diff --git a/.eslintignore b/.eslintignore index 1b84fb0bf..2d978e10c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,8 +8,6 @@ src/geom/polygon/Earcut.js src/utils/array/StableSort.js src/utils/object/Extend.js src/structs/RTree.js -src/dom/_ScaleManager.js -src/dom/VisualBounds.js plugins/spine/src/spine-canvas.js plugins/spine/src/spine-webgl.js webpack.* diff --git a/.eslintrc.json b/.eslintrc.json index f0680fd43..5cf14c39a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -85,7 +85,7 @@ "no-trailing-spaces": [ "error", { "skipBlankLines": true, "ignoreComments": true } ], "no-underscore-dangle": "off", "no-whitespace-before-property": "error", - "object-curly-newline": [ "error", { "multiline": true, "minProperties": 0 } ], + "object-curly-newline": [ "error", { "multiline": true, "minProperties": 0, "consistent": true } ], "one-var-declaration-per-line": [ "error", "initializations" ], "quote-props": [ "error", "as-needed" ], "quotes": [ "error", "single" ], diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 844990001..b58bade0a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -76,5 +76,5 @@ Thanks to Chad for creating the original Pixi.js Contributing file which we adap [1]: http://jsfiddle.net [2]: http://jsbin.com/ [3]: http://nodejs.org -[4]: http://www.html5gamedevs.com/forum/33-phaser-3/ +[4]: https://phaser.discourse.group/ [5]: https://codepen.io/pen?template=YeEWom "Phaser 3 game template" diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c49b33b07..73b1e5203 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,7 +9,7 @@ Thank you for taking the time to contribute towards Phaser. Before submitting yo 1. This repo is for Phaser 3 only. Phaser 2.x issues should be raised in the [Phaser CE](https://github.com/photonstorm/phaser-ce) repo. -2. This repo should not be used for technical support. If you're struggling to use Phaser then post your question to the [forum](http://www.html5gamedevs.com/forum/33-phaser-3/), [Slack](https://phaser.io/community/slack) or [Discord](https://phaser.io/community/discord) channels. GitHub Issues are for bugs and feature requests only. +2. This repo should not be used for technical support. If you're struggling to use Phaser then post your question to the [forum](https://phaser.discourse.group/), [Slack](https://phaser.io/community/slack) or [Discord](https://phaser.io/community/discord) channels. GitHub Issues are for bugs and feature requests only. 3. Make sure your issue isn't a duplicate, or has already been fixed. diff --git a/CHANGELOG.md b/CHANGELOG.md index 796de0510..11197f78e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,185 @@ # Change Log -## Version 3.16.0 - Ishikawa - in development +## Version 3.17.0 - Ishikawa - in dev -### Facebook Instant Games Updates and Fixes +Notes: -* Added the `Leaderboard.getConnectedScores` method, to get a list of scores from player connected entries. -* The `loadPlayerPhoto` function in the Instant Games plugin now listens for the updated Loader event correctly, causing the `photocomplete` event to fire properly. -* `Leaderboard.setScore` now emits the LeaderboardScore object with the `setscore` event, as the documentation said it did. -* `Leaderboard.getPlayerScore` now only populates the `playerScore` property if the entry isn't `null`. -* If the `setScore` or `getPlayerScore` calls fail, it will return `null` as the score instance, instead of causing a run-time error. -* You can now pass an object or a string to `setScore` and objects will be automatically stringified. -* The `preloadAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves. -* The `preloadVideoAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves. -* The `preloadAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load. -* The `preloadVideoAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load. -* The `showAd` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID. -* The `showVideo` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID. -* Showing an ad will emit the `adfinished` event when the ad is closed, previously this event was called `showad` but the new name better reflects what has happened. -* The Facebook Plugin is now available in the `Phaser.Scene` class template under the `facebook` property (thanks @bryanwood) +1) Vertex for any GO +2) Body Blocked +3) GO auto-add to Scene +4) GO move to another Scene + +### Arcade Physics + +#### New Features + +* `overlapTiles` is a new method that allows you to check for overlaps between a physics enabled Game Object and an array of Tiles. The Tiles don't have to have been enable for collision, or even be on the same layer, for the overlap check to work. You can provide your own process callback and/or overlap callback. This is handy for testing for overlap for a specific Tile in your map, not just based on a tile index. This is available via `this.physics.overlapTiles` and the World instance. +* `collideTiles` is a new method that allows you to check for collision between a physics enabled Game Object and an array of Tiles. The Tiles don't have to have been enable for collision, or even be on the same layer, for the collision to work. You can provide your own process callback and/or overlap callback. There are some limitations in using this method, please consult the API Docs for details, but on the whole, it allows for dynamic collision on small sets of Tile instances. This is available via `this.physics.collideTiles` and the World instance. +* `overlapRect` is a new method that allows you to return an array of all physics bodies within the given rectangular region of the World. It can return dynamic or static bodies and will use the RTree for super-fast searching, if enabled (which it is by default) + +#### Updates + +* `Body.preUpdate` is a new method that is called only once per game step. It resets all collision status properties and syncs the Body with the parent Game Object. +* `Body.update` has been rewritten to just perform one single physics step and no longer re-syncs with the Game Object. It can be called multiple times per game step, depending on the World FPS rate. +* `Body.postUpdate` has been rewritten to make it more compact. It syncs the body data back to the parent Game Object and is only called once per game step now (previously it was called whenever the Body updated) +* The `World.late` Set has been removed and is no longer populated, as it's no longer required. +* `World.update` now calls `Body.preUpdate` just once per game step, then calls `Body.update` as many times as is required as per the FPS setting, and no longer calls `Body.postUpdate` at all. +* `World.collideSpriteVsTilemapLayer` now returns a boolean if a collision or overlap happens, where-as before it didn't. +* `World.collideSpriteVsTilemapLayerHandler` is a new private method that handles all tilemap collision checks. +* The internal method `SeparateTile` now has a new argument `isLayer` which controls if the set comes from a layer or an array. +* The internal method `TileCheckX` now has a new argument `isLayer` which controls if the set comes from a layer or an array. +* The internal method `TileCheckY` now has a new argument `isLayer` which controls if the set comes from a layer or an array. + +#### Bug Fixes + +* The `Body.delta` values are now able to be read and acted upon during a Scene update, due to the new game step flow. This means you can now call `this.physics.collide` during a Scene `update` and it will work properly again. Fix #4370 (thanks @NokFrt) +* `ArcadePhysics.furthest` now iterates the bodies Set, rather than the RTree, which keeps it working even if the RTree has been disabled. +* `ArcadePhysics.closest` now iterates the bodies Set, rather than the RTree, which keeps it working even if the RTree has been disabled. + +### New Features + +* There is a new Game Config property `input.windowEvents` which is true by default. It controls if Phaser will listen for any input events on the Window. If you disable this, Phaser will stop being able to emit events like `POINTER_UP_OUTSIDE`, or be aware of anything that happens outside of the Canvas re: input. +* A Scene will now emit the new `CREATE` event after it has been created by the Scene Manager. If the Scene has a `create` method this event comes after that, so is useful to knowing when a Scene may have finished creating Game Objects, etc. (thanks @jackfreak) +* `Tilemap.removeTile` is a new method that allows you to remove a tile, or an array of tiles, by passing in references to the tiles themselves, rather than coordinates. The tiles can be replaced with new tiles of the given index, or removed entirely, and the method can optionally recalculate interesting faces on the layer. + +### Updates + +* Removed all references to CocoonJS from the API, including in the Device.OS object and elsewhere, as Cocoon is no longer. +* The MouseManager and TouchManager now use separate handlers for the Window level input events, which check to see if the canvas is the target or not, and redirect processing accordingly. +* `AnimationManager.generateFrameNumbers` can now accept a start number greater than the end number, and will generate them in reverse (thanks @cruzdanilo) +* The return from the `ScenePlugin.add` method has changed. Previously, it would return the ScenePlugin, but now it returns a reference to the Scene that was added to the Scene Manager, keeping it in-line with all other `add` methods in the API. Fix #4359 (thanks @BigZaphod) +* The `PluginManager.installScenePlugin` method has a new optional boolean parameter `fromLoader` which controls if the plugin is coming in from the result of a Loader operation or not. If it is, it no longer throws a console warning if the plugin already exists. This fixes an issue where if you return to a Scene that loads a Scene Plugin it would throw a warning and then not install the plugin to the Scene. +* The Scale Manager has a new event `FULLSCREEN_FAILED` which is fired if you try to enter fullscreen mode, but the browser rejects it for some reason. + +### Bug Fixes + +* The parent bounds are reset when exiting fullscreen mode in the Scale Manager. This fixes an issue when leaving fullscreen mode by pressing ESC (instead of programmatically) would leave the canvas in the full screen size. Fix #4357 (thanks @khutchins and @HeyStevenXu) +* `GetAdvancedValue` now uses the correct Math RND reference, which means anything that used the `randInt` or `randFloat` features of this function, such as creating a Sprite from a Config object, or Bitmap Text sizing, will no longer throw an error about a null object reference. Fix #4369 (thanks @sanadov) +* Trying to enter Fullscreen mode on Android / Chrome, or iOS / Safari, would throw an error regarding an unhandled Promise and a failure to invoke the event from a user gesture. This has been tightened up, using a proper Promise handler internally and the documentation clarified to explicitly say that you must call the function from a `pointerup` handler, and not `pointerdown`. Fix #4355 (thanks @matrizet) + +### Examples, Documentation and TypeScript + +My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs: + +@sky-coding @G-Rath @S4n60w3n @rootasjey @englercj @josephmbustamante + + +## Version 3.16.2 - Ishikawa - 11th February 2019 + +This is point release primarily fixes a few important issues that surfaced in 3.16.0. + +### Matter Pointer Constraint Changes + +The following changes all effect the Matter JS Pointer Constraint class: + +* Pointer handling has been changed to make more sense. In the previous version, pressing down and then moving the Pointer _over_ a body would start it being dragged, even if the pointer was pressed down well outside of the body bounds. Now, a body can only be dragged by actually pressing down on it, or any of its parts, which is more in-line with how input events should work. +* Previously, releasing ANY pointer would stop an object being dragged, even if it wasn't the one actually dragging a body, as in a multi-touch game. Bodies are now bound to the pointer which started their drag and only the release of that pointer will stop them. +* There is a new Matter Physics Event `DRAG_START` which is emitted by a Pointer Constraint when it starts dragging a body. Listen for this event from the Matter World instance. +* There is a new Matter Physics Event `DRAG` which is emitted by a Pointer Constraint as it drags a body. Listen for this event from the Matter World instance. +* There is a new Matter Physics Event `DRAG_END` which is emitted by a Pointer Constraint when it stops dragging a body. Listen for this event from the Matter World instance. +* The `camera` property can no longer be set in the config object. Instead it is set every time the Pointer is pressed down on a Body, this resolves issues where you have a multi-camera Scene and want to drag a body in the non-main camera. +* `body` is a new property that holds a reference to the Body being dragged, if any. +* `part` is a new property that holds a reference to the Body part that was clicked on which started the drag. +* The internal `getBodyPart` method has been renamed to `hitTestBody` to more accurately reflect what it does. +* The class no longer listens for the pointer `up` event, instead of tracks the active pointer and waits for that to be released. This has reduced the complexity and size of the `update` method considerably. +* `stopDrag` is a new method that allows you to manually stop an object being dragged, even if the pointer isn't released. +* This class now has 100% JSDocs. + +### Updates + +* `TileSprite.setTileScale` has been updated so that the `y` argument is optional and set to match the `x` argument, like `setScale` elsewhere in the API. +* `InputManager.time` is a new property that holds the most recent time it was updated from the Game step, which plugins can access. +* `InputManager.preStep` is a new method that populates some internal properties every step. +* `KeyboardPlugin.time` has moved from being a property to being a getter, which returns the time from the InputManager. +* The `scale` property has been added to the `Scene` class (thanks @strangeweekend) +* `Matter.World.remove` now uses the `Composite.remove` method internally. Previously, it used `Composite.removeBody` which only allowed it to remove bodies from the simulation. Now, it can remove any type of Matter object. +* When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it. +* Touch inputs will now trigger a `POINTER_OUT` event if they leave the game (i.e. are released), where-as before they would only trigger the `POINTER_UP` event. Now, both happen (thanks @rgk) + +### Bug Fixes + +* The `Mesh.setAlpha` method has been restored, even though it's empty and does nothing, to prevent runtime errors when adding a Mesh or Quad object to a Container. Fix #4338 #4343 (thanks @pfdtravalmatic @charmingny) +* `KeyboardPlugin.checkDown` would always fail if using the new event system, because the time value it was checking wasn't updated. +* Entering `Fullscreen` mode in the Scale Manager and then pressing ESC would leave the injected fullsceen div in the DOM, causing it to throw a node insertion failure the second time you wanted to enter fullscreen mode. Fix #4352 (thanks @ngdevr) +* Due to the changes in the Input event system, the `GAME_OUT` event would never fire unless the input system was in legacy mode. The OUT and OVER handlers have been refactored and will now fire as soon as the DOM event happens. As a result the `InputManager._emitIsOverEvent` property has been removed, as the native event is sent directly to the handler and doesn't need storing locally any more. Fix #4344 (thanks @RademCZ) +* Added `Zone.setBlendMode` method as a NOOP function, fixing a bug where if you added a Zone to a Container when running under Canvas it would fail. Fix #4295 (thanks @emanuel15) + +### Examples, Documentation and TypeScript + +My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs: + +@maretana @CipSoft-Components @brian-lui + +## Version 3.16.0 / 3.16.1 - Ishikawa - 5th February 2019 + +Phaser 3.16 is a massive update. The single largest in the history of Phaser 3 and it contains _breaking changes_. If you're upgrading from an earlier version please do check the log entries below. + +Please note: there is no difference between 3.16.0 and 3.16.1. The version bump was just to get around a stupid npm semver policy. + +### Important Namespace Changes + +* The `Phaser.Boot` namespace has been renamed to `Phaser.Core`. As a result, the `boot` folder has been renamed to `core`. This impacts the `TimeStep` class and `VisibilityHandler` function, which have been moved to be under the new namespace. +* The `Phaser.Animations` namespace was incorrectly exposed in the Phaser entrypoints as `Animation` (note the lack of plural). This means that if you are creating any custom classes that extend Animation objects using the Phaser namespace, then please update them from `Phaser.Animation` to `Phaser.Animations`, i.e. `Phaser.Animation.AnimationFrame` to `Phaser.Animations.AnimationFrame`. This doesn't impact you if you created animations directly via the Animation Manager. +* The keyed Data Manager change data event string has changed from `changedata_` to `changedata-` to keep it consistent with other keyed events. Note the change from `_` to `-`. +* The Keyboard Plugin `keydown` dynamic event string has changed from `keydown_` to `keydown-` to keep it consistent with other keyed events. Note the change from `_` to `-`. +* The Keyboard Plugin `keyup` dynamic event string has changed from `keyup_` to `keyup-` to keep it consistent with other keyed events. Note the change from `_` to `-`. +* The `texturesready` event emitted by the Texture Manager has been renamed to `ready`. +* The `loadcomplete` event emitted by the Loader Plugin has been renamed to `postprocess` to be reflect what it's used for. +* Game Objects used to emit a `collide` event if they had an Arcade Physics Body with `onCollide` set, that collided with a Tile. This has changed. The event has been renamed to `tilecollide` and you should now listen for this event from the Arcade Physics World itself: `this.physics.world.on('tilecollide')`. Game Objects no longer emit this event. +* Game Objects used to emit an `overlap` event if they had an Arcade Physics Body with `onOverlap` set, that overlapped with a Tile. This has changed. The event has been renamed to `tileoverlap` and you should now listen for this event from the Arcade Physics World itself: `this.physics.world.on('tileoverlap')`. Game Objects no longer emit this event. +* The function `Phaser.Physics.Impact.SeperateX` has been renamed to `SeparateX` to correct the spelling mistake. +* The function `Phaser.Physics.Impact.SeperateY` has been renamed to `SeparateY` to correct the spelling mistake. +* The `ended` event in `WebAudioSound` has been renamed to `complete` to make it more consistent with the rest of the API. +* The `ended` event in `HTML5AudioSound` has been renamed to `complete` to make it more consistent with the rest of the API. +* The `Phaser.Utils.Objects` namespace was incorrectly exposed in the Phaser entrypoints as `Object` (note the lack of plural), this has now been fixed so all associated functions are properly namespaced. +* `Phaser.GameObjects.Blitter.Bob` has been renamed to `Phaser.GameObjects.Bob` to avoid namespace conflicts in TypeScript. +* `Phaser.GameObjects.Text.TextStyle` has been renamed to `Phaser.GameObjects.TextStyle` to avoid namespace conflicts in TypeScript. + +### Important Changes to the Input System + +In Phaser 3.15 and earlier the Input system worked using an event queue. All native DOM input events, such as from the Mouse, Touch or Keyboard, were picked up by event handlers and stored in a queue within the Input Manager. This queue was then processed during the next game step, all the events were dealt with and then it was cleared, ready to receive more events. As they were processed, the internal Phaser events such as `pointerdown` or `keyup` were dispatched to your game code. + +This worked fine in that you were able to guarantee _exactly_ when the events would arrive, because it was always at the same time in the game step. However, it had the side effect of you not being able to do things like open external browser windows, or go into Full Screen mode, during your event handlers - because they weren't "real" events, so didn't pass the browser security checks. To this end, methods like `addUpCallback` were added to try and provide this support (although it was never possible for keyboard events). + +In 3.16 this has changed. The DOM Events now trigger the respective internal events immediately, in the same invocation. So if you click on the canvas, the `pointerdown` event you receive in your game is still part of the 'native' event handler, so you're now free to do things like go into full screen mode, or open external windows, without any browser warnings or work-arounds. + +It does, however, mean that the point at which these handlers are called is no longer always consistent, and is no longer bound to the speed of the Request Animation Frame update. We've tested as much as possible, and so far, things carry on working as before. We've noticed a slight increase in responsiveness, due to the removal of the fractional delay in processing the events, which feels good. However, if for whatever reason this change has broken your game then you're able to easily switch back to the previous version. In your Game Config, create an `input` object and give it the property `queue: true`. This will tell Phaser to use the legacy event queue system. + +Please note that we _will_ remove this legacy system in the near future. So, please try and adapt your games to use the new system. If you've found an edge-case where something breaks because of it, please report it so we can look into it. + +As a result of this change, the following are now deprecated: + +* `InputPlugin.addUpCallback` method. +* `InputPlugin.addDownCallback` method. +* `InputPlugin.addMoveCallback` method. +* `InputManager.queue` property. +* `InputManager.domCallbacks` property. +* `InputManager._hasUpCallback` property. +* `InputManager._hasDownCallback` property. +* `InputManager._hasMoveCallback` property. +* `InputManager.processDomCallbacks` method. +* `InputManager.addUpCallback` method. +* `InputManager.addDownCallback` method. +* `InputManager.addMoveCallback` method. + +### keydown and keyup changes + +Due to unification across the event system, the `keydown_` and `keyup_` dynamic event strings have changed. + +* In all cases the `keydown_KEY` event name has changed to `keydown-KEY`. Note the change from an underscore to a hyphen. +* In all cases the `keyup_KEY` event name has changed to `keyup-KEY`. Note the change from an underscore to a hyphen. + +You should update your game code accordingly. ### Keyboard Input - New Features -The specificity of the Keyboard events has been changed to allow you more control over event handling. Previously, the Keyboard Plugin would emit the global `keydown_CODE` event first (where CODE was a keycode string, like `keydown_A`), then it would emit the global `keydown` event. In previous versions, `Key` objects, created via `this.input.keyboard.addKey()`, didn't emit events. +The specificity of the Keyboard events has been changed to allow you more control over event handling. Previously, the Keyboard Plugin would emit the global `keydown-CODE` event first (where CODE was a keycode string, like `keydown-A`), then it would emit the global `keydown` event. In previous versions, `Key` objects, created via `this.input.keyboard.addKey()`, didn't emit events. The `Key` class now extends EventEmitter and emits two new events directly: `down` and `up`. This means you can listen for an event from a Key you've created, i.e.: `yourKey.on('up', handler)`. The order has also now changed. If it exists, the Key object will dispatch its `down` event first. Then the Keyboard Plugin will dispatch `keydown_CODE` and finally the least specific of them all, `keydown` will be dispatched. -You also now have the ability to cancel this at any stage either on a local or global level. All events handlers are sent an event object which you can call `event.stopImmediatePropagation()` on. This will immediately stop any further listeners from being invoked in the current Scene. Therefore, if you call `stopImmediatePropagation()` in the `Key.on` handler, then the Keyboard Plugin will not emit either the `keydown_CODE` or `keydown` global events. You can also call `stopImmediatePropagation()` during the `keydown_CODE` handler, to stop it reaching the global `keydown` handler. As `keydown` is last, calling it there has no effect. +You also now have the ability to cancel this at any stage either on a local or global level. All event handlers are sent an event object which you can call `event.stopImmediatePropagation()` on. This will immediately stop any further listeners from being invoked in the current Scene. Therefore, if you call `stopImmediatePropagation()` in the `Key.on` handler, then the Keyboard Plugin will not emit either the `keydown-CODE` or `keydown` global events. You can also call `stopImmediatePropagation()` during the `keydown-CODE` handler, to stop it reaching the global `keydown` handler. As `keydown` is last, calling it there has no effect. There is also the `stopPropagation()` function. This works in the same way as `stopImmediatePropagation` but instead of being local, it works across all of the Scenes in your game. For example, if you had 3 active Scenes (A, B and C, with A at the top of the Scene list), all listening for the same key, calling `stopPropagation()` in Scene A would stop the event from reaching any handlers in Scenes B or C. Remember that events flow down the Scene list from top to bottom. So, the top-most rendering Scene in the Scene list has priority over any Scene below it. @@ -58,10 +210,11 @@ Default captures can be defined in the Game Config in the `input.keyboard.captur #### Other Keyboard Updates and Fixes -* There is a new class called `KeyboardManager`. This class is created by the global Input Manager, if keyboard access has been enabled in the Game config. It's responsible for handling all browser keyboard events. Previously, the `KeyboardPlugin` did this. Which meant that every Scene that had its own Keyboard Plugin was binding more native keyboard events. This was causing problems with parallel Scenes when needing to capture keys. the `KeyboardPlugin` class still exists, and is still the main point of interface when you call `this.input.keyboard` in a Scene, but DOM event handling responsibility has been taken away from it. This means there's no only +* There is a new class called `KeyboardManager`. This class is created by the global Input Manager if keyboard access has been enabled in the Game config. It's responsible for handling all browser keyboard events. Previously, the `KeyboardPlugin` did this which meant that every Scene that had its own Keyboard Plugin was binding more native keyboard events. This was causing problems with parallel Scenes when needing to capture keys. the `KeyboardPlugin` class still exists, and is still the main point of interface when you call `this.input.keyboard` in a Scene, but DOM event handling responsibility has been taken away from it. This means there's now only one set of bindings ever created, which makes things a lot cleaner. * There is a new Game and Scene Config setting `input.keyboard.capture` which is an array of KeyCodes that the Keyboard Plugin will capture all non-modified key events on. By default it is empty. You can populate it in the config, or use the new capture methods. * The Keyboard Manager will now call `preventDefault` only on non-modified key presses, stopping the keyboard event from hitting the browser. Previously, capturing the R key, for example, would block a CTRL+R page reload, but it now ignores it because of the key modifier. +* If the browser Window loses focus, either from switching to another app, or another tab, all active Keys will be reset. This prevents issues with keys still reporting as being held down after leaving the game and returning to it again. Fix #4134 (thanks @Simplonium) * `Key.emitOnRepeat` is a new boolean property that controls if the Key will continuously emit a `down` event while being held down (true), or emit the event just once, on first press, and then skip future events (false). * `Key.setEmitOnRepeat` is a new chainable method for setting the `emitOnRepeat` property. * The `KeyboardPlugin.addKeys` method has a new optional boolean `emitOnRepeat` which sets that property on all Key objects it creates as part of the call. It defaults to `false`. @@ -83,60 +236,121 @@ one set of bindings ever created, which makes things a lot cleaner. * `KeyboardPlugin.target` has been removed as it's no longer used by the class. * `KeyboardPlugin.queue` has been removed as it's no longer used by the class. * `KeyboardPlugin.onKeyHandler` has been removed as it's no longer used by the class. +* `KeyboardPlugin.startListeners` has been removed as it's no longer used by the class. +* `KeyboardPlugin.stopListeners` has been removed as it's no longer used by the class. ### Mouse and Touch Input - New Features, Updates and Fixes * The Mouse Manager class has been updated to remove some commented out code and refine the `startListeners` method. * When enabling a Game Object for input it will now use the `width` and `height` properties of the Game Object first, falling back to the frame size if not found. This stops a bug when enabling BitmapText objects for input and it using the font texture as the hit area size, rather than the text itself. * `Pointer.smoothFactor` is a float-value that allows you to automatically apply smoothing to the Pointer position as it moves. This is ideal when you want something smoothly tracking a pointer in a game, or are need a smooth drawing motion for an art package. The default value is zero, meaning disabled. Set to a small number, such as 0.2, to enable. -* `Config.inputSmoothFactor` is a new property that allows you to set the smoothing factor for all Pointers the game creators. The default value is zero, which is disabled. Set in the game config as `input: { smoothFactor: value }`. +* `Config.inputSmoothFactor` is a new property that allows you to set the smoothing factor for all Pointers the game creates. The default value is zero, which is disabled. Set in the game config as `input: { smoothFactor: value }`. * `InputManager.transformPointer` has a new boolean argument `wasMove`, which controls if the pointer is being transformed after a move or up/down event. -* `Pointer.velocity` is a new Vector2 that contains the velocity of the Pointer, based on the current and previous positions. The velocity is smoothed out each frame, according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The velocity is updated based on Pointer movement, it doesn't require a button to be pressed first. -* `Pointer.angle` is a new property that contains the angle of the Pointer, in radians, based on the current and previous positions. The angle is smoothed out each frame, according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The angle is updated based on Pointer movement, it doesn't require a button to be pressed first. -* `Pointer.distance` is a new property that contains the distance of the Pointer, in radians, based on the current and previous positions. The distance is smoothed out each frame, according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The distance is updated based on Pointer movement, it doesn't require a button to be pressed first. -* `Pointer.motionFactor` is a new property that controls how much smoothing to apply to the Pointer positions each frame. This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current position of the Pointer. The default value is 0.2. +* `Pointer.velocity` is a new Vector2 that contains the velocity of the Pointer, based on the current and previous positions. The velocity is smoothed out each frame according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The velocity is updated based on Pointer movement and doesn't require a button to be pressed first. +* `Pointer.angle` is a new property that contains the angle of the Pointer, in radians, based on the current and previous positions. The angle is smoothed out each frame according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The angle is updated based on Pointer movement and doesn't require a button to be pressed first. +* `Pointer.distance` is a new property that contains the distance of the Pointer, in radians, based on the current and previous positions. The distance is smoothed out each frame according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The distance is updated based on Pointer movement and doesn't require a button to be pressed first. +* `Pointer.motionFactor` is a new property that controls how much smoothing to apply to the Pointer positions each frame. This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, angle and distance of the Pointer. It's applied every frame until the midPoint reaches the current position of the Pointer. The default value is 0.2. * The Input Plugin was emitting a `preUpdate` event, with the capital U, instead of `preupdate`. This has now been corrected. Fix #4185 (thanks @gadelan) * `Pointer.updateMotion` is a new method that is called automatically, each step, by the Input Manager. It's responsible for calculating the Pointer velocity, angle and distance properties. * `Pointer.time` is a new property that holds the time the Pointer was last updated by the Game step. * `Pointer.getDistance` has been updated. If called while a button is being held down, it will return the distance between the Pointer's current position and it's down position. If called when a Pointer doesn't have a button down, it will return the historic distance between the up and down positions. * `Pointer.getDistanceX` is a new method that will return the horizontal distance between the Pointer's previous and current coordinates. If called while a button is being held down, it will return the distance between the Pointer's current position and it's down position. If called when a Pointer doesn't have a button down, it will return the historic distance between the up and down positions. * `Pointer.getDistanceY` is a new method that will return the horizontal distance between the Pointer's previous and current coordinates. If called while a button is being held down, it will return the distance between the Pointer's current position and it's down position. If called when a Pointer doesn't have a button down, it will return the historic distance between the up and down positions. -* `Pointer.getDuration` is a new method that will return the duration the Pointer was held down for. If the Pointer has a button pressed down at the time this method is called, it will return the duration since the Pointer's was pressed down. If no button is held down, it will return the last recorded duration, based on the time the Pointer button was released. +* `Pointer.getDuration` is a new method that will return the duration the Pointer was held down for. If the Pointer has a button pressed down at the time this method is called, it will return the duration since the Pointer's button was pressed down. If no button is held down, it will return the last recorded duration, based on the time the Pointer button was released. * `Pointer.getAngle` is a new method that will return the angle between the Pointer coordinates. If the Pointer has a button pressed down at the time this method is called, it will return the angle between the Pointer's `downX` and `downY` values and the current position. If no button is held down, it will return the last recorded angle, based on where the Pointer was when the button was released. -* In previous versions, the VisibilityHandler would create a `mousedown` listener for the game canvas and then call `window.focus` when detected (assuming the game config `autoFocus` property was `true`). Responsibility for this has now been handled to the Mouse Manager `onMouseDown` handler. -* In previous versions, the VisibilityHandler would create a `mouseout` listener for the game canvas and then set `game.isOver` when detected. Responsibility for this has now been handled to the Mouse Manager, which sets the new Input Manager `isOver` property directly. -* In previous versions, the VisibilityHandler would create a `mouseover` listener for the game canvas and then set `game.isOver` when detected. Responsibility for this has now been handled to the Mouse Manager, which sets the new Input Manager `isOver` property directly. +* In previous versions, the VisibilityHandler would create a `mousedown` listener for the game canvas and then call `window.focus` when detected (assuming the game config `autoFocus` property was `true`). Responsibility for this has now been moved to the Mouse Manager `onMouseDown` handler. +* In previous versions, the VisibilityHandler would create a `mouseout` listener for the game canvas and then set `game.isOver` when detected. Responsibility for this has now been moved to the Mouse Manager, which sets the new Input Manager `isOver` property directly. +* In previous versions, the VisibilityHandler would create a `mouseover` listener for the game canvas and then set `game.isOver` when detected. Responsibility for this has now been moved to the Mouse Manager, which sets the new Input Manager `isOver` property directly. * The `Phaser.Game.isOver` property has been moved. You can now find it in the Input Manager and it's also accessible via the Input Plugin, which means you can do `this.input.isOver` from within a Scene. This makes more sense as it's input related and not a game level property. * The Input Plugin has a new event you can listen to: `gameover`, which is triggered whenever the mouse or a pointer is moved over the Game canvas. Listen to it with `this.input.on('gameover')` from within a Scene. * The Input Plugin has a new event you can listen to: `gameout`, which is triggered whenever the mouse or a pointer leaves the Game canvas. Listen to it with `this.input.on('gameout')` from within a Scene. * The Game used to emit a `mouseover` event when the mouse entered the game canvas. This is no longer emitted by the Game itself and can instead be listened for using the new Input Plugin event `gameover`. * The Game used to emit a `mouseout` event when the mouse left the game canvas. This is no longer emitted by the Game itself and can instead be listened for using the new Input Plugin event `gameout`. -* If the `window` object exists (which it will in normal browser environments) new `mouseup` and `touchend` event listeners are bound to it and trigger the normal `mouseup` or `touchend` events within the internal input system. This means if you will now get a `pointerup` event from the Input Plugin even if the pointer is released outside of the game canvas. Pointers will also no longer think they are still 'down' if released outside the canvas and then moved inside again in their new state. -* The window will now have focus called on it by the Touch Manager, as well as the Mouse Manager, is the `autoFocus` game config property is enabled. +* If the `window` object exists (which it will in normal browser environments) new `mouseup` and `touchend` event listeners are bound to it and trigger the normal `mouseup` or `touchend` events within the internal input system. This means you will now get a `pointerup` event from the Input Plugin even if the pointer is released outside of the game canvas. Pointers will also no longer think they are still 'down' if released outside the canvas and then moved inside again in their new state. +* The window will now have focus called on it by the Touch Manager, as well as the Mouse Manager, if the `autoFocus` game config property is enabled. * The Input Plugin has a new event you can listen to: `pointerdownoutside`, which is triggered whenever the mouse or a pointer is pressed down while outside of the Game canvas. Listen to it with `this.input.on('pointerdownoutside')` from within a Scene. -* The Input Plugin has a new event you can listen to: `pointerupoutside`, which is triggered whenever the mouse or a pointer is released while outside of the Game canvas. Listen to it with `this.input.on('pointerupoutside')` from within a Scene. +* The Input Plugin has a new event you can listen to: `pointerupoutside`, which is triggered whenever the mouse or a pointer is released while outside of the Game canvas. Listen to it with `this.input.on('pointerupoutside')` from within a Scene. * `Pointer.downElement` is a new property that holds the target of the DOM Event that triggered when the Pointer was pressed down. If this is within the game, this will be the game canvas element. * `Pointer.upElement` is a new property that holds the target of the DOM Event that triggered when the Pointer was released. If this is within the game, this will be the game canvas element. +* The `Pointer.dragState` property has been removed. This is no longer used internally as it has to be tracked per Scene, not on a global level. +* `InputPlugin.setDragState` is a new internal method that sets the drag state for the given Pointer. +* `InputPlugin.getDragState` is a new internal method that gets the drag state for the given Pointer. +* Draggable Game Objects would not work if you had multiple Scenes running in parallel, with draggable objects in both of them. Only the top-most Scene would work fully. Items in the bottom Scene would never finish their drag cycle, causing them to get stuck. Fix #4249 #4278 (thanks @probt @iArePJ) +* `Pointer.leftButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner). +* `Pointer.rightButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner). +* `Pointer.middleButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner). +* `Pointer.backButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner). +* `Pointer.forwardButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner). +* `Pointer.up`, `Pointer.move` and `Pointer.down` now use `in` to check for the existance of the `buttons` property on the event, causing it to be set even if equal to zero, which it is when there are no buttons down. This also fixes an issue where the buttons didn't update during a move event (thanks @SonnyCampbell @rexrainbow) + +### Changes as a result of the new Scale Manager + +3.16 introduces the completed Scale Manager. This is fully documented, but the class, all methods and all properties. It also includes a folder full of examples in the Phaser Labs, so you're strongly recommended to start there. + +* If you set the Game Config property `zoom` to be > 1 then it will automatically enable `pixelArt` mode, unless you set `pixelArt: false` in the config. +* There is a new property in the Game Config called `autoRound`, which controls if the canvas size and style sizes are passed through Math.floor or not. On some devices this can help with performance and anti-aliasing. The default is `false` (turned off). +* The Game Config property `autoResize` has been removed as it's now redundant. +* The WebGL and Canvas Renderers no longer change the Canvas size in their `resize` methods. They just update internal properties. +* The WebGL and Canvas Renderers now read the `width`, `height` and `resolution` values from the Scale Manager, not the Game Config. +* `CameraManager.baseScale` property has been removed as it's no longer used anywhere. +* The BaseCamera and Camera `preRender` methods now only take a resolution argument and use it internally for their transforms. +* `InputManager.scaleManager` is a new property that is a reference to the Scale Manager. This is populated in the `boot` method. +* The `InputManager.transformX` method has been removed. This is now available in the ScaleManager. +* The `InputManager.transformY` method has been removed. This is now available in the ScaleManager. +* The `InputManager.scale` property has been removed. This is now available in the ScaleManager under `displayScale`. +* The `InputManager.resize` method has been removed as this process is now handled by the ScaleManager. +* The `InputManager.bounds` property has been removed as this process is now handled by the ScaleManager. +* The `InputManager.updateBounds` method has been removed as this process is now handled by the ScaleManager. +* The `InputManager.getOffsetX` method has been removed as it's no longer required. +* The `InputManager.getOffsetY` method has been removed as it's no longer required. +* The `InputManager.getScaleX` method has been removed as it's no longer required. +* The `InputManager.getScaleY` method has been removed as it's no longer required. +* The `SceneManager.resize` method has been removed as it's no longer required. +* The `Scene.Systems.resize` method has been removed as it's no longer required. +* Scenes will no longer dispatch the `resize` event. You should now listen for this event from the Scale Manager instead. +* `BaseCamera.config` has been removed as it's no longer required. +* `BaseCamera.scaleManager` is a new property that references the Scale Manager and is used internally for size checks. +* The `Game.resize` method has been removed as it's no longer required. You should now call `ScaleManager.resize` instead. +* The Game will no longer dispatch the `resize` event. You should now listen for this event from the Scale Manager instead. + +### Facebook Instant Games Updates and Fixes + +* Added the `Leaderboard.getConnectedScores` method, to get a list of scores from player connected entries. +* The `loadPlayerPhoto` function in the Instant Games plugin now listens for the updated Loader event correctly, causing the `photocomplete` event to fire properly. +* `Leaderboard.setScore` now emits the LeaderboardScore object with the `setscore` event, as the documentation said it did. +* `Leaderboard.getPlayerScore` now only populates the `playerScore` property if the entry isn't `null`. +* If the `setScore` or `getPlayerScore` calls fail, it will return `null` as the score instance, instead of causing a run-time error. +* You can now pass an object or a string to `setScore` and objects will be automatically stringified. +* The `preloadAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves. +* The `preloadVideoAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves. +* The `preloadAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load. +* The `preloadVideoAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load. +* The `showAd` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID. +* The `showVideo` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID. +* Showing an ad will emit the `adfinished` event when the ad is closed, previously this event was called `showad` but the new name better reflects what has happened. +* The Facebook Plugin is now available in the `Phaser.Scene` class template under the `facebook` property (thanks @bryanwood) +* Fixed the `Leaderboard.getScores` method to now take the arguments into account. Fix #4271 (thanks @Oramy) +* Fixed an API validation error in the `chooseContext` method. Fix #4248 (thanks @yadurajiv) ### New Features * You can now load external Scene files using the new `load.sceneFile` method. This allows you to dynamically load a Scene into the Scene Manager of your game, and swap to it at will. Please see the documentation and examples for further details. * The data object being sent to the Dynamic Bitmap Text callback now has a new property `parent`, which is a reference to the Bitmap Text instance that owns the data object (thanks ornyth) * The WebGL Renderer has a new method `clearPipeline`, which will clear down the current pipeline and reset the blend mode, ready for the context to be passed to a 3rd party library. -* The WebGL Renderer has a new method `rebindPipeline`, which will rebind the given pipeline instance, reset the blank texture and reset the blend mode. Which is useful for recovering from 3rd party libs that have modified the gl context. +* The WebGL Renderer has a new method `rebindPipeline`, which will rebind the given pipeline instance, reset the blank texture and reset the blend mode. This is useful for recovering from 3rd party libs that have modified the gl context. * Game Objects have a new property called `state`. Use this to track the state of a Game Object during its lifetime. For example, it could move from a state of 'moving', to 'attacking', to 'dead'. Phaser itself will never set this property, although plugins are allowed to. * Game Objects have a new method called `setState` which will set the state property in a chainable call. -* `BlendModes.ERASE` is a new blend mode that will erase the object being drawn. When used in conjunction with a Render Texture it allows for effects that let you erase parts of the texture, in either Canvas or WebGL. When used with a transparent game canvas, it allows you to erase parts of the canvas, showing the web page background through. -* `BlendModes.SOURCE_IN` is a new Canvas-only blend mode, that allows you to use the `source-in` composite operation when rendering Game Objects. -* `BlendModes.SOURCE_OUT` is a new Canvas-only blend mode, that allows you to use the `source-out` composite operation when rendering Game Objects. -* `BlendModes.SOURCE_ATOP` is a new Canvas-only blend mode, that allows you to use the `source-atop` composite operation when rendering Game Objects. -* `BlendModes.DESTINATION_OVER` is a new Canvas-only blend mode, that allows you to use the `destination-over` composite operation when rendering Game Objects. -* `BlendModes.DESTINATION_IN` is a new Canvas-only blend mode, that allows you to use the `destination-in` composite operation when rendering Game Objects. -* `BlendModes.DESTINATION_OUT` is a new Canvas-only blend mode, that allows you to use the `destination-out` composite operation when rendering Game Objects. -* `BlendModes.DESTINATION_ATOP` is a new Canvas-only blend mode, that allows you to use the `destination-atop` composite operation when rendering Game Objects. -* `BlendModes.LIGHTER` is a new Canvas-only blend mode, that allows you to use the `lighter` composite operation when rendering Game Objects. -* `BlendModes.COPY` is a new Canvas-only blend mode, that allows you to use the `copy` composite operation when rendering Game Objects. -* `BlendModes.XOR` is a new Canvas-only blend mode, that allows you to use the `xor` composite operation when rendering Game Objects. +* `BlendModes.ERASE` is a new blend mode that will erase the object being drawn. When used in conjunction with a Render Texture it allows for effects that require you to erase parts of the texture, in either Canvas or WebGL. When used with a transparent game canvas, it allows you to erase parts of the canvas, showing the web page background through. +* `BlendModes.SOURCE_IN` is a new Canvas-only blend mode that allows you to use the `source-in` composite operation when rendering Game Objects. +* `BlendModes.SOURCE_OUT` is a new Canvas-only blend mode that allows you to use the `source-out` composite operation when rendering Game Objects. +* `BlendModes.SOURCE_ATOP` is a new Canvas-only blend mode that allows you to use the `source-atop` composite operation when rendering Game Objects. +* `BlendModes.DESTINATION_OVER` is a new Canvas-only blend mode that allows you to use the `destination-over` composite operation when rendering Game Objects. +* `BlendModes.DESTINATION_IN` is a new Canvas-only blend mode that allows you to use the `destination-in` composite operation when rendering Game Objects. +* `BlendModes.DESTINATION_OUT` is a new Canvas-only blend mode that allows you to use the `destination-out` composite operation when rendering Game Objects. +* `BlendModes.DESTINATION_ATOP` is a new Canvas-only blend mode that allows you to use the `destination-atop` composite operation when rendering Game Objects. +* `BlendModes.LIGHTER` is a new Canvas-only blend mode that allows you to use the `lighter` composite operation when rendering Game Objects. +* `BlendModes.COPY` is a new Canvas-only blend mode that allows you to use the `copy` composite operation when rendering Game Objects. +* `BlendModes.XOR` is a new Canvas-only blend mode that allows you to use the `xor` composite operation when rendering Game Objects. * `RenderTexture.erase` is a new method that will take an object, or array of objects, and draw them to the Render Texture using an ERASE blend mode, resulting in them being removed from the Render Texture. This is really handy for making a bitmap masked texture in Canvas or WebGL (without using an actual mask), or for 'cutting away' part of a texture. * There is a new boolean Game Config property called `customEnvironment`. If set to `true` it will skip the internal Feature checks when working out which type of renderer to create, allowing you to run Phaser under non-native web environments. If using this value, you _must_ set an explicit `renderType` of either CANVAS or WEBGL. It cannot be left as AUTO. Fix #4166 (thanks @jcyuan) * `Animation.nextFrame` will advance an animation to the next frame in the sequence instantly, regardless of the animation time or state. You can call this on a Sprite: `sprite.anims.nextFrame()` (thanks rgk25) @@ -145,8 +359,8 @@ one set of bindings ever created, which makes things a lot cleaner. * `Geom.Line.GetNearestPoint` is a new static method that will return the nearest point on a line to the given point. * `Geom.Line.GetShortestDistance` is a new static method that will return the shortest distance from a line to the given point. * `Camera.getBounds` is a new method that will return a rectangle containing the bounds of the camera. -* `Camera.centerOnX` will move the camera horizontally to be centered on the given coordinate, without changing its vertical placement. -* `Camera.centerOnY` will move the camera vertically to be centered on the given coordinate, without changing its horizontally placement. +* `Camera.centerOnX` will move the camera horizontally to be centered on the given coordinate without changing its vertical placement. +* `Camera.centerOnY` will move the camera vertically to be centered on the given coordinate without changing its horizontally placement. * `AnimationManager.exists` is a new method that will check to see if an Animation using the given key already exists or not and returns a boolean. * `animationstart-key` is a new Animation key specific event emitted by a Game Object. For example, if you had an animation with a key of 'explode' you can now listen for `animationstart-explode`. * `animationrestart-key` is a new Animation key specific event emitted by a Game Object. For example, if you had an animation with a key of 'explode' you can now listen for `animationrestart-explode`. @@ -163,6 +377,29 @@ one set of bindings ever created, which makes things a lot cleaner. * `CanvasTexture.setPixel` is a new method that sets the given pixel in the CanvasTexture to the color and alpha values provided. * `CanvasTexture.getData` is a new method that will extract an ImageData block from the CanvasTexture from the region given. * `CanvasTexture.putData` is a new method that will put an ImageData block at the given coordinates in a CanvasTexture. +* `Line.Extend` is a new static function that allows you extend the start and/or end points of a Line by the given amounts. +* `Vector2.LEFT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector2.RIGHT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector2.UP` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector2.DOWN` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector2.ONE` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.ZERO` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.LEFT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.RIGHT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.UP` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.DOWN` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.FORWARD` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.BACK` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* `Vector3.ONE` is a new constant that can be used in Vector comparison operations (thanks @Aedalus) +* Geometery Mask has a new property called `invertAlpha` in WebGL, which works in the same way as the flag on the Bitmap Mask and allows you to invert the function of the stencil buffer, i.e. non-drawn shapes become invisible, and drawn shapes visible (thanks @tfelix) +* The Arcade Physics Body has a new property `maxSpeed` which limits the vector length of the Body velocity. You can set it via the method `setMaxSpeed` and it is applied in the `World.computeVelocity` method (thanks @Edwin222 @rexrainbow) +* `WebGLRenderer.snapshotArea` is a new method that allows you to grab an image of the given region of the canvas during the post-render step and have it sent to your defined callback. This is the same as `snapshot` except you control the area being grabbed, so is more efficient if you only need a smaller area. +* `WebGLRenderer.snapshotPixel` is a new method that allows you to grab a single pixel from the game canvas, post-render. It returns the result as a `Color` object to your specified callback. +* `CanvasRenderer.snapshotArea` is a new method that allows you to grab an image of the given region of the canvas during the post-render step and have it sent to your defined callback. This is the same as `snapshot` except you control the area being grabbed, so is more efficient if you only need a smaller area. +* `CanvasRenderer.snapshotPixel` is a new method that allows you to grab a single pixel from the game canvas, post-render. It returns the result as a `Color` object to your specified callback. +* `SceneManager.getScenes` is a new method that will return all current Scenes being managed by the Scene Manager. You can optionally return only active scenes and reverse the order in which they are returned in the array. +* `DOM.GetTarget` is a new helper function that will return a reference to a DOM Element based on the given string or node. +* `GameObjects.Extern` is a new special type of Game Object that allows you to pass rendering off to a 3rd party. When you create an Extern and place it in the display list of a Scene, the renderer will process the list as usual. When it finds an Extern it will flush the current batch, clear down the pipeline and prepare a transform matrix which your render function can take advantage of, if required. The Extern Game Object is used heavily by the Spine Plugin, but can also be used by other libraries such as three.js, allowing them to render directly into a Phaser game. ### Updates @@ -176,8 +413,8 @@ one set of bindings ever created, which makes things a lot cleaner. * MATH_CONST no longer requires or sets the Random Data Generator, this is now done in the Game Config, allowing you to require the math constants without pulling in a whole copy of the RNG with it. * The Dynamic Bitmap Text Canvas Renderer was creating a new data object every frame for the callback. It now uses the `callbackData` object instead, like the WebGL renderer does. * `WebGLRenderer.setBlendMode` has a new optional argument `force`, which will force the given blend mode to be set, regardless of the current settings. -* The method `DisplayList.sortGameObjects` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used. The display list is automatically sorted anyway, so if you need to sort a small section of it, just use the standard JavaScript Array sort method (thanks ornyth) -* The method `DisplayList.getTopGameObject` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used (thanks ornyth) +* The method `DisplayList.sortGameObjects` has been removed. It has thrown a runtime error since v3.3.0(!) which no-one even spotted which is a good indication of how little the method was used. The display list is automatically sorted anyway, so if you need to sort a small section of it, just use the standard JavaScript Array sort method (thanks ornyth) +* The method `DisplayList.getTopGameObject` has been removed. It has thrown a runtime error since v3.3.0(!) which no-one even spotted which is a good indication of how little the method was used (thanks ornyth) * `WebGLRenderer.setFramebuffer` has a new optional boolean argument `updateScissor`, which will reset the scissor to match the framebuffer size, or clear it. * `WebAudioSoundManager.onFocus` will not try to resume the Audio Context if it's still locked. * `WebAudioSoundManager.onBlur` will not try to suspend the Audio Context if it's still locked. @@ -203,6 +440,24 @@ one set of bindings ever created, which makes things a lot cleaner. * `WebGLRenderer.pushScissor` now has a new optional argument `drawingBufferHeight` which allows you to specify the drawing buffer height, rather than use the renderers default value. * `WebGLRenderer.preRender` now calls `gl.clearColor` in order to restore the background clear color in case something, like a Render Texture, has changed it. * `Map.set` will now update an existing value if you provide it with a key that already exists within the Map. Previously, if you tried to set the value of a key that existed it would be skipped. +* `MatterSprite` would set its `type` property to be `Image`. It now sets it to be `Sprite` as it should do. +* `Matter.TileBody.setFromTileCollision` no longer checks if the shape is concave or convex before modifying the vertices, as the update to the Matter.js lib in 3.12 stopped this from working with Tiled collision shapes. +* The Scene `transitionstart` event is now dispatched by the Target Scene of a transition, regardless if the Scene has a `create` method or not. Previously, it was only dispatched if the Scene had a create method. +* The Loader will now allow an XHR status of 0 as success too. Normally only status 200 would be accepted as success, but 0 is returned when a file is loaded from the local filesystem (file://). This happens, for example, when opening the index.html of a game in a browser directly, or when using Cordova on iOS. Fix #3464 (thanks @Ithamar) +* `Tween.restart` now returns the Tween instance (thanks @rexrainbow) +* `Tween.play` now returns the Tween instance (thanks @rexrainbow) +* `Tween.seek` now returns the Tween instance (thanks @rexrainbow) +* `Tween.complete` now returns the Tween instance (thanks @rexrainbow) +* `Tween.stop` now returns the Tween instance (thanks @rexrainbow) +* `List.sort` now has an optional parameter `handler` which allows you to provide your own sort handling function (thanks @jcyuan) +* `Container.sort` now has an optional parameter `handler` which allows you to provide your own sort handling function (thanks @jcyuan) +* The WebGLRenderer method `canvasToTexture` will now only set the filter to be `NEAREST` if `antialias` is disabled in the game config (i.e. when running in pixelArt mode). This means that Text objects, and other Canvas backed textures, now render with anti-aliasing if everything else does. You can disable this on a per-object basis by calling `texture.setFilter(1)` on them. +* `CanvasRenderer.snapshotCallback`, `snapshotType` and `snapshotEncoder` have all been removed as they are no longer required. +* `CanvasRenderer.snapshotState` is a new object that contains the snapshot configuration data, the same as the WebGL Renderer. +* The signature of the `WebGLSnapshot` function has changed. It now takes a Snapshot Configuration object as the second parameter. +* The signature of the `CanvasSnapshot` function has changed. It now takes a Snapshot Configuration object as the second parameter. +* A Tween Timeline will now set it's internal destroy state _before_ calling either the `onComplete` callback or sending the `COMPLETE` event. This means you can now call methods that will change the state of the Timeline, such as `play`, during the callback handlers, where-as before doing this would have had the internal state changed immediately, preventing it (thanks Lucas Knight) +* The `AddToDOM` method has had the `overflowHidden` argument removed. The DOM element the canvas is inserted into no longer has `overflow: hidden` applied to its style. If you wish to have this, please add it directly via CSS. ### Bug Fixes @@ -212,7 +467,7 @@ one set of bindings ever created, which makes things a lot cleaner. * Disabling camera bounds and then moving the camera to an area in a Tilemap that did not have any tile information would throw an `Uncaught Reference error` as it tried to access tiles that did not exist (thanks @Siyalatas) * Fixed an issue where Sprite Sheets being extracted from a texture atlas would fail if the sheet was either just a single column or single row of sprites. Fix #4096 (thanks @Cirras) * If you created an Arcade Physics Group without passing a configuration object, and passing an array of non-standard children, it would throw a classType runtime error. It now creates a default config object correctly (thanks @pierpo) -* The `Camera.cull` method has been restructured so it now calculates if a Game Object is correctly in view or not, before culling it. Although not used internally, if you need to cull objects for a camera, you can now safely use this method. Fix #4092 (thanks @Cirras) +* The `Camera.cull` method has been restructured so it now calculates if a Game Object is correctly in view or not before culling it. Although not used internally, if you need to cull objects for a camera, you can now safely use this method. Fix #4092 (thanks @Cirras) * The Tiled Parser would ignore animated tile data if it was in the new Tiled 1.2 format. This is now accounted for, as well as 1.0 (thanks @nkholski) * `Array.Matrix.ReverseRows` was actually reversing the columns, but now reverses the rows. * `Array.Matrix.ReverseColumns` was actually reversing the rows, but now reverses the columns. @@ -221,52 +476,62 @@ one set of bindings ever created, which makes things a lot cleaner. * Render Textures created larger than the size of the default canvas would be automatically clipped when drawn to in WebGL. They now reset the gl scissor and drawing height property in order to draw to their full size, regardless of the canvas size. Fix #4139 (thanks @chaoyang805 @iamchristopher) * The `cameraFilter` property of a Game Object will now allow full bitmasks to be set (a value of -1), instead of just those > 0 (thanks @stuartkeith) * The `PathFollower.startFollow` method now properly uses the `startAt` argument to the method, so you can start a follower off at any point along the path. Fix #3688 (thanks @DannyT @diteix) -* Static Circular Arcade Physics Bodies now render as circles in the debug display, instead of showing their rectangle bounds (thanks @maikthomas) -* Changing the mute flag on an `HTML5AudioSound` instance, via the `mute` setter, now works, as it does via the Sound Manager (thanks @Waclaw-I @neon-dev) -* Changing the volume on an `HTML5AudioSound` instance, via the `volume` setter, now works, as it does via the Sound Manager (thanks @Waclaw-I) +* Static Circular Arcade Physics Bodies now render as circles in the debug display instead of showing their rectangle bounds (thanks @maikthomas) +* Changing the mute flag on an `HTML5AudioSound` instance, via the `mute` setter, now works as it does via the Sound Manager (thanks @Waclaw-I @neon-dev) +* Changing the volume on an `HTML5AudioSound` instance, via the `volume` setter, now works as it does via the Sound Manager (thanks @Waclaw-I) * The Dynamic Tilemap Layer WebGL renderer was drawing tiles at the incorrect position if the layer was scaled. Fix #4104 (thanks @the-realest-stu) -* `Tile.tileset` now returns the specific Tileset associated with the tile, rather than an array of them. Fix #4095 (thanks @quadrupleslap) +* `Tile.tileset` now returns the specific Tileset associated with the tile rather than an array of them. Fix #4095 (thanks @quadrupleslap) * `Tile.getCollisionGroup` wouldn't return the correct Group after the change to support multiple Tilesets. It now returns the group properly (thanks @jbpuryear) * `Tile.getTileData` wouldn't return the correct data after the change to support multiple Tilesets. It now returns the tile data properly (thanks @jbpuryear) * The `GetTileAt` and `RemoveTileAt` components would error with "Cannot read property 'index' of undefined" if the tile was undefined rather than null. It now handles both cases (thanks @WaSa42) * Changing `TileSprite.width` or `TileSprite.height` will now flag the texture as dirty and call `updateDisplayOrigin`, allowing you to resize TileSprites dynamically in both Canvas and WebGL. -* `RandomDataGenerator.shuffle` has been fixed to use the proper modifier in the calculation, allowing for a more even distribution (thanks wayfinder) -* The Particle Emitter was not recycling dead particles correctly, so it was creating new objects every time it emitted (the old particles were then left to the browsers gc to clear up). This has now been recoded, so the emitter will properly keep track of dead particles and re-use them (thanks @Waclaw-I for the initial PR) +* `RandomDataGenerator.shuffle` has been fixed to use the proper modifier in the calculation allowing for a more even distribution (thanks wayfinder) +* The Particle Emitter was not recycling dead particles correctly so it was creating new objects every time it emitted (the old particles were then left to the browsers gc to clear up). This has now been recoded so the emitter will properly keep track of dead particles and re-use them (thanks @Waclaw-I for the initial PR) * `ParticleEmitter.indexSortCallback` has been removed as it's no longer required. -* `Particle.index` has been removed, as it's no longer required. Particles don't need to keep track of their index any more. +* `Particle.index` has been removed as it's no longer required. Particles don't need to keep track of their index any more. * The Particle Emitter no longer needs to call the StableSort.inplace during its preUpdate, saving cpu. -* `Particle.resetPosition` is a new method that is called when a particle dies, preparing it ready for firing again in the future. +* `Particle.resetPosition` is a new method that is called when a particle dies preparing it for firing again in the future. * The Canvas `SetTransform` method would save the context state, but it wasn't restored at the end in the following Game Objects: Dynamic Bitmap Text, Graphics, Arc, Curve, Ellipse, Grid, IsoBox, IsoTriangle, Line, Polygon, Rectangle, Star and Triangle. These now all restore the context, meaning if you're using non-canvas sized cameras in Canvas mode, it will now render beyond just the first custom camera. * `Utils.Array.MoveUp` wouldn't let you move an array element to the top-most index in the array. This also impacted `Container.moveUp`. * The Texture Tint Pipeline had a logic error that would cause every 2001st quad to either be invisible, or pick-up the texture of the 2000th quad by mistake. The `batchQuad` and `batchTri` methods how handle re-assigning the batch texture if they cause a batch flush as part of their process. -* Rotating Sprites that used a Normal Map wouldn't rotate the normal map with it, causing the lighting effects to become irregular. The normal map vectors are now rotated correctly (thanks @sercant for the PR and @fazzamatazz and @ysraelJMM for the report) +* Rotating Sprites that used a Normal Map wouldn't rotate the normal map with it causing the lighting effects to become irregular. The normal map vectors are now rotated correctly (thanks @sercant for the PR and @fazzamatazz and @ysraelJMM for the report) * Changing `scaleX` or `scaleY` on a `MatterImage` or `MatterSprite` would cause the body scale to become distorted as the setters didn't use the correct factor when resetting the initial scale. Fix #4206 (thanks @YannCaron) * `StaticBody.reset` in Arcade Physics would ignore the `x` and `y` values given to it. If given, they're now used to reset the parent Game Object before the body is updated. Fix #4224 (thanks @samme) -* Static Tilemap Layers wouldn't render correctly if the layer used a tileset with a different size to the base map data (set via `setBaseTileSize`). They now render correctly in WebGL and Canvas, regardless of the base tile size. +* Static Tilemap Layers wouldn't render correctly if the layer used a tileset with a different size to the base map data (set via `setBaseTileSize`). They now render correctly in WebGL and Canvas regardless of the base tile size. * When using `RenderTexture.fill`, the `alpha` argument would be ignored in Canvas mode. It's now used when filling the RenderTexture. -* Fixed an issue in `WebGLRenderer.setScissor` where it was possible to try and compare the scissor size to a non-current scissor, if called outside of the render loop (i.e. from `RenderTexture.fill`) (thanks @hackhat) +* Fixed an issue in `WebGLRenderer.setScissor` where it was possible to try and compare the scissor size to a non-current scissor if called outside of the render loop (i.e. from `RenderTexture.fill`) (thanks @hackhat) * `RenderTexture.fill` in WebGL would use `gl.clear` and a clear color to try and fill the Render Texture. This only worked for full-canvas sized RenderTextures that didn't have a camera zoom applied. It has now been swapped to use the `drawFillRect` method of the Texture Tint Pipeline, allowing it to work properly regardless of camera zoom or size. -* `Container.getFirst` was using an incorrect Array Utils function `GetFirstElement`, when it should have been using `GetFirst`. It now uses the correct function. Fix #4244 (thanks @miran248) -* `List.getFirst` was using an incorrect Array Utils function `GetFirstElement`, when it should have been using `GetFirst`. It now uses the correct function. Fix #4244 (thanks @miran248) -* Fixed an issue where changing the viewport or size of a Camera belonging to a RenderTexture, it wouldn't impact the rendering and objects will still render outside of the viewport range. It's now converted to a proper gl scissor rect by the renderer, meaning you can limit the area rendered to by adjusting the internal Render Texture cameras viewport. Fix #4243 (thanks @hackhat) +* `Container.getFirst` was using an incorrect Array Utils function `GetFirstElement` when it should have been using `GetFirst`. It now uses the correct function. Fix #4244 (thanks @miran248) +* `List.getFirst` was using an incorrect Array Utils function `GetFirstElement` when it should have been using `GetFirst`. It now uses the correct function. Fix #4244 (thanks @miran248) +* Fixed an issue where changing the viewport or size of a Camera belonging to a RenderTexture wouldn't impact the rendering and objects will still render outside of the viewport range. It's now converted to a proper gl scissor rect by the renderer, meaning you can limit the area rendered to by adjusting the internal Render Texture cameras viewport. Fix #4243 (thanks @hackhat) * `CanvasTexture.destroy` is a new method that specifically handles the destruction of the CanvasTexture and all of its associated typed arrays. This prevents a memory leak when creating and destroying lots of RenderTextures (which are CanvasTexture backed). Fix #4239 (thanks @sjb933) * The Alpha, Flip and Origin components have been removed from the Mesh Game Object (and by extension, Quad as well) as they are not used in the renderer and should be manipulated via the Mesh properties. Fix #4188 (thanks @enriqueto) +* The `processDomCallbacks` method in the Input Manager wasn't correctly clearing the `once` arrays. Responsibility for this has now been passed to the queue methods `queueTouchStart`, `queueTouchMove`, `queueTouchEnd`, `queueMouseDown`, `queueMouseMove` and `queueMouseUp`. Fix #4257 (thanks @iArePJ) +* Arcade Physics now manages when `postUpdate` should be applied better, stopping it from gaining a zero delta during a further check in the same frame. This fixes various issues, including the mass collision test demo. Fix #4154 (thanks @samme) +* Arcade Physics could trigger a `collide` event on a Body even if it performing an overlap check, if the `onCollide` property was true (thanks @samme) +* TileSprites no longer cause a crash when using the Headless mode renderer. Fix #4297 (thanks @clesquir) +* The WebGLRenderer will now apply a transparent background if `transparent = true` in the game config (thanks @gomachan7) +* `List.sort` was missing the scope required for the sort handler, this is now correctly provided internally. Fix #4241 (thanks @jcyuan) +* `Container.sort` was missing the scope required for the sort handler, this is now correctly provided internally. Fix #4241 (thanks @jcyuan) +* `DataManager.pop` would emit the DataManager instance, instead of the parent, as the first event argument. It now emits the parent as it should do. Fix #4186 (thanks @gadelan) +* The `GetValue` function wasn't checking for the existance of '.' in the config property name correctly, causing the branch to always be taken (thanks @kyranet) +* Safari had permission problems playing HTML5 Audio files on Mac OS. Due to the changes in the input event system audio now plays properly based on user interactions. You still can't play it automatically, though, it will always require a user gesture to begin. Fix #4217 (thanks @increpare) ### Examples and TypeScript Thanks to the following for helping with the Phaser 3 Examples and TypeScript definitions, either by reporting errors, or even better, fixing them: -@guilhermehto @samvieten @darkwebdev @RoryO @snowbillr @slothyrulez @jcyuan @jestarray +@guilhermehto @samvieten @darkwebdev @RoryO @snowbillr @slothyrulez @jcyuan @jestarray @CzBiX ### Phaser Doc Jam The Phaser Doc Jam was a community-backed effort to try and get the Phaser 3 API documentation to 100% coverage. The Doc Jam is now over and I offer my thanks to the following who helped with docs in this release: -16patsle - @gurungrahul2 - @icbat - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - doronlinder - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - jak6jak - Jake Jensen - James Van Roose - JamesSkemp - joelahoover - Joey - madclaws - marc136 - Mihail Ilinov - naum303 - NicolasRoehm - nuane - rejacobson - Robert Kowalski - rodri042 - rootasjey - sawamara - scottwestover - sir13tommy - stetso - therealsamf - Tigran - willblackmore - zenwaichi +@16patsle - @gurungrahul2 - @icbat - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - doronlinder - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - jak6jak - Jake Jensen - James Van Roose - JamesSkemp - joelahoover - Joey - madclaws - marc136 - Mihail Ilinov - naum303 - NicolasRoehm - nuane - rejacobson - Robert Kowalski - rodri042 - rootasjey - sawamara - scottwestover - sir13tommy - stetso - therealsamf - Tigran - willblackmore - zenwaichi Also, the following helped with the docs outside of the Doc Jam: -@bryanwood @jestarray @matosummer @tfelix @imilo +@bryanwood @jestarray @matosummer @tfelix @imilo @BigZaphod @OmarShehata @16patsle @jcyuan @iam13islucky @FractalBobz Endre ## Version 3.15.1 - Batou - 16th October 2018 @@ -280,7 +545,7 @@ Note: We are releasing this version ahead of schedule in order to make some very * You can now set the `maxLights` value in the Game Config, which controls the total number of lights the Light2D shader can render in a single pass. The default is 10. Be careful about pushing this too far. More lights = less performance. Close #4081 (thanks @FrancescoNegri) * `Rectangle.SameDimensions` determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality. -* An ArcadePhysics Group can now pass `{ enable: false }`` in its config to disable all the member bodies (thanks @samme) +* An ArcadePhysics Group can now pass `{ enable: false }` in its config to disable all the member bodies (thanks @samme) * `Body.setEnable` is a new chainable method that allows you to toggle the enable state of an Arcade Physics Body (thanks @samme) * `KeyboardPlugin.resetKeys` is a new method that will reset the state of any Key object created by a Scene's Keyboard Plugin. * `Pointer.wasCanceled` is a new boolean property that allows you to tell if a Pointer was cleared due to a `touchcancel` event. This flag is reset during the next `touchstart` event for the Pointer. diff --git a/README.md b/README.md index ae2391003..261ffe03e 100644 --- a/README.md +++ b/README.md @@ -24,25 +24,19 @@ Grab the source and join the fun!
-> 16th October 2018 +> 11th February 2019 -Phaser 3.15 is now available. This is slightly ahead of schedule because we needed to get some important performance and iOS input related fixes released, without waiting for new features to be completed first. +With a new version as large as 3.16.0 was, there were bound to be some bugs that got overlooked. With 3.16.2 we address some of the more important ones. Please see the Change Log below for full details. If you're using 3.16, then please upgrade to 3.16.2. -This means that the new Scale Manager and Spine support have been moved to release 3.16 due towards the end of October. Please read the weekly Dev Logs for details about development. +5th February 2019: -> 1st October 2018 +I'm pleased to announce that Phaser 3.16 is now available. This version represents a significant milestone in the project as Phaser 3 is now 100% feature complete with all of the initially planned systems now in place. The most significant additions in 3.16 is the overhaul of the Input event handling, the long-awaited introduction of the Scale Manager, and the Extern Game Object, which allows for 3rd party rendering support, as required by Spine. Spine animation support is being handled exclusively through a Phaser Plugin. The current build of the Spine plugin can be found in this repo in the `plugins` folder, along with examples in the Phaser Labs. The Spine plugin will be developed independently of Phaser in the coming weeks. -I'm pleased to announce that Phaser 3.14 is now out. Hot on the heels of the massive 3.13 release, 3.14 brings some sought-after new features to the party, including support for the new Tiled Map Editor 1.2 file formats, as well as the long-requested feature allowing use of multiple tilesets per single tilemap layer. +This is the single largest update of Phaser 3 yet, and as such, there _are_ breaking changes. I have painstakingly listed all of them in the Change Log, so please do read it if you're upgrading from an earlier version. I know there is a lot to take in, so I'll be covering the new features in the Phaser World newsletter in the coming weeks. -There are also new features to make Matter JS debugging easier and body creation when using lists of vertices is now much cleaner too. It's never just features though. There are lots of important fixes and updates in 3.14, including a fix causing gl canvas resizing to fail, better handling of the game shutdown process and fixes for an issue with Graphics.generateTexture. +3.16 also brings together all of the hard work from the community that went in to the documentation. They're in a much better state than ever before, and very nearly 100% complete. I also completely reworked the internal event system, so event names, callback arguments and more are easy to find in one central place in the docs and can be reference in your code with either strings or properly name-spaced constants. -If you're building an active project on 3.13 then please upgrade to 3.14 and, as usual, report any issues you find on GitHub so we can look at them immediately. Also, in the 3.14 release we have completed over 1000 new areas of documentation. At the time of writing there are now just 1900 items in the API left to document, which may sound like a lot, but is a fraction of the tens of thousands already done! With our current progress we should have 100% documentation coverage within the next couple of months. - -In case you missed the notice, Phaser 3.13 introduced the Facebook Instant Games Plugin. The plugin provides a seamless bridge between Phaser and version 6.2 of the Facebook Instant Games SDK. Every single SDK function is available via the plugin and we will keep track of the official SDK to make sure they stay in sync. My thanks to Facebook for helping make this possible. - -Also new in 3.13 were the Shape Game Objects, which allows for quick addition of geometry onto the display list. Easily add rectangles, triangles, curves, stars and more into your game and treat them just like any other Game Object. Perfect for place-holder art, abstract style games or just really fast iterations game-jam style. - -3.14 continues to represent the tireless effort on my part to get it fully production ready. I'm seeing lots more games being released with Phaser 3 and stacks of tutorials and plugins are starting to surface. My aim has always been to continue the mission of enhancing Phaser 3 as quickly as I can. It means releasing significant updates in relatively short periods of time. But it also means I'm jumping on bug reports as quickly as I can, keeping the issues list total nice and low (the vast majority of the items in there are feature requests now!) - a massive thank-you to all of you who support Phaser on Patreon and PayPal. It's your support that allows me to work on this full-time, to the benefit of everyone. +A massive thank-you to everyone who supports Phaser on Patreon and PayPal. It's your backing that allows me to work on this full-time. If you've ever considered becoming a backer, now is the perfect time! As always, please check out the [Change Log](#changelog) for comprehensive details about what recent versions contain. @@ -62,15 +56,17 @@ Rich - [@photonstorm](https://twitter.com/photonstorm) ![Support Phaser](https://phaser.io/images/github/div-support-phaser.png "Support Phaser") -Developing Phaser takes a lot of time, effort and money. There are monthly running costs as well as countless hours of development time, community support, and assistance resolving issues. +Because Phaser is an open source project, we cannot charge for it in the same way as traditional retail software. What's more, we don't ever want to. After all, it's built on, and was born from, open web standards. It's part of our manifesto that the core framework will always be free, even if you use it commercially, as many of you do. -If you have found Phaser useful in your development life or have made income as a result of it please support our work via: +**You may not realize it, but because of this, we rely 100% on community backing to fund development.** -* A monthly contribution on [Patreon](https://www.patreon.com/photonstorm). -* A [one-off donation](https://phaser.io/community/donate) with PayPal. -* Purchase any of our [plugins or books](https://phaser.io/shop). +Those funds allow Phaser to improve, and when it improves, everyone involved benefits. Your support helps secure a constant cycle of updates, fixes, new features and planning for the future. -It all helps and genuinely contributes towards future development. +There are other benefits to [backing Phaser](https://www.patreon.com/join/photonstorm), too: + +![Backers Perks](https://phaser.io/images/github/patreon-perk-chart.png) + +I use [Patreon](https://www.patreon.com/photonstorm) to manage the backing and you can [support Phaser](https://www.patreon.com/join/photonstorm?) from $1 per month. The amount you pledge is entirely up to you and can be changed as often as you like. Patreon renews monthly, just like Netflix. You can, of course, cancel at any point. Tears will be shed on this end, but that's not your concern. Extra special thanks to our top-tier sponsors: [Orange Games](http://orangegames.com) and [CrossInstall](https://crossinstall.com). @@ -82,7 +78,7 @@ Extra special thanks to our top-tier sponsors: [Orange Games](http://orangegames We publish the [Phaser World](https://phaser.io/community/newsletter) newsletter. It's packed full of the latest Phaser games, tutorials, videos, meet-ups, talks, and more. The newsletter also contains our weekly Development Progress updates which let you know about the new features we're working on. -Over 120 previous editions can be found on our [Back Issues](https://phaser.io/community/backissues) page. +Over 130 previous editions can be found on our [Back Issues](https://phaser.io/community/backissues) page. ![Download Phaser](https://phaser.io/images/github/div-download.png "Download Phaser") @@ -108,13 +104,13 @@ npm install phaser [Phaser is on jsDelivr](https://www.jsdelivr.com/projects/phaser) which is a "super-fast CDN for developers". Include the following in your html: ```html - + ``` or the minified version: ```html - + ``` ### API Documentation @@ -186,13 +182,13 @@ We've 3 tutorials related to Facebook Instant Games and Phaser: A special build of Phaser with the Facebook Instant Games Plugin ready-enabled is [available on jsDelivr](https://www.jsdelivr.com/projects/phaser). Include the following in your html: ```html - + ``` or the minified version: ```html - + ``` The build files are in the git repository in the `dist` folder, and you can also include the plugin in custom builds. @@ -209,7 +205,7 @@ Create an `index.html` page locally and paste the following code into it: - + @@ -320,42 +316,51 @@ You can then run `webpack` to create a development build in the `build` folder w # Change Log -## Version 3.15.1 - Batou - 16th October 2018 +## Version 3.16.2 - Ishikawa - 11th February 2019 -Note: We are releasing this version ahead of schedule in order to make some very important iOS performance and input related fixes available. It does not contain the new Scale Manager or Spine support, both of which have been moved to 3.16 as they require a few more weeks of development. +This is point release primarily fixes a few important issues that surfaced in 3.16.0. Please be sure to read the [Change Log](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md) if you are coming from a version < 3.16.0 as it contains lots of important updates. -### New Features +### Matter Pointer Constraint Changes -* You can now set the `maxLights` value in the Game Config, which controls the total number of lights the Light2D shader can render in a single pass. The default is 10. Be careful about pushing this too far. More lights = less performance. Close #4081 (thanks @FrancescoNegri) -* `Rectangle.SameDimensions` determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality. -* An ArcadePhysics Group can now pass `{ enable: false }`` in its config to disable all the member bodies (thanks @samme) -* `Body.setEnable` is a new chainable method that allows you to toggle the enable state of an Arcade Physics Body (thanks @samme) -* `KeyboardPlugin.resetKeys` is a new method that will reset the state of any Key object created by a Scene's Keyboard Plugin. -* `Pointer.wasCanceled` is a new boolean property that allows you to tell if a Pointer was cleared due to a `touchcancel` event. This flag is reset during the next `touchstart` event for the Pointer. -* `Pointer.touchcancel` is a new internal method specifically for handling touch cancel events. It has the same result as `touchend` without setting any of the up properties, to avoid triggering up event handlers. It will also set the `wasCanceled` property to `true`. +The following changes all effect the Matter JS Pointer Constraint class: + +* Pointer handling has been changed to make more sense. In the previous version, pressing down and then moving the Pointer _over_ a body would start it being dragged, even if the pointer was pressed down well outside of the body bounds. Now, a body can only be dragged by actually pressing down on it, or any of its parts, which is more in-line with how input events should work. +* Previously, releasing ANY pointer would stop an object being dragged, even if it wasn't the one actually dragging a body, as in a multi-touch game. Bodies are now bound to the pointer which started their drag and only the release of that pointer will stop them. +* There is a new Matter Physics Event `DRAG_START` which is emitted by a Pointer Constraint when it starts dragging a body. Listen for this event from the Matter World instance. +* There is a new Matter Physics Event `DRAG` which is emitted by a Pointer Constraint as it drags a body. Listen for this event from the Matter World instance. +* There is a new Matter Physics Event `DRAG_END` which is emitted by a Pointer Constraint when it stops dragging a body. Listen for this event from the Matter World instance. +* The `camera` property can no longer be set in the config object. Instead it is set every time the Pointer is pressed down on a Body, this resolves issues where you have a multi-camera Scene and want to drag a body in the non-main camera. +* `body` is a new property that holds a reference to the Body being dragged, if any. +* `part` is a new property that holds a reference to the Body part that was clicked on which started the drag. +* The internal `getBodyPart` method has been renamed to `hitTestBody` to more accurately reflect what it does. +* The class no longer listens for the pointer `up` event, instead of tracks the active pointer and waits for that to be released. This has reduced the complexity and size of the `update` method considerably. +* `stopDrag` is a new method that allows you to manually stop an object being dragged, even if the pointer isn't released. +* This class now has 100% JSDocs. ### Updates -* `WebGLRenderer.deleteTexture` will check to see if the texture it is being asked to delete is the currently bound texture or not. If it is, it'll set the blank texture to be bound after deletion. This should stop `RENDER WARNING: there is no texture bound to the unit 0` errors if you destroy a Game Object, such as Text or TileSprite, from an async or timed process (thanks jamespierce) -* The `RequestAnimationFrame.step` and `stepTimeout` functions have been updated so that the new Frame is requested from raf before the main game step is called. This allows you to now stop the raf callback from within the game update or render loop. Fix #3952 (thanks @tolimeh) -* If you pass zero as the width or height when creating a TileSprite it will now use the dimensions of the texture frame as the size of the TileSprite. Fix #4073 (thanks @jcyuan) -* `TileSprite.setFrame` has had both the `updateSize` and `updateOrigin` arguments removed as they didn't do anything for TileSprites and were misleading. -* `CameraManager.remove` has a new argument `runDestroy` which, if set, will automatically call `Camera.destroy` on the Cameras removed from the Camera Manager. You should nearly always allow this to happen (thanks jamespierce) -* Device.OS has been restructured to allow fake UAs from Chrome dev tools to register iOS devices. -* Texture batching during the batch flush has been implemented in the TextureTintPipeline which resolves the issues of very low frame rates, especially on iOS devices, when using non-batched textures such as those used by Text or TileSprites. Fix #4110 #4086 (thanks @ivanpopelyshev @sachinhosmani @maximtsai @alexeymolchan) -* The WebGLRenderer method `canvasToTexture` has a new optional argument `noRepeat` which will stop it from using `gl.REPEAT` entirely. This is now used by the Text object to avoid it potentially switching between a REPEAT and CLAMP texture, causing texture black-outs (thanks @ivanpopelyshev) -* `KeyboardPlugin.resetKeys` is now called automatically as part of the Keyboard Plugin `shutdown` method. This means, when the plugin shuts down, such as when stopping a Scene, it will reset the state of any key held in the plugin. It will also clear the queue of any pending events. -* The `Touch Manager` has been rewritten to use declared functions for all touch event handlers, rather than bound functions. This means they will now clear properly when the TouchManager is shut down. -* There is a new Input constant `TOUCH_CANCEL` which represents canceled touch events. +* `TileSprite.setTileScale` has been updated so that the `y` argument is optional and set to match the `x` argument, like `setScale` elsewhere in the API. +* `InputManager.time` is a new property that holds the most recent time it was updated from the Game step, which plugins can access. +* `InputManager.preStep` is a new method that populates some internal properties every step. +* `KeyboardPlugin.time` has moved from being a property to being a getter, which returns the time from the InputManager. +* The `scale` property has been added to the `Scene` class (thanks @strangeweekend) +* `Matter.World.remove` now uses the `Composite.remove` method internally. Previously, it used `Composite.removeBody` which only allowed it to remove bodies from the simulation. Now, it can remove any type of Matter object. +* When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it. +* Touch inputs will now trigger a `POINTER_OUT` event if they leave the game (i.e. are released), where-as before they would only trigger the `POINTER_UP` event. Now, both happen (thanks @rgk) ### Bug Fixes -* Fixed a bug in the canvas rendering of both the Static and Dynamic Tilemap Layers where the camera matrix was being multiplied twice with the layer, causing the scale and placement to be off (thanks galerijanamar) -* If you set `pixelArt` to true in your game config (or `antialias` to false) then TileSprites will now respect this when using the Canvas Renderer and disable smoothing on the internal fill canvas. -* TileSprites that were set to be interactive before they had rendered once wouldn't receive a valid input hit area, causing input to fail. They now define their size immediately, allowing them to be made interactive without having rendered. Fix #4085 (thanks @DotTheGreat) -* The Particle Emitter Manager has been given a NOOP method called `setBlendMode` to stop warnings from being thrown if you added an emitter to a Container in the Canvas renderer. Fix #4083 (thanks @maximtsai) -* The `game.context` property would be incorrectly set to `null` after the WebGLRenderer instance was created (thanks @samme) -* The Touch Manager, Input Manager and Pointer classes all now handle the `touchcancel` event, such as triggered on iOS when activating an out of browser UI gesture, or in Facebook Instant Games when displaying an overlay ad. This should prevent issues with touch input becoming locked on iOS specifically. Fix #3756 (thanks @sftsk @sachinhosmani @kooappsdevs) +* The `Mesh.setAlpha` method has been restored, even though it's empty and does nothing, to prevent runtime errors when adding a Mesh or Quad object to a Container. Fix #4338 #4343 (thanks @pfdtravalmatic @charmingny) +* `KeyboardPlugin.checkDown` would always fail if using the new event system, because the time value it was checking wasn't updated. +* Entering `Fullscreen` mode in the Scale Manager and then pressing ESC would leave the injected fullsceen div in the DOM, causing it to throw a node insertion failure the second time you wanted to enter fullscreen mode. Fix #4352 (thanks @ngdevr) +* Due to the changes in the Input event system, the `GAME_OUT` event would never fire unless the input system was in legacy mode. The OUT and OVER handlers have been refactored and will now fire as soon as the DOM event happens. As a result the `InputManager._emitIsOverEvent` property has been removed, as the native event is sent directly to the handler and doesn't need storing locally any more. Fix #4344 (thanks @RademCZ) +* Added `Zone.setBlendMode` method as a NOOP function, fixing a bug where if you added a Zone to a Container when running under Canvas it would fail. Fix #4295 (thanks @emanuel15) + +### Examples, Documentation and TypeScript + +My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs: + +@maretana @CipSoft-Components @brian-lui Please see the complete [Change Log](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md) for previous releases. @@ -382,14 +387,14 @@ Phaser is a [Photon Storm](http://www.photonstorm.com) production. Created by [Richard Davey](mailto:rich@photonstorm.com). Powered by coffee, anime, pixels and love. -The Phaser logo and characters are © 2018 Photon Storm Limited. +The Phaser logo and characters are © 2019 Photon Storm Limited. All rights reserved. "Above all, video games are meant to be just one thing: fun. Fun for everyone." - Satoru Iwata -[get-js]: https://github.com/photonstorm/phaser/releases/download/v3.15.1/phaser.js -[get-minjs]: https://github.com/photonstorm/phaser/releases/download/v3.15.1/phaser.min.js +[get-js]: https://github.com/photonstorm/phaser/releases/download/v3.16.2/phaser.js +[get-minjs]: https://github.com/photonstorm/phaser/releases/download/v3.16.2/phaser.min.js [clone-http]: https://github.com/photonstorm/phaser.git [clone-ssh]: git@github.com:photonstorm/phaser.git [clone-ghwin]: github-windows://openRepo/https://github.com/photonstorm/phaser diff --git a/dist/phaser-arcade-physics.js b/dist/phaser-arcade-physics.js index 40e97dc8e..0d99f593c 100644 --- a/dist/phaser-arcade-physics.js +++ b/dist/phaser-arcade-physics.js @@ -46,19 +46,34 @@ return /******/ (function(modules) { // webpackBootstrap /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? @@ -76,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1078); +/******/ return __webpack_require__(__webpack_require__.s = 1299); /******/ }) /************************************************************************/ /******/ ([ @@ -85,7 +100,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -323,7 +338,7 @@ module.exports = Class; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -350,7 +365,7 @@ module.exports = NOOP; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -393,7 +408,7 @@ module.exports = GetFastValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -856,14 +871,14 @@ var Vector2 = new Class({ }, /** - * [description] + * Calculate the cross product of this Vector and the given Vector. * * @method Phaser.Math.Vector2#cross * @since 3.0.0 * - * @param {Phaser.Math.Vector2} src - [description] + * @param {Phaser.Math.Vector2} src - The Vector2 to cross with this Vector2. * - * @return {number} [description] + * @return {number} The cross product of this Vector and the given Vector. */ cross: function (src) { @@ -960,14 +975,76 @@ var Vector2 = new Class({ /** * A static zero Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. * * @constant * @name Phaser.Math.Vector2.ZERO - * @type {Vector2} + * @type {Phaser.Math.Vector2} * @since 3.1.0 */ Vector2.ZERO = new Vector2(); +/** + * A static right Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.RIGHT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.RIGHT = new Vector2(1, 0); + +/** + * A static left Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.LEFT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.LEFT = new Vector2(-1, 0); + +/** + * A static up Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.UP + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.UP = new Vector2(0, -1); + +/** + * A static down Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.DOWN + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.DOWN = new Vector2(0, 1); + +/** + * A static one Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.ONE + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.ONE = new Vector2(1, 1); + module.exports = Vector2; @@ -977,7 +1054,7 @@ module.exports = Vector2; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1007,7 +1084,7 @@ var GetValue = function (source, key, defaultValue) { return source[key]; } - else if (key.indexOf('.')) + else if (key.indexOf('.') !== -1) { var keys = key.split('.'); var parent = source; @@ -1048,12 +1125,13 @@ module.exports = GetValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -1116,8 +1194,8 @@ var GameObjectFactory = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -1133,7 +1211,7 @@ var GameObjectFactory = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -1147,7 +1225,7 @@ var GameObjectFactory = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1188,7 +1266,7 @@ var GameObjectFactory = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1203,7 +1281,7 @@ var GameObjectFactory = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -1235,7 +1313,7 @@ module.exports = GameObjectFactory; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1316,12 +1394,16 @@ module.exports = Point; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var types = {}; +/** + * @namespace Phaser.Loader.FileTypesManager + */ + var FileTypesManager = { /** @@ -1330,7 +1412,7 @@ var FileTypesManager = { * Loops through the local types object and injects all of them as * properties into the LoaderPlugin instance. * - * @method Phaser.Loader.FileTypesManager.register + * @method Phaser.Loader.FileTypesManager.install * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. @@ -1381,7 +1463,7 @@ module.exports = FileTypesManager; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1433,20 +1515,155 @@ module.exports = IsPlainObject; /***/ }), /* 9 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.WebGL.Utils + * @since 3.0.0 + */ +module.exports = { + + /** + * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats + * @since 3.0.0 + * + * @param {number} r - Red component in a range from 0.0 to 1.0 + * @param {number} g - Green component in a range from 0.0 to 1.0 + * @param {number} b - Blue component in a range from 0.0 to 1.0 + * @param {number} a - Alpha component in a range from 0.0 to 1.0 + * + * @return {number} [description] + */ + getTintFromFloats: function (r, g, b, a) + { + var ur = ((r * 255.0)|0) & 0xFF; + var ug = ((g * 255.0)|0) & 0xFF; + var ub = ((b * 255.0)|0) & 0xFF; + var ua = ((a * 255.0)|0) & 0xFF; + + return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlpha: function (rgb, a) + { + var ua = ((a * 255.0)|0) & 0xFF; + return ((ua << 24) | rgb) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a + * swizzled Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlphaAndSwap: function (rgb, a) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + var ua = ((a * 255.0)|0) & 0xFF; + + return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; + }, + + /** + * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 + * + * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB + * @since 3.0.0 + * + * @param {number} rgb - RGB packed as a Uint24 + * + * @return {array} Array of floats representing each component as a float + */ + getFloatsFromUintRGB: function (rgb) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + + return [ ur / 255.0, ug / 255.0, ub / 255.0 ]; + }, + + /** + * Counts how many attributes of 32 bits a vertex has + * + * @function Phaser.Renderer.WebGL.Utils.getComponentCount + * @since 3.0.0 + * + * @param {array} attributes - Array of attributes + * @param {WebGLRenderingContext} glContext - WebGLContext used for check types + * + * @return {number} Count of 32 bit attributes in vertex + */ + getComponentCount: function (attributes, glContext) + { + var count = 0; + + for (var index = 0; index < attributes.length; ++index) + { + var element = attributes[index]; + + if (element.type === glContext.FLOAT) + { + count += element.size; + } + else + { + count += 1; // We'll force any other type to be 32 bit. for now + } + } + + return count; + } + +}; + + +/***/ }), +/* 10 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(39); -var GetPoint = __webpack_require__(190); -var GetPoints = __webpack_require__(398); -var Line = __webpack_require__(54); -var Random = __webpack_require__(187); +var Contains = __webpack_require__(42); +var GetPoint = __webpack_require__(204); +var GetPoints = __webpack_require__(430); +var Line = __webpack_require__(59); +var Random = __webpack_require__(201); /** * @classdesc @@ -1930,141 +2147,6 @@ var Rectangle = new Class({ module.exports = Rectangle; -/***/ }), -/* 10 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.Renderer.WebGL.Utils - * @since 3.0.0 - */ -module.exports = { - - /** - * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats - * @since 3.0.0 - * - * @param {number} r - Red component in a range from 0.0 to 1.0 - * @param {number} g - [description] - * @param {number} b - [description] - * @param {number} a - Alpha component in a range from 0.0 to 1.0 - * - * @return {number} [description] - */ - getTintFromFloats: function (r, g, b, a) - { - var ur = ((r * 255.0)|0) & 0xFF; - var ug = ((g * 255.0)|0) & 0xFF; - var ub = ((b * 255.0)|0) & 0xFF; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlpha: function (rgb, a) - { - var ua = ((a * 255.0)|0) & 0xFF; - return ((ua << 24) | rgb) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a - * swizzled Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlphaAndSwap: function (rgb, a) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; - }, - - /** - * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 - * - * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB - * @since 3.0.0 - * - * @param {number} rgb - RGB packed as a Uint24 - * - * @return {array} Array of floats representing each component as a float - */ - getFloatsFromUintRGB: function (rgb) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - - return [ ur / 255.0, ug / 255.0, ub / 255.0 ]; - }, - - /** - * Counts how many attributes of 32 bits a vertex has - * - * @function Phaser.Renderer.WebGL.Utils.getComponentCount - * @since 3.0.0 - * - * @param {array} attributes - Array of attributes - * @param {WebGLRenderingContext} glContext - WebGLContext used for check types - * - * @return {number} Count of 32 bit attributes in vertex - */ - getComponentCount: function (attributes, glContext) - { - var count = 0; - - for (var index = 0; index < attributes.length; ++index) - { - var element = attributes[index]; - - if (element.type === glContext.FLOAT) - { - count += element.size; - } - else - { - count += 1; // We'll force any other type to be 32 bit. for now - } - } - - return count; - } - -}; - - /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { @@ -2414,51 +2496,52 @@ if (true) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH = __webpack_require__(16); +var MATH = __webpack_require__(20); var GetValue = __webpack_require__(4); -// Allowed types: - -// Implicit -// { -// x: 4 -// } -// -// From function -// { -// x: function () -// } -// -// Randomly pick one element from the array -// { -// x: [a, b, c, d, e, f] -// } -// -// Random integer between min and max: -// { -// x: { randInt: [min, max] } -// } -// -// Random float between min and max: -// { -// x: { randFloat: [min, max] } -// } - /** - * [description] + * Retrieves a value from an object. Allows for more advanced selection options, including: + * + * Allowed types: + * + * Implicit + * { + * x: 4 + * } + * + * From function + * { + * x: function () + * } + * + * Randomly pick one element from the array + * { + * x: [a, b, c, d, e, f] + * } + * + * Random integer between min and max: + * { + * x: { randInt: [min, max] } + * } + * + * Random float between min and max: + * { + * x: { randFloat: [min, max] } + * } + * * * @function Phaser.Utils.Objects.GetAdvancedValue * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] - * @param {*} defaultValue - [description] + * @param {object} source - The object to retrieve the value from. + * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. + * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. * - * @return {*} [description] + * @return {*} The value of the requested key. */ var GetAdvancedValue = function (source, key, defaultValue) { @@ -2500,12 +2583,54 @@ module.exports = GetAdvancedValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Components + */ + +module.exports = { + + Alpha: __webpack_require__(435), + Animation: __webpack_require__(460), + BlendMode: __webpack_require__(432), + ComputedSize: __webpack_require__(1248), + Crop: __webpack_require__(1247), + Depth: __webpack_require__(431), + Flip: __webpack_require__(1246), + GetBounds: __webpack_require__(1245), + Mask: __webpack_require__(427), + Origin: __webpack_require__(1244), + Pipeline: __webpack_require__(200), + ScaleMode: __webpack_require__(1243), + ScrollFactor: __webpack_require__(424), + Size: __webpack_require__(1242), + Texture: __webpack_require__(1241), + TextureCrop: __webpack_require__(1240), + Tint: __webpack_require__(1239), + ToJSON: __webpack_require__(423), + Transform: __webpack_require__(422), + TransformMatrix: __webpack_require__(41), + Visible: __webpack_require__(421) + +}; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -2569,8 +2694,8 @@ var GameObjectCreator = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -2586,7 +2711,7 @@ var GameObjectCreator = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -2600,7 +2725,7 @@ var GameObjectCreator = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -2613,7 +2738,7 @@ var GameObjectCreator = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -2628,7 +2753,7 @@ var GameObjectCreator = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -2653,54 +2778,203 @@ PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); module.exports = GameObjectCreator; -/***/ }), -/* 14 */ -/***/ (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.GameObjects.Components - */ - -module.exports = { - - Alpha: __webpack_require__(401), - Animation: __webpack_require__(427), - BlendMode: __webpack_require__(400), - ComputedSize: __webpack_require__(1045), - Crop: __webpack_require__(1044), - Depth: __webpack_require__(399), - Flip: __webpack_require__(1043), - GetBounds: __webpack_require__(1042), - Mask: __webpack_require__(395), - Origin: __webpack_require__(1041), - Pipeline: __webpack_require__(186), - ScaleMode: __webpack_require__(1040), - ScrollFactor: __webpack_require__(392), - Size: __webpack_require__(1039), - Texture: __webpack_require__(1038), - TextureCrop: __webpack_require__(1037), - Tint: __webpack_require__(1036), - ToJSON: __webpack_require__(391), - Transform: __webpack_require__(390), - TransformMatrix: __webpack_require__(38), - Visible: __webpack_require__(389) - -}; - - /***/ }), /* 15 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var FILE_CONST = { + + /** + * The Loader is idle. + * + * @name Phaser.Loader.LOADER_IDLE + * @type {integer} + * @since 3.0.0 + */ + LOADER_IDLE: 0, + + /** + * The Loader is actively loading. + * + * @name Phaser.Loader.LOADER_LOADING + * @type {integer} + * @since 3.0.0 + */ + LOADER_LOADING: 1, + + /** + * The Loader is processing files is has loaded. + * + * @name Phaser.Loader.LOADER_PROCESSING + * @type {integer} + * @since 3.0.0 + */ + LOADER_PROCESSING: 2, + + /** + * The Loader has completed loading and processing. + * + * @name Phaser.Loader.LOADER_COMPLETE + * @type {integer} + * @since 3.0.0 + */ + LOADER_COMPLETE: 3, + + /** + * The Loader is shutting down. + * + * @name Phaser.Loader.LOADER_SHUTDOWN + * @type {integer} + * @since 3.0.0 + */ + LOADER_SHUTDOWN: 4, + + /** + * The Loader has been destroyed. + * + * @name Phaser.Loader.LOADER_DESTROYED + * @type {integer} + * @since 3.0.0 + */ + LOADER_DESTROYED: 5, + + /** + * File is in the load queue but not yet started + * + * @name Phaser.Loader.FILE_PENDING + * @type {integer} + * @since 3.0.0 + */ + FILE_PENDING: 10, + + /** + * File has been started to load by the loader (onLoad called) + * + * @name Phaser.Loader.FILE_LOADING + * @type {integer} + * @since 3.0.0 + */ + FILE_LOADING: 11, + + /** + * File has loaded successfully, awaiting processing + * + * @name Phaser.Loader.FILE_LOADED + * @type {integer} + * @since 3.0.0 + */ + FILE_LOADED: 12, + + /** + * File failed to load + * + * @name Phaser.Loader.FILE_FAILED + * @type {integer} + * @since 3.0.0 + */ + FILE_FAILED: 13, + + /** + * File is being processed (onProcess callback) + * + * @name Phaser.Loader.FILE_PROCESSING + * @type {integer} + * @since 3.0.0 + */ + FILE_PROCESSING: 14, + + /** + * The File has errored somehow during processing. + * + * @name Phaser.Loader.FILE_ERRORED + * @type {integer} + * @since 3.0.0 + */ + FILE_ERRORED: 16, + + /** + * File has finished processing. + * + * @name Phaser.Loader.FILE_COMPLETE + * @type {integer} + * @since 3.0.0 + */ + FILE_COMPLETE: 17, + + /** + * File has been destroyed + * + * @name Phaser.Loader.FILE_DESTROYED + * @type {integer} + * @since 3.0.0 + */ + FILE_DESTROYED: 18, + + /** + * File was populated from local data and doesn't need an HTTP request + * + * @name Phaser.Loader.FILE_POPULATED + * @type {integer} + * @since 3.0.0 + */ + FILE_POPULATED: 19 + +}; + +module.exports = FILE_CONST; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scenes.Events + */ + +module.exports = { + + BOOT: __webpack_require__(1115), + DESTROY: __webpack_require__(1114), + PAUSE: __webpack_require__(1113), + POST_UPDATE: __webpack_require__(1112), + PRE_UPDATE: __webpack_require__(1111), + READY: __webpack_require__(1110), + RENDER: __webpack_require__(1109), + RESUME: __webpack_require__(1108), + SHUTDOWN: __webpack_require__(1107), + SLEEP: __webpack_require__(1106), + START: __webpack_require__(1105), + TRANSITION_COMPLETE: __webpack_require__(1104), + TRANSITION_INIT: __webpack_require__(1103), + TRANSITION_OUT: __webpack_require__(1102), + TRANSITION_START: __webpack_require__(1101), + TRANSITION_WAKE: __webpack_require__(1100), + UPDATE: __webpack_require__(1099), + WAKE: __webpack_require__(1098) + +}; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -2730,6 +3004,10 @@ var customPlugins = {}; var PluginCache = {}; +/** + * @namespace Phaser.Plugins.PluginCache + */ + /** * Static method called directly by the Core internal Plugins. * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) @@ -2915,337 +3193,21 @@ PluginCache.destroyCustomPlugins = function () module.exports = PluginCache; -/***/ }), -/* 16 */ -/***/ (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 RND = __webpack_require__(404); - -var MATH_CONST = { - - /** - * The value of PI * 2. - * - * @name Phaser.Math.PI2 - * @type {number} - * @since 3.0.0 - */ - PI2: Math.PI * 2, - - /** - * The value of PI * 0.5. - * - * @name Phaser.Math.TAU - * @type {number} - * @since 3.0.0 - */ - TAU: Math.PI * 0.5, - - /** - * An epsilon value (1.0e-6) - * - * @name Phaser.Math.EPSILON - * @type {number} - * @since 3.0.0 - */ - EPSILON: 1.0e-6, - - /** - * For converting degrees to radians (PI / 180) - * - * @name Phaser.Math.DEG_TO_RAD - * @type {number} - * @since 3.0.0 - */ - DEG_TO_RAD: Math.PI / 180, - - /** - * For converting radians to degrees (180 / PI) - * - * @name Phaser.Math.RAD_TO_DEG - * @type {number} - * @since 3.0.0 - */ - RAD_TO_DEG: 180 / Math.PI, - - /** - * An instance of the Random Number Generator. - * - * @name Phaser.Math.RND - * @type {Phaser.Math.RandomDataGenerator} - * @since 3.0.0 - */ - RND: new RND() - -}; - -module.exports = MATH_CONST; - - -/***/ }), -/* 17 */ -/***/ (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 GetFastValue = __webpack_require__(2); - -/** - * @typedef {object} GetTilesWithinFilteringOptions - * - * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. - * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - */ - -/** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @function Phaser.Tilemaps.Components.GetTilesWithin - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. - */ -var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) -{ - if (tileX === undefined) { tileX = 0; } - if (tileY === undefined) { tileY = 0; } - if (width === undefined) { width = layer.width; } - if (height === undefined) { height = layer.height; } - - var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); - var isColliding = GetFastValue(filteringOptions, 'isColliding', false); - var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - - // Clip x, y to top left of map, while shrinking width/height to match. - if (tileX < 0) - { - width += tileX; - tileX = 0; - } - if (tileY < 0) - { - height += tileY; - tileY = 0; - } - - // Clip width and height to bottom right of map. - if (tileX + width > layer.width) - { - width = Math.max(layer.width - tileX, 0); - } - if (tileY + height > layer.height) - { - height = Math.max(layer.height - tileY, 0); - } - - var results = []; - - for (var ty = tileY; ty < tileY + height; ty++) - { - for (var tx = tileX; tx < tileX + width; tx++) - { - var tile = layer.data[ty][tx]; - if (tile !== null) - { - if (isNotEmpty && tile.index === -1) { continue; } - if (isColliding && !tile.collides) { continue; } - if (hasInterestingFace && !tile.hasInterestingFace) { continue; } - results.push(tile); - } - } - } - - return results; -}; - -module.exports = GetTilesWithin; - - /***/ }), /* 18 */ -/***/ (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 FILE_CONST = { - - /** - * The Loader is idle. - * - * @name Phaser.Loader.LOADER_IDLE - * @type {integer} - * @since 3.0.0 - */ - LOADER_IDLE: 0, - - /** - * The Loader is actively loading. - * - * @name Phaser.Loader.LOADER_LOADING - * @type {integer} - * @since 3.0.0 - */ - LOADER_LOADING: 1, - - /** - * The Loader is processing files is has loaded. - * - * @name Phaser.Loader.LOADER_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - LOADER_PROCESSING: 2, - - /** - * The Loader has completed loading and processing. - * - * @name Phaser.Loader.LOADER_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - LOADER_COMPLETE: 3, - - /** - * The Loader is shutting down. - * - * @name Phaser.Loader.LOADER_SHUTDOWN - * @type {integer} - * @since 3.0.0 - */ - LOADER_SHUTDOWN: 4, - - /** - * The Loader has been destroyed. - * - * @name Phaser.Loader.LOADER_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - LOADER_DESTROYED: 5, - - /** - * File is in the load queue but not yet started - * - * @name Phaser.Loader.FILE_PENDING - * @type {integer} - * @since 3.0.0 - */ - FILE_PENDING: 10, - - /** - * File has been started to load by the loader (onLoad called) - * - * @name Phaser.Loader.FILE_LOADING - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADING: 11, - - /** - * File has loaded successfully, awaiting processing - * - * @name Phaser.Loader.FILE_LOADED - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADED: 12, - - /** - * File failed to load - * - * @name Phaser.Loader.FILE_FAILED - * @type {integer} - * @since 3.0.0 - */ - FILE_FAILED: 13, - - /** - * File is being processed (onProcess callback) - * - * @name Phaser.Loader.FILE_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - FILE_PROCESSING: 14, - - /** - * The File has errored somehow during processing. - * - * @name Phaser.Loader.FILE_ERRORED - * @type {integer} - * @since 3.0.0 - */ - FILE_ERRORED: 16, - - /** - * File has finished processing. - * - * @name Phaser.Loader.FILE_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - FILE_COMPLETE: 17, - - /** - * File has been destroyed - * - * @name Phaser.Loader.FILE_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - FILE_DESTROYED: 18, - - /** - * File was populated from local data and doesn't need an HTTP request - * - * @name Phaser.Loader.FILE_POPULATED - * @type {integer} - * @since 3.0.0 - */ - FILE_POPULATED: 19 - -}; - -module.exports = FILE_CONST; - - -/***/ }), -/* 19 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var ComponentsToJSON = __webpack_require__(391); -var DataManager = __webpack_require__(123); +var ComponentsToJSON = __webpack_require__(423); +var DataManager = __webpack_require__(134); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(133); /** * @classdesc @@ -3293,6 +3255,22 @@ var GameObject = new Class({ */ this.type = type; + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could move from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.GameObject#state + * @type {(integer|string)} + * @since 3.16.0 + */ + this.state = 0; + /** * The parent Container of this Game Object, if it has one. * @@ -3449,6 +3427,30 @@ var GameObject = new Class({ return this; }, + /** + * Sets the current state of this Game Object. + * + * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @method Phaser.GameObjects.GameObject#setState + * @since 3.16.0 + * + * @param {(integer|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. + */ + setState: function (value) + { + this.state = value; + + return this; + }, + /** * Adds a Data Manager component to this Game Object. * @@ -3501,7 +3503,7 @@ var GameObject = new Class({ * When the value is first set, a `setdata` event is emitted from this Game Object. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. @@ -3692,7 +3694,7 @@ var GameObject = new Class({ */ willRender: function (camera) { - return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id))); + return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); }, /** @@ -3753,8 +3755,9 @@ var GameObject = new Class({ * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. * * @method Phaser.GameObjects.GameObject#destroy + * @fires Phaser.GameObjects.Events#DESTROY * @since 3.0.0 - * + * * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown? */ destroy: function (fromScene) @@ -3772,7 +3775,7 @@ var GameObject = new Class({ this.preDestroy.call(this); } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); var sys = this.scene.sys; @@ -3832,12 +3835,12 @@ module.exports = GameObject; /***/ }), -/* 20 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -3853,7 +3856,7 @@ var IsPlainObject = __webpack_require__(8); * @function Phaser.Utils.Objects.Extend * @since 3.0.0 * - * @return {object} [description] + * @return {object} The extended object. */ var Extend = function () { @@ -3930,23 +3933,188 @@ var Extend = function () module.exports = Extend; +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var MATH_CONST = { + + /** + * The value of PI * 2. + * + * @name Phaser.Math.PI2 + * @type {number} + * @since 3.0.0 + */ + PI2: Math.PI * 2, + + /** + * The value of PI * 0.5. + * + * @name Phaser.Math.TAU + * @type {number} + * @since 3.0.0 + */ + TAU: Math.PI * 0.5, + + /** + * An epsilon value (1.0e-6) + * + * @name Phaser.Math.EPSILON + * @type {number} + * @since 3.0.0 + */ + EPSILON: 1.0e-6, + + /** + * For converting degrees to radians (PI / 180) + * + * @name Phaser.Math.DEG_TO_RAD + * @type {number} + * @since 3.0.0 + */ + DEG_TO_RAD: Math.PI / 180, + + /** + * For converting radians to degrees (180 / PI) + * + * @name Phaser.Math.RAD_TO_DEG + * @type {number} + * @since 3.0.0 + */ + RAD_TO_DEG: 180 / Math.PI, + + /** + * An instance of the Random Number Generator. + * This is not set until the Game boots. + * + * @name Phaser.Math.RND + * @type {Phaser.Math.RandomDataGenerator} + * @since 3.0.0 + */ + RND: null + +}; + +module.exports = MATH_CONST; + + /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetFastValue = __webpack_require__(2); + +/** + * @typedef {object} GetTilesWithinFilteringOptions + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ + +/** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithin + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) +{ + if (tileX === undefined) { tileX = 0; } + if (tileY === undefined) { tileY = 0; } + if (width === undefined) { width = layer.width; } + if (height === undefined) { height = layer.height; } + + var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); + var isColliding = GetFastValue(filteringOptions, 'isColliding', false); + var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); + + // Clip x, y to top left of map, while shrinking width/height to match. + if (tileX < 0) + { + width += tileX; + tileX = 0; + } + if (tileY < 0) + { + height += tileY; + tileY = 0; + } + + // Clip width and height to bottom right of map. + if (tileX + width > layer.width) + { + width = Math.max(layer.width - tileX, 0); + } + if (tileY + height > layer.height) + { + height = Math.max(layer.height - tileY, 0); + } + + var results = []; + + for (var ty = tileY; ty < tileY + height; ty++) + { + for (var tx = tileX; tx < tileX + width; tx++) + { + var tile = layer.data[ty][tx]; + if (tile !== null) + { + if (isNotEmpty && tile.index === -1) { continue; } + if (isColliding && !tile.collides) { continue; } + if (hasInterestingFace && !tile.hasInterestingFace) { continue; } + results.push(tile); + } + } + } + + return results; +}; + +module.exports = GetTilesWithin; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(18); +var CONST = __webpack_require__(15); +var Events = __webpack_require__(75); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(141); -var MergeXHRSettings = __webpack_require__(140); -var XHRLoader = __webpack_require__(254); -var XHRSettings = __webpack_require__(105); +var GetURL = __webpack_require__(152); +var MergeXHRSettings = __webpack_require__(151); +var XHRLoader = __webpack_require__(259); +var XHRSettings = __webpack_require__(112); /** * @typedef {object} FileConfig @@ -4251,7 +4419,9 @@ var File = new Class({ */ onLoad: function (xhr, event) { - var success = !(event.target && event.target.status !== 200); + var localFileOk = ((xhr.responseURL && xhr.responseURL.indexOf('file://') === 0 && event.target.status === 0)); + + var success = !(event.target && event.target.status !== 200) || localFileOk; // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) @@ -4270,6 +4440,7 @@ var File = new Class({ * @method Phaser.Loader.File#onError * @since 3.0.0 * + * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error. */ onError: function () @@ -4283,6 +4454,7 @@ var File = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.File#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 * * @param {ProgressEvent} event - The DOM ProgressEvent. @@ -4296,7 +4468,7 @@ var File = new Class({ this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); } }, @@ -4384,65 +4556,13 @@ var File = new Class({ this.pendingDestroy(); }, - /** - * You can listen for this event from the LoaderPlugin. It is dispatched _every time_ - * a file loads and is sent 3 arguments, which allow you to identify the file: - * - * ```javascript - * this.load.on('filecomplete', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#fileCompleteEvent - * @param {string} key - The key of the file that just loaded and finished processing. - * @param {string} type - The type of the file that just loaded and finished processing. - * @param {any} data - The data of the file. - */ - - /** - * You can listen for this event from the LoaderPlugin. It is dispatched only once per - * file and you have to use a special listener handle to pick it up. - * - * The string of the event is based on the file type and the key you gave it, split up - * using hyphens. - * - * For example, if you have loaded an image with a key of `monster`, you can listen for it - * using the following: - * - * ```javascript - * this.load.on('filecomplete-image-monster', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a texture atlas with a key of `Level1`: - * - * ```javascript - * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: - * - * ```javascript - * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#singleFileCompleteEvent - * @param {any} data - The data of the file. - */ - /** * Called once the file has been added to its cache and is now ready for deletion from the Loader. * It will emit a `filecomplete` event from the LoaderPlugin. * * @method Phaser.Loader.File#pendingDestroy - * @fires Phaser.Loader.File#fileCompleteEvent - * @fires Phaser.Loader.File#singleFileCompleteEvent + * @fires Phaser.Loader.Events#FILE_COMPLETE + * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE * @since 3.7.0 */ pendingDestroy: function (data) @@ -4452,8 +4572,8 @@ var File = new Class({ var key = this.key; var type = this.type; - this.loader.emit('filecomplete', key, type, data); - this.loader.emit('filecomplete-' + type + '-' + key, key, type, data); + this.loader.emit(Events.FILE_COMPLETE, key, type, data); + this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data); this.loader.flagForRemoval(this); }, @@ -4528,12 +4648,303 @@ module.exports = File; /***/ }), -/* 22 */ +/* 23 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(28); +var Smoothing = __webpack_require__(130); + +// The pool into which the canvas elements are placed. +var pool = []; + +// Automatically apply smoothing(false) to created Canvas elements +var _disableContextSmoothing = false; + +/** + * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. + * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, + * which is useless for some of the Phaser pipelines / renderer. + * + * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. + * Which means all instances of Phaser Games on the same page can share the one single pool. + * + * @namespace Phaser.Display.Canvas.CanvasPool + * @since 3.0.0 + */ +var CanvasPool = function () +{ + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? + * + * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool + */ + var create = function (parent, width, height, canvasType, selfParent) + { + if (width === undefined) { width = 1; } + if (height === undefined) { height = 1; } + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } + + var canvas; + var container = first(canvasType); + + if (container === null) + { + container = { + parent: parent, + canvas: document.createElement('canvas'), + type: canvasType + }; + + if (canvasType === CONST.CANVAS) + { + pool.push(container); + } + + canvas = container.canvas; + } + else + { + container.parent = parent; + + canvas = container.canvas; + } + + if (selfParent) + { + container.parent = canvas; + } + + canvas.width = width; + canvas.height = height; + + if (_disableContextSmoothing && canvasType === CONST.CANVAS) + { + Smoothing.disable(canvas.getContext('2d')); + } + + return canvas; + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create2D + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created canvas. + */ + var create2D = function (parent, width, height) + { + return create(parent, width, height, CONST.CANVAS); + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.createWebGL + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created WebGL canvas. + */ + var createWebGL = function (parent, width, height) + { + return create(parent, width, height, CONST.WEBGL); + }; + + /** + * Gets the first free canvas index from the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.first + * @since 3.0.0 + * + * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * + * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + */ + var first = function (canvasType) + { + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + + if (canvasType === CONST.WEBGL) + { + return null; + } + + for (var i = 0; i < pool.length; i++) + { + var container = pool[i]; + + if (!container.parent && container.type === canvasType) + { + return container; + } + } + + return null; + }; + + /** + * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. + * The canvas has its width and height set to 1, and its parent attribute nulled. + * + * @function Phaser.Display.Canvas.CanvasPool.remove + * @since 3.0.0 + * + * @param {*} parent - The canvas or the parent of the canvas to free. + */ + var remove = function (parent) + { + // Check to see if the parent is a canvas object + var isCanvas = parent instanceof HTMLCanvasElement; + + pool.forEach(function (container) + { + if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) + { + container.parent = null; + container.canvas.width = 1; + container.canvas.height = 1; + } + }); + }; + + /** + * Gets the total number of used canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.total + * @since 3.0.0 + * + * @return {integer} The number of used canvases. + */ + var total = function () + { + var c = 0; + + pool.forEach(function (container) + { + if (container.parent) + { + c++; + } + }); + + return c; + }; + + /** + * Gets the total number of free canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.free + * @since 3.0.0 + * + * @return {integer} The number of free canvases. + */ + var free = function () + { + return pool.length - total(); + }; + + /** + * Disable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing + * @since 3.0.0 + */ + var disableSmoothing = function () + { + _disableContextSmoothing = true; + }; + + /** + * Enable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing + * @since 3.0.0 + */ + var enableSmoothing = function () + { + _disableContextSmoothing = false; + }; + + return { + create2D: create2D, + create: create, + createWebGL: createWebGL, + disableSmoothing: disableSmoothing, + enableSmoothing: enableSmoothing, + first: first, + free: free, + pool: pool, + remove: remove, + total: total + }; +}; + +// If we export the called function here, it'll only be invoked once (not every time it's required). +module.exports = CanvasPool(); + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4541,12 +4952,12 @@ module.exports = File; * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix * and then performs the following steps: * - * 1) Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2) Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3) Sets the blend mode of the context to be that used by the Game Object. - * 4) Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5) Saves the context state. - * 6) Sets the final matrix values into the context via setTransform. + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. * * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. * @@ -4613,303 +5024,46 @@ module.exports = SetTransform; /***/ }), -/* 23 */ -/***/ (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; - - -/***/ }), -/* 24 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(26); -var Smoothing = __webpack_require__(120); - -// The pool into which the canvas elements are placed. -var pool = []; - -// Automatically apply smoothing(false) to created Canvas elements -var _disableContextSmoothing = false; - /** - * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. - * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, - * which is useless for some of the Phaser pipelines / renderer. - * - * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. - * Which means all instances of Phaser Games on the same page can share the one single pool. - * - * @namespace Phaser.Display.Canvas.CanvasPool - * @since 3.0.0 + * @namespace Phaser.Core.Events */ -var CanvasPool = function () -{ - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? - * - * @return {HTMLCanvasElement} [description] - */ - var create = function (parent, width, height, canvasType, selfParent) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = 1; } - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (selfParent === undefined) { selfParent = false; } - var canvas; - var container = first(canvasType); +module.exports = { - if (container === null) - { - container = { - parent: parent, - canvas: document.createElement('canvas'), - type: canvasType - }; + BLUR: __webpack_require__(1190), + BOOT: __webpack_require__(1189), + DESTROY: __webpack_require__(1188), + FOCUS: __webpack_require__(1187), + HIDDEN: __webpack_require__(1186), + PAUSE: __webpack_require__(1185), + POST_RENDER: __webpack_require__(1184), + POST_STEP: __webpack_require__(1183), + PRE_RENDER: __webpack_require__(1182), + PRE_STEP: __webpack_require__(1181), + READY: __webpack_require__(1180), + RESUME: __webpack_require__(1179), + STEP: __webpack_require__(1178), + VISIBLE: __webpack_require__(1177) - if (canvasType === CONST.CANVAS) - { - pool.push(container); - } - - canvas = container.canvas; - } - else - { - container.parent = parent; - - canvas = container.canvas; - } - - if (selfParent) - { - container.parent = canvas; - } - - canvas.width = width; - canvas.height = height; - - if (_disableContextSmoothing && canvasType === CONST.CANVAS) - { - Smoothing.disable(canvas.getContext('2d')); - } - - return canvas; - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create2D - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} [description] - */ - var create2D = function (parent, width, height) - { - return create(parent, width, height, CONST.CANVAS); - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.createWebGL - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} [description] - */ - var createWebGL = function (parent, width, height) - { - return create(parent, width, height, CONST.WEBGL); - }; - - /** - * Gets the first free canvas index from the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.first - * @since 3.0.0 - * - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * - * @return {HTMLCanvasElement} [description] - */ - var first = function (canvasType) - { - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - - if (canvasType === CONST.WEBGL) - { - return null; - } - - for (var i = 0; i < pool.length; i++) - { - var container = pool[i]; - - if (!container.parent && container.type === canvasType) - { - return container; - } - } - - return null; - }; - - /** - * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. - * The canvas has its width and height set to 1, and its parent attribute nulled. - * - * @function Phaser.Display.Canvas.CanvasPool.remove - * @since 3.0.0 - * - * @param {*} parent - [description] - */ - var remove = function (parent) - { - // Check to see if the parent is a canvas object - var isCanvas = parent instanceof HTMLCanvasElement; - - pool.forEach(function (container) - { - if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) - { - container.parent = null; - container.canvas.width = 1; - container.canvas.height = 1; - } - }); - }; - - /** - * Gets the total number of used canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.total - * @since 3.0.0 - * - * @return {integer} [description] - */ - var total = function () - { - var c = 0; - - pool.forEach(function (container) - { - if (container.parent) - { - c++; - } - }); - - return c; - }; - - /** - * Gets the total number of free canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.free - * @since 3.0.0 - * - * @return {integer} [description] - */ - var free = function () - { - return pool.length - total(); - }; - - /** - * Disable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing - * @since 3.0.0 - */ - var disableSmoothing = function () - { - _disableContextSmoothing = true; - }; - - /** - * Enable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing - * @since 3.0.0 - */ - var enableSmoothing = function () - { - _disableContextSmoothing = false; - }; - - return { - create2D: create2D, - create: create, - createWebGL: createWebGL, - disableSmoothing: disableSmoothing, - enableSmoothing: enableSmoothing, - first: first, - free: free, - pool: pool, - remove: remove, - total: total - }; }; -// If we export the called function here, it'll only be invoked once (not every time it's required). -module.exports = CanvasPool(); - /***/ }), -/* 25 */ +/* 27 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4971,12 +5125,12 @@ module.exports = PropertyValueSet; /***/ }), -/* 26 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4996,11 +5150,11 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.15.1', + VERSION: '3.16.2', - BlendModes: __webpack_require__(66), + BlendModes: __webpack_require__(60), - ScaleModes: __webpack_require__(94), + ScaleModes: __webpack_require__(101), /** * AUTO Detect Renderer. @@ -5109,19 +5263,19 @@ module.exports = CONST; /***/ }), -/* 27 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var Line = __webpack_require__(54); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var Line = __webpack_require__(59); /** * @classdesc @@ -5345,6 +5499,7 @@ var Shape = new Class({ * @method Phaser.GameObjects.Shape#setStrokeStyle * @since 3.13.0 * + * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. * @@ -5410,18 +5565,18 @@ module.exports = Shape; /***/ }), -/* 28 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); +var BlendModes = __webpack_require__(60); var GetAdvancedValue = __webpack_require__(12); -var ScaleModes = __webpack_require__(94); +var ScaleModes = __webpack_require__(101); /** * @typedef {object} GameObjectConfig @@ -5563,12 +5718,12 @@ module.exports = BuildGameObject; /***/ }), -/* 29 */ +/* 31 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -5617,385 +5772,25 @@ module.exports = { }; -/***/ }), -/* 30 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Sets the fillStyle on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#FillStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. - */ -var FillStyleCanvas = function (ctx, src, altColor) -{ - var fillColor = (altColor) ? altColor : src.fillColor; - var fillAlpha = src.fillAlpha; - - var red = ((fillColor & 0xFF0000) >>> 16); - var green = ((fillColor & 0xFF00) >>> 8); - var blue = (fillColor & 0xFF); - - ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; -}; - -module.exports = FillStyleCanvas; - - -/***/ }), -/* 31 */ -/***/ (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 CONST = __webpack_require__(16); - -/** - * Convert the given angle from degrees, to the equivalent angle in radians. - * - * @function Phaser.Math.DegToRad - * @since 3.0.0 - * - * @param {integer} degrees - The angle (in degrees) to convert to radians. - * - * @return {number} The given angle converted to radians. - */ -var DegToRad = function (degrees) -{ - return degrees * CONST.DEG_TO_RAD; -}; - -module.exports = DegToRad; - - /***/ }), /* 32 */ -/***/ (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 an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then adds the given value to it. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` - * - * @function Phaser.Actions.PropertyValueInc - * @since 3.3.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to be added to the property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var PropertyValueInc = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } - - var i; - var t = 0; - var end = items.length; - - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] += value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) - { - items[i][key] += value + (t * step); - t++; - } - } - - return items; -}; - -module.exports = PropertyValueInc; - - -/***/ }), -/* 33 */, -/* 34 */ /***/ (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 GetTileAt = __webpack_require__(102); -var GetTilesWithin = __webpack_require__(17); - -/** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. - * - * @function Phaser.Tilemaps.Components.CalculateFacesWithin - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var CalculateFacesWithin = function (tileX, tileY, width, height, layer) -{ - var above = null; - var below = null; - var left = null; - var right = null; - - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - - for (var i = 0; i < tiles.length; i++) - { - var tile = tiles[i]; - - if (tile) - { - if (tile.collides) - { - above = GetTileAt(tile.x, tile.y - 1, true, layer); - below = GetTileAt(tile.x, tile.y + 1, true, layer); - left = GetTileAt(tile.x - 1, tile.y, true, layer); - right = GetTileAt(tile.x + 1, tile.y, true, layer); - - tile.faceTop = (above && above.collides) ? false : true; - tile.faceBottom = (below && below.collides) ? false : true; - tile.faceLeft = (left && left.collides) ? false : true; - tile.faceRight = (right && right.collides) ? false : true; - } - else - { - tile.resetFaces(); - } - } - } -}; - -module.exports = CalculateFacesWithin; - - -/***/ }), -/* 35 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Arcade Physics consts. - * - * @ignore - */ - -var CONST = { - - /** - * Dynamic Body. - * - * @name Phaser.Physics.Arcade.DYNAMIC_BODY - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.Group#physicsType - */ - DYNAMIC_BODY: 0, - - /** - * Static Body. - * - * @name Phaser.Physics.Arcade.STATIC_BODY - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.StaticBody#physicsType - */ - STATIC_BODY: 1, - - /** - * [description] - * - * @name Phaser.Physics.Arcade.GROUP - * @readonly - * @type {number} - * @since 3.0.0 - */ - GROUP: 2, - - /** - * [description] - * - * @name Phaser.Physics.Arcade.TILEMAPLAYER - * @readonly - * @type {number} - * @since 3.0.0 - */ - TILEMAPLAYER: 3, - - /** - * Facing no direction (initial value). - * - * @name Phaser.Physics.Arcade.FACING_NONE - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_NONE: 10, - - /** - * Facing up. - * - * @name Phaser.Physics.Arcade.FACING_UP - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_UP: 11, - - /** - * Facing down. - * - * @name Phaser.Physics.Arcade.FACING_DOWN - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_DOWN: 12, - - /** - * Facing left. - * - * @name Phaser.Physics.Arcade.FACING_LEFT - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_LEFT: 13, - - /** - * Facing right. - * - * @name Phaser.Physics.Arcade.FACING_RIGHT - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_RIGHT: 14 - -}; - -module.exports = CONST; - - -/***/ }), -/* 36 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Sets the strokeStyle and lineWidth on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#LineStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. - */ -var LineStyleCanvas = function (ctx, src) -{ - var strokeColor = src.strokeColor; - var strokeAlpha = src.strokeAlpha; - - var red = ((strokeColor & 0xFF0000) >>> 16); - var green = ((strokeColor & 0xFF00) >>> 8); - var blue = (strokeColor & 0xFF); - - ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; - ctx.lineWidth = src.lineWidth; -}; - -module.exports = LineStyleCanvas; - - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(177); -var GetColor32 = __webpack_require__(376); -var HSVToRGB = __webpack_require__(176); -var RGBToHSV = __webpack_require__(375); +var GetColor = __webpack_require__(191); +var GetColor32 = __webpack_require__(409); +var HSVToRGB = __webpack_require__(190); +var RGBToHSV = __webpack_require__(408); + +/** + * @namespace Phaser.Display.Color + */ /** * @classdesc @@ -6841,12 +6636,411 @@ module.exports = Color; /***/ }), -/* 38 */ +/* 33 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Sets the fillStyle on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#FillStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. + */ +var FillStyleCanvas = function (ctx, src, altColor) +{ + var fillColor = (altColor) ? altColor : src.fillColor; + var fillAlpha = src.fillAlpha; + + var red = ((fillColor & 0xFF0000) >>> 16); + var green = ((fillColor & 0xFF00) >>> 8); + var blue = (fillColor & 0xFF); + + ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; +}; + +module.exports = FillStyleCanvas; + + +/***/ }), +/* 34 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Convert the given angle from degrees, to the equivalent angle in radians. + * + * @function Phaser.Math.DegToRad + * @since 3.0.0 + * + * @param {integer} degrees - The angle (in degrees) to convert to radians. + * + * @return {number} The given angle converted to radians. + */ +var DegToRad = function (degrees) +{ + return degrees * CONST.DEG_TO_RAD; +}; + +module.exports = DegToRad; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then adds the given value to it. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueInc + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to be added to the property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var PropertyValueInc = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } + + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] += value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] += value + (t * step); + t++; + } + } + + return items; +}; + +module.exports = PropertyValueInc; + + +/***/ }), +/* 36 */, +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetTileAt = __webpack_require__(109); +var GetTilesWithin = __webpack_require__(21); + +/** + * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the + * layer. Interesting faces are used internally for optimizing collisions against tiles. This method + * is mostly used internally. + * + * @function Phaser.Tilemaps.Components.CalculateFacesWithin + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesWithin = function (tileX, tileY, width, height, layer) +{ + var above = null; + var below = null; + var left = null; + var right = null; + + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + + for (var i = 0; i < tiles.length; i++) + { + var tile = tiles[i]; + + if (tile) + { + if (tile.collides) + { + above = GetTileAt(tile.x, tile.y - 1, true, layer); + below = GetTileAt(tile.x, tile.y + 1, true, layer); + left = GetTileAt(tile.x - 1, tile.y, true, layer); + right = GetTileAt(tile.x + 1, tile.y, true, layer); + + tile.faceTop = (above && above.collides) ? false : true; + tile.faceBottom = (below && below.collides) ? false : true; + tile.faceLeft = (left && left.collides) ? false : true; + tile.faceRight = (right && right.collides) ? false : true; + } + else + { + tile.resetFaces(); + } + } + } +}; + +module.exports = CalculateFacesWithin; + + +/***/ }), +/* 38 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Arcade Physics consts. + * + * @ignore + */ + +var CONST = { + + /** + * Dynamic Body. + * + * @name Phaser.Physics.Arcade.DYNAMIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.Group#physicsType + */ + DYNAMIC_BODY: 0, + + /** + * Static Body. + * + * @name Phaser.Physics.Arcade.STATIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.StaticBody#physicsType + */ + STATIC_BODY: 1, + + /** + * Arcade Physics Group containing Dynamic Bodies. + * + * @name Phaser.Physics.Arcade.GROUP + * @readonly + * @type {number} + * @since 3.0.0 + */ + GROUP: 2, + + /** + * A Tilemap Layer. + * + * @name Phaser.Physics.Arcade.TILEMAPLAYER + * @readonly + * @type {number} + * @since 3.0.0 + */ + TILEMAPLAYER: 3, + + /** + * Facing no direction (initial value). + * + * @name Phaser.Physics.Arcade.FACING_NONE + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_NONE: 10, + + /** + * Facing up. + * + * @name Phaser.Physics.Arcade.FACING_UP + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_UP: 11, + + /** + * Facing down. + * + * @name Phaser.Physics.Arcade.FACING_DOWN + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_DOWN: 12, + + /** + * Facing left. + * + * @name Phaser.Physics.Arcade.FACING_LEFT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_LEFT: 13, + + /** + * Facing right. + * + * @name Phaser.Physics.Arcade.FACING_RIGHT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_RIGHT: 14 + +}; + +module.exports = CONST; + + +/***/ }), +/* 39 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Sets the strokeStyle and lineWidth on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#LineStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. + */ +var LineStyleCanvas = function (ctx, src) +{ + var strokeColor = src.strokeColor; + var strokeAlpha = src.strokeAlpha; + + var red = ((strokeColor & 0xFF0000) >>> 16); + var green = ((strokeColor & 0xFF00) >>> 8); + var blue = (strokeColor & 0xFF); + + ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; + ctx.lineWidth = src.lineWidth; +}; + +module.exports = LineStyleCanvas; + + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ + +module.exports = { + + DESTROY: __webpack_require__(1168), + FADE_IN_COMPLETE: __webpack_require__(1167), + FADE_IN_START: __webpack_require__(1166), + FADE_OUT_COMPLETE: __webpack_require__(1165), + FADE_OUT_START: __webpack_require__(1164), + FLASH_COMPLETE: __webpack_require__(1163), + FLASH_START: __webpack_require__(1162), + PAN_COMPLETE: __webpack_require__(1161), + PAN_START: __webpack_require__(1160), + POST_RENDER: __webpack_require__(1159), + PRE_RENDER: __webpack_require__(1158), + SHAKE_COMPLETE: __webpack_require__(1157), + SHAKE_START: __webpack_require__(1156), + ZOOM_COMPLETE: __webpack_require__(1155), + ZOOM_START: __webpack_require__(1154) + +}; + + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7573,7 +7767,11 @@ var TransformMatrix = new Class({ }, /** - * Decompose this Matrix into its translation, scale and rotation values. + * Decompose this Matrix into its translation, scale and rotation values using QR decomposition. + * + * The result must be applied in the following order to reproduce the current matrix: + * + * translate -> rotate -> scale * * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix * @since 3.0.0 @@ -7596,21 +7794,33 @@ var TransformMatrix = new Class({ var c = matrix[2]; var d = matrix[3]; - var a2 = a * a; - var b2 = b * b; - var c2 = c * c; - var d2 = d * d; - - var sx = Math.sqrt(a2 + c2); - var sy = Math.sqrt(b2 + d2); + var determ = a * d - b * c; decomposedMatrix.translateX = matrix[4]; decomposedMatrix.translateY = matrix[5]; - decomposedMatrix.scaleX = sx; - decomposedMatrix.scaleY = sy; + if (a || b) + { + var r = Math.sqrt(a * a + b * b); - decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); + decomposedMatrix.rotation = (b > 0) ? Math.acos(a / r) : -Math.acos(a / r); + decomposedMatrix.scaleX = r; + decomposedMatrix.scaleY = determ / r; + } + else if (c || d) + { + var s = Math.sqrt(c * c + d * d); + + decomposedMatrix.rotation = Math.PI * 0.5 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); + decomposedMatrix.scaleX = determ / s; + decomposedMatrix.scaleY = s; + } + else + { + decomposedMatrix.rotation = 0; + decomposedMatrix.scaleX = 0; + decomposedMatrix.scaleY = 0; + } return decomposedMatrix; }, @@ -7752,26 +7962,26 @@ module.exports = TransformMatrix; /***/ }), -/* 39 */ +/* 42 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if a given point is inside a Rectangle's bounds. * * @function Phaser.Geom.Rectangle.Contains * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. */ var Contains = function (rect, x, y) { @@ -7787,12 +7997,12 @@ module.exports = Contains; /***/ }), -/* 40 */ +/* 43 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7828,12 +8038,12 @@ module.exports = Contains; /***/ }), -/* 41 */ +/* 44 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7861,12 +8071,12 @@ module.exports = SetTop; /***/ }), -/* 42 */ +/* 45 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7889,12 +8099,12 @@ module.exports = GetTop; /***/ }), -/* 43 */ +/* 46 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7922,12 +8132,12 @@ module.exports = SetRight; /***/ }), -/* 44 */ +/* 47 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7950,12 +8160,12 @@ module.exports = GetRight; /***/ }), -/* 45 */ +/* 48 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7983,12 +8193,12 @@ module.exports = SetLeft; /***/ }), -/* 46 */ +/* 49 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8011,12 +8221,12 @@ module.exports = GetLeft; /***/ }), -/* 47 */ +/* 50 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8044,12 +8254,12 @@ module.exports = SetBottom; /***/ }), -/* 48 */ +/* 51 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8072,12 +8282,75 @@ module.exports = GetBottom; /***/ }), -/* 49 */ +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: __webpack_require__(994), + DESTROY: __webpack_require__(993), + DRAG_END: __webpack_require__(992), + DRAG_ENTER: __webpack_require__(991), + DRAG: __webpack_require__(990), + DRAG_LEAVE: __webpack_require__(989), + DRAG_OVER: __webpack_require__(988), + DRAG_START: __webpack_require__(987), + DROP: __webpack_require__(986), + GAME_OUT: __webpack_require__(985), + GAME_OVER: __webpack_require__(984), + GAMEOBJECT_DOWN: __webpack_require__(983), + GAMEOBJECT_DRAG_END: __webpack_require__(982), + GAMEOBJECT_DRAG_ENTER: __webpack_require__(981), + GAMEOBJECT_DRAG: __webpack_require__(980), + GAMEOBJECT_DRAG_LEAVE: __webpack_require__(979), + GAMEOBJECT_DRAG_OVER: __webpack_require__(978), + GAMEOBJECT_DRAG_START: __webpack_require__(977), + GAMEOBJECT_DROP: __webpack_require__(976), + GAMEOBJECT_MOVE: __webpack_require__(975), + GAMEOBJECT_OUT: __webpack_require__(974), + GAMEOBJECT_OVER: __webpack_require__(973), + GAMEOBJECT_POINTER_DOWN: __webpack_require__(972), + GAMEOBJECT_POINTER_MOVE: __webpack_require__(971), + GAMEOBJECT_POINTER_OUT: __webpack_require__(970), + GAMEOBJECT_POINTER_OVER: __webpack_require__(969), + GAMEOBJECT_POINTER_UP: __webpack_require__(968), + GAMEOBJECT_UP: __webpack_require__(967), + MANAGER_BOOT: __webpack_require__(966), + MANAGER_PROCESS: __webpack_require__(965), + MANAGER_UPDATE: __webpack_require__(964), + POINTER_DOWN: __webpack_require__(963), + POINTER_DOWN_OUTSIDE: __webpack_require__(962), + POINTER_MOVE: __webpack_require__(961), + POINTER_OUT: __webpack_require__(960), + POINTER_OVER: __webpack_require__(959), + POINTER_UP: __webpack_require__(958), + POINTER_UP_OUTSIDE: __webpack_require__(957), + POINTERLOCK_CHANGE: __webpack_require__(956), + PRE_UPDATE: __webpack_require__(955), + SHUTDOWN: __webpack_require__(954), + START: __webpack_require__(953), + UPDATE: __webpack_require__(952) + +}; + + +/***/ }), +/* 53 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8123,12 +8396,12 @@ module.exports = WorldToTileY; /***/ }), -/* 50 */ +/* 54 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8174,18 +8447,18 @@ module.exports = WorldToTileX; /***/ }), -/* 51 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); @@ -8414,12 +8687,12 @@ module.exports = JSONFile; /***/ }), -/* 52 */ +/* 56 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8448,12 +8721,12 @@ module.exports = DistanceBetween; /***/ }), -/* 53 */ +/* 57 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8480,19 +8753,47 @@ module.exports = Wrap; /***/ }), -/* 54 */ +/* 58 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the length of the given line. + * + * @function Phaser.Geom.Line.Length + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the length of. + * + * @return {number} The length of the line. + */ +var Length = function (line) +{ + return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); +}; + +module.exports = Length; + + +/***/ }), +/* 59 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(397); -var GetPoints = __webpack_require__(189); -var Random = __webpack_require__(188); +var GetPoint = __webpack_require__(429); +var GetPoints = __webpack_require__(203); +var Random = __webpack_require__(202); var Vector2 = __webpack_require__(3); /** @@ -8805,18 +9106,273 @@ module.exports = Line; /***/ }), -/* 55 */ +/* 60 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Blend Modes. + * + * @name Phaser.BlendModes + * @enum {integer} + * @memberof Phaser + * @readonly + * @since 3.0.0 + */ + +module.exports = { + + /** + * Skips the Blend Mode check in the renderer. + * + * @name Phaser.BlendModes.SKIP_CHECK + */ + SKIP_CHECK: -1, + + /** + * Normal blend mode. For Canvas and WebGL. + * This is the default setting and draws new shapes on top of the existing canvas content. + * + * @name Phaser.BlendModes.NORMAL + */ + NORMAL: 0, + + /** + * Add blend mode. For Canvas and WebGL. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.ADD + */ + ADD: 1, + + /** + * Multiply blend mode. For Canvas and WebGL. + * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. + * + * @name Phaser.BlendModes.MULTIPLY + */ + MULTIPLY: 2, + + /** + * Screen blend mode. For Canvas and WebGL. + * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) + * + * @name Phaser.BlendModes.SCREEN + */ + SCREEN: 3, + + /** + * Overlay blend mode. For Canvas only. + * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. + * + * @name Phaser.BlendModes.OVERLAY + */ + OVERLAY: 4, + + /** + * Darken blend mode. For Canvas only. + * Retains the darkest pixels of both layers. + * + * @name Phaser.BlendModes.DARKEN + */ + DARKEN: 5, + + /** + * Lighten blend mode. For Canvas only. + * Retains the lightest pixels of both layers. + * + * @name Phaser.BlendModes.LIGHTEN + */ + LIGHTEN: 6, + + /** + * Color Dodge blend mode. For Canvas only. + * Divides the bottom layer by the inverted top layer. + * + * @name Phaser.BlendModes.COLOR_DODGE + */ + COLOR_DODGE: 7, + + /** + * Color Burn blend mode. For Canvas only. + * Divides the inverted bottom layer by the top layer, and then inverts the result. + * + * @name Phaser.BlendModes.COLOR_BURN + */ + COLOR_BURN: 8, + + /** + * Hard Light blend mode. For Canvas only. + * A combination of multiply and screen like overlay, but with top and bottom layer swapped. + * + * @name Phaser.BlendModes.HARD_LIGHT + */ + HARD_LIGHT: 9, + + /** + * Soft Light blend mode. For Canvas only. + * A softer version of hard-light. Pure black or white does not result in pure black or white. + * + * @name Phaser.BlendModes.SOFT_LIGHT + */ + SOFT_LIGHT: 10, + + /** + * Difference blend mode. For Canvas only. + * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. + * + * @name Phaser.BlendModes.DIFFERENCE + */ + DIFFERENCE: 11, + + /** + * Exclusion blend mode. For Canvas only. + * Like difference, but with lower contrast. + * + * @name Phaser.BlendModes.EXCLUSION + */ + EXCLUSION: 12, + + /** + * Hue blend mode. For Canvas only. + * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. + * + * @name Phaser.BlendModes.HUE + */ + HUE: 13, + + /** + * Saturation blend mode. For Canvas only. + * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. + * + * @name Phaser.BlendModes.SATURATION + */ + SATURATION: 14, + + /** + * Color blend mode. For Canvas only. + * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. + * + * @name Phaser.BlendModes.COLOR + */ + COLOR: 15, + + /** + * Luminosity blend mode. For Canvas only. + * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. + * + * @name Phaser.BlendModes.LUMINOSITY + */ + LUMINOSITY: 16, + + /** + * Alpha erase blend mode. For Canvas and WebGL. + * + * @name Phaser.BlendModes.ERASE + */ + ERASE: 17, + + /** + * Source-in blend mode. For Canvas only. + * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.SOURCE_IN + */ + SOURCE_IN: 18, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is drawn where it doesn't overlap the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_OUT + */ + SOURCE_OUT: 19, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is only drawn where it overlaps the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_ATOP + */ + SOURCE_ATOP: 20, + + /** + * Destination-over blend mode. For Canvas only. + * New shapes are drawn behind the existing canvas content. + * + * @name Phaser.BlendModes.DESTINATION_OVER + */ + DESTINATION_OVER: 21, + + /** + * Destination-in blend mode. For Canvas only. + * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.DESTINATION_IN + */ + DESTINATION_IN: 22, + + /** + * Destination-out blend mode. For Canvas only. + * The existing content is kept where it doesn't overlap the new shape. + * + * @name Phaser.BlendModes.DESTINATION_OUT + */ + DESTINATION_OUT: 23, + + /** + * Destination-out blend mode. For Canvas only. + * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. + * + * @name Phaser.BlendModes.DESTINATION_ATOP + */ + DESTINATION_ATOP: 24, + + /** + * Lighten blend mode. For Canvas only. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.LIGHTER + */ + LIGHTER: 25, + + /** + * Copy blend mode. For Canvas only. + * Only the new shape is shown. + * + * @name Phaser.BlendModes.COPY + */ + COPY: 26, + + /** + * xor blend mode. For Canvas only. + * Shapes are made transparent where both overlap and drawn normal everywhere else. + * + * @name Phaser.BlendModes.XOR + */ + XOR: 27 + +}; + + +/***/ }), +/* 61 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var Rectangle = __webpack_require__(265); +var Components = __webpack_require__(13); +var Rectangle = __webpack_require__(270); /** * @classdesc @@ -9520,7 +10076,9 @@ var Tile = new Class({ // bottom left, while the Phaser renderer assumes the origin is the top left. The y // coordinate needs to be adjusted by the difference. this.pixelX = this.x * this.baseWidth; - this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); + this.pixelY = this.y * this.baseHeight; + + // this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); return this; }, @@ -9571,8 +10129,9 @@ var Tile = new Class({ }, /** - * The tileset that contains this Tile. This will only return null if accessed from a LayerData - * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer. + * The tileset that contains this Tile. This is null if accessed from a LayerData instance + * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has + * an index that doesn't correspond to any of the map's tilesets. * * @name Phaser.Tilemaps.Tile#tileset * @type {?Phaser.Tilemaps.Tileset} @@ -9580,11 +10139,24 @@ var Tile = new Class({ * @since 3.0.0 */ tileset: { + get: function () { - var tilemapLayer = this.tilemapLayer; - return tilemapLayer ? tilemapLayer.tileset : null; + var tilemapLayer = this.layer.tilemapLayer; + + if (tilemapLayer) + { + var tileset = tilemapLayer.gidMap[this.index]; + + if (tileset) + { + return tileset; + } + } + + return null; } + }, /** @@ -9627,12 +10199,12 @@ module.exports = Tile; /***/ }), -/* 56 */ +/* 62 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9663,12 +10235,12 @@ module.exports = SetTileCollision; /***/ }), -/* 57 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9857,18 +10429,18 @@ module.exports = MultiFile; /***/ }), -/* 58 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -10153,21 +10725,21 @@ module.exports = ImageFile; /***/ }), -/* 59 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(69); -var GetPoint = __webpack_require__(278); -var GetPoints = __webpack_require__(277); -var Line = __webpack_require__(54); -var Random = __webpack_require__(184); +var Contains = __webpack_require__(74); +var GetPoint = __webpack_require__(283); +var GetPoints = __webpack_require__(282); +var Line = __webpack_require__(59); +var Random = __webpack_require__(198); /** * @classdesc @@ -10588,16 +11160,16 @@ module.exports = Triangle; /***/ }), -/* 60 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders a stroke outline around the given Shape. @@ -10663,19 +11235,19 @@ module.exports = StrokePathWebGL; /***/ }), -/* 61 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var SpriteRender = __webpack_require__(829); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var SpriteRender = __webpack_require__(852); /** * @classdesc @@ -10843,12 +11415,12 @@ module.exports = Sprite; /***/ }), -/* 62 */ +/* 68 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10892,12 +11464,53 @@ module.exports = SafeRange; /***/ }), -/* 63 */ +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Sound.Events + */ + +module.exports = { + + COMPLETE: __webpack_require__(932), + DESTROY: __webpack_require__(931), + DETUNE: __webpack_require__(930), + GLOBAL_DETUNE: __webpack_require__(929), + GLOBAL_MUTE: __webpack_require__(928), + GLOBAL_RATE: __webpack_require__(927), + GLOBAL_VOLUME: __webpack_require__(926), + LOOP: __webpack_require__(925), + LOOPED: __webpack_require__(924), + MUTE: __webpack_require__(923), + PAUSE_ALL: __webpack_require__(922), + PAUSE: __webpack_require__(921), + PLAY: __webpack_require__(920), + RATE: __webpack_require__(919), + RESUME_ALL: __webpack_require__(918), + RESUME: __webpack_require__(917), + SEEK: __webpack_require__(916), + STOP_ALL: __webpack_require__(915), + STOP: __webpack_require__(914), + UNLOCKED: __webpack_require__(913), + VOLUME: __webpack_require__(912) + +}; + + +/***/ }), +/* 70 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10934,47 +11547,40 @@ module.exports = Clone; /***/ }), -/* 64 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// 2.1.1 (Mar 17, 2016) +// Earcut 2.1.4 (December 4th 2018) /* -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. - -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. + * 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. + * + * 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. */ module.exports = earcut; -/* -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. - */ - function earcut(data, holeIndices, dim) { dim = dim || 2; @@ -10984,9 +11590,9 @@ function earcut(data, holeIndices, dim) { outerNode = linkedList(data, 0, outerLen, dim, true), triangles = []; - if (!outerNode) return triangles; + if (!outerNode || outerNode.next === outerNode.prev) return triangles; - var minX, minY, maxX, maxY, x, y, size; + var minX, minY, maxX, maxY, x, y, invSize; if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); @@ -11004,11 +11610,12 @@ function earcut(data, holeIndices, dim) { if (y > maxY) maxY = y; } - // minX, minY and size are later used to transform coords into integers for z-order calculation - size = Math.max(maxX - minX, maxY - minY); + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 1 / invSize : 0; } - earcutLinked(outerNode, triangles, dim, minX, minY, size); + earcutLinked(outerNode, triangles, dim, minX, minY, invSize); return triangles; } @@ -11044,7 +11651,7 @@ function filterPoints(start, end) { 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; + if (p === p.next) break; again = true; } else { @@ -11056,11 +11663,11 @@ function filterPoints(start, end) { } // main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { +function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { if (!ear) return; // interlink polygon nodes in z-order - if (!pass && size) indexCurve(ear, minX, minY, size); + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); var stop = ear, prev, next; @@ -11070,7 +11677,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { prev = ear.prev; next = ear.next; - if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { // cut off the triangle triangles.push(prev.i / dim); triangles.push(ear.i / dim); @@ -11078,7 +11685,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { removeNode(ear); - // skipping the next vertice leads to less sliver triangles + // skipping the next vertex leads to less sliver triangles ear = next.next; stop = next.next; @@ -11091,16 +11698,16 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { if (ear === stop) { // try filtering points and slicing again if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 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); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, size); + splitEarcut(ear, triangles, dim, minX, minY, invSize); } break; @@ -11128,7 +11735,7 @@ function isEar(ear) { return true; } -function isEarHashed(ear, minX, minY, size) { +function isEarHashed(ear, minX, minY, invSize) { var a = ear.prev, b = ear, c = ear.next; @@ -11142,22 +11749,26 @@ function isEarHashed(ear, minX, minY, size) { 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); + var minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - // first look for points inside the triangle in increasing z-order - var p = ear.nextZ; + var p = ear.prevZ, + n = ear.nextZ; - while (p && p.z <= maxZ) { + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.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; + p = p.prevZ; + + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; } - // then look for points in decreasing z-order - p = ear.prevZ; - + // look for remaining points in decreasing z-order 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) && @@ -11165,6 +11776,14 @@ function isEarHashed(ear, minX, minY, size) { p = p.prevZ; } + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + return true; } @@ -11194,7 +11813,7 @@ function cureLocalIntersections(start, triangles, dim) { } // try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, size) { +function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two var a = start; do { @@ -11209,8 +11828,8 @@ function splitEarcut(start, triangles, dim, minX, minY, size) { c = filterPoints(c, c.next); // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, size); - earcutLinked(c, triangles, dim, minX, minY, size); + earcutLinked(a, triangles, dim, minX, minY, invSize); + earcutLinked(c, triangles, dim, minX, minY, invSize); return; } b = b.next; @@ -11316,10 +11935,10 @@ function findHoleBridge(hole, outerNode) { } // interlink polygon nodes in z-order -function indexCurve(start, minX, minY, size) { +function indexCurve(start, minX, minY, invSize) { var p = start; do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); p.prevZ = p.prev; p.nextZ = p.next; p = p.next; @@ -11384,11 +12003,11 @@ function sortLinked(list) { return list; } -// z-order of a point given coords and size of the data bounding box -function zOrder(x, y, minX, minY, size) { +// z-order of a point given coords and inverse of the longer side of data bbox +function zOrder(x, y, minX, minY, invSize) { // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) / size; - y = 32767 * (y - minY) / size; + x = 32767 * (x - minX) * invSize; + y = 32767 * (y - minY) * invSize; x = (x | (x << 8)) & 0x00FF00FF; x = (x | (x << 4)) & 0x0F0F0F0F; @@ -11530,14 +12149,14 @@ function removeNode(p) { } function Node(i, x, y) { - // vertice index in coordinates array + // vertex index in coordinates array this.i = i; // vertex coordinates this.x = x; this.y = y; - // previous and next vertice nodes in a polygon ring + // previous and next vertex nodes in a polygon ring this.prev = null; this.next = null; @@ -11608,193 +12227,15 @@ earcut.flatten = function (data) { return result; }; + /***/ }), -/* 65 */ +/* 72 */, +/* 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} - */ - -/** - * Calculate the length of the given line. - * - * @function Phaser.Geom.Line.Length - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the length of. - * - * @return {number} The length of the line. - */ -var Length = function (line) -{ - return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); -}; - -module.exports = Length; - - -/***/ }), -/* 66 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Phaser Blend Modes. - * - * @name Phaser.BlendModes - * @enum {integer} - * @memberof Phaser - * @readonly - * @since 3.0.0 - */ - -module.exports = { - - /** - * Skips the Blend Mode check in the renderer. - * - * @name Phaser.BlendModes.SKIP_CHECK - */ - SKIP_CHECK: -1, - - /** - * Normal blend mode. - * - * @name Phaser.BlendModes.NORMAL - */ - NORMAL: 0, - - /** - * Add blend mode. - * - * @name Phaser.BlendModes.ADD - */ - ADD: 1, - - /** - * Multiply blend mode. - * - * @name Phaser.BlendModes.MULTIPLY - */ - MULTIPLY: 2, - - /** - * Screen blend mode. - * - * @name Phaser.BlendModes.SCREEN - */ - SCREEN: 3, - - /** - * Overlay blend mode. - * - * @name Phaser.BlendModes.OVERLAY - */ - OVERLAY: 4, - - /** - * Darken blend mode. - * - * @name Phaser.BlendModes.DARKEN - */ - DARKEN: 5, - - /** - * Lighten blend mode. - * - * @name Phaser.BlendModes.LIGHTEN - */ - LIGHTEN: 6, - - /** - * Color Dodge blend mode. - * - * @name Phaser.BlendModes.COLOR_DODGE - */ - COLOR_DODGE: 7, - - /** - * Color Burn blend mode. - * - * @name Phaser.BlendModes.COLOR_BURN - */ - COLOR_BURN: 8, - - /** - * Hard Light blend mode. - * - * @name Phaser.BlendModes.HARD_LIGHT - */ - HARD_LIGHT: 9, - - /** - * Soft Light blend mode. - * - * @name Phaser.BlendModes.SOFT_LIGHT - */ - SOFT_LIGHT: 10, - - /** - * Difference blend mode. - * - * @name Phaser.BlendModes.DIFFERENCE - */ - DIFFERENCE: 11, - - /** - * Exclusion blend mode. - * - * @name Phaser.BlendModes.EXCLUSION - */ - EXCLUSION: 12, - - /** - * Hue blend mode. - * - * @name Phaser.BlendModes.HUE - */ - HUE: 13, - - /** - * Saturation blend mode. - * - * @name Phaser.BlendModes.SATURATION - */ - SATURATION: 14, - - /** - * Color blend mode. - * - * @name Phaser.BlendModes.COLOR - */ - COLOR: 15, - - /** - * Luminosity blend mode. - * - * @name Phaser.BlendModes.LUMINOSITY - */ - LUMINOSITY: 16 - -}; - - -/***/ }), -/* 67 */, -/* 68 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11817,28 +12258,28 @@ module.exports = Angle; /***/ }), -/* 69 */ +/* 74 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // http://www.blackpawn.com/texts/pointinpoly/ /** - * [description] + * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. * * @function Phaser.Geom.Triangle.Contains * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. */ var Contains = function (triangle, x, y) { @@ -11870,18 +12311,48 @@ module.exports = Contains; /***/ }), -/* 70 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Loader.Events + */ + +module.exports = { + + ADD: __webpack_require__(945), + COMPLETE: __webpack_require__(944), + FILE_COMPLETE: __webpack_require__(943), + FILE_KEY_COMPLETE: __webpack_require__(942), + FILE_LOAD_ERROR: __webpack_require__(941), + FILE_LOAD: __webpack_require__(940), + FILE_PROGRESS: __webpack_require__(939), + POST_PROCESS: __webpack_require__(938), + PROGRESS: __webpack_require__(937), + START: __webpack_require__(936) + +}; + + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(173); -var Rectangle = __webpack_require__(9); +var FromPoints = __webpack_require__(180); +var Rectangle = __webpack_require__(10); var Vector2 = __webpack_require__(3); /** @@ -12445,20 +12916,20 @@ module.exports = Curve; /***/ }), -/* 71 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(40); -var GetPoint = __webpack_require__(405); -var GetPoints = __webpack_require__(403); -var Random = __webpack_require__(191); +var Contains = __webpack_require__(43); +var GetPoint = __webpack_require__(438); +var GetPoints = __webpack_require__(437); +var Random = __webpack_require__(206); /** * @classdesc @@ -12808,12 +13279,12 @@ module.exports = Circle; /***/ }), -/* 72 */ +/* 78 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12836,12 +13307,12 @@ module.exports = GetCenterY; /***/ }), -/* 73 */ +/* 79 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12871,12 +13342,12 @@ module.exports = SetCenterY; /***/ }), -/* 74 */ +/* 80 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12906,12 +13377,12 @@ module.exports = SetCenterX; /***/ }), -/* 75 */ +/* 81 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12934,19 +13405,42 @@ module.exports = GetCenterX; /***/ }), -/* 76 */, -/* 77 */ +/* 82 */, +/* 83 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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); +/** + * @typedef {object} MapDataConfig + * @property {string} [name] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @property {number} [width=0] - The width of the entire tilemap. + * @property {number} [height=0] - The height of the entire tilemap. + * @property {number} [tileWidth=0] - The width of the tiles. + * @property {number} [tileHeight=0] - The height of the tiles. + * @property {number} [widthInPixels] - The width in pixels of the entire tilemap. + * @property {number} [heightInPixels] - The height in pixels of the entire tilemap. + * @property {integer} [format] - The format of the Tilemap, as defined in Tiled. + * @property {string} [orientation] - The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. + * @property {string} [renderOrder] - Determines the draw order of tilemap. Default is right-down. + * @property {number} [version] - The version of Tiled the map uses. + * @property {number} [properties] - Map specific properties (can be specified in Tiled). + * @property {Phaser.Tilemaps.LayerData[]} [layers] - The layers of the tilemap. + * @property {array} [images] - An array with all the layers configured to the MapData. + * @property {object} [objects] - An array of Tiled Image Layers. + * @property {object} [collision] - An object of Tiled Object Layers. + * @property {Phaser.Tilemaps.Tileset[]} [tilesets] - The tilesets the map uses. + * @property {array} [imageCollections] - The collection of images the map uses(specified in Tiled). + * @property {array} [tiles] - [description] + */ + /** * @classdesc * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this @@ -12958,7 +13452,7 @@ var GetFastValue = __webpack_require__(2); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {MapDataConfig} [config] - [description] */ var MapData = new Class({ @@ -12969,7 +13463,7 @@ var MapData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The key in the Phaser cache that corresponds to the loaded tilemap data. * * @name Phaser.Tilemaps.MapData#name * @type {string} @@ -12978,7 +13472,7 @@ var MapData = new Class({ this.name = GetFastValue(config, 'name', 'map'); /** - * [description] + * The width of the entire tilemap. * * @name Phaser.Tilemaps.MapData#width * @type {number} @@ -12987,7 +13481,7 @@ var MapData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height of the entire tilemap. * * @name Phaser.Tilemaps.MapData#height * @type {number} @@ -12996,7 +13490,7 @@ var MapData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The width of the tiles. * * @name Phaser.Tilemaps.MapData#tileWidth * @type {number} @@ -13005,7 +13499,7 @@ var MapData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The height of the tiles. * * @name Phaser.Tilemaps.MapData#tileHeight * @type {number} @@ -13014,7 +13508,7 @@ var MapData = new Class({ this.tileHeight = GetFastValue(config, 'tileHeight', 0); /** - * [description] + * The width in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#widthInPixels * @type {number} @@ -13023,7 +13517,7 @@ var MapData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); /** - * [description] + * The height in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#heightInPixels * @type {number} @@ -13041,7 +13535,7 @@ var MapData = new Class({ this.format = GetFastValue(config, 'format', null); /** - * [description] + * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. * * @name Phaser.Tilemaps.MapData#orientation * @type {string} @@ -13050,7 +13544,12 @@ var MapData = new Class({ this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); /** - * [description] + * Determines the draw order of tilemap. Default is right-down + * + * 0, or 'right-down' + * 1, or 'left-down' + * 2, or 'right-up' + * 3, or 'left-up' * * @name Phaser.Tilemaps.MapData#renderOrder * @type {string} @@ -13059,7 +13558,7 @@ var MapData = new Class({ this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); /** - * [description] + * The version of the map data (as specified in Tiled). * * @name Phaser.Tilemaps.MapData#version * @type {string} @@ -13068,7 +13567,7 @@ var MapData = new Class({ this.version = GetFastValue(config, 'version', '1'); /** - * [description] + * Map specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.MapData#properties * @type {object} @@ -13077,16 +13576,16 @@ var MapData = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * [description] + * An array with all the layers configured to the MapData. * * @name Phaser.Tilemaps.MapData#layers - * @type {array} + * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} * @since 3.0.0 */ this.layers = GetFastValue(config, 'layers', []); /** - * [description] + * An array of Tiled Image Layers. * * @name Phaser.Tilemaps.MapData#images * @type {array} @@ -13095,7 +13594,7 @@ var MapData = new Class({ this.images = GetFastValue(config, 'images', []); /** - * [description] + * An object of Tiled Object Layers. * * @name Phaser.Tilemaps.MapData#objects * @type {object} @@ -13104,7 +13603,7 @@ var MapData = new Class({ this.objects = GetFastValue(config, 'objects', {}); /** - * [description] + * An object of collision data. Must be created as physics object or will return undefined. * * @name Phaser.Tilemaps.MapData#collision * @type {object} @@ -13113,16 +13612,16 @@ var MapData = new Class({ this.collision = GetFastValue(config, 'collision', {}); /** - * [description] + * An array of Tilesets. * * @name Phaser.Tilemaps.MapData#tilesets - * @type {array} + * @type {Phaser.Tilemaps.Tileset[]} * @since 3.0.0 */ this.tilesets = GetFastValue(config, 'tilesets', []); /** - * [description] + * The collection of images the map uses(specified in Tiled) * * @name Phaser.Tilemaps.MapData#imageCollections * @type {array} @@ -13146,12 +13645,12 @@ module.exports = MapData; /***/ }), -/* 78 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13180,7 +13679,7 @@ var LayerData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the layer, if specified in Tiled. * * @name Phaser.Tilemaps.LayerData#name * @type {string} @@ -13189,7 +13688,7 @@ var LayerData = new Class({ this.name = GetFastValue(config, 'name', 'layer'); /** - * [description] + * The x offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#x * @type {number} @@ -13198,7 +13697,7 @@ var LayerData = new Class({ this.x = GetFastValue(config, 'x', 0); /** - * [description] + * The y offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#y * @type {number} @@ -13207,7 +13706,7 @@ var LayerData = new Class({ this.y = GetFastValue(config, 'y', 0); /** - * [description] + * The width in tile of the layer. * * @name Phaser.Tilemaps.LayerData#width * @type {number} @@ -13216,7 +13715,7 @@ var LayerData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height in tiles of the layer. * * @name Phaser.Tilemaps.LayerData#height * @type {number} @@ -13225,7 +13724,7 @@ var LayerData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The pixel width of the tiles. * * @name Phaser.Tilemaps.LayerData#tileWidth * @type {number} @@ -13234,7 +13733,7 @@ var LayerData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The pixel height of the tiles. * * @name Phaser.Tilemaps.LayerData#tileHeight * @type {number} @@ -13261,7 +13760,7 @@ var LayerData = new Class({ this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); /** - * [description] + * The width in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#widthInPixels * @type {number} @@ -13270,7 +13769,7 @@ var LayerData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); /** - * [description] + * The height in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#heightInPixels * @type {number} @@ -13297,7 +13796,7 @@ var LayerData = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * Layer specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.LayerData#properties * @type {object} @@ -13342,10 +13841,10 @@ var LayerData = new Class({ this.bodies = GetFastValue(config, 'bodies', []); /** - * [description] + * An array of the tile indexes * * @name Phaser.Tilemaps.LayerData#data - * @type {array} + * @type {(number[])} * @since 3.0.0 */ this.data = GetFastValue(config, 'data', []); @@ -13366,12 +13865,12 @@ module.exports = LayerData; /***/ }), -/* 79 */ +/* 85 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13397,18 +13896,18 @@ module.exports = IsInLayerBounds; /***/ }), -/* 80 */, -/* 81 */, -/* 82 */ +/* 86 */, +/* 87 */, +/* 88 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders a filled path for the given Shape. @@ -13463,12 +13962,12 @@ module.exports = FillPathWebGL; /***/ }), -/* 83 */ +/* 89 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13635,12 +14134,12 @@ module.exports = TWEEN_CONST; /***/ }), -/* 84 */ +/* 90 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13676,25 +14175,25 @@ module.exports = GetBoolean; /***/ }), -/* 85 */ +/* 91 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Determine whether the source object has a property with the specified key. * * @function Phaser.Utils.Objects.HasValue * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] + * @param {object} source - The source object to be checked. + * @param {string} key - The property to check for within the object * - * @return {boolean} [description] + * @return {boolean} `true` if the provided `key` exists on the `source` object, otherwise `false`. */ var HasValue = function (source, key) { @@ -13705,16 +14204,16 @@ module.exports = HasValue; /***/ }), -/* 86 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EaseMap = __webpack_require__(174); +var EaseMap = __webpack_require__(188); /** * [description] @@ -13767,19 +14266,19 @@ module.exports = GetEaseFunction; /***/ }), -/* 87 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var ImageRender = __webpack_require__(826); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var ImageRender = __webpack_require__(849); /** * @classdesc @@ -13870,23 +14369,24 @@ module.exports = Image; /***/ }), -/* 88 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Actions = __webpack_require__(417); +var Actions = __webpack_require__(450); var Class = __webpack_require__(0); +var Events = __webpack_require__(133); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); var IsPlainObject = __webpack_require__(8); -var Range = __webpack_require__(312); -var Set = __webpack_require__(95); -var Sprite = __webpack_require__(61); +var Range = __webpack_require__(316); +var Set = __webpack_require__(102); +var Sprite = __webpack_require__(67); /** * @callback GroupCallback @@ -13903,7 +14403,7 @@ var Sprite = __webpack_require__(61); /** * @typedef {object} GroupConfig * - * @property {?object} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. + * @property {?GroupClassTypeConstructor} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. * @property {?boolean} [active=true] - Sets {@link Phaser.GameObjects.Group#active}. * @property {?number} [maxSize=-1] - Sets {@link Phaser.GameObjects.Group#maxSize}. * @property {?string} [defaultKey=null] - Sets {@link Phaser.GameObjects.Group#defaultKey}. @@ -13927,7 +14427,7 @@ var Sprite = __webpack_require__(61); * * `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used. * - * @property {?object} [classType] - The class of each new Game Object. + * @property {?GroupClassTypeConstructor} [classType] - The class of each new Game Object. * @property {string} [key] - The texture key of each new Game Object. * @property {?(string|integer)} [frame=null] - The texture frame of each new Game Object. * @property {?boolean} [visible=true] - The visible state of each new Game Object. @@ -13968,6 +14468,18 @@ var Sprite = __webpack_require__(61); * @see Phaser.Utils.Array.Range */ +/** + * A constructor function (class) that can be assigned to `classType`. + * @callback GroupClassTypeConstructor + * @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. + * + * @see Phaser.GameObjects.Group#classType + */ + /** * @classdesc A Group is a way for you to create, manipulate, or recycle similar Game Objects. * @@ -14060,7 +14572,7 @@ var Group = new Class({ * The class to create new group members from. * * @name Phaser.GameObjects.Group#classType - * @type {object} + * @type {GroupClassTypeConstructor} * @since 3.0.0 * @default Phaser.GameObjects.Sprite */ @@ -14435,7 +14947,7 @@ var Group = new Class({ } } - child.on('destroy', this.remove, this); + child.on(Events.DESTROY, this.remove, this); return this; }, @@ -14499,7 +15011,7 @@ var Group = new Class({ this.removeCallback.call(this, child); } - child.off('destroy', this.remove, this); + child.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -14542,7 +15054,7 @@ var Group = new Class({ { var gameObject = children.entries[i]; - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -15074,7 +15586,7 @@ var Group = new Class({ var gameObject = children.entries[i]; // Remove the event hook first or it'll go all recursive hell on us - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); gameObject.destroy(); } @@ -15092,12 +15604,12 @@ module.exports = Group; /***/ }), -/* 89 */ +/* 95 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15134,20 +15646,20 @@ module.exports = Contains; /***/ }), -/* 90 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(89); -var GetPoint = __webpack_require__(308); -var GetPoints = __webpack_require__(307); -var Random = __webpack_require__(185); +var Contains = __webpack_require__(95); +var GetPoint = __webpack_require__(311); +var GetPoints = __webpack_require__(310); +var Random = __webpack_require__(199); /** * @classdesc @@ -15502,12 +16014,12 @@ module.exports = Ellipse; /***/ }), -/* 91 */ +/* 97 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15518,10 +16030,10 @@ module.exports = Ellipse; * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 * - * @param {array} array - [description] - * @param {integer} index - [description] + * @param {array} array - The array to splice from. + * @param {integer} index - The index of the item which should be spliced. * - * @return {*} [description] + * @return {*} The item which was spliced (removed). */ var SpliceOne = function (array, index) { @@ -15548,12 +16060,56 @@ module.exports = SpliceOne; /***/ }), -/* 92 */ +/* 98 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using floor. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. + * As will `14` snap to `10`... but `16` will snap to `15`. + * + * @function Phaser.Math.Snap.Floor + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapFloor = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.floor(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapFloor; + + +/***/ }), +/* 99 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15735,15 +16291,15 @@ function init () module.exports = init(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(907))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1096))) /***/ }), -/* 93 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15772,12 +16328,12 @@ module.exports = FromPercent; /***/ }), -/* 94 */ +/* 101 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15818,25 +16374,24 @@ module.exports = { /***/ }), -/* 95 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * @callback EachSetCallback - * @generic E - [entry] + * @callback EachSetCallback * - * @param {*} entry - [description] - * @param {number} index - [description] + * @param {E} entry - The Set entry. + * @param {number} index - The index of the entry within the Set. * - * @return {?boolean} [description] + * @return {?boolean} The callback result. */ /** @@ -16002,7 +16557,7 @@ var Set = new Class({ * @genericUse {Phaser.Structs.Set.} - [$return] * * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} callbackScope - The scope of the callback. + * @param {*} [callbackScope] - The scope of the callback. * * @return {Phaser.Structs.Set} This Set object. */ @@ -16047,7 +16602,7 @@ var Set = new Class({ * @genericUse {Phaser.Structs.Set.} - [$return] * * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} callbackScope - The scope of the callback. + * @param {*} [callbackScope] - The scope of the callback. * * @return {Phaser.Structs.Set} This Set object. */ @@ -16268,16 +16823,16 @@ module.exports = Set; /***/ }), -/* 96 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Creates a new Object using all values from obj1 and obj2. @@ -16286,10 +16841,10 @@ var Clone = __webpack_require__(63); * @function Phaser.Utils.Objects.Merge * @since 3.0.0 * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] + * @param {object} obj1 - The first object. + * @param {object} obj2 - The second object. * - * @return {object} [description] + * @return {object} A new object containing the union of obj1's and obj2's properties. */ var Merge = function (obj1, obj2) { @@ -16310,26 +16865,26 @@ module.exports = Merge; /***/ }), -/* 97 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(129); +var Defaults = __webpack_require__(141); var GetAdvancedValue = __webpack_require__(12); -var GetBoolean = __webpack_require__(84); -var GetEaseFunction = __webpack_require__(86); -var GetNewValue = __webpack_require__(98); -var GetProps = __webpack_require__(205); -var GetTargets = __webpack_require__(131); +var GetBoolean = __webpack_require__(90); +var GetEaseFunction = __webpack_require__(92); +var GetNewValue = __webpack_require__(105); +var GetProps = __webpack_require__(221); +var GetTargets = __webpack_require__(143); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(130); -var Tween = __webpack_require__(128); -var TweenData = __webpack_require__(127); +var GetValueOp = __webpack_require__(142); +var Tween = __webpack_require__(140); +var TweenData = __webpack_require__(139); /** * [description] @@ -16339,7 +16894,33 @@ var TweenData = __webpack_require__(127); * * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] * @param {object} config - [description] - * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description] + * @param {Phaser.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. +` + * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. + * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. + * @property {number} [duration=1000] - The duration of the tween in milliseconds. + * @property {string} [ease='Power0'] - The easing equation to use for the tween. + * @property {array} [easeParams] - Optional easing parameters. + * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. + * @property {number} [repeat=0] - The number of times to repeat the tween. + * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. + * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. + * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. + * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. +` +{ + targets: null, + delay: 0, + duration: 1000, + ease: 'Power0', + easeParams: null, + hold: 0, + repeat: 0, + repeatDelay: 0, + yoyo: false, + flipX: false, + flipY: false +}; * * @return {Phaser.Tweens.Tween} [description] */ @@ -16441,12 +17022,12 @@ module.exports = TweenBuilder; /***/ }), -/* 98 */ +/* 105 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16504,12 +17085,12 @@ module.exports = GetNewValue; /***/ }), -/* 99 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16908,12 +17489,12 @@ module.exports = Tileset; /***/ }), -/* 100 */ +/* 107 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16953,12 +17534,12 @@ module.exports = TileToWorldY; /***/ }), -/* 101 */ +/* 108 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16998,16 +17579,16 @@ module.exports = TileToWorldX; /***/ }), -/* 102 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(79); +var IsInLayerBounds = __webpack_require__(85); /** * Gets a tile at the given tile coordinates from the given layer. @@ -17030,7 +17611,7 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) if (IsInLayerBounds(tileX, tileY, layer)) { - var tile = layer.data[tileY][tileX]; + var tile = layer.data[tileY][tileX] || null; if (tile === null) { return null; @@ -17054,12 +17635,12 @@ module.exports = GetTileAt; /***/ }), -/* 103 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17069,77 +17650,73 @@ module.exports = GetTileAt; module.exports = { - CalculateFacesAt: __webpack_require__(136), - CalculateFacesWithin: __webpack_require__(34), - Copy: __webpack_require__(489), - CreateFromTiles: __webpack_require__(488), - CullTiles: __webpack_require__(487), - Fill: __webpack_require__(486), - FilterTiles: __webpack_require__(485), - FindByIndex: __webpack_require__(484), - FindTile: __webpack_require__(483), - ForEachTile: __webpack_require__(482), - GetTileAt: __webpack_require__(102), - GetTileAtWorldXY: __webpack_require__(481), - GetTilesWithin: __webpack_require__(17), - GetTilesWithinShape: __webpack_require__(480), - GetTilesWithinWorldXY: __webpack_require__(479), - HasTileAt: __webpack_require__(219), - HasTileAtWorldXY: __webpack_require__(478), - IsInLayerBounds: __webpack_require__(79), - PutTileAt: __webpack_require__(135), - PutTileAtWorldXY: __webpack_require__(477), - PutTilesAt: __webpack_require__(476), - Randomize: __webpack_require__(475), - RemoveTileAt: __webpack_require__(218), - RemoveTileAtWorldXY: __webpack_require__(474), - RenderDebug: __webpack_require__(473), - ReplaceByIndex: __webpack_require__(220), - SetCollision: __webpack_require__(472), - SetCollisionBetween: __webpack_require__(471), - SetCollisionByExclusion: __webpack_require__(470), - SetCollisionByProperty: __webpack_require__(469), - SetCollisionFromCollisionGroup: __webpack_require__(468), - SetTileIndexCallback: __webpack_require__(467), - SetTileLocationCallback: __webpack_require__(466), - Shuffle: __webpack_require__(465), - SwapByIndex: __webpack_require__(464), - TileToWorldX: __webpack_require__(101), - TileToWorldXY: __webpack_require__(463), - TileToWorldY: __webpack_require__(100), - WeightedRandomize: __webpack_require__(462), - WorldToTileX: __webpack_require__(50), - WorldToTileXY: __webpack_require__(461), - WorldToTileY: __webpack_require__(49) + CalculateFacesAt: __webpack_require__(148), + CalculateFacesWithin: __webpack_require__(37), + Copy: __webpack_require__(528), + CreateFromTiles: __webpack_require__(527), + CullTiles: __webpack_require__(526), + Fill: __webpack_require__(525), + FilterTiles: __webpack_require__(524), + FindByIndex: __webpack_require__(523), + FindTile: __webpack_require__(522), + ForEachTile: __webpack_require__(521), + GetTileAt: __webpack_require__(109), + GetTileAtWorldXY: __webpack_require__(520), + GetTilesWithin: __webpack_require__(21), + GetTilesWithinShape: __webpack_require__(519), + GetTilesWithinWorldXY: __webpack_require__(518), + HasTileAt: __webpack_require__(235), + HasTileAtWorldXY: __webpack_require__(517), + IsInLayerBounds: __webpack_require__(85), + PutTileAt: __webpack_require__(147), + PutTileAtWorldXY: __webpack_require__(516), + PutTilesAt: __webpack_require__(515), + Randomize: __webpack_require__(514), + RemoveTileAt: __webpack_require__(234), + RemoveTileAtWorldXY: __webpack_require__(513), + RenderDebug: __webpack_require__(512), + ReplaceByIndex: __webpack_require__(236), + SetCollision: __webpack_require__(511), + SetCollisionBetween: __webpack_require__(510), + SetCollisionByExclusion: __webpack_require__(509), + SetCollisionByProperty: __webpack_require__(508), + SetCollisionFromCollisionGroup: __webpack_require__(507), + SetTileIndexCallback: __webpack_require__(506), + SetTileLocationCallback: __webpack_require__(505), + Shuffle: __webpack_require__(504), + SwapByIndex: __webpack_require__(503), + TileToWorldX: __webpack_require__(108), + TileToWorldXY: __webpack_require__(502), + TileToWorldY: __webpack_require__(107), + WeightedRandomize: __webpack_require__(501), + WorldToTileX: __webpack_require__(54), + WorldToTileXY: __webpack_require__(500), + WorldToTileY: __webpack_require__(53) }; /***/ }), -/* 104 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(236); -var Sprite = __webpack_require__(61); +var Components = __webpack_require__(253); +var Sprite = __webpack_require__(67); /** * @classdesc - * An Arcade Physics Sprite Game Object. + * An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * 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. + * The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image. + * If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites. * * @class Sprite * @extends Phaser.GameObjects.Sprite @@ -17222,12 +17799,12 @@ module.exports = ArcadeSprite; /***/ }), -/* 105 */ +/* 112 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17300,12 +17877,39 @@ module.exports = XHRSettings; /***/ }), -/* 106 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Keyboard.Events + */ + +module.exports = { + + ANY_KEY_DOWN: __webpack_require__(619), + ANY_KEY_UP: __webpack_require__(618), + COMBO_MATCH: __webpack_require__(617), + DOWN: __webpack_require__(616), + KEY_DOWN: __webpack_require__(615), + KEY_UP: __webpack_require__(614), + UP: __webpack_require__(613) + +}; + + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17323,6 +17927,10 @@ var inputPlugins = {}; * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used. */ +/** + * @namespace Phaser.Input.InputPluginCache + */ + var InputPluginCache = {}; /** @@ -17331,7 +17939,9 @@ var InputPluginCache = {}; * Plugin is the object to instantiate to create the plugin * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) * - * @method Phaser.Input.InputPluginCache.register + * @name Phaser.Input.InputPluginCache.register + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - A reference used to get this plugin from the plugin cache. @@ -17348,7 +17958,9 @@ InputPluginCache.register = function (key, plugin, mapping, settingsKey, configK /** * Returns the input plugin object from the cache based on the given key. * - * @method Phaser.Input.InputPluginCache.getCore + * @name Phaser.Input.InputPluginCache.getCore + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to get. @@ -17363,7 +17975,9 @@ InputPluginCache.getPlugin = function (key) /** * Installs all of the registered Input Plugins into the given target. * - * @method Phaser.Input.InputPluginCache.install + * @name Phaser.Input.InputPluginCache.install + * @type {function} + * @static * @since 3.10.0 * * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into. @@ -17391,7 +18005,9 @@ InputPluginCache.install = function (target) /** * Removes an input plugin based on the given key. * - * @method Phaser.Input.InputPluginCache.remove + * @name Phaser.Input.InputPluginCache.remove + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to remove. @@ -17408,12 +18024,12 @@ module.exports = InputPluginCache; /***/ }), -/* 107 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17484,19 +18100,20 @@ module.exports = LineToLine; /***/ }), -/* 108 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var MeshRender = __webpack_require__(731); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var MeshRender = __webpack_require__(753); +var NOOP = __webpack_require__(1); /** * @classdesc @@ -17509,13 +18126,10 @@ var MeshRender = __webpack_require__(731); * @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.Mask - * @extends Phaser.GameObjects.Components.Origin * @extends Phaser.GameObjects.Components.Pipeline * @extends Phaser.GameObjects.Components.ScaleMode * @extends Phaser.GameObjects.Components.Size @@ -17539,13 +18153,10 @@ var Mesh = new Class({ Extends: GameObject, Mixins: [ - Components.Alpha, Components.BlendMode, Components.Depth, - Components.Flip, Components.GetBounds, Components.Mask, - Components.Origin, Components.Pipeline, Components.ScaleMode, Components.Size, @@ -17646,9 +18257,17 @@ var Mesh = new Class({ this.setTexture(texture, frame); this.setPosition(x, y); this.setSizeToFrame(); - this.setOrigin(); this.initPipeline(); - } + }, + + /** + * This method is left intentionally empty and does not do anything. + * It is retained to allow a Mesh or Quad to be added to a Container. + * + * @method Phaser.GameObjects.Mesh#setAlpha + * @since 3.17.0 + */ + setAlpha: NOOP }); @@ -17656,21 +18275,21 @@ module.exports = Mesh; /***/ }), -/* 109 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var GetBitmapTextSize = __webpack_require__(846); -var ParseFromAtlas = __webpack_require__(845); -var Render = __webpack_require__(844); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var GetBitmapTextSize = __webpack_require__(872); +var ParseFromAtlas = __webpack_require__(871); +var Render = __webpack_require__(870); /** * The font data for an individual character of a Bitmap Font. @@ -17729,12 +18348,12 @@ var Render = __webpack_require__(844); * * To create a BitmapText data files you need a 3rd party app such as: * - * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ - * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner - * Littera (Web-based, free): http://kvazars.com/littera/ + * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/} + * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner} + * Littera (Web-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} * * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of - * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson + * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson} * * @class BitmapText * @extends Phaser.GameObjects.GameObject @@ -18300,33 +18919,76 @@ BitmapText.ALIGN_CENTER = 1; */ BitmapText.ALIGN_RIGHT = 2; +/** + * Parse an XML Bitmap Font from an Atlas. + * + * Adds the parsed Bitmap Font data to the cache with the `fontName` key. + * + * @name Phaser.GameObjects.BitmapText.ParseFromAtlas + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for. + * @param {string} fontName - The key of the font to add to the Bitmap Font cache. + * @param {string} textureKey - The key of the BitmapFont's texture. + * @param {string} frameKey - The key of the BitmapFont texture's frame. + * @param {string} xmlKey - The key of the XML data of the font to parse. + * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. + * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * + * @return {boolean} Whether the parsing was successful or not. + */ BitmapText.ParseFromAtlas = ParseFromAtlas; module.exports = BitmapText; /***/ }), -/* 110 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ //! stable.js 0.1.6, https://github.com/Two-Screen/stable //! © 2017 Angry Bytes and contributors. MIT licensed. +/** + * @namespace Phaser.Utils.Array.StableSortFunctions + */ + (function() { -// A stable array sort, because `Array#sort()` is not guaranteed stable. -// This is an implementation of merge sort, without recursion. - + /** + * A stable array sort, because `Array#sort()` is not guaranteed stable. + * This is an implementation of merge sort, without recursion. + * + * @function Phaser.Utils.Array.StableSort + * @since 3.0.0 + * + * @param {array} arr - The input array to be sorted. + * @param {function} comp - The comparison handler. + * + * @return {array} The sorted result. + */ var stable = function(arr, comp) { return exec(arr.slice(), comp); }; + /** + * Sort the input array and simply copy it back if the result isn't in the original array, which happens on an odd number of passes. + * + * @function Phaser.Utils.Array.StableSortFunctions.inplace + * @memberof Phaser.Utils.Array.StableSortFunctions + * @since 3.0.0 + * + * @param {array} arr - The input array. + * @param {function} comp - The comparison handler. + * + * @return {array} The sorted array. + */ stable.inplace = function(arr, comp) { var result = exec(arr, comp); @@ -18426,28 +19088,31 @@ else {} })(); /***/ }), -/* 111 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. - -var CheckMatrix = __webpack_require__(163); -var TransposeMatrix = __webpack_require__(315); +var CheckMatrix = __webpack_require__(173); +var TransposeMatrix = __webpack_require__(318); /** - * [description] + * Rotates the array matrix based on the given rotation value. + * + * The value can be given in degrees: 90, -90, 270, -270 or 180, + * or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * + * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. * * @function Phaser.Utils.Array.Matrix.RotateMatrix * @since 3.0.0 * * @param {array} matrix - The array to rotate. - * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. The value can be given in degrees: 90, -90, 270, -270 or 180, or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. * * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ @@ -18492,25 +19157,24 @@ module.exports = RotateMatrix; /***/ }), -/* 112 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayUtils = __webpack_require__(164); +var ArrayUtils = __webpack_require__(174); var Class = __webpack_require__(0); var NOOP = __webpack_require__(1); -var StableSort = __webpack_require__(110); +var StableSort = __webpack_require__(118); /** - * @callback EachListCallback - * @generic I - [item] + * @callback EachListCallback * - * @param {*} item - The item which is currently being processed. + * @param {I} item - The item which is currently being processed. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ @@ -18681,9 +19345,8 @@ var List = new Class({ }, /** - * Sort the contents of this List so the items are in order based - * on the given property. For example, `sort('alpha')` would sort the List - * contents based on the value of their `alpha` property. + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. * * @method Phaser.Structs.List#sort * @since 3.0.0 @@ -18691,38 +19354,28 @@ var List = new Class({ * @genericUse {T[]} - [children,$return] * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.Structs.List} This List object. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal handler for the {@link #sort} method which compares two items. - * - * @method Phaser.Structs.List#sortHandler - * @private - * @since 3.4.0 - * - * @genericUse {T} - [childA,childB] - * - * @param {*} childA - The first item to compare. - * @param {*} childB - The second item to compare. - * - * @return {integer} The result of the comparison, which will be negative if the first item is smaller then second, positive if the first item is larger than the second, or 0 if they're equal. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + StableSort.inplace(this.list, handler); + + return this; }, /** @@ -18768,7 +19421,6 @@ var List = new Class({ * @method Phaser.Structs.List#getFirst * @since 3.0.0 * - * @genericUse {T} - [value] * @genericUse {T | null} - [$return] * * @param {string} property - The name of the property to test or a falsey value to have no criterion. @@ -18780,7 +19432,7 @@ var List = new Class({ */ getFirst: function (property, value, startIndex, endIndex) { - return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex); + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); }, /** @@ -18930,7 +19582,7 @@ var List = new Class({ * @param {integer} [endIndex] - The position to stop removing at. The item at this position won't be removed. * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. * - * @return {Array.<*>} An array of the items which were removed.[description] + * @return {Array.<*>} An array of the items which were removed. */ removeBetween: function (startIndex, endIndex, skipCallback) { @@ -19207,7 +19859,8 @@ var List = new Class({ * The first item in the List or `null` for an empty List. * * @name Phaser.Structs.List#first - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -19233,7 +19886,8 @@ var List = new Class({ * The last item in the List, or `null` for an empty List. * * @name Phaser.Structs.List#last - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -19261,7 +19915,8 @@ var List = new Class({ * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. * * @name Phaser.Structs.List#next - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -19289,7 +19944,8 @@ var List = new Class({ * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. * * @name Phaser.Structs.List#previous - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -19317,18 +19973,18 @@ module.exports = List; /***/ }), -/* 113 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var Clamp = __webpack_require__(23); -var Extend = __webpack_require__(20); +var Extend = __webpack_require__(19); /** * @classdesc @@ -20134,19 +20790,20 @@ module.exports = Frame; /***/ }), -/* 114 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); -var Extend = __webpack_require__(20); +var Events = __webpack_require__(69); +var Extend = __webpack_require__(19); var NOOP = __webpack_require__(1); /** @@ -20604,6 +21261,7 @@ var BaseSound = new Class({ * Destroys this sound and all associated events and marks it for removal from the sound manager. * * @method Phaser.Sound.BaseSound#destroy + * @fires Phaser.Sound.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -20613,7 +21271,7 @@ var BaseSound = new Class({ return; } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); this.pendingRemove = true; this.manager = null; this.key = ''; @@ -20632,19 +21290,21 @@ module.exports = BaseSound; /***/ }), -/* 115 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(69); +var GameEvents = __webpack_require__(26); var NOOP = __webpack_require__(1); /** @@ -20659,7 +21319,7 @@ var NOOP = __webpack_require__(1); /** * Audio sprite sound type. * - * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound + * @typedef {object} AudioSpriteSound * * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. */ @@ -20799,7 +21459,7 @@ var BaseSoundManager = new Class({ */ this.unlocked = false; - game.events.on('blur', function () + game.events.on(GameEvents.BLUR, function () { if (this.pauseOnBlur) { @@ -20807,7 +21467,7 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('focus', function () + game.events.on(GameEvents.FOCUS, function () { if (this.pauseOnBlur) { @@ -20815,8 +21475,8 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('prestep', this.update, this); - game.events.once('destroy', this.destroy, this); + game.events.on(GameEvents.PRE_STEP, this.update, this); + game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -20844,7 +21504,7 @@ var BaseSoundManager = new Class({ * @param {string} key - Asset key for the sound. * @param {SoundConfig} [config] - An optional config object containing default sound settings. * - * @return {Phaser.Sound.BaseSound.AudioSpriteSound} The new audio sprite sound instance. + * @return {AudioSpriteSound} The new audio sprite sound instance. */ addAudioSprite: function (key, config) { @@ -20883,6 +21543,7 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#play + * @listens Phaser.Sound.Events#COMPLETE * @since 3.0.0 * * @param {string} key - Asset key for the sound. @@ -20894,7 +21555,7 @@ var BaseSoundManager = new Class({ { var sound = this.add(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); if (extra) { @@ -20920,6 +21581,7 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#playAudioSprite + * @listens Phaser.Sound.Events#COMPLETE * @since 3.0.0 * * @param {string} key - Asset key for the sound. @@ -20932,7 +21594,7 @@ var BaseSoundManager = new Class({ { var sound = this.addAudioSprite(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); return sound.play(spriteName, config); }, @@ -20996,16 +21658,11 @@ var BaseSoundManager = new Class({ return removed; }, - /** - * @event Phaser.Sound.BaseSoundManager#pauseall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Pauses all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#pauseAll - * @fires Phaser.Sound.BaseSoundManager#pauseall + * @fires Phaser.Sound.Events#PAUSE_ALL * @since 3.0.0 */ pauseAll: function () @@ -21015,19 +21672,14 @@ var BaseSoundManager = new Class({ sound.pause(); }); - this.emit('pauseall', this); + this.emit(Events.PAUSE_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#resumeall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Resumes all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#resumeAll - * @fires Phaser.Sound.BaseSoundManager#resumeall + * @fires Phaser.Sound.Events#RESUME_ALL * @since 3.0.0 */ resumeAll: function () @@ -21037,19 +21689,14 @@ var BaseSoundManager = new Class({ sound.resume(); }); - this.emit('resumeall', this); + this.emit(Events.RESUME_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#stopall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Stops all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#stopAll - * @fires Phaser.Sound.BaseSoundManager#stopall + * @fires Phaser.Sound.Events#STOP_ALL * @since 3.0.0 */ stopAll: function () @@ -21059,7 +21706,7 @@ var BaseSoundManager = new Class({ sound.stop(); }); - this.emit('stopall', this); + this.emit(Events.STOP_ALL, this); }, /** @@ -21103,6 +21750,7 @@ var BaseSoundManager = new Class({ * * @method Phaser.Sound.BaseSoundManager#update * @protected + * @fires Phaser.Sound.Events#UNLOCKED * @since 3.0.0 * * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. @@ -21115,11 +21763,7 @@ var BaseSoundManager = new Class({ 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); + this.emit(Events.UNLOCKED, this); } for (var i = this.sounds.length - 1; i >= 0; i--) @@ -21180,12 +21824,6 @@ var BaseSoundManager = new Class({ }); }, - /** - * @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. - */ - /** * Sets the global playback rate at which all the sounds will be played. * @@ -21193,7 +21831,7 @@ var BaseSoundManager = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.BaseSoundManager#setRate - * @fires Phaser.Sound.BaseSoundManager#rate + * @fires Phaser.Sound.Events#GLOBAL_RATE * @since 3.3.0 * * @param {number} value - Global playback rate at which all the sounds will be played. @@ -21233,7 +21871,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('rate', this, value); + this.emit(Events.GLOBAL_RATE, this, value); } }, @@ -21243,7 +21881,7 @@ var BaseSoundManager = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.BaseSoundManager#setDetune - * @fires Phaser.Sound.BaseSoundManager#detune + * @fires Phaser.Sound.Events#GLOBAL_DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -21257,12 +21895,6 @@ var BaseSoundManager = new Class({ return this; }, - /** - * @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. - */ - /** * 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). @@ -21288,7 +21920,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('detune', this, value); + this.emit(Events.GLOBAL_DETUNE, this, value); } } @@ -21299,12 +21931,12 @@ module.exports = BaseSoundManager; /***/ }), -/* 116 */ +/* 124 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -21421,6409 +22053,19 @@ var CONST = { module.exports = CONST; -/***/ }), -/* 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} - */ - -/** - * 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; - - -/***/ }), -/* 118 */ -/***/ (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 OS = __webpack_require__(92); - -/** - * 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. - * - * @typedef {object} Phaser.Device.Browser - * @since 3.0.0 - * - * @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(); - - -/***/ }), -/* 119 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates a linear (interpolation) value over t. - * - * @function Phaser.Math.Linear - * @since 3.0.0 - * - * @param {number} p0 - The first point. - * @param {number} p1 - The second point. - * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1. - * - * @return {number} The step t% of the way between p0 and p1. - */ -var Linear = function (p0, p1, t) -{ - return (p1 - p0) * t + p0; -}; - -module.exports = Linear; - - -/***/ }), -/* 120 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// 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 () -{ - /** - * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. - * - * @function Phaser.Display.Canvas.Smoothing.getPrefix - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {string} [description] - */ - var getPrefix = function (context) - { - var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; - - for (var i = 0; i < vendors.length; i++) - { - var s = vendors[i] + 'mageSmoothingEnabled'; - - if (s in context) - { - return s; - } - } - - return null; - }; - - /** - * 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 - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description] - */ - var enable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = true; - } - - return context; - }; - - /** - * 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 - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description] - */ - var disable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = false; - } - - return context; - }; - - /** - * 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 - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {?boolean} [description] - */ - var isEnabled = function (context) - { - return (prefix !== null) ? context[prefix] : null; - }; - - return { - disable: disable, - enable: enable, - getPrefix: getPrefix, - isEnabled: isEnabled - }; - -}; - -module.exports = Smoothing(); - - -/***/ }), -/* 121 */ -/***/ (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__(14); -var DegToRad = __webpack_require__(31); -var EventEmitter = __webpack_require__(11); -var Rectangle = __webpack_require__(9); -var TransformMatrix = __webpack_require__(38); -var ValueToColor = __webpack_require__(178); -var Vector2 = __webpack_require__(3); - -/** - * @typedef {object} JSONCameraBounds - * @property {number} x - The horizontal position of camera - * @property {number} y - The vertical position of camera - * @property {number} width - The width size of camera - * @property {number} height - The height size of camera - */ - -/** - * @typedef {object} JSONCamera - * - * @property {string} name - The name of the camera - * @property {number} x - The horizontal position of camera - * @property {number} y - The vertical position of camera - * @property {number} width - The width size of camera - * @property {number} height - The height size of camera - * @property {number} zoom - The zoom of camera - * @property {number} rotation - The rotation of camera - * @property {boolean} roundPixels - The round pixels st status of camera - * @property {number} scrollX - The horizontal scroll of camera - * @property {number} scrollY - The vertical scroll of camera - * @property {string} backgroundColor - The background color of camera - * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera - */ - -/** - * @classdesc - * A Base Camera class. - * - * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, - * and can be positioned, rotated, zoomed and scrolled accordingly. - * - * A Camera consists of two elements: The viewport and the scroll values. - * - * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are - * created the same size as your game, but their position and size can be set to anything. This means if you - * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, - * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). - * - * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this - * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the - * viewport, and changing the viewport has no impact on the scrolling. - * - * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. - * - * The Base Camera is extended by the Camera class, which adds in special effects including Fade, - * Flash and Camera Shake, as well as the ability to follow Game Objects. - * - * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow - * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate - * to when they were added to the Camera class. - * - * @class BaseCamera - * @memberof Phaser.Cameras.Scene2D - * @constructor - * @since 3.12.0 - * - * @extends Phaser.Events.EventEmitter - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.Visible - * - * @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 BaseCamera = new Class({ - - Extends: EventEmitter, - - Mixins: [ - Components.Alpha, - Components.Visible - ], - - initialize: - - function BaseCamera (x, y, width, height) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 0; } - if (height === undefined) { height = 0; } - - EventEmitter.call(this); - - /** - * A reference to the Scene this camera belongs to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene; - - /** - * A reference to the Game Scene Manager. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager - * @type {Phaser.Scenes.SceneManager} - * @since 3.12.0 - */ - this.sceneManager; - - /** - * A reference to the Game Config. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#config - * @type {object} - * @readonly - * @since 3.12.0 - */ - this.config; - - /** - * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. - * This value is a bitmask. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#id - * @type {integer} - * @readonly - * @since 3.11.0 - */ - this.id = 0; - - /** - * The name of the Camera. This is left empty for your own use. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; - - /** - * The resolution of the Game, used in most Camera calculations. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#resolution - * @type {number} - * @readonly - * @since 3.12.0 - */ - this.resolution = 1; - - /** - * Should this camera round its pixel values to integers? - * - * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.roundPixels = false; - - /** - * Is this Camera visible or not? - * - * A visible camera will render and perform input tests. - * An invisible camera will not render anything and will skip input tests. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#visible - * @type {boolean} - * @default true - * @since 3.10.0 - */ - - /** - * Is this Camera using a bounds to restrict scrolling movement? - * - * Set this property along with the bounds via `Camera.setBounds`. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.useBounds = false; - - /** - * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at. - * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. - * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. - * You can use it for culling or intersection checks. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#worldView - * @type {Phaser.Geom.Rectangle} - * @readonly - * @since 3.11.0 - */ - this.worldView = new Rectangle(); - - /** - * Is this Camera dirty? - * - * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. - * - * This flag is cleared during the `postRenderCamera` method of the renderer. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#dirty - * @type {boolean} - * @default true - * @since 3.11.0 - */ - this.dirty = true; - - /** - * The x position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollX` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#x - * @type {number} - * @private - * @since 3.0.0 - */ - this._x = x; - - /** - * The y position of the Camera, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollY` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#y - * @type {number} - * @private - * @since 3.0.0 - */ - this._y = y; - - /** - * Internal Camera X value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cx - * @type {number} - * @private - * @since 3.12.0 - */ - this._cx = 0; - - /** - * Internal Camera Y value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cy - * @type {number} - * @private - * @since 3.12.0 - */ - this._cy = 0; - - /** - * Internal Camera Width value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cw - * @type {number} - * @private - * @since 3.12.0 - */ - this._cw = 0; - - /** - * Internal Camera Height value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_ch - * @type {number} - * @private - * @since 3.12.0 - */ - this._ch = 0; - - /** - * The width of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_width - * @type {number} - * @private - * @since 3.11.0 - */ - this._width = width; - - /** - * The height of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_height - * @type {number} - * @private - * @since 3.11.0 - */ - this._height = height; - - /** - * The bounds the camera is restrained to during scrolling. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds - * @type {Phaser.Geom.Rectangle} - * @private - * @since 3.0.0 - */ - this._bounds = new Rectangle(); - - /** - * The horizontal scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - this._scrollX = 0; - - /** - * The vertical scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - this._scrollY = 0; - - /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. - * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. - * - * Set to 1 to return to the default zoom level. - * - * Be careful to never set this value to zero. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom - * @type {number} - * @private - * @default 1 - * @since 3.11.0 - */ - this._zoom = 1; - - /** - * The rotation of the Camera in radians. - * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. - * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - this._rotation = 0; - - /** - * A local transform matrix used for internal calculations. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#matrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.0.0 - */ - this.matrix = new TransformMatrix(); - - /** - * Does this Camera have a transparent background? - * - * @name Phaser.Cameras.Scene2D.BaseCamera#transparent - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.transparent = true; - - /** - * The background color of this Camera. Only used if `transparent` is `false`. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor - * @type {Phaser.Display.Color} - * @since 3.0.0 - */ - this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); - - /** - * The Camera alpha value. Setting this property impacts every single object that this Camera - * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out, - * or via the chainable `setAlpha` method instead. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#alpha - * @type {number} - * @default 1 - * @since 3.11.0 - */ - - /** - * Should the camera cull Game Objects before checking them for input hit tests? - * In some special cases it may be beneficial to disable this. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.disableCull = false; - - /** - * A temporary array of culled objects. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects - * @type {Phaser.GameObjects.GameObject[]} - * @default [] - * @private - * @since 3.0.0 - */ - this.culledObjects = []; - - /** - * The mid-point of the Camera in 'world' coordinates. - * - * Use it to obtain exactly where in the world the center of the camera is currently looking. - * - * This value is updated in the preRender method, after the scroll values and follower - * have been processed. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.11.0 - */ - this.midPoint = new Vector2(width / 2, height / 2); - - /** - * The horizontal origin of rotation for this Camera. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * See `setOrigin` to set both origins in a single, chainable call. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#originX - * @type {number} - * @default 0.5 - * @since 3.11.0 - */ - this.originX = 0.5; - - /** - * The vertical origin of rotation for this Camera. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * See `setOrigin` to set both origins in a single, chainable call. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#originY - * @type {number} - * @default 0.5 - * @since 3.11.0 - */ - this.originY = 0.5; - - /** - * Does this Camera have a custom viewport? - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport - * @type {boolean} - * @private - * @default false - * @since 3.12.0 - */ - this._customViewport = false; - }, - - /** - * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha - * @since 3.11.0 - * - * @param {number} [value=1] - The Camera alpha value. - * - * @return {this} This Camera instance. - */ - - /** - * Sets the rotation origin of this Camera. - * - * The values are given in the range 0 to 1 and are only used when calculating Camera rotation. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin - * @since 3.11.0 - * - * @param {number} [x=0.5] - The horizontal origin value. - * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. - * - * @return {this} This Camera instance. - */ - setOrigin: function (x, y) - { - if (x === undefined) { x = 0.5; } - if (y === undefined) { y = x; } - - this.originX = x; - this.originY = y; - - return this; - }, - - /** - * Calculates what the Camera.scrollX and scrollY values would need to be in order to move - * the Camera so it is centered on the given x and y coordinates, without actually moving - * the Camera there. The results are clamped based on the Camera bounds, if set. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll - * @since 3.11.0 - * - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * @param {Phaser.Math.Vector2} [out] - A Vec2 to store the values in. If not given a new Vec2 is created. - * - * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` abd `y` properties. - */ - getScroll: function (x, y, out) - { - if (out === undefined) { out = new Vector2(); } - - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - out.x = x - originX; - out.y = y - originY; - - if (this.useBounds) - { - out.x = this.clampX(out.x); - out.y = this.clampY(out.y); - } - - return out; - }, - - /** - * Moves the Camera so that it is centered on the given coordinates, bounds allowing. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn - * @since 3.11.0 - * - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - centerOn: function (x, y) - { - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - this.midPoint.set(x, y); - - this.scrollX = x - originX; - this.scrollY = y - originY; - - if (this.useBounds) - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } - - return this; - }, - - /** - * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds - * @since 3.0.0 - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - centerToBounds: function () - { - if (this.useBounds) - { - var bounds = this._bounds; - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - this.midPoint.set(bounds.centerX, bounds.centerY); - - this.scrollX = bounds.centerX - originX; - this.scrollY = bounds.centerY - originY; - } - - return this; - }, - - /** - * Moves the Camera so that it is re-centered based on its viewport size. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize - * @since 3.0.0 - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - centerToSize: function () - { - this.scrollX = this.width * 0.5; - this.scrollY = this.height * 0.5; - - return this; - }, - - /** - * Takes an array of Game Objects and returns a new array featuring only those objects - * visible by this camera. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#cull - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return] - * - * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull. - * - * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera. - */ - cull: function (renderableObjects) - { - if (this.disableCull) - { - return renderableObjects; - } - - 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 renderableObjects; - } - - 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 culledObjects = this.culledObjects; - var length = renderableObjects.length; - - determinant = 1 / determinant; - - culledObjects.length = 0; - - for (var index = 0; index < length; ++index) - { - var object = renderableObjects[index]; - - if (!object.hasOwnProperty('width') || object.parentContainer) - { - culledObjects.push(object); - continue; - } - - 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); - } - } - - return culledObjects; - }, - - /** - * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform. - * You can optionally provide a Vector2, or similar object, to store the results in. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {number} x - The x position to convert to world space. - * @param {number} y - The y position to convert to world space. - * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties. - */ - getWorldPoint: function (x, y, output) - { - 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]; - - // Invert Matrix - var determinant = (mva * mvd) - (mvb * mvc); - - if (!determinant) - { - output.x = x; - output.y = y; - - return output; - } - - 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 res = this.resolution; - - var scrollX = this.scrollX; - var scrollY = this.scrollY; - - // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks - var sx = x + ((scrollX * c - scrollY * s) * zoom); - var sy = y + ((scrollX * s + scrollY * c) * zoom); - - // Apply transform to point - output.x = (sx * ima + sy * imc) * res + ime; - output.y = (sx * imb + sy * imd) * res + imf; - - return output; - }, - - /** - * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings - * so that they are ignored by this Camera. This means they will not be rendered by this Camera. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#ignore - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group)} entries - The Game Object, or array of Game Objects, to be ignored by this Camera. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - ignore: function (entries) - { - var id = this.id; - - if (!Array.isArray(entries)) - { - entries = [ entries ]; - } - - for (var i = 0; i < entries.length; i++) - { - var entry = entries[i]; - - if (Array.isArray(entry)) - { - this.ignore(entry); - } - else if (entry.isParent) - { - this.ignore(entry.getChildren()); - } - else - { - entry.cameraFilter |= id; - } - } - - return this; - }, - - /** - * Internal preRender step. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#preRender - * @protected - * @since 3.0.0 - * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. - */ - preRender: function (baseScale, resolution) - { - var width = this.width; - var height = this.height; - - var halfWidth = width * 0.5; - var halfHeight = height * 0.5; - - var zoom = this.zoom * baseScale; - var matrix = this.matrix; - - var originX = width * this.originX; - var originY = height * this.originY; - - var sx = this.scrollX; - var sy = this.scrollY; - - if (this.useBounds) - { - sx = this.clampX(sx); - sy = this.clampY(sy); - } - - if (this.roundPixels) - { - originX = Math.round(originX); - originY = Math.round(originY); - } - - // Values are in pixels and not impacted by zooming the Camera - this.scrollX = sx; - this.scrollY = sy; - - var midX = sx + halfWidth; - var midY = sy + halfHeight; - - // The center of the camera, in world space, so taking zoom into account - // Basically the pixel value of what it's looking at in the middle of the cam - this.midPoint.set(midX, midY); - - var displayWidth = width / zoom; - var displayHeight = height / zoom; - - this.worldView.setTo( - midX - (displayWidth / 2), - midY - (displayHeight / 2), - displayWidth, - displayHeight - ); - - 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); - }, - - /** - * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required. - * Do not call this method if you are not using camera bounds. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#clampX - * @since 3.11.0 - * - * @param {number} x - The value to horizontally scroll clamp. - * - * @return {number} The adjusted value to use as scrollX. - */ - clampX: function (x) - { - var bounds = this._bounds; - - var dw = this.displayWidth; - - var bx = bounds.x + ((dw - this.width) / 2); - var bw = Math.max(bx, bx + bounds.width - dw); - - if (x < bx) - { - x = bx; - } - else if (x > bw) - { - x = bw; - } - - return x; - }, - - /** - * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required. - * Do not call this method if you are not using camera bounds. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#clampY - * @since 3.11.0 - * - * @param {number} y - The value to vertically scroll clamp. - * - * @return {number} The adjusted value to use as scrollY. - */ - clampY: function (y) - { - var bounds = this._bounds; - - var dh = this.displayHeight; - - var by = bounds.y + ((dh - this.height) / 2); - var bh = Math.max(by, by + bounds.height - dh); - - if (y < by) - { - y = by; - } - else if (y > bh) - { - y = bh; - } - - return y; - }, - - /* - var gap = this._zoomInversed; - return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap); - */ - - /** - * If this Camera has previously had movement bounds set on it, this will remove them. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds - * @since 3.0.0 - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - removeBounds: function () - { - this.useBounds = false; - - this.dirty = true; - - this._bounds.setEmpty(); - - return this; - }, - - /** - * Set the rotation of this Camera. This causes everything it renders to appear rotated. - * - * Rotating a camera does not rotate the viewport itself, it is applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle - * @since 3.0.0 - * - * @param {number} [value=0] - The cameras angle of rotation, given in degrees. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setAngle: function (value) - { - if (value === undefined) { value = 0; } - - this.rotation = DegToRad(value); - - return this; - }, - - /** - * Sets the background color for this Camera. - * - * By default a Camera has a transparent background but it can be given a solid color, with any level - * of transparency, via this method. - * - * The color value can be specified using CSS color notation, hex or numbers. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor - * @since 3.0.0 - * - * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setBackgroundColor: function (color) - { - if (color === undefined) { color = 'rgba(0,0,0,0)'; } - - this.backgroundColor = ValueToColor(color); - - this.transparent = (this.backgroundColor.alpha === 0); - - return this; - }, - - /** - * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. - * - * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the - * edges and into blank space. It does not limit the placement of Game Objects, or where - * the Camera viewport can be positioned. - * - * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. - * - * Clear the bounds entirely by calling `Camera.removeBounds`. - * - * If you set bounds that are smaller than the viewport it will stop the Camera from being - * able to scroll. The bounds can be positioned where-ever you wish. By default they are from - * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of - * the Camera bounds. However, you can position them anywhere. So if you wanted a game world - * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y - * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find - * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds - * @since 3.0.0 - * - * @param {integer} x - The top-left x coordinate of the bounds. - * @param {integer} y - The top-left y coordinate of the bounds. - * @param {integer} width - The width of the bounds, in pixels. - * @param {integer} height - The height of the bounds, in pixels. - * @param {boolean} [centerOn] - If `true` the Camera will automatically be centered on the new bounds. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setBounds: function (x, y, width, height, centerOn) - { - this._bounds.setTo(x, y, width, height); - - this.dirty = true; - this.useBounds = true; - - if (centerOn) - { - this.centerToBounds(); - } - else - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } - - return this; - }, - - /** - * Sets the name of this Camera. - * This value is for your own use and isn't used internally. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setName - * @since 3.0.0 - * - * @param {string} [value=''] - The name of the Camera. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setName: function (value) - { - if (value === undefined) { value = ''; } - - this.name = value; - - return this; - }, - - /** - * Set the position of the Camera viewport within the game. - * - * This does not change where the camera is 'looking'. See `setScroll` to control that. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition - * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the Camera viewport. - * @param {number} [y=x] - The top-left y coordinate of the Camera viewport. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setPosition: function (x, y) - { - if (y === undefined) { y = x; } - - this.x = x; - this.y = y; - - return this; - }, - - /** - * Set the rotation of this Camera. This causes everything it renders to appear rotated. - * - * Rotating a camera does not rotate the viewport itself, it is applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation - * @since 3.0.0 - * - * @param {number} [value=0] - The rotation of the Camera, in radians. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setRotation: function (value) - { - if (value === undefined) { value = 0; } - - this.rotation = value; - - return this; - }, - - /** - * Should the Camera round pixel values to whole integers when rendering Game Objects? - * - * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels - * @since 3.0.0 - * - * @param {boolean} value - `true` to round Camera pixels, `false` to not. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setRoundPixels: function (value) - { - this.roundPixels = value; - - return this; - }, - - /** - * Sets the Scene the Camera is bound to. - * - * Also populates the `resolution` property and updates the internal size values. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setScene - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene the camera is bound to. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setScene: function (scene) - { - if (this.scene && this._customViewport) - { - this.sceneManager.customViewports--; - } - - this.scene = scene; - - this.config = scene.sys.game.config; - this.sceneManager = scene.sys.game.scene; - - var res = this.config.resolution; - - this.resolution = res; - - this._cx = this._x * res; - this._cy = this._y * res; - this._cw = this._width * res; - this._ch = this._height * res; - - this.updateSystem(); - - return this; - }, - - /** - * Set the position of where the Camera is looking within the game. - * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly. - * Use this method, or the scroll properties, to move your camera around the game world. - * - * This does not change where the camera viewport is placed. See `setPosition` to control that. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll - * @since 3.0.0 - * - * @param {number} x - The x coordinate of the Camera in the game world. - * @param {number} [y=x] - The y coordinate of the Camera in the game world. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setScroll: function (x, y) - { - if (y === undefined) { y = x; } - - this.scrollX = x; - this.scrollY = y; - - return this; - }, - - /** - * Set the size of the Camera viewport. - * - * By default a Camera is the same size as the game, but can be made smaller via this method, - * allowing you to create mini-cam style effects by creating and positioning a smaller Camera - * viewport within your game. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setSize - * @since 3.0.0 - * - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setSize: function (width, height) - { - if (height === undefined) { height = width; } - - this.width = width; - this.height = height; - - return this; - }, - - /** - * This method sets the position and size of the Camera viewport in a single call. - * - * If you're trying to change where the Camera is looking at in your game, then see - * the method `Camera.setScroll` instead. This method is for changing the viewport - * itself, not what the camera can see. - * - * By default a Camera is the same size as the game, but can be made smaller via this method, - * allowing you to create mini-cam style effects by creating and positioning a smaller Camera - * viewport within your game. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport - * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the Camera viewport. - * @param {number} y - The top-left y coordinate of the Camera viewport. - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setViewport: function (x, y, width, height) - { - this.x = x; - this.y = y; - this.width = width; - this.height = height; - - return this; - }, - - /** - * Set the zoom value of the Camera. - * - * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. - * Changing to a larger value, such as 2, will cause the camera to 'zoom in'. - * - * A value of 1 means 'no zoom' and is the default. - * - * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom - * @since 3.0.0 - * - * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setZoom: function (value) - { - if (value === undefined) { value = 1; } - - if (value === 0) - { - value = 0.001; - } - - this.zoom = value; - - return this; - }, - - /** - * Sets the visibility of this Camera. - * - * An invisible Camera will skip rendering and input tests of everything it can see. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible - * @since 3.10.0 - * - * @param {boolean} value - The visible state of the Camera. - * - * @return {this} This Camera instance. - */ - - /** - * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON - * @since 3.0.0 - * - * @return {JSONCamera} A well-formed object suitable for conversion to JSON. - */ - toJSON: function () - { - 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 - }; - } - - return output; - }, - - /** - * Internal method called automatically by the Camera Manager. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#update - * @protected - * @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, in ms, elapsed since the last frame. - */ - update: function () - { - // NOOP - }, - - /** - * Internal method called automatically when the viewport changes. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem - * @private - * @since 3.12.0 - */ - updateSystem: function () - { - if (!this.config) - { - return; - } - - var custom = (this._x !== 0 || this._y !== 0 || this.config.width !== this._width || this.config.height !== this._height); - - var sceneManager = this.sceneManager; - - if (custom && !this._customViewport) - { - // We need a custom viewport for this Camera - sceneManager.customViewports++; - } - else if (!custom && this._customViewport) - { - // We're turning off a custom viewport for this Camera - sceneManager.customViewports--; - } - - this.dirty = true; - this._customViewport = custom; - }, - - /** - * This event is fired when a camera is destroyed by the Camera Manager. - * - * @event CameraDestroyEvent - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. - */ - - /** - * Destroys this Camera instance and its internal properties and references. - * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. - * - * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. - * - * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, - * rather than calling this method directly. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#destroy - * @fires CameraDestroyEvent - * @since 3.0.0 - */ - destroy: function () - { - this.emit('cameradestroy', this); - - this.removeAllListeners(); - - this.matrix.destroy(); - - this.culledObjects = []; - - if (this._customViewport) - { - // We're turning off a custom viewport for this Camera - this.sceneManager.customViewports--; - } - - this._bounds = null; - - this.scene = null; - this.config = null; - this.sceneManager = null; - }, - - /** - * The x position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollX` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#x - * @type {number} - * @since 3.0.0 - */ - x: { - - get: function () - { - return this._x; - }, - - set: function (value) - { - this._x = value; - this._cx = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The y position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollY` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#y - * @type {number} - * @since 3.0.0 - */ - y: { - - get: function () - { - return this._y; - }, - - set: function (value) - { - this._y = value; - this._cy = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The width of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#width - * @type {number} - * @since 3.0.0 - */ - width: { - - get: function () - { - return this._width; - }, - - set: function (value) - { - this._width = value; - this._cw = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The height of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#height - * @type {number} - * @since 3.0.0 - */ - height: { - - get: function () - { - return this._height; - }, - - set: function (value) - { - this._height = value; - this._ch = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The horizontal scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - scrollX: { - - get: function () - { - return this._scrollX; - }, - - set: function (value) - { - this._scrollX = value; - this.dirty = true; - } - - }, - - /** - * The vertical scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - scrollY: { - - get: function () - { - return this._scrollY; - }, - - set: function (value) - { - this._scrollY = value; - this.dirty = true; - } - - }, - - /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. - * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. - * - * Set to 1 to return to the default zoom level. - * - * Be careful to never set this value to zero. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#zoom - * @type {number} - * @default 1 - * @since 3.0.0 - */ - zoom: { - - get: function () - { - return this._zoom; - }, - - set: function (value) - { - this._zoom = value; - this.dirty = true; - } - - }, - - /** - * The rotation of the Camera in radians. - * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. - * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#rotation - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - rotation: { - - get: function () - { - return this._rotation; - }, - - set: function (value) - { - this._rotation = value; - this.dirty = true; - } - - }, - - /** - * The x position of the center of the Camera's viewport, relative to the top-left of the game canvas. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#centerX - * @type {number} - * @readonly - * @since 3.10.0 - */ - centerX: { - - get: function () - { - return this.x + (0.5 * this.width); - } - - }, - - /** - * The y position of the center of the Camera's viewport, relative to the top-left of the game canvas. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#centerY - * @type {number} - * @readonly - * @since 3.10.0 - */ - centerY: { - - get: function () - { - return this.y + (0.5 * this.height); - } - - }, - - /** - * The displayed width of the camera viewport, factoring in the camera zoom level. - * - * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width - * would be 1600, as it's displaying twice as many pixels as zoom level 1. - * - * Equally, a camera with a width of 800 and zoom of 2 would have a display width - * of 400 pixels. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth - * @type {number} - * @readonly - * @since 3.11.0 - */ - displayWidth: { - - get: function () - { - return this.width / this.zoom; - } - - }, - - /** - * The displayed height of the camera viewport, factoring in the camera zoom level. - * - * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height - * would be 1200, as it's displaying twice as many pixels as zoom level 1. - * - * Equally, a camera with a height of 600 and zoom of 2 would have a display height - * of 300 pixels. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight - * @type {number} - * @readonly - * @since 3.11.0 - */ - displayHeight: { - - get: function () - { - return this.height / this.zoom; - } - - } - -}); - -module.exports = BaseCamera; - - -/***/ }), -/* 122 */ -/***/ (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--) - { - var j = Math.floor(Math.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - - return array; -}; - -module.exports = Shuffle; - - -/***/ }), -/* 123 */ -/***/ (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); - -/** - * @callback DataEachCallback - * - * @param {*} parent - The parent object of the DataManager. - * @param {string} key - The key of the value. - * @param {*} value - The value. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. - */ - -/** - * @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 {object} parent - The object that this DataManager belongs to. - * @param {Phaser.Events.EventEmitter} eventEmitter - The DataManager's event emitter. - */ -var DataManager = new Class({ - - initialize: - - function DataManager (parent, eventEmitter) - { - /** - * The object that this DataManager belongs to. - * - * @name Phaser.Data.DataManager#parent - * @type {*} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * The DataManager's event emitter. - * - * @name Phaser.Data.DataManager#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = eventEmitter; - - if (!eventEmitter) - { - this.events = (parent.events) ? parent.events : parent; - } - - /** - * The data list. - * - * @name Phaser.Data.DataManager#list - * @type {Object.} - * @default {} - * @since 3.0.0 - */ - this.list = {}; - - /** - * The public values list. You can use this to access anything you have stored - * in this Data Manager. For example, if you set a value called `gold` you can - * access it via: - * - * ```javascript - * this.data.values.gold; - * ``` - * - * You can also modify it directly: - * - * ```javascript - * this.data.values.gold += 1000; - * ``` - * - * Doing so will emit a `setdata` event from the parent of this Data Manager. - * - * Do not modify this object directly. Adding properties directly to this object will not - * emit any events. Always use `DataManager.set` to create new items the first time around. - * - * @name Phaser.Data.DataManager#values - * @type {Object.} - * @default {} - * @since 3.10.0 - */ - this.values = {}; - - /** - * Whether setting data is frozen for this DataManager. - * - * @name Phaser.Data.DataManager#_frozen - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._frozen = false; - - if (!parent.hasOwnProperty('sys') && this.events) - { - this.events.once('destroy', this.destroy, this); - } - }, - - /** - * Retrieves the value for the given key, or undefined if it doesn't exist. - * - * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: - * - * ```javascript - * this.data.get('gold'); - * ``` - * - * Or access the value directly: - * - * ```javascript - * this.data.values.gold; - * ``` - * - * You can also pass in an array of keys, in which case an array of values will be returned: - * - * ```javascript - * this.data.get([ 'gold', 'armor', 'health' ]); - * ``` - * - * This approach is useful for destructuring arrays in ES6. - * - * @method Phaser.Data.DataManager#get - * @since 3.0.0 - * - * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. - * - * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. - */ - get: function (key) - { - var list = this.list; - - if (Array.isArray(key)) - { - var output = []; - - for (var i = 0; i < key.length; i++) - { - output.push(list[key[i]]); - } - - return output; - } - else - { - return list[key]; - } - }, - - /** - * Retrieves all data values in a new object. - * - * @method Phaser.Data.DataManager#getAll - * @since 3.0.0 - * - * @return {Object.} All data values. - */ - getAll: function () - { - var results = {}; - - for (var key in this.list) - { - if (this.list.hasOwnProperty(key)) - { - results[key] = this.list[key]; - } - } - - return results; - }, - - /** - * Queries the DataManager for the values of keys matching the given regular expression. - * - * @method Phaser.Data.DataManager#query - * @since 3.0.0 - * - * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). - * - * @return {Object.} The values of the keys matching the search string. - */ - query: function (search) - { - var results = {}; - - for (var key in this.list) - { - if (this.list.hasOwnProperty(key) && key.match(search)) - { - results[key] = this.list[key]; - } - } - - return results; - }, - - /** - * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created. - * - * ```javascript - * data.set('name', 'Red Gem Stone'); - * ``` - * - * You can also pass in an object of key value pairs as the first argument: - * - * ```javascript - * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); - * ``` - * - * To get a value back again you can call `get`: - * - * ```javascript - * data.get('gold'); - * ``` - * - * Or you can access the value directly via the `values` property, where it works like any other variable: - * - * ```javascript - * data.values.gold += 50; - * ``` - * - * When the value is first set, a `setdata` event is emitted. - * - * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. - * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. - * - * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.Data.DataManager#set - * @since 3.0.0 - * - * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. - * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - set: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (typeof key === 'string') - { - return this.setValue(key, data); - } - else - { - for (var entry in key) - { - this.setValue(entry, key[entry]); - } - } - - return this; - }, - - /** - * Internal value setter, called automatically by the `set` method. - * - * @method Phaser.Data.DataManager#setValue - * @private - * @since 3.10.0 - * - * @param {string} key - The key to set the value for. - * @param {*} data - The value to set. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - setValue: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (this.has(key)) - { - // Hit the key getter, which will in turn emit the events. - this.values[key] = data; - } - else - { - var _this = this; - var list = this.list; - var events = this.events; - var parent = this.parent; - - Object.defineProperty(this.values, key, { - - enumerable: true, - - configurable: true, - - get: function () - { - return list[key]; - }, - - set: function (value) - { - if (!_this._frozen) - { - var previousValue = list[key]; - list[key] = value; - - events.emit('changedata', parent, key, value, previousValue); - events.emit('changedata_' + key, parent, value, previousValue); - } - } - - }); - - list[key] = data; - - events.emit('setdata', parent, key, data); - } - - return this; - }, - - /** - * Passes all data entries to the given callback. - * - * @method Phaser.Data.DataManager#each - * @since 3.0.0 - * - * @param {DataEachCallback} callback - The function to call. - * @param {*} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - each: function (callback, context) - { - var args = [ this.parent, null, undefined ]; - - for (var i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } - - for (var key in this.list) - { - args[1] = key; - args[2] = this.list[key]; - - callback.apply(context, args); - } - - return this; - }, - - /** - * Merge the given object of key value pairs into this DataManager. - * - * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument) - * will emit a `changedata` event. - * - * @method Phaser.Data.DataManager#merge - * @since 3.0.0 - * - * @param {Object.} data - The data to merge. - * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - merge: function (data, overwrite) - { - if (overwrite === undefined) { overwrite = true; } - - // Merge data from another component into this one - for (var key in data) - { - if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key)))) - { - this.setValue(key, data[key]); - } - } - - return this; - }, - - /** - * Remove the value for the given key. - * - * If the key is found in this Data Manager it is removed from the internal lists and a - * `removedata` event is emitted. - * - * You can also pass in an array of keys, in which case all keys in the array will be removed: - * - * ```javascript - * this.data.remove([ 'gold', 'armor', 'health' ]); - * ``` - * - * @method Phaser.Data.DataManager#remove - * @since 3.0.0 - * - * @param {(string|string[])} key - The key to remove, or an array of keys to remove. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - remove: function (key) - { - if (this._frozen) - { - return this; - } - - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - this.removeValue(key[i]); - } - } - else - { - return this.removeValue(key); - } - - return this; - }, - - /** - * Internal value remover, called automatically by the `remove` method. - * - * @method Phaser.Data.DataManager#removeValue - * @private - * @since 3.10.0 - * - * @param {string} key - The key to set the value for. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - removeValue: function (key) - { - if (this.has(key)) - { - var data = this.list[key]; - - delete this.list[key]; - delete this.values[key]; - - this.events.emit('removedata', this.parent, key, data); - } - - return this; - }, - - /** - * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. - * - * @method Phaser.Data.DataManager#pop - * @since 3.0.0 - * - * @param {string} key - The key of the value to retrieve and delete. - * - * @return {*} The value of the given key. - */ - pop: function (key) - { - var data = undefined; - - if (!this._frozen && this.has(key)) - { - data = this.list[key]; - - delete this.list[key]; - delete this.values[key]; - - this.events.emit('removedata', this, key, data); - } - - return data; - }, - - /** - * Determines whether the given key is set in this Data Manager. - * - * Please note that the keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.Data.DataManager#has - * @since 3.0.0 - * - * @param {string} key - The key to check. - * - * @return {boolean} Returns `true` if the key exists, otherwise `false`. - */ - has: function (key) - { - return this.list.hasOwnProperty(key); - }, - - /** - * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts - * to create new values or update existing ones. - * - * @method Phaser.Data.DataManager#setFreeze - * @since 3.0.0 - * - * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - setFreeze: function (value) - { - this._frozen = value; - - return this; - }, - - /** - * Delete all data in this Data Manager and unfreeze it. - * - * @method Phaser.Data.DataManager#reset - * @since 3.0.0 - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - reset: function () - { - for (var key in this.list) - { - delete this.list[key]; - delete this.values[key]; - } - - this._frozen = false; - - return this; - }, - - /** - * Destroy this data manager. - * - * @method Phaser.Data.DataManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.reset(); - - this.events.off('changedata'); - this.events.off('setdata'); - this.events.off('removedata'); - - this.parent = null; - }, - - /** - * Gets or sets the frozen state of this Data Manager. - * A frozen Data Manager will block all attempts to create new values or update existing ones. - * - * @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; - } - - }, - - /** - * Return the total number of entries in this Data Manager. - * - * @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; - } - - } - -}); - -module.exports = DataManager; - - -/***/ }), -/* 124 */ -/***/ (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.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); -}; - -module.exports = Perimeter; - - /***/ }), /* 125 */ -/***/ (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__(66); -var Circle = __webpack_require__(71); -var CircleContains = __webpack_require__(40); -var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var GameObject = __webpack_require__(19); -var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(39); - -/** - * @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 - The Scene to which this Game Object belongs. - * @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. - * - * @name Phaser.GameObjects.Zone#blendMode - * @type {integer} - * @since 3.0.0 - */ - this.blendMode = BlendModes.NORMAL; - - this.updateDisplayOrigin(); - }, - - /** - * 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; - }, - - 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.Zone#displayHeight - * @type {number} - * @since 3.0.0 - */ - displayHeight: { - - get: function () - { - return this.scaleY * this.height; - }, - - set: function (value) - { - this.scaleY = value / this.height; - } - - }, - - /** - * Sets the size of this Game Object. - * - * @method Phaser.GameObjects.Zone#setSize - * @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. - * - * @return {Phaser.GameObjects.Zone} This Game Object. - */ - setSize: function (width, height, resizeInput) - { - if (resizeInput === undefined) { resizeInput = true; } - - this.width = width; - this.height = height; - - if (resizeInput && this.input && this.input.hitArea instanceof Rectangle) - { - this.input.hitArea.width = width; - this.input.hitArea.height = height; - } - - return this; - }, - - /** - * Sets the display size of this Game Object. - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Zone#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.Zone} This Game Object. - */ - setDisplaySize: function (width, height) - { - this.displayWidth = width; - this.displayHeight = height; - - return this; - }, - - /** - * Sets this Zone to be a Circular Drop Zone. - * The circle is centered on this Zones `x` and `y` coordinates. - * - * @method Phaser.GameObjects.Zone#setCircleDropZone - * @since 3.0.0 - * - * @param {number} radius - The radius of the Circle that will form the Drop Zone. - * - * @return {Phaser.GameObjects.Zone} This Game Object. - */ - setCircleDropZone: function (radius) - { - return this.setDropZone(new Circle(0, 0, radius), CircleContains); - }, - - /** - * Sets this Zone to be a Rectangle Drop Zone. - * The rectangle is centered on this Zones `x` and `y` coordinates. - * - * @method Phaser.GameObjects.Zone#setRectangleDropZone - * @since 3.0.0 - * - * @param {number} width - The width of the rectangle drop zone. - * @param {number} height - The height of the rectangle drop zone. - * - * @return {Phaser.GameObjects.Zone} This Game Object. - */ - setRectangleDropZone: function (width, height) - { - return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains); - }, - - /** - * Allows you to define your own Geometry shape to be used as a Drop Zone. - * - * @method Phaser.GameObjects.Zone#setDropZone - * @since 3.0.0 - * - * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. - * @param {HitAreaCallback} 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. - */ - setDropZone: function (shape, callback) - { - if (shape === undefined) - { - this.setRectangleDropZone(this.width, this.height); - } - else if (!this.input) - { - this.setInteractive(shape, callback, true); - } - - return this; - }, - - /** - * A NOOP method so you can pass a Zone to a Container. - * Calling this method will do nothing. It is intentionally empty. - * - * @method Phaser.GameObjects.Zone#setAlpha - * @private - * @since 3.11.0 - */ - setAlpha: function () - { - }, - - /** - * A Zone does not render. - * - * @method Phaser.GameObjects.Zone#renderCanvas - * @private - * @since 3.0.0 - */ - renderCanvas: function () - { - }, - - /** - * A Zone does not render. - * - * @method Phaser.GameObjects.Zone#renderWebGL - * @private - * @since 3.0.0 - */ - renderWebGL: function () - { - } - -}); - -module.exports = Zone; - - -/***/ }), -/* 126 */, -/* 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} - */ - -/** - * @typedef {object} TweenDataGenConfig - * - * @property {function} delay - [description] - * @property {function} duration - [description] - * @property {function} hold - [description] - * @property {function} repeat - [description] - * @property {function} repeatDelay - [description] - */ - -/** - * @typedef {object} Phaser.Tweens.TweenDataConfig - * - * @property {object} target - The target to tween. - * @property {string} key - The property of the target being tweened. - * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween. - * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween. - * @property {function} ease - The ease function this tween uses. - * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats. - * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) - * @property {number} [delay=0] - Time in ms/frames before tween will start. - * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired. - * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start. - * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats - * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats - * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData. - * @property {number} [elapsed=0] - Delta counter - * @property {integer} [repeatCounter=0] - How many repeats are left to run? - * @property {number} [start=0] - Ease value data. - * @property {number} [current=0] - Ease value data. - * @property {number} [end=0] - Ease value data. - * @property {number} [t1=0] - Time duration 1. - * @property {number} [t2=0] - Time duration 2. - * @property {TweenDataGenConfig} [gen] - LoadValue generation functions. - * @property {integer} [state=0] - TWEEN_CONST.CREATED - */ - -/** - * [description] - * - * @function Phaser.Tweens.TweenData - * @since 3.0.0 - * - * @param {object} target - [description] - * @param {string} key - [description] - * @param {function} getEnd - [description] - * @param {function} getStart - [description] - * @param {function} ease - [description] - * @param {number} delay - [description] - * @param {number} duration - [description] - * @param {boolean} yoyo - [description] - * @param {number} hold - [description] - * @param {number} repeat - [description] - * @param {number} repeatDelay - [description] - * @param {boolean} flipX - [description] - * @param {boolean} flipY - [description] - * - * @return {TweenDataConfig} [description] - */ -var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) -{ - return { - - // The target to tween - target: target, - - // The property of the target to tween - key: key, - - // The returned value sets what the property will be at the END of the Tween. - getEndValue: getEnd, - - // The returned value sets what the property will be at the START of the Tween. - getStartValue: getStart, - - // The ease function this tween uses. - ease: ease, - - // Duration of the tween in ms/frames, excludes time for yoyo or repeats. - duration: 0, - - // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) - totalDuration: 0, - - // Time in ms/frames before tween will start. - delay: 0, - - // Cause the tween to return back to its start value after hold has expired. - yoyo: yoyo, - - // Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - hold: 0, - - // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - repeat: 0, - - // Time in ms/frames before the repeat will start. - repeatDelay: 0, - - // Automatically call toggleFlipX when the TweenData yoyos or repeats - flipX: flipX, - - // Automatically call toggleFlipY when the TweenData yoyos or repeats - flipY: flipY, - - // Between 0 and 1 showing completion of this TweenData. - progress: 0, - - // Delta counter. - elapsed: 0, - - // How many repeats are left to run? - repeatCounter: 0, - - // Ease Value Data: - - start: 0, - current: 0, - end: 0, - - // Time Durations - t1: 0, - t2: 0, - - // LoadValue generation functions - gen: { - delay: delay, - duration: duration, - hold: hold, - repeat: repeat, - repeatDelay: repeatDelay - }, - - // TWEEN_CONST.CREATED - state: 0 - }; -}; - -module.exports = TweenData; - - -/***/ }), -/* 128 */ -/***/ (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 GameObjectCreator = __webpack_require__(13); -var GameObjectFactory = __webpack_require__(5); -var TWEEN_CONST = __webpack_require__(83); - -/** - * @classdesc - * [description] - * - * @class Tween - * @memberof Phaser.Tweens - * @constructor - * @since 3.0.0 - * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] - * @param {Phaser.Tweens.TweenDataConfig[]} data - [description] - * @param {array} targets - [description] - */ -var Tween = new Class({ - - initialize: - - function Tween (parent, data, targets) - { - /** - * [description] - * - * @name Phaser.Tweens.Tween#parent - * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * Is the parent of this Tween a Timeline? - * - * @name Phaser.Tweens.Tween#parentIsTimeline - * @type {boolean} - * @since 3.0.0 - */ - this.parentIsTimeline = parent.hasOwnProperty('isTimeline'); - - /** - * An array of TweenData objects, each containing a unique property and target being tweened. - * - * @name Phaser.Tweens.Tween#data - * @type {Phaser.Tweens.TweenDataConfig[]} - * @since 3.0.0 - */ - this.data = data; - - /** - * data array doesn't change, so we can cache the length - * - * @name Phaser.Tweens.Tween#totalData - * @type {integer} - * @since 3.0.0 - */ - this.totalData = data.length; - - /** - * An array of references to the target/s this Tween is operating on - * - * @name Phaser.Tweens.Tween#targets - * @type {object[]} - * @since 3.0.0 - */ - this.targets = targets; - - /** - * Cached target total (not necessarily the same as the data total) - * - * @name Phaser.Tweens.Tween#totalTargets - * @type {integer} - * @since 3.0.0 - */ - this.totalTargets = targets.length; - - /** - * If true then duration, delay, etc values are all frame totals. - * - * @name Phaser.Tweens.Tween#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.Tween#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.Tween#loop - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loop = 0; - - /** - * Time in ms/frames before the tween loops. - * - * @name Phaser.Tweens.Tween#loopDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopDelay = 0; - - /** - * How many loops are left to run? - * - * @name Phaser.Tweens.Tween#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 = -1 (as it never completes) - * - * @name Phaser.Tweens.Tween#completeDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.completeDelay = 0; - - /** - * Countdown timer (used by timeline offset, loopDelay and completeDelay) - * - * @name Phaser.Tweens.Tween#countdown - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.countdown = 0; - - /** - * Set only if this Tween is part of a Timeline. - * - * @name Phaser.Tweens.Tween#offset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.offset = 0; - - /** - * Set only if this Tween is part of a Timeline. The calculated offset amount. - * - * @name Phaser.Tweens.Tween#calculatedOffset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.calculatedOffset = 0; - - /** - * The current state of the tween - * - * @name Phaser.Tweens.Tween#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.Tween#_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.Tween#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.Tween#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.Tween#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.Tween#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.Tween#progress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.progress = 0; - - /** - * Time in ms/frames for the Tween to complete (including looping) - * - * @name Phaser.Tweens.Tween#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.Tween#totalProgress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalProgress = 0; - - /** - * An object containing the various Tween callback references. - * - * @name Phaser.Tweens.Tween#callbacks - * @type {object} - * @default 0 - * @since 3.0.0 - */ - this.callbacks = { - onComplete: null, - onLoop: null, - onRepeat: null, - onStart: null, - onUpdate: null, - onYoyo: null - }; - - this.callbackScope; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#getValue - * @since 3.0.0 - * - * @return {number} [description] - */ - getValue: function () - { - return this.data[0].current; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#setTimeScale - * @since 3.0.0 - * - * @param {number} value - [description] - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - setTimeScale: function (value) - { - this.timeScale = value; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#getTimeScale - * @since 3.0.0 - * - * @return {number} [description] - */ - getTimeScale: function () - { - return this.timeScale; - }, - - /** - * Checks if the Tween is currently active. - * - * @method Phaser.Tweens.Tween#isPlaying - * @since 3.0.0 - * - * @return {boolean} `true` if the Tween is active, otherwise `false`. - */ - isPlaying: function () - { - return (this.state === TWEEN_CONST.ACTIVE); - }, - - /** - * Checks if the Tween is currently paused. - * - * @method Phaser.Tweens.Tween#isPaused - * @since 3.0.0 - * - * @return {boolean} `true` if the Tween is paused, otherwise `false`. - */ - isPaused: function () - { - return (this.state === TWEEN_CONST.PAUSED); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#hasTarget - * @since 3.0.0 - * - * @param {object} target - [description] - * - * @return {boolean} [description] - */ - hasTarget: function (target) - { - return (this.targets.indexOf(target) !== -1); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#updateTo - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {*} value - [description] - * @param {boolean} startToCurrent - [description] - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - updateTo: function (key, value, startToCurrent) - { - for (var i = 0; i < this.totalData; i++) - { - var tweenData = this.data[i]; - - if (tweenData.key === key) - { - tweenData.end = value; - - if (startToCurrent) - { - tweenData.start = tweenData.current; - } - - break; - } - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#restart - * @since 3.0.0 - */ - restart: function () - { - if (this.state === TWEEN_CONST.REMOVED) - { - this.seek(0); - this.parent.makeActive(this); - } - else - { - this.stop(); - this.play(); - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#calcDuration - * @since 3.0.0 - */ - calcDuration: function () - { - var max = 0; - - var data = this.data; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - - // Set t1 (duration + hold + yoyo) - tweenData.t1 = tweenData.duration + tweenData.hold; - - if (tweenData.yoyo) - { - tweenData.t1 += tweenData.duration; - } - - // Set t2 (repeatDelay + duration + hold + yoyo) - tweenData.t2 = tweenData.t1 + tweenData.repeatDelay; - - // Total Duration - tweenData.totalDuration = tweenData.delay + tweenData.t1; - - if (tweenData.repeat === -1) - { - tweenData.totalDuration += (tweenData.t2 * 999999999999); - } - else if (tweenData.repeat > 0) - { - tweenData.totalDuration += (tweenData.t2 * tweenData.repeat); - } - - if (tweenData.totalDuration > max) - { - // Get the longest TweenData from the Tween, used to calculate the Tween TD - max = tweenData.totalDuration; - } - } - - // Excludes loop values - this.duration = max; - - 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; - } - }, - - /** - * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens. - * Should not be called directly. - * - * @method Phaser.Tweens.Tween#init - * @since 3.0.0 - * - * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager. - */ - init: function () - { - var data = this.data; - var totalTargets = this.totalTargets; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - var target = tweenData.target; - var gen = tweenData.gen; - - tweenData.delay = gen.delay(i, totalTargets, target); - tweenData.duration = gen.duration(i, totalTargets, target); - tweenData.hold = gen.hold(i, totalTargets, target); - tweenData.repeat = gen.repeat(i, totalTargets, target); - tweenData.repeatDelay = gen.repeatDelay(i, totalTargets, target); - } - - this.calcDuration(); - - this.progress = 0; - this.totalProgress = 0; - this.elapsed = 0; - this.totalElapsed = 0; - - // You can't have a paused Tween if it's part of a Timeline - if (this.paused && !this.parentIsTimeline) - { - this.state = TWEEN_CONST.PENDING_ADD; - this._pausedState = TWEEN_CONST.INIT; - - return false; - } - else - { - this.state = TWEEN_CONST.INIT; - - return true; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#nextState - * @since 3.0.0 - */ - nextState: function () - { - if (this.loopCounter > 0) - { - this.elapsed = 0; - this.progress = 0; - this.loopCounter--; - - var onLoop = this.callbacks.onLoop; - - if (onLoop) - { - onLoop.params[1] = this.targets; - - onLoop.func.apply(onLoop.scope, onLoop.params); - } - - this.resetTweenData(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.params[1] = this.targets; - - onComplete.func.apply(onComplete.scope, onComplete.params); - } - - this.state = TWEEN_CONST.PENDING_REMOVE; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#pause - * @since 3.0.0 - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - pause: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } - - this.paused = true; - - this._pausedState = this.state; - - this.state = TWEEN_CONST.PAUSED; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#play - * @since 3.0.0 - * - * @param {boolean} resetFromTimeline - [description] - */ - play: function (resetFromTimeline) - { - if (this.state === TWEEN_CONST.ACTIVE) - { - return; - } - else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED) - { - this.init(); - this.parent.makeActive(this); - resetFromTimeline = true; - } - - var onStart = this.callbacks.onStart; - - if (this.parentIsTimeline) - { - this.resetTweenData(resetFromTimeline); - - if (this.calculatedOffset === 0) - { - if (onStart) - { - onStart.params[1] = this.targets; - - onStart.func.apply(onStart.scope, onStart.params); - } - - this.state = TWEEN_CONST.ACTIVE; - } - else - { - this.countdown = this.calculatedOffset; - - this.state = TWEEN_CONST.OFFSET_DELAY; - } - } - else if (this.paused) - { - this.paused = false; - - this.parent.makeActive(this); - } - else - { - this.resetTweenData(resetFromTimeline); - - this.state = TWEEN_CONST.ACTIVE; - - if (onStart) - { - onStart.params[1] = this.targets; - - onStart.func.apply(onStart.scope, onStart.params); - } - - this.parent.makeActive(this); - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#resetTweenData - * @since 3.0.0 - * - * @param {boolean} resetFromLoop - [description] - */ - resetTweenData: function (resetFromLoop) - { - var data = this.data; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - - tweenData.progress = 0; - tweenData.elapsed = 0; - - tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat; - - if (resetFromLoop) - { - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.end); - - tweenData.current = tweenData.start; - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - else if (tweenData.delay > 0) - { - tweenData.elapsed = tweenData.delay; - tweenData.state = TWEEN_CONST.DELAY; - } - else - { - tweenData.state = TWEEN_CONST.PENDING_RENDER; - } - } - }, - - /** - * Resumes the playback of a previously paused Tween. - * - * @method Phaser.Tweens.Tween#resume - * @since 3.0.0 - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - resume: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - this.paused = false; - - this.state = this._pausedState; - } - else - { - this.play(); - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#seek - * @since 3.0.0 - * - * @param {number} toPosition - A value between 0 and 1. - */ - seek: function (toPosition) - { - var data = this.data; - - for (var i = 0; i < this.totalData; i++) - { - // This won't work with loop > 0 yet - var ms = this.totalDuration * toPosition; - - var tweenData = data[i]; - var progress = 0; - var elapsed = 0; - - if (ms <= tweenData.delay) - { - progress = 0; - elapsed = 0; - } - else if (ms >= tweenData.totalDuration) - { - progress = 1; - elapsed = tweenData.duration; - } - else if (ms > tweenData.delay && ms <= tweenData.t1) - { - // Keep it zero bound - ms = Math.max(0, ms - tweenData.delay); - - // Somewhere in the first playthru range - progress = ms / tweenData.t1; - elapsed = tweenData.duration * progress; - } - else if (ms > tweenData.t1 && ms < tweenData.totalDuration) - { - // Somewhere in repeat land - ms -= tweenData.delay; - ms -= tweenData.t1; - - // var repeats = Math.floor(ms / tweenData.t2); - - // remainder - ms = ((ms / tweenData.t2) % 1) * tweenData.t2; - - if (ms > tweenData.repeatDelay) - { - progress = ms / tweenData.t1; - elapsed = tweenData.duration * progress; - } - } - - tweenData.progress = progress; - tweenData.elapsed = elapsed; - - var v = tweenData.ease(tweenData.progress); - - tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - - // console.log(tweenData.key, 'Seek', tweenData.target[tweenData.key], 'to', tweenData.current, 'pro', tweenData.progress, 'marker', toPosition, progress); - - // if (tweenData.current === 0) - // { - // console.log('zero', tweenData.start, tweenData.end, v, 'progress', progress); - // } - - tweenData.target[tweenData.key] = tweenData.current; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#setCallback - * @since 3.0.0 - * - * @param {string} type - [description] - * @param {function} callback - [description] - * @param {array} [params] - [description] - * @param {object} [scope] - [description] - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - setCallback: function (type, callback, params, scope) - { - this.callbacks[type] = { func: callback, scope: scope, params: params }; - - 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. - * - * @method Phaser.Tweens.Tween#stop - * @since 3.0.0 - * - * @param {number} [resetTo] - A value between 0 and 1. - */ - stop: function (resetTo) - { - if (this.state === TWEEN_CONST.ACTIVE) - { - if (resetTo !== undefined) - { - this.seek(resetTo); - } - } - - if (this.state !== TWEEN_CONST.REMOVED) - { - if (this.state === TWEEN_CONST.PAUSED || this.state === TWEEN_CONST.PENDING_ADD) - { - this.parent._destroy.push(this); - this.parent._toProcess++; - } - - this.state = TWEEN_CONST.PENDING_REMOVE; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#update - * @since 3.0.0 - * - * @param {number} timestamp - [description] - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - * - * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. - */ - update: function (timestamp, delta) - { - if (this.state === TWEEN_CONST.PAUSED) - { - return false; - } - - if (this.useFrames) - { - delta = 1 * this.parent.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 = false; - - for (var i = 0; i < this.totalData; i++) - { - if (this.updateTweenData(this, this.data[i], delta)) - { - stillRunning = true; - } - } - - // Anything still running? If not, we're done - if (!stillRunning) - { - this.nextState(); - } - - break; - - case TWEEN_CONST.LOOP_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; - } - - break; - - case TWEEN_CONST.OFFSET_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - var onStart = this.callbacks.onStart; - - if (onStart) - { - onStart.params[1] = this.targets; - - onStart.func.apply(onStart.scope, onStart.params); - } - - 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.state = TWEEN_CONST.PENDING_REMOVE; - } - - break; - } - - return (this.state === TWEEN_CONST.PENDING_REMOVE); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#setStateFromEnd - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] - * - * @return {integer} The state of this Tween. - */ - setStateFromEnd: function (tween, tweenData, diff) - { - if (tweenData.yoyo) - { - // We've hit the end of a Playing Forward TweenData and we have a yoyo - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - // Problem: The flip and callback and so on gets called for every TweenData that triggers it at the same time. - // If you're tweening several properties it can fire for all of them, at once. - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - var onYoyo = tween.callbacks.onYoyo; - - if (onYoyo) - { - // Element 1 is reserved for the target of the yoyo (and needs setting here) - onYoyo.params[1] = tweenData.target; - - onYoyo.func.apply(onYoyo.scope, onYoyo.params); - } - - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); - - return TWEEN_CONST.PLAYING_BACKWARD; - } - else if (tweenData.repeatCounter > 0) - { - // We've hit the end of a Playing Forward TweenData and we have a Repeat. - // So we're going to go right back to the start to repeat it again. - - tweenData.repeatCounter--; - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - var onRepeat = tween.callbacks.onRepeat; - - if (onRepeat) - { - // Element 1 is reserved for the target of the repeat (and needs setting here) - onRepeat.params[1] = tweenData.target; - - onRepeat.func.apply(onRepeat.scope, onRepeat.params); - } - - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); - - // Delay? - if (tweenData.repeatDelay > 0) - { - tweenData.elapsed = tweenData.repeatDelay - diff; - - tweenData.current = tweenData.start; - - tweenData.target[tweenData.key] = tweenData.current; - - return TWEEN_CONST.REPEAT_DELAY; - } - else - { - return TWEEN_CONST.PLAYING_FORWARD; - } - } - - return TWEEN_CONST.COMPLETE; - }, - - /** - * Was PLAYING_BACKWARD and has hit the start. - * - * @method Phaser.Tweens.Tween#setStateFromStart - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] - * - * @return {integer} The state of this Tween. - */ - setStateFromStart: function (tween, tweenData, diff) - { - if (tweenData.repeatCounter > 0) - { - tweenData.repeatCounter--; - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - var onRepeat = tween.callbacks.onRepeat; - - if (onRepeat) - { - // Element 1 is reserved for the target of the repeat (and needs setting here) - onRepeat.params[1] = tweenData.target; - - onRepeat.func.apply(onRepeat.scope, onRepeat.params); - } - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); - - // Delay? - if (tweenData.repeatDelay > 0) - { - tweenData.elapsed = tweenData.repeatDelay - diff; - - tweenData.current = tweenData.start; - - tweenData.target[tweenData.key] = tweenData.current; - - return TWEEN_CONST.REPEAT_DELAY; - } - else - { - return TWEEN_CONST.PLAYING_FORWARD; - } - } - - return TWEEN_CONST.COMPLETE; - }, - - // - /** - * [description] - * - * @method Phaser.Tweens.Tween#updateTweenData - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true - * - * @return {boolean} [description] - */ - updateTweenData: function (tween, tweenData, delta) - { - switch (tweenData.state) - { - case TWEEN_CONST.PLAYING_FORWARD: - case TWEEN_CONST.PLAYING_BACKWARD: - - if (!tweenData.target) - { - tweenData.state = TWEEN_CONST.COMPLETE; - break; - } - - var elapsed = tweenData.elapsed; - var duration = tweenData.duration; - var diff = 0; - - elapsed += delta; - - if (elapsed > duration) - { - diff = elapsed - duration; - elapsed = duration; - } - - var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD); - var progress = elapsed / duration; - - var v; - - if (forward) - { - v = tweenData.ease(progress); - } - else - { - v = tweenData.ease(1 - progress); - } - - tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - - tweenData.target[tweenData.key] = tweenData.current; - - tweenData.elapsed = elapsed; - tweenData.progress = progress; - - var onUpdate = tween.callbacks.onUpdate; - - if (onUpdate) - { - onUpdate.params[1] = tweenData.target; - - onUpdate.func.apply(onUpdate.scope, onUpdate.params); - } - - if (progress === 1) - { - if (forward) - { - if (tweenData.hold > 0) - { - tweenData.elapsed = tweenData.hold - diff; - - tweenData.state = TWEEN_CONST.HOLD_DELAY; - } - else - { - tweenData.state = this.setStateFromEnd(tween, tweenData, diff); - } - } - else - { - tweenData.state = this.setStateFromStart(tween, tweenData, diff); - } - } - - break; - - case TWEEN_CONST.DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.elapsed = Math.abs(tweenData.elapsed); - - tweenData.state = TWEEN_CONST.PENDING_RENDER; - } - - break; - - case TWEEN_CONST.REPEAT_DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.elapsed = Math.abs(tweenData.elapsed); - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - - break; - - case TWEEN_CONST.HOLD_DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed)); - } - - break; - - case TWEEN_CONST.PENDING_RENDER: - - if (tweenData.target) - { - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.target[tweenData.key]); - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); - - tweenData.current = tweenData.start; - - tweenData.target[tweenData.key] = tweenData.start; - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - else - { - tweenData.state = TWEEN_CONST.COMPLETE; - } - - break; - } - - // Return TRUE if this TweenData still playing, otherwise return FALSE - return (tweenData.state !== TWEEN_CONST.COMPLETE); - } - -}); - -Tween.TYPES = [ - 'onComplete', - 'onLoop', - 'onRepeat', - 'onStart', - 'onUpdate', - 'onYoyo' -]; - -/** - * Creates a new Tween object. - * - * Note: This method will only be available Tweens have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#tween - * @since 3.0.0 - * - * @param {object} config - The Tween configuration. - * - * @return {Phaser.Tweens.Tween} The Tween that was created. - */ -GameObjectFactory.register('tween', function (config) -{ - return this.scene.sys.tweens.add(config); -}); - -// 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 - -/** - * Creates a new Tween object and returns it. - * - * Note: This method will only be available if Tweens have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#tween - * @since 3.0.0 - * - * @param {object} config - The Tween configuration. - * - * @return {Phaser.Tweens.Tween} The Tween that was created. - */ -GameObjectCreator.register('tween', function (config) -{ - return this.scene.sys.tweens.create(config); -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. - -module.exports = Tween; - - -/***/ }), -/* 129 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @typedef {object} Phaser.Tweens.TweenConfigDefaults - * - * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. - * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. - * @property {number} [duration=1000] - The duration of the tween in milliseconds. - * @property {string} [ease='Power0'] - The easing equation to use for the tween. - * @property {array} [easeParams] - Optional easing parameters. - * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. - * @property {number} [repeat=0] - The number of times to repeat the tween. - * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. - * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. - * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. - * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. - */ - -var TWEEN_DEFAULTS = { - targets: null, - delay: 0, - duration: 1000, - ease: 'Power0', - easeParams: null, - hold: 0, - repeat: 0, - repeatDelay: 0, - yoyo: false, - flipX: false, - flipY: false -}; - -module.exports = TWEEN_DEFAULTS; - - -/***/ }), -/* 130 */ -/***/ (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 hasGetStart (def) -{ - return (!!def.getStart && typeof def.getStart === 'function'); -} - -function hasGetEnd (def) -{ - return (!!def.getEnd && typeof def.getEnd === 'function'); -} - -function hasGetters (def) -{ - return hasGetStart(def) || hasGetEnd(def); -} - -/** - * [description] - * - * @function Phaser.Tweens.Builders.GetValueOp - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {*} propertyValue - [description] - * - * @return {function} [description] - */ -var GetValueOp = function (key, propertyValue) -{ - var callbacks; - - // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween) - var getEnd = function (target, key, value) { return value; }; - - // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween) - var getStart = function (target, key, value) { return value; }; - - var t = typeof(propertyValue); - - if (t === 'number') - { - // props: { - // x: 400, - // y: 300 - // } - - getEnd = function () - { - return propertyValue; - }; - } - else if (t === 'string') - { - // props: { - // x: '+=400', - // y: '-=300', - // z: '*=2', - // w: '/=2' - // } - - var op = propertyValue[0]; - var num = parseFloat(propertyValue.substr(2)); - - switch (op) - { - case '+': - getEnd = function (target, key, value) - { - return value + num; - }; - break; - - case '-': - getEnd = function (target, key, value) - { - return value - num; - }; - break; - - case '*': - getEnd = function (target, key, value) - { - return value * num; - }; - break; - - case '/': - getEnd = function (target, key, value) - { - return value / num; - }; - break; - - default: - getEnd = function () - { - return parseFloat(propertyValue); - }; - } - } - else if (t === 'function') - { - // The same as setting just the getEnd function and no getStart - - // props: { - // x: function (target, key, value) { return value + 50); }, - // } - - getEnd = propertyValue; - } - else if (t === 'object' && hasGetters(propertyValue)) - { - /* - x: { - // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween. - getEnd: function (target, key, value) - { - return value; - }, - - // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween. - getStart: function (target, key, value) - { - return value; - } - } - */ - - if (hasGetEnd(propertyValue)) - { - getEnd = propertyValue.getEnd; - } - - if (hasGetStart(propertyValue)) - { - getStart = propertyValue.getStart; - } - } - else if (propertyValue.hasOwnProperty('value')) - { - // Value may still be a string, function or a number - // props: { - // x: { value: 400, ... }, - // y: { value: 300, ... } - // } - - callbacks = GetValueOp(key, propertyValue.value); - } - - // If callback not set by the else if block above then set it here and return it - if (!callbacks) - { - callbacks = { - getEnd: getEnd, - getStart: getStart - }; - } - - return callbacks; -}; - -module.exports = GetValueOp; - - -/***/ }), -/* 131 */ -/***/ (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.GetTargets - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {array} [description] - */ -var GetTargets = function (config) -{ - var targets = GetValue(config, 'targets', null); - - if (targets === null) - { - return targets; - } - - if (typeof targets === 'function') - { - targets = targets.call(); - } - - if (!Array.isArray(targets)) - { - targets = [ targets ]; - } - - return targets; -}; - -module.exports = GetTargets; - - -/***/ }), -/* 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 Formats = __webpack_require__(29); -var MapData = __webpack_require__(77); -var Parse = __webpack_require__(217); -var Tilemap = __webpack_require__(209); - -/** - * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When - * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from - * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For - * an empty map, you should specify tileWidth, tileHeight, width & height. - * - * @function Phaser.Tilemaps.ParseToTilemap - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. - * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {integer} [tileWidth=32] - The width of a tile in pixels. - * @param {integer} [tileHeight=32] - The height of a tile in pixels. - * @param {integer} [width=10] - The width of the map in tiles. - * @param {integer} [height=10] - The height of the map in tiles. - * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from - * a 2D array of tile indexes. - * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the - * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.Tilemap} - */ -var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) -{ - if (tileWidth === undefined) { tileWidth = 32; } - if (tileHeight === undefined) { tileHeight = 32; } - if (width === undefined) { width = 10; } - if (height === undefined) { height = 10; } - if (insertNull === undefined) { insertNull = false; } - - var mapData = null; - - if (Array.isArray(data)) - { - var name = key !== undefined ? key : 'map'; - mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull); - } - else if (key !== undefined) - { - var tilemapData = scene.cache.tilemap.get(key); - - if (!tilemapData) - { - console.warn('No map data found for key ' + key); - } - else - { - mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull); - } - } - - if (mapData === null) - { - mapData = new MapData({ - tileWidth: tileWidth, - tileHeight: tileHeight, - width: width, - height: height - }); - } - - return new Tilemap(scene, mapData); -}; - -module.exports = ParseToTilemap; - - -/***/ }), -/* 133 */ -/***/ (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 Formats = __webpack_require__(29); -var LayerData = __webpack_require__(78); -var MapData = __webpack_require__(77); -var Tile = __webpack_require__(55); - -/** - * Parses a 2D array of tile indexes into a new MapData object with a single layer. - * - * @function Phaser.Tilemaps.Parsers.Parse2DArray - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object. - * @param {integer} tileWidth - The width of a tile in pixels. - * @param {integer} tileHeight - The height of a tile in pixels. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.MapData} [description] - */ -var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) -{ - var layerData = new LayerData({ - tileWidth: tileWidth, - tileHeight: tileHeight - }); - - var mapData = new MapData({ - name: name, - tileWidth: tileWidth, - tileHeight: tileHeight, - format: Formats.ARRAY_2D, - layers: [ layerData ] - }); - - var tiles = []; - var height = data.length; - var width = 0; - - for (var y = 0; y < data.length; y++) - { - tiles[y] = []; - var row = data[y]; - - for (var x = 0; x < row.length; x++) - { - var tileIndex = parseInt(row[x], 10); - - if (isNaN(tileIndex) || tileIndex === -1) - { - tiles[y][x] = insertNull - ? null - : new Tile(layerData, -1, x, y, tileWidth, tileHeight); - } - else - { - tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight); - } - } - - if (width === 0) - { - width = row.length; - } - } - - mapData.width = layerData.width = width; - mapData.height = layerData.height = height; - mapData.widthInPixels = layerData.widthInPixels = width * tileWidth; - mapData.heightInPixels = layerData.heightInPixels = height * tileHeight; - layerData.data = tiles; - - return mapData; -}; - -module.exports = Parse2DArray; - - -/***/ }), -/* 134 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Internally used method to keep track of the tile indexes that collide within a layer. This - * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`. - * - * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex - * @private - * @since 3.0.0 - * - * @param {integer} tileIndex - The tile index to set the collision boolean for. - * @param {boolean} [collides=true] - Should the tile index collide or not? - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetLayerCollisionIndex = function (tileIndex, collides, layer) -{ - var loc = layer.collideIndexes.indexOf(tileIndex); - - if (collides && loc === -1) - { - layer.collideIndexes.push(tileIndex); - } - else if (!collides && loc !== -1) - { - layer.collideIndexes.splice(loc, 1); - } -}; - -module.exports = SetLayerCollisionIndex; - - -/***/ }), -/* 135 */ -/***/ (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 Tile = __webpack_require__(55); -var IsInLayerBounds = __webpack_require__(79); -var CalculateFacesAt = __webpack_require__(136); -var SetTileCollision = __webpack_require__(56); - -/** - * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index - * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified - * location. If you pass in an index, only the index at the specified location will be changed. - * Collision information will be recalculated at the specified location. - * - * @function Phaser.Tilemaps.Components.PutTileAt - * @private - * @since 3.0.0 - * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. - */ -var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) -{ - if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - var oldTile = layer.data[tileY][tileX]; - var oldTileCollides = oldTile && oldTile.collides; - - if (tile instanceof Tile) - { - if (layer.data[tileY][tileX] === null) - { - layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height); - } - layer.data[tileY][tileX].copy(tile); - } - else - { - var index = tile; - if (layer.data[tileY][tileX] === null) - { - layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight); - } - else - { - layer.data[tileY][tileX].index = index; - } - } - - // Updating colliding flag on the new tile - var newTile = layer.data[tileY][tileX]; - var collides = layer.collideIndexes.indexOf(newTile.index) !== -1; - SetTileCollision(newTile, collides); - - // Recalculate faces only if the colliding flag at (tileX, tileY) has changed - if (recalculateFaces && (oldTileCollides !== newTile.collides)) - { - CalculateFacesAt(tileX, tileY, layer); - } - - return newTile; -}; - -module.exports = PutTileAt; - - - -/***/ }), -/* 136 */ -/***/ (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 GetTileAt = __webpack_require__(102); - -/** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. - * - * @function Phaser.Tilemaps.Components.CalculateFacesAt - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var CalculateFacesAt = function (tileX, tileY, layer) -{ - var tile = GetTileAt(tileX, tileY, true, layer); - var above = GetTileAt(tileX, tileY - 1, true, layer); - var below = GetTileAt(tileX, tileY + 1, true, layer); - var left = GetTileAt(tileX - 1, tileY, true, layer); - var right = GetTileAt(tileX + 1, tileY, true, layer); - var tileCollides = tile && tile.collides; - - // Assume the changed tile has all interesting edges - if (tileCollides) - { - tile.faceTop = true; - tile.faceBottom = true; - tile.faceLeft = true; - tile.faceRight = true; - } - - // Reset edges that are shared between tile and its neighbors - if (above && above.collides) - { - if (tileCollides) { tile.faceTop = false; } - above.faceBottom = !tileCollides; - } - - if (below && below.collides) - { - if (tileCollides) { tile.faceBottom = false; } - below.faceTop = !tileCollides; - } - - if (left && left.collides) - { - if (tileCollides) { tile.faceLeft = false; } - left.faceRight = !tileCollides; - } - - if (right && right.collides) - { - if (tileCollides) { tile.faceRight = false; } - right.faceLeft = !tileCollides; - } - - if (tile && !tile.collides) { tile.resetFaces(); } - - return tile; -}; - -module.exports = CalculateFacesAt; - - -/***/ }), -/* 137 */, -/* 138 */ -/***/ (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 - * A representation of a vector in 3D space. - * - * A three-component vector. - * - * @class Vector3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - */ -var Vector3 = new Class({ - - initialize: - - function Vector3 (x, y, z) - { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector3#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector3#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector3#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - }, - - /** - * Set this Vector to point up. - * - * Sets the y component of the vector to 1, and the others to 0. - * - * @method Phaser.Math.Vector3#up - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - up: function () - { - this.x = 0; - this.y = 1; - this.z = 0; - - return this; - }, - - /** - * Make a clone of this Vector3. - * - * @method Phaser.Math.Vector3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. - */ - clone: function () - { - return new Vector3(this.x, this.y, this.z); - }, - - /** - * Calculate the cross (vector) product of two given Vectors. - * - * @method Phaser.Math.Vector3#crossVectors - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - The first Vector to multiply. - * @param {Phaser.Math.Vector3} b - The second Vector to multiply. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - crossVectors: function (a, b) - { - var ax = a.x; - var ay = a.y; - var az = a.z; - var bx = b.x; - var by = b.y; - var bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict equality check against each Vector's components. - * - * @method Phaser.Math.Vector3#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. - * - * @return {boolean} True if the two vectors strictly match, otherwise false. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector3#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - - return this; - }, - - /** - * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. - * - * @method Phaser.Math.Vector3#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. - * @param {number} [y] - The y value to set for this Vector. - * @param {number} [z] - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - set: function (x, y, z) - { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - - return this; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector3#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector3#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - - return this; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector3#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - scale: function (scale) - { - if (isFinite(scale)) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - } - else - { - this.x = 0; - this.y = 0; - this.z = 0; - } - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - - return this; - }, - - /** - * Negate the `x`, `y` and `z` components of this Vector. - * - * @method Phaser.Math.Vector3#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector3#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return dx * dx + dy * dy + dz * dz; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector3#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return Math.sqrt(x * x + y * y + z * z); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector3#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return x * x + y * y + z * z; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector3#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var len = x * x + y * y + z * z; - - if (len > 0) - { - len = 1 / Math.sqrt(len); - - this.x = x * len; - this.y = y * len; - this.z = z * len; - } - - return this; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. - * - * @return {number} The dot product of this Vector and `v`. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z; - }, - - /** - * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. - * - * @method Phaser.Math.Vector3#cross - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector to cross product with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - cross: function (v) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var bx = v.x; - var by = v.y; - var bz = v.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector3#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = x * m[0] + y * m[3] + z * m[6]; - this.y = x * m[1] + y * m[4] + z * m[7]; - this.z = x * m[2] + y * m[5] + z * m[8]; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Vector3#transformCoordinates - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformCoordinates: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; - - this.x = tx / tw; - this.y = ty / tw; - this.z = tz / tw; - - return this; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector3#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - 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; - - // 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; - - // 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; - }, - - /** - * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, - * e.g. unprojecting a 2D point into 3D space. - * - * @method Phaser.Math.Vector3#project - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - project: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var a00 = m[0]; - var a01 = m[1]; - var a02 = m[2]; - var a03 = m[3]; - var a10 = m[4]; - var a11 = m[5]; - var a12 = m[6]; - var a13 = m[7]; - var a20 = m[8]; - var a21 = m[9]; - var a22 = m[10]; - var a23 = m[11]; - var a30 = m[12]; - var a31 = m[13]; - var a32 = m[14]; - var a33 = m[15]; - - var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); - - this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; - this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; - this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; - - return this; - }, - - /** - * Unproject this point from 2D space to 3D space. - * The point should have its x and y properties set to - * 2D screen space, and the z either at 0 (near plane) - * or 1 (far plane). The provided matrix is assumed to already - * be combined, i.e. projection * view * model. - * - * After this operation, this vector's (x, y, z) components will - * represent the unprojected 3D coordinate. - * - * @method Phaser.Math.Vector3#unproject - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. - * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - unproject: function (viewport, invProjectionView) - { - var viewX = viewport.x; - var viewY = viewport.y; - var viewWidth = viewport.z; - var viewHeight = viewport.w; - - var x = this.x - viewX; - var y = (viewHeight - this.y - 1) - viewY; - var z = this.z; - - this.x = (2 * x) / viewWidth - 1; - this.y = (2 * y) / viewHeight - 1; - this.z = 2 * z - 1; - - return this.project(invProjectionView); - }, - - /** - * Make this Vector the zero vector (0, 0, 0). - * - * @method Phaser.Math.Vector3#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - - return this; - } - -}); - -/* -Vector3.Zero = function () -{ - return new Vector3(0, 0, 0); -}; - -Vector3.Up = function () -{ - return new Vector3(0, 1.0, 0); -}; - -Vector3.Copy = function (source) -{ - return new Vector3(source.x, source.y, source.z); -}; - -Vector3.TransformCoordinates = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]) + transformation.m[12]; - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]) + transformation.m[13]; - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]) + transformation.m[14]; - var w = (vector.x * transformation.m[3]) + (vector.y * transformation.m[7]) + (vector.z * transformation.m[11]) + transformation.m[15]; - - return new Vector3(x / w, y / w, z / w); -}; - -Vector3.TransformNormal = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]); - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]); - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]); - - return new Vector3(x, y, z); -}; - -Vector3.Dot = function (left, right) -{ - return (left.x * right.x + left.y * right.y + left.z * right.z); -}; - -Vector3.Cross = function (left, right) -{ - var x = left.y * right.z - left.z * right.y; - var y = left.z * right.x - left.x * right.z; - var z = left.x * right.y - left.y * right.x; - - return new Vector3(x, y, z); -}; - -Vector3.Normalize = function (vector) -{ - var newVector = Vector3.Copy(vector); - newVector.normalize(); - - return newVector; -}; - -Vector3.Distance = function (value1, value2) -{ - return Math.sqrt(Vector3.DistanceSquared(value1, value2)); -}; - -Vector3.DistanceSquared = function (value1, value2) -{ - var x = value1.x - value2.x; - var y = value1.y - value2.y; - var z = value1.z - value2.z; - - return (x * x) + (y * y) + (z * z); -}; -*/ - -module.exports = Vector3; - - -/***/ }), -/* 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 Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var File = __webpack_require__(21); -var FileTypesManager = __webpack_require__(7); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(8); -var ParseXML = __webpack_require__(343); - -/** - * @typedef {object} Phaser.Loader.FileTypes.XMLFileConfig - * - * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. - * @property {string} [url] - The absolute or relative URL to load the file from. - * @property {string} [extension='xml'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ - -/** - * @classdesc - * A single XML File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml. - * - * @class XMLFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var XMLFile = new Class({ - - Extends: File, - - initialize: - - function XMLFile (loader, key, url, xhrSettings) - { - var extension = 'xml'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - - var fileConfig = { - type: 'xml', - cache: loader.cacheManager.xml, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.XMLFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = ParseXML(this.xhrLoader.responseText); - - if (this.data) - { - this.onProcessComplete(); - } - else - { - console.warn('Invalid XMLFile: ' + this.key); - - this.onProcessError(); - } - } - -}); - -/** - * Adds an XML file, or array of XML files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.xml('wavedata', 'files/AlienWaveData.xml'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global XML Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the XML Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the XML Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.xml({ - * key: 'wavedata', - * url: 'files/AlienWaveData.xml' - * }); - * ``` - * - * See the documentation for `Phaser.Loader.FileTypes.XMLFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.xml('wavedata', 'files/AlienWaveData.xml'); - * // and later in your game ... - * var data = this.cache.xml.get('wavedata'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the XML Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#xml - * @fires Phaser.Loader.LoaderPlugin#addFileEvent - * @since 3.0.0 - * - * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig|Phaser.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {Phaser.Loader.LoaderPlugin} The Loader instance. - */ -FileTypesManager.register('xml', 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 XMLFile(this, key[i])); - } - } - else - { - this.addFile(new XMLFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = XMLFile; - - -/***/ }), -/* 140 */ -/***/ (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 Extend = __webpack_require__(20); -var XHRSettings = __webpack_require__(105); - -/** - * Takes two XHRSettings Objects and creates a new XHRSettings object from them. - * - * The new object is seeded by the values given in the global settings, but any setting in - * the local object overrides the global ones. - * - * @function Phaser.Loader.MergeXHRSettings - * @since 3.0.0 - * - * @param {XHRSettingsObject} global - The global XHRSettings object. - * @param {XHRSettingsObject} local - The local XHRSettings object. - * - * @return {XHRSettingsObject} A newly formed XHRSettings object. - */ -var MergeXHRSettings = function (global, local) -{ - var output = (global === undefined) ? XHRSettings() : Extend({}, global); - - if (local) - { - for (var setting in local) - { - if (local[setting] !== undefined) - { - output[setting] = local[setting]; - } - } - } - - return output; -}; - -module.exports = MergeXHRSettings; - - -/***/ }), -/* 141 */ -/***/ (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 a File and a baseURL value this returns the URL the File will use to download from. - * - * @function Phaser.Loader.GetURL - * @since 3.0.0 - * - * @param {Phaser.Loader.File} file - The File object. - * @param {string} baseURL - A default base URL. - * - * @return {string} The URL the File will use. - */ -var GetURL = function (file, baseURL) -{ - if (!file.url) - { - return false; - } - - if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) - { - return file.url; - } - else - { - return baseURL + file.url; - } -}; - -module.exports = GetURL; - - -/***/ }), -/* 142 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using floor. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. - * As will `14` snap to `10`... but `16` will snap to `15`. - * - * @function Phaser.Math.Snap.Floor - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapFloor = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.floor(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapFloor; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Keyboard Codes. - * + * * @name Phaser.Input.Keyboard.KeyCodes * @enum {integer} * @memberof Phaser.Input.Keyboard @@ -28281,37 +22523,5847 @@ var KeyCodes = { /** * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET */ - CLOSED_BRACKET: 221 + CLOSED_BRACKET: 221, + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX + */ + SEMICOLON_FIREFOX: 59, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COLON + */ + COLON: 58, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS + */ + COMMA_FIREFOX_WINDOWS: 60, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX + */ + COMMA_FIREFOX: 62, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX + */ + BRACKET_RIGHT_FIREFOX: 174, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX + */ + BRACKET_LEFT_FIREFOX: 175 }; module.exports = KeyCodes; /***/ }), -/* 144 */ -/***/ (function(module, exports) { +/* 126 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * @namespace Phaser.Textures.Events + */ + +module.exports = { + + ADD: __webpack_require__(1049), + ERROR: __webpack_require__(1048), + LOAD: __webpack_require__(1047), + READY: __webpack_require__(1046), + REMOVE: __webpack_require__(1045) + +}; + + +/***/ }), +/* 127 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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; + + +/***/ }), +/* 128 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(99); + +/** + * 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. + * + * @typedef {object} Phaser.Device.Browser + * @since 3.0.0 + * + * @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(); + + +/***/ }), +/* 129 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates a linear (interpolation) value over t. + * + * @function Phaser.Math.Linear + * @since 3.0.0 + * + * @param {number} p0 - The first point. + * @param {number} p1 - The second point. + * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1. + * + * @return {number} The step t% of the way between p0 and p1. + */ +var Linear = function (p0, p1, t) +{ + return (p1 - p0) * t + p0; +}; + +module.exports = Linear; + + +/***/ }), +/* 130 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// 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 () +{ + /** + * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. + * + * @function Phaser.Display.Canvas.Smoothing.getPrefix + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. + * + * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. + */ + var getPrefix = function (context) + { + var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + + for (var i = 0; i < vendors.length; i++) + { + var s = vendors[i] + 'mageSmoothingEnabled'; + + if (s in context) + { + return s; + } + } + + return null; + }; + + /** + * 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 + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var enable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = true; + } + + return context; + }; + + /** + * 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 + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var disable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = false; + } + + return context; + }; + + /** + * 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 + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. + * + * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. + */ + var isEnabled = function (context) + { + return (prefix !== null) ? context[prefix] : null; + }; + + return { + disable: disable, + enable: enable, + getPrefix: getPrefix, + isEnabled: isEnabled + }; + +}; + +module.exports = Smoothing(); + + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(13); +var DegToRad = __webpack_require__(34); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(40); +var Rectangle = __webpack_require__(10); +var TransformMatrix = __webpack_require__(41); +var ValueToColor = __webpack_require__(192); +var Vector2 = __webpack_require__(3); + +/** + * @typedef {object} JSONCameraBounds + * @property {number} x - The horizontal position of camera + * @property {number} y - The vertical position of camera + * @property {number} width - The width size of camera + * @property {number} height - The height size of camera + */ + +/** + * @typedef {object} JSONCamera + * + * @property {string} name - The name of the camera + * @property {number} x - The horizontal position of camera + * @property {number} y - The vertical position of camera + * @property {number} width - The width size of camera + * @property {number} height - The height size of camera + * @property {number} zoom - The zoom of camera + * @property {number} rotation - The rotation of camera + * @property {boolean} roundPixels - The round pixels st status of camera + * @property {number} scrollX - The horizontal scroll of camera + * @property {number} scrollY - The vertical scroll of camera + * @property {string} backgroundColor - The background color of camera + * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera + */ + +/** + * @classdesc + * A Base Camera class. + * + * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, + * and can be positioned, rotated, zoomed and scrolled accordingly. + * + * A Camera consists of two elements: The viewport and the scroll values. + * + * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are + * created the same size as your game, but their position and size can be set to anything. This means if you + * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, + * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). + * + * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this + * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the + * viewport, and changing the viewport has no impact on the scrolling. + * + * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, + * allowing you to filter Game Objects out on a per-Camera basis. + * + * The Base Camera is extended by the Camera class, which adds in special effects including Fade, + * Flash and Camera Shake, as well as the ability to follow Game Objects. + * + * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow + * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate + * to when they were added to the Camera class. + * + * @class BaseCamera + * @memberof Phaser.Cameras.Scene2D + * @constructor + * @since 3.12.0 + * + * @extends Phaser.Events.EventEmitter + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.Visible + * + * @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 BaseCamera = new Class({ + + Extends: EventEmitter, + + Mixins: [ + Components.Alpha, + Components.Visible + ], + + initialize: + + function BaseCamera (x, y, width, height) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 0; } + if (height === undefined) { height = 0; } + + EventEmitter.call(this); + + /** + * A reference to the Scene this camera belongs to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene; + + /** + * A reference to the Game Scene Manager. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @since 3.12.0 + */ + this.sceneManager; + + /** + * A reference to the Game Scale Manager. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scaleManager; + + /** + * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. + * This value is a bitmask. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#id + * @type {integer} + * @readonly + * @since 3.11.0 + */ + this.id = 0; + + /** + * The name of the Camera. This is left empty for your own use. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; + + /** + * This property is un-used in v3.16. + * + * The resolution of the Game, used in most Camera calculations. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#resolution + * @type {number} + * @readonly + * @deprecated + * @since 3.12.0 + */ + this.resolution = 1; + + /** + * Should this camera round its pixel values to integers? + * + * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.roundPixels = false; + + /** + * Is this Camera visible or not? + * + * A visible camera will render and perform input tests. + * An invisible camera will not render anything and will skip input tests. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#visible + * @type {boolean} + * @default true + * @since 3.10.0 + */ + + /** + * Is this Camera using a bounds to restrict scrolling movement? + * + * Set this property along with the bounds via `Camera.setBounds`. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.useBounds = false; + + /** + * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at. + * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. + * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. + * You can use it for culling or intersection checks. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#worldView + * @type {Phaser.Geom.Rectangle} + * @readonly + * @since 3.11.0 + */ + this.worldView = new Rectangle(); + + /** + * Is this Camera dirty? + * + * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. + * + * This flag is cleared during the `postRenderCamera` method of the renderer. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#dirty + * @type {boolean} + * @default true + * @since 3.11.0 + */ + this.dirty = true; + + /** + * The x position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollX` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#x + * @type {number} + * @private + * @since 3.0.0 + */ + this._x = x; + + /** + * The y position of the Camera, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollY` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#y + * @type {number} + * @private + * @since 3.0.0 + */ + this._y = y; + + /** + * Internal Camera X value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_cx + * @type {number} + * @private + * @since 3.12.0 + */ + this._cx = 0; + + /** + * Internal Camera Y value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_cy + * @type {number} + * @private + * @since 3.12.0 + */ + this._cy = 0; + + /** + * Internal Camera Width value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_cw + * @type {number} + * @private + * @since 3.12.0 + */ + this._cw = 0; + + /** + * Internal Camera Height value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_ch + * @type {number} + * @private + * @since 3.12.0 + */ + this._ch = 0; + + /** + * The width of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_width + * @type {number} + * @private + * @since 3.11.0 + */ + this._width = width; + + /** + * The height of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_height + * @type {number} + * @private + * @since 3.11.0 + */ + this._height = height; + + /** + * The bounds the camera is restrained to during scrolling. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.0.0 + */ + this._bounds = new Rectangle(); + + /** + * The horizontal scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._scrollX = 0; + + /** + * The vertical scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._scrollY = 0; + + /** + * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom + * @type {number} + * @private + * @default 1 + * @since 3.11.0 + */ + this._zoom = 1; + + /** + * The rotation of the Camera in radians. + * + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._rotation = 0; + + /** + * A local transform matrix used for internal calculations. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#matrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.0.0 + */ + this.matrix = new TransformMatrix(); + + /** + * Does this Camera have a transparent background? + * + * @name Phaser.Cameras.Scene2D.BaseCamera#transparent + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.transparent = true; + + /** + * The background color of this Camera. Only used if `transparent` is `false`. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor + * @type {Phaser.Display.Color} + * @since 3.0.0 + */ + this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); + + /** + * The Camera alpha value. Setting this property impacts every single object that this Camera + * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out, + * or via the chainable `setAlpha` method instead. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#alpha + * @type {number} + * @default 1 + * @since 3.11.0 + */ + + /** + * Should the camera cull Game Objects before checking them for input hit tests? + * In some special cases it may be beneficial to disable this. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.disableCull = false; + + /** + * A temporary array of culled objects. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects + * @type {Phaser.GameObjects.GameObject[]} + * @default [] + * @private + * @since 3.0.0 + */ + this.culledObjects = []; + + /** + * The mid-point of the Camera in 'world' coordinates. + * + * Use it to obtain exactly where in the world the center of the camera is currently looking. + * + * This value is updated in the preRender method, after the scroll values and follower + * have been processed. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.11.0 + */ + this.midPoint = new Vector2(width / 2, height / 2); + + /** + * The horizontal origin of rotation for this Camera. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * See `setOrigin` to set both origins in a single, chainable call. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#originX + * @type {number} + * @default 0.5 + * @since 3.11.0 + */ + this.originX = 0.5; + + /** + * The vertical origin of rotation for this Camera. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * See `setOrigin` to set both origins in a single, chainable call. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#originY + * @type {number} + * @default 0.5 + * @since 3.11.0 + */ + this.originY = 0.5; + + /** + * Does this Camera have a custom viewport? + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport + * @type {boolean} + * @private + * @default false + * @since 3.12.0 + */ + this._customViewport = false; + }, + + /** + * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha + * @since 3.11.0 + * + * @param {number} [value=1] - The Camera alpha value. + * + * @return {this} This Camera instance. + */ + + /** + * Sets the rotation origin of this Camera. + * + * The values are given in the range 0 to 1 and are only used when calculating Camera rotation. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin + * @since 3.11.0 + * + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {this} This Camera instance. + */ + setOrigin: function (x, y) + { + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } + + this.originX = x; + this.originY = y; + + return this; + }, + + /** + * Calculates what the Camera.scrollX and scrollY values would need to be in order to move + * the Camera so it is centered on the given x and y coordinates, without actually moving + * the Camera there. The results are clamped based on the Camera bounds, if set. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll + * @since 3.11.0 + * + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. + * @param {Phaser.Math.Vector2} [out] - A Vec2 to store the values in. If not given a new Vec2 is created. + * + * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` and `y` properties. + */ + getScroll: function (x, y, out) + { + if (out === undefined) { out = new Vector2(); } + + var originX = this.width * 0.5; + var originY = this.height * 0.5; + + out.x = x - originX; + out.y = y - originY; + + if (this.useBounds) + { + out.x = this.clampX(out.x); + out.y = this.clampY(out.y); + } + + return out; + }, + + /** + * Moves the Camera horizontally so that it is centered on the given x coordinate, bounds allowing. + * Calling this does not change the scrollY value. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX + * @since 3.16.0 + * + * @param {number} x - The horizontal coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOnX: function (x) + { + var originX = this.width * 0.5; + + this.midPoint.x = x; + + this.scrollX = x - originX; + + if (this.useBounds) + { + this.scrollX = this.clampX(this.scrollX); + } + + return this; + }, + + /** + * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing. + * Calling this does not change the scrollX value. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY + * @since 3.16.0 + * + * @param {number} y - The vertical coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOnY: function (y) + { + var originY = this.height * 0.5; + + this.midPoint.y = y; + + this.scrollY = y - originY; + + if (this.useBounds) + { + this.scrollY = this.clampY(this.scrollY); + } + + return this; + }, + + /** + * Moves the Camera so that it is centered on the given coordinates, bounds allowing. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn + * @since 3.11.0 + * + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOn: function (x, y) + { + this.centerOnX(x); + this.centerOnY(y); + + return this; + }, + + /** + * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerToBounds: function () + { + if (this.useBounds) + { + var bounds = this._bounds; + var originX = this.width * 0.5; + var originY = this.height * 0.5; + + this.midPoint.set(bounds.centerX, bounds.centerY); + + this.scrollX = bounds.centerX - originX; + this.scrollY = bounds.centerY - originY; + } + + return this; + }, + + /** + * Moves the Camera so that it is re-centered based on its viewport size. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerToSize: function () + { + this.scrollX = this.width * 0.5; + this.scrollY = this.height * 0.5; + + return this; + }, + + /** + * Takes an array of Game Objects and returns a new array featuring only those objects + * visible by this camera. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#cull + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return] + * + * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull. + * + * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera. + */ + cull: function (renderableObjects) + { + if (this.disableCull) + { + return renderableObjects; + } + + 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 renderableObjects; + } + + 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 culledObjects = this.culledObjects; + var length = renderableObjects.length; + + determinant = 1 / determinant; + + culledObjects.length = 0; + + for (var index = 0; index < length; ++index) + { + var object = renderableObjects[index]; + + if (!object.hasOwnProperty('width') || object.parentContainer) + { + culledObjects.push(object); + continue; + } + + 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 cullTop = this.y; + var cullBottom = cullTop + cameraH; + var cullLeft = this.x; + var cullRight = cullLeft + cameraW; + + if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom)) + { + culledObjects.push(object); + } + } + + return culledObjects; + }, + + /** + * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform. + * You can optionally provide a Vector2, or similar object, to store the results in. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [output,$return] + * + * @param {number} x - The x position to convert to world space. + * @param {number} y - The y position to convert to world space. + * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties. + */ + getWorldPoint: function (x, y, output) + { + 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]; + + // Invert Matrix + var determinant = (mva * mvd) - (mvb * mvc); + + if (!determinant) + { + output.x = x; + output.y = y; + + return output; + } + + 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 res = this.resolution; + + var scrollX = this.scrollX; + var scrollY = this.scrollY; + + // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks + var sx = x + ((scrollX * c - scrollY * s) * zoom); + var sy = y + ((scrollX * s + scrollY * c) * zoom); + + // Apply transform to point + output.x = (sx * ima + sy * imc) * res + ime; + output.y = (sx * imb + sy * imd) * res + imf; + + return output; + }, + + /** + * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings + * so that they are ignored by this Camera. This means they will not be rendered by this Camera. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#ignore + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group)} entries - The Game Object, or array of Game Objects, to be ignored by this Camera. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + ignore: function (entries) + { + var id = this.id; + + if (!Array.isArray(entries)) + { + entries = [ entries ]; + } + + for (var i = 0; i < entries.length; i++) + { + var entry = entries[i]; + + if (Array.isArray(entry)) + { + this.ignore(entry); + } + else if (entry.isParent) + { + this.ignore(entry.getChildren()); + } + else + { + entry.cameraFilter |= id; + } + } + + return this; + }, + + /** + * Internal preRender step. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#preRender + * @protected + * @since 3.0.0 + * + * @param {number} resolution - The game resolution, as set in the Scale Manager. + */ + preRender: function (resolution) + { + var width = this.width; + var height = this.height; + + var halfWidth = width * 0.5; + var halfHeight = height * 0.5; + + var zoom = this.zoom * resolution; + var matrix = this.matrix; + + var originX = width * this.originX; + var originY = height * this.originY; + + var sx = this.scrollX; + var sy = this.scrollY; + + if (this.useBounds) + { + sx = this.clampX(sx); + sy = this.clampY(sy); + } + + if (this.roundPixels) + { + originX = Math.round(originX); + originY = Math.round(originY); + } + + // Values are in pixels and not impacted by zooming the Camera + this.scrollX = sx; + this.scrollY = sy; + + var midX = sx + halfWidth; + var midY = sy + halfHeight; + + // The center of the camera, in world space, so taking zoom into account + // Basically the pixel value of what it's looking at in the middle of the cam + this.midPoint.set(midX, midY); + + var displayWidth = width / zoom; + var displayHeight = height / zoom; + + this.worldView.setTo( + midX - (displayWidth / 2), + midY - (displayHeight / 2), + displayWidth, + displayHeight + ); + + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); + matrix.translate(-originX, -originY); + }, + + /** + * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required. + * Do not call this method if you are not using camera bounds. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#clampX + * @since 3.11.0 + * + * @param {number} x - The value to horizontally scroll clamp. + * + * @return {number} The adjusted value to use as scrollX. + */ + clampX: function (x) + { + var bounds = this._bounds; + + var dw = this.displayWidth; + + var bx = bounds.x + ((dw - this.width) / 2); + var bw = Math.max(bx, bx + bounds.width - dw); + + if (x < bx) + { + x = bx; + } + else if (x > bw) + { + x = bw; + } + + return x; + }, + + /** + * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required. + * Do not call this method if you are not using camera bounds. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#clampY + * @since 3.11.0 + * + * @param {number} y - The value to vertically scroll clamp. + * + * @return {number} The adjusted value to use as scrollY. + */ + clampY: function (y) + { + var bounds = this._bounds; + + var dh = this.displayHeight; + + var by = bounds.y + ((dh - this.height) / 2); + var bh = Math.max(by, by + bounds.height - dh); + + if (y < by) + { + y = by; + } + else if (y > bh) + { + y = bh; + } + + return y; + }, + + /* + var gap = this._zoomInversed; + return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap); + */ + + /** + * If this Camera has previously had movement bounds set on it, this will remove them. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + removeBounds: function () + { + this.useBounds = false; + + this.dirty = true; + + this._bounds.setEmpty(); + + return this; + }, + + /** + * Set the rotation of this Camera. This causes everything it renders to appear rotated. + * + * Rotating a camera does not rotate the viewport itself, it is applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle + * @since 3.0.0 + * + * @param {number} [value=0] - The cameras angle of rotation, given in degrees. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setAngle: function (value) + { + if (value === undefined) { value = 0; } + + this.rotation = DegToRad(value); + + return this; + }, + + /** + * Sets the background color for this Camera. + * + * By default a Camera has a transparent background but it can be given a solid color, with any level + * of transparency, via this method. + * + * The color value can be specified using CSS color notation, hex or numbers. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor + * @since 3.0.0 + * + * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setBackgroundColor: function (color) + { + if (color === undefined) { color = 'rgba(0,0,0,0)'; } + + this.backgroundColor = ValueToColor(color); + + this.transparent = (this.backgroundColor.alpha === 0); + + return this; + }, + + /** + * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. + * + * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the + * edges and into blank space. It does not limit the placement of Game Objects, or where + * the Camera viewport can be positioned. + * + * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. + * + * Clear the bounds entirely by calling `Camera.removeBounds`. + * + * If you set bounds that are smaller than the viewport it will stop the Camera from being + * able to scroll. The bounds can be positioned where-ever you wish. By default they are from + * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of + * the Camera bounds. However, you can position them anywhere. So if you wanted a game world + * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y + * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find + * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds + * @since 3.0.0 + * + * @param {integer} x - The top-left x coordinate of the bounds. + * @param {integer} y - The top-left y coordinate of the bounds. + * @param {integer} width - The width of the bounds, in pixels. + * @param {integer} height - The height of the bounds, in pixels. + * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setBounds: function (x, y, width, height, centerOn) + { + if (centerOn === undefined) { centerOn = false; } + + this._bounds.setTo(x, y, width, height); + + this.dirty = true; + this.useBounds = true; + + if (centerOn) + { + this.centerToBounds(); + } + else + { + this.scrollX = this.clampX(this.scrollX); + this.scrollY = this.clampY(this.scrollY); + } + + return this; + }, + + /** + * Returns a rectangle containing the bounds of the Camera. + * + * If the Camera does not have any bounds the rectangle will be empty. + * + * The rectangle is a copy of the bounds, so is safe to modify. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds + * @since 3.16.0 + * + * @param {Phaser.Geom.Rectangle} [out] - An optional Rectangle to store the bounds in. If not given, a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the bounds of this Camera. + */ + getBounds: function (out) + { + if (out === undefined) { out = new Rectangle(); } + + var source = this._bounds; + + out.setTo(source.x, source.y, source.width, source.height); + + return out; + }, + + /** + * Sets the name of this Camera. + * This value is for your own use and isn't used internally. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setName + * @since 3.0.0 + * + * @param {string} [value=''] - The name of the Camera. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setName: function (value) + { + if (value === undefined) { value = ''; } + + this.name = value; + + return this; + }, + + /** + * Set the position of the Camera viewport within the game. + * + * This does not change where the camera is 'looking'. See `setScroll` to control that. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition + * @since 3.0.0 + * + * @param {number} x - The top-left x coordinate of the Camera viewport. + * @param {number} [y=x] - The top-left y coordinate of the Camera viewport. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setPosition: function (x, y) + { + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; + + return this; + }, + + /** + * Set the rotation of this Camera. This causes everything it renders to appear rotated. + * + * Rotating a camera does not rotate the viewport itself, it is applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation + * @since 3.0.0 + * + * @param {number} [value=0] - The rotation of the Camera, in radians. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setRotation: function (value) + { + if (value === undefined) { value = 0; } + + this.rotation = value; + + return this; + }, + + /** + * Should the Camera round pixel values to whole integers when rendering Game Objects? + * + * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels + * @since 3.0.0 + * + * @param {boolean} value - `true` to round Camera pixels, `false` to not. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setRoundPixels: function (value) + { + this.roundPixels = value; + + return this; + }, + + /** + * Sets the Scene the Camera is bound to. + * + * Also populates the `resolution` property and updates the internal size values. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setScene + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene the camera is bound to. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setScene: function (scene) + { + if (this.scene && this._customViewport) + { + this.sceneManager.customViewports--; + } + + this.scene = scene; + + this.sceneManager = scene.sys.game.scene; + this.scaleManager = scene.sys.scale; + + var res = this.scaleManager.resolution; + + this.resolution = res; + + this._cx = this._x * res; + this._cy = this._y * res; + this._cw = this._width * res; + this._ch = this._height * res; + + this.updateSystem(); + + return this; + }, + + /** + * Set the position of where the Camera is looking within the game. + * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly. + * Use this method, or the scroll properties, to move your camera around the game world. + * + * This does not change where the camera viewport is placed. See `setPosition` to control that. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll + * @since 3.0.0 + * + * @param {number} x - The x coordinate of the Camera in the game world. + * @param {number} [y=x] - The y coordinate of the Camera in the game world. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setScroll: function (x, y) + { + if (y === undefined) { y = x; } + + this.scrollX = x; + this.scrollY = y; + + return this; + }, + + /** + * Set the size of the Camera viewport. + * + * By default a Camera is the same size as the game, but can be made smaller via this method, + * allowing you to create mini-cam style effects by creating and positioning a smaller Camera + * viewport within your game. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setSize + * @since 3.0.0 + * + * @param {integer} width - The width of the Camera viewport. + * @param {integer} [height=width] - The height of the Camera viewport. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setSize: function (width, height) + { + if (height === undefined) { height = width; } + + this.width = width; + this.height = height; + + return this; + }, + + /** + * This method sets the position and size of the Camera viewport in a single call. + * + * If you're trying to change where the Camera is looking at in your game, then see + * the method `Camera.setScroll` instead. This method is for changing the viewport + * itself, not what the camera can see. + * + * By default a Camera is the same size as the game, but can be made smaller via this method, + * allowing you to create mini-cam style effects by creating and positioning a smaller Camera + * viewport within your game. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport + * @since 3.0.0 + * + * @param {number} x - The top-left x coordinate of the Camera viewport. + * @param {number} y - The top-left y coordinate of the Camera viewport. + * @param {integer} width - The width of the Camera viewport. + * @param {integer} [height=width] - The height of the Camera viewport. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setViewport: function (x, y, width, height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + return this; + }, + + /** + * Set the zoom value of the Camera. + * + * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. + * Changing to a larger value, such as 2, will cause the camera to 'zoom in'. + * + * A value of 1 means 'no zoom' and is the default. + * + * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom + * @since 3.0.0 + * + * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setZoom: function (value) + { + if (value === undefined) { value = 1; } + + if (value === 0) + { + value = 0.001; + } + + this.zoom = value; + + return this; + }, + + /** + * Sets the visibility of this Camera. + * + * An invisible Camera will skip rendering and input tests of everything it can see. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible + * @since 3.10.0 + * + * @param {boolean} value - The visible state of the Camera. + * + * @return {this} This Camera instance. + */ + + /** + * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON + * @since 3.0.0 + * + * @return {JSONCamera} A well-formed object suitable for conversion to JSON. + */ + toJSON: function () + { + 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 + }; + } + + return output; + }, + + /** + * Internal method called automatically by the Camera Manager. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#update + * @protected + * @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, in ms, elapsed since the last frame. + */ + update: function () + { + // NOOP + }, + + /** + * Internal method called automatically when the viewport changes. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem + * @private + * @since 3.12.0 + */ + updateSystem: function () + { + if (!this.scaleManager) + { + return; + } + + var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.height !== this._height); + + var sceneManager = this.sceneManager; + + if (custom && !this._customViewport) + { + // We need a custom viewport for this Camera + sceneManager.customViewports++; + } + else if (!custom && this._customViewport) + { + // We're turning off a custom viewport for this Camera + sceneManager.customViewports--; + } + + this.dirty = true; + this._customViewport = custom; + }, + + /** + * Destroys this Camera instance and its internal properties and references. + * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. + * + * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. + * + * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, + * rather than calling this method directly. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#destroy + * @fires Phaser.Cameras.Scene2D.Events#DESTROY + * @since 3.0.0 + */ + destroy: function () + { + this.emit(Events.DESTROY, this); + + this.removeAllListeners(); + + this.matrix.destroy(); + + this.culledObjects = []; + + if (this._customViewport) + { + // We're turning off a custom viewport for this Camera + this.sceneManager.customViewports--; + } + + this._bounds = null; + + this.scene = null; + this.scaleManager = null; + this.sceneManager = null; + }, + + /** + * The x position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollX` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this._x; + }, + + set: function (value) + { + this._x = value; + this._cx = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The y position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollY` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this._y; + }, + + set: function (value) + { + this._y = value; + this._cy = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The width of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#width + * @type {number} + * @since 3.0.0 + */ + width: { + + get: function () + { + return this._width; + }, + + set: function (value) + { + this._width = value; + this._cw = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The height of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#height + * @type {number} + * @since 3.0.0 + */ + height: { + + get: function () + { + return this._height; + }, + + set: function (value) + { + this._height = value; + this._ch = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The horizontal scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + scrollX: { + + get: function () + { + return this._scrollX; + }, + + set: function (value) + { + this._scrollX = value; + this.dirty = true; + } + + }, + + /** + * The vertical scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + scrollY: { + + get: function () + { + return this._scrollY; + }, + + set: function (value) + { + this._scrollY = value; + this.dirty = true; + } + + }, + + /** + * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoom + * @type {number} + * @default 1 + * @since 3.0.0 + */ + zoom: { + + get: function () + { + return this._zoom; + }, + + set: function (value) + { + this._zoom = value; + this.dirty = true; + } + + }, + + /** + * The rotation of the Camera in radians. + * + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#rotation + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + rotation: { + + get: function () + { + return this._rotation; + }, + + set: function (value) + { + this._rotation = value; + this.dirty = true; + } + + }, + + /** + * The horizontal position of the center of the Camera's viewport, relative to the left of the game canvas. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#centerX + * @type {number} + * @readonly + * @since 3.10.0 + */ + centerX: { + + get: function () + { + return this.x + (0.5 * this.width); + } + + }, + + /** + * The vertical position of the center of the Camera's viewport, relative to the top of the game canvas. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#centerY + * @type {number} + * @readonly + * @since 3.10.0 + */ + centerY: { + + get: function () + { + return this.y + (0.5 * this.height); + } + + }, + + /** + * The displayed width of the camera viewport, factoring in the camera zoom level. + * + * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width + * would be 1600, as it's displaying twice as many pixels as zoom level 1. + * + * Equally, a camera with a width of 800 and zoom of 2 would have a display width + * of 400 pixels. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth + * @type {number} + * @readonly + * @since 3.11.0 + */ + displayWidth: { + + get: function () + { + return this.width / this.zoom; + } + + }, + + /** + * The displayed height of the camera viewport, factoring in the camera zoom level. + * + * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height + * would be 1200, as it's displaying twice as many pixels as zoom level 1. + * + * Equally, a camera with a height of 600 and zoom of 2 would have a display height + * of 300 pixels. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight + * @type {number} + * @readonly + * @since 3.11.0 + */ + displayHeight: { + + get: function () + { + return this.height / this.zoom; + } + + } + +}); + +module.exports = BaseCamera; + + +/***/ }), +/* 132 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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--) + { + var j = Math.floor(Math.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + + return array; +}; + +module.exports = Shuffle; + + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { DESTROY: __webpack_require__(1234) }; + + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var Events = __webpack_require__(420); + +/** + * @callback DataEachCallback + * + * @param {*} parent - The parent object of the DataManager. + * @param {string} key - The key of the value. + * @param {*} value - The value. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. + */ + +/** + * @classdesc + * The Data Manager 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 {object} parent - The object that this DataManager belongs to. + * @param {Phaser.Events.EventEmitter} eventEmitter - The DataManager's event emitter. + */ +var DataManager = new Class({ + + initialize: + + function DataManager (parent, eventEmitter) + { + /** + * The object that this DataManager belongs to. + * + * @name Phaser.Data.DataManager#parent + * @type {*} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * The DataManager's event emitter. + * + * @name Phaser.Data.DataManager#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events = eventEmitter; + + if (!eventEmitter) + { + this.events = (parent.events) ? parent.events : parent; + } + + /** + * The data list. + * + * @name Phaser.Data.DataManager#list + * @type {Object.} + * @default {} + * @since 3.0.0 + */ + this.list = {}; + + /** + * The public values list. You can use this to access anything you have stored + * in this Data Manager. For example, if you set a value called `gold` you can + * access it via: + * + * ```javascript + * this.data.values.gold; + * ``` + * + * You can also modify it directly: + * + * ```javascript + * this.data.values.gold += 1000; + * ``` + * + * Doing so will emit a `setdata` event from the parent of this Data Manager. + * + * Do not modify this object directly. Adding properties directly to this object will not + * emit any events. Always use `DataManager.set` to create new items the first time around. + * + * @name Phaser.Data.DataManager#values + * @type {Object.} + * @default {} + * @since 3.10.0 + */ + this.values = {}; + + /** + * Whether setting data is frozen for this DataManager. + * + * @name Phaser.Data.DataManager#_frozen + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._frozen = false; + + if (!parent.hasOwnProperty('sys') && this.events) + { + this.events.once('destroy', this.destroy, this); + } + }, + + /** + * Retrieves the value for the given key, or undefined if it doesn't exist. + * + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * + * ```javascript + * this.data.get('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * this.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * this.data.get([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.Data.DataManager#get + * @since 3.0.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + */ + get: function (key) + { + var list = this.list; + + if (Array.isArray(key)) + { + var output = []; + + for (var i = 0; i < key.length; i++) + { + output.push(list[key[i]]); + } + + return output; + } + else + { + return list[key]; + } + }, + + /** + * Retrieves all data values in a new object. + * + * @method Phaser.Data.DataManager#getAll + * @since 3.0.0 + * + * @return {Object.} All data values. + */ + getAll: function () + { + var results = {}; + + for (var key in this.list) + { + if (this.list.hasOwnProperty(key)) + { + results[key] = this.list[key]; + } + } + + return results; + }, + + /** + * Queries the DataManager for the values of keys matching the given regular expression. + * + * @method Phaser.Data.DataManager#query + * @since 3.0.0 + * + * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). + * + * @return {Object.} The values of the keys matching the search string. + */ + query: function (search) + { + var results = {}; + + for (var key in this.list) + { + if (this.list.hasOwnProperty(key) && key.match(search)) + { + results[key] = this.list[key]; + } + } + + return results; + }, + + /** + * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created. + * + * ```javascript + * data.set('name', 'Red Gem Stone'); + * ``` + * + * You can also pass in an object of key value pairs as the first argument: + * + * ```javascript + * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` + * + * To get a value back again you can call `get`: + * + * ```javascript + * data.get('gold'); + * ``` + * + * Or you can access the value directly via the `values` property, where it works like any other variable: + * + * ```javascript + * data.values.gold += 50; + * ``` + * + * When the value is first set, a `setdata` event is emitted. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.Data.DataManager#set + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.0.0 + * + * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. + * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + set: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (typeof key === 'string') + { + return this.setValue(key, data); + } + else + { + for (var entry in key) + { + this.setValue(entry, key[entry]); + } + } + + return this; + }, + + /** + * Internal value setter, called automatically by the `set` method. + * + * @method Phaser.Data.DataManager#setValue + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @private + * @since 3.10.0 + * + * @param {string} key - The key to set the value for. + * @param {*} data - The value to set. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + setValue: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (this.has(key)) + { + // Hit the key getter, which will in turn emit the events. + this.values[key] = data; + } + else + { + var _this = this; + var list = this.list; + var events = this.events; + var parent = this.parent; + + Object.defineProperty(this.values, key, { + + enumerable: true, + + configurable: true, + + get: function () + { + return list[key]; + }, + + set: function (value) + { + if (!_this._frozen) + { + var previousValue = list[key]; + list[key] = value; + + events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); + events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); + } + } + + }); + + list[key] = data; + + events.emit(Events.SET_DATA, parent, key, data); + } + + return this; + }, + + /** + * Passes all data entries to the given callback. + * + * @method Phaser.Data.DataManager#each + * @since 3.0.0 + * + * @param {DataEachCallback} callback - The function to call. + * @param {*} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + each: function (callback, context) + { + var args = [ this.parent, null, undefined ]; + + for (var i = 1; i < arguments.length; i++) + { + args.push(arguments[i]); + } + + for (var key in this.list) + { + args[1] = key; + args[2] = this.list[key]; + + callback.apply(context, args); + } + + return this; + }, + + /** + * Merge the given object of key value pairs into this DataManager. + * + * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument) + * will emit a `changedata` event. + * + * @method Phaser.Data.DataManager#merge + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.0.0 + * + * @param {Object.} data - The data to merge. + * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + merge: function (data, overwrite) + { + if (overwrite === undefined) { overwrite = true; } + + // Merge data from another component into this one + for (var key in data) + { + if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key)))) + { + this.setValue(key, data[key]); + } + } + + return this; + }, + + /** + * Remove the value for the given key. + * + * If the key is found in this Data Manager it is removed from the internal lists and a + * `removedata` event is emitted. + * + * You can also pass in an array of keys, in which case all keys in the array will be removed: + * + * ```javascript + * this.data.remove([ 'gold', 'armor', 'health' ]); + * ``` + * + * @method Phaser.Data.DataManager#remove + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {(string|string[])} key - The key to remove, or an array of keys to remove. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + remove: function (key) + { + if (this._frozen) + { + return this; + } + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + this.removeValue(key[i]); + } + } + else + { + return this.removeValue(key); + } + + return this; + }, + + /** + * Internal value remover, called automatically by the `remove` method. + * + * @method Phaser.Data.DataManager#removeValue + * @private + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.10.0 + * + * @param {string} key - The key to set the value for. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + removeValue: function (key) + { + if (this.has(key)) + { + var data = this.list[key]; + + delete this.list[key]; + delete this.values[key]; + + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); + } + + return this; + }, + + /** + * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. + * + * @method Phaser.Data.DataManager#pop + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {string} key - The key of the value to retrieve and delete. + * + * @return {*} The value of the given key. + */ + pop: function (key) + { + var data = undefined; + + if (!this._frozen && this.has(key)) + { + data = this.list[key]; + + delete this.list[key]; + delete this.values[key]; + + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); + } + + return data; + }, + + /** + * Determines whether the given key is set in this Data Manager. + * + * Please note that the keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.Data.DataManager#has + * @since 3.0.0 + * + * @param {string} key - The key to check. + * + * @return {boolean} Returns `true` if the key exists, otherwise `false`. + */ + has: function (key) + { + return this.list.hasOwnProperty(key); + }, + + /** + * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts + * to create new values or update existing ones. + * + * @method Phaser.Data.DataManager#setFreeze + * @since 3.0.0 + * + * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + setFreeze: function (value) + { + this._frozen = value; + + return this; + }, + + /** + * Delete all data in this Data Manager and unfreeze it. + * + * @method Phaser.Data.DataManager#reset + * @since 3.0.0 + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + reset: function () + { + for (var key in this.list) + { + delete this.list[key]; + delete this.values[key]; + } + + this._frozen = false; + + return this; + }, + + /** + * Destroy this data manager. + * + * @method Phaser.Data.DataManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.reset(); + + this.events.off(Events.CHANGE_DATA); + this.events.off(Events.SET_DATA); + this.events.off(Events.REMOVE_DATA); + + this.parent = null; + }, + + /** + * Gets or sets the frozen state of this Data Manager. + * A frozen Data Manager will block all attempts to create new values or update existing ones. + * + * @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; + } + + }, + + /** + * Return the total number of entries in this Data Manager. + * + * @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; + } + + } + +}); + +module.exports = DataManager; + + +/***/ }), +/* 135 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the perimeter of a Rectangle. + * + * @function Phaser.Geom.Rectangle.Perimeter + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to use. + * + * @return {number} The perimeter of the Rectangle, equal to `(width * 2) + (height * 2)`. + */ +var Perimeter = function (rect) +{ + return 2 * (rect.width + rect.height); +}; + +module.exports = Perimeter; + + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Animations.Events + */ + +module.exports = { + + ADD_ANIMATION: __webpack_require__(1266), + ANIMATION_COMPLETE: __webpack_require__(1265), + ANIMATION_REPEAT: __webpack_require__(1264), + ANIMATION_RESTART: __webpack_require__(1263), + ANIMATION_START: __webpack_require__(1262), + PAUSE_ALL: __webpack_require__(1261), + REMOVE_ANIMATION: __webpack_require__(1260), + RESUME_ALL: __webpack_require__(1259), + SPRITE_ANIMATION_COMPLETE: __webpack_require__(1258), + SPRITE_ANIMATION_KEY_COMPLETE: __webpack_require__(1257), + SPRITE_ANIMATION_KEY_REPEAT: __webpack_require__(1256), + SPRITE_ANIMATION_KEY_RESTART: __webpack_require__(1255), + SPRITE_ANIMATION_KEY_START: __webpack_require__(1254), + SPRITE_ANIMATION_KEY_UPDATE: __webpack_require__(1253), + SPRITE_ANIMATION_REPEAT: __webpack_require__(1252), + SPRITE_ANIMATION_RESTART: __webpack_require__(1251), + SPRITE_ANIMATION_START: __webpack_require__(1250), + SPRITE_ANIMATION_UPDATE: __webpack_require__(1249) + +}; + + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BlendModes = __webpack_require__(60); +var Circle = __webpack_require__(77); +var CircleContains = __webpack_require__(43); +var Class = __webpack_require__(0); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var Rectangle = __webpack_require__(10); +var RectangleContains = __webpack_require__(42); + +/** + * @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 - The Scene to which this Game Object belongs. + * @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. + * + * @name Phaser.GameObjects.Zone#blendMode + * @type {integer} + * @since 3.0.0 + */ + this.blendMode = BlendModes.NORMAL; + + this.updateDisplayOrigin(); + }, + + /** + * 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; + }, + + 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.Zone#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; + } + + }, + + /** + * Sets the size of this Game Object. + * + * @method Phaser.GameObjects.Zone#setSize + * @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. + * + * @return {Phaser.GameObjects.Zone} This Game Object. + */ + setSize: function (width, height, resizeInput) + { + if (resizeInput === undefined) { resizeInput = true; } + + this.width = width; + this.height = height; + + if (resizeInput && this.input && this.input.hitArea instanceof Rectangle) + { + this.input.hitArea.width = width; + this.input.hitArea.height = height; + } + + return this; + }, + + /** + * Sets the display size of this Game Object. + * Calling this will adjust the scale. + * + * @method Phaser.GameObjects.Zone#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.Zone} This Game Object. + */ + setDisplaySize: function (width, height) + { + this.displayWidth = width; + this.displayHeight = height; + + return this; + }, + + /** + * Sets this Zone to be a Circular Drop Zone. + * The circle is centered on this Zones `x` and `y` coordinates. + * + * @method Phaser.GameObjects.Zone#setCircleDropZone + * @since 3.0.0 + * + * @param {number} radius - The radius of the Circle that will form the Drop Zone. + * + * @return {Phaser.GameObjects.Zone} This Game Object. + */ + setCircleDropZone: function (radius) + { + return this.setDropZone(new Circle(0, 0, radius), CircleContains); + }, + + /** + * Sets this Zone to be a Rectangle Drop Zone. + * The rectangle is centered on this Zones `x` and `y` coordinates. + * + * @method Phaser.GameObjects.Zone#setRectangleDropZone + * @since 3.0.0 + * + * @param {number} width - The width of the rectangle drop zone. + * @param {number} height - The height of the rectangle drop zone. + * + * @return {Phaser.GameObjects.Zone} This Game Object. + */ + setRectangleDropZone: function (width, height) + { + return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains); + }, + + /** + * Allows you to define your own Geometry shape to be used as a Drop Zone. + * + * @method Phaser.GameObjects.Zone#setDropZone + * @since 3.0.0 + * + * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. + * @param {HitAreaCallback} 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. + */ + setDropZone: function (shape, callback) + { + if (shape === undefined) + { + this.setRectangleDropZone(this.width, this.height); + } + else if (!this.input) + { + this.setInteractive(shape, callback, true); + } + + return this; + }, + + /** + * A NOOP method so you can pass a Zone to a Container. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setAlpha + * @private + * @since 3.11.0 + */ + setAlpha: function () + { + }, + + /** + * A NOOP method so you can pass a Zone to a Container in Canvas. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setBlendMode + * @private + * @since 3.16.2 + */ + setBlendMode: function () + { + }, + + /** + * A Zone does not render. + * + * @method Phaser.GameObjects.Zone#renderCanvas + * @private + * @since 3.0.0 + */ + renderCanvas: function () + { + }, + + /** + * A Zone does not render. + * + * @method Phaser.GameObjects.Zone#renderWebGL + * @private + * @since 3.0.0 + */ + renderWebGL: function () + { + } + +}); + +module.exports = Zone; + + +/***/ }), +/* 138 */, +/* 139 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} TweenDataGenConfig + * + * @property {function} delay - Time in ms/frames before tween will start. + * @property {function} duration - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {function} hold - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {function} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {function} repeatDelay - Time in ms/frames before the repeat will start. + */ + +/** + * @typedef {object} Phaser.Tweens.TweenDataConfig + * + * @property {object} target - The target to tween. + * @property {string} key - The property of the target being tweened. + * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween. + * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween. + * @property {function} ease - The ease function this tween uses. + * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) + * @property {number} [delay=0] - Time in ms/frames before tween will start. + * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired. + * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start. + * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats + * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats + * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData. + * @property {number} [elapsed=0] - Delta counter + * @property {integer} [repeatCounter=0] - How many repeats are left to run? + * @property {number} [start=0] - Ease value data. + * @property {number} [current=0] - Ease value data. + * @property {number} [end=0] - Ease value data. + * @property {number} [t1=0] - Time duration 1. + * @property {number} [t2=0] - Time duration 2. + * @property {TweenDataGenConfig} [gen] - LoadValue generation functions. + * @property {integer} [state=0] - TWEEN_CONST.CREATED + */ + +/** + * Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween. + * + * This is an internal function used by the TweenBuilder and should not be accessed directly, instead, Tweens should be created using the GameObjectFactory or GameObjectCreator. + * + * @function Phaser.Tweens.TweenData + * @since 3.0.0 + * + * @param {object} target - The target to tween. + * @param {string} key - The property of the target to tween. + * @param {function} getEnd - What the property will be at the END of the Tween. + * @param {function} getStart - What the property will be at the START of the Tween. + * @param {function} ease - The ease function this tween uses. + * @param {number} delay - Time in ms/frames before tween will start. + * @param {number} duration - Duration of the tween in ms/frames. + * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. + * @param {number} hold - Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Time in ms/frames before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * + * @return {TweenDataConfig} The config object describing this TweenData. + */ +var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) +{ + return { + + // The target to tween + target: target, + + // The property of the target to tween + key: key, + + // The returned value sets what the property will be at the END of the Tween. + getEndValue: getEnd, + + // The returned value sets what the property will be at the START of the Tween. + getStartValue: getStart, + + // The ease function this tween uses. + ease: ease, + + // Duration of the tween in ms/frames, excludes time for yoyo or repeats. + duration: 0, + + // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) + totalDuration: 0, + + // Time in ms/frames before tween will start. + delay: 0, + + // Cause the tween to return back to its start value after hold has expired. + yoyo: yoyo, + + // Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + hold: 0, + + // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + repeat: 0, + + // Time in ms/frames before the repeat will start. + repeatDelay: 0, + + // Automatically call toggleFlipX when the TweenData yoyos or repeats + flipX: flipX, + + // Automatically call toggleFlipY when the TweenData yoyos or repeats + flipY: flipY, + + // Between 0 and 1 showing completion of this TweenData. + progress: 0, + + // Delta counter. + elapsed: 0, + + // How many repeats are left to run? + repeatCounter: 0, + + // Ease Value Data: + + start: 0, + current: 0, + end: 0, + + // Time Durations + t1: 0, + t2: 0, + + // LoadValue generation functions + gen: { + delay: delay, + duration: duration, + hold: hold, + repeat: repeat, + repeatDelay: repeatDelay + }, + + // TWEEN_CONST.CREATED + state: 0 + }; +}; + +module.exports = TweenData; + + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var GameObjectCreator = __webpack_require__(14); +var GameObjectFactory = __webpack_require__(5); +var TWEEN_CONST = __webpack_require__(89); + +/** + * @classdesc + * A Tween is able to manipulate the properties of one or more objects to any given value, based + * on a duration and type of ease. They are rarely instantiated directly and instead should be + * created via the TweenManager. + * + * @class Tween + * @memberof Phaser.Tweens + * @constructor + * @since 3.0.0 + * + * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - A reference to the parent of this Tween. Either the Tween Manager or a Tween Timeline instance. + * @param {Phaser.Tweens.TweenDataConfig[]} data - An array of TweenData objects, each containing a unique property to be tweened. + * @param {array} targets - An array of targets to be tweened. + */ +var Tween = new Class({ + + initialize: + + function Tween (parent, data, targets) + { + /** + * A reference to the parent of this Tween. + * Either the Tween Manager or a Tween Timeline instance. + * + * @name Phaser.Tweens.Tween#parent + * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * Is the parent of this Tween a Timeline? + * + * @name Phaser.Tweens.Tween#parentIsTimeline + * @type {boolean} + * @since 3.0.0 + */ + this.parentIsTimeline = parent.hasOwnProperty('isTimeline'); + + /** + * An array of TweenData objects, each containing a unique property and target being tweened. + * + * @name Phaser.Tweens.Tween#data + * @type {Phaser.Tweens.TweenDataConfig[]} + * @since 3.0.0 + */ + this.data = data; + + /** + * The cached length of the data array. + * + * @name Phaser.Tweens.Tween#totalData + * @type {integer} + * @since 3.0.0 + */ + this.totalData = data.length; + + /** + * An array of references to the target/s this Tween is operating on. + * + * @name Phaser.Tweens.Tween#targets + * @type {object[]} + * @since 3.0.0 + */ + this.targets = targets; + + /** + * Cached target total (not necessarily the same as the data total) + * + * @name Phaser.Tweens.Tween#totalTargets + * @type {integer} + * @since 3.0.0 + */ + this.totalTargets = targets.length; + + /** + * If `true` then duration, delay, etc values are all frame totals. + * + * @name Phaser.Tweens.Tween#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.Tween#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 element. + * + * @name Phaser.Tweens.Tween#loop + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.loop = 0; + + /** + * Time in ms/frames before the tween loops. + * + * @name Phaser.Tweens.Tween#loopDelay + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.loopDelay = 0; + + /** + * How many loops are left to run? + * + * @name Phaser.Tweens.Tween#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 = -1 (as it never completes) + * + * @name Phaser.Tweens.Tween#completeDelay + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.completeDelay = 0; + + /** + * Countdown timer (used by timeline offset, loopDelay and completeDelay) + * + * @name Phaser.Tweens.Tween#countdown + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.countdown = 0; + + /** + * Set only if this Tween is part of a Timeline. + * + * @name Phaser.Tweens.Tween#offset + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.offset = 0; + + /** + * Set only if this Tween is part of a Timeline. The calculated offset amount. + * + * @name Phaser.Tweens.Tween#calculatedOffset + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.calculatedOffset = 0; + + /** + * The current state of the tween + * + * @name Phaser.Tweens.Tween#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.Tween#_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.Tween#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.Tween#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.Tween#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.Tween#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.Tween#progress + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.progress = 0; + + /** + * Time in ms/frames for the Tween to complete (including looping) + * + * @name Phaser.Tweens.Tween#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.Tween#totalProgress + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.totalProgress = 0; + + /** + * An object containing the various Tween callback references. + * + * @name Phaser.Tweens.Tween#callbacks + * @type {object} + * @default 0 + * @since 3.0.0 + */ + this.callbacks = { + onComplete: null, + onLoop: null, + onRepeat: null, + onStart: null, + onUpdate: null, + onYoyo: null + }; + + this.callbackScope; + }, + + /** + * Returns the current value of the Tween. + * + * @method Phaser.Tweens.Tween#getValue + * @since 3.0.0 + * + * @return {number} The value of the Tween. + */ + getValue: function () + { + return this.data[0].current; + }, + + /** + * Set the scale 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. + * + * @method Phaser.Tweens.Tween#setTimeScale + * @since 3.0.0 + * + * @param {number} value - The scale factor for timescale. + * + * @return {this} - This Tween instance. + */ + setTimeScale: function (value) + { + this.timeScale = value; + + return this; + }, + + /** + * Returns the scale of the time applied to this Tween. + * + * @method Phaser.Tweens.Tween#getTimeScale + * @since 3.0.0 + * + * @return {number} The timescale of this tween (between 0 and 1) + */ + getTimeScale: function () + { + return this.timeScale; + }, + + /** + * Checks if the Tween is currently active. + * + * @method Phaser.Tweens.Tween#isPlaying + * @since 3.0.0 + * + * @return {boolean} `true` if the Tween is active, otherwise `false`. + */ + isPlaying: function () + { + return (this.state === TWEEN_CONST.ACTIVE); + }, + + /** + * Checks if the Tween is currently paused. + * + * @method Phaser.Tweens.Tween#isPaused + * @since 3.0.0 + * + * @return {boolean} `true` if the Tween is paused, otherwise `false`. + */ + isPaused: function () + { + return (this.state === TWEEN_CONST.PAUSED); + }, + + /** + * See if this Tween is currently acting upon the given target. + * + * @method Phaser.Tweens.Tween#hasTarget + * @since 3.0.0 + * + * @param {object} target - The target to check against this Tween. + * + * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`. + */ + hasTarget: function (target) + { + return (this.targets.indexOf(target) !== -1); + }, + + /** + * Updates the value of a property of this Tween to a new value, without adjusting the + * Tween duration or current progress. + * + * You can optionally tell it to set the 'start' value to be the current value (before the change). + * + * @method Phaser.Tweens.Tween#updateTo + * @since 3.0.0 + * + * @param {string} key - The property to set the new value for. + * @param {*} value - The new value of the property. + * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value? + * + * @return {this} - This Tween instance. + */ + updateTo: function (key, value, startToCurrent) + { + if (startToCurrent === undefined) { startToCurrent = false; } + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = this.data[i]; + + if (tweenData.key === key) + { + tweenData.end = value; + + if (startToCurrent) + { + tweenData.start = tweenData.current; + } + + break; + } + } + + return this; + }, + + /** + * Restarts the tween from the beginning. + * + * @method Phaser.Tweens.Tween#restart + * @since 3.0.0 + * + * @return {this} This Tween instance. + */ + restart: function () + { + if (this.state === TWEEN_CONST.REMOVED) + { + this.seek(0); + this.parent.makeActive(this); + } + else + { + this.stop(); + this.play(); + } + + return this; + }, + + /** + * Internal method that calculates the overall duration of the Tween. + * + * @method Phaser.Tweens.Tween#calcDuration + * @since 3.0.0 + */ + calcDuration: function () + { + var max = 0; + + var data = this.data; + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = data[i]; + + // Set t1 (duration + hold + yoyo) + tweenData.t1 = tweenData.duration + tweenData.hold; + + if (tweenData.yoyo) + { + tweenData.t1 += tweenData.duration; + } + + // Set t2 (repeatDelay + duration + hold + yoyo) + tweenData.t2 = tweenData.t1 + tweenData.repeatDelay; + + // Total Duration + tweenData.totalDuration = tweenData.delay + tweenData.t1; + + if (tweenData.repeat === -1) + { + tweenData.totalDuration += (tweenData.t2 * 999999999999); + } + else if (tweenData.repeat > 0) + { + tweenData.totalDuration += (tweenData.t2 * tweenData.repeat); + } + + if (tweenData.totalDuration > max) + { + // Get the longest TweenData from the Tween, used to calculate the Tween TD + max = tweenData.totalDuration; + } + } + + // Excludes loop values + this.duration = max; + + 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; + } + }, + + /** + * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens. + * Should not be called directly. + * + * @method Phaser.Tweens.Tween#init + * @since 3.0.0 + * + * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager. + */ + init: function () + { + var data = this.data; + var totalTargets = this.totalTargets; + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = data[i]; + var target = tweenData.target; + var gen = tweenData.gen; + + tweenData.delay = gen.delay(i, totalTargets, target); + tweenData.duration = gen.duration(i, totalTargets, target); + tweenData.hold = gen.hold(i, totalTargets, target); + tweenData.repeat = gen.repeat(i, totalTargets, target); + tweenData.repeatDelay = gen.repeatDelay(i, totalTargets, target); + } + + this.calcDuration(); + + this.progress = 0; + this.totalProgress = 0; + this.elapsed = 0; + this.totalElapsed = 0; + + // You can't have a paused Tween if it's part of a Timeline + if (this.paused && !this.parentIsTimeline) + { + this.state = TWEEN_CONST.PENDING_ADD; + this._pausedState = TWEEN_CONST.INIT; + + return false; + } + else + { + this.state = TWEEN_CONST.INIT; + + return true; + } + }, + + /** + * Internal method that advances to the next state of the Tween during playback. + * + * @method Phaser.Tweens.Tween#nextState + * @since 3.0.0 + */ + nextState: function () + { + if (this.loopCounter > 0) + { + this.elapsed = 0; + this.progress = 0; + this.loopCounter--; + + var onLoop = this.callbacks.onLoop; + + if (onLoop) + { + onLoop.params[1] = this.targets; + + onLoop.func.apply(onLoop.scope, onLoop.params); + } + + this.resetTweenData(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.params[1] = this.targets; + + onComplete.func.apply(onComplete.scope, onComplete.params); + } + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + }, + + /** + * Pauses the Tween immediately. Use `resume` to continue playback. + * + * @method Phaser.Tweens.Tween#pause + * @since 3.0.0 + * + * @return {this} - This Tween instance. + */ + pause: function () + { + if (this.state === TWEEN_CONST.PAUSED) + { + return; + } + + this.paused = true; + + this._pausedState = this.state; + + this.state = TWEEN_CONST.PAUSED; + + return this; + }, + + /** + * Starts a Tween playing. + * + * You only need to call this method if you have configured the tween to be paused on creation. + * + * @method Phaser.Tweens.Tween#play + * @since 3.0.0 + * + * @param {boolean} resetFromTimeline - Is this Tween being played as part of a Timeline? + * + * @return {this} This Tween instance. + */ + play: function (resetFromTimeline) + { + if (this.state === TWEEN_CONST.ACTIVE) + { + return this; + } + else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED) + { + this.init(); + this.parent.makeActive(this); + resetFromTimeline = true; + } + + var onStart = this.callbacks.onStart; + + if (this.parentIsTimeline) + { + this.resetTweenData(resetFromTimeline); + + if (this.calculatedOffset === 0) + { + if (onStart) + { + onStart.params[1] = this.targets; + + onStart.func.apply(onStart.scope, onStart.params); + } + + this.state = TWEEN_CONST.ACTIVE; + } + else + { + this.countdown = this.calculatedOffset; + + this.state = TWEEN_CONST.OFFSET_DELAY; + } + } + else if (this.paused) + { + this.paused = false; + + this.parent.makeActive(this); + } + else + { + this.resetTweenData(resetFromTimeline); + + this.state = TWEEN_CONST.ACTIVE; + + if (onStart) + { + onStart.params[1] = this.targets; + + onStart.func.apply(onStart.scope, onStart.params); + } + + this.parent.makeActive(this); + } + + return this; + }, + + /** + * Internal method that resets all of the Tween Data, including the progress and elapsed values. + * + * @method Phaser.Tweens.Tween#resetTweenData + * @since 3.0.0 + * + * @param {boolean} resetFromLoop - Has this method been called as part of a loop? + */ + resetTweenData: function (resetFromLoop) + { + var data = this.data; + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = data[i]; + + tweenData.progress = 0; + tweenData.elapsed = 0; + + tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat; + + if (resetFromLoop) + { + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.end); + + tweenData.current = tweenData.start; + + tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + } + else if (tweenData.delay > 0) + { + tweenData.elapsed = tweenData.delay; + tweenData.state = TWEEN_CONST.DELAY; + } + else + { + tweenData.state = TWEEN_CONST.PENDING_RENDER; + } + } + }, + + /** + * Resumes the playback of a previously paused Tween. + * + * @method Phaser.Tweens.Tween#resume + * @since 3.0.0 + * + * @return {this} - This Tween instance. + */ + resume: function () + { + if (this.state === TWEEN_CONST.PAUSED) + { + this.paused = false; + + this.state = this._pausedState; + } + else + { + this.play(); + } + + return this; + }, + + /** + * Attempts to seek to a specific position in a Tween. + * + * @method Phaser.Tweens.Tween#seek + * @since 3.0.0 + * + * @param {number} toPosition - A value between 0 and 1 which represents the progress point to seek to. + * + * @return {this} This Tween instance. + */ + seek: function (toPosition) + { + var data = this.data; + + for (var i = 0; i < this.totalData; i++) + { + // This won't work with loop > 0 yet + var ms = this.totalDuration * toPosition; + + var tweenData = data[i]; + var progress = 0; + var elapsed = 0; + + if (ms <= tweenData.delay) + { + progress = 0; + elapsed = 0; + } + else if (ms >= tweenData.totalDuration) + { + progress = 1; + elapsed = tweenData.duration; + } + else if (ms > tweenData.delay && ms <= tweenData.t1) + { + // Keep it zero bound + ms = Math.max(0, ms - tweenData.delay); + + // Somewhere in the first playthru range + progress = ms / tweenData.t1; + elapsed = tweenData.duration * progress; + } + else if (ms > tweenData.t1 && ms < tweenData.totalDuration) + { + // Somewhere in repeat land + ms -= tweenData.delay; + ms -= tweenData.t1; + + // var repeats = Math.floor(ms / tweenData.t2); + + // remainder + ms = ((ms / tweenData.t2) % 1) * tweenData.t2; + + if (ms > tweenData.repeatDelay) + { + progress = ms / tweenData.t1; + elapsed = tweenData.duration * progress; + } + } + + tweenData.progress = progress; + tweenData.elapsed = elapsed; + + var v = tweenData.ease(tweenData.progress); + + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + + tweenData.target[tweenData.key] = tweenData.current; + } + + return this; + }, + + /** + * Sets an event based callback to be invoked during playback. + * + * @method Phaser.Tweens.Tween#setCallback + * @since 3.0.0 + * + * @param {string} type - Type of the callback. + * @param {function} callback - Callback function. + * @param {array} [params] - An array of parameters for specified callbacks types. + * @param {object} [scope] - The context the callback will be invoked in. + * + * @return {this} This Tween instance. + */ + setCallback: function (type, callback, params, scope) + { + this.callbacks[type] = { func: callback, scope: scope, params: params }; + + 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. + * + * @return {this} This Tween instance. + */ + 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; + } + + return this; + }, + + /** + * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. + * + * @method Phaser.Tweens.Tween#stop + * @since 3.0.0 + * + * @param {number} [resetTo] - A value between 0 and 1. + * + * @return {this} This Tween instance. + */ + stop: function (resetTo) + { + if (this.state === TWEEN_CONST.ACTIVE) + { + if (resetTo !== undefined) + { + this.seek(resetTo); + } + } + + if (this.state !== TWEEN_CONST.REMOVED) + { + if (this.state === TWEEN_CONST.PAUSED || this.state === TWEEN_CONST.PENDING_ADD) + { + this.parent._destroy.push(this); + this.parent._toProcess++; + } + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + + return this; + }, + + /** + * Internal method that advances the Tween based on the time values. + * + * @method Phaser.Tweens.Tween#update + * @since 3.0.0 + * + * @param {number} timestamp - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * + * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. + */ + update: function (timestamp, delta) + { + if (this.state === TWEEN_CONST.PAUSED) + { + return false; + } + + if (this.useFrames) + { + delta = 1 * this.parent.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 = false; + + for (var i = 0; i < this.totalData; i++) + { + if (this.updateTweenData(this, this.data[i], delta)) + { + stillRunning = true; + } + } + + // Anything still running? If not, we're done + if (!stillRunning) + { + this.nextState(); + } + + break; + + case TWEEN_CONST.LOOP_DELAY: + + this.countdown -= delta; + + if (this.countdown <= 0) + { + this.state = TWEEN_CONST.ACTIVE; + } + + break; + + case TWEEN_CONST.OFFSET_DELAY: + + this.countdown -= delta; + + if (this.countdown <= 0) + { + var onStart = this.callbacks.onStart; + + if (onStart) + { + onStart.params[1] = this.targets; + + onStart.func.apply(onStart.scope, onStart.params); + } + + 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.state = TWEEN_CONST.PENDING_REMOVE; + } + + break; + } + + return (this.state === TWEEN_CONST.PENDING_REMOVE); + }, + + /** + * Internal method used as part of the playback process that sets a tween to play in reverse. + * + * @method Phaser.Tweens.Tween#setStateFromEnd + * @since 3.0.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + * + * @return {integer} The state of this Tween. + */ + setStateFromEnd: function (tween, tweenData, diff) + { + if (tweenData.yoyo) + { + // We've hit the end of a Playing Forward TweenData and we have a yoyo + + // Account for any extra time we got from the previous frame + tweenData.elapsed = diff; + tweenData.progress = diff / tweenData.duration; + + if (tweenData.flipX) + { + tweenData.target.toggleFlipX(); + } + + // Problem: The flip and callback and so on gets called for every TweenData that triggers it at the same time. + // If you're tweening several properties it can fire for all of them, at once. + + if (tweenData.flipY) + { + tweenData.target.toggleFlipY(); + } + + var onYoyo = tween.callbacks.onYoyo; + + if (onYoyo) + { + // Element 1 is reserved for the target of the yoyo (and needs setting here) + onYoyo.params[1] = tweenData.target; + + onYoyo.func.apply(onYoyo.scope, onYoyo.params); + } + + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); + + return TWEEN_CONST.PLAYING_BACKWARD; + } + else if (tweenData.repeatCounter > 0) + { + // We've hit the end of a Playing Forward TweenData and we have a Repeat. + // So we're going to go right back to the start to repeat it again. + + tweenData.repeatCounter--; + + // Account for any extra time we got from the previous frame + tweenData.elapsed = diff; + tweenData.progress = diff / tweenData.duration; + + if (tweenData.flipX) + { + tweenData.target.toggleFlipX(); + } + + if (tweenData.flipY) + { + tweenData.target.toggleFlipY(); + } + + var onRepeat = tween.callbacks.onRepeat; + + if (onRepeat) + { + // Element 1 is reserved for the target of the repeat (and needs setting here) + onRepeat.params[1] = tweenData.target; + + onRepeat.func.apply(onRepeat.scope, onRepeat.params); + } + + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); + + // Delay? + if (tweenData.repeatDelay > 0) + { + tweenData.elapsed = tweenData.repeatDelay - diff; + + tweenData.current = tweenData.start; + + tweenData.target[tweenData.key] = tweenData.current; + + return TWEEN_CONST.REPEAT_DELAY; + } + else + { + return TWEEN_CONST.PLAYING_FORWARD; + } + } + + return TWEEN_CONST.COMPLETE; + }, + + /** + * Internal method used as part of the playback process that sets a tween to play from the start. + * + * @method Phaser.Tweens.Tween#setStateFromStart + * @since 3.0.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + * + * @return {integer} The state of this Tween. + */ + setStateFromStart: function (tween, tweenData, diff) + { + if (tweenData.repeatCounter > 0) + { + tweenData.repeatCounter--; + + // Account for any extra time we got from the previous frame + tweenData.elapsed = diff; + tweenData.progress = diff / tweenData.duration; + + if (tweenData.flipX) + { + tweenData.target.toggleFlipX(); + } + + if (tweenData.flipY) + { + tweenData.target.toggleFlipY(); + } + + var onRepeat = tween.callbacks.onRepeat; + + if (onRepeat) + { + // Element 1 is reserved for the target of the repeat (and needs setting here) + onRepeat.params[1] = tweenData.target; + + onRepeat.func.apply(onRepeat.scope, onRepeat.params); + } + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); + + // Delay? + if (tweenData.repeatDelay > 0) + { + tweenData.elapsed = tweenData.repeatDelay - diff; + + tweenData.current = tweenData.start; + + tweenData.target[tweenData.key] = tweenData.current; + + return TWEEN_CONST.REPEAT_DELAY; + } + else + { + return TWEEN_CONST.PLAYING_FORWARD; + } + } + + return TWEEN_CONST.COMPLETE; + }, + + /** + * Internal method that advances the TweenData based on the time value given. + * + * @method Phaser.Tweens.Tween#updateTweenData + * @since 3.0.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true + * + * @return {boolean} [description] + */ + updateTweenData: function (tween, tweenData, delta) + { + switch (tweenData.state) + { + case TWEEN_CONST.PLAYING_FORWARD: + case TWEEN_CONST.PLAYING_BACKWARD: + + if (!tweenData.target) + { + tweenData.state = TWEEN_CONST.COMPLETE; + break; + } + + var elapsed = tweenData.elapsed; + var duration = tweenData.duration; + var diff = 0; + + elapsed += delta; + + if (elapsed > duration) + { + diff = elapsed - duration; + elapsed = duration; + } + + var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD); + var progress = elapsed / duration; + + var v; + + if (forward) + { + v = tweenData.ease(progress); + } + else + { + v = tweenData.ease(1 - progress); + } + + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + + tweenData.target[tweenData.key] = tweenData.current; + + tweenData.elapsed = elapsed; + tweenData.progress = progress; + + var onUpdate = tween.callbacks.onUpdate; + + if (onUpdate) + { + onUpdate.params[1] = tweenData.target; + + onUpdate.func.apply(onUpdate.scope, onUpdate.params); + } + + if (progress === 1) + { + if (forward) + { + if (tweenData.hold > 0) + { + tweenData.elapsed = tweenData.hold - diff; + + tweenData.state = TWEEN_CONST.HOLD_DELAY; + } + else + { + tweenData.state = this.setStateFromEnd(tween, tweenData, diff); + } + } + else + { + tweenData.state = this.setStateFromStart(tween, tweenData, diff); + } + } + + break; + + case TWEEN_CONST.DELAY: + + tweenData.elapsed -= delta; + + if (tweenData.elapsed <= 0) + { + tweenData.elapsed = Math.abs(tweenData.elapsed); + + tweenData.state = TWEEN_CONST.PENDING_RENDER; + } + + break; + + case TWEEN_CONST.REPEAT_DELAY: + + tweenData.elapsed -= delta; + + if (tweenData.elapsed <= 0) + { + tweenData.elapsed = Math.abs(tweenData.elapsed); + + tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + } + + break; + + case TWEEN_CONST.HOLD_DELAY: + + tweenData.elapsed -= delta; + + if (tweenData.elapsed <= 0) + { + tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed)); + } + + break; + + case TWEEN_CONST.PENDING_RENDER: + + if (tweenData.target) + { + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.target[tweenData.key]); + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); + + tweenData.current = tweenData.start; + + tweenData.target[tweenData.key] = tweenData.start; + + tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + } + else + { + tweenData.state = TWEEN_CONST.COMPLETE; + } + + break; + } + + // Return TRUE if this TweenData still playing, otherwise return FALSE + return (tweenData.state !== TWEEN_CONST.COMPLETE); + } + +}); + +Tween.TYPES = [ + 'onComplete', + 'onLoop', + 'onRepeat', + 'onStart', + 'onUpdate', + 'onYoyo' +]; + +/** + * Creates a new Tween object. + * + * Note: This method will only be available Tweens have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#tween + * @since 3.0.0 + * + * @param {object} config - The Tween configuration. + * + * @return {Phaser.Tweens.Tween} The Tween that was created. + */ +GameObjectFactory.register('tween', function (config) +{ + return this.scene.sys.tweens.add(config); +}); + +// 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 + +/** + * Creates a new Tween object and returns it. + * + * Note: This method will only be available if Tweens have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#tween + * @since 3.0.0 + * + * @param {object} config - The Tween configuration. + * + * @return {Phaser.Tweens.Tween} The Tween that was created. + */ +GameObjectCreator.register('tween', function (config) +{ + return this.scene.sys.tweens.create(config); +}); + +// When registering a factory function 'this' refers to the GameObjectCreator context. + +module.exports = Tween; + + +/***/ }), +/* 141 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Tweens.TweenConfigDefaults + * + * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. + * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. + * @property {number} [duration=1000] - The duration of the tween in milliseconds. + * @property {string} [ease='Power0'] - The easing equation to use for the tween. + * @property {array} [easeParams] - Optional easing parameters. + * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. + * @property {number} [repeat=0] - The number of times to repeat the tween. + * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. + * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. + * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. + * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. + */ + +var TWEEN_DEFAULTS = { + targets: null, + delay: 0, + duration: 1000, + ease: 'Power0', + easeParams: null, + hold: 0, + repeat: 0, + repeatDelay: 0, + yoyo: false, + flipX: false, + flipY: false +}; + +module.exports = TWEEN_DEFAULTS; + + +/***/ }), +/* 142 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +function hasGetStart (def) +{ + return (!!def.getStart && typeof def.getStart === 'function'); +} + +function hasGetEnd (def) +{ + return (!!def.getEnd && typeof def.getEnd === 'function'); +} + +function hasGetters (def) +{ + return hasGetStart(def) || hasGetEnd(def); +} + +/** + * Returns `getStart` and `getEnd` functions for a Tween's Data based on a target property and end value. + * + * If the end value is a number, it will be treated as an absolute value and the property will be tweened to it. A string can be provided to specify a relative end value which consists of an operation (`+=` to add to the current value, `-=` to subtract from the current value, `*=` to multiply the current value, or `/=` to divide the current value) followed by its operand. A function can be provided to allow greater control over the end value; it will receive the target object being tweened, the name of the property being tweened, and the current value of the property as its arguments. If both the starting and the ending values need to be controlled, an object with `getStart` and `getEnd` callbacks, which will receive the same arguments, can be provided instead. If an object with a `value` property is provided, the property will be used as the effective value under the same rules described here. + * + * @function Phaser.Tweens.Builders.GetValueOp + * @since 3.0.0 + * + * @param {string} key - The name of the property to modify. + * @param {*} propertyValue - The ending value of the property, as described above. + * + * @return {function} An array of two functions, `getStart` and `getEnd`, which return the starting and the ending value of the property based on the provided value. + */ +var GetValueOp = function (key, propertyValue) +{ + var callbacks; + + // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween) + var getEnd = function (target, key, value) { return value; }; + + // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween) + var getStart = function (target, key, value) { return value; }; + + var t = typeof(propertyValue); + + if (t === 'number') + { + // props: { + // x: 400, + // y: 300 + // } + + getEnd = function () + { + return propertyValue; + }; + } + else if (t === 'string') + { + // props: { + // x: '+=400', + // y: '-=300', + // z: '*=2', + // w: '/=2' + // } + + var op = propertyValue[0]; + var num = parseFloat(propertyValue.substr(2)); + + switch (op) + { + case '+': + getEnd = function (target, key, value) + { + return value + num; + }; + break; + + case '-': + getEnd = function (target, key, value) + { + return value - num; + }; + break; + + case '*': + getEnd = function (target, key, value) + { + return value * num; + }; + break; + + case '/': + getEnd = function (target, key, value) + { + return value / num; + }; + break; + + default: + getEnd = function () + { + return parseFloat(propertyValue); + }; + } + } + else if (t === 'function') + { + // The same as setting just the getEnd function and no getStart + + // props: { + // x: function (target, key, value) { return value + 50); }, + // } + + getEnd = propertyValue; + } + else if (t === 'object' && hasGetters(propertyValue)) + { + /* + x: { + // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween. + getEnd: function (target, key, value) + { + return value; + }, + + // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween. + getStart: function (target, key, value) + { + return value; + } + } + */ + + if (hasGetEnd(propertyValue)) + { + getEnd = propertyValue.getEnd; + } + + if (hasGetStart(propertyValue)) + { + getStart = propertyValue.getStart; + } + } + else if (propertyValue.hasOwnProperty('value')) + { + // Value may still be a string, function or a number + // props: { + // x: { value: 400, ... }, + // y: { value: 300, ... } + // } + + callbacks = GetValueOp(key, propertyValue.value); + } + + // If callback not set by the else if block above then set it here and return it + if (!callbacks) + { + callbacks = { + getEnd: getEnd, + getStart: getStart + }; + } + + return callbacks; +}; + +module.exports = GetValueOp; + + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetValue = __webpack_require__(4); + +/** + * Extracts an array of targets from a Tween configuration object. + * + * The targets will be looked for in a `targets` property. If it's a function, its return value will be used as the result. + * + * @function Phaser.Tweens.Builders.GetTargets + * @since 3.0.0 + * + * @param {object} config - The configuration object to use. + * + * @return {array} An array of targets (may contain only one element), or `null` if no targets were specified. + */ +var GetTargets = function (config) +{ + var targets = GetValue(config, 'targets', null); + + if (targets === null) + { + return targets; + } + + if (typeof targets === 'function') + { + targets = targets.call(); + } + + if (!Array.isArray(targets)) + { + targets = [ targets ]; + } + + return targets; +}; + +module.exports = GetTargets; + + +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Formats = __webpack_require__(31); +var MapData = __webpack_require__(83); +var Parse = __webpack_require__(233); +var Tilemap = __webpack_require__(225); + +/** + * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When + * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from + * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For + * an empty map, you should specify tileWidth, tileHeight, width & height. + * + * @function Phaser.Tilemaps.ParseToTilemap + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. + * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @param {integer} [tileWidth=32] - The width of a tile in pixels. + * @param {integer} [tileHeight=32] - The height of a tile in pixels. + * @param {integer} [width=10] - The width of the map in tiles. + * @param {integer} [height=10] - The height of the map in tiles. + * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from + * a 2D array of tile indexes. + * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the + * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.Tilemap} + */ +var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) +{ + if (tileWidth === undefined) { tileWidth = 32; } + if (tileHeight === undefined) { tileHeight = 32; } + if (width === undefined) { width = 10; } + if (height === undefined) { height = 10; } + if (insertNull === undefined) { insertNull = false; } + + var mapData = null; + + if (Array.isArray(data)) + { + var name = key !== undefined ? key : 'map'; + mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull); + } + else if (key !== undefined) + { + var tilemapData = scene.cache.tilemap.get(key); + + if (!tilemapData) + { + console.warn('No map data found for key ' + key); + } + else + { + mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull); + } + } + + if (mapData === null) + { + mapData = new MapData({ + tileWidth: tileWidth, + tileHeight: tileHeight, + width: width, + height: height + }); + } + + return new Tilemap(scene, mapData); +}; + +module.exports = ParseToTilemap; + + +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Formats = __webpack_require__(31); +var LayerData = __webpack_require__(84); +var MapData = __webpack_require__(83); +var Tile = __webpack_require__(61); + +/** + * Parses a 2D array of tile indexes into a new MapData object with a single layer. + * + * @function Phaser.Tilemaps.Parsers.Parse2DArray + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object. + * @param {integer} tileWidth - The width of a tile in pixels. + * @param {integer} tileHeight - The height of a tile in pixels. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.MapData} [description] + */ +var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) +{ + var layerData = new LayerData({ + tileWidth: tileWidth, + tileHeight: tileHeight + }); + + var mapData = new MapData({ + name: name, + tileWidth: tileWidth, + tileHeight: tileHeight, + format: Formats.ARRAY_2D, + layers: [ layerData ] + }); + + var tiles = []; + var height = data.length; + var width = 0; + + for (var y = 0; y < data.length; y++) + { + tiles[y] = []; + var row = data[y]; + + for (var x = 0; x < row.length; x++) + { + var tileIndex = parseInt(row[x], 10); + + if (isNaN(tileIndex) || tileIndex === -1) + { + tiles[y][x] = insertNull + ? null + : new Tile(layerData, -1, x, y, tileWidth, tileHeight); + } + else + { + tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight); + } + } + + if (width === 0) + { + width = row.length; + } + } + + mapData.width = layerData.width = width; + mapData.height = layerData.height = height; + mapData.widthInPixels = layerData.widthInPixels = width * tileWidth; + mapData.heightInPixels = layerData.heightInPixels = height * tileHeight; + layerData.data = tiles; + + return mapData; +}; + +module.exports = Parse2DArray; + + +/***/ }), +/* 146 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Internally used method to keep track of the tile indexes that collide within a layer. This + * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`. + * + * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex + * @private + * @since 3.0.0 + * + * @param {integer} tileIndex - The tile index to set the collision boolean for. + * @param {boolean} [collides=true] - Should the tile index collide or not? + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var SetLayerCollisionIndex = function (tileIndex, collides, layer) +{ + var loc = layer.collideIndexes.indexOf(tileIndex); + + if (collides && loc === -1) + { + layer.collideIndexes.push(tileIndex); + } + else if (!collides && loc !== -1) + { + layer.collideIndexes.splice(loc, 1); + } +}; + +module.exports = SetLayerCollisionIndex; + + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Tile = __webpack_require__(61); +var IsInLayerBounds = __webpack_require__(85); +var CalculateFacesAt = __webpack_require__(148); +var SetTileCollision = __webpack_require__(62); + +/** + * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index + * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified + * location. If you pass in an index, only the index at the specified location will be changed. + * Collision information will be recalculated at the specified location. + * + * @function Phaser.Tilemaps.Components.PutTileAt + * @private + * @since 3.0.0 + * + * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {integer} tileX - The x coordinate, in tiles, not pixels. + * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. + */ +var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) +{ + if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + + var oldTile = layer.data[tileY][tileX]; + var oldTileCollides = oldTile && oldTile.collides; + + if (tile instanceof Tile) + { + if (layer.data[tileY][tileX] === null) + { + layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height); + } + layer.data[tileY][tileX].copy(tile); + } + else + { + var index = tile; + if (layer.data[tileY][tileX] === null) + { + layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight); + } + else + { + layer.data[tileY][tileX].index = index; + } + } + + // Updating colliding flag on the new tile + var newTile = layer.data[tileY][tileX]; + var collides = layer.collideIndexes.indexOf(newTile.index) !== -1; + SetTileCollision(newTile, collides); + + // Recalculate faces only if the colliding flag at (tileX, tileY) has changed + if (recalculateFaces && (oldTileCollides !== newTile.collides)) + { + CalculateFacesAt(tileX, tileY, layer); + } + + return newTile; +}; + +module.exports = PutTileAt; + + + +/***/ }), +/* 148 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetTileAt = __webpack_require__(109); + +/** + * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting + * faces are used internally for optimizing collisions against tiles. This method is mostly used + * internally to optimize recalculating faces when only one tile has been changed. + * + * @function Phaser.Tilemaps.Components.CalculateFacesAt + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The x coordinate. + * @param {integer} tileY - The y coordinate. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesAt = function (tileX, tileY, layer) +{ + var tile = GetTileAt(tileX, tileY, true, layer); + var above = GetTileAt(tileX, tileY - 1, true, layer); + var below = GetTileAt(tileX, tileY + 1, true, layer); + var left = GetTileAt(tileX - 1, tileY, true, layer); + var right = GetTileAt(tileX + 1, tileY, true, layer); + var tileCollides = tile && tile.collides; + + // Assume the changed tile has all interesting edges + if (tileCollides) + { + tile.faceTop = true; + tile.faceBottom = true; + tile.faceLeft = true; + tile.faceRight = true; + } + + // Reset edges that are shared between tile and its neighbors + if (above && above.collides) + { + if (tileCollides) { tile.faceTop = false; } + above.faceBottom = !tileCollides; + } + + if (below && below.collides) + { + if (tileCollides) { tile.faceBottom = false; } + below.faceTop = !tileCollides; + } + + if (left && left.collides) + { + if (tileCollides) { tile.faceLeft = false; } + left.faceRight = !tileCollides; + } + + if (right && right.collides) + { + if (tileCollides) { tile.faceRight = false; } + right.faceLeft = !tileCollides; + } + + if (tile && !tile.collides) { tile.resetFaces(); } + + return tile; +}; + +module.exports = CalculateFacesAt; + + +/***/ }), +/* 149 */, +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(15); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(8); +var ParseXML = __webpack_require__(344); + +/** + * @typedef {object} Phaser.Loader.FileTypes.XMLFileConfig + * + * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. + * @property {string} [url] - The absolute or relative URL to load the file from. + * @property {string} [extension='xml'] - The default file extension to use if no url is provided. + * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ + +/** + * @classdesc + * A single XML File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml. + * + * @class XMLFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var XMLFile = new Class({ + + Extends: File, + + initialize: + + function XMLFile (loader, key, url, xhrSettings) + { + var extension = 'xml'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'xml', + cache: loader.cacheManager.xml, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.XMLFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = ParseXML(this.xhrLoader.responseText); + + if (this.data) + { + this.onProcessComplete(); + } + else + { + console.warn('Invalid XMLFile: ' + this.key); + + this.onProcessError(); + } + } + +}); + +/** + * Adds an XML file, or array of XML files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.xml('wavedata', 'files/AlienWaveData.xml'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global XML Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the XML Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the XML Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.xml({ + * key: 'wavedata', + * url: 'files/AlienWaveData.xml' + * }); + * ``` + * + * See the documentation for `Phaser.Loader.FileTypes.XMLFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.xml('wavedata', 'files/AlienWaveData.xml'); + * // and later in your game ... + * var data = this.cache.xml.get('wavedata'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the XML Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#xml + * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @since 3.0.0 + * + * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig|Phaser.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {Phaser.Loader.LoaderPlugin} The Loader instance. + */ +FileTypesManager.register('xml', 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 XMLFile(this, key[i])); + } + } + else + { + this.addFile(new XMLFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = XMLFile; + + +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Extend = __webpack_require__(19); +var XHRSettings = __webpack_require__(112); + +/** + * Takes two XHRSettings Objects and creates a new XHRSettings object from them. + * + * The new object is seeded by the values given in the global settings, but any setting in + * the local object overrides the global ones. + * + * @function Phaser.Loader.MergeXHRSettings + * @since 3.0.0 + * + * @param {XHRSettingsObject} global - The global XHRSettings object. + * @param {XHRSettingsObject} local - The local XHRSettings object. + * + * @return {XHRSettingsObject} A newly formed XHRSettings object. + */ +var MergeXHRSettings = function (global, local) +{ + var output = (global === undefined) ? XHRSettings() : Extend({}, global); + + if (local) + { + for (var setting in local) + { + if (local[setting] !== undefined) + { + output[setting] = local[setting]; + } + } + } + + return output; +}; + +module.exports = MergeXHRSettings; + + +/***/ }), +/* 152 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Given a File and a baseURL value this returns the URL the File will use to download from. + * + * @function Phaser.Loader.GetURL + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - The File object. + * @param {string} baseURL - A default base URL. + * + * @return {string} The URL the File will use. + */ +var GetURL = function (file, baseURL) +{ + if (!file.url) + { + return false; + } + + if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) + { + return file.url; + } + else + { + return baseURL + file.url; + } +}; + +module.exports = GetURL; + + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Gamepad.Events + */ + +module.exports = { + + BUTTON_DOWN: __webpack_require__(633), + BUTTON_UP: __webpack_require__(632), + CONNECTED: __webpack_require__(631), + DISCONNECTED: __webpack_require__(630), + GAMEPAD_BUTTON_DOWN: __webpack_require__(629), + GAMEPAD_BUTTON_UP: __webpack_require__(628) + +}; + + +/***/ }), +/* 154 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Rotates an entire Triangle at a given angle about a specific point. * * @function Phaser.Geom.Triangle.RotateAroundXY * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} x - The X coordinate of the point to rotate the Triangle about. + * @param {number} y - The Y coordinate of the point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var RotateAroundXY = function (triangle, x, y, angle) { @@ -28343,24 +28395,24 @@ module.exports = RotateAroundXY; /***/ }), -/* 145 */ +/* 155 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the width/height ratio of a rectangle. * * @function Phaser.Geom.Rectangle.GetAspectRatio * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle. * - * @return {number} [description] + * @return {number} The width/height ratio of the rectangle. */ var GetAspectRatio = function (rect) { @@ -28371,12 +28423,12 @@ module.exports = GetAspectRatio; /***/ }), -/* 146 */ +/* 156 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -28419,12 +28471,12 @@ module.exports = RotateAroundXY; /***/ }), -/* 147 */ +/* 157 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -28506,25 +28558,27 @@ module.exports = ContainsArray; /***/ }), -/* 148 */ +/* 158 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if two Rectangles intersect. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle. * * @function Phaser.Geom.Intersects.RectangleToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. */ var RectangleToRectangle = function (rectA, rectB) { @@ -28540,17 +28594,17 @@ module.exports = RectangleToRectangle; /***/ }), -/* 149 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Mesh = __webpack_require__(108); +var Mesh = __webpack_require__(116); /** * @classdesc @@ -29201,12 +29255,12 @@ module.exports = Quad; /***/ }), -/* 150 */ +/* 160 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -29250,29 +29304,41 @@ module.exports = Contains; /***/ }), -/* 151 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(150); -var GetPoints = __webpack_require__(284); +var Contains = __webpack_require__(160); +var GetPoints = __webpack_require__(289); /** * @classdesc - * [description] + * A Polygon object + * + + * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. + * Several formats are supported to define the list of points, check the setTo method for details. + * This is a geometry object allowing you to define and inspect the shape. + * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. + * To render a Polygon you should look at the capabilities of the Graphics class. * * @class Polygon * @memberof Phaser.Geom * @constructor * @since 3.0.0 * - * @param {Phaser.Geom.Point[]} [points] - [description] + * @param {Phaser.Geom.Point[]} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: + * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` + * - An array of objects with public x y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` */ var Polygon = new Class({ @@ -29337,7 +29403,7 @@ var Polygon = new Class({ * @method Phaser.Geom.Polygon#setTo * @since 3.0.0 * - * @param {array} points - [description] + * @param {array} points - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. * * @return {Phaser.Geom.Polygon} This Polygon object. */ @@ -29459,23 +29525,23 @@ module.exports = Polygon; /***/ }), -/* 152 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var CONST = __webpack_require__(26); -var GameObject = __webpack_require__(19); -var GetPowerOfTwo = __webpack_require__(294); -var Smoothing = __webpack_require__(120); -var TileSpriteRender = __webpack_require__(805); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var GameObject = __webpack_require__(18); +var GetPowerOfTwo = __webpack_require__(376); +var Smoothing = __webpack_require__(130); +var TileSpriteRender = __webpack_require__(828); var Vector2 = __webpack_require__(3); // bitmask flag for GameObject.renderMask @@ -29488,8 +29554,8 @@ var _FLAG = 8; // 1000 * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and * are designed so that you can create game backdrops using seamless textures as a source. * - * You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background - * that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition` + * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background + * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. @@ -29840,22 +29906,18 @@ var TileSprite = new Class({ * @method Phaser.GameObjects.TileSprite#setTileScale * @since 3.12.0 * - * @param {number} [x] - The horizontal scale of the tiling texture. - * @param {number} [y] - The vertical scale of the tiling texture. + * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value. + * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value. * * @return {this} This Tile Sprite instance. */ setTileScale: function (x, y) { - if (x !== undefined) - { - this.tileScaleX = x; - } + if (x === undefined) { x = this.tileScaleX; } + if (y === undefined) { y = x; } - if (y !== undefined) - { - this.tileScaleY = y; - } + this.tileScaleX = x; + this.tileScaleY = y; return this; }, @@ -29869,7 +29931,7 @@ var TileSprite = new Class({ */ updateTileTexture: function () { - if (!this.dirty) + if (!this.dirty || !this.renderer) { return; } @@ -29934,6 +29996,9 @@ var TileSprite = new Class({ canvas.height = this.height; this.frame.setSize(this.width, this.height); + this.updateDisplayOrigin(); + + this.dirty = true; } if (!this.dirty || this.renderer && this.renderer.gl) @@ -30099,26 +30164,26 @@ module.exports = TileSprite; /***/ }), -/* 153 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(169); +var AddToDOM = __webpack_require__(179); var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var CONST = __webpack_require__(26); -var GameObject = __webpack_require__(19); -var GetTextSize = __webpack_require__(811); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var GameObject = __webpack_require__(18); +var GetTextSize = __webpack_require__(834); var GetValue = __webpack_require__(4); -var RemoveFromDOM = __webpack_require__(342); -var TextRender = __webpack_require__(810); -var TextStyle = __webpack_require__(807); +var RemoveFromDOM = __webpack_require__(343); +var TextRender = __webpack_require__(833); +var TextStyle = __webpack_require__(830); /** * @classdesc @@ -30131,6 +30196,21 @@ var TextStyle = __webpack_require__(807); * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes, either + * when creating the Text object, or when setting the font via `setFont` or `setFontFamily`. I.e.: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: '"Roboto Condensed"' }); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: 'Verdana, "Times New Roman", Tahoma, serif' }); + * ``` * * You can only display fonts that are currently loaded and available to the browser: therefore fonts must * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, @@ -30242,7 +30322,7 @@ var Text = new Class({ * Manages the style of this Text object. * * @name Phaser.GameObjects.Text#style - * @type {Phaser.GameObjects.Text.TextStyle} + * @type {Phaser.GameObjects.TextStyle} * @since 3.0.0 */ this.style = new TextStyle(this, style); @@ -30733,6 +30813,20 @@ var Text = new Class({ * * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFont * @since 3.0.0 @@ -30748,6 +30842,20 @@ var Text = new Class({ /** * Set the font family. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFontFamily * @since 3.0.0 @@ -30825,18 +30933,23 @@ var Text = new Class({ }, /** - * Set the text fill color. + * Set the fill style to be used by the Text object. + * + * This can be any valid CanvasRenderingContext2D fillStyle value, such as + * a color (in hex, rgb, rgba, hsl or named values), a gradient or a pattern. + * + * See the [MDN fillStyle docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) for more details. * * @method Phaser.GameObjects.Text#setFill * @since 3.0.0 * - * @param {string} color - The text fill color. + * @param {(string|any)} color - The text fill style. Can be any valid CanvasRenderingContext `fillStyle` value. * * @return {Phaser.GameObjects.Text} This Text object. */ - setFill: function (color) + setFill: function (fillStyle) { - return this.style.setFill(color); + return this.style.setFill(fillStyle); }, /** @@ -31380,24 +31493,26 @@ module.exports = Text; /***/ }), -/* 154 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(121); +var BlendModes = __webpack_require__(60); +var Camera = __webpack_require__(131); var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var CONST = __webpack_require__(26); -var Frame = __webpack_require__(113); -var GameObject = __webpack_require__(19); -var Render = __webpack_require__(817); -var UUID = __webpack_require__(295); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var Frame = __webpack_require__(121); +var GameObject = __webpack_require__(18); +var Render = __webpack_require__(840); +var Utils = __webpack_require__(9); +var UUID = __webpack_require__(299); /** * @classdesc @@ -31406,6 +31521,11 @@ var UUID = __webpack_require__(295); * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads. + * + * Note that under WebGL a FrameBuffer, which is what the Render Texture uses internally, cannot be anti-aliased. This means + * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this + * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that + * to the Render Texture. * * @class RenderTexture * @extends Phaser.GameObjects.GameObject @@ -31507,8 +31627,7 @@ var RenderTexture = new Class({ this.globalAlpha = 1; /** - * The HTML Canvas Element that the Render Texture is drawing to. - * This is only populated if Phaser is running with the Canvas Renderer. + * The HTML Canvas Element that the Render Texture is drawing to when using the Canvas Renderer. * * @name Phaser.GameObjects.RenderTexture#canvas * @type {HTMLCanvasElement} @@ -31573,6 +31692,16 @@ var RenderTexture = new Class({ */ this._saved = false; + /** + * Internal erase mode flag. + * + * @name Phaser.GameObjects.RenderTexture#_eraseMode + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._eraseMode = false; + /** * An internal Camera that can be used to move around the Render Texture. * Control it just like you would any Scene Camera. The difference is that it only impacts the placement of what @@ -31629,7 +31758,7 @@ var RenderTexture = new Class({ /** * Sets the size of this Game Object. * - * @method Phaser.GameObjects.Components.Size#setSize + * @method Phaser.GameObjects.RenderTexture#setSize * @since 3.0.0 * * @param {number} width - The width of this Game Object. @@ -31784,25 +31913,31 @@ var RenderTexture = new Class({ { if (alpha === undefined) { alpha = 1; } - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; + var r = ((rgb >> 16) | 0) & 0xff; + var g = ((rgb >> 8) | 0) & 0xff; + var b = (rgb | 0) & 0xff; - if (this.gl) + var gl = this.gl; + + if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var renderer = this.renderer; - var gl = this.gl; - - gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, alpha); - - gl.clear(gl.COLOR_BUFFER_BIT); - - this.renderer.setFramebuffer(null); + var bounds = this.getBounds(); + + renderer.setFramebuffer(this.framebuffer, true); + + this.pipeline.drawFillRect( + bounds.x, bounds.y, bounds.right, bounds.bottom, + Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1), + alpha + ); + + renderer.setFramebuffer(null, true); } else { - this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')'; + this.context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'; this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); } @@ -31821,17 +31956,18 @@ var RenderTexture = new Class({ { if (this.dirty) { - if (this.gl) - { - this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + + if (gl) + { + var renderer = this.renderer; + + renderer.setFramebuffer(this.framebuffer, true); - var gl = this.gl; - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - this.renderer.setFramebuffer(null); + + renderer.setFramebuffer(null, true); } else { @@ -31849,6 +31985,70 @@ var RenderTexture = new Class({ return this; }, + /** + * Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE. + * This has the effect of erasing any filled pixels in the objects from this Render Texture. + * + * It can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Dynamic and Static Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. + * * Another Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up a texture from the Texture Manager. + * + * Note: You cannot erase a Render Texture from itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * @method Phaser.GameObjects.RenderTexture#erase + * @since 3.16.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. + * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object. + * + * @return {this} This Render Texture instance. + */ + erase: function (entries, x, y) + { + this._eraseMode = true; + + var blendMode = this.renderer.currentBlendMode; + + this.renderer.setBlendMode(BlendModes.ERASE); + + this.draw(entries, x, y, 1, 16777215); + + this.renderer.setBlendMode(blendMode); + + this._eraseMode = false; + + return this; + }, + /** * Draws the given object, or an array of objects, to this Render Texture. * @@ -31921,11 +32121,18 @@ var RenderTexture = new Class({ var gl = this.gl; - this.camera.preRender(1, 1, 1); + this.camera.preRender(1, 1); if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var cx = this.camera._cx; + var cy = this.camera._cy; + var cw = this.camera._cw; + var ch = this.camera._ch; + + this.renderer.setFramebuffer(this.framebuffer, false); + + this.renderer.pushScissor(cx, cy, cw, ch, ch); var pipeline = this.pipeline; @@ -31935,7 +32142,9 @@ var RenderTexture = new Class({ pipeline.flush(); - this.renderer.setFramebuffer(null); + this.renderer.setFramebuffer(null, false); + + this.renderer.popScissor(); pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); } @@ -32003,11 +32212,18 @@ var RenderTexture = new Class({ if (textureFrame) { - this.camera.preRender(1, 1, 1); + this.camera.preRender(1, 1); if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var cx = this.camera._cx; + var cy = this.camera._cy; + var cw = this.camera._cw; + var ch = this.camera._ch; + + this.renderer.setFramebuffer(this.framebuffer, false); + + this.renderer.pushScissor(cx, cy, cw, ch, ch); var pipeline = this.pipeline; @@ -32017,8 +32233,10 @@ var RenderTexture = new Class({ pipeline.flush(); - this.renderer.setFramebuffer(null); - + this.renderer.setFramebuffer(null, false); + + this.renderer.popScissor(); + pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); } else @@ -32133,7 +32351,10 @@ var RenderTexture = new Class({ var prevX = gameObject.x; var prevY = gameObject.y; - this.renderer.setBlendMode(gameObject.blendMode); + if (!this._eraseMode) + { + this.renderer.setBlendMode(gameObject.blendMode); + } gameObject.setPosition(x, y); @@ -32161,11 +32382,23 @@ var RenderTexture = new Class({ var prevX = gameObject.x; var prevY = gameObject.y; + if (this._eraseMode) + { + var blendMode = gameObject.blendMode; + + gameObject.blendMode = BlendModes.ERASE; + } + gameObject.setPosition(x, y); gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null); gameObject.setPosition(prevX, prevY); + + if (this._eraseMode) + { + gameObject.blendMode = blendMode; + } }, /** @@ -32250,6 +32483,12 @@ var RenderTexture = new Class({ } this.texture.destroy(); + this.camera.destroy(); + + this.canvas = null; + this.context = null; + this.framebuffer = null; + this.texture = null; } } @@ -32259,22 +32498,22 @@ module.exports = RenderTexture; /***/ }), -/* 155 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var GravityWell = __webpack_require__(304); -var List = __webpack_require__(112); -var ParticleEmitter = __webpack_require__(302); -var Render = __webpack_require__(821); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var GravityWell = __webpack_require__(307); +var List = __webpack_require__(120); +var ParticleEmitter = __webpack_require__(305); +var Render = __webpack_require__(844); /** * @classdesc @@ -32731,12 +32970,12 @@ module.exports = ParticleEmitterManager; /***/ }), -/* 156 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -32773,19 +33012,15 @@ module.exports = CircumferencePoint; /***/ }), -/* 157 */ +/* 167 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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, @@ -32816,33 +33051,33 @@ module.exports = { /***/ }), -/* 158 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(121); +var BaseCamera = __webpack_require__(131); var Class = __webpack_require__(0); -var Commands = __webpack_require__(157); -var ComponentsAlpha = __webpack_require__(401); -var ComponentsBlendMode = __webpack_require__(400); -var ComponentsDepth = __webpack_require__(399); -var ComponentsMask = __webpack_require__(395); -var ComponentsPipeline = __webpack_require__(186); -var ComponentsTransform = __webpack_require__(390); -var ComponentsVisible = __webpack_require__(389); -var ComponentsScrollFactor = __webpack_require__(392); +var Commands = __webpack_require__(167); +var ComponentsAlpha = __webpack_require__(435); +var ComponentsBlendMode = __webpack_require__(432); +var ComponentsDepth = __webpack_require__(431); +var ComponentsMask = __webpack_require__(427); +var ComponentsPipeline = __webpack_require__(200); +var ComponentsTransform = __webpack_require__(422); +var ComponentsVisible = __webpack_require__(421); +var ComponentsScrollFactor = __webpack_require__(424); -var Ellipse = __webpack_require__(90); -var GameObject = __webpack_require__(19); +var Ellipse = __webpack_require__(96); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var MATH_CONST = __webpack_require__(16); -var Render = __webpack_require__(831); +var MATH_CONST = __webpack_require__(20); +var Render = __webpack_require__(854); /** * Graphics line style (or stroke style) settings. @@ -33327,6 +33562,26 @@ var Graphics = new Class({ return this; }, + /** + * Fill the current path. + * + * This is an alias for `Graphics.fillPath` and does the same thing. + * It was added to match the CanvasRenderingContext 2D API. + * + * @method Phaser.GameObjects.Graphics#fill + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Graphics} This Game Object. + */ + fill: function () + { + this.commandBuffer.push( + Commands.FILL_PATH + ); + + return this; + }, + /** * Stroke the current path. * @@ -33344,6 +33599,26 @@ var Graphics = new Class({ return this; }, + /** + * Stroke the current path. + * + * This is an alias for `Graphics.strokePath` and does the same thing. + * It was added to match the CanvasRenderingContext 2D API. + * + * @method Phaser.GameObjects.Graphics#stroke + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Graphics} This Game Object. + */ + stroke: function () + { + this.commandBuffer.push( + Commands.STROKE_PATH + ); + + return this; + }, + /** * Fill the given circle. * @@ -33511,6 +33786,15 @@ var Graphics = new Class({ return this; }, + /** + * @typedef {object} RoundedRectRadius + * + * @property {number} [tl=20] - Top left + * @property {number} [tr=20] - Top right + * @property {number} [br=20] - Bottom right + * @property {number} [bl=20] - Bottom left + */ + /** * Fill a rounded rectangle with the given position, size and radius. * @@ -33521,11 +33805,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -33571,11 +33851,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -33826,15 +34102,15 @@ var Graphics = new Class({ }, /** - * [description] + * Draw a line from the current drawing position to the given position with a specific width and color. * * @method Phaser.GameObjects.Graphics#lineFxTo * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} rgb - [description] + * @param {number} x - The x coordinate to draw the line to. + * @param {number} y - The y coordinate to draw the line to. + * @param {number} width - The width of the stroke. + * @param {number} rgb - The color of the stroke. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -33849,15 +34125,15 @@ var Graphics = new Class({ }, /** - * [description] + * Move the current drawing position to the given position and change the pen width and color. * * @method Phaser.GameObjects.Graphics#moveFxTo * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} rgb - [description] + * @param {number} x - The x coordinate to move to. + * @param {number} y - The y coordinate to move to. + * @param {number} width - The new stroke width. + * @param {number} rgb - The new stroke color. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -34267,8 +34543,8 @@ var Graphics = new Class({ var sys = this.scene.sys; var renderer = sys.game.renderer; - if (width === undefined) { width = sys.game.config.width; } - if (height === undefined) { height = sys.game.config.height; } + if (width === undefined) { width = sys.scale.width; } + if (height === undefined) { height = sys.scale.height; } Graphics.TargetCamera.setScene(this.scene); Graphics.TargetCamera.setViewport(0, 0, width, height); @@ -34350,23 +34626,24 @@ module.exports = Graphics; /***/ }), -/* 159 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(109); +var BitmapText = __webpack_require__(117); var Class = __webpack_require__(0); -var Render = __webpack_require__(834); +var Render = __webpack_require__(860); /** * @typedef {object} DisplayCallbackConfig * - * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. + * @property {Phaser.GameObjects.DynamicBitmapText} parent - The Dynamic Bitmap Text object that owns this character being rendered. + * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. Always zero in Canvas. * @property {number} index - The index of the character being rendered. * @property {number} charCode - The character code of the character being rendered. * @property {number} x - The x position of the character being rendered. @@ -34504,6 +34781,7 @@ var DynamicBitmapText = new Class({ * @since 3.11.0 */ this.callbackData = { + parent: this, color: 0, tint: { topLeft: 0, @@ -34603,24 +34881,25 @@ module.exports = DynamicBitmapText; /***/ }), -/* 160 */ +/* 170 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayUtils = __webpack_require__(164); -var BlendModes = __webpack_require__(66); +var ArrayUtils = __webpack_require__(174); +var BlendModes = __webpack_require__(60); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var GameObject = __webpack_require__(19); -var Rectangle = __webpack_require__(9); -var Render = __webpack_require__(837); -var Union = __webpack_require__(309); +var Components = __webpack_require__(13); +var Events = __webpack_require__(133); +var GameObject = __webpack_require__(18); +var Rectangle = __webpack_require__(10); +var Render = __webpack_require__(863); +var Union = __webpack_require__(313); var Vector2 = __webpack_require__(3); /** @@ -34971,7 +35250,7 @@ var Container = new Class({ */ addHandler: function (gameObject) { - gameObject.once('destroy', this.remove, this); + gameObject.once(Events.DESTROY, this.remove, this); if (this.exclusive) { @@ -34997,7 +35276,7 @@ var Container = new Class({ */ removeHandler: function (gameObject) { - gameObject.off('destroy', this.remove); + gameObject.off(Events.DESTROY, this.remove); if (this.exclusive) { @@ -35132,36 +35411,28 @@ var Container = new Class({ * @since 3.4.0 * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.GameObjects.Container} This Container instance. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - ArrayUtils.StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal sort handler method. - * - * @method Phaser.GameObjects.Container#sortHandler - * @private - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} childA - The first child to sort. - * @param {Phaser.GameObjects.GameObject} childB - The second child to sort. - * - * @return {integer} The sort results. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + ArrayUtils.StableSort.inplace(this.list, handler); + + return this; }, /** @@ -35209,8 +35480,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getFirst * @since 3.4.0 * - * @param {string} [property] - The property to test on each Game Object in the Container. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {string} property - The property to test on each Game Object in the Container. + * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. * @param {integer} [startIndex=0] - An optional start index to search from. * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) * @@ -35218,7 +35489,7 @@ var Container = new Class({ */ getFirst: function (property, value, startIndex, endIndex) { - return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex); + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); }, /** @@ -35840,27 +36111,27 @@ module.exports = Container; /***/ }), -/* 161 */ +/* 171 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlitterRender = __webpack_require__(841); -var Bob = __webpack_require__(838); +var BlitterRender = __webpack_require__(867); +var Bob = __webpack_require__(864); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var Frame = __webpack_require__(113); -var GameObject = __webpack_require__(19); -var List = __webpack_require__(112); +var Components = __webpack_require__(13); +var Frame = __webpack_require__(121); +var GameObject = __webpack_require__(18); +var List = __webpack_require__(120); /** - * @callback Phaser.GameObjects.Blitter.CreateCallback + * @callback CreateCallback * - * @param {Phaser.GameObjects.Blitter.Bob} bob - The Bob that was created by the Blitter. + * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. * @param {integer} index - The position of the Bob within the Blitter display list. */ @@ -35938,7 +36209,7 @@ var Blitter = new Class({ * This List contains all of the Bob objects created by the Blitter. * * @name Phaser.GameObjects.Blitter#children - * @type {Phaser.Structs.List.} + * @type {Phaser.Structs.List.} * @since 3.0.0 */ this.children = new List(); @@ -35948,7 +36219,7 @@ var Blitter = new Class({ * The array is re-populated whenever the dirty flag is set. * * @name Phaser.GameObjects.Blitter#renderList - * @type {Phaser.GameObjects.Blitter.Bob[]} + * @type {Phaser.GameObjects.Bob[]} * @default [] * @private * @since 3.0.0 @@ -35981,7 +36252,7 @@ var Blitter = new Class({ * @param {boolean} [visible=true] - Should the created Bob render or not? * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. * - * @return {Phaser.GameObjects.Blitter.Bob} The newly created Bob object. + * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ create: function (x, y, frame, visible, index) { @@ -36012,12 +36283,12 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#createFromCallback * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. + * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. * @param {integer} quantity - The quantity of Bob objects to create. * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createFromCallback: function (callback, quantity, frame, visible) { @@ -36048,7 +36319,7 @@ var Blitter = new Class({ * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createMultiple: function (quantity, frame, visible) { @@ -36080,7 +36351,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#childCanRender * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.Bob} child - The Bob to check for rendering. + * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering. * * @return {boolean} Returns `true` if the given child can render, otherwise `false`. */ @@ -36096,7 +36367,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#getRenderList * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that will be rendered this frame. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame. */ getRenderList: function () { @@ -36141,12 +36412,12 @@ module.exports = Blitter; /***/ }), -/* 162 */ +/* 172 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -36176,37 +36447,37 @@ module.exports = GetRandom; /***/ }), -/* 163 */ +/* 173 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** -* A Matrix is simply an array of arrays, where each sub-array (the rows) have the same length: -* -* let matrix2 = [ -* [ 1, 1, 1, 1, 1, 1 ], -* [ 2, 0, 0, 0, 0, 4 ], -* [ 2, 0, 1, 2, 0, 4 ], -* [ 2, 0, 3, 4, 0, 4 ], -* [ 2, 0, 0, 0, 0, 4 ], -* [ 3, 3, 3, 3, 3, 3 ] -*]; -*/ - -/** - * [description] + * Checks if an array can be used as a matrix. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` * * @function Phaser.Utils.Array.Matrix.CheckMatrix * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the given `matrix` array is a valid matrix. */ var CheckMatrix = function (matrix) { @@ -36234,12 +36505,12 @@ module.exports = CheckMatrix; /***/ }), -/* 164 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -36249,56 +36520,56 @@ module.exports = CheckMatrix; module.exports = { - Matrix: __webpack_require__(874), + Matrix: __webpack_require__(900), - Add: __webpack_require__(867), - AddAt: __webpack_require__(866), - BringToTop: __webpack_require__(865), - CountAllMatching: __webpack_require__(864), - Each: __webpack_require__(863), - EachInRange: __webpack_require__(862), - FindClosestInSorted: __webpack_require__(383), - GetAll: __webpack_require__(861), - GetFirst: __webpack_require__(860), - GetRandom: __webpack_require__(162), - MoveDown: __webpack_require__(859), - MoveTo: __webpack_require__(858), - MoveUp: __webpack_require__(857), - NumberArray: __webpack_require__(856), - NumberArrayStep: __webpack_require__(855), - QuickSelect: __webpack_require__(313), - Range: __webpack_require__(312), - Remove: __webpack_require__(330), - RemoveAt: __webpack_require__(854), - RemoveBetween: __webpack_require__(853), - RemoveRandomElement: __webpack_require__(852), - Replace: __webpack_require__(851), - RotateLeft: __webpack_require__(387), - RotateRight: __webpack_require__(386), - SafeRange: __webpack_require__(62), - SendToBack: __webpack_require__(850), - SetAll: __webpack_require__(849), - Shuffle: __webpack_require__(122), - SpliceOne: __webpack_require__(91), - StableSort: __webpack_require__(110), - Swap: __webpack_require__(848) + Add: __webpack_require__(893), + AddAt: __webpack_require__(892), + BringToTop: __webpack_require__(891), + CountAllMatching: __webpack_require__(890), + Each: __webpack_require__(889), + EachInRange: __webpack_require__(888), + FindClosestInSorted: __webpack_require__(434), + GetAll: __webpack_require__(887), + GetFirst: __webpack_require__(886), + GetRandom: __webpack_require__(172), + MoveDown: __webpack_require__(885), + MoveTo: __webpack_require__(884), + MoveUp: __webpack_require__(883), + NumberArray: __webpack_require__(882), + NumberArrayStep: __webpack_require__(881), + QuickSelect: __webpack_require__(317), + Range: __webpack_require__(316), + Remove: __webpack_require__(177), + RemoveAt: __webpack_require__(880), + RemoveBetween: __webpack_require__(879), + RemoveRandomElement: __webpack_require__(878), + Replace: __webpack_require__(877), + RotateLeft: __webpack_require__(418), + RotateRight: __webpack_require__(417), + SafeRange: __webpack_require__(68), + SendToBack: __webpack_require__(876), + SetAll: __webpack_require__(875), + Shuffle: __webpack_require__(132), + SpliceOne: __webpack_require__(97), + StableSort: __webpack_require__(118), + Swap: __webpack_require__(874) }; /***/ }), -/* 165 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(113); -var TextureSource = __webpack_require__(317); +var Frame = __webpack_require__(121); +var TextureSource = __webpack_require__(320); var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; @@ -36321,7 +36592,7 @@ var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; * * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. * @param {string} key - The unique string-based key of this Texture. - * @param {(HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. * @param {number} [width] - The width of the Texture. This is optional and automatically derived from the source images. * @param {number} [height] - The height of the Texture. This is optional and automatically derived from the source images. */ @@ -36677,7 +36948,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#setDataSource * @since 3.0.0 * - * @param {(HTMLImageElement|HTMLCanvasElement)} data - The source image. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} data - The source image. */ setDataSource: function (data) { @@ -36762,22 +37033,23 @@ module.exports = Texture; /***/ }), -/* 166 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(116); -var DefaultPlugins = __webpack_require__(167); -var GetPhysicsPlugins = __webpack_require__(890); -var GetScenePlugins = __webpack_require__(889); +var CONST = __webpack_require__(124); +var DefaultPlugins = __webpack_require__(181); +var Events = __webpack_require__(16); +var GetPhysicsPlugins = __webpack_require__(935); +var GetScenePlugins = __webpack_require__(934); var NOOP = __webpack_require__(1); -var Settings = __webpack_require__(326); +var Settings = __webpack_require__(329); /** * @classdesc @@ -36906,6 +37178,17 @@ var Systems = new Class({ */ this.registry; + /** + * A reference to the global Scale Manager. + * + * In the default set-up you can access this from within a Scene via the `this.scale` property. + * + * @name Phaser.Scenes.Systems#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.15.0 + */ + this.scale; + /** * A reference to the global Sound Manager. * @@ -37048,6 +37331,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#init * @protected + * @fires Phaser.Scenes.Events#BOOT * @since 3.0.0 * * @param {Phaser.Game} game - A reference to the Phaser Game instance. @@ -37070,7 +37354,7 @@ var Systems = new Class({ pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]); - this.events.emit('boot', this); + this.events.emit(Events.BOOT, this); this.settings.isBooted = true; }, @@ -37099,6 +37383,9 @@ var Systems = new Class({ * Frame or Set Timeout call to the main Game instance. * * @method Phaser.Scenes.Systems#step + * @fires Phaser.Scenes.Events#PRE_UPDATE + * @fires Phaser.Scenes.Events#_UPDATE + * @fires Phaser.Scenes.Events#POST_UPDATE * @since 3.0.0 * * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). @@ -37106,13 +37393,13 @@ var Systems = new Class({ */ step: function (time, delta) { - this.events.emit('preupdate', time, delta); + this.events.emit(Events.PRE_UPDATE, time, delta); - this.events.emit('update', time, delta); + this.events.emit(Events.UPDATE, time, delta); this.sceneUpdate.call(this.scene, time, delta); - this.events.emit('postupdate', time, delta); + this.events.emit(Events.POST_UPDATE, time, delta); }, /** @@ -37120,6 +37407,7 @@ var Systems = new Class({ * Instructs the Scene to render itself via its Camera Manager to the renderer given. * * @method Phaser.Scenes.Systems#render + * @fires Phaser.Scenes.Events#RENDER * @since 3.0.0 * * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call. @@ -37132,7 +37420,7 @@ var Systems = new Class({ this.cameras.render(renderer, displayList); - this.events.emit('render', renderer); + this.events.emit(Events.RENDER, renderer); }, /** @@ -37162,6 +37450,7 @@ var Systems = new Class({ * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. * * @method Phaser.Scenes.Systems#pause + * @fires Phaser.Scenes.Events#PAUSE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'pause' event. @@ -37176,7 +37465,7 @@ var Systems = new Class({ this.settings.active = false; - this.events.emit('pause', this, data); + this.events.emit(Events.PAUSE, this, data); } return this; @@ -37186,6 +37475,7 @@ var Systems = new Class({ * Resume this Scene from a paused state. * * @method Phaser.Scenes.Systems#resume + * @fires Phaser.Scenes.Events#RESUME * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'resume' event. @@ -37200,7 +37490,7 @@ var Systems = new Class({ this.settings.active = true; - this.events.emit('resume', this, data); + this.events.emit(Events.RESUME, this, data); } return this; @@ -37215,6 +37505,7 @@ var Systems = new Class({ * from other Scenes may still invoke changes within it, so be careful what is left active. * * @method Phaser.Scenes.Systems#sleep + * @fires Phaser.Scenes.Events#SLEEP * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'sleep' event. @@ -37228,7 +37519,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('sleep', this, data); + this.events.emit(Events.SLEEP, this, data); return this; }, @@ -37237,6 +37528,7 @@ var Systems = new Class({ * Wake-up this Scene if it was previously asleep. * * @method Phaser.Scenes.Systems#wake + * @fires Phaser.Scenes.Events#WAKE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'wake' event. @@ -37252,11 +37544,11 @@ var Systems = new Class({ settings.active = true; settings.visible = true; - this.events.emit('wake', this, data); + this.events.emit(Events.WAKE, this, data); if (settings.isTransition) { - this.events.emit('transitionwake', settings.transitionFrom, settings.transitionDuration); + this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); } return this; @@ -37401,6 +37693,8 @@ var Systems = new Class({ * Called automatically by the SceneManager. * * @method Phaser.Scenes.Systems#start + * @fires Phaser.Scenes.Events#START + * @fires Phaser.Scenes.Events#READY * @since 3.0.0 * * @param {object} data - Optional data object that may have been passed to this Scene from another. @@ -37418,25 +37712,10 @@ var Systems = new Class({ this.settings.visible = true; // For plugins to listen out for - this.events.emit('start', this); + this.events.emit(Events.START, this); // For user-land code to listen out for - this.events.emit('ready', this, data); - }, - - /** - * 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); + this.events.emit(Events.READY, this, data); }, /** @@ -37447,23 +37726,24 @@ var Systems = new Class({ * to free-up resources. * * @method Phaser.Scenes.Systems#shutdown + * @fires Phaser.Scenes.Events#SHUTDOWN * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'shutdown' event. */ shutdown: function (data) { - this.events.off('transitioninit'); - this.events.off('transitionstart'); - this.events.off('transitioncomplete'); - this.events.off('transitionout'); + this.events.off(Events.TRANSITION_INIT); + this.events.off(Events.TRANSITION_START); + this.events.off(Events.TRANSITION_COMPLETE); + this.events.off(Events.TRANSITION_OUT); this.settings.status = CONST.SHUTDOWN; this.settings.active = false; this.settings.visible = false; - this.events.emit('shutdown', this, data); + this.events.emit(Events.SHUTDOWN, this, data); }, /** @@ -37473,6 +37753,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#destroy * @private + * @fires Phaser.Scenes.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -37482,7 +37763,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('destroy', this); + this.events.emit(Events.DESTROY, this); this.events.removeAllListeners(); @@ -37500,12 +37781,268 @@ module.exports = Systems; /***/ }), -/* 167 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SpliceOne = __webpack_require__(97); + +/** + * Removes the given item, or array of items, from the array. + * + * The array is modified in-place. + * + * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * + * @function Phaser.Utils.Array.Remove + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. + * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + */ +var Remove = function (array, item, callback, context) +{ + if (context === undefined) { context = array; } + + var index; + + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) + { + index = array.indexOf(item); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, item); + } + + return item; + } + else + { + return null; + } + } + + // If we got this far, we have an array of items to remove + + var itemLength = item.length - 1; + + while (itemLength >= 0) + { + var entry = item[itemLength]; + + index = array.indexOf(entry); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, entry); + } + } + else + { + // Item wasn't found in the array, so remove it from our return results + item.pop(); + } + + itemLength--; + } + + return item; +}; + +module.exports = Remove; + + +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = { + + CENTER: __webpack_require__(349), + ORIENTATION: __webpack_require__(348), + SCALE_MODE: __webpack_require__(347), + ZOOM: __webpack_require__(346) + +}; + +module.exports = CONST; + + +/***/ }), +/* 179 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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 it falls back to using `document.body`. + * + * @function Phaser.DOM.AddToDOM + * @since 3.0.0 + * + * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. + * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. + * + * @return {HTMLElement} The element that was added to the DOM. + */ +var AddToDOM = function (element, parent) +{ + var target; + + 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; + } + } + else if (element.parentElement) + { + return element; + } + + // Fallback, covers an invalid ID and a non HTMLElement object + if (!target) + { + target = document.body; + } + + target.appendChild(element); + + return element; +}; + +module.exports = AddToDOM; + + +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Rectangle = __webpack_require__(10); + +// 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 } +// ] + +/** + * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. + * + * @function Phaser.Geom.Rectangle.FromPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. + * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. + */ +var FromPoints = function (points, out) +{ + if (out === undefined) { out = new Rectangle(); } + + if (points.length === 0) + { + return out; + } + + var minX = Number.MAX_VALUE; + var minY = Number.MAX_VALUE; + + var maxX = Number.MIN_SAFE_INTEGER; + var maxY = Number.MIN_SAFE_INTEGER; + + var p; + var px; + var py; + + for (var i = 0; i < points.length; i++) + { + p = points[i]; + + if (Array.isArray(p)) + { + px = p[0]; + py = p[1]; + } + else + { + px = p.x; + py = p.y; + } + + minX = Math.min(minX, px); + minY = Math.min(minY, py); + + maxX = Math.max(maxX, px); + maxY = Math.max(maxY, py); + } + + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; + + return out; +}; + +module.exports = FromPoints; + + +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -37601,17 +38138,957 @@ module.exports = DefaultPlugins; /***/ }), -/* 168 */ +/* 182 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); -var Browser = __webpack_require__(118); +// 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 + * A representation of a vector in 3D space. + * + * A three-component vector. + * + * @class Vector3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Vector3 = new Class({ + + initialize: + + function Vector3 (x, y, z) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector3#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector3#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector3#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + }, + + /** + * Set this Vector to point up. + * + * Sets the y component of the vector to 1, and the others to 0. + * + * @method Phaser.Math.Vector3#up + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + up: function () + { + this.x = 0; + this.y = 1; + this.z = 0; + + return this; + }, + + /** + * Make a clone of this Vector3. + * + * @method Phaser.Math.Vector3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. + */ + clone: function () + { + return new Vector3(this.x, this.y, this.z); + }, + + /** + * Calculate the cross (vector) product of two given Vectors. + * + * @method Phaser.Math.Vector3#crossVectors + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to multiply. + * @param {Phaser.Math.Vector3} b - The second Vector to multiply. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + crossVectors: function (a, b) + { + var ax = a.x; + var ay = a.y; + var az = a.z; + var bx = b.x; + var by = b.y; + var bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict equality check against each Vector's components. + * + * @method Phaser.Math.Vector3#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. + * + * @return {boolean} True if the two vectors strictly match, otherwise false. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector3#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + + return this; + }, + + /** + * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. + * + * @method Phaser.Math.Vector3#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. + * @param {number} [y] - The y value to set for this Vector. + * @param {number} [z] - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + set: function (x, y, z) + { + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + + return this; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector3#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + + return this; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector3#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + scale: function (scale) + { + if (isFinite(scale)) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + } + else + { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + + return this; + }, + + /** + * Negate the `x`, `y` and `z` components of this Vector. + * + * @method Phaser.Math.Vector3#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + distance: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector3#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + distanceSq: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return dx * dx + dy * dy + dz * dz; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector3#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return Math.sqrt(x * x + y * y + z * z); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector3#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return x * x + y * y + z * z; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector3#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + normalize: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var len = x * x + y * y + z * z; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + } + + return this; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. + * + * @return {number} The dot product of this Vector and `v`. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + /** + * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. + * + * @method Phaser.Math.Vector3#cross + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector to cross product with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + cross: function (v) + { + var ax = this.x; + var ay = this.y; + var az = this.z; + var bx = v.x; + var by = v.y; + var bz = v.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector3#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + lerp: function (v, t) + { + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat3: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = x * m[0] + y * m[3] + z * m[6]; + this.y = x * m[1] + y * m[4] + z * m[7]; + this.z = x * m[2] + y * m[5] + z * m[8]; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; + + return this; + }, + + /** + * Transforms the coordinates of this Vector3 with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformCoordinates + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformCoordinates: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.x = tx / tw; + this.y = ty / tw; + this.z = tz / tw; + + return this; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector3#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + 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; + + // 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; + + // 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; + }, + + /** + * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, + * e.g. unprojecting a 2D point into 3D space. + * + * @method Phaser.Math.Vector3#project + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + project: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var a00 = m[0]; + var a01 = m[1]; + var a02 = m[2]; + var a03 = m[3]; + var a10 = m[4]; + var a11 = m[5]; + var a12 = m[6]; + var a13 = m[7]; + var a20 = m[8]; + var a21 = m[9]; + var a22 = m[10]; + var a23 = m[11]; + var a30 = m[12]; + var a31 = m[13]; + var a32 = m[14]; + var a33 = m[15]; + + var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + + this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; + this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; + this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + + return this; + }, + + /** + * Unproject this point from 2D space to 3D space. + * The point should have its x and y properties set to + * 2D screen space, and the z either at 0 (near plane) + * or 1 (far plane). The provided matrix is assumed to already + * be combined, i.e. projection * view * model. + * + * After this operation, this vector's (x, y, z) components will + * represent the unprojected 3D coordinate. + * + * @method Phaser.Math.Vector3#unproject + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. + * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unproject: function (viewport, invProjectionView) + { + var viewX = viewport.x; + var viewY = viewport.y; + var viewWidth = viewport.z; + var viewHeight = viewport.w; + + var x = this.x - viewX; + var y = (viewHeight - this.y - 1) - viewY; + var z = this.z; + + this.x = (2 * x) / viewWidth - 1; + this.y = (2 * y) / viewHeight - 1; + this.z = 2 * z - 1; + + return this.project(invProjectionView); + }, + + /** + * Make this Vector the zero vector (0, 0, 0). + * + * @method Phaser.Math.Vector3#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + + return this; + } + +}); + +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); + +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); + +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); + +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); + +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); + +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); + +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); + +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); + +module.exports = Vector3; + + +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Convert the given angle in radians, to the equivalent angle in degrees. + * + * @function Phaser.Math.RadToDeg + * @since 3.0.0 + * + * @param {number} radians - The angle in radians to convert ot degrees. + * + * @return {integer} The given angle converted to degrees. + */ +var RadToDeg = function (radians) +{ + return radians * CONST.RAD_TO_DEG; +}; + +module.exports = RadToDeg; + + +/***/ }), +/* 184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random integer between the `min` and `max` values, inclusive. + * + * @function Phaser.Math.Between + * @since 3.0.0 + * + * @param {integer} min - The minimum value. + * @param {integer} max - The maximum value. + * + * @return {integer} The random integer. + */ +var Between = function (min, max) +{ + return Math.floor(Math.random() * (max - min + 1) + min); +}; + +module.exports = Between; + + +/***/ }), +/* 185 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates a Catmull-Rom value. + * + * @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} The Catmull-Rom value. + */ +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; + + return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; +}; + +module.exports = CatmullRom; + + +/***/ }), +/* 186 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether the given values are fuzzily equal. + * + * Two numbers are fuzzily equal if their difference is less than `epsilon`. + * + * @function Phaser.Math.Fuzzy.Equal + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. + */ +var Equal = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.abs(a - b) < epsilon; +}; + +module.exports = Equal; + + +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(99); +var Browser = __webpack_require__(128); var CanvasPool = __webpack_require__(24); /** @@ -37798,274 +39275,27 @@ module.exports = init(); /***/ }), -/* 169 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * 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 it falls back to using `document.body`. - * - * @function Phaser.DOM.AddToDOM - * @since 3.0.0 - * - * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. - * @param {(string|HTMLElement)} [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] - Whether or not to hide overflowing content inside the parent. - * - * @return {HTMLElement} The element that was added to the DOM. - */ -var AddToDOM = function (element, parent, overflowHidden) -{ - if (overflowHidden === undefined) { overflowHidden = true; } - - var target; - - 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; - } - } - else if (element.parentElement) - { - return element; - } - - // Fallback, covers an invalid ID and a non HTMLElement object - if (!target) - { - target = document.body; - } - - if (overflowHidden && target.style) - { - target.style.overflow = 'hidden'; - } - - target.appendChild(element); - - return element; -}; - -module.exports = AddToDOM; - - -/***/ }), -/* 170 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random integer between the `min` and `max` values, inclusive. - * - * @function Phaser.Math.Between - * @since 3.0.0 - * - * @param {integer} min - The minimum value. - * @param {integer} max - The maximum value. - * - * @return {integer} The random integer. - */ -var Between = function (min, max) -{ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -module.exports = Between; - - -/***/ }), -/* 171 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates a Catmull-Rom value. - * - * @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} The Catmull-Rom value. - */ -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; - - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -}; - -module.exports = CatmullRom; - - -/***/ }), -/* 172 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(16); - -/** - * Convert the given angle in radians, to the equivalent angle in degrees. - * - * @function Phaser.Math.RadToDeg - * @since 3.0.0 - * - * @param {number} radians - The angle in radians to convert ot degrees. - * - * @return {integer} The given angle converted to degrees. - */ -var RadToDeg = function (radians) -{ - return radians * CONST.RAD_TO_DEG; -}; - -module.exports = RadToDeg; - - -/***/ }), -/* 173 */ -/***/ (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__(9); - -// 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 } -// ] - -/** - * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. - * - * @function Phaser.Geom.Rectangle.FromPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. - * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. - * - * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. - */ -var FromPoints = function (points, out) -{ - if (out === undefined) { out = new Rectangle(); } - - if (points.length === 0) - { - return out; - } - - var minX = Number.MAX_VALUE; - var minY = Number.MAX_VALUE; - - var maxX = Number.MIN_SAFE_INTEGER; - var maxY = Number.MIN_SAFE_INTEGER; - - var p; - var px; - var py; - - for (var i = 0; i < points.length; i++) - { - p = points[i]; - - if (Array.isArray(p)) - { - px = p[0]; - py = p[1]; - } - else - { - px = p.x; - py = p.y; - } - - minX = Math.min(minX, px); - minY = Math.min(minY, py); - - maxX = Math.max(maxX, px); - maxY = Math.max(maxY, py); - } - - out.x = minX; - out.y = minY; - out.width = maxX - minX; - out.height = maxY - minY; - - return out; -}; - -module.exports = FromPoints; - - -/***/ }), -/* 174 */ -/***/ (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 Back = __webpack_require__(369); -var Bounce = __webpack_require__(368); -var Circular = __webpack_require__(367); -var Cubic = __webpack_require__(366); -var Elastic = __webpack_require__(365); -var Expo = __webpack_require__(364); -var Linear = __webpack_require__(363); -var Quadratic = __webpack_require__(362); -var Quartic = __webpack_require__(361); -var Quintic = __webpack_require__(360); -var Sine = __webpack_require__(359); -var Stepped = __webpack_require__(358); +var Back = __webpack_require__(402); +var Bounce = __webpack_require__(401); +var Circular = __webpack_require__(400); +var Cubic = __webpack_require__(399); +var Elastic = __webpack_require__(398); +var Expo = __webpack_require__(397); +var Linear = __webpack_require__(396); +var Quadratic = __webpack_require__(395); +var Quartic = __webpack_require__(394); +var Quintic = __webpack_require__(393); +var Sine = __webpack_require__(392); +var Stepped = __webpack_require__(391); // EaseMap module.exports = { @@ -38126,12 +39356,12 @@ module.exports = { /***/ }), -/* 175 */ +/* 189 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38163,16 +39393,16 @@ module.exports = CenterOn; /***/ }), -/* 176 */ +/* 190 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetColor = __webpack_require__(177); +var GetColor = __webpack_require__(191); /** * Converts an HSV (hue, saturation and value) color value to RGB. @@ -38264,12 +39494,12 @@ module.exports = HSVToRGB; /***/ }), -/* 177 */ +/* 191 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38294,19 +39524,19 @@ module.exports = GetColor; /***/ }), -/* 178 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HexStringToColor = __webpack_require__(377); -var IntegerToColor = __webpack_require__(374); -var ObjectToColor = __webpack_require__(372); -var RGBStringToColor = __webpack_require__(371); +var HexStringToColor = __webpack_require__(410); +var IntegerToColor = __webpack_require__(407); +var ObjectToColor = __webpack_require__(405); +var RGBStringToColor = __webpack_require__(404); /** * Converts the given source color value into an instance of a Color class. @@ -38350,12 +39580,12 @@ module.exports = ValueToColor; /***/ }), -/* 179 */ +/* 193 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38426,25 +39656,24 @@ module.exports = Pad; /***/ }), -/* 180 */ +/* 194 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * @callback EachMapCallback - * @generic E - [entry] + * @callback EachMapCallback * - * @param {string} key - [description] - * @param {*} entry - [description] + * @param {string} key - The key of the Map entry. + * @param {E} entry - The value of the Map entry. * - * @return {?boolean} [description] + * @return {?boolean} The callback result. */ /** @@ -38509,6 +39738,7 @@ var Map = new Class({ /** * Adds an element with a specified `key` and `value` to this Map. + * If the `key` already exists, the value will be replaced. * * @method Phaser.Structs.Map#set * @since 3.0.0 @@ -38526,10 +39756,11 @@ var Map = new Class({ { if (!this.has(key)) { - this.entries[key] = value; this.size++; } + this.entries[key] = value; + return this; }, @@ -38798,12 +40029,12 @@ module.exports = Map; /***/ }), -/* 181 */ +/* 195 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38845,12 +40076,12 @@ module.exports = SmoothStep; /***/ }), -/* 182 */ +/* 196 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38884,17 +40115,17 @@ module.exports = SmootherStep; /***/ }), -/* 183 */ +/* 197 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rotate a `point` around `x` and `y` by the given `angle` and `distance`. * * @function Phaser.Math.RotateAroundDistance * @since 3.0.0 @@ -38903,7 +40134,7 @@ module.exports = SmootherStep; * @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] + * @param {number} distance - The distance from (x, y) to place the point at. * * @return {Phaser.Geom.Point} The given point. */ @@ -38921,12 +40152,12 @@ module.exports = RotateAroundDistance; /***/ }), -/* 184 */ +/* 198 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38977,12 +40208,12 @@ module.exports = Random; /***/ }), -/* 185 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39018,12 +40249,12 @@ module.exports = Random; /***/ }), -/* 186 */ +/* 200 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39147,12 +40378,12 @@ module.exports = Pipeline; /***/ }), -/* 187 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39185,12 +40416,12 @@ module.exports = Random; /***/ }), -/* 188 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39225,16 +40456,16 @@ module.exports = Random; /***/ }), -/* 189 */ +/* 203 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); var Point = __webpack_require__(6); /** @@ -39290,16 +40521,16 @@ module.exports = GetPoints; /***/ }), -/* 190 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(124); +var Perimeter = __webpack_require__(135); var Point = __webpack_require__(6); /** @@ -39367,12 +40598,953 @@ module.exports = GetPoint; /***/ }), -/* 191 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Clamp = __webpack_require__(23); +var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(136); +var FindClosestInSorted = __webpack_require__(434); +var Frame = __webpack_require__(433); +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. + * + * @class Animation + * @memberof Phaser.Animations + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationManager} manager - A reference to the global Animation Manager + * @param {string} key - The unique identifying string for this animation. + * @param {Phaser.Animations.Types.Animation} config - The Animation configuration. + */ +var Animation = new Class({ + + Extends: EventEmitter, + + initialize: + + function Animation (manager, key, config) + { + EventEmitter.call(this); + + /** + * A reference to the global Animation Manager. + * + * @name Phaser.Animations.Animation#manager + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.manager = manager; + + /** + * The unique identifying string for this animation. + * + * @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 {Phaser.Animations.AnimationFrame[]} + * @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, in milliseconds. + * If the `frameRate` property has been set then it overrides this value, + * otherwise the `frameRate` is derived from `duration`. + * + * @name Phaser.Animations.Animation#duration + * @type {integer} + * @since 3.0.0 + */ + 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) * 1000; + } + 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 = 4000 ms + // So frameRate is 12 / (4000 / 1000) = 3 fps + this.frameRate = this.frames.length / (this.duration / 1000); + } + 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 * 1000 (half a second, or 500ms) + this.duration = (this.frames.length / this.frameRate) * 1000; + } + + /** + * How many ms per frame, not including frame specific modifiers. + * + * @name Phaser.Animations.Animation#msPerFrame + * @type {integer} + * @since 3.0.0 + */ + this.msPerFrame = 1000 / this.frameRate; + + /** + * 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); + + /** + * The delay in ms before the playback will begin. + * + * @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. Set to -1 to repeat forever. + * + * @name Phaser.Animations.Animation#repeat + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeat = GetValue(config, 'repeat', 0); + + /** + * The delay in ms before the a repeat play starts. + * + * @name Phaser.Animations.Animation#repeatDelay + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeatDelay = GetValue(config, 'repeatDelay', 0); + + /** + * 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); + + /** + * Should the GameObject's `visible` property be set to `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); + + /** + * Should the GameObject's `visible` property be set to `false` when the animation finishes? + * + * @name Phaser.Animations.Animation#hideOnComplete + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.hideOnComplete = GetValue(config, 'hideOnComplete', false); + + /** + * Global pause. All Game Objects using this Animation instance are impacted by this property. + * + * @name Phaser.Animations.Animation#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + this.manager.on(Events.PAUSE_ALL, this.pause, this); + this.manager.on(Events.RESUME_ALL, this.resume, this); + }, + + /** + * Add frames to the end of the animation. + * + * @method Phaser.Animations.Animation#addFrame + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} config - [description] + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + addFrame: function (config) + { + return this.addFrameAt(this.frames.length, config); + }, + + /** + * Add frame/s into the animation. + * + * @method Phaser.Animations.Animation#addFrameAt + * @since 3.0.0 + * + * @param {integer} index - The index to insert the frame at within the animation. + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} 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); + } + + this.updateFrameSequence(); + } + + return this; + }, + + /** + * Check if the given frame index is valid. + * + * @method Phaser.Animations.Animation#checkFrame + * @since 3.0.0 + * + * @param {integer} index - The index to be checked. + * + * @return {boolean} `true` if the index is valid, otherwise `false`. + */ + checkFrame: function (index) + { + return (index >= 0 && index < this.frames.length); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#completeAnimation + * @protected + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + completeAnimation: function (component) + { + if (this.hideOnComplete) + { + component.parent.visible = false; + } + + component.stop(); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFirstTick + * @protected + * @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) + { + component.nextTick += component._delay; + } + }, + + /** + * Returns the AnimationFrame at the provided index + * + * @method Phaser.Animations.Animation#getFrameAt + * @protected + * @since 3.0.0 + * + * @param {integer} index - The index in the AnimationFrame array + * + * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence + */ + getFrameAt: function (index) + { + return this.frames[index]; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFrames + * @since 3.0.0 + * + * @param {Phaser.Textures.TextureManager} textureManager - [description] + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} frames - [description] + * @param {string} [defaultTextureKey] - [description] + * + * @return {Phaser.Animations.AnimationFrame[]} [description] + */ + getFrames: function (textureManager, frames, defaultTextureKey) + { + 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.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.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 + + // When is the next update due? + component.accumulator -= component.nextTick; + + component.nextTick = component.msPerFrame + component.currentFrame.duration; + }, + + /** + * Loads the Animation values into the Animation Component. + * + * @method Phaser.Animations.Animation#load + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to load values into. + * @param {integer} startFrame - The start frame of the animation to load. + */ + load: function (component, startFrame) + { + if (startFrame >= this.frames.length) + { + startFrame = 0; + } + + if (component.currentAnim !== this) + { + component.currentAnim = this; + + 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; + } + + var frame = this.frames[startFrame]; + + if (startFrame === 0 && !component.forward) + { + frame = this.getLastFrame(); + } + + component.updateFrame(frame); + }, + + /** + * Returns the frame closest to the given progress value between 0 and 1. + * + * @method Phaser.Animations.Animation#getFrameByProgress + * @since 3.4.0 + * + * @param {number} value - A value between 0 and 1. + * + * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. + */ + getFrameByProgress: function (value) + { + value = Clamp(value, 0, 1); + + return FindClosestInSorted(value, this.frames, 'progress'); + }, + + /** + * Advance the animation frame. + * + * @method Phaser.Animations.Animation#nextFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + */ + nextFrame: function (component) + { + var frame = component.currentFrame; + + // TODO: Add frame skip support + + if (frame.isLast) + { + // We're at the end of the animation + + // Yoyo? (happens before repeat) + if (component._yoyo) + { + this.handleYoyoFrame(component, false); + } + else if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + + if (component._reverse && component.forward) + { + component.forward = false; + } + else + { + this.repeatAnimation(component); + } + } + else + { + this.completeAnimation(component); + } + } + else + { + this.updateAndGetNextTick(component, frame.nextFrame); + } + }, + + /** + * Handle the yoyo functionality in nextFrame and previousFrame methods. + * + * @method Phaser.Animations.Animation#handleYoyoFrame + * @private + * @since 3.12.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) + */ + handleYoyoFrame: function (component, isReverse) + { + if (!isReverse) { isReverse = false; } + + if (component._reverse === !isReverse && component.repeatCounter > 0) + { + component.forward = isReverse; + + this.repeatAnimation(component); + + return; + } + + if (component._reverse !== isReverse && component.repeatCounter === 0) + { + this.completeAnimation(component); + + return; + } + + component.forward = isReverse; + + var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; + + this.updateAndGetNextTick(component, frame); + }, + + /** + * Returns the animation last frame. + * + * @method Phaser.Animations.Animation#getLastFrame + * @since 3.12.0 + * + * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. + */ + getLastFrame: function () + { + return this.frames[this.frames.length - 1]; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#previousFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + previousFrame: function (component) + { + var frame = component.currentFrame; + + // TODO: Add frame skip support + + if (frame.isFirst) + { + // We're at the start of the animation + + if (component._yoyo) + { + this.handleYoyoFrame(component, true); + } + else if (component.repeatCounter > 0) + { + if (component._reverse && !component.forward) + { + component.currentFrame = this.getLastFrame(); + this.repeatAnimation(component); + } + else + { + // Repeat (happens before complete) + component.forward = true; + this.repeatAnimation(component); + } + } + else + { + this.completeAnimation(component); + } + } + else + { + this.updateAndGetNextTick(component, frame.prevFrame); + } + }, + + /** + * Update Frame and Wait next tick. + * + * @method Phaser.Animations.Animation#updateAndGetNextTick + * @private + * @since 3.12.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. + */ + updateAndGetNextTick: function (component, frame) + { + component.updateFrame(frame); + + this.getNextTick(component); + }, + + /** + * [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); + } + + return this; + }, + + /** + * Removes a frame from the AnimationFrame array at the provided index + * and updates the animation accordingly. + * + * @method Phaser.Animations.Animation#removeFrameAt + * @since 3.0.0 + * + * @param {integer} index - The index in the AnimationFrame array + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + removeFrameAt: function (index) + { + this.frames.splice(index, 1); + + this.updateFrameSequence(); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#repeatAnimation + * @fires Phaser.Animations.Events#ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + repeatAnimation: function (component) + { + if (component._pendingStop === 2) + { + return this.completeAnimation(component); + } + + if (component._repeatDelay > 0 && component.pendingRepeat === false) + { + component.pendingRepeat = true; + component.accumulator -= component.nextTick; + component.nextTick += component._repeatDelay; + } + else + { + component.repeatCounter--; + + component.updateFrame(component.currentFrame[(component.forward) ? 'nextFrame' : 'prevFrame']); + + if (component.isPlaying) + { + this.getNextTick(component); + + component.pendingRepeat = false; + + var frame = component.currentFrame; + var parent = component.parent; + + this.emit(Events.ANIMATION_REPEAT, this, frame); + + parent.emit(Events.SPRITE_ANIMATION_KEY_REPEAT + this.key, this, frame, component.repeatCounter, parent); + + parent.emit(Events.SPRITE_ANIMATION_REPEAT, this, frame, component.repeatCounter, parent); + } + } + }, + + /** + * Sets the texture frame the animation uses for rendering. + * + * @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); + } + }, + + /** + * Converts the animation data to JSON. + * + * @method Phaser.Animations.Animation#toJSON + * @since 3.0.0 + * + * @return {Phaser.Animations.Types.JSONAnimation} [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; + }, + + /** + * [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); + + 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; + }, + + /** + * [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 () + { + this.removeAllListeners(); + + this.manager.off(Events.PAUSE_ALL, this.pause, this); + this.manager.off(Events.RESUME_ALL, this.resume, this); + + this.manager.remove(this.key); + + for (var i = 0; i < this.frames.length; i++) + { + this.frames[i].destroy(); + } + + this.frames = []; + + this.manager = null; + } + +}); + +module.exports = Animation; + + +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39411,12 +41583,12 @@ module.exports = Random; /***/ }), -/* 192 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39450,12 +41622,12 @@ module.exports = CircumferencePoint; /***/ }), -/* 193 */ +/* 208 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39584,27 +41756,27 @@ module.exports = ALIGN_CONST; /***/ }), -/* 194 */, -/* 195 */, -/* 196 */ +/* 209 */, +/* 210 */, +/* 211 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); +var Earcut = __webpack_require__(71); var GetFastValue = __webpack_require__(2); -var ModelViewProjection = __webpack_require__(894); -var ShaderSourceFS = __webpack_require__(893); -var ShaderSourceVS = __webpack_require__(892); -var TransformMatrix = __webpack_require__(38); -var Utils = __webpack_require__(10); -var WebGLPipeline = __webpack_require__(197); +var ModelViewProjection = __webpack_require__(1041); +var ShaderSourceFS = __webpack_require__(1040); +var ShaderSourceVS = __webpack_require__(1039); +var TransformMatrix = __webpack_require__(41); +var Utils = __webpack_require__(9); +var WebGLPipeline = __webpack_require__(212); /** * @classdesc @@ -39626,7 +41798,7 @@ var WebGLPipeline = __webpack_require__(197); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration options for this Texture Tint Pipeline, as described above. */ var TextureTintPipeline = new Class({ @@ -39869,11 +42041,6 @@ var TextureTintPipeline = new Class({ this.mvpUpdate(); - if (this.batches.length === 0) - { - this.pushBatch(); - } - return this; }, @@ -39899,58 +42066,56 @@ var TextureTintPipeline = new Class({ }, /** - * Assigns a texture to the current batch. If a texture is already set it creates - * a new batch object. + * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. * * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#setTexture2D * @since 3.1.0 * - * @param {WebGLTexture} texture - WebGLTexture that will be assigned to the current batch. - * @param {integer} textureUnit - Texture unit to which the texture needs to be bound. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline} This pipeline instance. */ setTexture2D: function (texture, unit) { - if (!texture) + if (texture === undefined) { texture = this.renderer.blankTexture.glTexture; } + if (unit === undefined) { unit = 0; } + + if (this.requireTextureBatch(texture, unit)) { - texture = this.renderer.blankTexture.glTexture; - unit = 0; - } - - var batches = this.batches; - - if (batches.length === 0) - { - this.pushBatch(); - } - - var batch = batches[batches.length - 1]; - - if (unit > 0) - { - if (batch.textures[unit - 1] && - batch.textures[unit - 1] !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].textures[unit - 1] = texture; - } - else - { - if (batch.texture !== null && - batch.texture !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].texture = texture; + this.pushBatch(texture, unit); } return this; }, + /** + * Checks if the current batch has the same texture and texture unit, or if we need to create a new batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#requireTextureBatch + * @since 3.16.0 + * + * @param {WebGLTexture} texture - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {integer} unit - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if the pipeline needs to create a new batch, otherwise `false`. + */ + requireTextureBatch: function (texture, unit) + { + var batches = this.batches; + var batchLength = batches.length; + + if (batchLength > 0) + { + // If Texture Unit specified, we get the texture from the textures array, otherwise we use the texture property + var currentTexture = (unit > 0) ? batches[batchLength - 1].textures[unit - 1] : batches[batchLength - 1].texture; + + return !(currentTexture === texture); + } + + return true; + }, + /** * Creates a new batch object and pushes it to a batch array. * The batch object contains information relevant to the current @@ -39959,16 +42124,32 @@ var TextureTintPipeline = new Class({ * * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#pushBatch * @since 3.1.0 + * + * @param {WebGLTexture} texture - Optional WebGLTexture that will be assigned to the created batch. + * @param {integer} unit - Texture unit to which the texture needs to be bound. */ - pushBatch: function () + pushBatch: function (texture, unit) { - var batch = { - first: this.vertexCount, - texture: null, - textures: [] - }; + if (unit === 0) + { + this.batches.push({ + first: this.vertexCount, + texture: texture, + textures: [] + }); + } + else + { + var textures = []; - this.batches.push(batch); + textures[unit - 1] = texture; + + this.batches.push({ + first: this.vertexCount, + texture: null, + textures: textures + }); + } }, /** @@ -40011,11 +42192,14 @@ var TextureTintPipeline = new Class({ gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - for (var index = 0; index < batches.length - 1; index++) + // Process the TEXTURE BATCHES + + for (var index = 0; index < batchCount - 1; index++) { batch = batches[index]; batchNext = batches[index + 1]; + // Multi-texture check (for non-zero texture units) if (batch.textures.length > 0) { for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) @@ -40024,7 +42208,7 @@ var TextureTintPipeline = new Class({ if (nTexture) { - renderer.setTexture2D(nTexture, 1 + textureIndex); + renderer.setTexture2D(nTexture, 1 + textureIndex, false); } } @@ -40033,18 +42217,21 @@ var TextureTintPipeline = new Class({ batchVertexCount = batchNext.first - batch.first; + // Bail out if texture property is null (i.e. if a texture unit > 0) if (batch.texture === null || batchVertexCount <= 0) { continue; } - renderer.setTexture2D(batch.texture, 0); + renderer.setTexture2D(batch.texture, 0, false); gl.drawArrays(topology, batch.first, batchVertexCount); } // Left over data - batch = batches[batches.length - 1]; + batch = batches[batchCount - 1]; + + // Multi-texture check (for non-zero texture units) if (batch.textures.length > 0) { @@ -40054,7 +42241,7 @@ var TextureTintPipeline = new Class({ if (nTexture) { - renderer.setTexture2D(nTexture, 1 + textureIndex); + renderer.setTexture2D(nTexture, 1 + textureIndex, false); } } @@ -40065,7 +42252,7 @@ var TextureTintPipeline = new Class({ if (batch.texture && batchVertexCount > 0) { - renderer.setTexture2D(batch.texture, 0); + renderer.setTexture2D(batch.texture, 0, false); gl.drawArrays(topology, batch.first, batchVertexCount); } @@ -40074,8 +42261,6 @@ var TextureTintPipeline = new Class({ batches.length = 0; - this.pushBatch(); - this.flushLocked = false; return this; @@ -40093,6 +42278,7 @@ var TextureTintPipeline = new Class({ */ batchSprite: function (sprite, camera, parentTransformMatrix) { + // Will cause a flush if there are batchSize entries already this.renderer.setPipeline(this); var camMatrix = this._tempMatrix1; @@ -40197,24 +42383,24 @@ var TextureTintPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); var tintEffect = (sprite._isTinted && sprite.tintFill); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -40254,10 +42440,12 @@ var TextureTintPipeline = new Class({ * @param {number} tintBL - The bottom-left tint color value. * @param {number} tintBR - The bottom-right tint color value. * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect) + batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) { var hasFlushed = false; @@ -40266,6 +42454,8 @@ var TextureTintPipeline = new Class({ this.flush(); hasFlushed = true; + + this.setTexture2D(texture, unit); } var vertexViewF32 = this.vertexViewF32; @@ -40352,10 +42542,12 @@ var TextureTintPipeline = new Class({ * @param {number} tintTR - The top-right tint color value. * @param {number} tintBL - The bottom-left tint color value. * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect) + batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) { var hasFlushed = false; @@ -40363,6 +42555,8 @@ var TextureTintPipeline = new Class({ { this.flush(); + this.setTexture2D(texture, unit); + hasFlushed = true; } @@ -40562,22 +42756,22 @@ var TextureTintPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -40635,7 +42829,7 @@ var TextureTintPipeline = new Class({ tint = Utils.getTintAppendFloatAlpha(tint, alpha); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, 0); }, /** @@ -40658,6 +42852,8 @@ var TextureTintPipeline = new Class({ var xw = x + width; var yh = y + height; + this.setTexture2D(); + var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); this.batchQuad(x, y, x, yh, xw, yh, xw, y, 0, 0, 1, 1, tint, tint, tint, tint, 2); @@ -41054,18 +43250,18 @@ module.exports = TextureTintPipeline; /***/ }), -/* 197 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(10); +var Utils = __webpack_require__(9); /** * @classdesc @@ -41104,7 +43300,7 @@ var Utils = __webpack_require__(10); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for this WebGL Pipeline, as described above. */ var WebGLPipeline = new Class({ @@ -41122,7 +43318,7 @@ var WebGLPipeline = new Class({ this.name = 'WebGLPipeline'; /** - * [description] + * The Game which owns this WebGL Pipeline. * * @name Phaser.Renderer.WebGL.WebGLPipeline#game * @type {Phaser.Game} @@ -41131,7 +43327,7 @@ var WebGLPipeline = new Class({ this.game = config.game; /** - * [description] + * The canvas which this WebGL Pipeline renders to. * * @name Phaser.Renderer.WebGL.WebGLPipeline#view * @type {HTMLCanvasElement} @@ -41146,7 +43342,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.resolution = config.game.config.resolution; + this.resolution = 1; /** * Width of the current viewport @@ -41155,7 +43351,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.width = config.game.config.width * this.resolution; + this.width = 0; /** * Height of the current viewport @@ -41164,10 +43360,10 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.height = config.game.config.height * this.resolution; + this.height = 0; /** - * [description] + * The WebGL context this WebGL Pipeline uses. * * @name Phaser.Renderer.WebGL.WebGLPipeline#gl * @type {WebGLRenderingContext} @@ -41195,7 +43391,7 @@ var WebGLPipeline = new Class({ this.vertexCapacity = config.vertexCapacity; /** - * [description] + * The WebGL Renderer which owns this WebGL Pipeline. * * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer * @type {Phaser.Renderer.WebGL.WebGLRenderer} @@ -41343,7 +43539,7 @@ var WebGLPipeline = new Class({ * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush * @since 3.0.0 * - * @return {boolean} [description] + * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. */ shouldFlush: function () { @@ -41356,9 +43552,9 @@ var WebGLPipeline = new Class({ * @method Phaser.Renderer.WebGL.WebGLPipeline#resize * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * @param {number} resolution - The resolution this WebGL Pipeline should be resized to. * * @return {this} This WebGLPipeline instance. */ @@ -41366,6 +43562,7 @@ var WebGLPipeline = new Class({ { this.width = width * resolution; this.height = height * resolution; + this.resolution = resolution; return this; }, @@ -41410,7 +43607,9 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Set whenever this WebGL Pipeline is bound to a WebGL Renderer. + * + * This method is called every time the WebGL Pipeline is attempted to be bound, even if it already is the current pipeline. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind * @since 3.0.0 @@ -41424,7 +43623,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called before each frame is rendered, but after the canvas has been cleared. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender * @since 3.0.0 @@ -41438,13 +43637,13 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called before a Scene's Camera is rendered. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. */ @@ -41455,7 +43654,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called after each frame has been completely rendered and snapshots have been taken. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender * @since 3.0.0 @@ -41504,7 +43703,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Removes all object references in this WebGL Pipeline and removes its program from the WebGL context. * * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy * @since 3.0.0 @@ -41532,7 +43731,7 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] + * @param {number} x - The new value of the `float` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41550,8 +43749,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41569,9 +43768,9 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} z - [description] + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41682,7 +43881,7 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] + * @param {integer} x - The new value of the `int` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41700,8 +43899,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] + * @param {integer} x - The new X component of the `ivec2` uniform. + * @param {integer} y - The new Y component of the `ivec2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41719,9 +43918,9 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] + * @param {integer} x - The new X component of the `ivec3` uniform. + * @param {integer} y - The new Y component of the `ivec3` uniform. + * @param {integer} z - The new Z component of the `ivec3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41760,8 +43959,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41779,8 +43978,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -41816,16 +44015,16 @@ module.exports = WebGLPipeline; /***/ }), -/* 198 */ +/* 213 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * Wrap an angle in degrees. @@ -41848,16 +44047,16 @@ module.exports = WrapDegrees; /***/ }), -/* 199 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathWrap = __webpack_require__(53); +var MathWrap = __webpack_require__(57); /** * Wrap an angle. @@ -41880,7 +44079,7 @@ module.exports = Wrap; /***/ }), -/* 200 */ +/* 215 */ /***/ (function(module, exports) { var g; @@ -41906,23 +44105,52 @@ module.exports = g; /***/ }), -/* 201 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tweens.Events + */ + +module.exports = { + + TIMELINE_COMPLETE: __webpack_require__(475), + TIMELINE_LOOP: __webpack_require__(474), + TIMELINE_PAUSE: __webpack_require__(473), + TIMELINE_RESUME: __webpack_require__(472), + TIMELINE_START: __webpack_require__(471), + TIMELINE_UPDATE: __webpack_require__(470) + +}; + + +/***/ }), +/* 217 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(11); -var TweenBuilder = __webpack_require__(97); -var TWEEN_CONST = __webpack_require__(83); +var Events = __webpack_require__(216); +var TweenBuilder = __webpack_require__(104); +var TWEEN_CONST = __webpack_require__(89); /** * @classdesc - * [description] + * A Timeline combines multiple Tweens into one. Its overall behavior is otherwise similar to a single Tween. + * + * The Timeline updates all of its Tweens simultaneously. Its methods allow you to easily build a sequence of Tweens (each one starting after the previous one) or run multiple Tweens at once during given parts of the Timeline. * * @class Timeline * @memberof Phaser.Tweens @@ -41930,7 +44158,7 @@ var TWEEN_CONST = __webpack_require__(83); * @constructor * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] + * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager which owns this Timeline. */ var Timeline = new Class({ @@ -41943,7 +44171,7 @@ var Timeline = new Class({ EventEmitter.call(this); /** - * [description] + * The Tween Manager which owns this Timeline. * * @name Phaser.Tweens.Timeline#manager * @type {Phaser.Tweens.TweenManager} @@ -41952,7 +44180,7 @@ var Timeline = new Class({ this.manager = manager; /** - * [description] + * A constant value which allows this Timeline to be easily identified as one. * * @name Phaser.Tweens.Timeline#isTimeline * @type {boolean} @@ -42253,14 +44481,14 @@ var Timeline = new Class({ }, /** - * [description] + * Checks whether the offset value is a number or a directive that is relative to previous tweens. * * @method Phaser.Tweens.Timeline#isOffsetAbsolute * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The offset value to be evaluated * - * @return {boolean} [description] + * @return {boolean} True if the result is a number, false if it is a directive like " -= 1000" */ isOffsetAbsolute: function (value) { @@ -42268,14 +44496,14 @@ var Timeline = new Class({ }, /** - * [description] + * Checks if the offset is a relative value rather than an absolute one. If the value is just a number, this returns false. * * @method Phaser.Tweens.Timeline#isOffsetRelative * @since 3.0.0 * - * @param {string} value - [description] + * @param {string} value - The offset value to be evaluated * - * @return {boolean} [description] + * @return {boolean} Returns true if the value is relative, i.e " -= 1000". If false, the offset is absolute. */ isOffsetRelative: function (value) { @@ -42295,15 +44523,15 @@ var Timeline = new Class({ }, /** - * [description] + * Parses the relative offset value, returning a positive or negative number. * * @method Phaser.Tweens.Timeline#getRelativeOffset * @since 3.0.0 * - * @param {string} value - [description] - * @param {number} base - [description] + * @param {string} value - The relative offset, in the format of '-=500', for example. The first character determines whether it will be a positive or negative number. Spacing matters here. + * @param {number} base - The value to use as the offset. * - * @return {number} [description] + * @return {number} The returned number value. */ getRelativeOffset: function (value, base) { @@ -42327,7 +44555,7 @@ var Timeline = new Class({ }, /** - * [description] + * Calculates the total duration of the timeline. Computes all tween's durations and returns the full duration of the timeline. The resulting number is stored in the timeline, not as a return value. * * @method Phaser.Tweens.Timeline#calcDuration * @since 3.0.0 @@ -42390,12 +44618,12 @@ var Timeline = new Class({ }, /** - * [description] + * Initializes the timeline, which means all Tweens get their init() called, and the total duration will be computed. Returns a boolean indicating whether the timeline is auto-started or not. * * @method Phaser.Tweens.Timeline#init * @since 3.0.0 * - * @return {boolean} [description] + * @return {boolean} Returns true if the timeline is started. False if it is paused. */ init: function () { @@ -42417,12 +44645,12 @@ var Timeline = new Class({ }, /** - * [description] + * Resets all of the timeline's tweens back to their initial states. The boolean parameter indicates whether tweens that are looping should reset as well, or not. * * @method Phaser.Tweens.Timeline#resetTweens * @since 3.0.0 * - * @param {boolean} resetFromLoop - [description] + * @param {boolean} resetFromLoop - If true, resets all looping tweens to their initial values. */ resetTweens: function (resetFromLoop) { @@ -42435,15 +44663,15 @@ var Timeline = new Class({ }, /** - * Sets a callback for the Tween Manager. + * Sets a callback for the Timeline. * * @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] + * @param {string} type - The internal type of callback to set. + * @param {function} callback - Timeline allows multiple tweens to be linked together to create a streaming sequence. + * @param {array} [params] - The parameters to pass to the callback. + * @param {object} [scope] - The context scope of the callback. * * @return {Phaser.Tweens.Timeline} This Timeline object. */ @@ -42473,9 +44701,10 @@ var Timeline = new Class({ }, /** - * [description] + * Starts playing the timeline. * * @method Phaser.Tweens.Timeline#play + * @fires Phaser.Tweens.Events#TIMELINE_START * @since 3.0.0 */ play: function () @@ -42507,13 +44736,15 @@ var Timeline = new Class({ onStart.func.apply(onStart.scope, onStart.params); } - this.emit('start', this); + this.emit(Events.TIMELINE_START, this); }, /** * [description] * * @method Phaser.Tweens.Timeline#nextState + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_LOOP * @since 3.0.0 */ nextState: function () @@ -42536,7 +44767,7 @@ var Timeline = new Class({ onLoop.func.apply(onLoop.scope, onLoop.params); } - this.emit('loop', this, this.loopCounter); + this.emit(Events.TIMELINE_LOOP, this, this.loopCounter); this.resetTweens(true); @@ -42557,6 +44788,8 @@ var Timeline = new Class({ } else { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -42564,9 +44797,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } }, @@ -42575,6 +44806,8 @@ var Timeline = new Class({ * Otherwise, returns false. * * @method Phaser.Tweens.Timeline#update + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_UPDATE * @since 3.0.0 * * @param {number} timestamp - [description] @@ -42627,7 +44860,7 @@ var Timeline = new Class({ onUpdate.func.apply(onUpdate.scope, onUpdate.params); } - this.emit('update', this); + this.emit(Events.TIMELINE_UPDATE, this); // Anything still running? If not, we're done if (stillRunning === 0) @@ -42654,6 +44887,8 @@ var Timeline = new Class({ if (this.countdown <= 0) { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -42661,9 +44896,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } break; @@ -42684,9 +44917,10 @@ var Timeline = new Class({ }, /** - * [description] + * Pauses the timeline, retaining its internal state. * * @method Phaser.Tweens.Timeline#pause + * @fires Phaser.Tweens.Events#TIMELINE_PAUSE * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -42704,15 +44938,16 @@ var Timeline = new Class({ this.state = TWEEN_CONST.PAUSED; - this.emit('pause', this); + this.emit(Events.TIMELINE_PAUSE, this); return this; }, /** - * [description] + * Resumes the timeline from where it was when it was paused. * * @method Phaser.Tweens.Timeline#resume + * @fires Phaser.Tweens.Events#TIMELINE_RESUME * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -42726,20 +44961,20 @@ var Timeline = new Class({ this.state = this._pausedState; } - this.emit('resume', this); + this.emit(Events.TIMELINE_RESUME, this); return this; }, /** - * [description] + * Checks if any of the tweens has the target as the object they are operating on. Retuns false if no tweens operate on the target object. * * @method Phaser.Tweens.Timeline#hasTarget * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - The target to check all tweens against. * - * @return {boolean} [description] + * @return {boolean} True if there at least a single tween that operates on the target object. False otherwise. */ hasTarget: function (target) { @@ -42776,37 +45011,66 @@ module.exports = Timeline; /***/ }), -/* 202 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); -var Defaults = __webpack_require__(129); +var Clone = __webpack_require__(70); +var Defaults = __webpack_require__(141); var GetAdvancedValue = __webpack_require__(12); -var GetBoolean = __webpack_require__(84); -var GetEaseFunction = __webpack_require__(86); -var GetNewValue = __webpack_require__(98); -var GetTargets = __webpack_require__(131); -var GetTweens = __webpack_require__(204); +var GetBoolean = __webpack_require__(90); +var GetEaseFunction = __webpack_require__(92); +var GetNewValue = __webpack_require__(105); +var GetTargets = __webpack_require__(143); +var GetTweens = __webpack_require__(220); var GetValue = __webpack_require__(4); -var Timeline = __webpack_require__(201); -var TweenBuilder = __webpack_require__(97); +var Timeline = __webpack_require__(217); +var TweenBuilder = __webpack_require__(104); /** - * [description] + * Builds a Timeline of Tweens based on a configuration object. + * + * The configuration object (`config`) can have the following properties: + * + * `tweens` - an array of tween configuration objects to create and add into the new Timeline, as described by `TweenBuilder`. If this doesn't exist or is empty, the Timeline will start off paused and none of the other configuration settings will be read. If it's a function, it will be called and its return value will be used as the array. + * `targets` - an array (or function which returns one) of default targets to which to apply the Timeline. Each individual Tween configuration can override this value. + * `totalDuration` - if specified, each Tween in the Timeline will get an equal portion of this duration, usually in milliseconds, by default. Each individual Tween configuration can override the Tween's duration. + * `duration` - if `totalDuration` is not specified, the default duration, usually in milliseconds, of each Tween which will be created. Each individual Tween configuration can override the Tween's duration. + * `delay`, `easeParams`, `ease`, `hold`, `repeat`, `repeatDelay`, `yoyo`, `flipX`, `flipY` - the default settings for each Tween which will be created, as specified by `TweenBuilder`. Each individual Tween configuration can override any of these values. + * `completeDelay` - if specified, the time to wait, usually in milliseconds, before the Timeline completes. + * `loop` - how many times the Timeline should loop, or -1 to loop indefinitely. + * `loopDelay` - the time, usually in milliseconds, between each loop + * `paused` - if `true`, the Timeline will start paused + * `useFrames` - if `true`, all duration in the Timeline will be in frames instead of milliseconds + * `callbackScope` - the default scope (`this` value) to use for each callback registered by the Timeline Builder. If not specified, the Timeline itself will be used. + * `onStart` - if specified, the `onStart` callback for the Timeline, called every time it starts playing + * `onStartScope` - the scope (`this` value) to use for the `onStart` callback. If not specified, the `callbackScope` will be used. + * `onStartParams` - additional arguments to pass to the `onStart` callback. The Timeline will always be the first argument. + * `onUpdate` - if specified, the `onUpdate` callback for the Timeline, called every frame it's active, regardless of its Tweens + * `onUpdateScope` - the scope (`this` value) to use for the `onUpdate` callback. If not specified, the `callbackScope` will be used. + * `onUpdateParams` - additional arguments to pass to the `onUpdate` callback. The Timeline will always be the first argument. + * `onLoop` - if specified, the `onLoop` callback for the Timeline, called every time it loops + * `onLoopScope` - the scope (`this` value) to use for the `onLoop` callback. If not specified, the `callbackScope` will be used. + * `onLoopParams` - additional arguments to pass to the `onLoop` callback. The Timeline will always be the first argument. + * `onYoyo` - if specified, the `onYoyo` callback for the Timeline, called every time it yoyos + * `onYoyoScope` - the scope (`this` value) to use for the `onYoyo` callback. If not specified, the `callbackScope` will be used. + * `onYoyoParams` - additional arguments to pass to the `onYoyo` callback. The first argument will always be `null`, while the Timeline will always be the second argument. + * `onComplete` - if specified, the `onComplete` callback for the Timeline, called after it completes + * `onCompleteScope` - the scope (`this` value) to use for the `onComplete` callback. If not specified, the `callbackScope` will be used. + * `onCompleteParams` - additional arguments to pass to the `onComplete` callback. The Timeline will always be the first argument. * * @function Phaser.Tweens.Builders.TimelineBuilder * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] - * @param {object} config - [description] + * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager to which the Timeline will belong. + * @param {object} config - The configuration object for the Timeline, as described above. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline. */ var TimelineBuilder = function (manager, config) { @@ -42928,24 +45192,24 @@ module.exports = TimelineBuilder; /***/ }), -/* 203 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(129); +var Defaults = __webpack_require__(141); var GetAdvancedValue = __webpack_require__(12); -var GetBoolean = __webpack_require__(84); -var GetEaseFunction = __webpack_require__(86); -var GetNewValue = __webpack_require__(98); +var GetBoolean = __webpack_require__(90); +var GetEaseFunction = __webpack_require__(92); +var GetNewValue = __webpack_require__(105); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(130); -var Tween = __webpack_require__(128); -var TweenData = __webpack_require__(127); +var GetValueOp = __webpack_require__(142); +var Tween = __webpack_require__(140); +var TweenData = __webpack_require__(139); /** * [description] @@ -43056,19 +45320,19 @@ module.exports = NumberTweenBuilder; /***/ }), -/* 204 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); /** - * [description] + * Returns an array of all tweens in the given config * * @function Phaser.Tweens.Builders.GetTweens * @since 3.0.0 @@ -43102,16 +45366,16 @@ module.exports = GetTweens; /***/ }), -/* 205 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RESERVED = __webpack_require__(437); +var RESERVED = __webpack_require__(476); /** * [description] @@ -43160,12 +45424,12 @@ module.exports = GetProps; /***/ }), -/* 206 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -43175,27 +45439,29 @@ var GetFastValue = __webpack_require__(2); /** * @typedef {object} TimerEventConfig * - * @property {number} [delay=0] - [description] - * @property {number} [repeat=0] - [description] - * @property {boolean} [loop=false] - [description] - * @property {function} [callback] - [description] - * @property {*} [callbackScope] - [description] - * @property {Array.<*>} [args] - [description] - * @property {number} [timeScale=1] - [description] - * @property {number} [startAt=1] - [description] - * @property {boolean} [paused=false] - [description] + * @property {number} [delay=0] - The delay after which the Timer Event should fire, in milliseconds. + * @property {number} [repeat=0] - The total number of times the Timer Event will repeat before finishing. + * @property {boolean} [loop=false] - `true` if the Timer Event should repeat indefinitely. + * @property {function} [callback] - The callback which will be called when the Timer Event fires. + * @property {*} [callbackScope] - The scope (`this` object) with which to invoke the `callback`. + * @property {Array.<*>} [args] - Additional arguments to be passed to the `callback`. + * @property {number} [timeScale=1] - The scale of the elapsed time. + * @property {number} [startAt=1] - The initial elapsed time in milliseconds. Useful if you want a long duration with repeat, but for the first loop to fire quickly. + * @property {boolean} [paused=false] - `true` if the Timer Event should be paused. */ /** * @classdesc - * [description] + * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. + * + * Because it's managed by a Clock, a Timer Event is based on game time, will be affected by its Clock's time scale, and will pause if its Clock pauses. * * @class TimerEvent * @memberof Phaser.Time * @constructor * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. */ var TimerEvent = new Class({ @@ -43294,7 +45560,9 @@ var TimerEvent = new Class({ this.startAt = 0; /** - * [description] + * The time in milliseconds which has elapsed since the Timer Event's creation. + * + * This value is local for the Timer Event and is relative to its Clock. As such, it's influenced by the Clock's time scale and paused state, the Timer Event's initial {@link #startAt} property, and the Timer Event's {@link #timeScale} and {@link #paused} state. * * @name Phaser.Time.TimerEvent#elapsed * @type {number} @@ -43304,7 +45572,7 @@ var TimerEvent = new Class({ this.elapsed = 0; /** - * [description] + * Whether or not this timer is paused. * * @name Phaser.Time.TimerEvent#paused * @type {boolean} @@ -43314,7 +45582,9 @@ var TimerEvent = new Class({ this.paused = false; /** - * [description] + * Whether the Timer Event's function has been called. + * + * When the Timer Event fires, this property will be set to `true` before the callback function is invoked and will be reset immediately afterward if the Timer Event should repeat. The value of this property does not directly influence whether the Timer Event will be removed from its Clock, but can prevent it from firing. * * @name Phaser.Time.TimerEvent#hasDispatched * @type {boolean} @@ -43327,12 +45597,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Completely reinitializes the Timer Event, regardless of its current state, according to a configuration object. * * @method Phaser.Time.TimerEvent#reset * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The new state for the Timer Event. * * @return {Phaser.Time.TimerEvent} This TimerEvent object. */ @@ -43370,7 +45640,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#getProgress * @since 3.0.0 * - * @return {number} [description] + * @return {number} A number between 0 and 1 representing the current progress. */ getProgress: function () { @@ -43383,7 +45653,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#getOverallProgress * @since 3.0.0 * - * @return {number} [description] + * @return {number} The overall progress of the Timer Event, between 0 and 1. */ getOverallProgress: function () { @@ -43401,12 +45671,14 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the number of times this Timer Event will repeat before finishing. + * + * This should not be confused with the number of times the Timer Event will fire before finishing. A return value of 0 doesn't indicate that the Timer Event has finished running - it indicates that it will not repeat after the next time it fires. * * @method Phaser.Time.TimerEvent#getRepeatCount * @since 3.0.0 * - * @return {number} [description] + * @return {number} How many times the Timer Event will repeat. */ getRepeatCount: function () { @@ -43414,12 +45686,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the local elapsed time for the current iteration of the Timer Event. * * @method Phaser.Time.TimerEvent#getElapsed * @since 3.0.0 * - * @return {number} [description] + * @return {number} The local elapsed time in milliseconds. */ getElapsed: function () { @@ -43427,12 +45699,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the local elapsed time for the current iteration of the Timer Event in seconds. * * @method Phaser.Time.TimerEvent#getElapsedSeconds * @since 3.0.0 * - * @return {number} [description] + * @return {number} The local elapsed time in seconds. */ getElapsedSeconds: function () { @@ -43440,12 +45712,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. * * @method Phaser.Time.TimerEvent#remove * @since 3.0.0 * - * @param {function} dispatchCallback - [description] + * @param {boolean} [dispatchCallback] - If `true` (by default `false`), the function of the Timer Event will be called before its removal from its Clock. */ remove: function (dispatchCallback) { @@ -43459,7 +45731,9 @@ var TimerEvent = new Class({ }, /** - * [description] + * Destroys all object references in the Timer Event, i.e. its callback, scope, and arguments. + * + * Normally, this method is only called by the Clock when it shuts down. As such, it doesn't stop the Timer Event. If called manually, the Timer Event will still be updated by the Clock, but it won't do anything when it fires. * * @method Phaser.Time.TimerEvent#destroy * @since 3.0.0 @@ -43477,23 +45751,23 @@ module.exports = TimerEvent; /***/ }), -/* 207 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var CONST = __webpack_require__(26); -var GameObject = __webpack_require__(19); -var StaticTilemapLayerRender = __webpack_require__(446); -var TilemapComponents = __webpack_require__(103); -var TransformMatrix = __webpack_require__(38); -var Utils = __webpack_require__(10); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var GameObject = __webpack_require__(18); +var StaticTilemapLayerRender = __webpack_require__(485); +var TilemapComponents = __webpack_require__(110); +var TransformMatrix = __webpack_require__(41); +var Utils = __webpack_require__(9); /** * @classdesc @@ -43697,9 +45971,9 @@ var StaticTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -43837,7 +46111,7 @@ var StaticTilemapLayer = new Class({ this.setAlpha(this.layer.alpha); this.setPosition(x, y); this.setOrigin(); - this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); this.updateVBOData(); @@ -44078,8 +46352,8 @@ var StaticTilemapLayer = new Class({ * @param {integer} vOffset - The vertex offset. * @param {any} tile - The tile being rendered. * @param {any} tileset - The tileset being used for rendering. - * @param {integer} width - The width of the layer. - * @param {integer} height - The height of the layer. + * @param {integer} width - The width of the tileset image in pixels. + * @param {integer} height - The height of the tileset image in pixels. * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the layer is being rendered with. * @param {integer} tilesetIndex - The tileset index. * @@ -44094,32 +46368,32 @@ var StaticTilemapLayer = new Class({ return vOffset; } - var u0 = texCoords.x / width; - var v0 = texCoords.y / height; - var u1 = (texCoords.x + tile.width) / width; - var v1 = (texCoords.y + tile.height) / height; - - var matrix = this._tempMatrix; - - var tileWidth = tile.width; - var tileHeight = tile.height; + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; var halfTileWidth = tileWidth / 2; var halfTileHeight = tileHeight / 2; + var u0 = texCoords.x / width; + var v0 = texCoords.y / height; + var u1 = (texCoords.x + tileWidth) / width; + var v1 = (texCoords.y + tileHeight) / height; + + var matrix = this._tempMatrix; + var x = -halfTileWidth; var y = -halfTileHeight; if (tile.flipX) { tileWidth *= -1; - x += tile.width; + x += tileset.tileWidth; } if (tile.flipY) { tileHeight *= -1; - y += tile.height; + y += tileset.tileHeight; } var xw = x + tileWidth; @@ -44143,17 +46417,17 @@ var StaticTilemapLayer = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } var vertexViewF32 = this.vertexViewF32[tilesetIndex]; @@ -44281,10 +46555,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesWithin * @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 {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -44421,17 +46695,11 @@ var StaticTilemapLayer = new Class({ * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -44452,17 +46720,11 @@ var StaticTilemapLayer = new Class({ * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -44481,17 +46743,11 @@ var StaticTilemapLayer = new Class({ * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -44530,7 +46786,7 @@ var StaticTilemapLayer = new Class({ * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile * object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates * were invalid. @@ -44546,17 +46802,11 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithin * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -44571,18 +46821,12 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinWorldXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {number} worldX - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} worldY - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles high from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -44599,14 +46843,8 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -44622,8 +46860,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAt * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] + * @param {integer} tileX - X position to get the tile from in tile coordinates. + * @param {integer} tileY - Y position to get the tile from in tile coordinates. * * @return {boolean} */ @@ -44639,9 +46877,9 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAtWorldXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {number} worldX - The X coordinate of the world position. + * @param {number} worldY - The Y coordinate of the world position. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {boolean} */ @@ -44660,13 +46898,7 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -44830,10 +47062,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] + * @param {integer} tileX - The leftmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The topmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. * @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. * @@ -44853,8 +47085,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {integer} tileX - The X coordinate, in tile coordinates. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {number} */ @@ -44870,8 +47102,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY * @since 3.0.0 * - * @param {integer} tileY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {integer} tileY - The Y coordinate, in tile coordinates. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {number} */ @@ -44888,10 +47120,10 @@ var StaticTilemapLayer = new Class({ * @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] + * @param {integer} tileX - The X coordinate, in tile coordinates. + * @param {integer} tileY - The Y coordinate, in tile coordinates. + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {Phaser.Math.Vector2} */ @@ -44907,10 +47139,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX * @since 3.0.0 * - * @param {number} worldX - [description] + * @param {number} worldX - The X coordinate, in world pixels. * @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] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.] * * @return {number} */ @@ -44926,10 +47158,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileY * @since 3.0.0 * - * @param {number} worldY - [description] + * @param {number} worldY - The Y coordinate, in world pixels. * @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] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {number} */ @@ -44946,12 +47178,12 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] + * @param {number} worldX - The X coordinate, in world pixels. + * @param {number} worldY - The Y coordinate, in world pixels. * @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] + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Math.Vector2} */ @@ -45001,20 +47233,20 @@ module.exports = StaticTilemapLayer; /***/ }), -/* 208 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var DynamicTilemapLayerRender = __webpack_require__(449); -var GameObject = __webpack_require__(19); -var TilemapComponents = __webpack_require__(103); +var Components = __webpack_require__(13); +var DynamicTilemapLayerRender = __webpack_require__(488); +var GameObject = __webpack_require__(18); +var TilemapComponents = __webpack_require__(110); /** * @classdesc @@ -45205,9 +47437,9 @@ var DynamicTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -45253,7 +47485,7 @@ var DynamicTilemapLayer = new Class({ this.setAlpha(this.layer.alpha); this.setPosition(x, y); this.setOrigin(); - this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); this.initPipeline('TextureTintPipeline'); }, @@ -45519,10 +47751,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -45567,10 +47796,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -45592,10 +47818,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -45652,10 +47875,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -45672,10 +47892,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -45695,10 +47912,7 @@ var DynamicTilemapLayer = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -45884,13 +48098,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -45982,10 +48190,8 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -46007,10 +48213,8 @@ var DynamicTilemapLayer = new Class({ * * @param {integer} start - The first index of the tile to be set for collision. * @param {integer} stop - The last index of the tile to be set 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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -46033,12 +48237,9 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -46058,10 +48259,8 @@ var DynamicTilemapLayer = new Class({ * @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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -46081,10 +48280,8 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -46104,8 +48301,7 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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 {(integer|integer[])} 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. * @@ -46130,7 +48326,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @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.DynamicTilemapLayer} This Tilemap Layer object. @@ -46341,26 +48537,26 @@ module.exports = DynamicTilemapLayer; /***/ }), -/* 209 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var DynamicTilemapLayer = __webpack_require__(208); -var Extend = __webpack_require__(20); -var Formats = __webpack_require__(29); -var LayerData = __webpack_require__(78); -var Rotate = __webpack_require__(242); -var StaticTilemapLayer = __webpack_require__(207); -var Tile = __webpack_require__(55); -var TilemapComponents = __webpack_require__(103); -var Tileset = __webpack_require__(99); +var DegToRad = __webpack_require__(34); +var DynamicTilemapLayer = __webpack_require__(224); +var Extend = __webpack_require__(19); +var Formats = __webpack_require__(31); +var LayerData = __webpack_require__(84); +var Rotate = __webpack_require__(373); +var StaticTilemapLayer = __webpack_require__(223); +var Tile = __webpack_require__(61); +var TilemapComponents = __webpack_require__(110); +var Tileset = __webpack_require__(106); /** * @callback TilemapFilterCallback @@ -46470,14 +48666,14 @@ var Tilemap = new Class({ /** * The render (draw) order of the map data (as specified in Tiled), usually 'right-down'. - * + * * The draw orders are: - * + * * right-down * left-down * right-up * left-up - * + * * This can be changed via the `setRenderOrder` method. * * @name Phaser.Tilemaps.Tilemap#renderOrder @@ -46587,22 +48783,22 @@ var Tilemap = new Class({ /** * Sets the rendering (draw) order of the tiles in this map. - * + * * The default is 'right-down', meaning it will order the tiles starting from the top-left, * drawing to the right and then moving down to the next row. - * + * * The draw orders are: - * + * * 0 = right-down * 1 = left-down * 2 = right-up * 3 = left-up - * + * * Setting the render order does not change the tiles or how they are stored in the layer, * it purely impacts the order in which they are rendered. - * + * * You can provide either an integer (0 to 3), or the string version of the order. - * + * * Calling this method _after_ creating Static or Dynamic Tilemap Layers will **not** automatically * update them to use the new render order. If you call this method after creating layers, use their * own `setRenderOrder` methods to change them as needed. @@ -46754,12 +48950,12 @@ var Tilemap = new Class({ * Copies the tiles in the source rectangular area to a new destination (all specified in tile * coordinates) within the layer. This copies all tile properties & recalculates collision * information in the destination region. - * + * * If no layer specified, the map's current layer is used. This cannot be applied to StaticTilemapLayers. * * @method Phaser.Tilemaps.Tilemap#copy * @since 3.0.0 - * + * * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. * @param {integer} width - The width of the area to copy, in tiles, not pixels. @@ -46767,7 +48963,7 @@ var Tilemap = new Class({ * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -46804,7 +49000,7 @@ var Tilemap = new Class({ * @param {integer} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. * @param {integer} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. * @param {integer} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. - * + * * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer was created, or null if it failed. */ createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) @@ -47034,7 +49230,7 @@ var Tilemap = new Class({ * @param {SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -47063,8 +49259,8 @@ var Tilemap = new Class({ * * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} x - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} y - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer was created, or null if it failed. */ @@ -47134,7 +49330,7 @@ var Tilemap = new Class({ * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -47184,6 +49380,14 @@ var Tilemap = new Class({ return objectLayer.objects.filter(callback, context); }, + /** + * @typedef {object} FilteringOptions + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ + /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns @@ -47201,11 +49405,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to apply the filter on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -47232,7 +49433,7 @@ var Tilemap = new Class({ * @param {integer} index - The tile index value to search for. * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -47292,11 +49493,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -47324,11 +49522,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -47485,7 +49680,7 @@ var Tilemap = new Class({ * @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 tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -47509,7 +49704,7 @@ var Tilemap = new Class({ * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -47538,11 +49733,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -47564,12 +49756,9 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -47593,12 +49782,9 @@ var Tilemap = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -47655,7 +49841,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -47680,7 +49866,7 @@ var Tilemap = new Class({ * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -47730,7 +49916,7 @@ var Tilemap = new Class({ * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. */ @@ -47762,7 +49948,7 @@ var Tilemap = new Class({ * @param {number} worldY - The y coordinate, in pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -47794,7 +49980,7 @@ var Tilemap = new Class({ * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -47830,7 +50016,7 @@ var Tilemap = new Class({ * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -47860,7 +50046,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -47889,7 +50075,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -47944,7 +50130,7 @@ var Tilemap = new Class({ * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -47974,7 +50160,7 @@ var Tilemap = new Class({ * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -47989,6 +50175,14 @@ var Tilemap = new Class({ return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, layer); }, + /** + * @typedef {object} StyleConfig + * + * @property {?number} [tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. + * @property {?number} [collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. + * @property {?number} [faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. + */ + /** * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles @@ -48001,11 +50195,8 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48037,7 +50228,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48068,7 +50259,7 @@ var Tilemap = new Class({ * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48098,7 +50289,7 @@ var Tilemap = new Class({ * @param {integer} stop - The last index of the tile to be set 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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48130,7 +50321,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48158,7 +50349,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48186,7 +50377,7 @@ var Tilemap = new Class({ * * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48215,7 +50406,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48246,7 +50437,7 @@ var Tilemap = new Class({ * @param {integer} height - How many tiles tall from the `tileY` index the area will be. * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48314,9 +50505,9 @@ var Tilemap = new Class({ var mapWidth = this.layers[i].width; var mapHeight = this.layers[i].height; - for (var row = 0; row < mapHeight; ++row) + for (var row = 0; row < mapHeight; row++) { - for (var col = 0; col < mapWidth; ++col) + for (var col = 0; col < mapWidth; col++) { var tile = mapData[row][col]; @@ -48360,13 +50551,16 @@ var Tilemap = new Class({ var mapWidth = layer.width; var mapHeight = layer.height; - for (var row = 0; row < mapHeight; ++row) + for (var row = 0; row < mapHeight; row++) { - for (var col = 0; col < mapWidth; ++col) + for (var col = 0; col < mapWidth; col++) { var tile = mapData[row][col]; - if (tile !== null) { tile.setSize(tileWidth, tileHeight); } + if (tile !== null) + { + tile.setSize(tileWidth, tileHeight); + } } } @@ -48389,7 +50583,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48424,7 +50618,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48453,7 +50647,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -48477,7 +50671,8 @@ var Tilemap = new Class({ * * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer + * to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -48504,7 +50699,7 @@ var Tilemap = new Class({ * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. */ @@ -48545,7 +50740,7 @@ var Tilemap = new Class({ * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during * randomization. They should be in the form: { index: 0, weight: 4 } or * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -48575,7 +50770,8 @@ var Tilemap = new Class({ * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @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] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer + * to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -48600,7 +50796,7 @@ var Tilemap = new Class({ * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. * @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] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -48628,7 +50824,7 @@ var Tilemap = new Class({ * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. */ @@ -48669,19 +50865,19 @@ module.exports = Tilemap; /***/ }), -/* 210 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var MapData = __webpack_require__(77); -var ParseTileLayers = __webpack_require__(451); -var ParseTilesets = __webpack_require__(450); +var Formats = __webpack_require__(31); +var MapData = __webpack_require__(83); +var ParseTileLayers = __webpack_require__(490); +var ParseTilesets = __webpack_require__(489); /** * @namespace Phaser.Tilemaps.Parsers.Impact @@ -48740,12 +50936,12 @@ module.exports = ParseWeltmeister; /***/ }), -/* 211 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -48766,7 +50962,7 @@ var GetFastValue = __webpack_require__(2); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {object} [config] - The data for the layer from the Tiled JSON object. */ var ObjectLayer = new Class({ @@ -48777,7 +50973,7 @@ var ObjectLayer = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the Object Layer. * * @name Phaser.Tilemaps.ObjectLayer#name * @type {string} @@ -48786,7 +50982,7 @@ var ObjectLayer = new Class({ this.name = GetFastValue(config, 'name', 'object layer'); /** - * [description] + * The opacity of the layer, between 0 and 1. * * @name Phaser.Tilemaps.ObjectLayer#opacity * @type {number} @@ -48795,7 +50991,7 @@ var ObjectLayer = new Class({ this.opacity = GetFastValue(config, 'opacity', 1); /** - * [description] + * The custom properties defined on the Object Layer, keyed by their name. * * @name Phaser.Tilemaps.ObjectLayer#properties * @type {object} @@ -48804,7 +51000,7 @@ var ObjectLayer = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * [description] + * The type of each custom property defined on the Object Layer, keyed by its name. * * @name Phaser.Tilemaps.ObjectLayer#propertyTypes * @type {object} @@ -48813,7 +51009,7 @@ var ObjectLayer = new Class({ this.propertyTypes = GetFastValue(config, 'propertytypes', {}); /** - * [description] + * The type of the layer, which should be `objectgroup`. * * @name Phaser.Tilemaps.ObjectLayer#type * @type {string} @@ -48822,7 +51018,7 @@ var ObjectLayer = new Class({ this.type = GetFastValue(config, 'type', 'objectgroup'); /** - * [description] + * Whether the layer is shown (`true`) or hidden (`false`). * * @name Phaser.Tilemaps.ObjectLayer#visible * @type {boolean} @@ -48831,7 +51027,15 @@ var ObjectLayer = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * An array of all objects on this Object Layer. + * + * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique), `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees), `properties` (if any), `visible` state (`true` if visible, `false` otherwise), `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels). + * + * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property, a `flippedVertical` property, and `flippedAntiDiagonal` property. The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains information on flipping and rotation. + * + * Polylines have a `polyline` property, which is an array of objects corresponding to points, where each point has an `x` property and a `y` property. Polygons have an identically structured array in their `polygon` property. Text objects have a `text` property with the text's properties. + * + * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`. * * @name Phaser.Tilemaps.ObjectLayer#objects * @type {Phaser.GameObjects.GameObject[]} @@ -48846,33 +51050,33 @@ module.exports = ObjectLayer; /***/ }), -/* 212 */ +/* 228 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pick = __webpack_require__(455); -var ParseGID = __webpack_require__(214); +var Pick = __webpack_require__(494); +var ParseGID = __webpack_require__(230); var copyPoints = function (p) { return { x: p.x, y: p.y }; }; var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; /** - * [description] + * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) * * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject * @since 3.0.0 * - * @param {object} tiledObject - [description] - * @param {number} [offsetX=0] - [description] - * @param {number} [offsetY=0] - [description] + * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. + * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. + * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. * - * @return {object} [description] + * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. */ var ParseObject = function (tiledObject, offsetX, offsetY) { @@ -48928,12 +51132,12 @@ module.exports = ParseObject; /***/ }), -/* 213 */ +/* 229 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -49100,12 +51304,12 @@ module.exports = ImageCollection; /***/ }), -/* 214 */ +/* 230 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -49190,23 +51394,23 @@ module.exports = ParseGID; /***/ }), -/* 215 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var MapData = __webpack_require__(77); -var ParseTileLayers = __webpack_require__(459); -var ParseImageLayers = __webpack_require__(457); -var ParseTilesets = __webpack_require__(456); -var ParseObjectLayers = __webpack_require__(454); -var BuildTilesetIndex = __webpack_require__(453); -var AssignTileProperties = __webpack_require__(452); +var Formats = __webpack_require__(31); +var MapData = __webpack_require__(83); +var ParseTileLayers = __webpack_require__(498); +var ParseImageLayers = __webpack_require__(496); +var ParseTilesets = __webpack_require__(495); +var ParseObjectLayers = __webpack_require__(493); +var BuildTilesetIndex = __webpack_require__(492); +var AssignTileProperties = __webpack_require__(491); /** * @namespace Phaser.Tilemaps.Parsers.Tiled @@ -49271,17 +51475,17 @@ module.exports = ParseJSONTiled; /***/ }), -/* 216 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var Parse2DArray = __webpack_require__(133); +var Formats = __webpack_require__(31); +var Parse2DArray = __webpack_require__(145); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -49319,20 +51523,20 @@ module.exports = ParseCSV; /***/ }), -/* 217 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var Parse2DArray = __webpack_require__(133); -var ParseCSV = __webpack_require__(216); -var ParseJSONTiled = __webpack_require__(215); -var ParseWeltmeister = __webpack_require__(210); +var Formats = __webpack_require__(31); +var Parse2DArray = __webpack_require__(145); +var ParseCSV = __webpack_require__(232); +var ParseJSONTiled = __webpack_require__(231); +var ParseWeltmeister = __webpack_require__(226); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -49389,18 +51593,18 @@ module.exports = Parse; /***/ }), -/* 218 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tile = __webpack_require__(55); -var IsInLayerBounds = __webpack_require__(79); -var CalculateFacesAt = __webpack_require__(136); +var Tile = __webpack_require__(61); +var IsInLayerBounds = __webpack_require__(85); +var CalculateFacesAt = __webpack_require__(148); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -49424,7 +51628,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la if (recalculateFaces === undefined) { recalculateFaces = true; } if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } - var tile = layer.data[tileY][tileX]; + var tile = layer.data[tileY][tileX] || null; if (tile === null) { return null; @@ -49449,16 +51653,16 @@ module.exports = RemoveTileAt; /***/ }), -/* 219 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(79); +var IsInLayerBounds = __webpack_require__(85); /** * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns @@ -49492,16 +51696,16 @@ module.exports = HasTileAt; /***/ }), -/* 220 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -49537,12 +51741,12 @@ module.exports = ReplaceByIndex; /***/ }), -/* 221 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ @@ -49718,22 +51922,22 @@ module.exports = BasePlugin; /***/ }), -/* 222 */, -/* 223 */, -/* 224 */, -/* 225 */ +/* 238 */, +/* 239 */, +/* 240 */, +/* 241 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircleContains = __webpack_require__(40); +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var RectangleContains = __webpack_require__(39); +var CONST = __webpack_require__(38); +var RectangleContains = __webpack_require__(42); var Vector2 = __webpack_require__(3); /** @@ -49752,8 +51956,8 @@ var Vector2 = __webpack_require__(3); * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - [description] - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Static Body belongs to. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object this Static Body belongs to. */ var StaticBody = new Class({ @@ -49765,7 +51969,7 @@ var StaticBody = new Class({ var height = (gameObject.height) ? gameObject.height : 64; /** - * [description] + * The Arcade Physics simulation this Static Body belongs to. * * @name Phaser.Physics.Arcade.StaticBody#world * @type {Phaser.Physics.Arcade.World} @@ -49774,7 +51978,7 @@ var StaticBody = new Class({ this.world = world; /** - * [description] + * The Game Object this Static Body belongs to. * * @name Phaser.Physics.Arcade.StaticBody#gameObject * @type {Phaser.GameObjects.GameObject} @@ -49783,7 +51987,7 @@ var StaticBody = new Class({ this.gameObject = gameObject; /** - * [description] + * Whether the Static Body's boundary is drawn to the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugShowBody * @type {boolean} @@ -49792,7 +51996,7 @@ var StaticBody = new Class({ this.debugShowBody = world.defaults.debugShowStaticBody; /** - * [description] + * The color of this Static Body on the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor * @type {integer} @@ -49801,7 +52005,7 @@ var StaticBody = new Class({ this.debugBodyColor = world.defaults.staticBodyDebugColor; /** - * [description] + * Whether this Static Body is updated by the physics simulation. * * @name Phaser.Physics.Arcade.StaticBody#enable * @type {boolean} @@ -49811,7 +52015,7 @@ var StaticBody = new Class({ this.enable = true; /** - * [description] + * Whether this Static Body's boundary is circular (`true`) or rectangular (`false`). * * @name Phaser.Physics.Arcade.StaticBody#isCircle * @type {boolean} @@ -49821,7 +52025,8 @@ var StaticBody = new Class({ this.isCircle = false; /** - * [description] + * If this Static Body is circular, this is the unscaled radius of the Static Body's boundary, as set by {@link #setCircle}, in source pixels. + * The true radius is equal to `halfWidth`. * * @name Phaser.Physics.Arcade.StaticBody#radius * @type {number} @@ -49831,7 +52036,9 @@ var StaticBody = new Class({ this.radius = 0; /** - * [description] + * The offset of this Static Body's actual position from any updated position. + * + * Unlike a dynamic Body, a Static Body does not follow its Game Object. As such, this offset is only applied when resizing the Static Body. * * @name Phaser.Physics.Arcade.StaticBody#offset * @type {Phaser.Math.Vector2} @@ -49840,7 +52047,7 @@ var StaticBody = new Class({ this.offset = new Vector2(); /** - * [description] + * The position of this Static Body within the simulation. * * @name Phaser.Physics.Arcade.StaticBody#position * @type {Phaser.Math.Vector2} @@ -49849,7 +52056,8 @@ var StaticBody = new Class({ this.position = new Vector2(gameObject.x - gameObject.displayOriginX, gameObject.y - gameObject.displayOriginY); /** - * [description] + * The width of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. * * @name Phaser.Physics.Arcade.StaticBody#width * @type {number} @@ -49858,7 +52066,8 @@ var StaticBody = new Class({ this.width = width; /** - * [description] + * The height of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. * * @name Phaser.Physics.Arcade.StaticBody#height * @type {number} @@ -49867,7 +52076,8 @@ var StaticBody = new Class({ this.height = height; /** - * [description] + * Half the Static Body's width, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. * * @name Phaser.Physics.Arcade.StaticBody#halfWidth * @type {number} @@ -49876,7 +52086,8 @@ var StaticBody = new Class({ this.halfWidth = Math.abs(this.width / 2); /** - * [description] + * Half the Static Body's height, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. * * @name Phaser.Physics.Arcade.StaticBody#halfHeight * @type {number} @@ -49885,7 +52096,8 @@ var StaticBody = new Class({ this.halfHeight = Math.abs(this.height / 2); /** - * [description] + * The center of the Static Body's boundary. + * This is the midpoint of its `position` (top-left corner) and its bottom-right corner. * * @name Phaser.Physics.Arcade.StaticBody#center * @type {Phaser.Math.Vector2} @@ -49894,7 +52106,7 @@ var StaticBody = new Class({ this.center = new Vector2(gameObject.x + this.halfWidth, gameObject.y + this.halfHeight); /** - * [description] + * A constant zero velocity used by the Arcade Physics simulation for calculations. * * @name Phaser.Physics.Arcade.StaticBody#velocity * @type {Phaser.Math.Vector2} @@ -49904,7 +52116,7 @@ var StaticBody = new Class({ this.velocity = Vector2.ZERO; /** - * [description] + * A constant `false` value expected by the Arcade Physics simulation. * * @name Phaser.Physics.Arcade.StaticBody#allowGravity * @type {boolean} @@ -49937,10 +52149,12 @@ var StaticBody = new Class({ // If true this Body will dispatch events /** - * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary (and `collideWorldBounds` is also true). + * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary and never trigger a `worldbounds` event.) * * @name Phaser.Physics.Arcade.StaticBody#onWorldBounds * @type {boolean} + * @readonly * @default false * @since 3.0.0 */ @@ -49987,7 +52201,7 @@ var StaticBody = new Class({ this.immovable = true; /** - * A flag disabling the default horizontal separation of colliding bodies. Pass your own `processHandler` to the collider. + * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. * * @name Phaser.Physics.Arcade.StaticBody#customSeparateX * @type {boolean} @@ -49997,7 +52211,7 @@ var StaticBody = new Class({ this.customSeparateX = false; /** - * A flag disabling the default vertical separation of colliding bodies. Pass your own `processHandler` to the collider. + * A flag disabling the default vertical separation of colliding bodies. Pass your own `collideHandler` to the collider. * * @name Phaser.Physics.Arcade.StaticBody#customSeparateY * @type {boolean} @@ -50037,7 +52251,7 @@ var StaticBody = new Class({ this.overlapR = 0; /** - * Whether this StaticBody is overlapped with another and both have zero velocity. + * Whether this StaticBody has ever overlapped with another while both were not moving. * * @name Phaser.Physics.Arcade.StaticBody#embedded * @type {boolean} @@ -50048,9 +52262,11 @@ var StaticBody = new Class({ /** * Whether this StaticBody interacts with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary.) * * @name Phaser.Physics.Arcade.StaticBody#collideWorldBounds * @type {boolean} + * @readonly * @default false * @since 3.0.0 */ @@ -50066,7 +52282,7 @@ var StaticBody = new Class({ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; /** - * Whether this StaticBody is colliding with another and in which direction. + * Whether this StaticBody has ever collided with another body and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#touching * @type {ArcadeBodyCollision} @@ -50075,7 +52291,7 @@ var StaticBody = new Class({ this.touching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody was colliding with another during the last step, and in which direction. + * Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#wasTouching * @type {ArcadeBodyCollision} @@ -50084,7 +52300,7 @@ var StaticBody = new Class({ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody is colliding with a tile or the world boundary. + * Whether this StaticBody has ever collided with a tile or the world boundary. * * @name Phaser.Physics.Arcade.StaticBody#blocked * @type {ArcadeBodyCollision} @@ -50097,6 +52313,7 @@ var StaticBody = new Class({ * * @name Phaser.Physics.Arcade.StaticBody#physicsType * @type {integer} + * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ this.physicsType = CONST.STATIC_BODY; @@ -50332,14 +52549,14 @@ var StaticBody = new Class({ }, /** - * Updates this Static Body's position based on the current Game Object it is bound to. + * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. * Similar to `updateFromGameObject`, but doesn't modify the Body's dimensions. * * @method Phaser.Physics.Arcade.StaticBody#reset * @since 3.0.0 * - * @param {number} x - The x coordinate to reset the body to. - * @param {number} y - The y coordinate to reset the body to. + * @param {number} [x] - The x coordinate to reset the body to. If not given will use the parent Game Object's coordinate. + * @param {number} [y] - The y coordinate to reset the body to. If not given will use the parent Game Object's coordinate. */ reset: function (x, y) { @@ -50350,6 +52567,8 @@ var StaticBody = new Class({ this.world.staticTree.remove(this); + gameObject.setPosition(x, y); + gameObject.getTopLeft(this.position); this.updateCenter(); @@ -50448,7 +52667,7 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#deltaX * @since 3.0.0 * - * @return {number} Always zero for a Static Body. + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. */ deltaX: function () { @@ -50461,7 +52680,7 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#deltaY * @since 3.0.0 * - * @return {number} 0 + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. */ deltaY: function () { @@ -50469,12 +52688,12 @@ var StaticBody = new Class({ }, /** - * [description] + * The change in this StaticBody's rotation from the previous step. Always zero. * * @method Phaser.Physics.Arcade.StaticBody#deltaZ * @since 3.0.0 * - * @return {number} 0 + * @return {number} The change in this StaticBody's rotation from the previous step. Always zero. */ deltaZ: function () { @@ -50506,10 +52725,22 @@ var StaticBody = new Class({ { var pos = this.position; + var x = pos.x + this.halfWidth; + var y = pos.y + this.halfHeight; + if (this.debugShowBody) { graphic.lineStyle(1, this.debugBodyColor, 1); - graphic.strokeRect(pos.x, pos.y, this.width, this.height); + + if (this.isCircle) + { + graphic.strokeCircle(x, y, this.width / 2); + } + else + { + graphic.strokeRect(pos.x, pos.y, this.width, this.height); + } + } }, @@ -50673,30 +52904,29 @@ module.exports = StaticBody; /***/ }), -/* 226 */ +/* 242 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body. * * @function Phaser.Physics.Arcade.Tilemap.TileIntersectsBody * @since 3.0.0 * - * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - [description] - * @param {Phaser.Physics.Arcade.Body} body - [description] + * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - A rectangle object that defines the tile placement in the world. + * @param {Phaser.Physics.Arcade.Body} body - The body to check for intersection against. * - * @return {boolean} [description] + * @return {boolean} Returns `true` of the tile intersects with the body, otherwise `false`. */ var TileIntersectsBody = function (tileWorldRect, body) { - // Currently, all bodies are treated as rectangles when colliding with a Tile. Eventually, this - // should support circle bodies when those are less buggy in v3. + // Currently, all bodies are treated as rectangles when colliding with a Tile. return !( body.right <= tileWorldRect.left || @@ -50710,16 +52940,16 @@ module.exports = TileIntersectsBody; /***/ }), -/* 227 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var quickselect = __webpack_require__(313); +var quickselect = __webpack_require__(317); /** * @classdesc @@ -51318,12 +53548,12 @@ function multiSelect (arr, left, right, n, compare) module.exports = rbush; /***/ }), -/* 228 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -51331,7 +53561,16 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * A Process Queue maintains three internal lists. + * + * The `pending` list is a selection of items which are due to be made 'active' in the next update. + * The `active` list is a selection of items which are considered active and should be updated. + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. + * + * When new items are added to a Process Queue they are put in a pending data, rather than being added + * immediately the active list. Equally, items that are removed are put into the destroy list, rather than + * being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed + * time, rather than at the time of the request from the API. * * @class ProcessQueue * @memberof Phaser.Structs @@ -51347,7 +53586,7 @@ var ProcessQueue = new Class({ function ProcessQueue () { /** - * [description] + * The `pending` list is a selection of items which are due to be made 'active' in the next update. * * @genericUse {T[]} - [$type] * @@ -51360,7 +53599,7 @@ var ProcessQueue = new Class({ this._pending = []; /** - * [description] + * The `active` list is a selection of items which are considered active and should be updated. * * @genericUse {T[]} - [$type] * @@ -51373,7 +53612,7 @@ var ProcessQueue = new Class({ this._active = []; /** - * [description] + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. * * @genericUse {T[]} - [$type] * @@ -51386,7 +53625,7 @@ var ProcessQueue = new Class({ this._destroy = []; /** - * [description] + * The total number of items awaiting processing. * * @name Phaser.Structs.ProcessQueue#_toProcess * @type {integer} @@ -51398,7 +53637,8 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Adds a new item to the Process Queue. + * The item is added to the pending list and made active in the next update. * * @method Phaser.Structs.ProcessQueue#add * @since 3.0.0 @@ -51406,7 +53646,7 @@ var ProcessQueue = new Class({ * @genericUse {T} - [item] * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] * - * @param {*} item - [description] + * @param {*} item - The item to add to the queue. * * @return {Phaser.Structs.ProcessQueue} This Process Queue object. */ @@ -51420,7 +53660,8 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Removes an item from the Process Queue. + * The item is added to the pending destroy and fully removed in the next update. * * @method Phaser.Structs.ProcessQueue#remove * @since 3.0.0 @@ -51428,7 +53669,7 @@ var ProcessQueue = new Class({ * @genericUse {T} - [item] * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] * - * @param {*} item - [description] + * @param {*} item - The item to be removed from the queue. * * @return {Phaser.Structs.ProcessQueue} This Process Queue object. */ @@ -51442,14 +53683,17 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Update this queue. First it will process any items awaiting destruction, and remove them. + * + * Then it will check to see if there are any items pending insertion, and move them to an + * active state. Finally, it will return a list of active items for further processing. * * @method Phaser.Structs.ProcessQueue#update * @since 3.0.0 * * @genericUse {T[]} - [$return] * - * @return {Array.<*>} [description] + * @return {Array.<*>} A list of active items. */ update: function () { @@ -51501,14 +53745,14 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Returns the current list of active items. * * @method Phaser.Structs.ProcessQueue#getActive * @since 3.0.0 * * @genericUse {T[]} - [$return] * - * @return {Array.<*>} [description] + * @return {Array.<*>} A list of active items. */ getActive: function () { @@ -51516,13 +53760,15 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Immediately destroys this process queue, clearing all of its internal arrays and resetting the process totals. * * @method Phaser.Structs.ProcessQueue#destroy * @since 3.0.0 */ destroy: function () { + this._toProcess = 0; + this._pending = []; this._active = []; this._destroy = []; @@ -51534,29 +53780,30 @@ module.exports = ProcessQueue; /***/ }), -/* 229 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(35); +var CONST = __webpack_require__(38); /** - * [description] + * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'. * * @function Phaser.Physics.Arcade.GetOverlapY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). * - * @return {number} [description] + * @return {number} The amount of overlap. */ var GetOverlapY = function (body1, body2, overlapOnly, bias) { @@ -51641,29 +53888,30 @@ module.exports = GetOverlapY; /***/ }), -/* 230 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(35); +var CONST = __webpack_require__(38); /** - * [description] + * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'. * * @function Phaser.Physics.Arcade.GetOverlapX * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). * - * @return {number} [description] + * @return {number} The amount of overlap. */ var GetOverlapX = function (body1, body2, overlapOnly, bias) { @@ -51748,12 +53996,12 @@ module.exports = GetOverlapX; /***/ }), -/* 231 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -51761,15 +54009,16 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects + * every step. If a collision, or overlap, occurs it will invoke the given callbacks. * * @class Collider * @memberof Phaser.Physics.Arcade * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - [description] - * @param {boolean} overlapOnly - [description] + * @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions. + * @param {boolean} overlapOnly - Whether to check for collisions or overlap. * @param {ArcadeColliderType} object1 - The first object to check for collision. * @param {ArcadeColliderType} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. @@ -51783,7 +54032,7 @@ var Collider = new Class({ function Collider (world, overlapOnly, object1, object2, collideCallback, processCallback, callbackContext) { /** - * [description] + * The world in which the bodies will collide. * * @name Phaser.Physics.Arcade.Collider#world * @type {Phaser.Physics.Arcade.World} @@ -51792,7 +54041,7 @@ var Collider = new Class({ this.world = world; /** - * [description] + * The name of the collider (unused by Phaser). * * @name Phaser.Physics.Arcade.Collider#name * @type {string} @@ -51801,7 +54050,7 @@ var Collider = new Class({ this.name = ''; /** - * [description] + * Whether the collider is active. * * @name Phaser.Physics.Arcade.Collider#active * @type {boolean} @@ -51811,7 +54060,7 @@ var Collider = new Class({ this.active = true; /** - * [description] + * Whether to check for collisions or overlaps. * * @name Phaser.Physics.Arcade.Collider#overlapOnly * @type {boolean} @@ -51820,7 +54069,7 @@ var Collider = new Class({ this.overlapOnly = overlapOnly; /** - * [description] + * The first object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object1 * @type {ArcadeColliderType} @@ -51829,7 +54078,7 @@ var Collider = new Class({ this.object1 = object1; /** - * [description] + * The second object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object2 * @type {ArcadeColliderType} @@ -51838,7 +54087,7 @@ var Collider = new Class({ this.object2 = object2; /** - * [description] + * The callback to invoke when the two objects collide. * * @name Phaser.Physics.Arcade.Collider#collideCallback * @type {ArcadePhysicsCallback} @@ -51847,7 +54096,7 @@ var Collider = new Class({ this.collideCallback = collideCallback; /** - * [description] + * If a processCallback exists it must return true or collision checking will be skipped. * * @name Phaser.Physics.Arcade.Collider#processCallback * @type {ArcadePhysicsCallback} @@ -51856,7 +54105,7 @@ var Collider = new Class({ this.processCallback = processCallback; /** - * [description] + * The context the collideCallback and processCallback will run in. * * @name Phaser.Physics.Arcade.Collider#callbackContext * @type {object} @@ -51866,14 +54115,16 @@ var Collider = new Class({ }, /** - * [description] + * A name for the Collider. + * + * Phaser does not use this value, it's for your own reference. * * @method Phaser.Physics.Arcade.Collider#setName * @since 3.1.0 * - * @param {string} name - [description] + * @param {string} name - The name to assign to the Collider. * - * @return {Phaser.Physics.Arcade.Collider} [description] + * @return {Phaser.Physics.Arcade.Collider} This Collider instance. */ setName: function (name) { @@ -51883,7 +54134,7 @@ var Collider = new Class({ }, /** - * [description] + * Called by World as part of its step processing, initial operation of collision checking. * * @method Phaser.Physics.Arcade.Collider#update * @since 3.0.0 @@ -51901,7 +54152,7 @@ var Collider = new Class({ }, /** - * [description] + * Removes Collider from World and disposes of its resources. * * @method Phaser.Physics.Arcade.Collider#destroy * @since 3.0.0 @@ -51928,21 +54179,49 @@ module.exports = Collider; /***/ }), -/* 232 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircleContains = __webpack_require__(40); +/** + * @namespace Phaser.Physics.Arcade.Events + */ + +module.exports = { + + COLLIDE: __webpack_require__(563), + OVERLAP: __webpack_require__(562), + PAUSE: __webpack_require__(561), + RESUME: __webpack_require__(560), + TILE_COLLIDE: __webpack_require__(559), + TILE_OVERLAP: __webpack_require__(558), + WORLD_BOUNDS: __webpack_require__(557) + +}; + + +/***/ }), +/* 249 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var RadToDeg = __webpack_require__(172); -var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(39); +var CONST = __webpack_require__(38); +var Events = __webpack_require__(248); +var RadToDeg = __webpack_require__(183); +var Rectangle = __webpack_require__(10); +var RectangleContains = __webpack_require__(42); var Vector2 = __webpack_require__(3); /** @@ -52334,7 +54613,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:worldbounds + * @see Phaser.Physics.Arcade.World#worldboundsEvent */ this.onWorldBounds = false; @@ -52345,7 +54624,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:collide + * @see Phaser.Physics.Arcade.World#collideEvent */ this.onCollide = false; @@ -52356,7 +54635,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:overlap + * @see Phaser.Physics.Arcade.World#overlapEvent */ this.onOverlap = false; @@ -52370,6 +54649,19 @@ var Body = new Class({ */ this.maxVelocity = new Vector2(10000, 10000); + /** + * The maximum speed this Body is allowed to reach. + * + * If not negative it limits the scalar value of speed. + * + * Any negative value means no maximum is being applied. + * + * @name Phaser.Physics.Arcade.Body#maxSpeed + * @type {number} + * @since 3.16.0 + */ + this.maxSpeed = -1; + /** * If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1. * The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all. @@ -52556,7 +54848,7 @@ var Body = new Class({ this.overlapR = 0; /** - * Whether this Body is overlapped with another and both have zero velocity. + * Whether this Body is overlapped with another and both are not moving. * * @name Phaser.Physics.Arcade.Body#embedded * @type {boolean} @@ -52577,7 +54869,7 @@ var Body = new Class({ /** * Whether this Body is checked for collisions and for which directions. - * You can set `checkCollision.none = false` to disable collision checks. + * You can set `checkCollision.none = true` to disable collision checks. * * @name Phaser.Physics.Arcade.Body#checkCollision * @type {ArcadeBodyCollision} @@ -52651,6 +54943,7 @@ var Body = new Class({ * @name Phaser.Physics.Arcade.Body#physicsType * @type {integer} * @readonly + * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ this.physicsType = CONST.DYNAMIC_BODY; @@ -52720,7 +55013,8 @@ var Body = new Class({ }, /** - * Updates this Body's transform, dimensions, and position from its Game Object. + * Updates the Body's `transform`, `width`, `height`, and `center` from its Game Object. + * The Body's `position` isn't changed. * * @method Phaser.Physics.Arcade.Body#updateBounds * @since 3.0.0 @@ -52807,7 +55101,7 @@ var Body = new Class({ * @fires Phaser.Physics.Arcade.World#worldbounds * @since 3.0.0 * - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} delta - The delta time, in seconds, elapsed since the last frame. */ update: function (delta) { @@ -52877,7 +55171,7 @@ var Body = new Class({ if (this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds) { - this.world.emit('worldbounds', this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); + this.world.emit(Events.WORLD_BOUNDS, this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); } } @@ -53328,7 +55622,10 @@ var Body = new Class({ { this.enable = false; - this.world.pendingDestroy.set(this); + if (this.world) + { + this.world.pendingDestroy.set(this); + } }, /** @@ -53348,7 +55645,7 @@ var Body = new Class({ if (this.debugShowBody) { - graphic.lineStyle(1, this.debugBodyColor); + graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor); if (this.isCircle) { @@ -53362,7 +55659,7 @@ var Body = new Class({ if (this.debugShowVelocity) { - graphic.lineStyle(1, this.world.defaults.velocityDebugColor, 1); + graphic.lineStyle(graphic.defaultStrokeWidth, this.world.defaults.velocityDebugColor, 1); graphic.lineBetween(x, y, x + this.velocity.x / 2, y + this.velocity.y / 2); } }, @@ -53481,6 +55778,23 @@ var Body = new Class({ return this; }, + /** + * Sets the maximum speed the Body can move. + * + * @method Phaser.Physics.Arcade.Body#setMaxSpeed + * @since 3.16.0 + * + * @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxSpeed: function (value) + { + this.maxSpeed = value; + + return this; + }, + /** * Sets the Body's bounce. * @@ -54023,74 +56337,42 @@ module.exports = Body; /***/ }), -/* 233 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(232); +var Body = __webpack_require__(249); var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); -var Collider = __webpack_require__(231); -var CONST = __webpack_require__(35); -var DistanceBetween = __webpack_require__(52); +var Collider = __webpack_require__(247); +var CONST = __webpack_require__(38); +var DistanceBetween = __webpack_require__(56); var EventEmitter = __webpack_require__(11); -var FuzzyEqual = __webpack_require__(248); -var FuzzyGreaterThan = __webpack_require__(247); -var FuzzyLessThan = __webpack_require__(246); -var GetOverlapX = __webpack_require__(230); -var GetOverlapY = __webpack_require__(229); +var Events = __webpack_require__(248); +var FuzzyEqual = __webpack_require__(186); +var FuzzyGreaterThan = __webpack_require__(383); +var FuzzyLessThan = __webpack_require__(382); +var GetOverlapX = __webpack_require__(246); +var GetOverlapY = __webpack_require__(245); var GetValue = __webpack_require__(4); -var ProcessQueue = __webpack_require__(228); -var ProcessTileCallbacks = __webpack_require__(514); -var Rectangle = __webpack_require__(9); -var RTree = __webpack_require__(227); -var SeparateTile = __webpack_require__(513); -var SeparateX = __webpack_require__(508); -var SeparateY = __webpack_require__(507); -var Set = __webpack_require__(95); -var StaticBody = __webpack_require__(225); -var TileIntersectsBody = __webpack_require__(226); -var TransformMatrix = __webpack_require__(38); +var ProcessQueue = __webpack_require__(244); +var ProcessTileCallbacks = __webpack_require__(556); +var Rectangle = __webpack_require__(10); +var RTree = __webpack_require__(243); +var SeparateTile = __webpack_require__(555); +var SeparateX = __webpack_require__(550); +var SeparateY = __webpack_require__(549); +var Set = __webpack_require__(102); +var StaticBody = __webpack_require__(241); +var TileIntersectsBody = __webpack_require__(242); +var TransformMatrix = __webpack_require__(41); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(53); - -/** - * @event Phaser.Physics.Arcade.World#pause - */ - -/** - * @event Phaser.Physics.Arcade.World#resume - */ - -/** - * @event Phaser.Physics.Arcade.World#collide - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - */ - -/** - * @event Phaser.Physics.Arcade.World#overlap - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - */ - -/** - * @event Phaser.Physics.Arcade.World#worldbounds - * @param {Phaser.Physics.Arcade.Body} body - * @param {boolean} up - * @param {boolean} down - * @param {boolean} left - * @param {boolean} right - */ +var Wrap = __webpack_require__(57); /** * @typedef {object} ArcadeWorldConfig @@ -54127,30 +56409,30 @@ var Wrap = __webpack_require__(53); /** * @typedef {object} CheckCollisionObject * - * @property {boolean} up - [description] - * @property {boolean} down - [description] - * @property {boolean} left - [description] - * @property {boolean} right - [description] + * @property {boolean} up - Will bodies collide with the top side of the world bounds? + * @property {boolean} down - Will bodies collide with the bottom side of the world bounds? + * @property {boolean} left - Will bodies collide with the left side of the world bounds? + * @property {boolean} right - Will bodies collide with the right side of the world bounds? */ /** * @typedef {object} ArcadeWorldDefaults * - * @property {boolean} debugShowBody - [description] - * @property {boolean} debugShowStaticBody - [description] - * @property {boolean} debugShowVelocity - [description] - * @property {number} bodyDebugColor - [description] - * @property {number} staticBodyDebugColor - [description] - * @property {number} velocityDebugColor - [description] + * @property {boolean} debugShowBody - Set to `true` to render dynamic body outlines to the debug display. + * @property {boolean} debugShowStaticBody - Set to `true` to render static body outlines to the debug display. + * @property {boolean} debugShowVelocity - Set to `true` to render body velocity markers to the debug display. + * @property {number} bodyDebugColor - The color of dynamic body outlines when rendered to the debug display. + * @property {number} staticBodyDebugColor - The color of static body outlines when rendered to the debug display. + * @property {number} velocityDebugColor - The color of the velocity markers when rendered to the debug display. */ /** * @typedef {object} ArcadeWorldTreeMinMax * - * @property {number} minX - [description] - * @property {number} minY - [description] - * @property {number} maxX - [description] - * @property {number} maxY - [description] + * @property {number} minX - The minimum x value used in RTree searches. + * @property {number} minY - The minimum y value used in RTree searches. + * @property {number} maxX - The maximum x value used in RTree searches. + * @property {number} maxY - The maximum y value used in RTree searches. */ /** @@ -54238,6 +56520,28 @@ var World = new Class({ */ this.pendingDestroy = new Set(); + /** + * Dynamic Bodies that need a second `update` call to resynchronize their Game Objects. + * This set is filled only when the `_late` flag is on, and is processed and cleared during `postUpdate`. + * + * @name Phaser.Physics.Arcade.World#late + * @type {Phaser.Structs.Set.} + * @private + * @since 3.16.0 + */ + this.late = new Set(); + + /** + * A flag allowing the `late` set to be filled, as appropriate. + * This is on (true) only between `update` and `postUpdate` and false at other times. + * + * @name Phaser.Physics.Arcade.World#_late + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._late = false; + /** * This simulation's collision processors. * @@ -54266,8 +56570,8 @@ var World = new Class({ this.bounds = new Rectangle( GetValue(config, 'x', 0), GetValue(config, 'y', 0), - GetValue(config, 'width', scene.sys.game.config.width), - GetValue(config, 'height', scene.sys.game.config.height) + GetValue(config, 'width', scene.sys.scale.width), + GetValue(config, 'height', scene.sys.scale.height) ); /** @@ -54772,6 +57076,7 @@ var World = new Class({ { this.tree.remove(body); this.bodies.delete(body); + this.late.delete(body); } else if (body.physicsType === CONST.STATIC_BODY) { @@ -54881,7 +57186,7 @@ var World = new Class({ * checks. * * @method Phaser.Physics.Arcade.World#pause - * @fires Phaser.Physics.Arcade.World#pause + * @fires Phaser.Physics.Arcade.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -54890,7 +57195,7 @@ var World = new Class({ { this.isPaused = true; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -54899,7 +57204,7 @@ var World = new Class({ * Resumes the simulation, if paused. * * @method Phaser.Physics.Arcade.World#resume - * @fires Phaser.Physics.Arcade.World#resume + * @fires Phaser.Physics.Arcade.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -54908,7 +57213,7 @@ var World = new Class({ { this.isPaused = false; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -55060,6 +57365,7 @@ var World = new Class({ var msPerFrame = this._frameTimeMS * this.timeScale; this._elapsed += delta; + this._late = false; while (this._elapsed >= msPerFrame) { @@ -55071,15 +57377,16 @@ var World = new Class({ } this.stepsLastFrame = stepsThisFrame; + this._late = true; }, /** - * Advances the simulation by one step. + * Advances the simulation by a time increment. * * @method Phaser.Physics.Arcade.World#step * @since 3.10.0 * - * @param {number} delta - The delta time amount, in ms, by which to advance the simulation. + * @param {number} delta - The delta time amount, in seconds, by which to advance the simulation. */ step: function (delta) { @@ -55141,14 +57448,37 @@ var World = new Class({ postUpdate: function () { var i; + var bodies; var body; + var len; var dynamic = this.bodies; var staticBodies = this.staticBodies; var pending = this.pendingDestroy; + var late = this.late; - var bodies = dynamic.entries; - var len = bodies.length; + if (late.size > 0) + { + bodies = late.entries; + len = bodies.length; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.postUpdate(); + } + } + + late.clear(); + } + + this._late = false; + + bodies = dynamic.entries; + len = bodies.length; if (this.drawDebug) { @@ -55196,6 +57526,7 @@ var World = new Class({ { dynamicTree.remove(body); dynamic.delete(body); + late.delete(body); } else if (body.physicsType === CONST.STATIC_BODY) { @@ -55218,7 +57549,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to be updated. - * @param {number} delta - The delta value to be used in the motion calculations. + * @param {number} delta - The delta value to be used in the motion calculations, in seconds. */ updateMotion: function (body, delta) { @@ -55237,7 +57568,7 @@ var World = new Class({ * @since 3.10.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation. + * @param {number} delta - The delta value to be used in the calculation, in seconds. */ computeAngularVelocity: function (body, delta) { @@ -55283,7 +57614,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation. + * @param {number} delta - The delta value to be used in the calculation, in seconds. */ computeVelocity: function (body, delta) { @@ -55298,6 +57629,7 @@ var World = new Class({ var maxY = body.maxVelocity.y; var speed = body.speed; + var maxSpeed = body.maxSpeed; var allowDrag = body.allowDrag; var useDamping = body.useDamping; @@ -55383,14 +57715,19 @@ var World = new Class({ velocityY = Clamp(velocityY, -maxY, maxY); body.velocity.set(velocityX, velocityY); + + if (maxSpeed > -1 && body.velocity.length() > maxSpeed) + { + body.velocity.normalize().scale(maxSpeed); + } }, /** * Separates two Bodies. * * @method Phaser.Physics.Arcade.World#separate - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. @@ -55481,18 +57818,24 @@ var World = new Class({ if (result) { - if (overlapOnly && (body1.onOverlap || body2.onOverlap)) + if (overlapOnly) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + if (body1.onOverlap || body2.onOverlap) + { + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); + } } else { - body1.postUpdate(); - body2.postUpdate(); + if (this._late) + { + this.late.set(body1); + this.late.set(body2); + } if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } } } @@ -55504,14 +57847,14 @@ var World = new Class({ * Separates two Bodies, when both are circular. * * @method Phaser.Physics.Arcade.World#separateCircle - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. * @param {boolean} [overlapOnly] - If this a collide or overlap check? - * @param {number} bias - A small value added to the calculations. + * @param {number} [bias] - A small value added to the calculations. * * @return {boolean} True if separation occurred, otherwise false. */ @@ -55578,7 +57921,7 @@ var World = new Class({ { if (overlap !== 0 && (body1.onOverlap || body2.onOverlap)) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); } // return true if there was some overlap, otherwise false @@ -55690,7 +58033,7 @@ var World = new Class({ if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } // sync changes back to the bodies @@ -55818,9 +58161,9 @@ var World = new Class({ * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {*} [callbackContext] - The context in which to run the callbacks. + * @param {any} [callbackContext] - The context in which to run the callbacks. * - * @return {boolean} True if any overlapping Game Objects were separated, otherwise false. + * @return {boolean} `true` if any overlapping Game Objects were separated, otherwise `false`. */ collide: function (object1, object2, collideCallback, processCallback, callbackContext) { @@ -55832,16 +58175,17 @@ var World = new Class({ }, /** - * Helper for Phaser.Physics.Arcade.World#collide. + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideObjects + * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - [description] - * @param {ArcadeColliderType} [object2] - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {ArcadeColliderType} object1 - The first object to check for collision. + * @param {ArcadeColliderType} object2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -55902,16 +58246,17 @@ var World = new Class({ }, /** - * Helper for Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap. + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap instead. * * @method Phaser.Physics.Arcade.World#collideHandler + * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - [description] - * @param {ArcadeColliderType} [object2] - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. + * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -55980,19 +58325,21 @@ var World = new Class({ }, /** - * Handler for Sprite vs. Sprite collisions. + * Internal handler for Sprite vs. Sprite collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsSprite + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite1 - [description] - * @param {Phaser.GameObjects.GameObject} sprite2 - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.GameObject} sprite1 - The first object to check for collision. + * @param {Phaser.GameObjects.GameObject} sprite2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -56015,19 +58362,21 @@ var World = new Class({ }, /** - * Handler for Sprite vs. Group collisions. + * Internal handler for Sprite vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsGroup + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite - [description] - * @param {Phaser.GameObjects.Group} group - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} `true` if the Sprite collided with the given Group, otherwise `false`. */ collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -56108,19 +58457,21 @@ var World = new Class({ }, /** - * Helper for Group vs. Tilemap collisions. + * Internal handler for Group vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.Group} group - [description] - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.Group} group - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -56148,21 +58499,22 @@ var World = new Class({ }, /** - * Helper for Sprite vs. Tilemap collisions. + * Internal handler for Sprite vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite - [description] - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -56238,11 +58590,11 @@ var World = new Class({ if (overlapOnly && body.onOverlap) { - sprite.emit('overlap', body.gameObject, tile, body, null); + this.emit(Events.TILE_OVERLAP, body.gameObject, tile, body); } else if (body.onCollide) { - sprite.emit('collide', body.gameObject, tile, body, null); + this.emit(Events.TILE_COLLIDE, body.gameObject, tile, body); } // sync changes back to the body @@ -56252,19 +58604,21 @@ var World = new Class({ }, /** - * Helper for Group vs. Group collisions. + * Internal helper for Group vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideGroupVsGroup + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.Group} group1 - [description] - * @param {Phaser.GameObjects.Group} group2 - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.Group} group1 - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -56359,6 +58713,7 @@ var World = new Class({ this.staticTree.clear(); this.bodies.clear(); this.staticBodies.clear(); + this.late.clear(); this.colliders.destroy(); this.removeAllListeners(); @@ -56383,19 +58738,19 @@ module.exports = World; /***/ }), -/* 234 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeSprite = __webpack_require__(104); +var ArcadeSprite = __webpack_require__(111); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var Group = __webpack_require__(88); +var CONST = __webpack_require__(38); +var Group = __webpack_require__(94); var IsPlainObject = __webpack_require__(8); /** @@ -56474,7 +58829,7 @@ var StaticPhysicsGroup = new Class({ * * @name Phaser.Physics.Arcade.StaticGroup#physicsType * @type {integer} - * @default STATIC_BODY + * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ this.physicsType = CONST.STATIC_BODY; @@ -56562,20 +58917,20 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 235 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeSprite = __webpack_require__(104); +var ArcadeSprite = __webpack_require__(111); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); +var CONST = __webpack_require__(38); var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(88); +var Group = __webpack_require__(94); var IsPlainObject = __webpack_require__(8); /** @@ -56688,6 +59043,14 @@ var PhysicsGroup = new Class({ singleConfig.removeCallback = this.removeCallbackHandler; }); } + else + { + // config is not defined and children is not a plain object nor an array of plain objects + config = { + createCallback: this.createCallbackHandler, + removeCallback: this.removeCallbackHandler + }; + } /** * The physics simulation. @@ -56699,11 +59062,12 @@ var PhysicsGroup = new Class({ this.world = world; /** - * The class to create new group members from. - * This should be ArcadeImage, ArcadeSprite, or a class extending one of those. + * The class to create new Group members from. + * + * This should be either `Phaser.Physics.Arcade.Image`, `Phaser.Physics.Arcade.Sprite`, or a class extending one of those. * * @name Phaser.Physics.Arcade.Group#classType - * @type {(Phaser.Physics.Arcade.Image|Phaser.Physics.Arcade.Sprite)} + * @type {GroupClassTypeConstructor} * @default ArcadeSprite */ config.classType = GetFastValue(config, 'classType', ArcadeSprite); @@ -56713,7 +59077,7 @@ var PhysicsGroup = new Class({ * * @name Phaser.Physics.Arcade.Group#physicsType * @type {integer} - * @default DYNAMIC_BODY + * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ this.physicsType = CONST.DYNAMIC_BODY; @@ -56874,12 +59238,12 @@ module.exports = PhysicsGroup; /***/ }), -/* 236 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -56889,44 +59253,42 @@ module.exports = PhysicsGroup; module.exports = { - Acceleration: __webpack_require__(526), - Angular: __webpack_require__(525), - Bounce: __webpack_require__(524), - Debug: __webpack_require__(523), - Drag: __webpack_require__(522), - Enable: __webpack_require__(521), - Friction: __webpack_require__(520), - Gravity: __webpack_require__(519), - Immovable: __webpack_require__(518), - Mass: __webpack_require__(517), - Size: __webpack_require__(516), - Velocity: __webpack_require__(515) + Acceleration: __webpack_require__(575), + Angular: __webpack_require__(574), + Bounce: __webpack_require__(573), + Debug: __webpack_require__(572), + Drag: __webpack_require__(571), + Enable: __webpack_require__(570), + Friction: __webpack_require__(569), + Gravity: __webpack_require__(568), + Immovable: __webpack_require__(567), + Mass: __webpack_require__(566), + Size: __webpack_require__(565), + Velocity: __webpack_require__(564) }; /***/ }), -/* 237 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(236); -var Image = __webpack_require__(87); +var Components = __webpack_require__(253); +var Image = __webpack_require__(93); /** * @classdesc - * An Arcade Physics Image Game Object. + * An Arcade Physics Image is an Image with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * 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. + * The main difference between an Arcade Image and an Arcade Sprite is that you cannot animate an Arcade Image. * * @class Image * @extends Phaser.GameObjects.Image @@ -57009,21 +59371,21 @@ module.exports = ArcadeImage; /***/ }), -/* 238 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeImage = __webpack_require__(237); -var ArcadeSprite = __webpack_require__(104); +var ArcadeImage = __webpack_require__(254); +var ArcadeSprite = __webpack_require__(111); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var PhysicsGroup = __webpack_require__(235); -var StaticPhysicsGroup = __webpack_require__(234); +var CONST = __webpack_require__(38); +var PhysicsGroup = __webpack_require__(252); +var StaticPhysicsGroup = __webpack_require__(251); /** * @classdesc @@ -57072,7 +59434,7 @@ var Factory = new Class({ }, /** - * Create a new Arcade Physics Collider object. + * Creates a new Arcade Physics Collider object. * * @method Phaser.Physics.Arcade.Factory#collider * @since 3.0.0 @@ -57091,7 +59453,7 @@ var Factory = new Class({ }, /** - * Create a new Arcade Physics Collider Overlap object. + * Creates a new Arcade Physics Collider Overlap object. * * @method Phaser.Physics.Arcade.Factory#overlap * @since 3.0.0 @@ -57280,3110 +59642,18 @@ module.exports = Factory; /***/ }), -/* 239 */ +/* 256 */ /***/ (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__(138); -var Matrix3 = __webpack_require__(241); - -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 - * A quaternion. - * - * @class Quaternion - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. - */ -var Quaternion = new Class({ - - initialize: - - function Quaternion (x, y, z, w) - { - /** - * The x component of this Quaternion. - * - * @name Phaser.Math.Quaternion#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The y component of this Quaternion. - * - * @name Phaser.Math.Quaternion#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The z component of this Quaternion. - * - * @name Phaser.Math.Quaternion#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The w component of this Quaternion. - * - * @name Phaser.Math.Quaternion#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; - } - }, - - /** - * Copy the components of a given Quaternion or Vector into this Quaternion. - * - * @method Phaser.Math.Quaternion#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; - }, - - /** - * Set the components of this Quaternion. - * - * @method Phaser.Math.Quaternion#set - * @since 3.0.0 - * - * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. - * @param {number} [y=0] - The y component. - * @param {number} [z=0] - The z component. - * @param {number} [w=0] - The w component. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - set: function (x, y, z, w) - { - 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; - }, - - /** - * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. - * - * @method Phaser.Math.Quaternion#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - }, - - /** - * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. - * - * @method Phaser.Math.Quaternion#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - }, - - /** - * Scale this Quaternion by the given value. - * - * @method Phaser.Math.Quaternion#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - - return this; - }, - - /** - * Calculate the length of this Quaternion. - * - * @method Phaser.Math.Quaternion#length - * @since 3.0.0 - * - * @return {number} The length of this Quaternion. - */ - length: function () - { - 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); - }, - - /** - * Calculate the length of this Quaternion squared. - * - * @method Phaser.Math.Quaternion#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Quaternion, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return x * x + y * y + z * z + w * w; - }, - - /** - * Normalize this Quaternion. - * - * @method Phaser.Math.Quaternion#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - - 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; - }, - - /** - * Calculate the dot product of this Quaternion and the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#dot - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. - * - * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, - - /** - * Linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#lerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. - * @param {number} [t=0] - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - lerp: function (v, t) - { - 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; - }, - - /** - * [description] - * - * @method Phaser.Math.Quaternion#rotationTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - [description] - * @param {Phaser.Math.Vector3} b - [description] - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotationTo: function (a, b) - { - 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(); - - 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(); - } - }, - - /** - * Set the axes of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxes - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} view - The view axis. - * @param {Phaser.Math.Vector3} right - The right axis. - * @param {Phaser.Math.Vector3} up - The upwards axis. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxes: function (view, right, up) - { - var m = tmpMat3.val; - - 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(); - }, - - /** - * Reset this Matrix to an identity (default) Quaternion. - * - * @method Phaser.Math.Quaternion#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - identity: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; - }, - - /** - * Set the axis angle of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxisAngle - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} axis - The axis. - * @param {number} rad - The angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxisAngle: function (axis, rad) - { - 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; - }, - - /** - * Multiply this Quaternion by the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - multiply: function (b) - { - 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; - - 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; - }, - - /** - * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#slerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. - * @param {number} t - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - slerp: function (b, t) - { - // 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) - { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; - } - - // "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) - { - // 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; - }, - - /** - * Invert this Quaternion. - * - * @method Phaser.Math.Quaternion#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - invert: 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 - - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; - - return this; - }, - - /** - * Convert this Quaternion into its conjugate. - * - * Sets the x, y and z components. - * - * @method Phaser.Math.Quaternion#conjugate - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - conjugate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Rotate this Quaternion on the X axis. - * - * @method Phaser.Math.Quaternion#rotateX - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateX: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this Quaternion on the Y axis. - * - * @method Phaser.Math.Quaternion#rotateY - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - }, - - /** - * Rotate this Quaternion on the Z axis. - * - * @method Phaser.Math.Quaternion#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateZ: function (rad) - { - 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); - - 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; - }, - - /** - * Create a unit (or rotation) Quaternion from its x, y, and z components. - * - * Sets the w component. - * - * @method Phaser.Math.Quaternion#calculateW - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - calculateW: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); - - return this; - }, - - /** - * Convert the given Matrix into this Quaternion. - * - * @method Phaser.Math.Quaternion#fromMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - - -/***/ }), -/* 240 */ -/***/ (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 EPSILON = 0.000001; - -/** - * @classdesc - * A four-dimensional matrix. - * - * @class Matrix4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. - */ -var Matrix4 = new Class({ - - initialize: - - function Matrix4 (m) - { - /** - * The matrix values. - * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} - * @since 3.0.0 - */ - this.val = new Float32Array(16); - - if (m) - { - // Assume Matrix4 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, - - /** - * Make a clone of this Matrix4. - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} A clone of this Matrix4. - */ - clone: function () - { - return new Matrix4(this); - }, - - // TODO - Should work with basic values - - /** - * This method is an alias for `Matrix4.copy`. - * - * @method Phaser.Math.Matrix4#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - copy: function (src) - { - 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]; - 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; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix4#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromArray: function (a) - { - 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; - }, - - /** - * Reset this Matrix. - * - * Sets all values to `0`. - * - * @method Phaser.Math.Matrix4#zero - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - zero: function () - { - 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; - - return this; - }, - - /** - * Set the `x`, `y` and `z` values of this Matrix. - * - * @method Phaser.Math.Matrix4#xyz - * @since 3.0.0 - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - xyz: function (x, y, z) - { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; - - return this; - }, - - /** - * Set the scaling values of this Matrix. - * - * @method Phaser.Math.Matrix4#scaling - * @since 3.0.0 - * - * @param {number} x - The x scaling value. - * @param {number} y - The y scaling value. - * @param {number} z - The z scaling value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaling: function (x, y, z) - { - this.zero(); - - var out = this.val; - - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; - - return this; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix4#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - identity: function () - { - 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; - - return this; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix4#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - transpose: function () - { - 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; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix4#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - invert: 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 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; - - return this; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix4#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - adjoint: 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)); - - return this; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix4#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: 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 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; - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix4#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiply: function (src) - { - 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; - - 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.Math.Matrix4#multiplyLocal - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - [description] - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiplyLocal: function (src) - { - 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); - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix4#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translate: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - 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; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix4#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scale: 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; - - return this; - }, - - /** - * Derive a rotation matrix around the given axis. - * - * @method Phaser.Math.Matrix4#makeRotationAxis - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. - * @param {number} angle - The rotation angle in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - makeRotationAxis: function (axis, angle) - { - // 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.fromArray([ - 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; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotate: function (rad, axis) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its X axis. - * - * @method Phaser.Math.Matrix4#rotateX - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateX: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its Y axis. - * - * @method Phaser.Math.Matrix4#rotateY - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateY: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its Z axis. - * - * @method Phaser.Math.Matrix4#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateZ: function (rad) - { - 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]; - - // 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; - }, - - /** - * Set the values of this Matrix from the given rotation Quaternion and translation Vector. - * - * @method Phaser.Math.Matrix4#fromRotationTranslation - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. - * @param {Phaser.Math.Vector3} v - The Vector to set translation from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromRotationTranslation: function (q, v) - { - // 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; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = v.x; - out[13] = v.y; - out[14] = v.z; - out[15] = 1; - - return this; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix4#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromQuat: function (q) - { - 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; - - 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[15] = 1; - - return this; - }, - - /** - * Generate a frustum matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#frustum - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - frustum: function (left, right, bottom, top, near, far) - { - 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; - - 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; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspective - * @since 3.0.0 - * - * @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. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspective: function (fovy, aspect, near, far) - { - 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; - - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspectiveLH - * @since 3.0.0 - * - * @param {number} width - The width of the frustum. - * @param {number} height - The height of the frustum. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspectiveLH: function (width, height, near, far) - { - 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; - - out[12] = 0; - out[13] = 0; - out[14] = (near * far) / (near - far); - out[15] = 0; - - return this; - }, - - /** - * Generate an orthogonal projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#ortho - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - ortho: function (left, right, bottom, top, near, far) - { - 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; - - 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; - }, - - /** - * Generate a look-at matrix with the given eye position, focal point, and up axis. - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer - * @param {Phaser.Math.Vector3} center - Point the viewer is looking at - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - lookAt: function (eye, center, up) - { - var out = this.val; - - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; - - var upx = up.x; - var upy = up.y; - var upz = up.z; - - 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(); - } - - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; - - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - - z0 *= len; - z1 *= len; - z2 *= len; - - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; - - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - - if (!len) - { - x0 = 0; - x1 = 0; - x2 = 0; - } - else - { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - - if (!len) - { - y0 = 0; - y1 = 0; - y2 = 0; - } - else - { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - 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; - }, - - /** - * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {number} yaw - [description] - * @param {number} pitch - [description] - * @param {number} roll - [description] - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - yawPitchRoll: function (yaw, pitch, roll) - { - 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; - }, - - /** - * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. - * @param {Phaser.Math.Vector3} position - The position of the world matrix. - * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. - * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. - * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) - { - 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) - { - this.multiplyLocal(viewMatrix); - } - - if (projectionMatrix !== undefined) - { - this.multiplyLocal(projectionMatrix); - } - - return this; - } - -}); - -var _tempMat1 = new Matrix4(); -var _tempMat2 = new Matrix4(); - -module.exports = Matrix4; - - -/***/ }), -/* 241 */ -/***/ (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 - * A three-dimensional matrix. - * - * Defaults to the identity matrix when instantiated. - * - * @class Matrix3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. - */ -var Matrix3 = new Class({ - - initialize: - - function Matrix3 (m) - { - /** - * The matrix values. - * - * @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(); - } - }, - - /** - * Make a clone of this Matrix3. - * - * @method Phaser.Math.Matrix3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} A clone of this Matrix3. - */ - clone: function () - { - return new Matrix3(this); - }, - - /** - * This method is an alias for `Matrix3.copy`. - * - * @method Phaser.Math.Matrix3#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix3#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - copy: function (src) - { - 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; - }, - - /** - * Copy the values of a given Matrix4 into this Matrix3. - * - * @method Phaser.Math.Matrix3#fromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromMat4: function (m) - { - 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; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix3#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromArray: function (a) - { - 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; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix3#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - 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; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix3#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - transpose: function () - { - 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; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix3#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - invert: 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 a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; - - 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; - - if (!det) - { - 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; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix3#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - adjoint: 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 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; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix3#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: 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 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); - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix3#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - multiply: function (src) - { - 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]; - - 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; - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix3#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - translate: function (v) - { - var a = this.val; - var x = v.x; - var y = v.y; - - 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; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix3#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - rotate: function (rad) - { - 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; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x` and `y` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix3#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - scale: function (v) - { - 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; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix3#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromQuat: function (q) - { - 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; - - out[2] = xz + wy; - out[5] = yz - wx; - out[8] = 1 - (xx + yy); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Matrix3#normalFromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - [description] - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - normalFromMat4: function (m) - { - 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; - - 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; - - 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; - - -/***/ }), -/* 242 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. - * - * @function Phaser.Math.Rotate - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. - * @param {number} angle - The angle to be rotated by in an anticlockwise direction. - * - * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. - */ -var Rotate = function (point, angle) -{ - var x = point.x; - var y = point.y; - - point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); - point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); - - return point; -}; - -module.exports = Rotate; - - -/***/ }), -/* 243 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using ceil. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. - * As will `14` snap to `15`... but `16` will snap to `20`. - * - * @function Phaser.Math.Snap.Ceil - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapCeil = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.ceil(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapCeil; - - -/***/ }), -/* 244 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates the factorial of a given number for integer values greater than 0. - * - * @function Phaser.Math.Factorial - * @since 3.0.0 - * - * @param {number} value - A positive integer to calculate the factorial of. - * - * @return {number} The factorial of the given number. - */ -var Factorial = function (value) -{ - if (value === 0) - { - return 1; - } - - var res = value; - - while (--value) - { - res *= value; - } - - return res; -}; - -module.exports = Factorial; - - -/***/ }), -/* 245 */ -/***/ (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 Factorial = __webpack_require__(244); - -/** - * [description] - * - * @function Phaser.Math.Bernstein - * @since 3.0.0 - * - * @param {number} n - [description] - * @param {number} i - [description] - * - * @return {number} [description] - */ -var Bernstein = function (n, i) -{ - return Factorial(n) / Factorial(i) / Factorial(n - i); -}; - -module.exports = Bernstein; - - -/***/ }), -/* 246 */ -/***/ (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 whether `a` is fuzzily less than `b`. - * - * `a` is fuzzily less than `b` if it is less than `b + epsilon`. - * - * @function Phaser.Math.Fuzzy.LessThan - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. - */ -var LessThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a < b + epsilon; -}; - -module.exports = LessThan; - - -/***/ }), -/* 247 */ -/***/ (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 whether `a` is fuzzily greater than `b`. - * - * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. - * - * @function Phaser.Math.Fuzzy.GreaterThan - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. - */ -var GreaterThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a > b - epsilon; -}; - -module.exports = GreaterThan; - - -/***/ }), -/* 248 */ -/***/ (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 whether the given values are fuzzily equal. - * - * Two numbers are fuzzily equal if their difference is less than `epsilon`. - * - * @function Phaser.Math.Fuzzy.Equal - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. - */ -var Equal = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.abs(a - b) < epsilon; -}; - -module.exports = Equal; - - -/***/ }), -/* 249 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points), squared. - * - * @function Phaser.Math.Distance.Squared - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point, squared. - */ -var DistanceSquared = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; - - return dx * dx + dy * dy; -}; - -module.exports = DistanceSquared; - - -/***/ }), -/* 250 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Normalize an angle to the [0, 2pi] range. - * - * @function Phaser.Math.Angle.Normalize - * @since 3.0.0 - * - * @param {number} angle - The angle to normalize, in radians. - * - * @return {number} The normalized angle, in radians. - */ -var Normalize = function (angle) -{ - angle = angle % (2 * Math.PI); - - if (angle >= 0) - { - return angle; - } - else - { - return angle + 2 * Math.PI; - } -}; - -module.exports = Normalize; - - -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -60556,19 +59826,20 @@ module.exports = TextFile; /***/ }), -/* 252 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var File = __webpack_require__(21); +var Events = __webpack_require__(75); +var File = __webpack_require__(22); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(141); +var GetURL = __webpack_require__(152); var IsPlainObject = __webpack_require__(8); /** @@ -60665,6 +59936,7 @@ var HTML5AudioFile = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.FileTypes.HTML5AudioFile#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 */ onProgress: function (event) @@ -60678,7 +59950,7 @@ var HTML5AudioFile = new Class({ this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); if (this.filesLoaded === this.filesTotal) { @@ -60752,21 +60024,21 @@ module.exports = HTML5AudioFile; /***/ }), -/* 253 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(26); -var File = __webpack_require__(21); +var CONST = __webpack_require__(28); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(252); +var HTML5AudioFile = __webpack_require__(257); var IsPlainObject = __webpack_require__(8); /** @@ -61032,16 +60304,16 @@ module.exports = AudioFile; /***/ }), -/* 254 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MergeXHRSettings = __webpack_require__(140); +var MergeXHRSettings = __webpack_require__(151); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -61085,7 +60357,7 @@ var XHRLoader = function (file, globalXHRSettings) // After a successful request, the xhr.response property will contain the requested data as a DOMString, ArrayBuffer, Blob, or Document (depending on what was set for responseType.) xhr.onload = file.onLoad.bind(file, xhr); - xhr.onerror = file.onError.bind(file); + xhr.onerror = file.onError.bind(file, xhr); xhr.onprogress = file.onProgress.bind(file); // This is the only standard method, the ones above are browser additions (maybe not universal?) @@ -61100,19 +60372,20 @@ module.exports = XHRLoader; /***/ }), -/* 255 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(113); var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(605); -var ResetKeyCombo = __webpack_require__(603); +var ProcessKeyCombo = __webpack_require__(611); +var ResetKeyCombo = __webpack_require__(609); /** * @callback KeyboardKeydownCallback @@ -61160,6 +60433,7 @@ var ResetKeyCombo = __webpack_require__(603); * @class KeyCombo * @memberof Phaser.Input.Keyboard * @constructor + * @listens Phaser.Input.Keyboard.Events#ANY_KEY_DOWN * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. @@ -61340,7 +60614,7 @@ var KeyCombo = new Class({ if (matched) { - _this.manager.emit('keycombomatch', _this, event); + _this.manager.emit(Events.COMBO_MATCH, _this, event); if (_this.resetOnMatch) { @@ -61359,11 +60633,12 @@ var KeyCombo = new Class({ * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown * @private * @type {KeyboardKeydownCallback} + * @fires Phaser.Input.Keyboard.Events#COMBO_MATCH * @since 3.0.0 */ this.onKeyDown = onKeyDownHandler; - this.manager.on('keydown', onKeyDownHandler); + this.manager.on(Events.ANY_KEY_DOWN, this.onKeyDown); }, /** @@ -61394,7 +60669,7 @@ var KeyCombo = new Class({ this.enabled = false; this.keyCodes = []; - this.manager.off('keydown', this.onKeyDown); + this.manager.off(Events.ANY_KEY_DOWN, this.onKeyDown); this.manager = null; } @@ -61405,16 +60680,18 @@ module.exports = KeyCombo; /***/ }), -/* 256 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); +var Events = __webpack_require__(113); /** * @classdesc @@ -61422,6 +60699,7 @@ var Class = __webpack_require__(0); * keycode must be an integer * * @class Key + * @extends Phaser.Events.EventEmitter * @memberof Phaser.Input.Keyboard * @constructor * @since 3.0.0 @@ -61430,10 +60708,14 @@ var Class = __webpack_require__(0); */ var Key = new Class({ + Extends: EventEmitter, + initialize: function Key (keyCode) { + EventEmitter.call(this); + /** * The keycode of this key. * @@ -61452,16 +60734,6 @@ var Key = new Class({ */ this.originalEvent = undefined; - /** - * Should this Key prevent event propagation? - * - * @name Phaser.Input.Keyboard.Key#preventDefault - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.preventDefault = true; - /** * Can this Key be processed? * @@ -61522,6 +60794,17 @@ var Key = new Class({ */ this.shiftKey = false; + /** + * The down state of the Meta key, if pressed at the same time as this key. + * On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key. + * + * @name Phaser.Input.Keyboard.Key#metaKey + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.metaKey = false; + /** * The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad. * @@ -61562,6 +60845,19 @@ var Key = new Class({ */ this.timeUp = 0; + /** + * When a key is held down should it continuously fire the `down` event each time it repeats? + * + * By default it will emit the `down` event just once, but if you wish to receive the event + * for each repeat as well, enable this property. + * + * @name Phaser.Input.Keyboard.Key#emitOnRepeat + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.emitOnRepeat = false; + /** * If a key is held down this holds down the number of times the key has 'repeated'. * @@ -61605,10 +60901,104 @@ var Key = new Class({ this._tick = -1; }, + /** + * Controls if this Key will continuously emit a `down` event while being held down (true), + * or emit the event just once, on first press, and then skip future events (false). + * + * @method Phaser.Input.Keyboard.Key#setEmitOnRepeat + * @since 3.16.0 + * + * @param {boolean} value - Emit `down` events on repeated key down actions, or just once? + * + * @return {Phaser.Input.Keyboard.Key} This Key instance. + */ + setEmitOnRepeat: function (value) + { + this.emitOnRepeat = value; + + return this; + }, + + /** + * Processes the Key Down action for this Key. + * Called automatically by the Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.Key#onDown + * @fires Phaser.Input.Keyboard.Events#DOWN + * @since 3.16.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard event. + */ + onDown: function (event) + { + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.altKey = event.altKey; + this.ctrlKey = event.ctrlKey; + this.shiftKey = event.shiftKey; + this.metaKey = event.metaKey; + this.location = event.location; + + this.repeats++; + + if (!this.isDown) + { + this.isDown = true; + this.isUp = false; + this.timeDown = event.timeStamp; + this.duration = 0; + this._justDown = true; + this._justUp = false; + + this.emit(Events.DOWN, this, event); + } + else if (this.emitOnRepeat) + { + this.emit(Events.DOWN, this, event); + } + }, + + /** + * Processes the Key Up action for this Key. + * Called automatically by the Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.Key#onUp + * @fires Phaser.Input.Keyboard.Events#UP + * @since 3.16.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard event. + */ + onUp: function (event) + { + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.isDown = false; + this.isUp = true; + this.timeUp = event.timeStamp; + this.duration = this.timeUp - this.timeDown; + this.repeats = 0; + + this._justDown = false; + this._justUp = true; + this._tick = -1; + + this.emit(Events.UP, this, event); + }, + /** * Resets this Key object back to its default un-pressed state. * - * @method Phaser.Input.Keyboard.Key.reset + * @method Phaser.Input.Keyboard.Key#reset * @since 3.6.0 * * @return {Phaser.Input.Keyboard.Key} This Key instance. @@ -61622,6 +61012,7 @@ var Key = new Class({ this.altKey = false; this.ctrlKey = false; this.shiftKey = false; + this.metaKey = false; this.timeDown = 0; this.duration = 0; this.timeUp = 0; @@ -61631,6 +61022,19 @@ var Key = new Class({ this._tick = -1; return this; + }, + + /** + * Removes any bound event handlers and removes local references. + * + * @method Phaser.Input.Keyboard.Key#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.originalEvent = null; } }); @@ -61639,17 +61043,17 @@ module.exports = Key; /***/ }), -/* 257 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Axis = __webpack_require__(259); -var Button = __webpack_require__(258); +var Axis = __webpack_require__(264); +var Button = __webpack_require__(263); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(11); var Vector2 = __webpack_require__(3); @@ -62397,16 +61801,17 @@ module.exports = Gamepad; /***/ }), -/* 258 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(153); /** * @classdesc @@ -62491,10 +61896,14 @@ var Button = new Class({ * Called automatically by the Gamepad as part of its update. * * @method Phaser.Input.Gamepad.Button#update + * @fires Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#BUTTON_UP + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP * @private * @since 3.0.0 * - * @param {number} value - The GamepadButton value. + * @param {number} value - The value of the button. Between 0 and 1. */ update: function (value) { @@ -62508,15 +61917,15 @@ var Button = new Class({ if (!this.pressed) { this.pressed = true; - this.events.emit('down', pad, this, value); - this.pad.emit('down', index, value, this); + this.events.emit(Events.BUTTON_DOWN, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_DOWN, index, value, this); } } else if (this.pressed) { this.pressed = false; - this.events.emit('up', pad, this, value); - this.pad.emit('up', index, value, this); + this.events.emit(Events.BUTTON_UP, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_UP, index, value, this); } }, @@ -62538,12 +61947,12 @@ module.exports = Button; /***/ }), -/* 259 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -62663,12 +62072,12 @@ module.exports = Axis; /***/ }), -/* 260 */ +/* 265 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -62759,12 +62168,12 @@ module.exports = CreateInteractiveObject; /***/ }), -/* 261 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -62783,17 +62192,17 @@ function getLength (x1, y1, x2, y2) } /** - * [description] + * Calculates the position of the incenter of a Triangle object. This is the point where its three angle bisectors meet and it's also the center of the incircle, which is the circle inscribed in the triangle. * * @function Phaser.Geom.Triangle.InCenter * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to find the incenter of. + * @param {Phaser.Geom.Point} [out] - An optional Point in which to store the coordinates. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} Point (x, y) of the center pixel of the triangle. */ var InCenter = function (triangle, out) { @@ -62824,28 +62233,28 @@ module.exports = InCenter; /***/ }), -/* 262 */ +/* 267 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Moves each point (vertex) of a Triangle by a given offset, thus moving the entire Triangle by that offset. * * @function Phaser.Geom.Triangle.Offset * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to move. + * @param {number} x - The horizontal offset (distance) by which to move each point. Can be positive or negative. + * @param {number} y - The vertical offset (distance) by which to move each point. Can be positive or negative. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The modified Triangle. */ var Offset = function (triangle, x, y) { @@ -62865,12 +62274,12 @@ module.exports = Offset; /***/ }), -/* 263 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -62881,17 +62290,19 @@ var Point = __webpack_require__(6); // The centroid divides each median in a ratio of 2:1 /** - * [description] + * Calculates the position of a Triangle's centroid, which is also its center of mass (center of gravity). + * + * The centroid is the point in a Triangle at which its three medians (the lines drawn from the vertices to the bisectors of the opposite sides) meet. It divides each one in a 2:1 ratio. * * @function Phaser.Geom.Triangle.Centroid * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the coordinates in. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} The `out` object with modified `x` and `y` properties, or a new Point if none was provided. */ var Centroid = function (triangle, out) { @@ -62907,27 +62318,25 @@ module.exports = Centroid; /***/ }), -/* 264 */ +/* 269 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Checks if rectB is fully contained within rectA - /** - * [description] + * Tests if one rectangle fully contains another. * * @function Phaser.Geom.Rectangle.ContainsRect * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first rectangle. + * @param {Phaser.Geom.Rectangle} rectB - The second rectangle. * - * @return {boolean} [description] + * @return {boolean} True only if rectA fully contains rectB. */ var ContainsRect = function (rectA, rectB) { @@ -62949,77 +62358,77 @@ module.exports = ContainsRect; /***/ }), -/* 265 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); -Rectangle.Area = __webpack_require__(656); -Rectangle.Ceil = __webpack_require__(655); -Rectangle.CeilAll = __webpack_require__(654); -Rectangle.CenterOn = __webpack_require__(175); -Rectangle.Clone = __webpack_require__(653); -Rectangle.Contains = __webpack_require__(39); -Rectangle.ContainsPoint = __webpack_require__(652); -Rectangle.ContainsRect = __webpack_require__(264); -Rectangle.CopyFrom = __webpack_require__(651); -Rectangle.Decompose = __webpack_require__(270); -Rectangle.Equals = __webpack_require__(650); -Rectangle.FitInside = __webpack_require__(649); -Rectangle.FitOutside = __webpack_require__(648); -Rectangle.Floor = __webpack_require__(647); -Rectangle.FloorAll = __webpack_require__(646); -Rectangle.FromPoints = __webpack_require__(173); -Rectangle.GetAspectRatio = __webpack_require__(145); -Rectangle.GetCenter = __webpack_require__(645); -Rectangle.GetPoint = __webpack_require__(190); -Rectangle.GetPoints = __webpack_require__(398); -Rectangle.GetSize = __webpack_require__(644); -Rectangle.Inflate = __webpack_require__(643); -Rectangle.Intersection = __webpack_require__(642); -Rectangle.MarchingAnts = __webpack_require__(388); -Rectangle.MergePoints = __webpack_require__(641); -Rectangle.MergeRect = __webpack_require__(640); -Rectangle.MergeXY = __webpack_require__(639); -Rectangle.Offset = __webpack_require__(638); -Rectangle.OffsetPoint = __webpack_require__(637); -Rectangle.Overlaps = __webpack_require__(636); -Rectangle.Perimeter = __webpack_require__(124); -Rectangle.PerimeterPoint = __webpack_require__(635); -Rectangle.Random = __webpack_require__(187); -Rectangle.RandomOutside = __webpack_require__(634); -Rectangle.SameDimensions = __webpack_require__(633); -Rectangle.Scale = __webpack_require__(632); -Rectangle.Union = __webpack_require__(309); +Rectangle.Area = __webpack_require__(675); +Rectangle.Ceil = __webpack_require__(674); +Rectangle.CeilAll = __webpack_require__(673); +Rectangle.CenterOn = __webpack_require__(189); +Rectangle.Clone = __webpack_require__(672); +Rectangle.Contains = __webpack_require__(42); +Rectangle.ContainsPoint = __webpack_require__(671); +Rectangle.ContainsRect = __webpack_require__(269); +Rectangle.CopyFrom = __webpack_require__(670); +Rectangle.Decompose = __webpack_require__(275); +Rectangle.Equals = __webpack_require__(669); +Rectangle.FitInside = __webpack_require__(668); +Rectangle.FitOutside = __webpack_require__(667); +Rectangle.Floor = __webpack_require__(666); +Rectangle.FloorAll = __webpack_require__(665); +Rectangle.FromPoints = __webpack_require__(180); +Rectangle.GetAspectRatio = __webpack_require__(155); +Rectangle.GetCenter = __webpack_require__(664); +Rectangle.GetPoint = __webpack_require__(204); +Rectangle.GetPoints = __webpack_require__(430); +Rectangle.GetSize = __webpack_require__(663); +Rectangle.Inflate = __webpack_require__(662); +Rectangle.Intersection = __webpack_require__(661); +Rectangle.MarchingAnts = __webpack_require__(419); +Rectangle.MergePoints = __webpack_require__(660); +Rectangle.MergeRect = __webpack_require__(659); +Rectangle.MergeXY = __webpack_require__(658); +Rectangle.Offset = __webpack_require__(657); +Rectangle.OffsetPoint = __webpack_require__(656); +Rectangle.Overlaps = __webpack_require__(655); +Rectangle.Perimeter = __webpack_require__(135); +Rectangle.PerimeterPoint = __webpack_require__(654); +Rectangle.Random = __webpack_require__(201); +Rectangle.RandomOutside = __webpack_require__(653); +Rectangle.SameDimensions = __webpack_require__(652); +Rectangle.Scale = __webpack_require__(651); +Rectangle.Union = __webpack_require__(313); module.exports = Rectangle; /***/ }), -/* 266 */ +/* 271 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the square of magnitude of given point.(Can be used for fast magnitude calculation of point) * * @function Phaser.Geom.Point.GetMagnitudeSq * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Point} point - Returns square of the magnitude/length of given point. * - * @return {number} [description] + * @return {number} Returns square of the magnitude of given point. */ var GetMagnitudeSq = function (point) { @@ -63030,24 +62439,24 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 267 */ +/* 272 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculate the magnitude of the point, which equivalent to the length of the line from the origin to this point. * * @function Phaser.Geom.Point.GetMagnitude * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Point} point - The point to calculate the magnitude for * - * @return {number} [description] + * @return {number} The resulting magnitude */ var GetMagnitude = function (point) { @@ -63058,18 +62467,18 @@ module.exports = GetMagnitude; /***/ }), -/* 268 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Wrap = __webpack_require__(53); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Wrap = __webpack_require__(57); +var Angle = __webpack_require__(73); /** * Get the angle of the normal of the given line in radians. @@ -63092,25 +62501,25 @@ module.exports = NormalAngle; /***/ }), -/* 269 */ +/* 274 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Decomposes a Triangle into an array of its points. * * @function Phaser.Geom.Triangle.Decompose * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {array} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to decompose. + * @param {array} [out] - An array to store the points into. * - * @return {array} [description] + * @return {array} The provided `out` array, or a new array if none was provided, with three objects with `x` and `y` properties representing each point of the Triangle appended to it. */ var Decompose = function (triangle, out) { @@ -63127,12 +62536,12 @@ module.exports = Decompose; /***/ }), -/* 270 */ +/* 275 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -63164,63 +62573,103 @@ module.exports = Decompose; /***/ }), -/* 271 */ +/* 276 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if the a Point falls between the two end-points of a Line, based on the given line thickness. + * + * Assumes that the line end points are circular, not square. * * @function Phaser.Geom.Intersects.PointToLine * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Line} line - [description] + * @param {(Phaser.Geom.Point|any)} point - The point, or point-like object to check. + * @param {Phaser.Geom.Line} line - The line segment to test for intersection on. + * @param {number} [lineThickness=1] - The line thickness. Assumes that the line end points are circular. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point falls on the Line, otherwise `false`. */ -var PointToLine = function (point, line) +var PointToLine = function (point, line, lineThickness) { - return ((point.x - line.x1) * (line.y2 - line.y1) === (line.x2 - line.x1) * (point.y - line.y1)); + if (lineThickness === undefined) { lineThickness = 1; } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var px = point.x; + var py = point.y; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return false; + } + + var r = (((px - x1) * (x2 - x1)) + ((py - y1) * (y2 - y1))) / L2; + + // Assume line thickness is circular + if (r < 0) + { + // Outside line1 + return (Math.sqrt(((x1 - px) * (x1 - px)) + ((y1 - py) * (y1 - py))) <= lineThickness); + } + else if ((r >= 0) && (r <= 1)) + { + // On the line segment + var s = (((y1 - py) * (x2 - x1)) - ((x1 - px) * (y2 - y1))) / L2; + + return (Math.abs(s) * Math.sqrt(L2) <= lineThickness); + } + else + { + // Outside line2 + return (Math.sqrt(((x2 - px) * (x2 - px)) + ((y2 - py) * (y2 - py))) <= lineThickness); + } }; module.exports = PointToLine; /***/ }), -/* 272 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on code by Matt DesLauriers -// https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md - -var Contains = __webpack_require__(40); +var Contains = __webpack_require__(43); var Point = __webpack_require__(6); var tmp = new Point(); /** - * [description] + * Checks for intersection between the line segment and circle. + * + * Based on code by [Matt DesLauriers](https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md). * * @function Phaser.Geom.Intersects.LineToCircle * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] - * @param {Phaser.Geom.Circle} circle - [description] - * @param {Phaser.Geom.Point} [nearest] - [description] + * @param {Phaser.Geom.Line} line - The line segment to check. + * @param {Phaser.Geom.Circle} circle - The circle to check against the line. + * @param {(Phaser.Geom.Point|any)} [nearest] - An optional Point-like object. If given the closest point on the Line where the circle intersects will be stored in this object. * - * @return {boolean} [description] + * @return {boolean} `true` if the two objects intersect, otherwise `false`. */ var LineToCircle = function (line, circle, nearest) { @@ -63278,12 +62727,12 @@ module.exports = LineToCircle; /***/ }), -/* 273 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -63293,31 +62742,31 @@ module.exports = LineToCircle; module.exports = { - CircleToCircle: __webpack_require__(703), - CircleToRectangle: __webpack_require__(702), - GetRectangleIntersection: __webpack_require__(701), - LineToCircle: __webpack_require__(272), - LineToLine: __webpack_require__(107), - LineToRectangle: __webpack_require__(700), - PointToLine: __webpack_require__(271), - PointToLineSegment: __webpack_require__(699), - RectangleToRectangle: __webpack_require__(148), - RectangleToTriangle: __webpack_require__(698), - RectangleToValues: __webpack_require__(697), - TriangleToCircle: __webpack_require__(696), - TriangleToLine: __webpack_require__(695), - TriangleToTriangle: __webpack_require__(694) + CircleToCircle: __webpack_require__(725), + CircleToRectangle: __webpack_require__(724), + GetRectangleIntersection: __webpack_require__(723), + LineToCircle: __webpack_require__(277), + LineToLine: __webpack_require__(115), + LineToRectangle: __webpack_require__(722), + PointToLine: __webpack_require__(276), + PointToLineSegment: __webpack_require__(721), + RectangleToRectangle: __webpack_require__(158), + RectangleToTriangle: __webpack_require__(720), + RectangleToValues: __webpack_require__(719), + TriangleToCircle: __webpack_require__(718), + TriangleToLine: __webpack_require__(717), + TriangleToTriangle: __webpack_require__(716) }; /***/ }), -/* 274 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -63327,31 +62776,31 @@ module.exports = { module.exports = { - Circle: __webpack_require__(723), - Ellipse: __webpack_require__(713), - Intersects: __webpack_require__(273), - Line: __webpack_require__(693), - Point: __webpack_require__(675), - Polygon: __webpack_require__(661), - Rectangle: __webpack_require__(265), - Triangle: __webpack_require__(631) + Circle: __webpack_require__(745), + Ellipse: __webpack_require__(735), + Intersects: __webpack_require__(278), + Line: __webpack_require__(715), + Point: __webpack_require__(694), + Polygon: __webpack_require__(680), + Rectangle: __webpack_require__(270), + Triangle: __webpack_require__(650) }; /***/ }), -/* 275 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Light = __webpack_require__(276); -var Utils = __webpack_require__(10); +var Light = __webpack_require__(281); +var Utils = __webpack_require__(9); /** * @callback LightForEach @@ -63703,17 +63152,17 @@ module.exports = LightsManager; /***/ }), -/* 276 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(10); +var Utils = __webpack_require__(9); /** * @classdesc @@ -63966,16 +63415,16 @@ module.exports = Light; /***/ }), -/* 277 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); var Point = __webpack_require__(6); /** @@ -64059,32 +63508,31 @@ module.exports = GetPoints; /***/ }), -/* 278 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); -// Position is a value between 0 and 1 /** - * [description] + * Returns a Point from around the perimeter of a Triangle. * * @function Phaser.Geom.Triangle.GetPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} position - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the point on its perimeter from. + * @param {number} position - The position along the perimeter of the triangle. A value between 0 and 1. + * @param {(Phaser.Geom.Point|object)} [out] - An option Point, or Point-like object to store the value in. If not given a new Point will be created. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} A Point object containing the given position from the perimeter of the triangle. */ var GetPoint = function (triangle, position, out) { @@ -64147,19 +63595,19 @@ module.exports = GetPoint; /***/ }), -/* 279 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); -var GeomTriangle = __webpack_require__(59); -var TriangleRender = __webpack_require__(772); +var Shape = __webpack_require__(29); +var GeomTriangle = __webpack_require__(65); +var TriangleRender = __webpack_require__(795); /** * @classdesc @@ -64290,19 +63738,19 @@ module.exports = Triangle; /***/ }), -/* 280 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StarRender = __webpack_require__(775); +var StarRender = __webpack_require__(798); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); -var Shape = __webpack_require__(27); +var Earcut = __webpack_require__(71); +var Shape = __webpack_require__(29); /** * @classdesc @@ -64578,19 +64026,19 @@ module.exports = Star; /***/ }), -/* 281 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GeomRectangle = __webpack_require__(9); -var Shape = __webpack_require__(27); -var RectangleRender = __webpack_require__(778); +var GeomRectangle = __webpack_require__(10); +var Shape = __webpack_require__(29); +var RectangleRender = __webpack_require__(801); /** * @classdesc @@ -64690,13 +64138,13 @@ module.exports = Rectangle; /***/ }), -/* 282 */ +/* 287 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Igor Ognichenko - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -64763,17 +64211,17 @@ module.exports = Smooth; /***/ }), -/* 283 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); -var Line = __webpack_require__(54); +var Length = __webpack_require__(58); +var Line = __webpack_require__(59); /** * Returns the perimeter of the given Polygon. @@ -64811,18 +64259,18 @@ module.exports = Perimeter; /***/ }), -/* 284 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); -var Line = __webpack_require__(54); -var Perimeter = __webpack_require__(283); +var Length = __webpack_require__(58); +var Line = __webpack_require__(59); +var Perimeter = __webpack_require__(288); /** * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, @@ -64888,29 +64336,29 @@ module.exports = GetPoints; /***/ }), -/* 285 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** - * [description] + * Calculates the bounding AABB rectangle of a polygon. * * @function Phaser.Geom.Polygon.GetAABB * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [out,$return] * - * @param {Phaser.Geom.Polygon} polygon - [description] - * @param {(Phaser.Geom.Rectangle|object)} [out] - [description] + * @param {Phaser.Geom.Polygon} polygon - The polygon that should be calculated. + * @param {(Phaser.Geom.Rectangle|object)} [out] - The rectangle or object that has x, y, width, and height properties to store the result. Optional. * - * @return {(Phaser.Geom.Rectangle|object)} [description] + * @return {(Phaser.Geom.Rectangle|object)} The resulting rectangle or object that is passed in with position and dimensions of the polygon's AABB. */ var GetAABB = function (polygon, out) { @@ -64944,22 +64392,22 @@ module.exports = GetAABB; /***/ }), -/* 286 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PolygonRender = __webpack_require__(781); +var PolygonRender = __webpack_require__(804); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); -var GetAABB = __webpack_require__(285); -var GeomPolygon = __webpack_require__(151); -var Shape = __webpack_require__(27); -var Smooth = __webpack_require__(282); +var Earcut = __webpack_require__(71); +var GetAABB = __webpack_require__(290); +var GeomPolygon = __webpack_require__(161); +var Shape = __webpack_require__(29); +var Smooth = __webpack_require__(287); /** * @classdesc @@ -65083,19 +64531,19 @@ module.exports = Polygon; /***/ }), -/* 287 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); -var GeomLine = __webpack_require__(54); -var LineRender = __webpack_require__(784); +var Shape = __webpack_require__(29); +var GeomLine = __webpack_require__(59); +var LineRender = __webpack_require__(807); /** * @classdesc @@ -65247,18 +64695,18 @@ module.exports = Line; /***/ }), -/* 288 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var IsoTriangleRender = __webpack_require__(787); -var Shape = __webpack_require__(27); +var IsoTriangleRender = __webpack_require__(810); +var Shape = __webpack_require__(29); /** * @classdesc @@ -65493,18 +64941,18 @@ module.exports = IsoTriangle; /***/ }), -/* 289 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsoBoxRender = __webpack_require__(790); +var IsoBoxRender = __webpack_require__(813); var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); +var Shape = __webpack_require__(29); /** * @classdesc @@ -65708,18 +65156,18 @@ module.exports = IsoBox; /***/ }), -/* 290 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); -var GridRender = __webpack_require__(793); +var Shape = __webpack_require__(29); +var GridRender = __webpack_require__(816); /** * @classdesc @@ -65990,20 +65438,20 @@ module.exports = Grid; /***/ }), -/* 291 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); -var EllipseRender = __webpack_require__(796); -var GeomEllipse = __webpack_require__(90); -var Shape = __webpack_require__(27); +var Earcut = __webpack_require__(71); +var EllipseRender = __webpack_require__(819); +var GeomEllipse = __webpack_require__(96); +var Shape = __webpack_require__(29); /** * @classdesc @@ -66177,20 +65625,20 @@ module.exports = Ellipse; /***/ }), -/* 292 */ +/* 297 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var CurveRender = __webpack_require__(799); -var Earcut = __webpack_require__(64); -var Rectangle = __webpack_require__(9); -var Shape = __webpack_require__(27); +var CurveRender = __webpack_require__(822); +var Earcut = __webpack_require__(71); +var Rectangle = __webpack_require__(10); +var Shape = __webpack_require__(29); /** * @classdesc @@ -66359,22 +65807,22 @@ module.exports = Curve; /***/ }), -/* 293 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcRender = __webpack_require__(802); +var ArcRender = __webpack_require__(825); var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var Earcut = __webpack_require__(64); -var GeomCircle = __webpack_require__(71); -var MATH_CONST = __webpack_require__(16); -var Shape = __webpack_require__(27); +var DegToRad = __webpack_require__(34); +var Earcut = __webpack_require__(71); +var GeomCircle = __webpack_require__(77); +var MATH_CONST = __webpack_require__(20); +var Shape = __webpack_require__(29); /** * @classdesc @@ -66763,42 +66211,12 @@ module.exports = Arc; /***/ }), -/* 294 */ +/* 299 */ /***/ (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 nearest power of 2 to the given `value`. - * - * @function Phaser.Math.Pow2.GetPowerOfTwo - * @since 3.0.0 - * - * @param {number} value - The value. - * - * @return {integer} The nearest power of 2 to `value`. - */ -var GetPowerOfTwo = function (value) -{ - var index = Math.log(value) / 0.6931471805599453; - - return (1 << Math.ceil(index)); -}; - -module.exports = GetPowerOfTwo; - - -/***/ }), -/* 295 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -66828,21 +66246,21 @@ module.exports = UUID; /***/ }), -/* 296 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var GetBoolean = __webpack_require__(84); +var DegToRad = __webpack_require__(34); +var GetBoolean = __webpack_require__(90); var GetValue = __webpack_require__(4); -var Sprite = __webpack_require__(61); -var TWEEN_CONST = __webpack_require__(83); +var Sprite = __webpack_require__(67); +var TWEEN_CONST = __webpack_require__(89); var Vector2 = __webpack_require__(3); /** @@ -66856,7 +66274,7 @@ var Vector2 = __webpack_require__(3); * @property {boolean} [positionOnPath=false] - Whether to position the PathFollower on the Path using its path offset. * @property {boolean} [rotateToPath=false] - Should the PathFollower automatically rotate to point in the direction of the Path? * @property {number} [rotationOffset=0] - If the PathFollower is rotating to match the Path, this value is added to the rotation value. This allows you to rotate objects to a path but control the angle of the rotation as well. - * @property {boolean} [verticalAdjust=false] - [description] + * @property {number} [startAt=0] - Current start position of the path follow, between 0 and 1. */ /** @@ -66914,16 +66332,6 @@ var PathFollower = new Class({ */ this.rotateToPath = false; - /** - * [description] - * - * @name Phaser.GameObjects.PathFollower#pathRotationVerticalAdjust - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.pathRotationVerticalAdjust = false; - /** * If the PathFollower is rotating to match the Path (@see Phaser.GameObjects.PathFollower#rotateToPath) * this value is added to the rotation value. This allows you to rotate objects to a path but control @@ -66947,7 +66355,7 @@ var PathFollower = new Class({ this.pathOffset = new Vector2(x, y); /** - * [description] + * A Vector2 that stores the current point of the path the follower is on. * * @name Phaser.GameObjects.PathFollower#pathVector * @type {Phaser.Math.Vector2} @@ -67027,19 +66435,16 @@ var PathFollower = new Class({ * * @param {boolean} value - Whether the PathFollower should automatically rotate to point in the direction of the Path. * @param {number} [offset=0] - Rotation offset in degrees. - * @param {boolean} [verticalAdjust=false] - [description] * * @return {Phaser.GameObjects.PathFollower} This Game Object. */ - setRotateToPath: function (value, offset, verticalAdjust) + setRotateToPath: function (value, offset) { if (offset === undefined) { offset = 0; } - if (verticalAdjust === undefined) { verticalAdjust = false; } this.rotateToPath = value; this.pathRotationOffset = offset; - this.pathRotationVerticalAdjust = verticalAdjust; return this; }, @@ -67099,7 +66504,22 @@ var PathFollower = new Class({ this.rotateToPath = GetBoolean(config, 'rotateToPath', false); this.pathRotationOffset = GetValue(config, 'rotationOffset', 0); - this.pathRotationVerticalAdjust = GetBoolean(config, 'verticalAdjust', false); + + // This works, but it's not an ideal way of doing it as the follower jumps position + var seek = GetValue(config, 'startAt', startAt); + + if (seek) + { + config.onStart = function (tween) + { + var tweenData = tween.data[0]; + tweenData.progress = seek; + tweenData.elapsed = tweenData.duration * seek; + var v = tweenData.ease(tweenData.progress); + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + tweenData.target[tweenData.key] = tweenData.current; + }; + } this.pathTween = this.scene.sys.tweens.addCounter(config); @@ -67254,11 +66674,6 @@ var PathFollower = new Class({ if (this.rotateToPath) { this.rotation = Math.atan2(speedY, speedX) + DegToRad(this.pathRotationOffset); - - if (this.pathRotationVerticalAdjust) - { - this.flipY = (this.rotation !== 0 && tweenData.state === TWEEN_CONST.PLAYING_BACKWARD); - } } } } @@ -67269,12 +66684,12 @@ module.exports = PathFollower; /***/ }), -/* 297 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67361,12 +66776,12 @@ module.exports = RandomZone; /***/ }), -/* 298 */ +/* 302 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67398,41 +66813,12 @@ module.exports = HasAny; /***/ }), -/* 299 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. - * - * @function Phaser.Math.FloatBetween - * @since 3.0.0 - * - * @param {number} min - The lower bound for the float, inclusive. - * @param {number} max - The upper bound for the float exclusive. - * - * @return {number} A random float within the given range. - */ -var FloatBetween = function (min, max) -{ - return Math.random() * (max - min) + min; -}; - -module.exports = FloatBetween; - - -/***/ }), -/* 300 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67695,12 +67081,12 @@ module.exports = EdgeZone; /***/ }), -/* 301 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67794,31 +67180,31 @@ module.exports = DeathZone; /***/ }), -/* 302 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); +var BlendModes = __webpack_require__(60); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var DeathZone = __webpack_require__(301); -var EdgeZone = __webpack_require__(300); -var EmitterOp = __webpack_require__(822); +var Components = __webpack_require__(13); +var DeathZone = __webpack_require__(304); +var EdgeZone = __webpack_require__(303); +var EmitterOp = __webpack_require__(845); var GetFastValue = __webpack_require__(2); -var GetRandom = __webpack_require__(162); -var HasAny = __webpack_require__(298); -var HasValue = __webpack_require__(85); -var Particle = __webpack_require__(303); -var RandomZone = __webpack_require__(297); -var Rectangle = __webpack_require__(9); -var StableSort = __webpack_require__(110); +var GetRandom = __webpack_require__(172); +var HasAny = __webpack_require__(302); +var HasValue = __webpack_require__(91); +var Particle = __webpack_require__(306); +var RandomZone = __webpack_require__(301); +var Rectangle = __webpack_require__(10); +var StableSort = __webpack_require__(118); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * @callback ParticleEmitterCallback @@ -67884,7 +67270,7 @@ var Wrap = __webpack_require__(53); * @typedef {object} ParticleEmitterConfig * * @property {boolean} [active] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#active}. - * @property {integer} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. + * @property {(Phaser.BlendModes|string)} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. * @property {*} [callbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope} and {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. * @property {boolean} [collideBottom] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideBottom}. * @property {boolean} [collideLeft] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideLeft}. @@ -67934,7 +67320,7 @@ var Wrap = __webpack_require__(53); * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. * @property {number} [followOffset.x] - x-coordinate of the offset. * @property {number} [followOffset.y] - y-coordinate of the offset. - * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frames] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frame] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. */ /** @@ -69811,13 +69197,9 @@ var ParticleEmitter = new Class({ for (var i = 0; i < count; i++) { - var particle; + var particle = dead.pop(); - if (dead.length > 0) - { - particle = dead.pop(); - } - else + if (!particle) { particle = new this.particleClass(this); } @@ -69872,47 +69254,49 @@ var ParticleEmitter = new Class({ var processors = this.manager.getProcessors(); var particles = this.alive; + var dead = this.dead; + + var i = 0; + var rip = []; var length = particles.length; - for (var index = 0; index < length; index++) + for (i = 0; i < length; i++) { - var particle = particles[index]; + var particle = particles[i]; - // update returns `true` if the particle is now dead (lifeStep < 0) + // update returns `true` if the particle is now dead (lifeCurrent <= 0) if (particle.update(delta, step, processors)) { - // Moves the dead particle to the end of the particles array (ready for splicing out later) - var last = particles[length - 1]; - - particles[length - 1] = particle; - particles[index] = last; - - index -= 1; - length -= 1; + rip.push({ index: i, particle: particle }); } } // Move dead particles to the dead array - var deadLength = particles.length - length; + length = rip.length; - if (deadLength > 0) + if (length > 0) { - var rip = particles.splice(particles.length - deadLength, deadLength); - var deathCallback = this.deathCallback; var deathCallbackScope = this.deathCallbackScope; - if (deathCallback) + for (i = length - 1; i >= 0; i--) { - for (var i = 0; i < rip.length; i++) + var entry = rip[i]; + + // Remove from particles array + particles.splice(entry.index, 1); + + // Add to dead array + dead.push(entry.particle); + + // Callback + if (deathCallback) { - deathCallback.call(deathCallbackScope, rip[i]); + deathCallback.call(deathCallbackScope, entry.particle); } + + entry.particle.resetPosition(); } - - this.dead.concat(rip); - - StableSort.inplace(particles, this.indexSortCallback); } if (!this.on) @@ -69952,22 +69336,6 @@ var ParticleEmitter = new Class({ depthSortCallback: function (a, b) { return a.y - b.y; - }, - - /** - * Calculates the difference of two particles, for sorting them by index. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#indexSortCallback - * @since 3.0.0 - * - * @param {object} a - The first particle. - * @param {object} b - The second particle. - * - * @return {integer} The difference of a and b's `index` properties. - */ - indexSortCallback: function (a, b) - { - return a.index - b.index; } }); @@ -69976,18 +69344,18 @@ module.exports = ParticleEmitter; /***/ }), -/* 303 */ +/* 306 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var DistanceBetween = __webpack_require__(52); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(56); /** * @classdesc @@ -70028,16 +69396,6 @@ var Particle = new Class({ */ this.frame = null; - /** - * The position of this Particle within its Emitter's particle pool. - * - * @name Phaser.GameObjects.Particles.Particle#index - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.index = 0; - /** * The x coordinate of this Particle. * @@ -70257,6 +69615,18 @@ var Particle = new Class({ return (this.lifeCurrent > 0); }, + /** + * Resets the position of this particle back to zero. + * + * @method Phaser.GameObjects.Particles.Particle#resetPosition + * @since 3.16.0 + */ + resetPosition: function () + { + this.x = 0; + this.y = 0; + }, + /** * Starts this Particle from the given coordinates. * @@ -70363,8 +69733,6 @@ var Particle = new Class({ this.alpha = emitter.alpha.onEmit(this, 'alpha'); this.tint = emitter.tint.onEmit(this, 'tint'); - - this.index = emitter.alive.length; }, /** @@ -70545,12 +69913,12 @@ module.exports = Particle; /***/ }), -/* 304 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -70562,14 +69930,18 @@ var GetFastValue = __webpack_require__(2); * * @property {number} [x=0] - The x coordinate of the Gravity Well, in world space. * @property {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @property {number} [power=0] - The power of the Gravity Well. - * @property {number} [epsilon=100] - [description] + * @property {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @property {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. * @property {number} [gravity=50] - The gravitational force of this Gravity Well. */ /** * @classdesc - * [description] + * The GravityWell action applies a force on the particle to draw it towards, or repel it from, a single point. + * + * The force applied is inversely proportional to the square of the distance from the particle to the point, in accordance with Newton's law of gravity. + * + * This simulates the effect of gravity over large distances (as between planets, for example). * * @class GravityWell * @memberof Phaser.GameObjects.Particles @@ -70578,8 +69950,8 @@ var GetFastValue = __webpack_require__(2); * * @param {(number|GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. * @param {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @param {number} [power=0] - The power of the Gravity Well. - * @param {number} [epsilon=100] - [description] + * @param {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @param {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. * @param {number} [gravity=50] - The gravitational force of this Gravity Well. */ var GravityWell = new Class({ @@ -70668,7 +70040,7 @@ var GravityWell = new Class({ this._epsilon = 0; /** - * The power of the Gravity Well. + * The strength of the gravity force - larger numbers produce a stronger force. * * @name Phaser.GameObjects.Particles.GravityWell#power * @type {number} @@ -70677,7 +70049,7 @@ var GravityWell = new Class({ this.power = power; /** - * [description] + * The minimum distance for which the gravity force is calculated. * * @name Phaser.GameObjects.Particles.GravityWell#epsilon * @type {number} @@ -70770,17 +70142,17 @@ module.exports = GravityWell; /***/ }), -/* 305 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Commands = __webpack_require__(157); -var SetTransform = __webpack_require__(22); +var Commands = __webpack_require__(167); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -70820,8 +70192,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c var green = 0; var blue = 0; - ctx.save(); - // Reset any currently active paths ctx.beginPath(); @@ -71014,6 +70384,7 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c } } + // Restore the context saved in SetTransform ctx.restore(); }; @@ -71021,12 +70392,12 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 306 */ +/* 309 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71053,19 +70424,19 @@ module.exports = Circumference; /***/ }), -/* 307 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(306); -var CircumferencePoint = __webpack_require__(156); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var Circumference = __webpack_require__(309); +var CircumferencePoint = __webpack_require__(166); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); /** * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, @@ -71107,18 +70478,18 @@ module.exports = GetPoints; /***/ }), -/* 308 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircumferencePoint = __webpack_require__(156); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var CircumferencePoint = __webpack_require__(166); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); var Point = __webpack_require__(6); /** @@ -71150,16 +70521,114 @@ module.exports = GetPoint; /***/ }), -/* 309 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Class = __webpack_require__(0); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var ExternRender = __webpack_require__(857); + +/** + * @classdesc + * An Extern Game Object is a special type of Game Object that allows you to pass + * rendering off to a 3rd party. + * + * When you create an Extern and place it in the display list of a Scene, the renderer will + * process the list as usual. When it finds an Extern it will flush the current batch, + * clear down the pipeline and prepare a transform matrix which your render function can + * take advantage of, if required. + * + * The WebGL context is then left is a 'clean' state, ready for you to bind your own shaders, + * or draw to it, whatever you wish to do. Once you've finished, you should free-up any + * of your resources. The Extern will then rebind the Phaser pipeline and carry on + * rendering the display list. + * + * Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of + * them are used during rendering unless you take advantage of them in your own render code. + * + * @class Extern + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.16.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.Origin + * @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. + */ +var Extern = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.Origin, + Components.ScaleMode, + Components.ScrollFactor, + Components.Size, + Components.Texture, + Components.Tint, + Components.Transform, + Components.Visible, + ExternRender + ], + + initialize: + + function Extern (scene) + { + GameObject.call(this, scene, 'Extern'); + }, + + preUpdate: function () + { + // override this! + // Arguments: time, delta + }, + + render: function () + { + // override this! + // Arguments: renderer, camera, calcMatrix + } + +}); + +module.exports = Extern; + + +/***/ }), +/* 313 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Rectangle = __webpack_require__(10); /** * Creates a new Rectangle or repositions and/or resizes an existing Rectangle so that it encompasses the two given Rectangles, i.e. calculates their union. @@ -71192,12 +70661,12 @@ module.exports = Union; /***/ }), -/* 310 */ +/* 314 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71333,12 +70802,12 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 311 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71422,17 +70891,17 @@ module.exports = BuildGameObjectAnimation; /***/ }), -/* 312 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); -var Shuffle = __webpack_require__(122); +var Shuffle = __webpack_require__(132); var BuildChunk = function (a, b, qty) { @@ -71452,47 +70921,45 @@ var BuildChunk = function (a, b, qty) return out; }; -// options = repeat, random, randomB, yoyo, max, qty - -// Range ([a,b,c], [1,2,3]) = -// a1, a2, a3, b1, b2, b3, c1, c2, c3 - -// Range ([a,b], [1,2,3], qty = 3) = -// a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 - -// Range ([a,b,c], [1,2,3], repeat x1) = -// a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 - -// Range ([a,b], [1,2], repeat -1 = endless, max = 14) = -// Maybe if max is set then repeat goes to -1 automatically? -// a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) - -// Range ([a], [1,2,3,4,5], random = true) = -// a4, a1, a5, a2, a3 - -// Range ([a, b], [1,2,3], random = true) = -// b3, a2, a1, b1, a3, b2 - -// Range ([a, b, c], [1,2,3], randomB = true) = -// a3, a1, a2, b2, b3, b1, c1, c3, c2 - -// Range ([a], [1,2,3,4,5], yoyo = true) = -// a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 - -// Range ([a, b], [1,2,3], yoyo = true) = -// a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 - /** - * [description] + * Creates an array populated with a range of values, based on the given arguments and configuration object. + * + * Range ([a,b,c], [1,2,3]) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2,3], qty = 3) = + * a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 + * + * Range ([a,b,c], [1,2,3], repeat x1) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2], repeat -1 = endless, max = 14) = + * Maybe if max is set then repeat goes to -1 automatically? + * a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) + * + * Range ([a], [1,2,3,4,5], random = true) = + * a4, a1, a5, a2, a3 + * + * Range ([a, b], [1,2,3], random = true) = + * b3, a2, a1, b1, a3, b2 + * + * Range ([a, b, c], [1,2,3], randomB = true) = + * a3, a1, a2, b2, b3, b1, c1, c3, c2 + * + * Range ([a], [1,2,3,4,5], yoyo = true) = + * a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 + * + * Range ([a, b], [1,2,3], yoyo = true) = + * a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 * * @function Phaser.Utils.Array.Range * @since 3.0.0 * - * @param {array} a - [description] - * @param {array} b - [description] - * @param {object} options - [description] + * @param {array} a - The first array of range elements. + * @param {array} b - The second array of range elements. + * @param {object} [options] - A range configuration object. Can contain: repeat, random, randomB, yoyo, max, qty. * - * @return {array} [description] + * @return {array} An array of arranged elements. */ var Range = function (a, b, options) { @@ -71562,41 +71029,51 @@ module.exports = Range; /***/ }), -/* 313 */ +/* 317 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// This is from the quickselect npm package: https://www.npmjs.com/package/quickselect -// Coded by https://www.npmjs.com/~mourner (Vladimir Agafonkin) +function swap (arr, i, j) +{ + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} -// https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm - -// Floyd-Rivest selection algorithm: -// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; -// The k-th element will have the (k - left + 1)th smallest value in [left, right] +function defaultCompare (a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} /** - * [description] + * A [Floyd-Rivest](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm) quick selection algorithm. + * + * Rearranges the array items so that all items in the [left, k] range are smaller than all items in [k, right]; + * The k-th element will have the (k - left + 1)th smallest value in [left, right]. + * + * The array is modified in-place. + * + * Based on code by [Vladimir Agafonkin](https://www.npmjs.com/~mourner) * * @function Phaser.Utils.Array.QuickSelect * @since 3.0.0 * - * @param {array} arr - [description] - * @param {number} k - [description] - * @param {number} left - [description] - * @param {number} right - [description] - * @param {function} compare - [description] + * @param {array} arr - The array to sort. + * @param {integer} k - The k-th element index. + * @param {integer} [left=0] - The index of the left part of the range. + * @param {integer} [right] - The index of the right part of the range. + * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. */ var QuickSelect = function (arr, k, left, right, compare) { - left = left || 0; - right = right || (arr.length - 1); - compare = compare || defaultCompare; + if (left === undefined) { left = 0; } + if (right === undefined) { right = arr.length - 1; } + if (compare === undefined) { compare = defaultCompare; } while (right > left) { @@ -71664,65 +71141,23 @@ var QuickSelect = function (arr, k, left, right, compare) } }; -function swap (arr, i, j) -{ - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultCompare (a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} - module.exports = QuickSelect; /***/ }), -/* 314 */ +/* 318 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * Transposes the elements of the given matrix (array of arrays). * - * @function Phaser.Math.RoundAwayFromZero - * @since 3.0.0 - * - * @param {number} value - The number to round. - * - * @return {number} The rounded number, rounded away from zero. - */ -var RoundAwayFromZero = function (value) -{ - // "Opposite" of truncate. - return (value > 0) ? Math.ceil(value) : Math.floor(value); -}; - -module.exports = RoundAwayFromZero; - - -/***/ }), -/* 315 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// Transposes the elements of the given matrix (array of arrays). -// The transpose of a matrix is a new matrix whose rows are the columns of the original. - -/** - * [description] + * The transpose of a matrix is a new matrix whose rows are the columns of the original. * * @function Phaser.Utils.Array.Matrix.TransposeMatrix * @since 3.0.0 @@ -71755,12 +71190,12 @@ module.exports = TransposeMatrix; /***/ }), -/* 316 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71770,32 +71205,32 @@ module.exports = TransposeMatrix; module.exports = { - AtlasXML: __webpack_require__(886), - Canvas: __webpack_require__(885), - Image: __webpack_require__(884), - JSONArray: __webpack_require__(883), - JSONHash: __webpack_require__(882), - SpriteSheet: __webpack_require__(881), - SpriteSheetFromAtlas: __webpack_require__(880), - UnityYAML: __webpack_require__(879) + AtlasXML: __webpack_require__(910), + Canvas: __webpack_require__(909), + Image: __webpack_require__(908), + JSONArray: __webpack_require__(907), + JSONHash: __webpack_require__(906), + SpriteSheet: __webpack_require__(905), + SpriteSheetFromAtlas: __webpack_require__(904), + UnityYAML: __webpack_require__(903) }; /***/ }), -/* 317 */ +/* 320 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var IsSizePowerOfTwo = __webpack_require__(117); -var ScaleModes = __webpack_require__(94); +var IsSizePowerOfTwo = __webpack_require__(127); +var ScaleModes = __webpack_require__(101); /** * @classdesc @@ -72070,25 +71505,27 @@ module.exports = TextureSource; /***/ }), -/* 318 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(24); -var CanvasTexture = __webpack_require__(887); +var CanvasTexture = __webpack_require__(911); var Class = __webpack_require__(0); -var Color = __webpack_require__(37); -var CONST = __webpack_require__(26); +var Color = __webpack_require__(32); +var CONST = __webpack_require__(28); var EventEmitter = __webpack_require__(11); -var GenerateTexture = __webpack_require__(357); +var Events = __webpack_require__(126); +var GameEvents = __webpack_require__(26); +var GenerateTexture = __webpack_require__(361); var GetValue = __webpack_require__(4); -var Parser = __webpack_require__(316); -var Texture = __webpack_require__(165); +var Parser = __webpack_require__(319); +var Texture = __webpack_require__(175); /** * @callback EachTextureCallback @@ -72184,7 +71621,7 @@ var TextureManager = new Class({ */ this._pending = 0; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -72198,13 +71635,13 @@ var TextureManager = new Class({ { this._pending = 2; - this.on('onload', this.updatePending, this); - this.on('onerror', this.updatePending, this); + this.on(Events.LOAD, this.updatePending, this); + this.on(Events.ERROR, this.updatePending, this); this.addBase64('__DEFAULT', this.game.config.defaultImage); this.addBase64('__MISSING', this.game.config.missingImage); - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -72220,10 +71657,10 @@ var TextureManager = new Class({ if (this._pending === 0) { - this.off('onload'); - this.off('onerror'); + this.off(Events.LOAD); + this.off(Events.ERROR); - this.game.events.emit('texturesready'); + this.emit(Events.READY); } }, @@ -72261,6 +71698,7 @@ var TextureManager = new Class({ * step when clearing down to avoid this. * * @method Phaser.Textures.TextureManager#remove + * @fires Phaser.Textures.Events#REMOVE * @since 3.7.0 * * @param {(string|Phaser.Textures.Texture)} key - The key of the Texture to remove, or a reference to it. @@ -72289,7 +71727,7 @@ var TextureManager = new Class({ key.destroy(); - this.emit('removetexture', key.key); + this.emit(Events.REMOVE, key.key); } return this; @@ -72299,6 +71737,9 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * * @method Phaser.Textures.TextureManager#addBase64 + * @fires Phaser.Textures.Events#ADD + * @fires Phaser.Textures.Events#ERROR + * @fires Phaser.Textures.Events#LOAD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -72316,7 +71757,7 @@ var TextureManager = new Class({ image.onerror = function () { - _this.emit('onerror', key); + _this.emit(Events.ERROR, key); }; image.onload = function () @@ -72325,9 +71766,9 @@ var TextureManager = new Class({ Parser.Image(texture, 0); - _this.emit('addtexture', key, texture); + _this.emit(Events.ADD, key, texture); - _this.emit('onload', key, texture); + _this.emit(Events.LOAD, key, texture); }; image.src = data; @@ -72391,11 +71832,12 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Image element. * * @method Phaser.Textures.TextureManager#addImage + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -72414,7 +71856,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72425,6 +71867,7 @@ var TextureManager = new Class({ * This allows you to then use the Render Texture as a normal texture for texture based Game Objects like Sprites. * * @method Phaser.Textures.TextureManager#addRenderTexture + * @fires Phaser.Textures.Events#ADD * @since 3.12.0 * * @param {string} key - The unique string-based key of the Texture. @@ -72442,7 +71885,7 @@ var TextureManager = new Class({ texture.add('__BASE', 0, 0, 0, renderTexture.width, renderTexture.height); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72489,7 +71932,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {integer} [width=256]- The width of the Canvas element. + * @param {integer} [width=256] - The width of the Canvas element. * @param {integer} [height=256] - The height of the Canvas element. * * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. @@ -72514,6 +71957,7 @@ var TextureManager = new Class({ * and adds it to this Texture Manager, unless `skipCache` is true. * * @method Phaser.Textures.TextureManager#addCanvas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -72538,7 +71982,7 @@ var TextureManager = new Class({ this.list[key] = texture; - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72554,7 +71998,7 @@ var TextureManager = new Class({ * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -72577,12 +72021,13 @@ var TextureManager = new Class({ * This is known as a JSON Array in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONArray + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {(HTMLImageElement|HTMLImageElement[])} source - The source Image element/s. * @param {(object|object[])} data - The Texture Atlas data/s. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -72617,7 +72062,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72629,12 +72074,13 @@ var TextureManager = new Class({ * This is known as a JSON Hash in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONHash + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -72663,7 +72109,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72674,12 +72120,13 @@ var TextureManager = new Class({ * in the XML format. * * @method Phaser.Textures.TextureManager#addAtlasXML + * @fires Phaser.Textures.Events#ADD * @since 3.7.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas XML data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -72698,7 +72145,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72709,12 +72156,13 @@ var TextureManager = new Class({ * The data must be in the form of a Unity YAML file. * * @method Phaser.Textures.TextureManager#addUnityAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -72733,7 +72181,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72757,6 +72205,7 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheet + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -72778,7 +72227,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, 0, 0, width, height, config); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -72804,6 +72253,7 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -72843,7 +72293,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, sheet.cutX, sheet.cutY, sheet.cutWidth, sheet.cutHeight, config); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); return texture; } @@ -72990,7 +72440,7 @@ var TextureManager = new Class({ * @param {integer} x - The x coordinate of the pixel within the Texture. * @param {integer} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, * or `null` if the coordinates were out of bounds. @@ -73037,7 +72487,7 @@ var TextureManager = new Class({ * @param {integer} x - The x coordinate of the pixel within the Texture. * @param {integer} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {integer} A value between 0 and 255, or `null` if the coordinates were out of bounds. */ @@ -73081,7 +72531,7 @@ var TextureManager = new Class({ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. */ @@ -73183,18 +72633,19 @@ module.exports = TextureManager; /***/ }), -/* 319 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(114); +var BaseSound = __webpack_require__(122); var Class = __webpack_require__(0); +var Events = __webpack_require__(69); /** * @classdesc @@ -73363,11 +72814,6 @@ var WebAudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.WebAudioSound#playEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Play this sound, or a marked section of it. * @@ -73375,7 +72821,7 @@ var WebAudioSound = new Class({ * you can set 'seek' setting of the config object, provided to this call, to that value. * * @method Phaser.Sound.WebAudioSound#play - * @fires Phaser.Sound.WebAudioSound#playEvent + * @fires Phaser.Sound.Events#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. @@ -73394,21 +72840,16 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); this.createAndStartBufferSource(); - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#pauseEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.WebAudioSound#pause - * @fires Phaser.Sound.WebAudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -73429,21 +72870,16 @@ var WebAudioSound = new Class({ this.currentConfig.seek = this.getCurrentTime(); // Equivalent to setting paused time this.stopAndRemoveBufferSource(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#resumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.WebAudioSound#resume - * @fires Phaser.Sound.WebAudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -73463,21 +72899,16 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = true, isPaused = false \/\/\/ this.createAndStartBufferSource(); - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#stopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.WebAudioSound#stop - * @fires Phaser.Sound.WebAudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -73492,7 +72923,7 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndRemoveBufferSource(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -73641,22 +73072,12 @@ var WebAudioSound = new Class({ BaseSound.prototype.applyConfig.call(this); }, - /** - * @event Phaser.Sound.WebAudioSound#endedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.WebAudioSound#loopedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.WebAudioSound#update - * @fires Phaser.Sound.WebAudioSound#endedEvent - * @fires Phaser.Sound.WebAudioSound#loopedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -73674,7 +73095,7 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); } else if (this.hasLooped) { @@ -73691,7 +73112,7 @@ var WebAudioSound = new Class({ this.createAndStartLoopBufferSource(); - this.emit('looped', this); + this.emit(Events.LOOPED, this); } }, @@ -73801,12 +73222,6 @@ var WebAudioSound = new Class({ return this.playTime + lastRateUpdate.time + (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate; }, - /** - * @event Phaser.Sound.WebAudioSound#rateEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -73815,6 +73230,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -73830,7 +73246,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } }, @@ -73842,7 +73258,7 @@ var WebAudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.WebAudioSound#setRate - * @fires Phaser.Sound.WebAudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -73856,12 +73272,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#detuneEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -73869,6 +73279,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -73884,7 +73295,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } }, @@ -73894,7 +73305,7 @@ var WebAudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.WebAudioSound#setDetune - * @fires Phaser.Sound.WebAudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -73908,12 +73319,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#muteEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -73921,6 +73326,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -73935,7 +73341,7 @@ var WebAudioSound = new Class({ this.currentConfig.mute = value; this.muteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.MUTE, this, value); } }, @@ -73944,7 +73350,7 @@ var WebAudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.WebAudioSound#setMute - * @fires Phaser.Sound.WebAudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -73958,18 +73364,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#volumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.WebAudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -73984,7 +73385,7 @@ var WebAudioSound = new Class({ this.currentConfig.volume = value; this.volumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.VOLUME, this, value); } }, @@ -73992,7 +73393,7 @@ var WebAudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.WebAudioSound#setVolume - * @fires Phaser.Sound.WebAudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -74006,12 +73407,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#seekEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -74020,6 +73415,7 @@ var WebAudioSound = new Class({ * * @name Phaser.Sound.WebAudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -74064,7 +73460,7 @@ var WebAudioSound = new Class({ this.createAndStartBufferSource(); } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -74073,7 +73469,7 @@ var WebAudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.WebAudioSound#setSeek - * @fires Phaser.Sound.WebAudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -74087,18 +73483,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#loopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.WebAudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -74122,7 +73513,7 @@ var WebAudioSound = new Class({ } } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -74130,7 +73521,7 @@ var WebAudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.WebAudioSound#setLoop - * @fires Phaser.Sound.WebAudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. @@ -74150,19 +73541,20 @@ module.exports = WebAudioSound; /***/ }), -/* 320 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(115); +var BaseSoundManager = __webpack_require__(123); var Class = __webpack_require__(0); -var WebAudioSound = __webpack_require__(319); +var Events = __webpack_require__(69); +var WebAudioSound = __webpack_require__(322); /** * @classdesc @@ -74299,23 +73691,26 @@ var WebAudioSoundManager = new Class({ { var _this = this; - var unlock = function () + var unlockHandler = function unlockHandler () { - _this.context.resume().then(function () + if (_this.context) { - document.body.removeEventListener('touchstart', unlock); - document.body.removeEventListener('touchend', unlock); - document.body.removeEventListener('click', unlock); - - _this.unlocked = true; - }); + _this.context.resume().then(function () + { + document.body.removeEventListener('touchstart', unlockHandler); + document.body.removeEventListener('touchend', unlockHandler); + document.body.removeEventListener('click', unlockHandler); + + _this.unlocked = true; + }); + } }; if (document.body) { - document.body.addEventListener('touchstart', unlock, false); - document.body.addEventListener('touchend', unlock, false); - document.body.addEventListener('click', unlock, false); + document.body.addEventListener('touchstart', unlockHandler, false); + document.body.addEventListener('touchend', unlockHandler, false); + document.body.addEventListener('click', unlockHandler, false); } }, @@ -74329,7 +73724,10 @@ var WebAudioSoundManager = new Class({ */ onBlur: function () { - this.context.suspend(); + if (!this.locked) + { + this.context.suspend(); + } }, /** @@ -74342,7 +73740,10 @@ var WebAudioSoundManager = new Class({ */ onFocus: function () { - this.context.resume(); + if (!this.locked) + { + this.context.resume(); + } }, /** @@ -74379,17 +73780,11 @@ var WebAudioSoundManager = new Class({ BaseSoundManager.prototype.destroy.call(this); }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setMute - * @fires Phaser.Sound.WebAudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -74406,7 +73801,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.WebAudioSoundManager#MuteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -74420,22 +73815,16 @@ var WebAudioSoundManager = new Class({ { this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, 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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setVolume - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -74452,7 +73841,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -74466,7 +73855,7 @@ var WebAudioSoundManager = new Class({ { this.masterVolumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } @@ -74477,20 +73866,20 @@ module.exports = WebAudioSoundManager; /***/ }), -/* 321 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(114); +var BaseSound = __webpack_require__(122); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(11); -var Extend = __webpack_require__(20); +var Extend = __webpack_require__(19); /** * @classdesc @@ -74604,20 +73993,20 @@ module.exports = NoAudioSound; /***/ }), -/* 322 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(115); +var BaseSoundManager = __webpack_require__(123); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(11); -var NoAudioSound = __webpack_require__(321); +var NoAudioSound = __webpack_require__(324); var NOOP = __webpack_require__(1); /** @@ -74722,18 +74111,19 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 323 */ +/* 326 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(114); +var BaseSound = __webpack_require__(122); var Class = __webpack_require__(0); +var Events = __webpack_require__(69); /** * @classdesc @@ -74821,18 +74211,13 @@ var HTML5AudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.HTML5AudioSound#playEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * 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.HTML5AudioSound#play - * @fires Phaser.Sound.HTML5AudioSound#playEvent + * @fires Phaser.Sound.Events#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. @@ -74858,21 +74243,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#pauseEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.HTML5AudioSound#pause - * @fires Phaser.Sound.HTML5AudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -74899,21 +74279,16 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#resumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.HTML5AudioSound#resume - * @fires Phaser.Sound.HTML5AudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -74941,21 +74316,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#stopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.HTML5AudioSound#stop - * @fires Phaser.Sound.HTML5AudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -74975,7 +74345,7 @@ var HTML5AudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndReleaseAudioTag(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -75184,22 +74554,12 @@ var HTML5AudioSound = new Class({ this.pickAndPlayAudioTag(); }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.HTML5AudioSound#endedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.HTML5AudioSound#update - * @fires Phaser.Sound.HTML5AudioSound#loopedEvent - * @fires Phaser.Sound.HTML5AudioSound#endedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -75248,7 +74608,7 @@ var HTML5AudioSound = new Class({ if (currentTime < this.previousTime) { - this.emit('looped', this); + this.emit(Events.LOOPED, this); } } else if (currentTime >= endTime) @@ -75257,7 +74617,7 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); return; } @@ -75331,12 +74691,6 @@ var HTML5AudioSound = new Class({ } }, - /** - * @event Phaser.Sound.HTML5AudioSound#muteEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -75344,6 +74698,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -75362,7 +74717,9 @@ var HTML5AudioSound = new Class({ return; } - this.emit('mute', this, value); + this.updateMute(); + + this.emit(Events.MUTE, this, value); } }, @@ -75370,7 +74727,7 @@ var HTML5AudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setMute - * @fires Phaser.Sound.HTML5AudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -75384,18 +74741,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#volumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.HTML5AudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -75414,7 +74766,9 @@ var HTML5AudioSound = new Class({ return; } - this.emit('volume', this, value); + this.updateVolume(); + + this.emit(Events.VOLUME, this, value); } }, @@ -75422,7 +74776,7 @@ var HTML5AudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setVolume - * @fires Phaser.Sound.HTML5AudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -75436,12 +74790,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#rateEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -75450,6 +74798,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -75463,7 +74812,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.rate = value; - if (this.manager.isLocked(this, 'rate', value)) + if (this.manager.isLocked(this, Events.RATE, value)) { return; } @@ -75471,7 +74820,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } } @@ -75484,7 +74833,7 @@ var HTML5AudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.HTML5AudioSound#setRate - * @fires Phaser.Sound.HTML5AudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -75498,12 +74847,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#detuneEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -75511,6 +74854,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -75524,7 +74868,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.detune = value; - if (this.manager.isLocked(this, 'detune', value)) + if (this.manager.isLocked(this, Events.DETUNE, value)) { return; } @@ -75532,7 +74876,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } } @@ -75543,7 +74887,7 @@ var HTML5AudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.HTML5AudioSound#setDetune - * @fires Phaser.Sound.HTML5AudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -75557,12 +74901,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#seekEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -75571,6 +74909,7 @@ var HTML5AudioSound = new Class({ * * @name Phaser.Sound.HTML5AudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -75617,7 +74956,7 @@ var HTML5AudioSound = new Class({ this.currentConfig.seek = value; } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -75626,7 +74965,7 @@ var HTML5AudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.HTML5AudioSound#setSeek - * @fires Phaser.Sound.HTML5AudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -75640,18 +74979,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.HTML5AudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -75675,7 +75009,7 @@ var HTML5AudioSound = new Class({ this.audio.loop = value; } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -75684,7 +75018,7 @@ var HTML5AudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setLoop - * @fires Phaser.Sound.HTML5AudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. @@ -75704,19 +75038,20 @@ module.exports = HTML5AudioSound; /***/ }), -/* 324 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(115); +var BaseSoundManager = __webpack_require__(123); var Class = __webpack_require__(0); -var HTML5AudioSound = __webpack_require__(323); +var Events = __webpack_require__(69); +var HTML5AudioSound = __webpack_require__(326); /** * HTML5 Audio implementation of the Sound Manager. @@ -75947,7 +75282,7 @@ var HTML5AudioSoundManager = new Class({ }); }; - this.once('unlocked', function () + this.once(Events.UNLOCKED, function () { this.forEachActiveSound(function (sound) { @@ -76063,17 +75398,11 @@ var HTML5AudioSoundManager = new Class({ return false; }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setMute - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -76090,7 +75419,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -76109,22 +75438,16 @@ var HTML5AudioSoundManager = new Class({ sound.updateMute(); }); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, this, value); } }, - /** - * @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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setVolume - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -76141,7 +75464,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -76160,7 +75483,7 @@ var HTML5AudioSoundManager = new Class({ sound.updateVolume(); }); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } @@ -76171,19 +75494,19 @@ module.exports = HTML5AudioSoundManager; /***/ }), -/* 325 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(324); -var NoAudioSoundManager = __webpack_require__(322); -var WebAudioSoundManager = __webpack_require__(320); +var HTML5AudioSoundManager = __webpack_require__(327); +var NoAudioSoundManager = __webpack_require__(325); +var WebAudioSoundManager = __webpack_require__(323); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -76221,19 +75544,19 @@ module.exports = SoundManagerCreator; /***/ }), -/* 326 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(116); +var CONST = __webpack_require__(124); var GetValue = __webpack_require__(4); -var Merge = __webpack_require__(96); -var InjectionMap = __webpack_require__(888); +var Merge = __webpack_require__(103); +var InjectionMap = __webpack_require__(933); /** * @namespace Phaser.Scenes.Settings @@ -76242,50 +75565,50 @@ var InjectionMap = __webpack_require__(888); /** * @typedef {object} Phaser.Scenes.Settings.Config * - * @property {string} [key] - [description] - * @property {boolean} [active=false] - [description] - * @property {boolean} [visible=true] - [description] - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - [description] - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - [description] + * @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance. + * @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step. + * @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object. * @property {Object.} [map] - Overwrites the default injection map for a scene. * @property {Object.} [mapAdd] - Extends the injection map for a scene. - * @property {object} [physics={}] - [description] - * @property {object} [loader={}] - [description] - * @property {(false|*)} [plugins=false] - [description] + * @property {object} [physics={}] - The physics configuration object for the Scene. + * @property {object} [loader={}] - The loader configuration object for the Scene. + * @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene. */ /** * @typedef {object} Phaser.Scenes.Settings.Object * - * @property {number} status - [description] - * @property {string} key - [description] - * @property {boolean} active - [description] - * @property {boolean} visible - [description] - * @property {boolean} isBooted - [description] - * @property {boolean} isTransition - [description] - * @property {?Phaser.Scene} transitionFrom - [description] - * @property {integer} transitionDuration - [description] - * @property {boolean} transitionAllowInput - [description] - * @property {object} data - [description] - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - [description] - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - [description] - * @property {Object.} map - [description] - * @property {object} physics - [description] - * @property {object} loader - [description] - * @property {(false|*)} plugins - [description] + * @property {number} status - The current status of the Scene. Maps to the Scene constants. + * @property {string} key - The unique key of this Scene. Unique within the entire Game instance. + * @property {boolean} active - The active state of this Scene. An active Scene updates each step. + * @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step. + * @property {boolean} isBooted - Has the Scene finished booting? + * @property {boolean} isTransition - Is the Scene in a state of transition? + * @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set. + * @property {integer} transitionDuration - The duration of the transition, if set. + * @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions? + * @property {object} data - a data bundle passed to this Scene from the Scene Manager. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - The Camera configuration object. + * @property {Object.} map - The Scene's Injection Map. + * @property {object} physics - The physics configuration object for the Scene. + * @property {object} loader - The loader configuration object for the Scene. + * @property {(false|*)} plugins - The plugin configuration object for the Scene. */ var Settings = { /** - * Takes a Scene configuration object and returns a fully formed Systems object. + * Takes a Scene configuration object and returns a fully formed System Settings object. * * @function Phaser.Scenes.Settings.create * @since 3.0.0 * - * @param {(string|Phaser.Scenes.Settings.Config)} config - [description] + * @param {(string|Phaser.Scenes.Settings.Config)} config - The Scene configuration object used to create this Scene Settings. * - * @return {Phaser.Scenes.Settings.Object} [description] + * @return {Phaser.Scenes.Settings.Object} The Scene Settings object created as a result of the config and default settings. */ create: function (config) { @@ -76353,12 +75676,12 @@ module.exports = Settings; /***/ }), -/* 327 */ +/* 330 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -76390,21 +75713,21 @@ module.exports = UppercaseFirst; /***/ }), -/* 328 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Systems = __webpack_require__(166); +var Systems = __webpack_require__(176); /** * @classdesc - * [description] + * A base Phaser.Scene class which you could extend for your own use. * * @class Scene * @memberof Phaser @@ -76637,6 +75960,19 @@ var Scene = new Class({ * @since 3.0.0 */ this.matter; + + if (false) + {} + + /** + * A reference to the global Scale Manager. + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.2 + */ + this.scale; }, /** @@ -76659,21 +75995,24 @@ module.exports = Scene; /***/ }), -/* 329 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(116); +var CONST = __webpack_require__(124); +var Events = __webpack_require__(16); +var GameEvents = __webpack_require__(26); var GetValue = __webpack_require__(4); +var LoaderEvents = __webpack_require__(75); var NOOP = __webpack_require__(1); -var Scene = __webpack_require__(328); -var Systems = __webpack_require__(166); +var Scene = __webpack_require__(331); +var Systems = __webpack_require__(176); /** * @classdesc @@ -76816,7 +76155,7 @@ var SceneManager = new Class({ } } - game.events.once('ready', this.bootQueue, this); + game.events.once(GameEvents.READY, this.bootQueue, this); }, /** @@ -77103,6 +76442,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#bootScene * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to boot. @@ -77120,7 +76460,7 @@ var SceneManager = new Class({ if (settings.isTransition) { - sys.events.emit('transitioninit', settings.transitionFrom, settings.transitionDuration); + sys.events.emit(Events.TRANSITION_INIT, settings.transitionFrom, settings.transitionDuration); } } @@ -77147,7 +76487,7 @@ var SceneManager = new Class({ settings.status = CONST.LOADING; // Start the loader going as we have something in the queue - loader.once('complete', this.loadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.loadComplete, this); loader.start(); } @@ -77224,26 +76564,6 @@ var SceneManager = new Class({ } }, - /** - * Informs the Scenes of the Game being resized. - * - * @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); - } - }, - /** * Renders the Scenes. * @@ -77273,6 +76593,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#create * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to create. @@ -77287,11 +76608,11 @@ var SceneManager = new Class({ settings.status = CONST.CREATING; scene.create.call(scene, settings.data); + } - if (settings.isTransition) - { - sys.events.emit('transitionstart', settings.transitionFrom, settings.transitionDuration); - } + if (settings.isTransition) + { + sys.events.emit(Events.TRANSITION_START, settings.transitionFrom, settings.transitionDuration); } // If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP @@ -77496,6 +76817,41 @@ var SceneManager = new Class({ } }, + /** + * Returns an array of all the current Scenes being managed by this Scene Manager. + * + * You can filter the output by the active state of the Scene and choose to have + * the array returned in normal or reversed order. + * + * @method Phaser.Scenes.SceneManager#getScenes + * @since 3.16.0 + * + * @param {boolean} [isActive=true] - Only include Scene's that are currently active? + * @param {boolean} [inReverse=false] - Return the array of Scenes in reverse? + * + * @return {Phaser.Scene[]} An array containing all of the Scenes in the Scene Manager. + */ + getScenes: function (isActive, inReverse) + { + if (isActive === undefined) { isActive = true; } + if (inReverse === undefined) { inReverse = false; } + + var out = []; + var scenes = this.scenes; + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene && (!isActive || (isActive && scene.sys.isActive()))) + { + out.push(scene); + } + } + + return (inReverse) ? out.reverse() : out; + }, + /** * Retrieves a Scene. * @@ -77794,7 +77150,7 @@ var SceneManager = new Class({ { scene.sys.settings.status = CONST.LOADING; - loader.once('complete', this.payloadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); loader.start(); @@ -78242,114 +77598,2420 @@ module.exports = SceneManager; /***/ }), -/* 330 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(91); +var Clamp = __webpack_require__(23); +var Class = __webpack_require__(0); +var SnapFloor = __webpack_require__(98); +var Vector2 = __webpack_require__(3); /** - * Removes the given item, or array of items, from the array. + * @classdesc + * The Size component allows you to set `width` and `height` properties and define the relationship between them. * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * The component can automatically maintain the aspect ratios between the two values, and clamp them + * to a defined min-max range. You can also control the dominant axis. When dimensions are given to the Size component + * that would cause it to exceed its min-max range, the dimensions are adjusted based on the dominant axis. * - * @function Phaser.Utils.Array.Remove - * @since 3.4.0 + * @class Size + * @memberof Phaser.Structs + * @constructor + * @since 3.16.0 * - * @param {array} array - The array to be modified. - * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. - * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + * @param {number} [width=0] - The width of the Size component. + * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. + * @param {integer} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ -var Remove = function (array, item, callback, context) -{ - if (context === undefined) { context = array; } +var Size = new Class({ - var index; + initialize: - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) + function Size (width, height, aspectMode, parent) { - index = array.indexOf(item); + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (aspectMode === undefined) { aspectMode = 0; } + if (parent === undefined) { parent = null; } - if (index !== -1) - { - SpliceOne(array, index); + /** + * Internal width value. + * + * @name Phaser.Structs.Size#_width + * @type {number} + * @private + * @since 3.16.0 + */ + this._width = width; - if (callback) - { - callback.call(context, item); - } + /** + * Internal height value. + * + * @name Phaser.Structs.Size#_height + * @type {number} + * @private + * @since 3.16.0 + */ + this._height = height; - return item; - } - else - { - return null; - } - } + /** + * Internal parent reference. + * + * @name Phaser.Structs.Size#_parent + * @type {any} + * @private + * @since 3.16.0 + */ + this._parent = parent; - // If we got this far, we have an array of items to remove + /** + * The aspect mode this Size component will use when calculating its dimensions. + * This property is read-only. To change it use the `setAspectMode` method. + * + * @name Phaser.Structs.Size#aspectMode + * @type {integer} + * @readonly + * @since 3.16.0 + */ + this.aspectMode = aspectMode; - var itemLength = item.length - 1; + /** + * The proportional relationship between the width and height. + * + * This property is read-only and is updated automatically when either the `width` or `height` properties are changed, + * depending on the aspect mode. + * + * @name Phaser.Structs.Size#aspectRatio + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.aspectRatio = (height === 0) ? 1 : width / height; - while (itemLength >= 0) + /** + * The minimum allowed width. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minWidth = 0; + + /** + * The minimum allowed height. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minHeight = 0; + + /** + * The maximum allowed width. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxWidth = Number.MAX_VALUE; + + /** + * The maximum allowed height. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxHeight = Number.MAX_VALUE; + + /** + * A Vector2 containing the horizontal and vertical snap values, which the width and height are snapped to during resizing. + * + * By default this is disabled. + * + * This property is read-only. To change it see the `setSnap` method. + * + * @name Phaser.Structs.Size#snapTo + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.snapTo = new Vector2(); + }, + + /** + * Sets the aspect mode of this Size component. + * + * The aspect mode controls what happens when you modify the `width` or `height` properties, or call `setSize`. + * + * It can be a number from 0 to 4, or a Size constant: + * + * 0. NONE = Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * 1. WIDTH_CONTROLS_HEIGHT = The height is automatically adjusted based on the width. + * 2. HEIGHT_CONTROLS_WIDTH = The width is automatically adjusted based on the height. + * 3. FIT = The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * 4. ENVELOP = The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setAspectMode + * @since 3.16.0 + * + * @param {integer} [value=0] - The aspect mode value. + * + * @return {this} This Size component instance. + */ + setAspectMode: function (value) { - var entry = item[itemLength]; + if (value === undefined) { value = 0; } - index = array.indexOf(entry); + this.aspectMode = value; - if (index !== -1) + return this.setSize(this._width, this._height); + }, + + /** + * By setting a Snap To value when this Size component is modified its dimensions will automatically + * by snapped to the nearest grid slice, using floor. For example, if you have snap value of 16, + * and the width changes to 68, then it will snap down to 64 (the closest multiple of 16 when floored) + * + * Note that snapping takes place before adjustments by the parent, or the min / max settings. If these + * values are not multiples of the given snap values, then this can result in un-snapped dimensions. + * + * Call this method with no arguments to reset the snap values. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setSnap + * @since 3.16.0 + * + * @param {number} [snapWidth=0] - The amount to snap the width to. If you don't want to snap the width, pass a value of zero. + * @param {number} [snapHeight=snapWidth] - The amount to snap the height to. If not provided it will use the `snapWidth` value. If you don't want to snap the height, pass a value of zero. + * + * @return {this} This Size component instance. + */ + setSnap: function (snapWidth, snapHeight) + { + if (snapWidth === undefined) { snapWidth = 0; } + if (snapHeight === undefined) { snapHeight = snapWidth; } + + this.snapTo.set(snapWidth, snapHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets, or clears, the parent of this Size component. + * + * To clear the parent call this method with no arguments. + * + * The parent influences the maximum extents to which this Size compoent can expand, + * based on the aspect mode: + * + * NONE - The parent clamps both the width and height. + * WIDTH_CONTROLS_HEIGHT - The parent clamps just the width. + * HEIGHT_CONTROLS_WIDTH - The parent clamps just the height. + * FIT - The parent clamps whichever axis is required to ensure the size fits within it. + * ENVELOP - The parent is used to ensure the size fully envelops the parent. + * + * Calling this method automatically calls `setSize`. + * + * @method Phaser.Structs.Size#setParent + * @since 3.16.0 + * + * @param {any} [parent] - Sets the parent of this Size component. Don't provide a value to clear an existing parent. + * + * @return {this} This Size component instance. + */ + setParent: function (parent) + { + this._parent = parent; + + return this.setSize(this._width, this._height); + }, + + /** + * Set the minimum width and height values this Size component will allow. + * + * The minimum values can never be below zero, or greater than the maximum values. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the minimums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMin + * @since 3.16.0 + * + * @param {number} [width=0] - The minimum allowed width of the Size component. + * @param {number} [height=width] - The minimum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMin: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + + this.minWidth = Clamp(width, 0, this.maxWidth); + this.minHeight = Clamp(height, 0, this.maxHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Set the maximum width and height values this Size component will allow. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the maximums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMax + * @since 3.16.0 + * + * @param {number} [width=Number.MAX_VALUE] - The maximum allowed width of the Size component. + * @param {number} [height=width] - The maximum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMax: function (width, height) + { + if (width === undefined) { width = Number.MAX_VALUE; } + if (height === undefined) { height = width; } + + this.maxWidth = Clamp(width, this.minWidth, Number.MAX_VALUE); + this.maxHeight = Clamp(height, this.minHeight, Number.MAX_VALUE); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets the width and height of this Size component based on the aspect mode. + * + * If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current + * aspect ratio is honored across all other modes. + * + * If snapTo values have been set then the given width and height are snapped first, prior to any further + * adjustment via min/max values, or a parent. + * + * If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into + * that range prior to adjustment, but may still exceed them depending on the aspect mode. + * + * If this Size component has a parent set, and the aspect mode is `fit` or `envelop`, then the given sizes will + * be clamped to the range specified by the parent. + * + * @method Phaser.Structs.Size#setSize + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setSize: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + + switch (this.aspectMode) { - SpliceOne(array, index); + case Size.NONE: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + break; - if (callback) + case Size.WIDTH_CONTROLS_HEIGHT: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(this._width * (1 / this.aspectRatio), false); + break; + + case Size.HEIGHT_CONTROLS_WIDTH: + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this._width = this.getNewWidth(this._height * this.aspectRatio, false); + break; + + case Size.FIT: + this.constrain(width, height, true); + break; + + case Size.ENVELOP: + this.constrain(width, height, false); + break; + } + + return this; + }, + + /** + * Sets a new aspect ratio, overriding what was there previously. + * + * It then calls `setSize` immediately using the current dimensions. + * + * @method Phaser.Structs.Size#setAspectRatio + * @since 3.16.0 + * + * @param {number} ratio - The new aspect ratio. + * + * @return {this} This Size component instance. + */ + setAspectRatio: function (ratio) + { + this.aspectRatio = ratio; + + return this.setSize(this._width, this._height); + }, + + /** + * Sets a new width and height for this Size component and updates the aspect ratio based on them. + * + * It _doesn't_ change the `aspectMode` and still factors in size limits such as the min max and parent bounds. + * + * @method Phaser.Structs.Size#resize + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + resize: function (width, height) + { + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + + return this; + }, + + /** + * Takes a new width and passes it through the min/max clamp and then checks it doesn't exceed the parent width. + * + * @method Phaser.Structs.Size#getNewWidth + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified width value. + */ + getNewWidth: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minWidth, this.maxWidth); + + if (checkParent && this._parent && value > this._parent.width) + { + value = Math.max(this.minWidth, this._parent.width); + } + + return value; + }, + + /** + * Takes a new height and passes it through the min/max clamp and then checks it doesn't exceed the parent height. + * + * @method Phaser.Structs.Size#getNewHeight + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified height value. + */ + getNewHeight: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minHeight, this.maxHeight); + + if (checkParent && this._parent && value > this._parent.height) + { + value = Math.max(this.minHeight, this._parent.height); + } + + return value; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * If `fit` is true there may be some space inside the target area which is not covered if its aspect ratio differs. + * If `fit` is false the size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#constrain + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * @param {boolean} [fit=true] - Perform a `fit` (true) constraint, or an `envelop` (false) constraint. + * + * @return {this} This Size component instance. + */ + constrain: function (width, height, fit) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (fit === undefined) { fit = true; } + + width = this.getNewWidth(width); + height = this.getNewHeight(height); + + var snap = this.snapTo; + var newRatio = (height === 0) ? 1 : width / height; + + if ((fit && this.aspectRatio > newRatio) || (!fit && this.aspectRatio < newRatio)) + { + // We need to change the height to fit the width + // height = width / this.aspectRatio; + + width = SnapFloor(width, snap.x); + + height = width / this.aspectRatio; + + if (snap.y > 0) { - callback.call(context, entry); + height = SnapFloor(height, snap.y); + + // Reduce the width accordingly + width = height * this.aspectRatio; } } - else + else if ((fit && this.aspectRatio < newRatio) || (!fit && this.aspectRatio > newRatio)) { - // Item wasn't found in the array, so remove it from our return results - item.pop(); + // We need to change the width to fit the height + // width = height * this.aspectRatio; + + height = SnapFloor(height, snap.y); + + width = height * this.aspectRatio; + + if (snap.x > 0) + { + width = SnapFloor(width, snap.x); + + // Reduce the height accordingly + height = width * (1 / this.aspectRatio); + } + } + + this._width = width; + this._height = height; + + return this; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * There may be some space inside the target area which is not covered if its aspect ratio differs. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#fitTo + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + fitTo: function (width, height) + { + return this.constrain(width, height, true); + }, + + /** + * The current `width` and `height` are adjusted so that they fully envlop the given dimensions, while keeping the aspect ratio. + * + * The size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the values are clamped so that it never exceeds the parent + * on the longest axis. + * + * @method Phaser.Structs.Size#envelop + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + envelop: function (width, height) + { + return this.constrain(width, height, false); + }, + + /** + * Sets the width of this Size component. + * + * Depending on the aspect mode, changing the width may also update the height and aspect ratio. + * + * @method Phaser.Structs.Size#setWidth + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * + * @return {this} This Size component instance. + */ + setWidth: function (value) + { + return this.setSize(value, this._height); + }, + + /** + * Sets the height of this Size component. + * + * Depending on the aspect mode, changing the height may also update the width and aspect ratio. + * + * @method Phaser.Structs.Size#setHeight + * @since 3.16.0 + * + * @param {number} height - The new height of the Size component. + * + * @return {this} This Size component instance. + */ + setHeight: function (value) + { + return this.setSize(this._width, value); + }, + + /** + * Returns a string representation of this Size component. + * + * @method Phaser.Structs.Size#toString + * @since 3.16.0 + * + * @return {string} A string representation of this Size component. + */ + toString: function () + { + return '[{ Size (width=' + this._width + ' height=' + this._height + ' aspectRatio=' + this.aspectRatio + ' aspectMode=' + this.aspectMode + ') }]'; + }, + + /** + * Copies the aspect mode, aspect ratio, width and height from this Size component + * to the given Size component. Note that the parent, if set, is not copied across. + * + * @method Phaser.Structs.Size#copy + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} destination - The Size component to copy the values to. + * + * @return {Phaser.Structs.Size} The updated destination Size component. + */ + copy: function (destination) + { + destination.setAspectMode(this.aspectMode); + + destination.aspectRatio = this.aspectRatio; + + return destination.setSize(this.width, this.height); + }, + + /** + * Destroys this Size component. + * + * This clears the local properties and any parent object, if set. + * + * A destroyed Size component cannot be re-used. + * + * @method Phaser.Structs.Size#destroy + * @since 3.16.0 + */ + destroy: function () + { + this._parent = null; + this.snapTo = null; + }, + + /** + * The width of this Size component. + * + * This value is clamped to the range specified by `minWidth` and `maxWidth`, if enabled. + * + * A width can never be less than zero. + * + * Changing this value will automatically update the `height` if the aspect ratio lock is enabled. + * You can also use the `setWidth` and `getWidth` methods. + * + * @name Phaser.Structs.Size#width + * @type {number} + * @since 3.16.0 + */ + width: { + + get: function () + { + return this._width; + }, + + set: function (value) + { + this.setSize(value, this._height); + } + + }, + + /** + * The height of this Size component. + * + * This value is clamped to the range specified by `minHeight` and `maxHeight`, if enabled. + * + * A height can never be less than zero. + * + * Changing this value will automatically update the `width` if the aspect ratio lock is enabled. + * You can also use the `setHeight` and `getHeight` methods. + * + * @name Phaser.Structs.Size#height + * @type {number} + * @since 3.16.0 + */ + height: { + + get: function () + { + return this._height; + }, + + set: function (value) + { + this.setSize(this._width, value); } - itemLength--; } - return item; -}; +}); -module.exports = Remove; +/** + * Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * + * @name Phaser.Structs.Size.NONE + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.NONE = 0; + +/** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.WIDTH_CONTROLS_HEIGHT = 1; + +/** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.HEIGHT_CONTROLS_WIDTH = 2; + +/** + * The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * + * @name Phaser.Structs.Size.FIT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.FIT = 3; + +/** + * The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Structs.Size.ENVELOP + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.ENVELOP = 4; + +module.exports = Size; /***/ }), -/* 331 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scale.Events + */ + +module.exports = { + + ENTER_FULLSCREEN: __webpack_require__(951), + FULLSCREEN_UNSUPPORTED: __webpack_require__(950), + LEAVE_FULLSCREEN: __webpack_require__(949), + ORIENTATION_CHANGE: __webpack_require__(948), + RESIZE: __webpack_require__(947) + +}; + + +/***/ }), +/* 335 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(178); +var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(334); +var GameEvents = __webpack_require__(26); +var GetInnerHeight = __webpack_require__(946); +var GetTarget = __webpack_require__(345); +var GetScreenOrientation = __webpack_require__(350); +var NOOP = __webpack_require__(1); +var Rectangle = __webpack_require__(10); +var Size = __webpack_require__(333); +var SnapFloor = __webpack_require__(98); +var Vector2 = __webpack_require__(3); + +/** + * @classdesc + * The Scale Manager handles the scaling, resizing and alignment of the game canvas. + * + * The way scaling is handled is by setting the game canvas to a fixed size, which is defined in the + * game configuration. You also define the parent container in the game config. If no parent is given, + * it will default to using the document body. The Scale Manager will then look at the available space + * within the _parent_ and scale the canvas accordingly. Scaling is handled by setting the canvas CSS + * width and height properties, leaving the width and height of the canvas element itself untouched. + * Scaling is therefore achieved by keeping the core canvas the same size and 'stretching' + * it via its CSS properties. This gives the same result and speed as using the `transform-scale` CSS + * property, without the need for browser prefix handling. + * + * The calculations for the scale are heavily influenced by the bounding parent size, which is the computed + * dimensions of the canvas's parent. The CSS rules of the parent element play an important role in the + * operation of the Scale Manager. For example, if the parent has no defined width or height, then actions + * like auto-centering will fail to achieve the required result. The Scale Manager works in tandem with the + * CSS you set-up on the page hosting your game, rather than taking control of it. + * + * #### Parent and Display canvas containment guidelines: + * + * - Style the Parent element (of the game canvas) to control the Parent size and thus the games size and layout. + * + * - The Parent element's CSS styles should _effectively_ apply maximum (and minimum) bounding behavior. + * + * - The Parent element should _not_ apply a padding as this is not accounted for. + * If a padding is required apply it to the Parent's parent or apply a margin to the Parent. + * If you need to add a border, margin or any other CSS around your game container, then use a parent element and + * apply the CSS to this instead, otherwise you'll be constantly resizing the shape of the game container. + * + * - The Display canvas layout CSS styles (i.e. margins, size) should not be altered / specified as + * they may be updated by the Scale Manager. + * + * #### Scale Modes + * + * The way the scaling is handled is determined by the `scaleMode` property. The default is `NO_SCALE`, + * which prevents Phaser from scaling or touching the canvas, or its parent, at all. In this mode, you are + * responsible for all scaling. The other scaling modes afford you automatic scaling. + * + * If you wish to scale your game so that it always fits into the available space within the parent, you + * should use the scale mode `FIT`. Look at the documentation for other scale modes to see what options are + * available. Here is a basic config showing how to set this scale mode: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * mode: Phaser.Scale.FIT, + * width: 800, + * height: 600 + * } + * ``` + * + * Place the `scale` config object within your game config. + * + * If you wish for the canvas to be resized directly, so that the canvas itself fills the available space + * (i.e. it isn't scaled, it's resized) then use the `RESIZE` scale mode. This will give you a 1:1 mapping + * of canvas pixels to game size. In this mode CSS isn't used to scale the canvas, it's literally adjusted + * to fill all available space within the parent. You should be extremely careful about the size of the + * canvas you're creating when doing this, as the larger the area, the more work the GPU has to do and it's + * very easy to hit fill-rate limits quickly. + * + * For complex, custom-scaling requirements, you should probably consider using the `RESIZE` scale mode, + * with your own limitations in place re: canvas dimensions and managing the scaling with the game scenes + * yourself. For the vast majority of games, however, the `FIT` mode is likely to be the most used. + * + * Please appreciate that the Scale Manager cannot perform miracles. All it does is scale your game canvas + * as best it can, based on what it can infer from its surrounding area. There are all kinds of environments + * where it's up to you to guide and help the canvas position itself, especially when built into rendering + * frameworks like React and Vue. If your page requires meta tags to prevent user scaling gestures, or such + * like, then it's up to you to ensure they are present in the html. + * + * #### Centering + * + * You can also have the game canvas automatically centered. Again, this relies heavily on the parent being + * properly configured and styled, as the centering offsets are based entirely on the available space + * within the parent element. Centering is disabled by default, or can be applied horizontally, vertically, + * or both. Here's an example: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * autoCenter: Phaser.Scale.CENTER_BOTH, + * width: 800, + * height: 600 + * } + * ``` + * + * #### Fullscreen API + * + * If the browser supports it, you can send your game into fullscreen mode. In this mode, the game will fill + * the entire display, removing all browser UI and anything else present on the screen. It will remain in this + * mode until your game either disables it, or until the user tabs out or presses ESCape if on desktop. It's a + * great way to achieve a desktop-game like experience from the browser, but it does require a modern browser + * to handle it. Some mobile browsers also support this. + * + * @class ScaleManager + * @memberof Phaser.Scale + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance. + */ +var ScaleManager = new Class({ + + Extends: EventEmitter, + + initialize: + + function ScaleManager (game) + { + EventEmitter.call(this); + + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Scale.ScaleManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.15.0 + */ + this.game = game; + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * + * @name Phaser.Scale.ScaleManager#canvas + * @type {HTMLCanvasElement} + * @since 3.16.0 + */ + this.canvas; + + /** + * The DOM bounds of the canvas element. + * + * @name Phaser.Scale.ScaleManager#canvasBounds + * @type {Phaser.Geom.Rectangle} + * @since 3.16.0 + */ + this.canvasBounds = new Rectangle(); + + /** + * The parent object of the Canvas. Often a div, or the browser window, or nothing in non-browser environments. + * + * This is set in the Game Config as the `parent` property. If undefined (or just not present), it will default + * to use the document body. If specifically set to `null` Phaser will ignore all parent operations. + * + * @name Phaser.Scale.ScaleManager#parent + * @type {?any} + * @since 3.16.0 + */ + this.parent = null; + + /** + * Is the parent element the browser window? + * + * @name Phaser.Scale.ScaleManager#parentIsWindow + * @type {boolean} + * @since 3.16.0 + */ + this.parentIsWindow = false; + + /** + * The Parent Size component. + * + * @name Phaser.Scale.ScaleManager#parentSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.parentSize = new Size(); + + /** + * The Game Size component. + * + * The un-modified game size, as requested in the game config (the raw width / height), + * as used for world bounds, cameras, etc + * + * @name Phaser.Scale.ScaleManager#gameSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.gameSize = new Size(); + + /** + * The Base Size component. + * + * The modified game size, which is the gameSize * resolution, used to set the canvas width and height + * (but not the CSS style) + * + * @name Phaser.Scale.ScaleManager#baseSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.baseSize = new Size(); + + /** + * The Display Size component. + * + * The size used for the canvas style, factoring in the scale mode, parent and other values. + * + * @name Phaser.Scale.ScaleManager#displaySize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.displaySize = new Size(); + + /** + * The game scale mode. + * + * @name Phaser.Scale.ScaleManager#scaleMode + * @type {Phaser.Scale.ScaleModeType} + * @since 3.16.0 + */ + this.scaleMode = CONST.SCALE_MODE.NONE; + + /** + * The canvas resolution. + * + * This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date. + * + * @name Phaser.Scale.ScaleManager#resolution + * @type {number} + * @since 3.16.0 + */ + this.resolution = 1; + + /** + * The game zoom factor. + * + * This value allows you to multiply your games base size by the given zoom factor. + * This is then used when calculating the display size, even in `NO_SCALE` situations. + * If you don't want Phaser to touch the canvas style at all, this value should be 1. + * + * Can also be set to `MAX_ZOOM` in which case the zoom value will be derived based + * on the game size and available space within the parent. + * + * @name Phaser.Scale.ScaleManager#zoom + * @type {number} + * @since 3.16.0 + */ + this.zoom = 1; + + /** + * The scale factor between the baseSize and the canvasBounds. + * + * @name Phaser.Scale.ScaleManager#displayScale + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ + this.displayScale = new Vector2(1, 1); + + /** + * If set, the canvas sizes will be automatically passed through Math.floor. + * This results in rounded pixel display values, which is important for performance on legacy + * and low powered devices, but at the cost of not achieving a 'perfect' fit in some browser windows. + * + * @name Phaser.Scale.ScaleManager#autoRound + * @type {boolean} + * @since 3.16.0 + */ + this.autoRound = false; + + /** + * Automatically center the canvas within the parent? The different centering modes are: + * + * 1. No centering. + * 2. Center both horizontally and vertically. + * 3. Center horizontally. + * 4. Center vertically. + * + * Please be aware that in order to center the game canvas, you must have specified a parent + * that has a size set, or the canvas parent is the document.body. + * + * @name Phaser.Scale.ScaleManager#autoCenter + * @type {Phaser.Scale.CenterType} + * @since 3.16.0 + */ + this.autoCenter = CONST.CENTER.NO_CENTER; + + /** + * The current device orientation. + * + * Orientation events are dispatched via the Device Orientation API, typically only on mobile browsers. + * + * @name Phaser.Scale.ScaleManager#orientation + * @type {Phaser.Scale.OrientationType} + * @since 3.16.0 + */ + this.orientation = CONST.ORIENTATION.LANDSCAPE; + + /** + * A reference to the Device.Fullscreen object. + * + * @name Phaser.Scale.ScaleManager#fullscreen + * @type {Phaser.Device.Fullscreen} + * @since 3.16.0 + */ + this.fullscreen; + + /** + * The DOM Element which is sent into fullscreen mode. + * + * @name Phaser.Scale.ScaleManager#fullscreenTarget + * @type {?any} + * @since 3.16.0 + */ + this.fullscreenTarget = null; + + /** + * Did Phaser create the fullscreen target div, or was it provided in the game config? + * + * @name Phaser.Scale.ScaleManager#_createdFullscreenTarget + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._createdFullscreenTarget = false; + + /** + * Internal var that keeps track of the user, or the browser, requesting fullscreen changes. + * + * @name Phaser.Scale.ScaleManager#_requestedFullscreenChange + * @type {boolean} + * @private + * @since 3.16.2 + */ + this._requestedFullscreenChange = false; + + /** + * The dirty state of the Scale Manager. + * Set if there is a change between the parent size and the current size. + * + * @name Phaser.Scale.ScaleManager#dirty + * @type {boolean} + * @since 3.16.0 + */ + this.dirty = false; + + /** + * How many milliseconds should elapse before checking if the browser size has changed? + * + * Most modern browsers dispatch a 'resize' event, which the Scale Manager will listen for. + * However, older browsers fail to do this, or do it consistently, so we fall back to a + * more traditional 'size check' based on a time interval. You can control how often it is + * checked here. + * + * @name Phaser.Scale.ScaleManager#resizeInterval + * @type {integer} + * @since 3.16.0 + */ + this.resizeInterval = 500; + + /** + * Internal size interval tracker. + * + * @name Phaser.Scale.ScaleManager#_lastCheck + * @type {integer} + * @private + * @since 3.16.0 + */ + this._lastCheck = 0; + + /** + * Internal flag to check orientation state. + * + * @name Phaser.Scale.ScaleManager#_checkOrientation + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._checkOrientation = false; + + /** + * Internal object containing our defined event listeners. + * + * @name Phaser.Scale.ScaleManager#listeners + * @type {object} + * @private + * @since 3.16.0 + */ + this.listeners = { + + orientationChange: NOOP, + windowResize: NOOP, + fullScreenChange: NOOP, + fullScreenError: NOOP + + }; + }, + + /** + * Called _before_ the canvas object is created and added to the DOM. + * + * @method Phaser.Scale.ScaleManager#preBoot + * @protected + * @listens Phaser.Core.Events#BOOT + * @since 3.16.0 + */ + preBoot: function () + { + // Parse the config to get the scaling values we need + this.parseConfig(this.game.config); + + this.game.events.once('boot', this.boot, this); + }, + + /** + * The Boot handler is called by Phaser.Game when it first starts up. + * The renderer is available by now and the canvas has been added to the DOM. + * + * @method Phaser.Scale.ScaleManager#boot + * @protected + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + */ + boot: function () + { + var game = this.game; + + this.canvas = game.canvas; + + this.fullscreen = game.device.fullscreen; + + if (this.scaleMode !== CONST.SCALE_MODE.RESIZE) + { + this.displaySize.setAspectMode(this.scaleMode); + } + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + this.resize(this.width, this.height); + } + else + { + this.getParentBounds(); + + // Only set the parent bounds if the parent has an actual size + if (this.parentSize.width > 0 && this.parentSize.height > 0) + { + this.displaySize.setParent(this.parentSize); + } + + this.refresh(); + } + + game.events.on(GameEvents.PRE_STEP, this.step, this); + + this.startListeners(); + }, + + /** + * Parses the game configuration to set-up the scale defaults. + * + * @method Phaser.Scale.ScaleManager#parseConfig + * @protected + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + parseConfig: function (config) + { + // Get the parent element, if any + this.getParent(config); + + // Get the size of the parent element + // This can often set a height of zero (especially for un-styled divs) + this.getParentBounds(); + + var width = config.width; + var height = config.height; + var scaleMode = config.scaleMode; + var resolution = config.resolution; + var zoom = config.zoom; + var autoRound = config.autoRound; + + // If width = '100%', or similar value + if (typeof width === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentWidth = this.parentSize.width; + + if (parentWidth === 0) + { + parentWidth = window.innerWidth; + } + + var parentScaleX = parseInt(width, 10) / 100; + + width = Math.floor(parentWidth * parentScaleX); + } + + // If height = '100%', or similar value + if (typeof height === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentHeight = this.parentSize.height; + + if (parentHeight === 0) + { + parentHeight = window.innerHeight; + } + + var parentScaleY = parseInt(height, 10) / 100; + + height = Math.floor(parentHeight * parentScaleY); + } + + // This is fixed at 1 on purpose. + // Changing it will break all user input. + // Wait for another release to solve this issue. + this.resolution = 1; + + this.scaleMode = scaleMode; + + this.autoRound = autoRound; + + this.autoCenter = config.autoCenter; + + this.resizeInterval = config.resizeInterval; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.setSize(width, height); + + if (zoom === CONST.ZOOM.MAX_ZOOM) + { + zoom = this.getMaxZoom(); + } + + this.zoom = zoom; + + // The modified game size, which is the w/h * resolution + this.baseSize.setSize(width * resolution, height * resolution); + + if (autoRound) + { + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } + + if (config.minWidth > 0) + { + this.displaySize.setMin(config.minWidth * zoom, config.minHeight * zoom); + } + + if (config.maxWidth > 0) + { + this.displaySize.setMax(config.maxWidth * zoom, config.maxHeight * zoom); + } + + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) + this.displaySize.setSize(width, height); + + this.orientation = GetScreenOrientation(width, height); + }, + + /** + * Determines the parent element of the game canvas, if any, based on the game configuration. + * + * @method Phaser.Scale.ScaleManager#getParent + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + getParent: function (config) + { + var parent = config.parent; + + if (parent === null) + { + // User is responsible for managing the parent + return; + } + + this.parent = GetTarget(parent); + this.parentIsWindow = (this.parent === document.body); + + if (config.expandParent && config.scaleMode !== CONST.SCALE_MODE.NONE) + { + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow || DOMRect.height === 0) + { + document.documentElement.style.height = '100%'; + document.body.style.height = '100%'; + + DOMRect = this.parent.getBoundingClientRect(); + + // The parent STILL has no height, clearly no CSS + // has been set on it even though we fixed the body :( + if (!this.parentIsWindow && DOMRect.height === 0) + { + this.parent.style.overflow = 'hidden'; + this.parent.style.width = '100%'; + this.parent.style.height = '100%'; + } + } + } + + // And now get the fullscreenTarget + if (config.fullscreenTarget && !this.fullscreenTarget) + { + this.fullscreenTarget = GetTarget(config.fullscreenTarget); + } + }, + + /** + * Calculates the size of the parent bounds and updates the `parentSize` component, if the canvas has a dom parent. + * + * @method Phaser.Scale.ScaleManager#getParentBounds + * @since 3.16.0 + * + * @return {boolean} `true` if the parent bounds have changed size, otherwise `false`. + */ + getParentBounds: function () + { + if (!this.parent) + { + return false; + } + + var parentSize = this.parentSize; + + // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect + + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow && this.game.device.os.iOS) + { + DOMRect.height = GetInnerHeight(true); + } + + var resolution = this.resolution; + var newWidth = DOMRect.width * resolution; + var newHeight = DOMRect.height * resolution; + + if (parentSize.width !== newWidth || parentSize.height !== newHeight) + { + parentSize.setSize(newWidth, newHeight); + + return true; + } + else + { + return false; + } + }, + + /** + * Attempts to lock the orientation of the web browser using the Screen Orientation API. + * + * This API is only available on modern mobile browsers. + * See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details. + * + * @method Phaser.Scale.ScaleManager#lockOrientation + * @since 3.16.0 + * + * @param {string} orientation - The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc. + * + * @return {boolean} `true` if the orientation was successfully locked, otherwise `false`. + */ + lockOrientation: function (orientation) + { + var lock = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation; + + if (lock) + { + return lock(orientation); + } + + return false; + }, + + /** + * This method will set the size of the Parent Size component, which is used in scaling + * and centering calculations. You only need to call this method if you have explicitly + * disabled the use of a parent in your game config, but still wish to take advantage of + * other Scale Manager features. + * + * @method Phaser.Scale.ScaleManager#setParentSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the parent. + * @param {number} height - The new height of the parent. + * + * @return {this} The Scale Manager instance. + */ + setParentSize: function (width, height) + { + this.parentSize.setSize(width, height); + + return this.refresh(); + }, + + /** + * This method will set a new size for your game. + * + * @method Phaser.Scale.ScaleManager#setGameSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + setGameSize: function (width, height) + { + var autoRound = this.autoRound; + var resolution = this.resolution; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + this.baseSize.resize(width * resolution, height * resolution); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this.refresh(); + }, + + /** + * Call this to modify the size of the Phaser canvas element directly. + * You should only use this if you are using the `NO_SCALE` scale mode, + * it will update all internal components completely. + * + * If all you want to do is change the size of the parent, see the `setParentSize` method. + * + * If all you want is to change the base size of the game, but still have the Scale Manager + * manage all the scaling, then see the `setGameSize` method. + * + * This method will set the `gameSize`, `baseSize` and `displaySize` components to the given + * dimensions. It will then resize the canvas width and height to the values given, by + * directly setting the properties. Finally, if you have set the Scale Manager zoom value + * to anything other than 1 (the default), it will set the canvas CSS width and height to + * be the given size multiplied by the zoom factor (the canvas pixel size remains untouched). + * + * If you have enabled `autoCenter`, it is then passed to the `updateCenter` method and + * the margins are set, allowing the canvas to be centered based on its parent element + * alone. Finally, the `displayScale` is adjusted and the RESIZE event dispatched. + * + * @method Phaser.Scale.ScaleManager#resize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + resize: function (width, height) + { + var zoom = this.zoom; + var resolution = this.resolution; + var autoRound = this.autoRound; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + + this.baseSize.resize(width * resolution, height * resolution); + + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + this.canvas.width = this.baseSize.width; + this.canvas.height = this.baseSize.height; + + var style = this.canvas.style; + + var styleWidth = width * zoom; + var styleHeight = height * zoom; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (styleWidth !== width || styleHeight !== height) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + this.getParentBounds(); + + this.updateCenter(); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this; + }, + + /** + * Sets the zoom value of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#setZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {integer} value - The new zoom value of the game. + * + * @return {this} The Scale Manager instance. + */ + setZoom: function (value) + { + this.zoom = value; + + return this.refresh(); + }, + + /** + * Sets the zoom to be the maximum possible based on the _current_ parent size. + * + * @method Phaser.Scale.ScaleManager#setMaxZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + setMaxZoom: function () + { + this.zoom = this.getMaxZoom(); + + return this.refresh(); + }, + + /** + * Refreshes the internal scale values, bounds sizes and orientation checks. + * + * Once finished, dispatches the resize event. + * + * This is called automatically by the Scale Manager when the browser window size changes, + * as long as it is using a Scale Mode other than 'NONE'. + * + * @method Phaser.Scale.ScaleManager#refresh + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + refresh: function () + { + this.updateScale(); + this.updateBounds(); + this.updateOrientation(); + + this.displayScale.set(this.baseSize.width / this.canvasBounds.width, this.baseSize.height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + return this; + }, + + /** + * Internal method that checks the current screen orientation, only if the internal check flag is set. + * + * If the orientation has changed it updates the orientation property and then dispatches the orientation change event. + * + * @method Phaser.Scale.ScaleManager#updateOrientation + * @fires Phaser.Scale.Events#ORIENTATION_CHANGE + * @since 3.16.0 + */ + updateOrientation: function () + { + if (this._checkOrientation) + { + this._checkOrientation = false; + + var newOrientation = GetScreenOrientation(this.width, this.height); + + if (newOrientation !== this.orientation) + { + this.orientation = newOrientation; + + this.emit(Events.ORIENTATION_CHANGE, newOrientation); + } + } + }, + + /** + * Internal method that manages updating the size components based on the scale mode. + * + * @method Phaser.Scale.ScaleManager#updateScale + * @since 3.16.0 + */ + updateScale: function () + { + var style = this.canvas.style; + + var width = this.gameSize.width; + var height = this.gameSize.height; + + var styleWidth; + var styleHeight; + + var zoom = this.zoom; + var autoRound = this.autoRound; + var resolution = 1; + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + // No scale + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (zoom > 1) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + } + else if (this.scaleMode === CONST.SCALE_MODE.RESIZE) + { + // Resize to match parent + + // This will constrain using min/max + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + this.gameSize.setSize(this.displaySize.width, this.displaySize.height); + + this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + this.canvas.width = styleWidth; + this.canvas.height = styleHeight; + } + else + { + // All other scale modes + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + // Update the parentSize incase the canvas / style change modified it + this.getParentBounds(); + + // Finally, update the centering + this.updateCenter(); + }, + + /** + * Calculates and returns the largest possible zoom factor, based on the current + * parent and game sizes. If the parent has no dimensions (i.e. an unstyled div), + * or is smaller than the un-zoomed game, then this will return a value of 1 (no zoom) + * + * @method Phaser.Scale.ScaleManager#getMaxZoom + * @since 3.16.0 + * + * @return {integer} The maximum possible zoom factor. At a minimum this value is always at least 1. + */ + getMaxZoom: function () + { + var zoomH = SnapFloor(this.parentSize.width, this.gameSize.width, 0, true); + var zoomV = SnapFloor(this.parentSize.height, this.gameSize.height, 0, true); + + return Math.max(Math.min(zoomH, zoomV), 1); + }, + + /** + * Calculates and updates the canvas CSS style in order to center it within the + * bounds of its parent. If you have explicitly set parent to be `null` in your + * game config then this method will likely give incorrect results unless you have called the + * `setParentSize` method first. + * + * It works by modifying the canvas CSS `marginLeft` and `marginTop` properties. + * + * If they have already been set by your own style sheet, or code, this will overwrite them. + * + * To prevent the Scale Manager from centering the canvas, either do not set the + * `autoCenter` property in your game config, or make sure it is set to `NO_CENTER`. + * + * @method Phaser.Scale.ScaleManager#updateCenter + * @since 3.16.0 + */ + updateCenter: function () + { + var autoCenter = this.autoCenter; + + if (autoCenter === CONST.CENTER.NO_CENTER) + { + return; + } + + var canvas = this.canvas; + + var style = canvas.style; + + var bounds = canvas.getBoundingClientRect(); + + // var width = parseInt(canvas.style.width, 10) || canvas.width; + // var height = parseInt(canvas.style.height, 10) || canvas.height; + + var width = bounds.width; + var height = bounds.height; + + var offsetX = Math.floor((this.parentSize.width - width) / 2); + var offsetY = Math.floor((this.parentSize.height - height) / 2); + + if (autoCenter === CONST.CENTER.CENTER_HORIZONTALLY) + { + offsetY = 0; + } + else if (autoCenter === CONST.CENTER.CENTER_VERTICALLY) + { + offsetX = 0; + } + + style.marginLeft = offsetX + 'px'; + style.marginTop = offsetY + 'px'; + }, + + /** + * Updates the `canvasBounds` rectangle to match the bounding client rectangle of the + * canvas element being used to track input events. + * + * @method Phaser.Scale.ScaleManager#updateBounds + * @since 3.16.0 + */ + updateBounds: function () + { + var bounds = this.canvasBounds; + var clientRect = this.canvas.getBoundingClientRect(); + + bounds.x = clientRect.left + (window.pageXOffset || 0) - (document.documentElement.clientLeft || 0); + bounds.y = clientRect.top + (window.pageYOffset || 0) - (document.documentElement.clientTop || 0); + bounds.width = clientRect.width; + bounds.height = clientRect.height; + }, + + /** + * Transforms the pageX value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformX + * @since 3.16.0 + * + * @param {number} pageX - The DOM pageX value. + * + * @return {number} The translated value. + */ + transformX: function (pageX) + { + return (pageX - this.canvasBounds.left) * this.displayScale.x; + }, + + /** + * Transforms the pageY value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformY + * @since 3.16.0 + * + * @param {number} pageY - The DOM pageY value. + * + * @return {number} The translated value. + */ + transformY: function (pageY) + { + return (pageY - this.canvasBounds.top) * this.displayScale.y; + }, + + /** + * Sends a request to the browser to ask it to go in to full screen mode, using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Fullscreen API}. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * Performing an action that navigates to another page, or opens another tab, will automatically cancel + * fullscreen mode, as will the user pressing the ESC key. To cancel fullscreen mode from your game, i.e. + * from clicking an icon, call the `stopFullscreen` method. + * + * A browser can only send one DOM element into fullscreen. You can control which element this is by + * setting the `fullscreenTarget` property in your game config, or changing the property in the Scale Manager. + * Note that the game canvas _must_ be a child of the target. If you do not give a target, Phaser will + * automatically create a blank `
` element and move the canvas into it, before going fullscreen. + * When it leaves fullscreen, the div will be removed. + * + * @method Phaser.Scale.ScaleManager#startFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + startFullscreen: function (fullscreenOptions) + { + if (fullscreenOptions === undefined) { fullscreenOptions = { navigationUI: 'hide' }; } + + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return; + } + + if (!fullscreen.active) + { + var fsTarget = this.getFullscreenTarget(); + + this._requestedFullscreenChange = true; + + if (fullscreen.keyboard) + { + fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); + } + else + { + fsTarget[fullscreen.request](fullscreenOptions); + } + + this.getParentBounds(); + + this.refresh(); + + this.emit(Events.ENTER_FULLSCREEN); + } + }, + + /** + * An internal method that gets the target element that is used when entering fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#getFullscreenTarget + * @since 3.16.0 + * + * @return {object} The fullscreen target element. + */ + getFullscreenTarget: function () + { + if (!this.fullscreenTarget) + { + var fsTarget = document.createElement('div'); + + fsTarget.style.margin = '0'; + fsTarget.style.padding = '0'; + fsTarget.style.width = '100%'; + fsTarget.style.height = '100%'; + + this.fullscreenTarget = fsTarget; + + this._createdFullscreenTarget = true; + } + + if (this._createdFullscreenTarget) + { + var canvasParent = this.canvas.parentNode; + + canvasParent.insertBefore(this.fullscreenTarget, this.canvas); + + this.fullscreenTarget.appendChild(this.canvas); + } + + return this.fullscreenTarget; + }, + + /** + * Calling this method will cancel fullscreen mode, if the browser has entered it. + * + * @method Phaser.Scale.ScaleManager#stopFullscreen + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.16.0 + */ + stopFullscreen: function () + { + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return false; + } + + if (fullscreen.active) + { + this._requestedFullscreenChange = true; + + document[fullscreen.cancel](); + } + + if (this._createdFullscreenTarget) + { + var fsTarget = this.fullscreenTarget; + + if (fsTarget && fsTarget.parentNode) + { + var parent = fsTarget.parentNode; + + parent.insertBefore(this.canvas, fsTarget); + + parent.removeChild(fsTarget); + } + } + + this.emit(Events.LEAVE_FULLSCREEN); + + this.refresh(); + }, + + /** + * Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. + * If not in fullscreen, this will request the browser to enter fullscreen mode. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * @method Phaser.Scale.ScaleManager#toggleFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + toggleFullscreen: function (fullscreenOptions) + { + if (this.fullscreen.active) + { + this.stopFullscreen(); + } + else + { + this.startFullscreen(fullscreenOptions); + } + }, + + /** + * An internal method that starts the different DOM event listeners running. + * + * @method Phaser.Scale.ScaleManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + var listeners = this.listeners; + + listeners.orientationChange = function () + { + _this._checkOrientation = true; + _this.dirty = true; + }; + + listeners.windowResize = function () + { + _this.dirty = true; + }; + + // Only dispatched on mobile devices + window.addEventListener('orientationchange', listeners.orientationChange, false); + + window.addEventListener('resize', listeners.windowResize, false); + + if (this.fullscreen.available) + { + listeners.fullScreenChange = function (event) + { + return _this.onFullScreenChange(event); + }; + + listeners.fullScreenError = function (event) + { + return _this.onFullScreenError(event); + }; + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); + } + }, + + /** + * Triggered when a fullscreenchange event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenChange + * @since 3.16.0 + */ + onFullScreenChange: function () + { + // They pressed ESC while in fullscreen mode + if (!this._requestedFullscreenChange) + { + this.stopFullscreen(); + } + + this._requestedFullscreenChange = false; + }, + + /** + * Triggered when a fullscreenerror event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenError + * @since 3.16.0 + */ + onFullScreenError: function () + { + }, + + /** + * Internal method, called automatically by the game step. + * Monitors the elapsed time and resize interval to see if a parent bounds check needs to take place. + * + * @method Phaser.Scale.ScaleManager#step + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + step: function (time, delta) + { + if (!this.parent) + { + return; + } + + this._lastCheck += delta; + + if (this.dirty || this._lastCheck > this.resizeInterval) + { + // Returns true if the parent bounds have changed size + if (this.getParentBounds()) + { + this.refresh(); + } + + this.dirty = false; + this._lastCheck = 0; + } + }, + + /** + * Stops all DOM event listeners. + * + * @method Phaser.Scale.ScaleManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var listeners = this.listeners; + + window.removeEventListener('orientationchange', listeners.orientationChange, false); + window.removeEventListener('resize', listeners.windowResize, false); + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); + }, + + /** + * Destroys this Scale Manager, releasing all references to external resources. + * Once destroyed, the Scale Manager cannot be used again. + * + * @method Phaser.Scale.ScaleManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.stopListeners(); + + this.game = null; + this.canvas = null; + this.canvasBounds = null; + this.parent = null; + this.parentSize.destroy(); + this.gameSize.destroy(); + this.baseSize.destroy(); + this.displaySize.destroy(); + this.fullscreenTarget = null; + }, + + /** + * Is the browser currently in fullscreen mode or not? + * + * @name Phaser.Scale.ScaleManager#isFullscreen + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isFullscreen: { + + get: function () + { + return this.fullscreen.active; + } + + }, + + /** + * The game width. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#width + * @type {number} + * @readonly + * @since 3.16.0 + */ + width: { + + get: function () + { + return this.gameSize.width; + } + + }, + + /** + * The game height. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#height + * @type {number} + * @readonly + * @since 3.16.0 + */ + height: { + + get: function () + { + return this.gameSize.height; + } + + }, + + /** + * Is the device in a portrait orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isPortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isPortrait: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.PORTRAIT); + } + + }, + + /** + * Is the device in a landscape orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isLandscape: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.LANDSCAPE); + } + + }, + + /** + * Are the game dimensions portrait? (i.e. taller than they are wide) + * + * This is different to the device itself being in a portrait orientation. + * + * @name Phaser.Scale.ScaleManager#isGamePortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGamePortrait: { + + get: function () + { + return (this.height > this.width); + } + + }, + + /** + * Are the game dimensions landscape? (i.e. wider than they are tall) + * + * This is different to the device itself being in a landscape orientation. + * + * @name Phaser.Scale.ScaleManager#isGameLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGameLandscape: { + + get: function () + { + return (this.width > this.height); + } + + } + +}); + +module.exports = ScaleManager; + + +/***/ }), +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(26); var EventEmitter = __webpack_require__(11); var FileTypesManager = __webpack_require__(7); -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GameObjectFactory = __webpack_require__(5); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); -var Remove = __webpack_require__(330); +var PluginCache = __webpack_require__(17); +var Remove = __webpack_require__(177); /** * @typedef {object} GlobalPlugin @@ -78371,8 +80033,8 @@ var Remove = __webpack_require__(330); * * There are two types of plugin: * - * 1) A Global Plugin - * 2) A Scene Plugin + * 1. A Global Plugin + * 2. A Scene Plugin * * A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get * access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in @@ -78386,9 +80048,9 @@ var Remove = __webpack_require__(330); * * You can add a plugin to Phaser in three different ways: * - * 1) Preload it - * 2) Include it in your source code and install it via the Game Config - * 3) Include it in your source code and install it within a Scene + * 1. Preload it + * 2. Include it in your source code and install it via the Game Config + * 3. Include it in your source code and install it within a Scene * * For examples of all of these approaches please see the Phaser 3 Examples Repo `plugins` folder. * @@ -78465,7 +80127,7 @@ var PluginManager = new Class({ } else { - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); } }, @@ -78536,7 +80198,7 @@ var PluginManager = new Class({ this._pendingGlobal = []; this._pendingScene = []; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -78744,6 +80406,8 @@ var PluginManager = new Class({ * @param {boolean} [start=false] - Automatically start the plugin running? This is always `true` if you provide a mapping value. * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. * @param {any} [data] - A value passed to the plugin's `init` method. + * + * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if `start` was false, or game isn't yet booted. */ install: function (key, plugin, start, mapping, data) { @@ -78754,13 +80418,13 @@ var PluginManager = new Class({ if (typeof plugin !== 'function') { console.warn('Invalid Plugin: ' + key); - return; + return null; } if (PluginCache.hasCustom(key)) { console.warn('Plugin key in use: ' + key); - return; + return null; } if (mapping !== null) @@ -78782,6 +80446,8 @@ var PluginManager = new Class({ return this.start(key); } } + + return null; }, /** @@ -79188,71 +80854,17 @@ module.exports = PluginManager; /***/ }), -/* 332 */ +/* 337 */ /***/ (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 Vector2 = __webpack_require__(3); - -/** - * Takes the `x` and `y` coordinates and transforms them into the same space as - * defined by the position, rotation and scale values. - * - * @function Phaser.Math.TransformXY - * @since 3.0.0 - * - * @param {number} x - The x coordinate to be transformed. - * @param {number} y - The y coordinate to be transformed. - * @param {number} positionX - Horizontal position of the transform point. - * @param {number} positionY - Vertical position of the transform point. - * @param {number} rotation - Rotation of the transform point, in radians. - * @param {number} scaleX - Horizontal scale of the transform point. - * @param {number} scaleY - Vertical scale of the transform point. - * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. - * - * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. - */ -var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) -{ - if (output === undefined) { output = new Vector2(); } - - var radianSin = Math.sin(rotation); - var radianCos = Math.cos(rotation); - - // Rotate and Scale - var a = radianCos * scaleX; - var b = radianSin * scaleX; - var c = -radianSin * scaleY; - var d = radianCos * scaleY; - - // Invert - var id = 1 / ((a * d) + (c * -b)); - - output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); - output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); - - return output; -}; - -module.exports = TransformXY; - - -/***/ }), -/* 333 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var InputEvents = __webpack_require__(52); var NOOP = __webpack_require__(1); // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events @@ -79360,7 +80972,27 @@ var TouchManager = new Class({ */ this.onTouchCancel = NOOP; - inputManager.events.once('boot', this.boot, this); + /** + * The Touch Over event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchOver + * @type {function} + * @since 3.16.0 + */ + this.onTouchOver = NOOP; + + /** + * The Touch Out event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchOut + * @type {function} + * @since 3.16.0 + */ + this.onTouchOut = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -79402,9 +81034,16 @@ var TouchManager = new Class({ startListeners: function () { var _this = this; + var canvas = this.manager.canvas; + var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); this.onTouchStart = function (event) { + if (autoFocus) + { + window.focus(); + } + if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled @@ -79413,7 +81052,7 @@ var TouchManager = new Class({ _this.manager.queueTouchStart(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } @@ -79445,7 +81084,7 @@ var TouchManager = new Class({ _this.manager.queueTouchEnd(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } @@ -79467,6 +81106,28 @@ var TouchManager = new Class({ } }; + this.onTouchOver = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOver(event); + }; + + this.onTouchOut = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOut(event); + }; + var target = this.target; if (!target) @@ -79477,18 +81138,17 @@ var TouchManager = new Class({ var passive = { passive: true }; var nonPassive = { passive: false }; - if (this.capture) + target.addEventListener('touchstart', this.onTouchStart, (this.capture) ? nonPassive : passive); + target.addEventListener('touchmove', this.onTouchMove, (this.capture) ? nonPassive : passive); + target.addEventListener('touchend', this.onTouchEnd, (this.capture) ? nonPassive : passive); + target.addEventListener('touchcancel', this.onTouchCancel, (this.capture) ? nonPassive : passive); + target.addEventListener('touchover', this.onTouchOver, (this.capture) ? nonPassive : passive); + target.addEventListener('touchout', this.onTouchOut, (this.capture) ? nonPassive : passive); + + if (window) { - target.addEventListener('touchstart', this.onTouchStart, nonPassive); - target.addEventListener('touchmove', this.onTouchMove, nonPassive); - target.addEventListener('touchend', this.onTouchEnd, nonPassive); - target.addEventListener('touchcancel', this.onTouchCancel, nonPassive); - } - else - { - target.addEventListener('touchstart', this.onTouchStart, passive); - target.addEventListener('touchmove', this.onTouchMove, passive); - target.addEventListener('touchend', this.onTouchEnd, passive); + window.addEventListener('touchstart', this.onTouchStart, nonPassive); + window.addEventListener('touchend', this.onTouchEnd, nonPassive); } this.enabled = true; @@ -79509,6 +81169,14 @@ var TouchManager = new Class({ target.removeEventListener('touchmove', this.onTouchMove); target.removeEventListener('touchend', this.onTouchEnd); target.removeEventListener('touchcancel', this.onTouchCancel); + target.removeEventListener('touchover', this.onTouchOver); + target.removeEventListener('touchout', this.onTouchOut); + + if (window) + { + window.removeEventListener('touchstart', this.onTouchStart); + window.removeEventListener('touchend', this.onTouchEnd); + } }, /** @@ -79532,51 +81200,20 @@ module.exports = TouchManager; /***/ }), -/* 334 */ +/* 338 */ /***/ (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 SmoothStep = __webpack_require__(181); - -/** - * A Smooth Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmoothStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmoothStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmoothStep(t, 0, 1); -}; - -module.exports = SmoothStepInterpolation; - - -/***/ }), -/* 335 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Angle = __webpack_require__(386); var Class = __webpack_require__(0); -var Distance = __webpack_require__(52); -var SmoothStepInterpolation = __webpack_require__(334); +var Distance = __webpack_require__(56); +var FuzzyEqual = __webpack_require__(186); +var SmoothStepInterpolation = __webpack_require__(377); var Vector2 = __webpack_require__(3); /** @@ -79636,6 +81273,26 @@ var Pointer = new Class({ */ this.event; + /** + * The DOM element the Pointer was pressed down on, taken from the DOM event. + * + * @name Phaser.Input.Pointer#downElement + * @type {any} + * @readonly + * @since 3.16.0 + */ + this.downElement; + + /** + * The DOM element the Pointer was released on, taken from the DOM event. + * + * @name Phaser.Input.Pointer#upElement + * @type {any} + * @readonly + * @since 3.16.0 + */ + this.upElement; + /** * The camera the Pointer interacted with during its last update. * @@ -79672,6 +81329,7 @@ var Pointer = new Class({ * * @name Phaser.Input.Pointer#position * @type {Phaser.Math.Vector2} + * @readonly * @since 3.0.0 */ this.position = new Vector2(); @@ -79681,15 +81339,109 @@ var Pointer = new Class({ * * The old x and y values are stored in here during the InputManager.transformPointer call. * - * You can use it to track how fast the pointer is moving, or to smoothly interpolate between the old and current position. - * See the `Pointer.getInterpolatedPosition` method to assist in this. + * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition. * * @name Phaser.Input.Pointer#prevPosition * @type {Phaser.Math.Vector2} + * @readonly * @since 3.11.0 */ this.prevPosition = new Vector2(); + /** + * An internal vector used for calculations of the pointer speed and angle. + * + * @name Phaser.Input.Pointer#midPoint + * @type {Phaser.Math.Vector2} + * @private + * @since 3.16.0 + */ + this.midPoint = new Vector2(-1, -1); + + /** + * The current velocity of the Pointer, based on its current and previous positions. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#velocity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.velocity = new Vector2(); + + /** + * The current angle the Pointer is moving, in radians, based on its previous and current position. + * + * The angle is based on the old position facing to the current position. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#angle + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.angle = 0; + + /** + * The distance the Pointer has moved, based on its previous and current position. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * If you need the total distance travelled since the primary buttons was pressed down, + * then use the `Pointer.getDistance` method. + * + * @name Phaser.Input.Pointer#distance + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.distance = 0; + + /** + * The smoothing factor to apply to the Pointer position. + * + * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions + * then you can set this value to apply an automatic smoothing to the positions as they are recorded. + * + * The default value of zero means 'no smoothing'. + * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this + * value directly, or by setting the `input.smoothFactor` property in the Game Config. + * + * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position + * is always precise, and not smoothed. + * + * @name Phaser.Input.Pointer#smoothFactor + * @type {number} + * @default 0 + * @since 3.16.0 + */ + this.smoothFactor = 0; + + /** + * The factor applied to the motion smoothing each frame. + * + * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, + * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current + * position of the Pointer. 0.2 provides a good average but can be increased if you need a + * quicker update and are working in a high performance environment. Never set this value to + * zero. + * + * @name Phaser.Input.Pointer#motionFactor + * @type {number} + * @default 0.2 + * @since 3.16.0 + */ + this.motionFactor = 0.2; + /** * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. * @@ -79710,6 +81462,16 @@ var Pointer = new Class({ */ this.worldY = 0; + /** + * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any) + * + * @name Phaser.Input.Pointer#moveTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.moveTime = 0; + /** * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. * @@ -79780,20 +81542,6 @@ var Pointer = new Class({ */ this.primaryDown = false; - /** - * The Drag State of the Pointer: - * - * 0 = Not dragging anything - * 1 = Being checked if dragging - * 2 = Dragging something - * - * @name Phaser.Input.Pointer#dragState - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.dragState = 0; - /** * Is _any_ button on this pointer considered as being down? * @@ -79914,6 +81662,15 @@ var Pointer = new Class({ * @since 3.10.0 */ this.active = (id === 0) ? true : false; + + /** + * Time when this Pointer was most recently updated by the Game step. + * + * @name Phaser.Input.Pointer#time + * @type {number} + * @since 3.16.0 + */ + this.time = 0; }, /** @@ -79935,13 +81692,13 @@ var Pointer = new Class({ /** * Resets the temporal properties of this Pointer. - * Called automatically by the Input Plugin each update. + * This method is called automatically each frame by the Input Manager. * * @method Phaser.Input.Pointer#reset * @private * @since 3.0.0 */ - reset: function () + reset: function (time) { this.dirty = false; @@ -79949,10 +81706,60 @@ var Pointer = new Class({ this.justUp = false; this.justMoved = false; + this.time = time; + this.movementX = 0; this.movementY = 0; }, + /** + * Calculates the motion of this Pointer, including its velocity and angle of movement. + * This method is called automatically each frame by the Input Manager. + * + * @method Phaser.Input.Pointer#updateMotion + * @private + * @since 3.16.0 + */ + updateMotion: function () + { + var cx = this.position.x; + var cy = this.position.y; + + var mx = this.midPoint.x; + var my = this.midPoint.y; + + if (cx === mx && cy === my) + { + // Nothing to do here + return; + } + + // Moving towards our goal ... + var vx = SmoothStepInterpolation(this.motionFactor, mx, cx); + var vy = SmoothStepInterpolation(this.motionFactor, my, cy); + + if (FuzzyEqual(vx, cx, 0.1)) + { + vx = cx; + } + + if (FuzzyEqual(vy, cy, 0.1)) + { + vy = cy; + } + + this.midPoint.set(vx, vy); + + var dx = cx - vx; + var dy = cy - vy; + + this.velocity.set(dx, dy); + + this.angle = Angle(vx, vy, cx, cy); + + this.distance = Math.sqrt(dx * dx + dy * dy); + }, + /** * Internal method to handle a Mouse Up Event. * @@ -79965,15 +81772,17 @@ var Pointer = new Class({ */ up: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } this.event = event; + this.upElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); // 0: Main button pressed, usually the left button or the un-initialized state if (event.button === 0) @@ -80004,15 +81813,17 @@ var Pointer = new Class({ */ down: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } this.event = event; + this.downElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); // 0: Main button pressed, usually the left button or the un-initialized state if (event.button === 0) @@ -80041,9 +81852,9 @@ var Pointer = new Class({ * @param {MouseEvent} event - The Mouse Event to process. * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. */ - move: function (event) + move: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } @@ -80051,7 +81862,7 @@ var Pointer = new Class({ this.event = event; // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, true); if (this.manager.mouse.locked) { @@ -80062,6 +81873,8 @@ var Pointer = new Class({ this.justMoved = true; + this.moveTime = time; + this.dirty = true; this.wasTouch = false; @@ -80092,8 +81905,10 @@ var Pointer = new Class({ this.event = event; + this.downElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); this.primaryDown = true; this.downX = this.x; @@ -80119,15 +81934,17 @@ var Pointer = new Class({ * @param {TouchEvent} event - The Touch Event to process. * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. */ - touchmove: function (event) + touchmove: function (event, time) { this.event = event; // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, true); this.justMoved = true; + this.moveTime = time; + this.dirty = true; this.wasTouch = true; @@ -80149,8 +81966,10 @@ var Pointer = new Class({ this.event = event; + this.upElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); this.primaryDown = false; this.upX = this.x; @@ -80219,7 +82038,7 @@ var Pointer = new Class({ */ leftButtonDown: function () { - return (this.buttons & 1); + return (this.buttons & 1) ? true : false; }, /** @@ -80232,7 +82051,7 @@ var Pointer = new Class({ */ rightButtonDown: function () { - return (this.buttons & 2); + return (this.buttons & 2) ? true : false; }, /** @@ -80245,7 +82064,7 @@ var Pointer = new Class({ */ middleButtonDown: function () { - return (this.buttons & 4); + return (this.buttons & 4) ? true : false; }, /** @@ -80258,7 +82077,7 @@ var Pointer = new Class({ */ backButtonDown: function () { - return (this.buttons & 8); + return (this.buttons & 8) ? true : false; }, /** @@ -80271,21 +82090,135 @@ var Pointer = new Class({ */ forwardButtonDown: function () { - return (this.buttons & 16); + return (this.buttons & 16) ? true : false; }, /** - * Returns the distance between the Pointer's current position and where it was - * first pressed down (the `downX` and `downY` properties) + * If the Pointer has a button pressed down at the time this method is called, it will return the + * distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded distance, based on where + * the Pointer was when the button was released. + * + * If you wish to get the distance being travelled currently, based on the velocity of the Pointer, + * then see the `Pointer.distance` property. * * @method Phaser.Input.Pointer#getDistance * @since 3.13.0 * - * @return {number} The distance the Pointer has moved since being pressed down. + * @return {number} The distance the Pointer moved. */ getDistance: function () { - return Distance(this.downX, this.downY, this.x, this.y); + if (this.isDown) + { + return Distance(this.downX, this.downY, this.x, this.y); + } + else + { + return Distance(this.downX, this.downY, this.upX, this.upY); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * horizontal distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded horizontal distance, based on where + * the Pointer was when the button was released. + * + * @method Phaser.Input.Pointer#getDistanceX + * @since 3.16.0 + * + * @return {number} The horizontal distance the Pointer moved. + */ + getDistanceX: function () + { + if (this.isDown) + { + return Math.abs(this.downX - this.x); + } + else + { + return Math.abs(this.downX - this.upX); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * vertical distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded vertical distance, based on where + * the Pointer was when the button was released. + * + * @method Phaser.Input.Pointer#getDistanceY + * @since 3.16.0 + * + * @return {number} The vertical distance the Pointer moved. + */ + getDistanceY: function () + { + if (this.isDown) + { + return Math.abs(this.downY - this.y); + } + else + { + return Math.abs(this.downY - this.upY); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * duration since the Pointer's was pressed down. + * + * If no button is held down, it will return the last recorded duration, based on the time + * the Pointer button was released. + * + * @method Phaser.Input.Pointer#getDuration + * @since 3.16.0 + * + * @return {number} The duration the Pointer was held down for in milliseconds. + */ + getDuration: function () + { + if (this.isDown) + { + return (this.time - this.downTime); + } + else + { + return (this.upTime - this.downTime); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * angle between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded angle, based on where + * the Pointer was when the button was released. + * + * The angle is based on the old position facing to the current position. + * + * If you wish to get the current angle, based on the velocity of the Pointer, then + * see the `Pointer.angle` property. + * + * @method Phaser.Input.Pointer#getAngle + * @since 3.16.0 + * + * @return {number} The angle between the Pointer's coordinates in radians. + */ + getAngle: function () + { + if (this.isDown) + { + return Angle(this.downX, this.downY, this.x, this.y); + } + else + { + return Angle(this.downX, this.downY, this.upX, this.upY); + } }, /** @@ -80404,17 +82337,19 @@ module.exports = Pointer; /***/ }), -/* 336 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Features = __webpack_require__(168); +var Features = __webpack_require__(187); +var InputEvents = __webpack_require__(52); +var NOOP = __webpack_require__(0); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md @@ -80490,7 +82425,73 @@ var MouseManager = new Class({ */ this.locked = false; - inputManager.events.once('boot', this.boot, this); + /** + * The Mouse Move Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseMove + * @type {function} + * @since 3.10.0 + */ + this.onMouseMove = NOOP; + + /** + * The Mouse Down Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseDown + * @type {function} + * @since 3.10.0 + */ + this.onMouseDown = NOOP; + + /** + * The Mouse Up Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseUp + * @type {function} + * @since 3.10.0 + */ + this.onMouseUp = NOOP; + + /** + * The Mouse Over Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOver + * @type {function} + * @since 3.16.0 + */ + this.onMouseOver = NOOP; + + /** + * The Mouse Out Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOut + * @type {function} + * @since 3.16.0 + */ + this.onMouseOut = NOOP; + + /** + * Internal pointerLockChange handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#pointerLockChange + * @type {function} + * @since 3.0.0 + */ + this.pointerLockChange = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -80518,7 +82519,7 @@ var MouseManager = new Class({ this.disableContextMenu(); } - if (this.enabled) + if (this.enabled && this.target) { this.startListeners(); } @@ -80568,31 +82569,13 @@ var MouseManager = new Class({ if (Features.pointerLock) { var element = this.target; + element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; + element.requestPointerLock(); } }, - /** - * Internal pointerLockChange handler. - * - * @method Phaser.Input.Mouse.MouseManager#pointerLockChange - * @since 3.0.0 - * - * @param {MouseEvent} event - The native event from the browser. - */ - - /* - pointerLockChange: function (event) - { - var element = this.target; - - this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; - - this.manager.queue.push(event); - }, - */ - /** * If the browser supports pointer lock, this will request that the pointer lock is released. If * the browser successfully enters a locked state, a 'POINTER_LOCK_CHANGE_EVENT' will be @@ -80610,87 +82593,6 @@ var MouseManager = new Class({ } }, - /** - * The Mouse Move Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseMove - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Move Event. - */ - - /* - onMouseMove: function (event) - { - if (event.defaultPrevented || !this.enabled || !this.manager) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseMove(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - - /** - * The Mouse Down Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseDown - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Down Event. - */ - - /* - onMouseDown: function (event) - { - if (event.defaultPrevented || !this.enabled) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseDown(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - - /** - * The Mouse Up Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseUp - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Up Event. - */ - - /* - onMouseUp: function (event) - { - if (event.defaultPrevented || !this.enabled) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseUp(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - /** * Starts the Mouse Event listeners running. * This is called automatically and does not need to be manually invoked. @@ -80701,15 +82603,17 @@ var MouseManager = new Class({ startListeners: function () { var _this = this; + var canvas = this.manager.canvas; + var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); - var onMouseMove = function (event) + this.onMouseMove = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled return; } - + _this.manager.queueMouseMove(event); if (_this.capture) @@ -80718,8 +82622,13 @@ var MouseManager = new Class({ } }; - var onMouseDown = function (event) + this.onMouseDown = function (event) { + if (autoFocus) + { + window.focus(); + } + if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled @@ -80728,13 +82637,13 @@ var MouseManager = new Class({ _this.manager.queueMouseDown(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } }; - var onMouseUp = function (event) + this.onMouseUp = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) { @@ -80744,27 +82653,59 @@ var MouseManager = new Class({ _this.manager.queueMouseUp(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } }; - this.onMouseMove = onMouseMove; - this.onMouseDown = onMouseDown; - this.onMouseUp = onMouseUp; + this.onMouseOver = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOver(event); + }; + + this.onMouseOut = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOut(event); + }; var target = this.target; + + if (!target) + { + return; + } + var passive = { passive: true }; var nonPassive = { passive: false }; - target.addEventListener('mousemove', onMouseMove, (this.capture) ? nonPassive : passive); - target.addEventListener('mousedown', onMouseDown, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseup', onMouseUp, (this.capture) ? nonPassive : passive); + target.addEventListener('mousemove', this.onMouseMove, (this.capture) ? nonPassive : passive); + target.addEventListener('mousedown', this.onMouseDown, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseup', this.onMouseUp, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseover', this.onMouseOver, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseout', this.onMouseOut, (this.capture) ? nonPassive : passive); + + if (window) + { + window.addEventListener('mousedown', this.onMouseDown, nonPassive); + window.addEventListener('mouseup', this.onMouseUp, nonPassive); + } if (Features.pointerLock) { - var onPointerLockChange = function (event) + this.pointerLockChange = function (event) { var element = _this.target; @@ -80773,12 +82714,12 @@ var MouseManager = new Class({ _this.manager.queue.push(event); }; - this.pointerLockChange = onPointerLockChange; - - document.addEventListener('pointerlockchange', onPointerLockChange, true); - document.addEventListener('mozpointerlockchange', onPointerLockChange, true); - document.addEventListener('webkitpointerlockchange', onPointerLockChange, true); + document.addEventListener('pointerlockchange', this.pointerLockChange, true); + document.addEventListener('mozpointerlockchange', this.pointerLockChange, true); + document.addEventListener('webkitpointerlockchange', this.pointerLockChange, true); } + + this.enabled = true; }, /** @@ -80795,6 +82736,14 @@ var MouseManager = new Class({ target.removeEventListener('mousemove', this.onMouseMove); target.removeEventListener('mousedown', this.onMouseDown); target.removeEventListener('mouseup', this.onMouseUp); + target.removeEventListener('mouseover', this.onMouseOver); + target.removeEventListener('mouseout', this.onMouseOut); + + if (window) + { + window.removeEventListener('mousedown', this.onMouseDown); + window.removeEventListener('mouseup', this.onMouseUp); + } if (Features.pointerLock) { @@ -80815,6 +82764,7 @@ var MouseManager = new Class({ this.stopListeners(); this.target = null; + this.enabled = false; this.manager = null; } @@ -80824,12 +82774,462 @@ module.exports = MouseManager; /***/ }), -/* 337 */ +/* 340 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ArrayRemove = __webpack_require__(177); +var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(26); +var InputEvents = __webpack_require__(52); +var KeyCodes = __webpack_require__(125); +var NOOP = __webpack_require__(0); + +/** + * @classdesc + * The Keyboard Manager is a helper class that belongs to the global Input Manager. + * + * Its role is to listen for native DOM Keyboard Events and then store them for further processing by the Keyboard Plugin. + * + * You do not need to create this class directly, the Input Manager will create an instance of it automatically if keyboard + * input has been enabled in the Game Config. + * + * @class KeyboardManager + * @memberof Phaser.Input.Keyboard + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. + */ +var KeyboardManager = new Class({ + + initialize: + + function KeyboardManager (inputManager) + { + /** + * A reference to the Input Manager. + * + * @name Phaser.Input.Keyboard.KeyboardManager#manager + * @type {Phaser.Input.InputManager} + * @since 3.16.0 + */ + this.manager = inputManager; + + /** + * An internal event queue. + * + * @name Phaser.Input.Keyboard.KeyboardManager#queue + * @type {KeyboardEvent[]} + * @private + * @since 3.16.0 + */ + this.queue = []; + + /** + * A flag that controls if the non-modified keys, matching those stored in the `captures` array, + * have `preventDefault` called on them or not. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle this property at run-time. + * + * @name Phaser.Input.Keyboard.KeyboardManager#preventDefault + * @type {boolean} + * @since 3.16.0 + */ + this.preventDefault = true; + + /** + * An array of Key Code values that will automatically have `preventDefault` called on them, + * as long as the `KeyboardManager.preventDefault` boolean is set to `true`. + * + * By default the array is empty. + * + * The key must be non-modified when pressed in order to be captured. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle the `KeyboardManager.preventDefault` boolean at run-time. + * + * If you need more specific control, you can create Key objects and set the flag on each of those instead. + * + * This array can be populated via the Game Config by setting the `input.keyboard.capture` array, or you + * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. + * + * @name Phaser.Input.Keyboard.KeyboardManager#captures + * @type {integer[]} + * @since 3.16.0 + */ + this.captures = []; + + /** + * A boolean that controls if the Keyboard Manager is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Keyboard.KeyboardManager#enabled + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.enabled = false; + + /** + * The Keyboard Event target, as defined in the Game Config. + * Typically the window in which the game is rendering, but can be any interactive DOM element. + * + * @name Phaser.Input.Keyboard.KeyboardManager#target + * @type {any} + * @since 3.16.0 + */ + this.target; + + /** + * The Key Down Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyDown + * @type {function} + * @since 3.16.00 + */ + this.onKeyDown = NOOP; + + /** + * The Key Up Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyUp + * @type {function} + * @since 3.16.00 + */ + this.onKeyUp = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); + }, + + /** + * The Keyboard Manager boot process. + * + * @method Phaser.Input.Keyboard.KeyboardManager#boot + * @private + * @since 3.16.0 + */ + boot: function () + { + var config = this.manager.config; + + this.enabled = config.inputKeyboard; + this.target = config.inputKeyboardEventTarget; + + this.addCapture(config.inputKeyboardCapture); + + if (!this.target && window) + { + this.target = window; + } + + if (this.enabled && this.target) + { + this.startListeners(); + } + + this.manager.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); + }, + + /** + * Starts the Keyboard Event listeners running. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Keyboard.KeyboardManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + + this.onKeyDown = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } + + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); + + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; + + this.onKeyUp = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } + + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); + + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; + + var target = this.target; + + if (target) + { + target.addEventListener('keydown', this.onKeyDown, false); + target.addEventListener('keyup', this.onKeyUp, false); + + this.enabled = true; + } + }, + + /** + * Stops the Key Event listeners. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Keyboard.KeyboardManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var target = this.target; + + target.removeEventListener('keydown', this.onKeyDown, false); + target.removeEventListener('keyup', this.onKeyUp, false); + + this.enabled = false; + }, + + /** + * Clears the event queue. + * Called automatically by the Input Manager. + * + * @method Phaser.Input.Keyboard.KeyboardManager#postUpdate + * @private + * @since 3.16.0 + */ + postUpdate: function () + { + this.queue = []; + }, + + /** + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. + * + * This `addCapture` method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browser + * and cause the default browser behavior. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass in a single key code value, or an array of key codes, or a string: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are active captures after calling this method, the `preventDefault` property is set to `true`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#addCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. + */ + addCapture: function (keycode) + { + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } + + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } + + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.trim().toUpperCase()]; + } + + if (captures.indexOf(code) === -1) + { + captures.push(code); + } + } + + this.preventDefault = captures.length > 0; + }, + + /** + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass in a single key code value, or an array of key codes, or a string: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are no captures left after calling this method, the `preventDefault` property is set to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. + */ + removeCapture: function (keycode) + { + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } + + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } + + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.toUpperCase()]; + } + + ArrayRemove(captures, code); + } + + this.preventDefault = captures.length > 0; + }, + + /** + * Removes all keyboard captures and sets the `preventDefault` property to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#clearCaptures + * @since 3.16.0 + */ + clearCaptures: function () + { + this.captures = []; + + this.preventDefault = false; + }, + + /** + * Destroys this Keyboard Manager instance. + * + * @method Phaser.Input.Keyboard.KeyboardManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.stopListeners(); + + this.clearCaptures(); + + this.queue = []; + + this.manager.game.events.off(GameEvents.POST_RENDER, this.postUpdate, this); + + this.target = null; + this.enabled = false; + this.manager = null; + } + +}); + +module.exports = KeyboardManager; + + +/***/ }), +/* 341 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -80913,24 +83313,26 @@ module.exports = INPUT_CONST; /***/ }), -/* 338 */ +/* 342 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(337); +var CONST = __webpack_require__(341); var EventEmitter = __webpack_require__(11); -var Mouse = __webpack_require__(336); -var Pointer = __webpack_require__(335); -var Rectangle = __webpack_require__(9); -var Touch = __webpack_require__(333); -var TransformMatrix = __webpack_require__(38); -var TransformXY = __webpack_require__(332); +var Events = __webpack_require__(52); +var GameEvents = __webpack_require__(26); +var Keyboard = __webpack_require__(340); +var Mouse = __webpack_require__(339); +var Pointer = __webpack_require__(338); +var Touch = __webpack_require__(337); +var TransformMatrix = __webpack_require__(41); +var TransformXY = __webpack_require__(371); /** * @classdesc @@ -80971,6 +83373,16 @@ var InputManager = new Class({ */ this.game = game; + /** + * A reference to the global Game Scale Manager. + * Used for all bounds checks and pointer scaling. + * + * @name Phaser.Input.InputManager#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scaleManager; + /** * The Canvas that is used for all DOM event input listeners. * @@ -80981,10 +83393,10 @@ var InputManager = new Class({ this.canvas; /** - * The Input Configuration object, as set in the Game Config. + * The Game Configuration object, as set during the game boot. * * @name Phaser.Input.InputManager#config - * @type {object} + * @type {Phaser.Core.Config} * @since 3.0.0 */ this.config = config; @@ -81014,6 +83426,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#queue * @type {array} * @default [] + * @deprecated * @since 3.0.0 */ this.queue = []; @@ -81024,16 +83437,29 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#domCallbacks * @private * @type {object} + * @deprecated * @since 3.10.0 */ this.domCallbacks = { up: [], down: [], move: [], upOnce: [], downOnce: [], moveOnce: [] }; + /** + * Are any mouse or touch pointers currently over the game canvas? + * This is updated automatically by the canvas over and out handlers. + * + * @name Phaser.Input.InputManager#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + this.isOver = true; + /** * Are there any up callbacks defined? * * @name Phaser.Input.InputManager#_hasUpCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasUpCallback = false; @@ -81044,6 +83470,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasDownCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasDownCallback = false; @@ -81054,6 +83481,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasMoveCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasMoveCallback = false; @@ -81093,6 +83521,15 @@ var InputManager = new Class({ */ this.defaultCursor = ''; + /** + * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property. + * + * @name Phaser.Input.InputManager#keyboard + * @type {?Phaser.Input.Keyboard.KeyboardManager} + * @since 3.16.0 + */ + this.keyboard = (config.inputKeyboard) ? new Keyboard(this) : null; + /** * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property. * @@ -81144,7 +83581,11 @@ var InputManager = new Class({ for (var i = 0; i <= this.pointersTotal; i++) { - this.pointers.push(new Pointer(this, i)); + var pointer = new Pointer(this, i); + + pointer.smoothFactor = config.inputSmoothFactor; + + this.pointers.push(pointer); } /** @@ -81181,15 +83622,6 @@ var InputManager = new Class({ */ this.dirty = false; - /** - * The Scale factor being applied to input coordinates. - * - * @name Phaser.Input.InputManager#scale - * @type { { x:number, y:number } } - * @since 3.0.0 - */ - this.scale = { x: 1, y: 1 }; - /** * If the top-most Scene in the Scene List receives an input it will stop input from * propagating any lower down the scene list, i.e. if you have a UI Scene at the top @@ -81215,19 +83647,49 @@ var InputManager = new Class({ this.ignoreEvents = false; /** - * The bounds of the Input Manager, used for pointer hit test calculations. + * Use the internal event queue or not? + * + * Set this via the Game Config with the `inputQueue` property. + * + * Phaser 3.15.1 and earlier used a event queue by default. + * + * This was changed in version 3.16 to use an immediate-mode system. + * The previous queue based version remains and is left under this flag for backwards + * compatibility. This flag, along with the legacy system, will be removed in a future version. * - * @name Phaser.Input.InputManager#bounds - * @type {Phaser.Geom.Rectangle} - * @since 3.0.0 + * @name Phaser.Input.InputManager#useQueue + * @type {boolean} + * @default false + * @since 3.16.0 */ - this.bounds = new Rectangle(); + this.useQueue = config.inputQueue; + + /** + * The time this Input Manager was last updated. + * This value is populated by the Game Step each frame. + * + * @name Phaser.Input.InputManager#time + * @type {number} + * @readonly + * @since 3.16.2 + */ + this.time = 0; + + /** + * Internal property that tracks frame event state. + * + * @name Phaser.Input.InputManager#_updatedThisFrame + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._updatedThisFrame = false; /** * A re-cycled point-like object to store hit test values in. * * @name Phaser.Input.InputManager#_tempPoint - * @type {{x:number,y:number}} + * @type {{x:number, y:number}} * @private * @since 3.0.0 */ @@ -81264,7 +83726,7 @@ var InputManager = new Class({ */ this._tempMatrix2 = new TransformMatrix(); - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -81273,79 +83735,131 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#boot * @protected + * @fires Phaser.Input.Events#MANAGER_BOOT * @since 3.0.0 */ boot: function () { this.canvas = this.game.canvas; - this.updateBounds(); + this.scaleManager = this.game.scale; - this.events.emit('boot'); + this.events.emit(Events.MANAGER_BOOT); - this.game.events.on('prestep', this.update, this); - this.game.events.on('poststep', this.postUpdate, this); - this.game.events.once('destroy', this.destroy, this); + if (this.useQueue) + { + this.game.events.on(GameEvents.PRE_STEP, this.legacyUpdate, this); + } + else + { + this.game.events.on(GameEvents.PRE_STEP, this.preStep, this); + } + + this.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); + + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * Updates the Input Manager bounds rectangle to match the bounding client rectangle of the - * canvas element being used to track input events. + * Internal canvas state change, called automatically by the Mouse Manager. * - * @method Phaser.Input.InputManager#updateBounds - * @since 3.0.0 - */ - updateBounds: function () - { - var bounds = this.bounds; - - 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; - }, - - /** - * Resizes the Input Manager internal values, including the bounds and scale factor. + * @method Phaser.Input.InputManager#setCanvasOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.0 * - * @method Phaser.Input.InputManager#resize - * @since 3.2.0 + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ - resize: function () + setCanvasOver: function (event) { - this.updateBounds(); + this.isOver = true; - // 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; + this.events.emit(Events.GAME_OVER, event); }, /** - * Internal update loop, called automatically by the Game Step. + * Internal canvas state change, called automatically by the Mouse Manager. + * + * @method Phaser.Input.InputManager#setCanvasOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.0 + * + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. + */ + setCanvasOut: function (event) + { + this.isOver = false; + + this.events.emit(Events.GAME_OUT, event); + }, + + /** + * Internal update method, called automatically when a DOM input event is received. * * @method Phaser.Input.InputManager#update * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE * @since 3.0.0 * * @param {number} time - The time stamp value of this game step. */ update: function (time) { + if (!this._updatedThisFrame) + { + this._setCursor = 0; + + this._updatedThisFrame = true; + } + + this.events.emit(Events.MANAGER_UPDATE); + + this.ignoreEvents = false; + + this.dirty = true; + + var pointers = this.pointers; + + for (var i = 0; i < this.pointersTotal; i++) + { + pointers[i].reset(time); + } + }, + + /** + * Internal update, called automatically by the Game Step. + * + * @method Phaser.Input.InputManager#preStep + * @private + * @since 3.16.2 + * + * @param {number} time - The time stamp value of this game step. + */ + preStep: function (time) + { + this.time = time; + }, + + /** + * Internal update loop, called automatically by the Game Step when using the legacy event queue. + * + * @method Phaser.Input.InputManager#legacyUpdate + * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE + * @since 3.16.0 + * + * @param {number} time - The time stamp value of this game step. + */ + legacyUpdate: function (time) + { + this.time = time; + var i; this._setCursor = 0; - this.events.emit('update'); + this.events.emit(Events.MANAGER_UPDATE); this.ignoreEvents = false; @@ -81357,21 +83871,21 @@ var InputManager = new Class({ for (i = 0; i < this.pointersTotal; i++) { - pointers[i].reset(); + pointers[i].reset(time); } if (!this.enabled || len === 0) { + for (i = 0; i < this.pointersTotal; i++) + { + pointers[i].updateMotion(); + } + return; } this.dirty = true; - this.updateBounds(); - - this.scale.x = this.game.config.width / this.bounds.width; - this.scale.y = this.game.config.height / this.bounds.height; - // Clears the queue array, and also means we don't work on array data that could potentially // be modified during the processing phase var queue = this.queue.splice(0, len); @@ -81414,10 +83928,15 @@ var InputManager = new Class({ break; case CONST.POINTER_LOCK_CHANGE: - this.events.emit('pointerlockchange', event, this.mouse.locked); + this.events.emit(Events.POINTERLOCK_CHANGE, event, this.mouse.locked); break; } } + + for (i = 0; i < this.pointersTotal; i++) + { + pointers[i].updateMotion(); + } }, /** @@ -81437,6 +83956,10 @@ var InputManager = new Class({ { this.canvas.style.cursor = this.defaultCursor; } + + this.dirty = false; + + this._updatedThisFrame = false; }, /** @@ -81528,10 +84051,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ startPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -81544,11 +84070,17 @@ var InputManager = new Class({ if (!pointer.active) { pointer.touchstart(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -81560,10 +84092,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ updatePointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -81576,11 +84111,17 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchmove(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, // For touch end its a list of the touch points that have been removed from the surface @@ -81596,10 +84137,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ stopPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -81612,10 +84156,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -81627,10 +84176,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ cancelPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -81643,10 +84195,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -81684,6 +84241,8 @@ var InputManager = new Class({ var pointer = new Pointer(this, id); + pointer.smoothFactor = this.config.inputSmoothFactor; + this.pointers.push(pointer); this.pointersTotal++; @@ -81699,6 +84258,7 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#processDomCallbacks * @private + * @deprecated * @since 3.10.0 * * @param {array} once - The isOnce callbacks to invoke. @@ -81721,11 +84281,35 @@ var InputManager = new Class({ every[i](event); } - once = []; - return (every.length > 0); }, + /** + * Internal method that gets a list of all the active Input Plugins in the game + * and updates each of them in turn, in reverse order (top to bottom), to allow + * for DOM top-level event handling simulation. + * + * @method Phaser.Input.InputManager#updateInputPlugins + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + updateInputPlugins: function (time, delta) + { + var scenes = this.game.scene.getScenes(true, true); + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene.sys.input) + { + scene.sys.input.update(time, delta); + } + } + }, + /** * Queues a touch start event, as passed in by the TouchManager. * Also dispatches any DOM callbacks for this event. @@ -81738,13 +84322,31 @@ var InputManager = new Class({ */ queueTouchStart: function (event) { - this.queue.push(CONST.TOUCH_START, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_START, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.startPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -81760,13 +84362,31 @@ var InputManager = new Class({ */ queueTouchMove: function (event) { - this.queue.push(CONST.TOUCH_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.updatePointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -81782,13 +84402,31 @@ var InputManager = new Class({ */ queueTouchEnd: function (event) { - this.queue.push(CONST.TOUCH_END, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_END, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.stopPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -81804,7 +84442,23 @@ var InputManager = new Class({ */ queueTouchCancel: function (event) { - this.queue.push(CONST.TOUCH_CANCEL, event); + if (this.useQueue) + { + this.queue.push(CONST.TOUCH_CANCEL, event); + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.cancelPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); + } }, /** @@ -81819,13 +84473,28 @@ var InputManager = new Class({ */ queueMouseDown: function (event) { - this.queue.push(CONST.MOUSE_DOWN, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_DOWN, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.down(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -81841,13 +84510,28 @@ var InputManager = new Class({ */ queueMouseMove: function (event) { - this.queue.push(CONST.MOUSE_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.move(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -81863,17 +84547,36 @@ var InputManager = new Class({ */ queueMouseUp: function (event) { - this.queue.push(CONST.MOUSE_UP, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_UP, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.up(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -81896,6 +84599,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -81922,6 +84626,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -81944,6 +84652,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -81970,6 +84679,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -81992,6 +84705,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -82226,97 +84940,35 @@ var InputManager = new Class({ * @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for. * @param {number} pageX - The Page X value. * @param {number} pageY - The Page Y value. + * @param {boolean} wasMove - Are we transforming the Pointer from a move event, or an up / down event? */ - transformPointer: function (pointer, pageX, pageY) + transformPointer: function (pointer, pageX, pageY, wasMove) { - // Store the previous position - pointer.prevPosition.x = pointer.x; - pointer.prevPosition.y = pointer.y; + var p0 = pointer.position; + var p1 = pointer.prevPosition; - pointer.x = (pageX - this.bounds.left) * this.scale.x; - pointer.y = (pageY - this.bounds.top) * this.scale.y; - }, + // Store previous position + p1.x = p0.x; + p1.y = p0.y; - /** - * Transforms the pageX value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformX - * @since 3.0.0 - * - * @param {number} pageX - The DOM pageX value. - * - * @return {number} The translated value. - */ - transformX: function (pageX) - { - return (pageX - this.bounds.left) * this.scale.x; - }, + // Translate coordinates + var x = this.scaleManager.transformX(pageX); + var y = this.scaleManager.transformY(pageY); - /** - * Transforms the pageY value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformY - * @since 3.0.0 - * - * @param {number} pageY - The DOM pageY value. - * - * @return {number} The translated value. - */ - transformY: function (pageY) - { - return (pageY - this.bounds.top) * this.scale.y; - }, + var a = pointer.smoothFactor; - /** - * Returns the left offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetX - * @since 3.0.0 - * - * @return {number} The left bounds value. - */ - getOffsetX: function () - { - return this.bounds.left; - }, - - /** - * Returns the top offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetY - * @since 3.0.0 - * - * @return {number} The top bounds value. - */ - getOffsetY: function () - { - return this.bounds.top; - }, - - /** - * Returns the horizontal Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleX - * @since 3.0.0 - * - * @return {number} The horizontal scale factor of the input. - */ - getScaleX: function () - { - return this.game.config.width / this.bounds.width; - }, - - /** - * Returns the vertical Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleY - * @since 3.0.0 - * - * @return {number} The vertical scale factor of the input. - */ - getScaleY: function () - { - return this.game.config.height / this.bounds.height; + if (!wasMove || a === 0) + { + // Set immediately + p0.x = x; + p0.y = y; + } + else + { + // Apply smoothing + p0.x = x * a + p1.x * (1 - a); + p0.y = y * a + p1.y * (1 - a); + } }, /** @@ -82331,6 +84983,11 @@ var InputManager = new Class({ { this.events.removeAllListeners(); + if (this.keyboard) + { + this.keyboard.destroy(); + } + if (this.mouse) { this.mouse.destroy(); @@ -82361,370 +85018,12 @@ module.exports = InputManager; /***/ }), -/* 339 */ -/***/ (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__(24); - -/** - * 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. - * - * @typedef {object} Phaser.Device.CanvasFeatures - * @since 3.0.0 - * - * @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 = { - - supportInverseAlpha: false, - supportNewBlendModes: false - -}; - -function checkBlendMode () -{ - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - - var magenta = new Image(); - - magenta.onload = function () - { - var yellow = new Image(); - - yellow.onload = function () - { - var canvas = CanvasPool.create(yellow, 6, 1); - var context = canvas.getContext('2d'); - - context.globalCompositeOperation = 'multiply'; - - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); - - if (!context.getImageData(2, 0, 1, 1)) - { - return false; - } - - var data = context.getImageData(2, 0, 1, 1).data; - - CanvasPool.remove(yellow); - - CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); - }; - - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - }; - - magenta.src = pngHead + 'AP804Oa6' + pngEnd; - - return false; -} - -function checkInverseAlpha () -{ - var canvas = CanvasPool.create(this, 2, 1); - var context = canvas.getContext('2d'); - - context.fillStyle = 'rgba(10, 20, 30, 0.5)'; - - // Draw a single pixel - context.fillRect(0, 0, 1, 1); - - // Get the color values - var s1 = context.getImageData(0, 0, 1, 1); - - if (s1 === null) - { - return false; - } - - // Plot them to x2 - context.putImageData(s1, 1, 0); - - // 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) - { - CanvasFeatures.supportNewBlendModes = checkBlendMode(); - CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); - } - - return CanvasFeatures; -} - -module.exports = init(); - - -/***/ }), -/* 340 */ -/***/ (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 singleton is instantiated as soon as Phaser loads, -// before a Phaser.Game instance has even been created. -// Which means all instances of Phaser Games can share it, -// without having to re-poll the device all over again - -/** - * @namespace Phaser.Device - * @since 3.0.0 - */ - -/** - * @typedef {object} Phaser.DeviceConf - * - * @property {Phaser.Device.OS} os - The OS Device functions. - * @property {Phaser.Device.Browser} browser - The Browser Device functions. - * @property {Phaser.Device.Features} features - The Features Device functions. - * @property {Phaser.Device.Input} input - The Input Device functions. - * @property {Phaser.Device.Audio} audio - The Audio Device functions. - * @property {Phaser.Device.Video} video - The Video Device functions. - * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. - * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. - */ - -module.exports = { - - os: __webpack_require__(92), - browser: __webpack_require__(118), - features: __webpack_require__(168), - input: __webpack_require__(902), - audio: __webpack_require__(901), - video: __webpack_require__(900), - fullscreen: __webpack_require__(899), - canvasFeatures: __webpack_require__(339) - -}; - - -/***/ }), -/* 341 */ -/***/ (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__(1); - -/** - * @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. - * - * @name Phaser.DOM.RequestAnimationFrame#isRunning - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isRunning = false; - - /** - * The callback to be invoked each step. - * - * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {FrameRequestCallback} - * @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 {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 {FrameRequestCallback} - * @since 3.0.0 - */ - this.step = function step (timestamp) - { - // DOMHighResTimeStamp - _this.lastTime = _this.tick; - - _this.tick = timestamp; - - _this.timeOutID = window.requestAnimationFrame(step); - - _this.callback(timestamp); - }; - - /** - * 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.timeOutID = window.setTimeout(stepTimeout, delay); - - _this.callback(d); - }; - }, - - /** - * Starts the requestAnimationFrame or setTimeout process running. - * - * @method Phaser.DOM.RequestAnimationFrame#start - * @since 3.0.0 - * - * @param {FrameRequestCallback} callback - The callback to invoke each step. - * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? - */ - start: function (callback, forceSetTimeOut) - { - if (this.isRunning) - { - return; - } - - this.callback = callback; - - this.isSetTimeOut = forceSetTimeOut; - - this.isRunning = true; - - this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); - }, - - /** - * 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 - { - window.cancelAnimationFrame(this.timeOutID); - } - }, - - /** - * Stops the step from running and clears the callback reference. - * - * @method Phaser.DOM.RequestAnimationFrame#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); - - this.callback = NOOP; - } - -}); - -module.exports = RequestAnimationFrame; - - -/***/ }), -/* 342 */ +/* 343 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -82748,12 +85047,12 @@ module.exports = RemoveFromDOM; /***/ }), -/* 343 */ +/* 344 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -82805,16 +85104,401 @@ module.exports = ParseXML; /***/ }), -/* 344 */ +/* 345 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Attempts to get the target DOM element based on the given value, which can be either + * a string, in which case it will be looked-up by ID, or an element node. If nothing + * can be found it will return a reference to the document.body. + * + * @function Phaser.DOM.GetTarget + * @since 3.16.0 + * + * @param {HTMLElement} element - The DOM element to look-up. + */ +var GetTarget = function (element) +{ + var target; + + if (element !== '') + { + if (typeof element === 'string') + { + // Hopefully an element ID + target = document.getElementById(element); + } + else if (element && element.nodeType === 1) + { + // Quick test for a HTMLElement + target = element; + } + } + + // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. + if (!target) + { + // Use the full window + target = document.body; + } + + return target; +}; + +module.exports = GetTarget; + + +/***/ }), +/* 346 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * @namespace Phaser.Scale.Zoom + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}. + * + * @typedef {(Phaser.Scale.Zoom.NO_ZOOM|Phaser.Scale.Zoom.ZOOM_2X|Phaser.Scale.Zoom.ZOOM_4X|Phaser.Scale.Zoom.MAX_ZOOM)} Phaser.Scale.ZoomType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas will not be zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.NO_ZOOM + * @since 3.16.0 + */ + NO_ZOOM: 1, + + /** + * The game canvas will be 2x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_2X + * @since 3.16.0 + */ + ZOOM_2X: 2, + + /** + * The game canvas will be 4x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_4X + * @since 3.16.0 + */ + ZOOM_4X: 4, + + /** + * Calculate the zoom value based on the maximum multiplied game size that will + * fit into the parent, or browser window if no parent is set. + * + * @name Phaser.Scale.Zoom.MAX_ZOOM + * @since 3.16.0 + */ + MAX_ZOOM: -1 + +}; + + +/***/ }), +/* 347 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * @namespace Phaser.Scale.ScaleModes + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}. + * + * @typedef {(Phaser.Scale.ScaleModes.NONE|Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT|Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH|Phaser.Scale.ScaleModes.FIT|Phaser.Scale.ScaleModes.ENVELOP|Phaser.Scale.ScaleModes.RESIZE)} Phaser.Scale.ScaleModeType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it + * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need + * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. + * + * @name Phaser.Scale.ScaleModes.NONE + * @since 3.16.0 + */ + NONE: 0, + + /** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT + * @since 3.16.0 + */ + WIDTH_CONTROLS_HEIGHT: 1, + + /** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH + * @since 3.16.0 + */ + HEIGHT_CONTROLS_WIDTH: 2, + + /** + * The width and height are automatically adjusted to fit inside the given target area, + * while keeping the aspect ratio. Depending on the aspect ratio there may be some space + * inside the area which is not covered. + * + * @name Phaser.Scale.ScaleModes.FIT + * @since 3.16.0 + */ + FIT: 3, + + /** + * The width and height are automatically adjusted to make the size cover the entire target + * area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Scale.ScaleModes.ENVELOP + * @since 3.16.0 + */ + ENVELOP: 4, + + /** + * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. + * + * @name Phaser.Scale.ScaleModes.RESIZE + * @since 3.16.0 + */ + RESIZE: 5 + +}; + + +/***/ }), +/* 348 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * @namespace Phaser.Scale.Orientation + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}. + * + * @typedef {(Phaser.Scale.Orientation.LANDSCAPE|Phaser.Scale.Orientation.PORTRAIT)} Phaser.Scale.OrientationType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * A landscape orientation. + * + * @name Phaser.Scale.Orientation.LANDSCAPE + * @since 3.16.0 + */ + LANDSCAPE: 'landscape-primary', + + /** + * A portrait orientation. + * + * @name Phaser.Scale.Orientation.PORTRAIT + * @since 3.16.0 + */ + PORTRAIT: 'portrait-primary' + +}; + + +/***/ }), +/* 349 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * @namespace Phaser.Scale.Center + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}. + * + * @typedef {(Phaser.Scale.Center.NO_CENTER|Phaser.Scale.Center.CENTER_BOTH|Phaser.Scale.Center.CENTER_HORIZONTALLY|Phaser.Scale.Center.CENTER_VERTICALLY)} Phaser.Scale.CenterType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas is not centered within the parent by Phaser. + * You can still center it yourself via CSS. + * + * @name Phaser.Scale.Center.NO_CENTER + * @since 3.16.0 + */ + NO_CENTER: 0, + + /** + * The game canvas is centered both horizontally and vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_BOTH + * @since 3.16.0 + */ + CENTER_BOTH: 1, + + /** + * The game canvas is centered horizontally within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_HORIZONTALLY + * @since 3.16.0 + */ + CENTER_HORIZONTALLY: 2, + + /** + * The game canvas is centered both vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_VERTICALLY + * @since 3.16.0 + */ + CENTER_VERTICALLY: 3 + +}; + + +/***/ }), +/* 350 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); +var CONST = __webpack_require__(178); + +var GetScreenOrientation = function (width, height) +{ + var screen = window.screen; + var orientation = (screen) ? screen.orientation || screen.mozOrientation || screen.msOrientation : false; + + if (orientation && typeof orientation.type === 'string') + { + // Screen Orientation API specification + return orientation.type; + } + else if (typeof orientation === 'string') + { + // moz / ms-orientation are strings + return orientation; + } + + if (screen) + { + return (screen.height > screen.width) ? CONST.PORTRAIT : CONST.LANDSCAPE; + } + else if (typeof window.orientation === 'number') + { + // This may change by device based on "natural" orientation. + return (window.orientation === 0 || window.orientation === 180) ? CONST.PORTRAIT : CONST.LANDSCAPE; + } + else if (window.matchMedia) + { + if (window.matchMedia('(orientation: portrait)').matches) + { + return CONST.PORTRAIT; + } + else if (window.matchMedia('(orientation: landscape)').matches) + { + return CONST.LANDSCAPE; + } + } + + return (height > width) ? CONST.PORTRAIT : CONST.LANDSCAPE; +}; + +module.exports = GetScreenOrientation; + + +/***/ }), +/* 351 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(99); /** * @callback ContentLoadedCallback @@ -82868,12 +85552,12 @@ module.exports = DOMContentLoaded; /***/ }), -/* 345 */ +/* 352 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -82924,12 +85608,12 @@ module.exports = HueToComponent; /***/ }), -/* 346 */ +/* 353 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -82954,12 +85638,12 @@ module.exports = ComponentToHex; /***/ }), -/* 347 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -82973,115 +85657,53 @@ module.exports = ComponentToHex; */ /** - * @typedef {Object} ColorObject + * @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. */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); -Color.ColorToRGBA = __webpack_require__(915); -Color.ComponentToHex = __webpack_require__(346); -Color.GetColor = __webpack_require__(177); -Color.GetColor32 = __webpack_require__(376); -Color.HexStringToColor = __webpack_require__(377); -Color.HSLToColor = __webpack_require__(914); -Color.HSVColorWheel = __webpack_require__(913); -Color.HSVToRGB = __webpack_require__(176); -Color.HueToComponent = __webpack_require__(345); -Color.IntegerToColor = __webpack_require__(374); -Color.IntegerToRGB = __webpack_require__(373); -Color.Interpolate = __webpack_require__(912); -Color.ObjectToColor = __webpack_require__(372); -Color.RandomRGB = __webpack_require__(911); -Color.RGBStringToColor = __webpack_require__(371); -Color.RGBToHSV = __webpack_require__(375); -Color.RGBToString = __webpack_require__(910); -Color.ValueToColor = __webpack_require__(178); +Color.ColorToRGBA = __webpack_require__(1005); +Color.ComponentToHex = __webpack_require__(353); +Color.GetColor = __webpack_require__(191); +Color.GetColor32 = __webpack_require__(409); +Color.HexStringToColor = __webpack_require__(410); +Color.HSLToColor = __webpack_require__(1004); +Color.HSVColorWheel = __webpack_require__(1003); +Color.HSVToRGB = __webpack_require__(190); +Color.HueToComponent = __webpack_require__(352); +Color.IntegerToColor = __webpack_require__(407); +Color.IntegerToRGB = __webpack_require__(406); +Color.Interpolate = __webpack_require__(1002); +Color.ObjectToColor = __webpack_require__(405); +Color.RandomRGB = __webpack_require__(1001); +Color.RGBStringToColor = __webpack_require__(404); +Color.RGBToHSV = __webpack_require__(408); +Color.RGBToString = __webpack_require__(1000); +Color.ValueToColor = __webpack_require__(192); module.exports = Color; /***/ }), -/* 348 */ -/***/ (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.Display.Canvas.CanvasInterpolation - * @since 3.0.0 - */ -var CanvasInterpolation = { - - /** - * 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' ]; - - types.forEach(function (type) - { - canvas.style['image-rendering'] = type; - }); - - canvas.style.msInterpolationMode = 'nearest-neighbor'; - - return canvas; - }, - - /** - * 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'; - - return canvas; - } - -}; - -module.exports = CanvasInterpolation; - - -/***/ }), -/* 349 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 CatmullRom = __webpack_require__(171); +var CatmullRom = __webpack_require__(185); var Class = __webpack_require__(0); -var Curve = __webpack_require__(70); +var Curve = __webpack_require__(76); var Vector2 = __webpack_require__(3); /** @@ -83293,72 +85915,18 @@ module.exports = SplineCurve; /***/ }), -/* 350 */ -/***/ (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 * p; -} - -function P1 (t, p) -{ - return 2 * (1 - t) * t * p; -} - -function P2 (t, p) -{ - return t * t * p; -} - -// p0 = start point -// p1 = control point 1 -// p2 = end point - -// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js - -/** - * A quadratic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.QuadraticBezier - * @since 3.2.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The control point. - * @param {number} p2 - The end point. - * - * @return {number} The interpolated value. - */ -var QuadraticBezierInterpolation = function (t, p0, p1, p2) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2); -}; - -module.exports = QuadraticBezierInterpolation; - - -/***/ }), -/* 351 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Curve = __webpack_require__(70); -var QuadraticBezierInterpolation = __webpack_require__(350); +var Curve = __webpack_require__(76); +var QuadraticBezierInterpolation = __webpack_require__(378); var Vector2 = __webpack_require__(3); /** @@ -83561,28 +86129,28 @@ module.exports = QuadraticBezier; /***/ }), -/* 352 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(70); -var FromPoints = __webpack_require__(173); -var Rectangle = __webpack_require__(9); +var Curve = __webpack_require__(76); +var FromPoints = __webpack_require__(180); +var Rectangle = __webpack_require__(10); var Vector2 = __webpack_require__(3); var tmpVec2 = new Vector2(); /** * @classdesc - * [description] + * A LineCurve is a "curve" comprising exactly two points (a line segment). * * @class Line * @extends Phaser.Curves.Curve @@ -83590,8 +86158,8 @@ var tmpVec2 = new Vector2(); * @constructor * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|number[])} p0 - [description] - * @param {Phaser.Math.Vector2} [p1] - [description] + * @param {(Phaser.Math.Vector2|number[])} p0 - The first endpoint. + * @param {Phaser.Math.Vector2} [p1] - The second endpoint. */ var LineCurve = new Class({ @@ -83611,7 +86179,7 @@ var LineCurve = new Class({ } /** - * [description] + * The first endpoint. * * @name Phaser.Curves.Line#p0 * @type {Phaser.Math.Vector2} @@ -83620,7 +86188,7 @@ var LineCurve = new Class({ this.p0 = p0; /** - * [description] + * The second endpoint. * * @name Phaser.Curves.Line#p1 * @type {Phaser.Math.Vector2} @@ -83668,14 +86236,14 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets the resolution of the line. * * @method Phaser.Curves.Line#getResolution * @since 3.0.0 * - * @param {number} [divisions=1] - [description] + * @param {number} [divisions=1] - The number of divisions to consider. * - * @return {number} [description] + * @return {number} The resolution. Equal to the number of divisions. */ getResolution: function (divisions) { @@ -83714,7 +86282,7 @@ var LineCurve = new Class({ // Line curve is linear, so we can overwrite default getPointAt /** - * [description] + * Gets a point at a given position on the line. * * @method Phaser.Curves.Line#getPointAt * @since 3.0.0 @@ -83732,14 +86300,14 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets the slope of the line as a unit vector. * * @method Phaser.Curves.Line#getTangent * @since 3.0.0 * * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} The tangent vector. */ getTangent: function () { @@ -83774,7 +86342,7 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets a JSON representation of the line. * * @method Phaser.Curves.Line#toJSON * @since 3.0.0 @@ -83795,14 +86363,14 @@ var LineCurve = new Class({ }); /** - * [description] + * Configures this line from a JSON representation. * * @function Phaser.Curves.Line.fromJSON * @since 3.0.0 * * @param {JSONCurve} data - The JSON object containing this curve data. * - * @return {Phaser.Curves.Line} [description] + * @return {Phaser.Curves.Line} A new LineCurve object. */ LineCurve.fromJSON = function (data) { @@ -83818,22 +86386,22 @@ module.exports = LineCurve; /***/ }), -/* 353 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(70); -var DegToRad = __webpack_require__(31); +var Curve = __webpack_require__(76); +var DegToRad = __webpack_require__(34); var GetValue = __webpack_require__(4); -var RadToDeg = __webpack_require__(172); +var RadToDeg = __webpack_require__(183); var Vector2 = __webpack_require__(3); /** @@ -84469,83 +87037,20 @@ module.exports = EllipseCurve; /***/ }), -/* 354 */ -/***/ (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 - -/** - * A cubic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.CubicBezier - * @since 3.0.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The first control point. - * @param {number} p2 - The second control point. - * @param {number} p3 - The end point. - * - * @return {number} The interpolated value. - */ -var CubicBezierInterpolation = function (t, p0, p1, p2, p3) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); -}; - -module.exports = CubicBezierInterpolation; - - -/***/ }), -/* 355 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(354); -var Curve = __webpack_require__(70); +var CubicBezier = __webpack_require__(379); +var Curve = __webpack_require__(76); var Vector2 = __webpack_require__(3); /** @@ -84759,12 +87264,12 @@ module.exports = CubicBezierCurve; /***/ }), -/* 356 */ +/* 360 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84797,16 +87302,16 @@ module.exports = { /***/ }), -/* 357 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arne16 = __webpack_require__(356); +var Arne16 = __webpack_require__(360); var CanvasPool = __webpack_require__(24); var GetValue = __webpack_require__(4); @@ -84912,12 +87417,5762 @@ module.exports = GenerateTexture; /***/ }), -/* 358 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Events = __webpack_require__(26); + +/** + * The Visibility Handler is responsible for listening out for document level visibility change events. + * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses + * the provided Event Emitter and fires the related events. + * + * @function Phaser.Core.VisibilityHandler + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. + */ +var VisibilityHandler = function (game) +{ + var hiddenVar; + var eventEmitter = game.events; + + if (document.hidden !== undefined) + { + hiddenVar = 'visibilitychange'; + } + else + { + var vendors = [ 'webkit', 'moz', 'ms' ]; + + vendors.forEach(function (prefix) + { + if (document[prefix + 'Hidden'] !== undefined) + { + document.hidden = function () + { + return document[prefix + 'Hidden']; + }; + + hiddenVar = prefix + 'visibilitychange'; + } + + }); + } + + var onChange = function (event) + { + if (document.hidden || event.type === 'pause') + { + eventEmitter.emit(Events.HIDDEN); + } + else + { + eventEmitter.emit(Events.VISIBLE); + } + }; + + if (hiddenVar) + { + document.addEventListener(hiddenVar, onChange, false); + } + + window.onblur = function () + { + eventEmitter.emit(Events.BLUR); + }; + + window.onfocus = function () + { + eventEmitter.emit(Events.FOCUS); + }; + + // Automatically give the window focus unless config says otherwise + if (window.focus && game.config.autoFocus) + { + window.focus(); + } +}; + +module.exports = VisibilityHandler; + + +/***/ }), +/* 363 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(1); + +/** + * @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. + * + * @name Phaser.DOM.RequestAnimationFrame#isRunning + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isRunning = false; + + /** + * The callback to be invoked each step. + * + * @name Phaser.DOM.RequestAnimationFrame#callback + * @type {FrameRequestCallback} + * @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 {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 {FrameRequestCallback} + * @since 3.0.0 + */ + this.step = function step () + { + // Because we cannot trust the time passed to this callback from the browser and need it kept in sync with event times + var timestamp = window.performance.now(); + + // 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); + }; + }, + + /** + * Starts the requestAnimationFrame or setTimeout process running. + * + * @method Phaser.DOM.RequestAnimationFrame#start + * @since 3.0.0 + * + * @param {FrameRequestCallback} callback - The callback to invoke each step. + * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? + */ + start: function (callback, forceSetTimeOut) + { + if (this.isRunning) + { + return; + } + + this.callback = callback; + + this.isSetTimeOut = forceSetTimeOut; + + this.isRunning = true; + + this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + }, + + /** + * 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 + { + window.cancelAnimationFrame(this.timeOutID); + } + }, + + /** + * Stops the step from running and clears the callback reference. + * + * @method Phaser.DOM.RequestAnimationFrame#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.stop(); + + this.callback = NOOP; + } + +}); + +module.exports = RequestAnimationFrame; + + +/***/ }), +/* 364 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 NOOP = __webpack_require__(1); +var RequestAnimationFrame = __webpack_require__(363); + +// Frame Rate config +// fps: { +// min: 10, +// target: 60, +// forceSetTimeOut: false, +// deltaHistory: 10, +// panicMax: 120 +// } + +// http://www.testufo.com/#test=animation-time-graph + +/** + * @callback TimeStepCallback + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} average - The Delta Average. + * @param {number} interpolation - Interpolation - how far between what is expected and where we are? + */ + +/** + * @classdesc + * [description] + * + * @class TimeStep + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. + * @param {FPSConfig} config + */ +var TimeStep = new Class({ + + initialize: + + function TimeStep (game, config) + { + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Core.TimeStep#game + * @type {Phaser.Game} + * @readonly + * @since 3.0.0 + */ + this.game = game; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#raf + * @type {Phaser.DOM.RequestAnimationFrame} + * @readonly + * @since 3.0.0 + */ + this.raf = new RequestAnimationFrame(); + + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * + * @name Phaser.Core.TimeStep#started + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.started = false; + + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * The difference between this value and `started` is that `running` is toggled when + * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if + * the TimeStep is actually stopped, not just paused. + * + * @name Phaser.Core.TimeStep#running + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.running = false; + + /** + * The minimum fps rate you want the Time Step to run at. + * + * @name Phaser.Core.TimeStep#minFps + * @type {integer} + * @default 5 + * @since 3.0.0 + */ + this.minFps = GetValue(config, 'min', 5); + + /** + * The target fps rate for the Time Step to run at. + * + * Setting this value will not actually change the speed at which the browser runs, that is beyond + * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step + * is spiraling out of control. + * + * @name Phaser.Core.TimeStep#targetFps + * @type {integer} + * @default 60 + * @since 3.0.0 + */ + this.targetFps = GetValue(config, 'target', 60); + + /** + * The minFps value in ms. + * Defaults to 200ms between frames (i.e. super slow!) + * + * @name Phaser.Core.TimeStep#_min + * @type {number} + * @private + * @since 3.0.0 + */ + this._min = 1000 / this.minFps; + + /** + * The targetFps value in ms. + * Defaults to 16.66ms between frames (i.e. normal) + * + * @name Phaser.Core.TimeStep#_target + * @type {number} + * @private + * @since 3.0.0 + */ + this._target = 1000 / this.targetFps; + + /** + * An exponential moving average of the frames per second. + * + * @name Phaser.Core.TimeStep#actualFps + * @type {integer} + * @readonly + * @default 60 + * @since 3.0.0 + */ + this.actualFps = this.targetFps; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#nextFpsUpdate + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.nextFpsUpdate = 0; + + /** + * The number of frames processed this second. + * + * @name Phaser.Core.TimeStep#framesThisSecond + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.framesThisSecond = 0; + + /** + * A callback to be invoked each time the Time Step steps. + * + * @name Phaser.Core.TimeStep#callback + * @type {TimeStepCallback} + * @default NOOP + * @since 3.0.0 + */ + this.callback = NOOP; + + /** + * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting + * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. + * + * @name Phaser.Core.TimeStep#forceSetTimeOut + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); + + /** + * [description] + * + * @name Phaser.Core.TimeStep#time + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.time = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#startTime + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.startTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#lastTime + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.lastTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#frame + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.frame = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#inFocus + * @type {boolean} + * @readonly + * @default true + * @since 3.0.0 + */ + this.inFocus = true; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#_pauseTime + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._pauseTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#_coolDown + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._coolDown = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#delta + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.delta = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaIndex + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.deltaIndex = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaHistory + * @type {integer[]} + * @since 3.0.0 + */ + this.deltaHistory = []; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaSmoothingMax + * @type {integer} + * @default 10 + * @since 3.0.0 + */ + this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); + + /** + * [description] + * + * @name Phaser.Core.TimeStep#panicMax + * @type {integer} + * @default 120 + * @since 3.0.0 + */ + this.panicMax = GetValue(config, 'panicMax', 120); + + /** + * The actual elapsed time in ms between one update and the next. + * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. + * So please be careful when using this value in calculations. + * + * @name Phaser.Core.TimeStep#rawDelta + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.rawDelta = 0; + }, + + /** + * Called when the DOM window.onBlur event triggers. + * + * @method Phaser.Core.TimeStep#blur + * @since 3.0.0 + */ + blur: function () + { + this.inFocus = false; + }, + + /** + * Called when the DOM window.onFocus event triggers. + * + * @method Phaser.Core.TimeStep#focus + * @since 3.0.0 + */ + focus: function () + { + this.inFocus = true; + + this.resetDelta(); + }, + + /** + * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) + * + * @method Phaser.Core.TimeStep#pause + * @since 3.0.0 + */ + pause: function () + { + this._pauseTime = window.performance.now(); + }, + + /** + * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) + * + * @method Phaser.Core.TimeStep#resume + * @since 3.0.0 + */ + resume: function () + { + this.resetDelta(); + + this.startTime += this.time - this._pauseTime; + }, + + /** + * [description] + * + * @method Phaser.Core.TimeStep#resetDelta + * @since 3.0.0 + */ + resetDelta: function () + { + var now = window.performance.now(); + + this.time = now; + this.lastTime = now; + this.nextFpsUpdate = now + 1000; + this.framesThisSecond = 0; + this.frame = 0; + + // Pre-populate smoothing array + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); + } + + this.delta = 0; + this.deltaIndex = 0; + + this._coolDown = this.panicMax; + }, + + /** + * Starts the Time Step running, if it is not already doing so. + * Called automatically by the Game Boot process. + * + * @method Phaser.Core.TimeStep#start + * @since 3.0.0 + * + * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. + */ + start: function (callback) + { + if (this.started) + { + return this; + } + + this.started = true; + this.running = true; + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = this._target; + } + + this.resetDelta(); + + this.startTime = window.performance.now(); + + this.callback = callback; + + this.raf.start(this.step.bind(this), this.forceSetTimeOut); + }, + + /** + * The main step method. This is called each time the browser updates, either by Request Animation Frame, + * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. + * You generally should never call this method directly. + * + * @method Phaser.Core.TimeStep#step + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + */ + step: function (time) + { + var before = time - this.lastTime; + + if (before < 0) + { + // Because, Chrome. + before = 0; + } + + this.rawDelta = before; + + var idx = this.deltaIndex; + var history = this.deltaHistory; + var max = this.deltaSmoothingMax; + + // delta time (time is in ms) + var dt = before; + + // When a browser switches tab, then comes back again, it takes around 10 frames before + // the delta time settles down so we employ a 'cooling down' period before we start + // trusting the delta values again, to avoid spikes flooding through our delta average + + if (this._coolDown > 0 || !this.inFocus) + { + this._coolDown--; + + dt = Math.min(dt, this._target); + } + + if (dt > this._min) + { + // Probably super bad start time or browser tab context loss, + // so use the last 'sane' dt value + + dt = history[idx]; + + // Clamp delta to min (in case history has become corrupted somehow) + dt = Math.min(dt, this._min); + } + + // Smooth out the delta over the previous X frames + + // add the delta to the smoothing array + history[idx] = dt; + + // adjusts the delta history array index based on the smoothing count + // this stops the array growing beyond the size of deltaSmoothingMax + this.deltaIndex++; + + if (this.deltaIndex > max) + { + this.deltaIndex = 0; + } + + // Delta Average + var avg = 0; + + // Loop the history array, adding the delta values together + + for (var i = 0; i < max; i++) + { + avg += history[i]; + } + + // Then divide by the array length to get the average delta + avg /= max; + + // Set as the world delta value + this.delta = avg; + + // Real-world timer advance + this.time += this.rawDelta; + + // Update the estimate of the frame rate, `fps`. Every second, the number + // of frames that occurred in that second are included in an exponential + // moving average of all frames per second, with an alpha of 0.25. This + // means that more recent seconds affect the estimated frame rate more than + // older seconds. + // + // When a browser window is NOT minimized, but is covered up (i.e. you're using + // another app which has spawned a window over the top of the browser), then it + // will start to throttle the raf callback time. It waits for a while, and then + // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. + // So if the game was running at 60fps, and the player opens a new window, then + // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. + // + // When they make the game visible again, the frame rate is increased at a rate of + // approx. 8fps, back up to 60fps (or the max it can obtain) + // + // There is no easy way to determine if this drop in frame rate is because the + // browser is throttling raf, or because the game is struggling with performance + // because you're asking it to do too much on the device. + + if (time > this.nextFpsUpdate) + { + // Compute the new exponential moving average with an alpha of 0.25. + this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; + this.nextFpsUpdate = time + 1000; + this.framesThisSecond = 0; + } + + this.framesThisSecond++; + + // Interpolation - how far between what is expected and where we are? + var interpolation = avg / this._target; + + this.callback(time, avg, interpolation); + + // Shift time value over + this.lastTime = time; + + this.frame++; + }, + + /** + * Manually calls TimeStep.step, passing in the performance.now value to it. + * + * @method Phaser.Core.TimeStep#tick + * @since 3.0.0 + */ + tick: function () + { + this.step(window.performance.now()); + }, + + /** + * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. + * + * @method Phaser.Core.TimeStep#sleep + * @since 3.0.0 + */ + sleep: function () + { + if (this.running) + { + this.raf.stop(); + + this.running = false; + } + }, + + /** + * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. + * The `seamless` argument controls if the wake-up should adjust the start time or not. + * + * @method Phaser.Core.TimeStep#wake + * @since 3.0.0 + * + * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. + */ + wake: function (seamless) + { + if (this.running) + { + this.sleep(); + } + else if (seamless) + { + this.startTime += -this.lastTime + (this.lastTime + window.performance.now()); + } + + this.raf.start(this.step.bind(this), this.useRAF); + + this.running = true; + + this.step(window.performance.now()); + }, + + /** + * Stops the TimeStep running. + * + * @method Phaser.Core.TimeStep#stop + * @since 3.0.0 + * + * @return {Phaser.Core.TimeStep} The TimeStep object. + */ + stop: function () + { + this.running = false; + this.started = false; + + this.raf.stop(); + + return this; + }, + + /** + * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null + * any objects. + * + * @method Phaser.Core.TimeStep#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.stop(); + + this.callback = NOOP; + + this.raf = null; + this.game = null; + } + +}); + +module.exports = TimeStep; + + +/***/ }), +/* 365 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(28); + +/** + * Called automatically by Phaser.Game and responsible for creating the console.log debug header. + * + * You can customize or disable the header via the Game Config object. + * + * @function Phaser.Core.DebugHeader + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. + */ +var DebugHeader = function (game) +{ + var config = game.config; + + if (config.hideBanner) + { + return; + } + + 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; + + var audioType; + + if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + { + audioType = 'Web Audio'; + } + else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + audioType = 'No Audio'; + } + else + { + audioType = 'HTML5 Audio'; + } + + if (!game.device.browser.ie) + { + var c = ''; + var args = [ c ]; + + if (Array.isArray(config.bannerBackgroundColor)) + { + var lastColor; + + config.bannerBackgroundColor.forEach(function (color) + { + c = c.concat('%c '); + + args.push('background: ' + color); + + lastColor = color; + + }); + + // inject the text color + args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + } + else + { + c = c.concat('%c '); + + args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + } + + // URL link background color (always white) + args.push('background: #fff'); + + if (config.gameTitle) + { + c = c.concat(config.gameTitle); + + if (config.gameVersion) + { + c = c.concat(' v' + config.gameVersion); + } + + if (!config.hidePhaser) + { + c = c.concat(' / '); + } + } + + var fb = ( false) ? undefined : ''; + + if (!config.hidePhaser) + { + c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); + } + + c = c.concat(' %c ' + config.gameURL); + + // Inject the new string back into the args array + args[0] = c; + + console.log.apply(console, args); + } + else if (window['console']) + { + console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); + } +}; + +module.exports = DebugHeader; + + +/***/ }), +/* 366 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @since 3.0.0 + */ +var CanvasInterpolation = { + + /** + * 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' ]; + + types.forEach(function (type) + { + canvas.style['image-rendering'] = type; + }); + + canvas.style.msInterpolationMode = 'nearest-neighbor'; + + return canvas; + }, + + /** + * 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'; + + return canvas; + } + +}; + +module.exports = CanvasInterpolation; + + +/***/ }), +/* 367 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasInterpolation = __webpack_require__(366); +var CanvasPool = __webpack_require__(24); +var CONST = __webpack_require__(28); +var Features = __webpack_require__(187); + +/** + * 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.Core.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; + + if ((config.customEnvironment || config.canvas) && config.renderType === CONST.AUTO) + { + throw new Error('Must set explicit renderType in custom environment'); + } + + // Not a custom environment, didn't provide their own canvas and not headless, so determine the renderer: + if (!config.customEnvironment && !config.canvas && 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.antialias) + { + CanvasPool.disableSmoothing(); + } + + var baseSize = game.scale.baseSize; + + var width = baseSize.width; + var height = baseSize.height; + + // Does the game config provide its own canvas element to use? + if (config.canvas) + { + game.canvas = config.canvas; + + game.canvas.width = width; + game.canvas.height = height; + } + else + { + game.canvas = CanvasPool.create(game, width, 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.antialias) + { + CanvasInterpolation.setCrisp(game.canvas); + } + + if (config.renderType === CONST.HEADLESS) + { + // Nothing more to do here + return; + } + + var CanvasRenderer; + var WebGLRenderer; + + if (true) + { + CanvasRenderer = __webpack_require__(459); + WebGLRenderer = __webpack_require__(456); + + // Let the config pick the renderer type, as both are included + if (config.renderType === CONST.WEBGL) + { + game.renderer = new WebGLRenderer(game); + } + else + { + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } + } + + if (false) + {} + + if (false) + {} +}; + +module.exports = CreateRenderer; + + +/***/ }), +/* 368 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(182); +var Matrix3 = __webpack_require__(370); + +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 + * A quaternion. + * + * @class Quaternion + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +var Quaternion = new Class({ + + initialize: + + function Quaternion (x, y, z, w) + { + /** + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The y component of this Quaternion. + * + * @name Phaser.Math.Quaternion#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The z component of this Quaternion. + * + * @name Phaser.Math.Quaternion#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The w component of this Quaternion. + * + * @name Phaser.Math.Quaternion#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; + } + }, + + /** + * Copy the components of a given Quaternion or Vector into this Quaternion. + * + * @method Phaser.Math.Quaternion#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z; + this.w = src.w; + + return this; + }, + + /** + * Set the components of this Quaternion. + * + * @method Phaser.Math.Quaternion#set + * @since 3.0.0 + * + * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=0] - The w component. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + set: function (x, y, z, w) + { + 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; + }, + + /** + * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. + * + * @method Phaser.Math.Quaternion#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z; + this.w += v.w; + + return this; + }, + + /** + * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. + * + * @method Phaser.Math.Quaternion#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + this.w -= v.w; + + return this; + }, + + /** + * Scale this Quaternion by the given value. + * + * @method Phaser.Math.Quaternion#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + scale: function (scale) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; + + return this; + }, + + /** + * Calculate the length of this Quaternion. + * + * @method Phaser.Math.Quaternion#length + * @since 3.0.0 + * + * @return {number} The length of this Quaternion. + */ + length: function () + { + 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); + }, + + /** + * Calculate the length of this Quaternion squared. + * + * @method Phaser.Math.Quaternion#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Quaternion, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return x * x + y * y + z * z + w * w; + }, + + /** + * Normalize this Quaternion. + * + * @method Phaser.Math.Quaternion#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + + 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; + }, + + /** + * Calculate the dot product of this Quaternion and the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#dot + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. + * + * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, + + /** + * Linearly interpolate this Quaternion towards the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#lerp + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. + * @param {number} [t=0] - The percentage of interpolation. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + lerp: function (v, t) + { + 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; + }, + + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotationTo + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - [description] + * @param {Phaser.Math.Vector3} b - [description] + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotationTo: function (a, b) + { + 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(); + + 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(); + } + }, + + /** + * Set the axes of this Quaternion. + * + * @method Phaser.Math.Quaternion#setAxes + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} view - The view axis. + * @param {Phaser.Math.Vector3} right - The right axis. + * @param {Phaser.Math.Vector3} up - The upwards axis. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setAxes: function (view, right, up) + { + var m = tmpMat3.val; + + 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(); + }, + + /** + * Reset this Matrix to an identity (default) Quaternion. + * + * @method Phaser.Math.Quaternion#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + identity: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + + return this; + }, + + /** + * Set the axis angle of this Quaternion. + * + * @method Phaser.Math.Quaternion#setAxisAngle + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} axis - The axis. + * @param {number} rad - The angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setAxisAngle: function (axis, rad) + { + 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; + }, + + /** + * Multiply this Quaternion by the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + multiply: function (b) + { + 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; + + 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; + }, + + /** + * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#slerp + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. + * @param {number} t - The percentage of interpolation. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + slerp: function (b, t) + { + // 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) + { + cosom = -cosom; + bx = - bx; + by = - by; + bz = - bz; + bw = - bw; + } + + // "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) + { + // 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; + }, + + /** + * Invert this Quaternion. + * + * @method Phaser.Math.Quaternion#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + invert: 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 + + this.x = -a0 * invDot; + this.y = -a1 * invDot; + this.z = -a2 * invDot; + this.w = a3 * invDot; + + return this; + }, + + /** + * Convert this Quaternion into its conjugate. + * + * Sets the x, y and z components. + * + * @method Phaser.Math.Quaternion#conjugate + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + conjugate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Rotate this Quaternion on the X axis. + * + * @method Phaser.Math.Quaternion#rotateX + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotateX: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this Quaternion on the Y axis. + * + * @method Phaser.Math.Quaternion#rotateY + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + }, + + /** + * Rotate this Quaternion on the Z axis. + * + * @method Phaser.Math.Quaternion#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotateZ: function (rad) + { + 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); + + 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; + }, + + /** + * Create a unit (or rotation) Quaternion from its x, y, and z components. + * + * Sets the w component. + * + * @method Phaser.Math.Quaternion#calculateW + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + calculateW: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); + + return this; + }, + + /** + * Convert the given Matrix into this Quaternion. + * + * @method Phaser.Math.Quaternion#fromMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + + +/***/ }), +/* 369 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 EPSILON = 0.000001; + +/** + * @classdesc + * A four-dimensional matrix. + * + * @class Matrix4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. + */ +var Matrix4 = new Class({ + + initialize: + + function Matrix4 (m) + { + /** + * The matrix values. + * + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(16); + + if (m) + { + // Assume Matrix4 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, + + /** + * Make a clone of this Matrix4. + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} A clone of this Matrix4. + */ + clone: function () + { + return new Matrix4(this); + }, + + // TODO - Should work with basic values + + /** + * This method is an alias for `Matrix4.copy`. + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + copy: function (src) + { + 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]; + 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; + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix4#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromArray: function (a) + { + 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; + }, + + /** + * Reset this Matrix. + * + * Sets all values to `0`. + * + * @method Phaser.Math.Matrix4#zero + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + zero: function () + { + 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; + + return this; + }, + + /** + * Set the `x`, `y` and `z` values of this Matrix. + * + * @method Phaser.Math.Matrix4#xyz + * @since 3.0.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + xyz: function (x, y, z) + { + this.identity(); + + var out = this.val; + + out[12] = x; + out[13] = y; + out[14] = z; + + return this; + }, + + /** + * Set the scaling values of this Matrix. + * + * @method Phaser.Math.Matrix4#scaling + * @since 3.0.0 + * + * @param {number} x - The x scaling value. + * @param {number} y - The y scaling value. + * @param {number} z - The z scaling value. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scaling: function (x, y, z) + { + this.zero(); + + var out = this.val; + + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; + + return this; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix4#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + identity: function () + { + 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; + + return this; + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix4#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + transpose: function () + { + 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; + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix4#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + invert: 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 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; + + return this; + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix4#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + adjoint: 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)); + + return this; + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix4#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: 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 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; + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix4#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + multiply: function (src) + { + 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; + + 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.Math.Matrix4#multiplyLocal + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - [description] + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + multiplyLocal: function (src) + { + 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); + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix4#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + translate: function (v) + { + var x = v.x; + var y = v.y; + var z = v.z; + var a = this.val; + + 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; + }, + + /** + * Translate this Matrix using the given values. + * + * @method Phaser.Math.Matrix4#translateXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + translateXYZ: function (x, y, z) + { + var a = this.val; + + 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; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix4#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scale: 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; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#scaleXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scaleXYZ: function (x, y, 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; + + return this; + }, + + /** + * Derive a rotation matrix around the given axis. + * + * @method Phaser.Math.Matrix4#makeRotationAxis + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. + * @param {number} angle - The rotation angle in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + makeRotationAxis: function (axis, angle) + { + // 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.fromArray([ + 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; + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotate: function (rad, axis) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its X axis. + * + * @method Phaser.Math.Matrix4#rotateX + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateX: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its Y axis. + * + * @method Phaser.Math.Matrix4#rotateY + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateY: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its Z axis. + * + * @method Phaser.Math.Matrix4#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateZ: function (rad) + { + 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]; + + // 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; + }, + + /** + * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * + * @method Phaser.Math.Matrix4#fromRotationTranslation + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. + * @param {Phaser.Math.Vector3} v - The Vector to set translation from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromRotationTranslation: function (q, v) + { + // 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; + + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + + out[12] = v.x; + out[13] = v.y; + out[14] = v.z; + out[15] = 1; + + return this; + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix4#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromQuat: function (q) + { + 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; + + 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[15] = 1; + + return this; + }, + + /** + * Generate a frustum matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#frustum + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + frustum: function (left, right, bottom, top, near, far) + { + 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; + + 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; + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspective + * @since 3.0.0 + * + * @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. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + perspective: function (fovy, aspect, near, far) + { + 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; + + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + + return this; + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspectiveLH + * @since 3.0.0 + * + * @param {number} width - The width of the frustum. + * @param {number} height - The height of the frustum. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + perspectiveLH: function (width, height, near, far) + { + 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; + + out[12] = 0; + out[13] = 0; + out[14] = (near * far) / (near - far); + out[15] = 0; + + return this; + }, + + /** + * Generate an orthogonal projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#ortho + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + ortho: function (left, right, bottom, top, near, far) + { + 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; + + 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; + }, + + /** + * Generate a look-at matrix with the given eye position, focal point, and up axis. + * + * @method Phaser.Math.Matrix4#lookAt + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer + * @param {Phaser.Math.Vector3} center - Point the viewer is looking at + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + lookAt: function (eye, center, up) + { + var out = this.val; + + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; + + var upx = up.x; + var upy = up.y; + var upz = up.z; + + 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(); + } + + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + + z0 *= len; + z1 *= len; + z2 *= len; + + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + + if (!len) + { + y0 = 0; + y1 = 0; + y2 = 0; + } + else + { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + 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; + }, + + /** + * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. + * + * @method Phaser.Math.Matrix4#yawPitchRoll + * @since 3.0.0 + * + * @param {number} yaw - [description] + * @param {number} pitch - [description] + * @param {number} roll - [description] + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + yawPitchRoll: function (yaw, pitch, roll) + { + 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; + }, + + /** + * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. + * + * @method Phaser.Math.Matrix4#setWorldMatrix + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. + * @param {Phaser.Math.Vector3} position - The position of the world matrix. + * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. + * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. + * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + { + 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) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix !== undefined) + { + this.multiplyLocal(projectionMatrix); + } + + return this; + } + +}); + +var _tempMat1 = new Matrix4(); +var _tempMat2 = new Matrix4(); + +module.exports = Matrix4; + + +/***/ }), +/* 370 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 + * A three-dimensional matrix. + * + * Defaults to the identity matrix when instantiated. + * + * @class Matrix3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. + */ +var Matrix3 = new Class({ + + initialize: + + function Matrix3 (m) + { + /** + * The matrix values. + * + * @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(); + } + }, + + /** + * Make a clone of this Matrix3. + * + * @method Phaser.Math.Matrix3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} A clone of this Matrix3. + */ + clone: function () + { + return new Matrix3(this); + }, + + /** + * This method is an alias for `Matrix3.copy`. + * + * @method Phaser.Math.Matrix3#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix3#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + copy: function (src) + { + 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; + }, + + /** + * Copy the values of a given Matrix4 into this Matrix3. + * + * @method Phaser.Math.Matrix3#fromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromMat4: function (m) + { + 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; + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix3#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromArray: function (a) + { + 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; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix3#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + 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; + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix3#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + transpose: function () + { + 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; + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix3#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + invert: 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 a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + + 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; + + if (!det) + { + 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; + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix3#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + adjoint: 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 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; + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix3#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: 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 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); + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix3#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + multiply: function (src) + { + 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]; + + 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; + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix3#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + translate: function (v) + { + var a = this.val; + var x = v.x; + var y = v.y; + + 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; + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix3#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + rotate: function (rad) + { + 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; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x` and `y` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix3#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + scale: function (v) + { + 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; + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix3#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromQuat: function (q) + { + 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; + + out[2] = xz + wy; + out[5] = yz - wx; + out[8] = 1 - (xx + yy); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Math.Matrix3#normalFromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - [description] + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + normalFromMat4: function (m) + { + 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; + + 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; + + 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; + + +/***/ }), +/* 371 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Takes the `x` and `y` coordinates and transforms them into the same space as + * defined by the position, rotation and scale values. + * + * @function Phaser.Math.TransformXY + * @since 3.0.0 + * + * @param {number} x - The x coordinate to be transformed. + * @param {number} y - The y coordinate to be transformed. + * @param {number} positionX - Horizontal position of the transform point. + * @param {number} positionY - Vertical position of the transform point. + * @param {number} rotation - Rotation of the transform point, in radians. + * @param {number} scaleX - Horizontal scale of the transform point. + * @param {number} scaleY - Vertical scale of the transform point. + * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. + * + * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. + */ +var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) +{ + if (output === undefined) { output = new Vector2(); } + + var radianSin = Math.sin(rotation); + var radianCos = Math.cos(rotation); + + // Rotate and Scale + var a = radianCos * scaleX; + var b = radianSin * scaleX; + var c = -radianSin * scaleY; + var d = radianCos * scaleY; + + // Invert + var id = 1 / ((a * d) + (c * -b)); + + output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); + output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); + + return output; +}; + +module.exports = TransformXY; + + +/***/ }), +/* 372 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * + * @function Phaser.Math.RoundAwayFromZero + * @since 3.0.0 + * + * @param {number} value - The number to round. + * + * @return {number} The rounded number, rounded away from zero. + */ +var RoundAwayFromZero = function (value) +{ + // "Opposite" of truncate. + return (value > 0) ? Math.ceil(value) : Math.floor(value); +}; + +module.exports = RoundAwayFromZero; + + +/***/ }), +/* 373 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. + * + * @function Phaser.Math.Rotate + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. + * @param {number} angle - The angle to be rotated by in an anticlockwise direction. + * + * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. + */ +var Rotate = function (point, angle) +{ + var x = point.x; + var y = point.y; + + point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); + point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); + + return point; +}; + +module.exports = Rotate; + + +/***/ }), +/* 374 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. + * + * @function Phaser.Math.FloatBetween + * @since 3.0.0 + * + * @param {number} min - The lower bound for the float, inclusive. + * @param {number} max - The upper bound for the float exclusive. + * + * @return {number} A random float within the given range. + */ +var FloatBetween = function (min, max) +{ + return Math.random() * (max - min) + min; +}; + +module.exports = FloatBetween; + + +/***/ }), +/* 375 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using ceil. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. + * As will `14` snap to `15`... but `16` will snap to `20`. + * + * @function Phaser.Math.Snap.Ceil + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapCeil = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.ceil(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapCeil; + + +/***/ }), +/* 376 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Returns the nearest power of 2 to the given `value`. + * + * @function Phaser.Math.Pow2.GetPowerOfTwo + * @since 3.0.0 + * + * @param {number} value - The value. + * + * @return {integer} The nearest power of 2 to `value`. + */ +var GetPowerOfTwo = function (value) +{ + var index = Math.log(value) / 0.6931471805599453; + + return (1 << Math.ceil(index)); +}; + +module.exports = GetPowerOfTwo; + + +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SmoothStep = __webpack_require__(195); + +/** + * A Smooth Step interpolation method. + * + * @function Phaser.Math.Interpolation.SmoothStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep} + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The interpolated value. + */ +var SmoothStepInterpolation = function (t, min, max) +{ + return min + (max - min) * SmoothStep(t, 0, 1); +}; + +module.exports = SmoothStepInterpolation; + + +/***/ }), +/* 378 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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 * p; +} + +function P1 (t, p) +{ + return 2 * (1 - t) * t * p; +} + +function P2 (t, p) +{ + return t * t * p; +} + +// p0 = start point +// p1 = control point 1 +// p2 = end point + +// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js + +/** + * A quadratic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.QuadraticBezier + * @since 3.2.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The control point. + * @param {number} p2 - The end point. + * + * @return {number} The interpolated value. + */ +var QuadraticBezierInterpolation = function (t, p0, p1, p2) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2); +}; + +module.exports = QuadraticBezierInterpolation; + + +/***/ }), +/* 379 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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 + +/** + * A cubic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.CubicBezier + * @since 3.0.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The first control point. + * @param {number} p2 - The second control point. + * @param {number} p3 - The end point. + * + * @return {number} The interpolated value. + */ +var CubicBezierInterpolation = function (t, p0, p1, p2, p3) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); +}; + +module.exports = CubicBezierInterpolation; + + +/***/ }), +/* 380 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the factorial of a given number for integer values greater than 0. + * + * @function Phaser.Math.Factorial + * @since 3.0.0 + * + * @param {number} value - A positive integer to calculate the factorial of. + * + * @return {number} The factorial of the given number. + */ +var Factorial = function (value) +{ + if (value === 0) + { + return 1; + } + + var res = value; + + while (--value) + { + res *= value; + } + + return res; +}; + +module.exports = Factorial; + + +/***/ }), +/* 381 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Factorial = __webpack_require__(380); + +/** + * [description] + * + * @function Phaser.Math.Bernstein + * @since 3.0.0 + * + * @param {number} n - [description] + * @param {number} i - [description] + * + * @return {number} [description] + */ +var Bernstein = function (n, i) +{ + return Factorial(n) / Factorial(i) / Factorial(n - i); +}; + +module.exports = Bernstein; + + +/***/ }), +/* 382 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether `a` is fuzzily less than `b`. + * + * `a` is fuzzily less than `b` if it is less than `b + epsilon`. + * + * @function Phaser.Math.Fuzzy.LessThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. + */ +var LessThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return a < b + epsilon; +}; + +module.exports = LessThan; + + +/***/ }), +/* 383 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether `a` is fuzzily greater than `b`. + * + * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. + * + * @function Phaser.Math.Fuzzy.GreaterThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. + */ +var GreaterThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return a > b - epsilon; +}; + +module.exports = GreaterThan; + + +/***/ }), +/* 384 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the distance between two sets of coordinates (points), squared. + * + * @function Phaser.Math.Distance.Squared + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The distance between each point, squared. + */ +var DistanceSquared = function (x1, y1, x2, y2) +{ + var dx = x1 - x2; + var dy = y1 - y2; + + return dx * dx + dy * dy; +}; + +module.exports = DistanceSquared; + + +/***/ }), +/* 385 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Normalize an angle to the [0, 2pi] range. + * + * @function Phaser.Math.Angle.Normalize + * @since 3.0.0 + * + * @param {number} angle - The angle to normalize, in radians. + * + * @return {number} The normalized angle, in radians. + */ +var Normalize = function (angle) +{ + angle = angle % (2 * Math.PI); + + if (angle >= 0) + { + return angle; + } + else + { + return angle + 2 * Math.PI; + } +}; + +module.exports = Normalize; + + +/***/ }), +/* 386 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * @function Phaser.Math.Angle.Between + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var Between = function (x1, y1, x2, y2) +{ + return Math.atan2(y2 - y1, x2 - x1); +}; + +module.exports = Between; + + +/***/ }), +/* 387 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); +var Extend = __webpack_require__(19); + +/** + * @namespace Phaser.Math + */ + +var PhaserMath = { + + // Collections of functions + Angle: __webpack_require__(1091), + Distance: __webpack_require__(1083), + Easing: __webpack_require__(1081), + Fuzzy: __webpack_require__(1080), + Interpolation: __webpack_require__(1077), + Pow2: __webpack_require__(1072), + Snap: __webpack_require__(1070), + + // Expose the RNG Class + RandomDataGenerator: __webpack_require__(1068), + + // Single functions + Average: __webpack_require__(1067), + Bernstein: __webpack_require__(381), + Between: __webpack_require__(184), + CatmullRom: __webpack_require__(185), + CeilTo: __webpack_require__(1066), + Clamp: __webpack_require__(23), + DegToRad: __webpack_require__(34), + Difference: __webpack_require__(1065), + Factorial: __webpack_require__(380), + FloatBetween: __webpack_require__(374), + FloorTo: __webpack_require__(1064), + FromPercent: __webpack_require__(100), + GetSpeed: __webpack_require__(1063), + IsEven: __webpack_require__(1062), + IsEvenStrict: __webpack_require__(1061), + Linear: __webpack_require__(129), + MaxAdd: __webpack_require__(1060), + MinSub: __webpack_require__(1059), + Percent: __webpack_require__(1058), + RadToDeg: __webpack_require__(183), + RandomXY: __webpack_require__(1057), + RandomXYZ: __webpack_require__(1056), + RandomXYZW: __webpack_require__(1055), + Rotate: __webpack_require__(373), + RotateAround: __webpack_require__(428), + RotateAroundDistance: __webpack_require__(197), + RoundAwayFromZero: __webpack_require__(372), + RoundTo: __webpack_require__(1054), + SinCosTableGenerator: __webpack_require__(1053), + SmootherStep: __webpack_require__(196), + SmoothStep: __webpack_require__(195), + TransformXY: __webpack_require__(371), + Within: __webpack_require__(1052), + Wrap: __webpack_require__(57), + + // Vector classes + Vector2: __webpack_require__(3), + Vector3: __webpack_require__(182), + Vector4: __webpack_require__(1051), + Matrix3: __webpack_require__(370), + Matrix4: __webpack_require__(369), + Quaternion: __webpack_require__(368), + RotateVec3: __webpack_require__(1050) + +}; + +// Merge in the consts + +PhaserMath = Extend(false, PhaserMath, CONST); + +// Export it + +module.exports = PhaserMath; + + +/***/ }), +/* 388 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(24); + +/** + * 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. + * + * @typedef {object} Phaser.Device.CanvasFeatures + * @since 3.0.0 + * + * @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 = { + + supportInverseAlpha: false, + supportNewBlendModes: false + +}; + +function checkBlendMode () +{ + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; + + var magenta = new Image(); + + magenta.onload = function () + { + var yellow = new Image(); + + yellow.onload = function () + { + var canvas = CanvasPool.create(yellow, 6, 1); + var context = canvas.getContext('2d'); + + context.globalCompositeOperation = 'multiply'; + + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + if (!context.getImageData(2, 0, 1, 1)) + { + return false; + } + + var data = context.getImageData(2, 0, 1, 1).data; + + CanvasPool.remove(yellow); + + CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); + }; + + yellow.src = pngHead + '/wCKxvRF' + pngEnd; + }; + + magenta.src = pngHead + 'AP804Oa6' + pngEnd; + + return false; +} + +function checkInverseAlpha () +{ + var canvas = CanvasPool.create(this, 2, 1); + var context = canvas.getContext('2d'); + + context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + + // Draw a single pixel + context.fillRect(0, 0, 1, 1); + + // Get the color values + var s1 = context.getImageData(0, 0, 1, 1); + + if (s1 === null) + { + return false; + } + + // Plot them to x2 + context.putImageData(s1, 1, 0); + + // 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) + { + CanvasFeatures.supportNewBlendModes = checkBlendMode(); + CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + } + + return CanvasFeatures; +} + +module.exports = init(); + + +/***/ }), +/* 389 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// This singleton is instantiated as soon as Phaser loads, +// before a Phaser.Game instance has even been created. +// Which means all instances of Phaser Games can share it, +// without having to re-poll the device all over again + +/** + * @namespace Phaser.Device + * @since 3.0.0 + */ + +/** + * @typedef {object} Phaser.DeviceConf + * + * @property {Phaser.Device.OS} os - The OS Device functions. + * @property {Phaser.Device.Browser} browser - The Browser Device functions. + * @property {Phaser.Device.Features} features - The Features Device functions. + * @property {Phaser.Device.Input} input - The Input Device functions. + * @property {Phaser.Device.Audio} audio - The Audio Device functions. + * @property {Phaser.Device.Video} video - The Video Device functions. + * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. + * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. + */ + +module.exports = { + + os: __webpack_require__(99), + browser: __webpack_require__(128), + features: __webpack_require__(187), + input: __webpack_require__(1095), + audio: __webpack_require__(1094), + video: __webpack_require__(1093), + fullscreen: __webpack_require__(1092), + canvasFeatures: __webpack_require__(388) + +}; + + +/***/ }), +/* 390 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(28); +var Device = __webpack_require__(389); +var GetFastValue = __webpack_require__(2); +var GetValue = __webpack_require__(4); +var IsPlainObject = __webpack_require__(8); +var PhaserMath = __webpack_require__(387); +var NOOP = __webpack_require__(1); +var DefaultPlugins = __webpack_require__(181); +var ValueToColor = __webpack_require__(192); + +/** + * This callback type is completely empty, a no-operation. + * + * @callback NOOP + */ + +/** + * @callback BootCallback + * + * @param {Phaser.Game} game - The game. + */ + +/** + * Config object containing various sound settings. + * + * @typedef {object} AudioConfig + * + * @property {boolean} [disableWebAudio=false] - Use HTML5 Audio instead of Web Audio. + * @property {AudioContext} [context] - An existing Web Audio context. + * @property {boolean} [noAudio=false] - Disable all audio output. + * + * @see Phaser.Sound.SoundManagerCreator + */ + +/** + * @typedef {object} InputConfig + * + * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. + * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. + * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. + * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. + * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. + * @property {number} [smoothFactor=0] - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + * @property {boolean} [inputQueue=false] - Should Phaser use a queued input system for native DOM Events or not? + */ + +/** + * @typedef {object} MouseInputConfig + * + * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether mouse input events have `preventDefault` called on them. + */ + +/** + * @typedef {object} KeyboardInputConfig + * + * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. + * @property {?integer} [capture] - `preventDefault` will be called on every non-modified key which has a key code in this array. By default it is empty. + */ + +/** + * @typedef {object} TouchInputConfig + * + * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. + */ + +/** + * @typedef {object} GamepadInputConfig + * + * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. + */ + +/** + * @typedef {object} BannerConfig + * + * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. + * @property {string} [text='#ffffff'] - The color of the banner text. + * @property {string[]} [background] - The background colors of the banner. + */ + +/** + * @typedef {object} FPSConfig + * + * @property {integer} [min=5] - The minimum acceptable rendering rate, in frames per second. + * @property {integer} [target=60] - The optimum rendering rate, in frames per second. + * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. + * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. + * @property {integer} [panicMax=120] - The amount of frames the time step counts before we trust the delta values again. + */ + +/** + * @typedef {object} RenderConfig + * + * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. + * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. + * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. + * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. + * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + * @property {integer} [batchSize=2000] - The default WebGL batch size. + * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + +/** + * @typedef {object} WidthHeight + * + * @property {integer} [width=0] - The width. + * @property {integer} [height=0] - The height. + */ + +/** + * @typedef {object} ScaleConfig + * + * @property {(integer|string)} [width=1024] - The base width of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(integer|string)} [height=768] - The base height of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(Phaser.Scale.ZoomType|integer)} [zoom=1] - The zoom value of the game canvas. + * @property {number} [resolution=1] - The rendering resolution of the canvas. This is reserved for future use and is currently ignored. + * @property {?(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If undefined, or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {boolean} [expandParent=true] - Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%? + * @property {Phaser.Scale.ScaleModeType} [mode=Phaser.Scale.ScaleModes.NONE] - The scale mode. + * @property {WidthHeight} [min] - The minimum width and height the canvas can be scaled down to. + * @property {WidthHeight} [max] - The maximum width the canvas can be scaled up to. + * @property {boolean} [autoRound=false] - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * @property {Phaser.Scale.CenterType} [autoCenter=Phaser.Scale.Center.NO_CENTER] - Automatically center the canvas within the parent? + * @property {integer} [resizeInterval=500] - How many ms should elapse before checking if the browser size has changed? + * @property {?(HTMLElement|string)} [fullscreenTarget] - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + +/** + * @typedef {object} CallbacksConfig + * + * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. + * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + +/** + * @typedef {object} LoaderConfig + * + * @property {string} [baseURL] - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + * @property {string} [path] - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. + * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. + * @property {boolean} [async=true] - Should the XHR request use async or not? + * @property {string} [user] - Optional username for all XHR requests. + * @property {string} [password] - Optional password for all XHR requests. + * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. + */ + +/** + * @typedef {object} DOMContainerConfig + * + * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. + * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. + */ + +/** + * @typedef {object} ImagesConfig + * + * @property {string} [default] - URL to use for the 'default' texture. + * @property {string} [missing] - URL to use for the 'missing' texture. + */ + +/** + * @typedef {object} PhysicsConfig + * + * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. + * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. + * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. + * @property {object} [matter] - Matter Physics configuration. + */ + +/** + * @typedef {object} PluginObjectItem + * + * @property {string} [key] - A key to identify the plugin in the Plugin Manager. + * @property {*} [plugin] - The plugin itself. Usually a class/constructor. + * @property {boolean} [start] - Whether the plugin should be started automatically. + * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). + * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). + * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @property {*} [data] - Arbitrary data passed to the plugin's init() method. + * + * @example + * // Global plugin + * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } + * @example + * // Scene plugin + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + */ + +/** + * @typedef {object} PluginObject + * + * @property {?PluginObjectItem[]} [global] - Global plugins to install. + * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. + * @property {string[]} [default] - The default set of scene plugins (names). + * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. + */ + +/** + * @typedef {object} GameConfig + * + * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. + * @property {(integer|string)} [height=768] - The height of the game, in game pixels. + * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. + * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. + * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. + * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If undefined or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. + * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. + * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. + * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. + * @property {string[]} [seed] - Seed for the random number generator. + * @property {string} [title=''] - The title of the game. Shown in the browser console. + * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. + * @property {string} [version=''] - The version of the game. Shown in the browser console. + * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. + * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. + * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). + * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. + * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. + * @property {FPSConfig} [fps] - Game loop configuration. + * @property {RenderConfig} [render] - Game renderer configuration. + * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. + * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. + * @property {LoaderConfig} [loader] - Loader configuration. + * @property {ImagesConfig} [images] - Images configuration. + * @property {object} [physics] - Physics configuration. + * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. + * @property {ScaleConfig} [scale] - The Scale Manager configuration. + */ + +/** + * @classdesc + * The active game configuration settings, parsed from a {@link GameConfig} object. + * + * @class Config + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * + * @see Phaser.Game#config + */ +var Config = new Class({ + + initialize: + + function Config (config) + { + if (config === undefined) { config = {}; } + + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; + + var defaultBannerTextColor = '#ffffff'; + + /** + * @const {(integer|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + */ + this.width = GetValue(config, 'width', 1024); + + /** + * @const {(integer|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + */ + this.height = GetValue(config, 'height', 768); + + /** + * @const {(Phaser.Scale.ZoomType|integer)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + */ + this.zoom = GetValue(config, 'zoom', 1); + + /** + * @const {number} Phaser.Core.Config#resolution - The canvas device pixel resolution. Currently un-used. + */ + this.resolution = GetValue(config, 'resolution', 1); + + /** + * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. + */ + this.parent = GetValue(config, 'parent', undefined); + + /** + * @const {Phaser.Scale.ScaleModeType} Phaser.Core.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. + */ + this.scaleMode = GetValue(config, 'scaleMode', 0); + + /** + * @const {boolean} Phaser.Core.Config#expandParent - Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%? + */ + this.expandParent = GetValue(config, 'expandParent', true); + + /** + * @const {integer} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + */ + this.autoRound = GetValue(config, 'autoRound', false); + + /** + * @const {Phaser.Scale.CenterType} Phaser.Core.Config#autoCenter - Automatically center the canvas within the parent? + */ + this.autoCenter = GetValue(config, 'autoCenter', 0); + + /** + * @const {integer} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + */ + this.resizeInterval = GetValue(config, 'resizeInterval', 500); + + /** + * @const {?(HTMLElement|string)} Phaser.Core.Config#fullscreenTarget - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); + + /** + * @const {integer} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minWidth = GetValue(config, 'minWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxWidth = GetValue(config, 'maxWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minHeight = GetValue(config, 'minHeight', 0); + + /** + * @const {integer} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxHeight = GetValue(config, 'maxHeight', 0); + + // Scale Manager - Anything set in here over-rides anything set above + + var scaleConfig = GetValue(config, 'scale', null); + + if (scaleConfig) + { + this.width = GetValue(scaleConfig, 'width', this.width); + this.height = GetValue(scaleConfig, 'height', this.height); + this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); + this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); + this.parent = GetValue(scaleConfig, 'parent', this.parent); + this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); + this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); + this.autoRound = GetValue(scaleConfig, 'autoRound', this.autoRound); + this.autoCenter = GetValue(scaleConfig, 'autoCenter', this.autoCenter); + this.resizeInterval = GetValue(scaleConfig, 'resizeInterval', this.resizeInterval); + this.fullscreenTarget = GetValue(scaleConfig, 'fullscreenTarget', this.fullscreenTarget); + this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); + this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); + this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); + this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); + } + + /** + * @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) + */ + this.renderType = GetValue(config, 'type', CONST.AUTO); + + /** + * @const {?HTMLCanvasElement} Phaser.Core.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. + */ + this.canvas = GetValue(config, 'canvas', null); + + /** + * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Core.Config#context - Force Phaser to use your own Canvas context instead of creating one. + */ + this.context = GetValue(config, 'context', null); + + /** + * @const {?string} Phaser.Core.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. + */ + this.canvasStyle = GetValue(config, 'canvasStyle', null); + + /** + * @const {boolean} Phaser.Core.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. + */ + this.customEnvironment = GetValue(config, 'customEnvironment', false); + + /** + * @const {?object} Phaser.Core.Config#sceneConfig - The default Scene configuration object. + */ + this.sceneConfig = GetValue(config, 'scene', null); + + /** + * @const {string[]} Phaser.Core.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. + */ + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + + PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); + + /** + * @const {string} Phaser.Core.Config#gameTitle - The title of the game. + */ + this.gameTitle = GetValue(config, 'title', ''); + + /** + * @const {string} Phaser.Core.Config#gameURL - The URL of the game. + */ + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); + + /** + * @const {string} Phaser.Core.Config#gameVersion - The version of the game. + */ + this.gameVersion = GetValue(config, 'version', ''); + + /** + * @const {boolean} Phaser.Core.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. + */ + this.autoFocus = GetValue(config, 'autoFocus', true); + + // DOM Element Container + + /** + * @const {?boolean} Phaser.Core.Config#domCreateContainer - EXPERIMENTAL: Do not currently use. + */ + this.domCreateContainer = GetValue(config, 'dom.createContainer', false); + + /** + * @const {?boolean} Phaser.Core.Config#domBehindCanvas - EXPERIMENTAL: Do not currently use. + */ + this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); + + // Input + + /** + * @const {boolean} Phaser.Core.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. + */ + this.inputKeyboard = GetValue(config, 'input.keyboard', true); + + /** + * @const {*} Phaser.Core.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. + */ + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + + /** + * @const {?integer[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + */ + this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); + + /** + * @const {(boolean|object)} Phaser.Core.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. + */ + this.inputMouse = GetValue(config, 'input.mouse', true); + + /** + * @const {?*} Phaser.Core.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. + */ + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. + */ + this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + + /** + * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. + */ + this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); + + /** + * @const {?*} Phaser.Core.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. + */ + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. + */ + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + + /** + * @const {integer} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + */ + this.inputActivePointers = GetValue(config, 'input.activePointers', 1); + + /** + * @const {integer} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + */ + this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); + + /** + * @const {boolean} Phaser.Core.Config#inputQueue - Should Phaser use a queued input system for native DOM Events or not? + */ + this.inputQueue = GetValue(config, 'input.queue', false); + + /** + * @const {boolean} Phaser.Core.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. + */ + this.inputGamepad = GetValue(config, 'input.gamepad', false); + + /** + * @const {*} Phaser.Core.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. + */ + this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); + + /** + * @const {boolean} Phaser.Core.Config#disableContextMenu - Set to `true` to disable the right-click context menu. + */ + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + + /** + * @const {AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. + */ + this.audio = GetValue(config, 'audio'); + + // If you do: { banner: false } it won't display any banner at all + + /** + * @const {boolean} Phaser.Core.Config#hideBanner - Don't write the banner line to the console.log. + */ + this.hideBanner = (GetValue(config, 'banner', null) === false); + + /** + * @const {boolean} Phaser.Core.Config#hidePhaser - Omit Phaser's name and version from the banner. + */ + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + + /** + * @const {string} Phaser.Core.Config#bannerTextColor - The color of the banner text. + */ + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + + /** + * @const {string[]} Phaser.Core.Config#bannerBackgroundColor - The background colors of the banner. + */ + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } + + /** + * @const {?FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + */ + this.fps = GetValue(config, 'fps', null); + + // Renderer Settings + // These can either be in a `render` object within the Config, or specified on their own + + var renderConfig = GetValue(config, 'render', config); + + /** + * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + */ + this.antialias = GetValue(renderConfig, 'antialias', true); + + /** + * @const {boolean} Phaser.Core.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + */ + this.roundPixels = GetValue(renderConfig, 'roundPixels', false); + + /** + * @const {boolean} Phaser.Core.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). + */ + this.pixelArt = GetValue(renderConfig, 'pixelArt', this.zoom !== 1); + + if (this.pixelArt) + { + this.antialias = false; + this.roundPixels = true; + } + + /** + * @const {boolean} Phaser.Core.Config#transparent - Whether the game canvas will have a transparent background. + */ + this.transparent = GetValue(renderConfig, 'transparent', false); + + /** + * @const {boolean} Phaser.Core.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. + */ + this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); + + /** + * @const {boolean} Phaser.Core.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. + */ + this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); + + /** + * @const {boolean} Phaser.Core.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + */ + this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); + + /** + * @const {string} Phaser.Core.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + */ + this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); + + /** + * @const {integer} Phaser.Core.Config#batchSize - The default WebGL Batch size. + */ + this.batchSize = GetValue(renderConfig, 'batchSize', 2000); + + /** + * @const {integer} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + this.maxLights = GetValue(renderConfig, 'maxLights', 10); + + var bgc = GetValue(config, 'backgroundColor', 0); + + /** + * @const {Phaser.Display.Color} Phaser.Core.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. + */ + this.backgroundColor = ValueToColor(bgc); + + if (bgc === 0 && this.transparent) + { + this.backgroundColor.alpha = 0; + } + + /** + * @const {BootCallback} Phaser.Core.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. + */ + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); + + /** + * @const {BootCallback} Phaser.Core.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + + /** + * @const {PhysicsConfig} Phaser.Core.Config#physics - The Physics Configuration object. + */ + this.physics = GetValue(config, 'physics', {}); + + /** + * @const {(boolean|string)} Phaser.Core.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. + */ + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + + /** + * @const {string} Phaser.Core.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + */ + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + */ + this.loaderPath = GetValue(config, 'loader.path', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + */ + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); + + /** + * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + */ + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + + /** + * @const {string} Phaser.Core.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. + */ + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + + /** + * @const {boolean} Phaser.Core.Config#loaderAsync - Should the XHR request use async or not? + */ + this.loaderAsync = GetValue(config, 'loader.async', true); + + /** + * @const {string} Phaser.Core.Config#loaderUser - Optional username for all XHR requests. + */ + this.loaderUser = GetValue(config, 'loader.user', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPassword - Optional password for all XHR requests. + */ + this.loaderPassword = GetValue(config, 'loader.password', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + */ + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + + /* + * Allows `plugins` property to either be an array, in which case it just replaces + * the default plugins like previously, or a config object. + * + * plugins: { + * global: [ + * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, + * ], + * scene: [ + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + * ], + * default: [], OR + * defaultMerge: [ + * 'ModPlayer' + * ] + * } + */ + + /** + * @const {any} Phaser.Core.Config#installGlobalPlugins - An array of global plugins to be installed. + */ + this.installGlobalPlugins = []; + + /** + * @const {any} Phaser.Core.Config#installScenePlugins - An array of Scene level plugins to be installed. + */ + this.installScenePlugins = []; + + var plugins = GetValue(config, 'plugins', null); + var defaultPlugins = DefaultPlugins.DefaultScene; + + if (plugins) + { + // Old 3.7 array format? + if (Array.isArray(plugins)) + { + this.defaultPlugins = plugins; + } + else if (IsPlainObject(plugins)) + { + this.installGlobalPlugins = GetFastValue(plugins, 'global', []); + this.installScenePlugins = GetFastValue(plugins, 'scene', []); + + if (Array.isArray(plugins.default)) + { + defaultPlugins = plugins.default; + } + else if (Array.isArray(plugins.defaultMerge)) + { + defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); + } + } + } + + /** + * @const {any} Phaser.Core.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). + */ + this.defaultPlugins = defaultPlugins; + + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + + /** + * @const {string} Phaser.Core.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. + */ + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + + /** + * @const {string} Phaser.Core.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. + */ + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + + if (window) + { + if (window.FORCE_WEBGL) + { + this.renderType = CONST.WEBGL; + } + else if (window.FORCE_CANVAS) + { + this.renderType = CONST.CANVAS; + } + } + } + +}); + +module.exports = Config; + + +/***/ }), +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84925,16 +93180,16 @@ module.exports = GenerateTexture; * @namespace Phaser.Math.Easing.Stepped */ -module.exports = __webpack_require__(952); +module.exports = __webpack_require__(1119); /***/ }), -/* 359 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84944,20 +93199,20 @@ module.exports = __webpack_require__(952); module.exports = { - In: __webpack_require__(955), - Out: __webpack_require__(954), - InOut: __webpack_require__(953) + In: __webpack_require__(1122), + Out: __webpack_require__(1121), + InOut: __webpack_require__(1120) }; /***/ }), -/* 360 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84967,20 +93222,20 @@ module.exports = { module.exports = { - In: __webpack_require__(958), - Out: __webpack_require__(957), - InOut: __webpack_require__(956) + In: __webpack_require__(1125), + Out: __webpack_require__(1124), + InOut: __webpack_require__(1123) }; /***/ }), -/* 361 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84990,20 +93245,20 @@ module.exports = { module.exports = { - In: __webpack_require__(961), - Out: __webpack_require__(960), - InOut: __webpack_require__(959) + In: __webpack_require__(1128), + Out: __webpack_require__(1127), + InOut: __webpack_require__(1126) }; /***/ }), -/* 362 */ +/* 395 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85013,20 +93268,20 @@ module.exports = { module.exports = { - In: __webpack_require__(964), - Out: __webpack_require__(963), - InOut: __webpack_require__(962) + In: __webpack_require__(1131), + Out: __webpack_require__(1130), + InOut: __webpack_require__(1129) }; /***/ }), -/* 363 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85034,16 +93289,16 @@ module.exports = { * @namespace Phaser.Math.Easing.Linear */ -module.exports = __webpack_require__(965); +module.exports = __webpack_require__(1132); /***/ }), -/* 364 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85053,20 +93308,20 @@ module.exports = __webpack_require__(965); module.exports = { - In: __webpack_require__(968), - Out: __webpack_require__(967), - InOut: __webpack_require__(966) + In: __webpack_require__(1135), + Out: __webpack_require__(1134), + InOut: __webpack_require__(1133) }; /***/ }), -/* 365 */ +/* 398 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85076,20 +93331,20 @@ module.exports = { module.exports = { - In: __webpack_require__(971), - Out: __webpack_require__(970), - InOut: __webpack_require__(969) + In: __webpack_require__(1138), + Out: __webpack_require__(1137), + InOut: __webpack_require__(1136) }; /***/ }), -/* 366 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85099,20 +93354,20 @@ module.exports = { module.exports = { - In: __webpack_require__(974), - Out: __webpack_require__(973), - InOut: __webpack_require__(972) + In: __webpack_require__(1141), + Out: __webpack_require__(1140), + InOut: __webpack_require__(1139) }; /***/ }), -/* 367 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85122,20 +93377,20 @@ module.exports = { module.exports = { - In: __webpack_require__(977), - Out: __webpack_require__(976), - InOut: __webpack_require__(975) + In: __webpack_require__(1144), + Out: __webpack_require__(1143), + InOut: __webpack_require__(1142) }; /***/ }), -/* 368 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85145,20 +93400,20 @@ module.exports = { module.exports = { - In: __webpack_require__(980), - Out: __webpack_require__(979), - InOut: __webpack_require__(978) + In: __webpack_require__(1147), + Out: __webpack_require__(1146), + InOut: __webpack_require__(1145) }; /***/ }), -/* 369 */ +/* 402 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85168,20 +93423,20 @@ module.exports = { module.exports = { - In: __webpack_require__(983), - Out: __webpack_require__(982), - InOut: __webpack_require__(981) + In: __webpack_require__(1150), + Out: __webpack_require__(1149), + InOut: __webpack_require__(1148) }; /***/ }), -/* 370 */ +/* 403 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85191,26 +93446,26 @@ module.exports = { module.exports = { - Fade: __webpack_require__(986), - Flash: __webpack_require__(985), - Pan: __webpack_require__(984), - Shake: __webpack_require__(951), - Zoom: __webpack_require__(950) + Fade: __webpack_require__(1153), + Flash: __webpack_require__(1152), + Pan: __webpack_require__(1151), + Shake: __webpack_require__(1118), + Zoom: __webpack_require__(1117) }; /***/ }), -/* 371 */ +/* 404 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); /** * Converts a CSS 'web' string into a Phaser Color object. @@ -85247,16 +93502,16 @@ module.exports = RGBStringToColor; /***/ }), -/* 372 */ +/* 405 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); /** * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. @@ -85277,12 +93532,12 @@ module.exports = ObjectToColor; /***/ }), -/* 373 */ +/* 406 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85325,17 +93580,17 @@ module.exports = IntegerToRGB; /***/ }), -/* 374 */ +/* 407 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); -var IntegerToRGB = __webpack_require__(373); +var Color = __webpack_require__(32); +var IntegerToRGB = __webpack_require__(406); /** * Converts the given color value into an instance of a Color object. @@ -85358,12 +93613,12 @@ module.exports = IntegerToColor; /***/ }), -/* 375 */ +/* 408 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85446,12 +93701,12 @@ module.exports = RGBToHSV; /***/ }), -/* 376 */ +/* 409 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85477,16 +93732,16 @@ module.exports = GetColor32; /***/ }), -/* 377 */ +/* 410 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); /** * Converts a hex string into a Phaser Color object. @@ -85530,24 +93785,24 @@ module.exports = HexStringToColor; /***/ }), -/* 378 */ +/* 411 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(121); +var BaseCamera = __webpack_require__(131); var CanvasPool = __webpack_require__(24); -var CenterOn = __webpack_require__(175); +var CenterOn = __webpack_require__(189); var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var Effects = __webpack_require__(370); -var Linear = __webpack_require__(119); -var Rectangle = __webpack_require__(9); +var Components = __webpack_require__(13); +var Effects = __webpack_require__(403); +var Linear = __webpack_require__(129); +var Rectangle = __webpack_require__(10); var Vector2 = __webpack_require__(3); /** @@ -85779,7 +94034,7 @@ var Camera = new Class({ * * This is only set if Phaser is running with the WebGL Renderer. * - * @name Phaser.Cameras.Scene2D.Camera#framebuffer + * @name Phaser.Cameras.Scene2D.Camera#glTexture * @type {?WebGLTexture} * @since 3.13.0 */ @@ -86021,6 +94276,8 @@ var Camera = new Class({ * Fades the Camera in from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeIn + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -86043,6 +94300,8 @@ var Camera = new Class({ * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades. * * @method Phaser.Cameras.Scene2D.Camera#fadeOut + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -86064,6 +94323,8 @@ var Camera = new Class({ * Fades the Camera from the given color to transparent over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeFrom + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.5.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -86086,6 +94347,8 @@ var Camera = new Class({ * Fades the Camera from transparent to the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fade + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.0.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -86108,6 +94371,8 @@ var Camera = new Class({ * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#flash + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.0.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -86130,6 +94395,8 @@ var Camera = new Class({ * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#shake + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.0.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -86151,13 +94418,15 @@ var Camera = new Class({ * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#pan + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -86174,12 +94443,14 @@ var Camera = new Class({ * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#zoomTo + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -86199,10 +94470,9 @@ var Camera = new Class({ * @protected * @since 3.0.0 * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. + * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (baseScale, resolution) + preRender: function (resolution) { var width = this.width; var height = this.height; @@ -86210,7 +94480,7 @@ var Camera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * baseScale; + var zoom = this.zoom * resolution; var matrix = this.matrix; var originX = width * this.originX; @@ -86292,11 +94562,7 @@ var Camera = new Class({ displayHeight ); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); this.shakeEffect.preRender(); @@ -86496,17 +94762,18 @@ module.exports = Camera; /***/ }), -/* 379 */ +/* 412 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCache = __webpack_require__(380); +var BaseCache = __webpack_require__(414); var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(26); /** * @classdesc @@ -86650,7 +94917,7 @@ var CacheManager = new Class({ */ this.custom = {}; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -86719,18 +94986,41 @@ module.exports = CacheManager; /***/ }), -/* 380 */ +/* 413 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cache.Events + */ + +module.exports = { + + ADD: __webpack_require__(1175), + REMOVE: __webpack_require__(1174) + +}; + + +/***/ }), +/* 414 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(180); +var CustomMap = __webpack_require__(194); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(413); /** * @classdesc @@ -86772,23 +95062,12 @@ var BaseCache = new Class({ this.events = new EventEmitter(); }, - /** - * 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} cache - The BaseCache to which the object was added. - * @param {string} key - The key of the object added to the cache. - * @param {*} object - 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 + * @fires Phaser.Cache.Events#ADD * @since 3.0.0 * * @param {string} key - The unique key by which the data added to the cache will be referenced. @@ -86800,7 +95079,7 @@ var BaseCache = new Class({ { this.entries.set(key, data); - this.events.emit('add', this, key, data); + this.events.emit(Events.ADD, this, key, data); return this; }, @@ -86852,17 +95131,6 @@ var BaseCache = new Class({ 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} cache - The BaseCache from which the object was removed. - * @param {string} key - The key of the object removed from the cache. - * @param {*} object - The object that was removed from the cache. - */ - /** * Removes and item from this cache based on the given key. * @@ -86871,7 +95139,7 @@ var BaseCache = new Class({ * 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 + * @fires Phaser.Cache.Events#REMOVE * @since 3.0.0 * * @param {string} key - The unique key of the item to remove from the cache. @@ -86886,7 +95154,7 @@ var BaseCache = new Class({ { this.entries.delete(key); - this.events.emit('remove', this, key, entry.data); + this.events.emit(Events.REMOVE, this, key, entry.data); } return this; @@ -86913,28 +95181,23 @@ module.exports = BaseCache; /***/ }), -/* 381 */ +/* 415 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Animation = __webpack_require__(384); +var Animation = __webpack_require__(205); var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(180); +var CustomMap = __webpack_require__(194); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(136); +var GameEvents = __webpack_require__(26); var GetValue = __webpack_require__(4); -var Pad = __webpack_require__(179); - -/** - * @typedef {object} JSONAnimationManager - * - * @property {JSONAnimation[]} anims - [description] - * @property {number} globalTimeScale - [description] - */ +var Pad = __webpack_require__(193); /** * @classdesc @@ -86985,7 +95248,9 @@ var AnimationManager = new Class({ this.textureManager = null; /** - * [description] + * The global time scale of the Animation Manager. + * + * This scales the time delta between two frames, thus influencing the speed of time for the Animation Manager. * * @name Phaser.Animations.AnimationManager#globalTimeScale * @type {number} @@ -86995,7 +95260,9 @@ var AnimationManager = new Class({ this.globalTimeScale = 1; /** - * [description] + * The Animations registered in the Animation Manager. + * + * This map should be modified with the {@link #add} and {@link #create} methods of the Animation Manager. * * @name Phaser.Animations.AnimationManager#anims * @type {Phaser.Structs.Map.} @@ -87005,7 +95272,7 @@ var AnimationManager = new Class({ this.anims = new CustomMap(); /** - * [description] + * Whether the Animation Manager is paused along with all of its Animations. * * @name Phaser.Animations.AnimationManager#paused * @type {boolean} @@ -87015,7 +95282,7 @@ var AnimationManager = new Class({ this.paused = false; /** - * [description] + * The name of this Animation Manager. * * @name Phaser.Animations.AnimationManager#name * @type {string} @@ -87023,31 +95290,32 @@ var AnimationManager = new Class({ */ this.name = 'AnimationManager'; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** - * [description] + * Registers event listeners after the Game boots. * * @method Phaser.Animations.AnimationManager#boot + * @listens Phaser.Core.Events#DESTROY * @since 3.0.0 */ boot: function () { this.textureManager = this.game.textures; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * [description] + * Adds an existing Animation to the Animation Manager. * * @method Phaser.Animations.AnimationManager#add - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {string} key - [description] - * @param {Phaser.Animations.Animation} animation - [description] + * @param {string} key - The key under which the Animation should be added. The Animation will be updated with it. Must be unique. + * @param {Phaser.Animations.Animation} animation - The Animation which should be added to the Animation Manager. * * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ @@ -87055,7 +95323,8 @@ var AnimationManager = new Class({ { if (this.anims.has(key)) { - console.warn('Animation with key', key, 'already exists'); + console.warn('Animation key exists: ' + key); + return; } @@ -87063,48 +95332,79 @@ var AnimationManager = new Class({ this.anims.set(key, animation); - this.emit('add', key, animation); + this.emit(Events.ADD_ANIMATION, key, animation); return this; }, /** - * [description] + * Checks to see if the given key is already in use within the Animation Manager or not. + * + * Animations are global. Keys created in one scene can be used from any other Scene in your game. They are not Scene specific. + * + * @method Phaser.Animations.AnimationManager#exists + * @since 3.16.0 + * + * @param {string} key - The key of the Animation to check. + * + * @return {boolean} `true` if the Animation already exists in the Animation Manager, or `false` if the key is available. + */ + exists: function (key) + { + return this.anims.has(key); + }, + + /** + * Creates a new Animation and adds it to the Animation Manager. + * + * Animations are global. Once created, you can use them in any Scene in your game. They are not Scene specific. + * + * If an invalid key is given this method will return `false`. + * + * If you pass the key of an animation that already exists in the Animation Manager, that animation will be returned. + * + * A brand new animation is only created if the key is valid and not already in use. + * + * If you wish to re-use an existing key, call `AnimationManager.remove` first, then this method. * * @method Phaser.Animations.AnimationManager#create - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {AnimationConfig} config - [description] + * @param {Phaser.Animations.Types.Animation} config - The configuration settings for the Animation. * - * @return {Phaser.Animations.Animation} The Animation that was created. + * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` is the key is already in use. */ create: function (config) { var key = config.key; - if (!key || this.anims.has(key)) + var anim = false; + + if (key) { - console.warn('Invalid Animation Key, or Key already in use: ' + key); - return; + anim = this.get(key); + + if (!anim) + { + anim = new Animation(this, key, config); + + this.anims.set(key, anim); + + this.emit(Events.ADD_ANIMATION, key, anim); + } } - var anim = new Animation(this, key, config); - - this.anims.set(key, anim); - - this.emit('add', key, anim); - return anim; }, /** - * [description] + * Loads this Animation Manager's Animations and settings from a JSON object. * * @method Phaser.Animations.AnimationManager#fromJSON * @since 3.0.0 * - * @param {(string|JSONAnimationManager|JSONAnimation)} data - [description] + * @param {(string|Phaser.Animations.Types.JSONAnimations|Phaser.Animations.Types.JSONAnimation)} data - The JSON object to parse. * @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added. * * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. @@ -87148,29 +95448,15 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNamesConfig - * - * @property {string} [prefix=''] - [description] - * @property {integer} [start=0] - [description] - * @property {integer} [end=0] - [description] - * @property {string} [suffix=''] - [description] - * @property {integer} [zeroPad=0] - [description] - * @property {AnimationFrameConfig[]} [outputArray=[]] - [description] - * @property {boolean} [frames=false] - [description] - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with string frame names, as configured by the given {@link AnimationFrameConfig}. + * [description] * * @method Phaser.Animations.AnimationManager#generateFrameNames * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNamesConfig} [config] - The configuration object for the animation frame names. + * @param {Phaser.Animations.Types.GenerateFrameNames} [config] - The configuration object for the animation frame names. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNames: function (key, config) { @@ -87237,27 +95523,17 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNumbersConfig + * Generate an array of {@link Phaser.Animations.Types.AnimationFrame} objects from a texture key and configuration object. * - * @property {integer} [start=0] - The starting frame of the animation. - * @property {integer} [end=-1] - The ending frame of the animation. - * @property {(boolean|integer)} [first=false] - A frame to put at the beginning of the animation, before `start` or `outputArray` or `frames`. - * @property {AnimationFrameConfig[]} [outputArray=[]] - An array to concatenate the output onto. - * @property {(boolean|integer[])} [frames=false] - A custom sequence of frames. - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with numbered frame names, as configured by the given {@link GenerateFrameNumbersConfig}. + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Animations.Types.GenerateFrameNumbers}. * * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNumbersConfig} config - The configuration object for the animation frames. + * @param {Phaser.Animations.Types.GenerateFrameNumbers} config - The configuration object for the animation frames. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNumbers: function (key, config) { @@ -87337,7 +95613,7 @@ var AnimationManager = new Class({ * @param {string} key - The key of the animation to load. * @param {(string|integer)} [startFrame] - The name of a start frame to set on the loaded animation. * - * @return {Phaser.GameObjects.GameObject} [description] + * @return {Phaser.GameObjects.GameObject} The Game Object with the animation loaded into it. */ load: function (child, key, startFrame) { @@ -87355,7 +95631,7 @@ var AnimationManager = new Class({ * Pause all animations. * * @method Phaser.Animations.AnimationManager#pauseAll - * @fires PauseAllAnimationEvent + * @fires Phaser.Animations.Events#PAUSE_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -87366,7 +95642,7 @@ var AnimationManager = new Class({ { this.paused = true; - this.emit('pauseall'); + this.emit(Events.PAUSE_ALL); } return this; @@ -87409,7 +95685,7 @@ var AnimationManager = new Class({ * Remove an animation. * * @method Phaser.Animations.AnimationManager#remove - * @fires RemoveAnimationEvent + * @fires Phaser.Animations.Events#REMOVE_ANIMATION * @since 3.0.0 * * @param {string} key - The key of the animation to remove. @@ -87422,7 +95698,7 @@ var AnimationManager = new Class({ if (anim) { - this.emit('remove', key, anim); + this.emit(Events.REMOVE_ANIMATION, key, anim); this.anims.delete(key); } @@ -87434,7 +95710,7 @@ var AnimationManager = new Class({ * Resume all paused animations. * * @method Phaser.Animations.AnimationManager#resumeAll - * @fires ResumeAllAnimationEvent + * @fires Phaser.Animations.Events#RESUME_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -87445,7 +95721,7 @@ var AnimationManager = new Class({ { this.paused = false; - this.emit('resumeall'); + this.emit(Events.RESUME_ALL); } return this; @@ -87492,14 +95768,14 @@ var AnimationManager = new Class({ }, /** - * [description] + * Get the animation data as javascript object by giving key, or get the data of all animations as array of objects, if key wasn't provided. * * @method Phaser.Animations.AnimationManager#toJSON * @since 3.0.0 * * @param {string} key - [description] * - * @return {JSONAnimationManager} [description] + * @return {Phaser.Animations.Types.JSONAnimations} [description] */ toJSON: function (key) { @@ -87524,7 +95800,8 @@ var AnimationManager = new Class({ }, /** - * [description] + * Destroy this Animation Manager and clean up animation definitions and references to other objects. + * This method should not be called directly. It will be called automatically as a response to a `destroy` event from the Phaser.Game instance. * * @method Phaser.Animations.AnimationManager#destroy * @since 3.0.0 @@ -87544,1241 +95821,12 @@ module.exports = AnimationManager; /***/ }), -/* 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} - */ - -var Class = __webpack_require__(0); - -/** - * @typedef {object} JSONAnimationFrame - * - * @property {string} key - The key of the Texture this AnimationFrame uses. - * @property {(string|integer)} frame - The key of the Frame within the Texture that this AnimationFrame uses. - * @property {number} duration - Additional time (in ms) that this frame should appear for during playback. - */ - -/** - * @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({ - - initialize: - - 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; - - /** - * 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; - - /** - * The index of this AnimationFrame within the Animation sequence. - * - * @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; - - /** - * 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; - }, - - /** - * Generates a JavaScript object suitable for converting to JSON. - * - * @method Phaser.Animations.AnimationFrame#toJSON - * @since 3.0.0 - * - * @return {JSONAnimationFrame} 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; - } - -}); - -module.exports = AnimationFrame; - - -/***/ }), -/* 383 */ +/* 416 */ /***/ (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.Array.FindClosestInSorted - * @since 3.0.0 - * - * @param {number} value - The value to search for in the array. - * @param {array} array - The array to search, which must be sorted. - * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. - * - * @return {number|object} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. - */ -var FindClosestInSorted = function (value, array, key) -{ - if (!array.length) - { - return NaN; - } - else if (array.length === 1) - { - return array[0]; - } - - var i = 1; - var low; - var high; - - if (key) - { - if (value < array[0][key]) - { - return array[0]; - } - - while (array[i][key] < value) - { - i++; - } - } - else - { - while (array[i] < value) - { - i++; - } - } - - if (i > array.length) - { - i = array.length; - } - - if (key) - { - low = array[i - 1][key]; - high = array[i][key]; - - return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; - } - else - { - low = array[i - 1]; - high = array[i]; - - return ((high - value) <= (value - low)) ? high : low; - } -}; - -module.exports = FindClosestInSorted; - - -/***/ }), -/* 384 */ -/***/ (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 Clamp = __webpack_require__(23); -var Class = __webpack_require__(0); -var FindClosestInSorted = __webpack_require__(383); -var Frame = __webpack_require__(382); -var GetValue = __webpack_require__(4); - -/** - * @typedef {object} JSONAnimation - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {string} type - A frame based animation (as opposed to a bone based animation) - * @property {JSONAnimationFrame[]} frames - [description] - * @property {integer} frameRate - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} duration - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} skipMissedFrames - Skip frames if the time lags, or always advanced anyway? - * @property {integer} delay - Delay before starting playback. Value given in milliseconds. - * @property {integer} repeat - Number of times to repeat the animation (-1 for infinity) - * @property {integer} repeatDelay - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} yoyo - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} showOnStart - Should sprite.visible = true when the animation starts to play? - * @property {boolean} hideOnComplete - Should sprite.visible = false when the animation finishes? - */ - -/** - * @typedef {object} AnimationFrameConfig - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {(string|number)} frame - [description] - * @property {number} [duration=0] - [description] - * @property {boolean} [visible] - [description] - */ - -/** - * @typedef {object} AnimationConfig - * - * @property {string} [key] - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {AnimationFrameConfig[]} [frames] - An object containing data used to generate the frames for the animation - * @property {string} [defaultTextureKey=null] - The key of the texture all frames of the animation will use. Can be overridden on a per frame basis. - * @property {integer} [frameRate] - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} [duration] - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} [skipMissedFrames=true] - Skip frames if the time lags, or always advanced anyway? - * @property {integer} [delay=0] - Delay before starting playback. Value given in milliseconds. - * @property {integer} [repeat=0] - Number of times to repeat the animation (-1 for infinity) - * @property {integer} [repeatDelay=0] - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? - * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? - */ - -/** - * @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. - * - * @class Animation - * @memberof Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationManager} manager - [description] - * @param {string} key - [description] - * @param {AnimationConfig} config - [description] - */ -var Animation = new Class({ - - initialize: - - function Animation (manager, key, config) - { - /** - * A reference to the global Animation Manager - * - * @name Phaser.Animations.Animation#manager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.manager = manager; - - /** - * The unique identifying string for this animation - * - * @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 {Phaser.Animations.AnimationFrame[]} - * @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, in milliseconds. - * If the `frameRate` property has been set then it overrides this value, - * otherwise the `frameRate` is derived from `duration`. - * - * @name Phaser.Animations.Animation#duration - * @type {integer} - * @since 3.0.0 - */ - 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) * 1000; - } - 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 = 4000 ms - // So frameRate is 12 / (4000 / 1000) = 3 fps - this.frameRate = this.frames.length / (this.duration / 1000); - } - 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 * 1000 (half a second, or 500ms) - this.duration = (this.frames.length / this.frameRate) * 1000; - } - - /** - * How many ms per frame, not including frame specific modifiers. - * - * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} - * @since 3.0.0 - */ - this.msPerFrame = 1000 / this.frameRate; - - /** - * 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); - - /** - * The delay in ms before the playback will begin. - * - * @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. Set to -1 to repeat forever. - * - * @name Phaser.Animations.Animation#repeat - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeat = GetValue(config, 'repeat', 0); - - /** - * The delay in ms before the a repeat playthrough starts. - * - * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = GetValue(config, 'repeatDelay', 0); - - /** - * 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); - - /** - * 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); - - /** - * 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); - - /** - * Global pause. All Game Objects using this Animation instance are impacted by this property. - * - * @name Phaser.Animations.Animation#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - this.manager.on('pauseall', this.pause, this); - this.manager.on('resumeall', this.resume, this); - }, - - /** - * Add frames to the end of the animation. - * - * @method Phaser.Animations.Animation#addFrame - * @since 3.0.0 - * - * @param {(string|AnimationFrameConfig[])} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrame: function (config) - { - return this.addFrameAt(this.frames.length, config); - }, - - /** - * Add frame/s into the animation. - * - * @method Phaser.Animations.Animation#addFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * @param {(string|AnimationFrameConfig[])} 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); - } - - this.updateFrameSequence(); - } - - return this; - }, - - /** - * Check if the given frame index is valid. - * - * @method Phaser.Animations.Animation#checkFrame - * @since 3.0.0 - * - * @param {integer} index - The index to be checked. - * - * @return {boolean} `true` if the index is valid, otherwise `false`. - */ - checkFrame: function (index) - { - return (index >= 0 && index < this.frames.length); - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#completeAnimation - * @protected - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - completeAnimation: function (component) - { - if (this.hideOnComplete) - { - component.parent.visible = false; - } - - component.stop(); - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#getFirstTick - * @protected - * @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) - { - component.nextTick += component._delay; - } - }, - - /** - * Returns the AnimationFrame at the provided index - * - * @method Phaser.Animations.Animation#getFrameAt - * @protected - * @since 3.0.0 - * - * @param {integer} index - The index in the AnimationFrame array - * - * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence - */ - getFrameAt: function (index) - { - return this.frames[index]; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#getFrames - * @since 3.0.0 - * - * @param {Phaser.Textures.TextureManager} textureManager - [description] - * @param {(string|AnimationFrameConfig[])} frames - [description] - * @param {string} [defaultTextureKey] - [description] - * - * @return {Phaser.Animations.AnimationFrame[]} [description] - */ - getFrames: function (textureManager, frames, defaultTextureKey) - { - 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.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.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 - - // When is the next update due? - component.accumulator -= component.nextTick; - - component.nextTick = component.msPerFrame + component.currentFrame.duration; - }, - - /** - * Loads the Animation values into the Animation Component. - * - * @method Phaser.Animations.Animation#load - * @private - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to load values into. - * @param {integer} startFrame - The start frame of the animation to load. - */ - load: function (component, startFrame) - { - if (startFrame >= this.frames.length) - { - startFrame = 0; - } - - if (component.currentAnim !== this) - { - component.currentAnim = this; - - 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; - } - - var frame = this.frames[startFrame]; - - if (startFrame === 0 && !component.forward) - { - frame = this.getLastFrame(); - } - - component.updateFrame(frame); - }, - - /** - * Returns the frame closest to the given progress value between 0 and 1. - * - * @method Phaser.Animations.Animation#getFrameByProgress - * @since 3.4.0 - * - * @param {number} value - A value between 0 and 1. - * - * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. - */ - getFrameByProgress: function (value) - { - value = Clamp(value, 0, 1); - - return FindClosestInSorted(value, this.frames, 'progress'); - }, - - /** - * Advance the animation frame. - * - * @method Phaser.Animations.Animation#nextFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. - */ - nextFrame: function (component) - { - var frame = component.currentFrame; - - // TODO: Add frame skip support - - if (frame.isLast) - { - // We're at the end of the animation - - // Yoyo? (happens before repeat) - if (component._yoyo) - { - this.handleYoyoFrame(component, false); - } - else if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - - if (component._reverse && component.forward) - { - component.forward = false; - } - else - { - this.repeatAnimation(component); - } - } - else - { - this.completeAnimation(component); - } - } - else - { - this.updateAndGetNextTick(component, frame.nextFrame); - } - }, - - /** - * Handle the yoyo functionality in nextFrame and previousFrame methods. - * - * @method Phaser.Animations.Animation#handleYoyoFrame - * @private - * @since 3.12.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. - * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) - */ - handleYoyoFrame: function (component, isReverse) - { - if (!isReverse) { isReverse = false; } - - if (component._reverse === !isReverse && component.repeatCounter > 0) - { - component.forward = isReverse; - - this.repeatAnimation(component); - - return; - } - - if (component._reverse !== isReverse && component.repeatCounter === 0) - { - this.completeAnimation(component); - - return; - } - - component.forward = isReverse; - - var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; - - this.updateAndGetNextTick(component, frame); - }, - - /** - * Returns the animation last frame. - * - * @method Phaser.Animations.Animation#getLastFrame - * @since 3.12.0 - * - * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. - */ - getLastFrame: function () - { - return this.frames[this.frames.length - 1]; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#previousFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - previousFrame: function (component) - { - var frame = component.currentFrame; - - // TODO: Add frame skip support - - if (frame.isFirst) - { - // We're at the start of the animation - - if (component._yoyo) - { - this.handleYoyoFrame(component, true); - } - else if (component.repeatCounter > 0) - { - if (component._reverse && !component.forward) - { - component.currentFrame = this.getLastFrame(); - this.repeatAnimation(component); - } - else - { - // Repeat (happens before complete) - component.forward = true; - this.repeatAnimation(component); - } - } - else - { - this.completeAnimation(component); - } - } - else - { - this.updateAndGetNextTick(component, frame.prevFrame); - } - }, - - /** - * Update Frame and Wait next tick. - * - * @method Phaser.Animations.Animation#updateAndGetNextTick - * @private - * @since 3.12.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. - */ - updateAndGetNextTick: function (component, frame) - { - component.updateFrame(frame); - - this.getNextTick(component); - }, - - /** - * [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); - } - - return this; - }, - - /** - * Removes a frame from the AnimationFrame array at the provided index - * and updates the animation accordingly. - * - * @method Phaser.Animations.Animation#removeFrameAt - * @since 3.0.0 - * - * @param {integer} index - The index in the AnimationFrame array - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrameAt: function (index) - { - this.frames.splice(index, 1); - - this.updateFrameSequence(); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#repeatAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - repeatAnimation: function (component) - { - if (component._pendingStop === 2) - { - return this.completeAnimation(component); - } - - if (component._repeatDelay > 0 && component.pendingRepeat === false) - { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += component._repeatDelay; - } - else - { - component.repeatCounter--; - - component.updateFrame(component.currentFrame[(component.forward) ? 'nextFrame' : 'prevFrame']); - - if (component.isPlaying) - { - this.getNextTick(component); - - component.pendingRepeat = false; - - component.parent.emit('animationrepeat', this, component.currentFrame, component.repeatCounter, component.parent); - } - } - }, - - /** - * [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 {JSONAnimation} [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; - }, - - /** - * [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); - - 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; - }, - - /** - * [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 () - { - this.manager.off('pauseall', this.pause, this); - this.manager.off('resumeall', this.resume, this); - - this.manager.remove(this.key); - - for (var i = 0; i < this.frames.length; i++) - { - this.frames[i].destroy(); - } - - this.frames = []; - - this.manager = null; - } - -}); - -module.exports = Animation; - - -/***/ }), -/* 385 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -88847,12 +95895,12 @@ module.exports = BresenhamPoints; /***/ }), -/* 386 */ +/* 417 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -88887,12 +95935,12 @@ module.exports = RotateRight; /***/ }), -/* 387 */ +/* 418 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -88927,16 +95975,16 @@ module.exports = RotateLeft; /***/ }), -/* 388 */ +/* 419 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(124); +var Perimeter = __webpack_require__(135); var Point = __webpack_require__(6); // Return an array of points from the perimeter of the rectangle @@ -89047,12 +96095,36 @@ module.exports = MarchingAnts; /***/ }), -/* 389 */ +/* 420 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data.Events + */ + +module.exports = { + + CHANGE_DATA: __webpack_require__(1238), + CHANGE_DATA_KEY: __webpack_require__(1237), + REMOVE_DATA: __webpack_require__(1236), + SET_DATA: __webpack_require__(1235) + +}; + + +/***/ }), +/* 421 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89136,19 +96208,19 @@ module.exports = Visible; /***/ }), -/* 390 */ +/* 422 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var TransformMatrix = __webpack_require__(38); -var WrapAngle = __webpack_require__(199); -var WrapAngleDegrees = __webpack_require__(198); +var MATH_CONST = __webpack_require__(20); +var TransformMatrix = __webpack_require__(41); +var WrapAngle = __webpack_require__(214); +var WrapAngleDegrees = __webpack_require__(213); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -89399,8 +96471,8 @@ var Transform = { { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } this.x = x + (Math.random() * width); this.y = y + (Math.random() * height); @@ -89604,12 +96676,12 @@ module.exports = Transform; /***/ }), -/* 391 */ +/* 423 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89691,12 +96763,12 @@ module.exports = ToJSON; /***/ }), -/* 392 */ +/* 424 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89798,12 +96870,12 @@ module.exports = ScrollFactor; /***/ }), -/* 393 */ +/* 425 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89811,11 +96883,21 @@ var Class = __webpack_require__(0); /** * @classdesc - * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect a visible pixel from the geometry mask. The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity). - * - * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and alpha of the pixel from the Geometry Mask do not matter. - * - * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. Moving or transforming the underlying Graphics object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask. You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed in front of all masked objects which has its own visual properties and, naturally, respects the camera's visual properties, but isn't affected by and doesn't follow the masked objects by itself. + * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect + * a visible pixel from the geometry mask. The mask is essentially a clipping path which can only + * make a masked pixel fully visible or fully invisible without changing its alpha (opacity). + * + * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) + * should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed + * if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and + * alpha of the pixel from the Geometry Mask do not matter. + * + * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. + * Moving or transforming the underlying Graphics object will change the mask (and affect the visibility + * of any masked objects), whereas moving or transforming a masked object will not affect the mask. + * You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed + * in front of all masked objects which has its own visual properties and, naturally, respects the camera's + * visual properties, but isn't affected by and doesn't follow the masked objects by itself. * * @class GeometryMask * @memberof Phaser.Display.Masks @@ -89839,6 +96921,16 @@ var GeometryMask = new Class({ * @since 3.0.0 */ this.geometryMask = graphicsGeometry; + + /** + * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels + * drawn to the Geometry Mask. + * + * @name Phaser.Display.Masks.GeometryMask#invertAlpha + * @type {boolean} + * @since 3.16.0 + */ + this.invertAlpha = false; }, /** @@ -89880,12 +96972,22 @@ var GeometryMask = new Class({ gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); + geometryMask.renderWebGL(renderer, geometryMask, 0, camera); + renderer.flush(); // Use stencil buffer to affect next rendering object gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, 1, 1); + + if (this.invertAlpha) + { + gl.stencilFunc(gl.NOTEQUAL, 1, 1); + } + else + { + gl.stencilFunc(gl.EQUAL, 1, 1); + } + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); }, @@ -89943,7 +97045,7 @@ var GeometryMask = new Class({ /** * Destroys this GeometryMask and nulls any references it holds. - * + * * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, * so be sure to call `clearMask` on any Game Object using it, before destroying it. * @@ -89961,12 +97063,12 @@ module.exports = GeometryMask; /***/ }), -/* 394 */ +/* 426 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89974,14 +97076,37 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. + * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, + * not a clipping path. It is only available when using the WebGL Renderer. + * + * A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). + * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha + * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the + * Bitmap Mask doesn't matter. + * + * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an + * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means + * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects + * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the + * corresponding pixel in the mask. + * + * The Bitmap Mask's location matches the location of its Game Object, not the location of the + * masked objects. Moving or transforming the underlying Game Object will change the mask + * (and affect the visibility of any masked objects), whereas moving or transforming a masked object + * will not affect the mask. + * + * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a + * Scene's display list, it will only be used for the mask and its full texture will not be directly + * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will + * render as a normal Game Object and will also serve as a mask. * * @class BitmapMask * @memberof Phaser.Display.Masks * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which this Bitmap Mask will be used in. * @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite. */ var BitmapMask = new Class({ @@ -90011,7 +97136,7 @@ var BitmapMask = new Class({ this.bitmapMask = renderable; /** - * [description] + * The texture used for the mask's framebuffer. * * @name Phaser.Display.Masks.BitmapMask#maskTexture * @type {WebGLTexture} @@ -90021,7 +97146,7 @@ var BitmapMask = new Class({ this.maskTexture = null; /** - * [description] + * The texture used for the main framebuffer. * * @name Phaser.Display.Masks.BitmapMask#mainTexture * @type {WebGLTexture} @@ -90031,7 +97156,7 @@ var BitmapMask = new Class({ this.mainTexture = null; /** - * [description] + * Whether the Bitmap Mask is dirty and needs to be updated. * * @name Phaser.Display.Masks.BitmapMask#dirty * @type {boolean} @@ -90041,7 +97166,7 @@ var BitmapMask = new Class({ this.dirty = true; /** - * [description] + * The framebuffer to which a masked Game Object is rendered. * * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer * @type {WebGLFramebuffer} @@ -90050,7 +97175,7 @@ var BitmapMask = new Class({ this.mainFramebuffer = null; /** - * [description] + * The framebuffer to which the Bitmap Mask's masking Game Object is rendered. * * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer * @type {WebGLFramebuffer} @@ -90059,7 +97184,9 @@ var BitmapMask = new Class({ this.maskFramebuffer = null; /** - * [description] + * Whether to invert the mask's alpha. + * + * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. * * @name Phaser.Display.Masks.BitmapMask#invertAlpha * @type {boolean} @@ -90100,7 +97227,7 @@ var BitmapMask = new Class({ }, /** - * [description] + * Sets a new masking Game Object for the Bitmap Mask. * * @method Phaser.Display.Masks.BitmapMask#setBitmap * @since 3.0.0 @@ -90113,13 +97240,15 @@ var BitmapMask = new Class({ }, /** - * [description] + * Prepares the WebGL Renderer to render a Game Object with this mask applied. + * + * This renders the masking Game Object to the mask framebuffer and switches to the main framebuffer so that the masked Game Object will be rendered to it instead of being rendered directly to the frame. * * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] - * @param {Phaser.GameObjects.GameObject} maskedObject - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to prepare. + * @param {Phaser.GameObjects.GameObject} maskedObject - The masked Game Object which will be drawn. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ preRenderWebGL: function (renderer, maskedObject, camera) @@ -90128,12 +97257,14 @@ var BitmapMask = new Class({ }, /** - * [description] + * Finalizes rendering of a masked Game Object. + * + * This resets the previously bound framebuffer and switches the WebGL Renderer to the Bitmap Mask Pipeline, which uses a special fragment shader to apply the masking effect. * * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to clean up. */ postRenderWebGL: function (renderer) { @@ -90141,13 +97272,13 @@ var BitmapMask = new Class({ }, /** - * [description] + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] - * @param {Phaser.GameObjects.GameObject} mask - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + * @param {Phaser.GameObjects.GameObject} mask - The masked Game Object which would be rendered. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ preRenderCanvas: function () @@ -90156,12 +97287,12 @@ var BitmapMask = new Class({ }, /** - * [description] + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. */ postRenderCanvas: function () { @@ -90204,17 +97335,17 @@ module.exports = BitmapMask; /***/ }), -/* 395 */ +/* 427 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapMask = __webpack_require__(394); -var GeometryMask = __webpack_require__(393); +var BitmapMask = __webpack_require__(426); +var GeometryMask = __webpack_require__(425); /** * Provides methods used for getting and setting the mask of a Game Object. @@ -90351,12 +97482,12 @@ module.exports = Mask; /***/ }), -/* 396 */ +/* 428 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -90391,12 +97522,12 @@ module.exports = RotateAround; /***/ }), -/* 397 */ +/* 429 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -90430,17 +97561,17 @@ module.exports = GetPoint; /***/ }), -/* 398 */ +/* 430 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetPoint = __webpack_require__(190); -var Perimeter = __webpack_require__(124); +var GetPoint = __webpack_require__(204); +var Perimeter = __webpack_require__(135); // Return an array of points from the perimeter of the rectangle // each spaced out based on the quantity or step required @@ -90454,8 +97585,8 @@ var Perimeter = __webpack_require__(124); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. - * @param {number} step - [description] - * @param {integer} quantity - [description] + * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsy. Ignored if quantity is positive. + * @param {integer} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsy, step param will be used to calculate the number of points. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. * * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. @@ -90484,12 +97615,12 @@ module.exports = GetPoints; /***/ }), -/* 399 */ +/* 431 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -90577,16 +97708,16 @@ module.exports = Depth; /***/ }), -/* 400 */ +/* 432 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); +var BlendModes = __webpack_require__(60); /** * Provides methods used for setting the blend mode of a Game Object. @@ -90619,6 +97750,7 @@ var BlendMode = { * * ADD * * MULTIPLY * * SCREEN + * * ERASE * * Canvas has more available depending on browser support. * @@ -90667,6 +97799,7 @@ var BlendMode = { * * ADD * * MULTIPLY * * SCREEN + * * ERASE (only works when rendering to a framebuffer, like a Render Texture) * * Canvas has more available depending on browser support. * @@ -90674,7 +97807,7 @@ var BlendMode = { * * 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 + * reasons try to be careful about the construction of your Scene and the frequency in which blend modes * are used. * * @method Phaser.GameObjects.Components.BlendMode#setBlendMode @@ -90697,12 +97830,270 @@ module.exports = BlendMode; /***/ }), -/* 401 */ +/* 433 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +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 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({ + + initialize: + + 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; + + /** + * 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; + + /** + * The index of this AnimationFrame within the Animation sequence. + * + * @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; + + /** + * 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; + }, + + /** + * Generates a JavaScript object suitable for converting to JSON. + * + * @method Phaser.Animations.AnimationFrame#toJSON + * @since 3.0.0 + * + * @return {Phaser.Animations.Types.JSONAnimationFrame} 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; + } + +}); + +module.exports = AnimationFrame; + + +/***/ }), +/* 434 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Searches a pre-sorted array for the closet value to the given number. + * + * If the `key` argument is given it will assume the array contains objects that all have the required `key` property name, + * and will check for the closest value of those to the given number. + * + * @function Phaser.Utils.Array.FindClosestInSorted + * @since 3.0.0 + * + * @param {number} value - The value to search for in the array. + * @param {array} array - The array to search, which must be sorted. + * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. + * + * @return {(number|any)} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. + */ +var FindClosestInSorted = function (value, array, key) +{ + if (!array.length) + { + return NaN; + } + else if (array.length === 1) + { + return array[0]; + } + + var i = 1; + var low; + var high; + + if (key) + { + if (value < array[0][key]) + { + return array[0]; + } + + while (array[i][key] < value) + { + i++; + } + } + else + { + while (array[i] < value) + { + i++; + } + } + + if (i > array.length) + { + i = array.length; + } + + if (key) + { + low = array[i - 1][key]; + high = array[i][key]; + + return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; + } + else + { + low = array[i - 1]; + high = array[i]; + + return ((high - value) <= (value - low)) ? high : low; + } +}; + +module.exports = FindClosestInSorted; + + +/***/ }), +/* 435 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -90992,12 +98383,12 @@ module.exports = Alpha; /***/ }), -/* 402 */ +/* 436 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -91020,19 +98411,19 @@ module.exports = Circumference; /***/ }), -/* 403 */ +/* 437 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(402); -var CircumferencePoint = __webpack_require__(192); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var Circumference = __webpack_require__(436); +var CircumferencePoint = __webpack_require__(207); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); /** * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, @@ -91072,517 +98463,18 @@ module.exports = GetPoints; /***/ }), -/* 404 */ +/* 438 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); - -/** - * @classdesc - * A seeded Random Data Generator. - * - * Access via `Phaser.Math.RND` which is an instance of this class pre-defined - * by Phaser. Or, create your own instance to use as you require. - * - * The `Math.RND` generator is seeded by the Game Config property value `seed`. - * If no such config property exists, a random number is used. - * - * If you create your own instance of this class you should provide a seed for it. - * If no seed is given it will use a 'random' one based on Date.now. - * - * @class RandomDataGenerator - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. - */ -var RandomDataGenerator = new Class({ - - initialize: - - function RandomDataGenerator (seeds) - { - if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } - - /** - * 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; - - /** - * Signs to choose from. - * - * @name Phaser.Math.RandomDataGenerator#signs - * @type {number[]} - * @since 3.0.0 - */ - this.signs = [ -1, 1 ]; - - if (seeds) - { - this.init(seeds); - } - }, - - /** - * Private random helper. - * - * @method Phaser.Math.RandomDataGenerator#rnd - * @since 3.0.0 - * @private - * - * @return {number} A random number. - */ - rnd: function () - { - 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 {string} data - The value to hash. - * - * @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++) - { - 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 - }, - - /** - * Initialize the state of the random data generator. - * - * @method Phaser.Math.RandomDataGenerator#init - * @since 3.0.0 - * - * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. - */ - 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 {string[]} 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 {*} 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 {*} 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(','); - }, - - /** - * Shuffles the given array, using the current seed. - * - * @method Phaser.Math.RandomDataGenerator#shuffle - * @since 3.7.0 - * - * @param {array} [array] - The array to be shuffled. - * - * @return {array} The shuffled array. - */ - shuffle: function (array) - { - var len = array.length - 1; - - for (var i = len; i > 0; i--) - { - var randomIndex = Math.floor(this.frac() * (len + 1)); - var itemAtIndex = array[randomIndex]; - - array[randomIndex] = array[i]; - array[i] = itemAtIndex; - } - - return array; - } - -}); - -module.exports = RandomDataGenerator; - - -/***/ }), -/* 405 */ -/***/ (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__(192); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var CircumferencePoint = __webpack_require__(207); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); var Point = __webpack_require__(6); /** @@ -91614,19 +98506,19 @@ module.exports = GetPoint; /***/ }), -/* 406 */ +/* 439 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(44); -var GetTop = __webpack_require__(42); -var SetRight = __webpack_require__(43); -var SetTop = __webpack_require__(41); +var GetRight = __webpack_require__(47); +var GetTop = __webpack_require__(45); +var SetRight = __webpack_require__(46); +var SetTop = __webpack_require__(44); /** * Takes given Game Object and aligns it so that it is positioned in the top right of the other. @@ -91658,19 +98550,19 @@ module.exports = TopRight; /***/ }), -/* 407 */ +/* 440 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(46); -var GetTop = __webpack_require__(42); -var SetLeft = __webpack_require__(45); -var SetTop = __webpack_require__(41); +var GetLeft = __webpack_require__(49); +var GetTop = __webpack_require__(45); +var SetLeft = __webpack_require__(48); +var SetTop = __webpack_require__(44); /** * Takes given Game Object and aligns it so that it is positioned in the top left of the other. @@ -91702,19 +98594,19 @@ module.exports = TopLeft; /***/ }), -/* 408 */ +/* 441 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterX = __webpack_require__(75); -var GetTop = __webpack_require__(42); -var SetCenterX = __webpack_require__(74); -var SetTop = __webpack_require__(41); +var GetCenterX = __webpack_require__(81); +var GetTop = __webpack_require__(45); +var SetCenterX = __webpack_require__(80); +var SetTop = __webpack_require__(44); /** * Takes given Game Object and aligns it so that it is positioned in the top center of the other. @@ -91746,19 +98638,19 @@ module.exports = TopCenter; /***/ }), -/* 409 */ +/* 442 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(72); -var GetRight = __webpack_require__(44); -var SetCenterY = __webpack_require__(73); -var SetRight = __webpack_require__(43); +var GetCenterY = __webpack_require__(78); +var GetRight = __webpack_require__(47); +var SetCenterY = __webpack_require__(79); +var SetRight = __webpack_require__(46); /** * Takes given Game Object and aligns it so that it is positioned in the right center of the other. @@ -91790,19 +98682,19 @@ module.exports = RightCenter; /***/ }), -/* 410 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(72); -var GetLeft = __webpack_require__(46); -var SetCenterY = __webpack_require__(73); -var SetLeft = __webpack_require__(45); +var GetCenterY = __webpack_require__(78); +var GetLeft = __webpack_require__(49); +var SetCenterY = __webpack_require__(79); +var SetLeft = __webpack_require__(48); /** * Takes given Game Object and aligns it so that it is positioned in the left center of the other. @@ -91834,17 +98726,17 @@ module.exports = LeftCenter; /***/ }), -/* 411 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetCenterX = __webpack_require__(74); -var SetCenterY = __webpack_require__(73); +var SetCenterX = __webpack_require__(80); +var SetCenterY = __webpack_require__(79); /** * Positions the Game Object so that it is centered on the given coordinates. @@ -91871,18 +98763,18 @@ module.exports = CenterOn; /***/ }), -/* 412 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(411); -var GetCenterX = __webpack_require__(75); -var GetCenterY = __webpack_require__(72); +var CenterOn = __webpack_require__(444); +var GetCenterX = __webpack_require__(81); +var GetCenterY = __webpack_require__(78); /** * Takes given Game Object and aligns it so that it is positioned in the center of the other. @@ -91913,19 +98805,19 @@ module.exports = Center; /***/ }), -/* 413 */ +/* 446 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(48); -var GetRight = __webpack_require__(44); -var SetBottom = __webpack_require__(47); -var SetRight = __webpack_require__(43); +var GetBottom = __webpack_require__(51); +var GetRight = __webpack_require__(47); +var SetBottom = __webpack_require__(50); +var SetRight = __webpack_require__(46); /** * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. @@ -91957,19 +98849,19 @@ module.exports = BottomRight; /***/ }), -/* 414 */ +/* 447 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(48); -var GetLeft = __webpack_require__(46); -var SetBottom = __webpack_require__(47); -var SetLeft = __webpack_require__(45); +var GetBottom = __webpack_require__(51); +var GetLeft = __webpack_require__(49); +var SetBottom = __webpack_require__(50); +var SetLeft = __webpack_require__(48); /** * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. @@ -92001,19 +98893,19 @@ module.exports = BottomLeft; /***/ }), -/* 415 */ +/* 448 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(48); -var GetCenterX = __webpack_require__(75); -var SetBottom = __webpack_require__(47); -var SetCenterX = __webpack_require__(74); +var GetBottom = __webpack_require__(51); +var GetCenterX = __webpack_require__(81); +var SetBottom = __webpack_require__(50); +var SetCenterX = __webpack_require__(80); /** * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. @@ -92045,28 +98937,28 @@ module.exports = BottomCenter; /***/ }), -/* 416 */ +/* 449 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ALIGN_CONST = __webpack_require__(193); +var ALIGN_CONST = __webpack_require__(208); var AlignInMap = []; -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(415); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(414); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(413); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(412); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(410); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(409); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(408); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(407); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(406); +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(448); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(447); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(446); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(445); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(443); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(442); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(441); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(440); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(439); /** * Takes given Game Object and aligns it so that it is positioned relative to the other. @@ -92094,12 +98986,12 @@ module.exports = QuickSet; /***/ }), -/* 417 */ +/* 450 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -92109,75 +99001,75 @@ module.exports = QuickSet; module.exports = { - Angle: __webpack_require__(1050), - Call: __webpack_require__(1049), - GetFirst: __webpack_require__(1048), - GetLast: __webpack_require__(1047), - GridAlign: __webpack_require__(1046), - IncAlpha: __webpack_require__(1035), - IncX: __webpack_require__(1034), - IncXY: __webpack_require__(1033), - IncY: __webpack_require__(1032), - PlaceOnCircle: __webpack_require__(1031), - PlaceOnEllipse: __webpack_require__(1030), - PlaceOnLine: __webpack_require__(1029), - PlaceOnRectangle: __webpack_require__(1028), - PlaceOnTriangle: __webpack_require__(1027), - PlayAnimation: __webpack_require__(1026), - PropertyValueInc: __webpack_require__(32), - PropertyValueSet: __webpack_require__(25), - RandomCircle: __webpack_require__(1025), - RandomEllipse: __webpack_require__(1024), - RandomLine: __webpack_require__(1023), - RandomRectangle: __webpack_require__(1022), - RandomTriangle: __webpack_require__(1021), - Rotate: __webpack_require__(1020), - RotateAround: __webpack_require__(1019), - RotateAroundDistance: __webpack_require__(1018), - ScaleX: __webpack_require__(1017), - ScaleXY: __webpack_require__(1016), - ScaleY: __webpack_require__(1015), - SetAlpha: __webpack_require__(1014), - SetBlendMode: __webpack_require__(1013), - SetDepth: __webpack_require__(1012), - SetHitArea: __webpack_require__(1011), - SetOrigin: __webpack_require__(1010), - SetRotation: __webpack_require__(1009), - SetScale: __webpack_require__(1008), - SetScaleX: __webpack_require__(1007), - SetScaleY: __webpack_require__(1006), - SetTint: __webpack_require__(1005), - SetVisible: __webpack_require__(1004), - SetX: __webpack_require__(1003), - SetXY: __webpack_require__(1002), - SetY: __webpack_require__(1001), - ShiftPosition: __webpack_require__(1000), - Shuffle: __webpack_require__(999), - SmootherStep: __webpack_require__(998), - SmoothStep: __webpack_require__(997), - Spread: __webpack_require__(996), - ToggleVisible: __webpack_require__(995), - WrapInRectangle: __webpack_require__(994) + Angle: __webpack_require__(1271), + Call: __webpack_require__(1270), + GetFirst: __webpack_require__(1269), + GetLast: __webpack_require__(1268), + GridAlign: __webpack_require__(1267), + IncAlpha: __webpack_require__(1233), + IncX: __webpack_require__(1232), + IncXY: __webpack_require__(1231), + IncY: __webpack_require__(1230), + PlaceOnCircle: __webpack_require__(1229), + PlaceOnEllipse: __webpack_require__(1228), + PlaceOnLine: __webpack_require__(1227), + PlaceOnRectangle: __webpack_require__(1226), + PlaceOnTriangle: __webpack_require__(1225), + PlayAnimation: __webpack_require__(1224), + PropertyValueInc: __webpack_require__(35), + PropertyValueSet: __webpack_require__(27), + RandomCircle: __webpack_require__(1223), + RandomEllipse: __webpack_require__(1222), + RandomLine: __webpack_require__(1221), + RandomRectangle: __webpack_require__(1220), + RandomTriangle: __webpack_require__(1219), + Rotate: __webpack_require__(1218), + RotateAround: __webpack_require__(1217), + RotateAroundDistance: __webpack_require__(1216), + ScaleX: __webpack_require__(1215), + ScaleXY: __webpack_require__(1214), + ScaleY: __webpack_require__(1213), + SetAlpha: __webpack_require__(1212), + SetBlendMode: __webpack_require__(1211), + SetDepth: __webpack_require__(1210), + SetHitArea: __webpack_require__(1209), + SetOrigin: __webpack_require__(1208), + SetRotation: __webpack_require__(1207), + SetScale: __webpack_require__(1206), + SetScaleX: __webpack_require__(1205), + SetScaleY: __webpack_require__(1204), + SetTint: __webpack_require__(1203), + SetVisible: __webpack_require__(1202), + SetX: __webpack_require__(1201), + SetXY: __webpack_require__(1200), + SetY: __webpack_require__(1199), + ShiftPosition: __webpack_require__(1198), + Shuffle: __webpack_require__(1197), + SmootherStep: __webpack_require__(1196), + SmoothStep: __webpack_require__(1195), + Spread: __webpack_require__(1194), + ToggleVisible: __webpack_require__(1193), + WrapInRectangle: __webpack_require__(1192) }; /***/ }), -/* 418 */, -/* 419 */, -/* 420 */ +/* 451 */, +/* 452 */, +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(895); -var TextureTintPipeline = __webpack_require__(196); +var ShaderSourceFS = __webpack_require__(1042); +var TextureTintPipeline = __webpack_require__(211); var LIGHT_COUNT = 10; @@ -92193,7 +99085,7 @@ var LIGHT_COUNT = 10; * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration of the pipeline, same as the {@link Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline}. The fragment shader will be replaced with the lighting shader. */ var ForwardDiffuseLightPipeline = new Class({ @@ -92218,6 +99110,20 @@ var ForwardDiffuseLightPipeline = new Class({ * @since 3.11.0 */ this.defaultNormalMap; + + /** + * Inverse rotation matrix for normal map rotations. + * + * @name Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#inverseRotationMatrix + * @type {Float32Array} + * @private + * @since 3.16.0 + */ + this.inverseRotationMatrix = new Float32Array([ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + ]); }, /** @@ -92272,8 +99178,8 @@ var ForwardDiffuseLightPipeline = new Class({ * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#onRender * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. */ @@ -92334,7 +99240,7 @@ var ForwardDiffuseLightPipeline = new Class({ /** * Generic function for batching a textured quad * - * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#batchTexture + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchTexture * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject @@ -92414,6 +99320,7 @@ var ForwardDiffuseLightPipeline = new Class({ } this.setTexture2D(normalTexture.glTexture, 1); + this.setNormalMapRotation(rotation); var camMatrix = this._tempMatrix1; var spriteMatrix = this._tempMatrix2; @@ -92532,22 +99439,22 @@ var ForwardDiffuseLightPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -92556,7 +99463,7 @@ var ForwardDiffuseLightPipeline = new Class({ * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMap * @since 3.11.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to update. */ setNormalMap: function (gameObject) { @@ -92583,15 +99490,46 @@ var ForwardDiffuseLightPipeline = new Class({ }, /** - * [description] + * Rotates the normal map vectors inversely by the given angle. + * Only works in 2D space. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMapRotation + * @since 3.16.0 + * + * @param {number} rotation - The angle of rotation in radians. + */ + setNormalMapRotation: function (rotation) + { + var inverseRotationMatrix = this.inverseRotationMatrix; + + if (rotation) + { + var rot = -rotation; + var c = Math.cos(rot); + var s = Math.sin(rot); + + inverseRotationMatrix[1] = s; + inverseRotationMatrix[3] = -s; + inverseRotationMatrix[0] = inverseRotationMatrix[4] = c; + } + else + { + inverseRotationMatrix[0] = inverseRotationMatrix[4] = 1; + inverseRotationMatrix[1] = inverseRotationMatrix[3] = 0; + } + + this.renderer.setMatrix3(this.program, 'uInverseRotationMatrix', false, inverseRotationMatrix); + }, + + /** + * Takes a Sprite Game Object, or any object that extends it, which has a normal texture and adds it to the batch. * * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchSprite * @since 3.0.0 * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - [description] - * + * @param {Phaser.GameObjects.Sprite} sprite - The texture-based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - The transform matrix of the parent container, if set. */ batchSprite: function (sprite, camera, parentTransformMatrix) { @@ -92607,6 +99545,7 @@ var ForwardDiffuseLightPipeline = new Class({ this.renderer.setPipeline(this); this.setTexture2D(normalTexture.glTexture, 1); + this.setNormalMapRotation(sprite.rotation); TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera, parentTransformMatrix); } @@ -92620,20 +99559,20 @@ module.exports = ForwardDiffuseLightPipeline; /***/ }), -/* 421 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(897); -var ShaderSourceVS = __webpack_require__(896); -var WebGLPipeline = __webpack_require__(197); +var ShaderSourceFS = __webpack_require__(1044); +var ShaderSourceVS = __webpack_require__(1043); +var WebGLPipeline = __webpack_require__(212); /** * @classdesc @@ -92851,98 +99790,130 @@ module.exports = BitmapMaskPipeline; /***/ }), -/* 422 */ -/***/ (function(module, exports) { +/* 455 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CanvasPool = __webpack_require__(24); +var Color = __webpack_require__(32); +var GetFastValue = __webpack_require__(2); + /** - * Takes a snapshot of the current frame displayed by a WebGL canvas. + * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * * @function Phaser.Renderer.Snapshot.WebGL * @since 3.0.0 * * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. - * @param {string} [type='image/png'] - The format of the returned image. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - * - * @return {HTMLImageElement} A new image which contains a snapshot of the canvas's contents. + * @param {SnapshotState} config - The snapshot configuration object. */ -var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) +var WebGLSnapshot = function (sourceCanvas, config) { - 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; + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = GetFastValue(config, 'x', 0); + var y = GetFastValue(config, 'y', 0); + var width = GetFastValue(config, 'width', gl.drawingBufferWidth); + var height = GetFastValue(config, 'height', gl.drawingBufferHeight); + var getPixel = GetFastValue(config, 'getPixel', false); - 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) + if (getPixel) { - 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]; - } + var pixel = new Uint8Array(4); + + gl.readPixels(x, gl.drawingBufferHeight - y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel); + + callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3] / 255)); } + else + { + var pixels = new Uint8Array(width * height * 4); - ctx.putImageData(imageData, 0, 0); + gl.readPixels(x, gl.drawingBufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + + var canvas = CanvasPool.createWebGL(this, width, height); + var ctx = canvas.getContext('2d'); - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); + var imageData = ctx.getImageData(0, 0, width, height); + + var data = imageData.data; + + for (var py = 0; py < height; py++) + { + for (var px = 0; px < width; px++) + { + var sourceIndex = ((height - py) * width + px) * 4; + var destIndex = (py * width + px) * 4; - image.src = src; + data[destIndex + 0] = pixels[sourceIndex + 0]; + data[destIndex + 1] = pixels[sourceIndex + 1]; + data[destIndex + 2] = pixels[sourceIndex + 2]; + data[destIndex + 3] = pixels[sourceIndex + 3]; + } + } + + ctx.putImageData(imageData, 0, 0); + + var image = new Image(); - return image; + image.onerror = function () + { + callback.call(null); + + CanvasPool.remove(canvas); + }; + + image.onload = function () + { + callback.call(null, image); + + CanvasPool.remove(canvas); + }; + + image.src = canvas.toDataURL(type, encoderOptions); + } }; module.exports = WebGLSnapshot; /***/ }), -/* 423 */ +/* 456 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(121); +var BaseCamera = __webpack_require__(131); +var CameraEvents = __webpack_require__(40); var Class = __webpack_require__(0); -var CONST = __webpack_require__(26); -var IsSizePowerOfTwo = __webpack_require__(117); -var SpliceOne = __webpack_require__(91); -var TransformMatrix = __webpack_require__(38); -var Utils = __webpack_require__(10); -var WebGLSnapshot = __webpack_require__(422); +var CONST = __webpack_require__(28); +var IsSizePowerOfTwo = __webpack_require__(127); +var SpliceOne = __webpack_require__(97); +var TextureEvents = __webpack_require__(126); +var TransformMatrix = __webpack_require__(41); +var Utils = __webpack_require__(9); +var WebGLSnapshot = __webpack_require__(455); // Default Pipelines -var BitmapMaskPipeline = __webpack_require__(421); -var ForwardDiffuseLightPipeline = __webpack_require__(420); -var TextureTintPipeline = __webpack_require__(196); +var BitmapMaskPipeline = __webpack_require__(454); +var ForwardDiffuseLightPipeline = __webpack_require__(453); +var TextureTintPipeline = __webpack_require__(211); /** * @callback WebGLContextCallback @@ -92950,14 +99921,6 @@ var TextureTintPipeline = __webpack_require__(196); * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. */ -/** - * @typedef {object} SnapshotState - * - * @property {SnapshotCallback} callback - The function to call after the snapshot is taken. - * @property {string} type - The type of the image to create. - * @property {number} encoder - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - */ - /** * @classdesc * WebGLRenderer is a class that contains the needed functionality to keep the @@ -92988,11 +99951,10 @@ var WebGLRenderer = new Class({ var contextCreationConfig = { alpha: gameConfig.transparent, - depth: false, // enable when 3D is added in the future + depth: false, antialias: gameConfig.antialias, premultipliedAlpha: gameConfig.premultipliedAlpha, stencil: true, - preserveDrawingBuffer: gameConfig.preserveDrawingBuffer, failIfMajorPerformanceCaveat: gameConfig.failIfMajorPerformanceCaveat, powerPreference: gameConfig.powerPreference }; @@ -93001,7 +99963,7 @@ var WebGLRenderer = new Class({ * The local configuration settings of this WebGL Renderer. * * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {RendererConfig} + * @type {object} * @since 3.0.0 */ this.config = { @@ -93010,7 +99972,6 @@ var WebGLRenderer = new Class({ backgroundColor: gameConfig.backgroundColor, contextCreation: contextCreationConfig, resolution: gameConfig.resolution, - autoResize: gameConfig.autoResize, roundPixels: gameConfig.roundPixels, maxTextures: gameConfig.maxTextures, maxTextureSize: gameConfig.maxTextureSize, @@ -93038,21 +99999,23 @@ var WebGLRenderer = new Class({ /** * The width of the canvas being rendered to. + * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#width * @type {integer} * @since 3.0.0 */ - this.width = game.config.width; + this.width = 0; /** * The height of the canvas being rendered to. + * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#height * @type {integer} * @since 3.0.0 */ - this.height = game.config.height; + this.height = 0; /** * The canvas which this WebGL Renderer draws to. @@ -93133,9 +100096,14 @@ var WebGLRenderer = new Class({ * @since 3.0.0 */ this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, callback: null, - type: null, - encoder: null + type: 'image/png', + encoder: 0.92 }; // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) @@ -93347,6 +100315,13 @@ var WebGLRenderer = new Class({ */ this.blankTexture = null; + /** + * A default Camera used in calls when no other camera has been provided. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultCamera + * @type {Phaser.Cameras.Scene2D.BaseCamera} + * @since 3.12.0 + */ this.defaultCamera = new BaseCamera(0, 0, 0, 0); /** @@ -93393,8 +100368,7 @@ var WebGLRenderer = new Class({ }, /** - * Creates a new WebGLRenderingContext and initializes all internal - * state. + * Creates a new WebGLRenderingContext and initializes all internal state. * * @method Phaser.Renderer.WebGL.WebGLRenderer#init * @since 3.0.0 @@ -93406,13 +100380,14 @@ var WebGLRenderer = new Class({ init: function (config) { var gl; + var game = this.game; var canvas = this.canvas; var clearColor = config.backgroundColor; // Did they provide their own context? - if (this.game.config.context) + if (game.config.context) { - gl = this.game.config.context; + gl = game.config.context; } else { @@ -93429,17 +100404,25 @@ var WebGLRenderer = new Class({ this.gl = gl; // Set it back into the Game, so developers can access it from there too - this.game.context = gl; + game.context = gl; - for (var i = 0; i <= 16; i++) + for (var i = 0; i <= 27; i++) { this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); } + // ADD this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; + + // MULTIPLY this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; + + // SCREEN this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; + // ERASE + this.blendModes[17] = { func: [ gl.ZERO, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_REVERSE_SUBTRACT }; + this.glFormats[0] = gl.BYTE; this.glFormats[1] = gl.SHORT; this.glFormats[2] = gl.UNSIGNED_BYTE; @@ -93468,14 +100451,13 @@ var WebGLRenderer = new Class({ this.supportedExtensions = exts; - // Setup initial WebGL state + // 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); + + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); // Initialize all textures to null for (var index = 0; index < this.currentTextures.length; ++index) @@ -93486,15 +100468,13 @@ var WebGLRenderer = new Class({ // Clear previous pipelines and reload default ones this.pipelines = {}; - this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ 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, maxLights: config.maxLights })); + this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: game, renderer: this })); + this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: game, renderer: this })); + this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: game, renderer: this, maxLights: config.maxLights })); this.setBlendMode(CONST.BlendModes.NORMAL); - this.resize(this.width, this.height); - - this.game.events.once('texturesready', this.boot, this); + game.textures.once(TextureEvents.READY, this.boot, this); return this; }, @@ -93518,38 +100498,64 @@ var WebGLRenderer = new Class({ this.pipelines.TextureTintPipeline.currentFrame = blank; this.blankTexture = blank; + + var gl = this.gl; + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + gl.enable(gl.SCISSOR_TEST); + + this.setPipeline(this.pipelines.TextureTintPipeline); + + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height, this.game.scale.resolution); }, /** - * Resizes the drawing buffer. + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize, displaySize, resolution) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height || resolution !== this.resolution) + { + this.resize(baseSize.width, baseSize.height, resolution); + } + }, + + /** + * Resizes the drawing buffer to match that required by the Scale Manager. * * @method Phaser.Renderer.WebGL.WebGLRenderer#resize * @since 3.0.0 * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. + * @param {number} [resolution] - The new resolution of the renderer. * * @return {this} This WebGLRenderer instance. */ - resize: function (width, height) + resize: function (width, height, resolution) { var gl = this.gl; var pipelines = this.pipelines; - var resolution = this.config.resolution; - this.width = Math.floor(width * resolution); - this.height = Math.floor(height * resolution); + this.width = width; + this.height = height; + this.resolution = resolution; - this.canvas.width = this.width; - this.canvas.height = this.height; - - if (this.config.autoResize) - { - this.canvas.style.width = (this.width / resolution) + 'px'; - this.canvas.style.height = (this.height / resolution) + 'px'; - } - - gl.viewport(0, 0, this.width, this.height); + gl.viewport(0, 0, width, height); // Update all registered pipelines for (var pipelineName in pipelines) @@ -93559,9 +100565,9 @@ var WebGLRenderer = new Class({ this.drawingBufferHeight = gl.drawingBufferHeight; - this.defaultCamera.setSize(width, height); + gl.scissor(0, (gl.drawingBufferHeight - height), width, height); - gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); + this.defaultCamera.setSize(width, height); return this; }, @@ -93709,7 +100715,7 @@ var WebGLRenderer = new Class({ * @param {string} pipelineName - A unique string-based key for the pipeline. * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - A pipeline instance which must extend WebGLPipeline. * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipline instance that was passed. + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance that was passed. */ addPipeline: function (pipelineName, pipelineInstance) { @@ -93739,18 +100745,21 @@ var WebGLRenderer = new Class({ * @param {integer} y - The y position of the scissor. * @param {integer} width - The width of the scissor. * @param {integer} height - The height of the scissor. + * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. * * @return {integer[]} An array containing the scissor values. */ - pushScissor: function (x, y, width, height) + pushScissor: function (x, y, width, height, drawingBufferHeight) { + if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } + var scissorStack = this.scissorStack; var scissor = [ x, y, width, height ]; scissorStack.push(scissor); - this.setScissor(x, y, width, height); + this.setScissor(x, y, width, height, drawingBufferHeight); this.currentScissor = scissor; @@ -93767,29 +100776,32 @@ var WebGLRenderer = new Class({ * @param {integer} y - The y position of the scissor. * @param {integer} width - The width of the scissor. * @param {integer} height - The height of the scissor. + * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. */ - setScissor: function (x, y, width, height) + setScissor: function (x, y, width, height, drawingBufferHeight) { var gl = this.gl; var current = this.currentScissor; - var cx = current[0]; - var cy = current[1]; - var cw = current[2]; - var ch = current[3]; + var setScissor = (width > 0 && height > 0); - if (cx !== x || cy !== y || cw !== width || ch !== height) + if (current && setScissor) + { + var cx = current[0]; + var cy = current[1]; + var cw = current[2]; + var ch = current[3]; + + setScissor = (cx !== x || cy !== y || cw !== width || ch !== height); + } + + if (setScissor) { this.flush(); // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor - - if (width > 0 && height > 0) - { - gl.scissor(x, (this.drawingBufferHeight - y - height), width, height); - - } + gl.scissor(x, (drawingBufferHeight - y - height), width, height); } }, @@ -93844,6 +100856,71 @@ var WebGLRenderer = new Class({ return this.currentPipeline; }, + /** + * Use this to reset the gl context to the state that Phaser requires to continue rendering. + * Calling this will: + * + * * Disable `DEPTH_TEST`, `CULL_FACE` and `STENCIL_TEST`. + * * Clear the depth buffer and stencil buffers. + * * Reset the viewport size. + * * Reset the blend mode. + * * Bind a blank texture as the active texture on texture unit zero. + * * Rebinds the given pipeline instance. + * + * You should call this having previously called `clearPipeline` and then wishing to return + * control to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#rebindPipeline + * @since 3.16.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - The pipeline instance to be activated. + */ + rebindPipeline: function (pipelineInstance) + { + var gl = this.gl; + + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.disable(gl.STENCIL_TEST); + + gl.clear(gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); + + gl.viewport(0, 0, this.width, this.height); + + this.setBlendMode(0, true); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, this.blankTexture.glTexture); + + this.currentActiveTextureUnit = 0; + this.currentTextures[0] = this.blankTexture.glTexture; + + this.currentPipeline = pipelineInstance; + this.currentPipeline.bind(); + this.currentPipeline.onBind(); + }, + + /** + * Flushes the current WebGLPipeline being used and then clears it, along with the + * the current shader program and vertex buffer. Then resets the blend mode to NORMAL. + * Call this before jumping to your own gl context handler, and then call `rebindPipeline` when + * you wish to return control to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#clearPipeline + * @since 3.16.0 + */ + clearPipeline: function () + { + this.flush(); + + this.currentPipeline = null; + this.currentProgram = null; + this.currentVertexBuffer = null; + this.currentIndexBuffer = null; + + this.setBlendMode(0, true); + }, + /** * Sets the blend mode to the value given. * @@ -93854,15 +100931,18 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {integer} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. + * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. * * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. */ - setBlendMode: function (blendModeId) + setBlendMode: function (blendModeId, force) { + if (force === undefined) { force = false; } + var gl = this.gl; var blendMode = this.blendModes[blendModeId]; - if (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId) + if (force || (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId)) { this.flush(); @@ -93944,7 +101024,7 @@ var WebGLRenderer = new Class({ */ removeBlendMode: function (index) { - if (index > 16 && this.blendModes[index]) + if (index > 17 && this.blendModes[index]) { this.blendModes.splice(index, 1); } @@ -93981,16 +101061,22 @@ var WebGLRenderer = new Class({ * * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. * @param {integer} textureUnit - The texture unit to which the texture will be bound. + * @param {boolean} [flush=true] - Will the current pipeline be flushed if this is a new texture, or not? * * @return {this} This WebGLRenderer instance. */ - setTexture2D: function (texture, textureUnit) + setTexture2D: function (texture, textureUnit, flush) { + if (flush === undefined) { flush = true; } + var gl = this.gl; if (texture !== this.currentTextures[textureUnit]) { - this.flush(); + if (flush) + { + this.flush(); + } if (this.currentActiveTextureUnit !== textureUnit) { @@ -94014,11 +101100,14 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. * * @return {this} This WebGLRenderer instance. */ - setFramebuffer: function (framebuffer) + setFramebuffer: function (framebuffer, updateScissor) { + if (updateScissor === undefined) { updateScissor = false; } + var gl = this.gl; var width = this.width; @@ -94040,6 +101129,22 @@ var WebGLRenderer = new Class({ gl.viewport(0, 0, width, height); + if (updateScissor) + { + if (framebuffer) + { + this.drawingBufferHeight = height; + + this.pushScissor(0, 0, width, height); + } + else + { + this.drawingBufferHeight = this.height; + + this.popScissor(); + } + } + this.currentFramebuffer = framebuffer; } @@ -94210,6 +101315,7 @@ var WebGLRenderer = new Class({ else { gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); + width = pixels.width; height = pixels.height; } @@ -94396,7 +101502,7 @@ var WebGLRenderer = new Class({ this.gl.deleteTexture(texture); - if (this.currentTextures[0] === texture) + if (this.currentTextures[0] === texture && !this.game.pendingDestroy) { // texture we just deleted is in use, so bind a blank texture this.setBlankTexture(true); @@ -94501,7 +101607,7 @@ var WebGLRenderer = new Class({ ); } - camera.emit('prerender', camera); + camera.emit(CameraEvents.PRE_RENDER, camera); } else { @@ -94544,7 +101650,7 @@ var WebGLRenderer = new Class({ this.setFramebuffer(null); - camera.emit('postrender', camera); + camera.emit(CameraEvents.POST_RENDER, camera); TextureTintPipeline.projOrtho(0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0); @@ -94590,12 +101696,17 @@ var WebGLRenderer = new Class({ if (this.contextLost) { return; } var gl = this.gl; - var color = this.config.backgroundColor; var pipelines = this.pipelines; + // Make sure we are bound to the main frame buffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + if (this.config.clearBeforeRender) { - gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); + var clearColor = this.config.backgroundColor; + + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } @@ -94621,8 +101732,14 @@ var WebGLRenderer = new Class({ }, /** - * The core render step for a Scene. + * The core render step for a Scene Camera. + * * Iterates through the given Game Object's array and renders them with the given Camera. + * + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. + * + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * * @method Phaser.Renderer.WebGL.WebGLRenderer#render * @since 3.0.0 @@ -94698,10 +101815,13 @@ var WebGLRenderer = new Class({ // Unbind custom framebuffer here - if (this.snapshotState.callback) + var state = this.snapshotState; + + if (state.callback) { - this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); - this.snapshotState.callback = null; + WebGLSnapshot(this.canvas, state); + + state.callback = null; } var pipelines = this.pipelines; @@ -94713,22 +101833,100 @@ var WebGLRenderer = new Class({ }, /** - * Schedules a snapshot to be taken after the current frame is rendered. + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot * @since 3.0.0 * - * @param {SnapshotCallback} callback - Function to invoke after the snapshot is created. - * @param {string} type - The format of the image to create, usually `image/png`. - * @param {number} encoderOptions - The image quality, between 0 and 1, to use for image formats with lossy compression (such as `image/jpeg`). + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} This WebGL Renderer. + * @return {this} This WebGL Renderer. */ snapshot: function (callback, type, encoderOptions) { - this.snapshotState.callback = callback; - this.snapshotState.type = type; - this.snapshotState.encoder = encoderOptions; + return this.snapshotArea(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gl.drawingBufferWidth); + state.height = Math.min(height, this.gl.drawingBufferHeight); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; return this; }, @@ -94760,7 +101958,9 @@ var WebGLRenderer = new Class({ wrapping = gl.REPEAT; } - dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); + var filter = (this.config.antialias) ? gl.LINEAR : gl.NEAREST; + + dstTexture = this.createTexture2D(0, filter, filter, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); } else { @@ -95007,8 +102207,8 @@ var WebGLRenderer = new Class({ * * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] + * @param {integer} x - The new X component + * @param {integer} y - The new Y component * * @return {this} This WebGL Renderer instance. */ @@ -95029,9 +102229,9 @@ var WebGLRenderer = new Class({ * * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] + * @param {integer} x - The new X component + * @param {integer} y - The new Y component + * @param {integer} z - The new Z component * * @return {this} This WebGL Renderer instance. */ @@ -95069,15 +102269,15 @@ var WebGLRenderer = new Class({ }, /** - * [description] + * Sets the value of a 2x2 matrix uniform variable in the given WebGLProgram. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 * @since 3.0.0 * * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. + * @param {Float32Array} matrix - The new matrix value. * * @return {this} This WebGL Renderer instance. */ @@ -95163,7 +102363,7 @@ var WebGLRenderer = new Class({ }, /** - * [description] + * Destroy this WebGLRenderer, cleaning up all related resources such as pipelines, native textures, etc. * * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy * @since 3.0.0 @@ -95178,7 +102378,7 @@ var WebGLRenderer = new Class({ delete this.pipelines[key]; } - for (var index = 0; index < this.nativeTextures.length; ++index) + for (var index = 0; index < this.nativeTextures.length; index++) { this.deleteTexture(this.nativeTextures[index]); @@ -95199,25 +102399,27 @@ module.exports = WebGLRenderer; /***/ }), -/* 424 */ +/* 457 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var modes = __webpack_require__(66); -var CanvasFeatures = __webpack_require__(339); +var modes = __webpack_require__(60); +var CanvasFeatures = __webpack_require__(388); /** - * [description] + * Returns an array which maps the default blend modes to supported Canvas blend modes. + * + * If the browser doesn't support a blend mode, it will default to the normal `source-over` blend mode. * * @function Phaser.Renderer.Canvas.GetBlendModes * @since 3.0.0 * - * @return {array} [description] + * @return {array} Which Canvas blend mode corresponds to which default Phaser blend mode. */ var GetBlendModes = function () { @@ -95242,6 +102444,17 @@ var GetBlendModes = function () output[modes.SATURATION] = (useNew) ? 'saturation' : so; output[modes.COLOR] = (useNew) ? 'color' : so; output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : so; + output[modes.ERASE] = 'destination-out'; + output[modes.SOURCE_IN] = 'source-in'; + output[modes.SOURCE_OUT] = 'source-out'; + output[modes.SOURCE_ATOP] = 'source-atop'; + output[modes.DESTINATION_OVER] = 'destination-over'; + output[modes.DESTINATION_IN] = 'destination-in'; + output[modes.DESTINATION_OUT] = 'destination-out'; + output[modes.DESTINATION_ATOP] = 'destination-atop'; + output[modes.LIGHTER] = 'lighter'; + output[modes.COPY] = 'copy'; + output[modes.XOR] = 'xor'; return output; }; @@ -95250,66 +102463,121 @@ module.exports = GetBlendModes; /***/ }), -/* 425 */ -/***/ (function(module, exports) { +/* 458 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CanvasPool = __webpack_require__(24); +var Color = __webpack_require__(32); +var GetFastValue = __webpack_require__(2); + /** - * [description] + * Takes a snapshot of an area from the current frame displayed by a canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * * @function Phaser.Renderer.Snapshot.Canvas * @since 3.0.0 * - * @param {HTMLCanvasElement} canvas - [description] - * @param {string} [type='image/png'] - [description] - * @param {number} [encoderOptions=0.92] - [description] - * - * @return {HTMLImageElement} [description] + * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {SnapshotState} config - The snapshot configuration object. */ -var CanvasSnapshot = function (canvas, type, encoderOptions) +var CanvasSnapshot = function (canvas, config) { - if (type === undefined) { type = 'image/png'; } - if (encoderOptions === undefined) { encoderOptions = 0.92; } + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); + var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); + var width = GetFastValue(config, 'width', canvas.width); + var height = GetFastValue(config, 'height', canvas.height); + var getPixel = GetFastValue(config, 'getPixel', false); - var src = canvas.toDataURL(type, encoderOptions); + if (getPixel) + { + var context = canvas.getContext('2d'); + var imageData = context.getImageData(x, y, 1, 1); + var data = imageData.data; - var image = new Image(); + callback.call(null, new Color(data[0], data[1], data[2], data[3] / 255)); + } + else if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) + { + // Area Grab + var copyCanvas = CanvasPool.createWebGL(this, width, height); + var ctx = copyCanvas.getContext('2d'); - image.src = src; + ctx.drawImage(canvas, x, y, width, height, 0, 0, width, height); - return image; + var image1 = new Image(); + + image1.onerror = function () + { + callback.call(null); + + CanvasPool.remove(copyCanvas); + }; + + image1.onload = function () + { + callback.call(null, image1); + + CanvasPool.remove(copyCanvas); + }; + + image1.src = copyCanvas.toDataURL(type, encoderOptions); + } + else + { + // Full Grab + var image2 = new Image(); + + image2.onerror = function () + { + callback.call(null); + }; + + image2.onload = function () + { + callback.call(null, image2); + }; + + image2.src = canvas.toDataURL(type, encoderOptions); + } }; module.exports = CanvasSnapshot; /***/ }), -/* 426 */ +/* 459 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasSnapshot = __webpack_require__(425); +var CanvasSnapshot = __webpack_require__(458); +var CameraEvents = __webpack_require__(40); var Class = __webpack_require__(0); -var CONST = __webpack_require__(26); -var GetBlendModes = __webpack_require__(424); -var ScaleModes = __webpack_require__(94); -var Smoothing = __webpack_require__(120); -var TransformMatrix = __webpack_require__(38); +var CONST = __webpack_require__(28); +var GetBlendModes = __webpack_require__(457); +var ScaleModes = __webpack_require__(101); +var Smoothing = __webpack_require__(130); +var TransformMatrix = __webpack_require__(41); /** * @classdesc - * [description] + * The Canvas Renderer is responsible for managing 2D canvas rendering contexts, including the one used by the Game's canvas. It tracks the internal state of a given context and can renderer textured Game Objects to it, taking into account alpha, blending, and scaling. * * @class CanvasRenderer * @memberof Phaser.Renderer.Canvas @@ -95334,7 +102602,7 @@ var CanvasRenderer = new Class({ this.game = game; /** - * [description] + * A constant which allows the renderer to be easily identified as a Canvas Renderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#type * @type {integer} @@ -95343,7 +102611,7 @@ var CanvasRenderer = new Class({ this.type = CONST.CANVAS; /** - * [description] + * The total number of Game Objects which were rendered in a frame. * * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount * @type {number} @@ -95353,41 +102621,40 @@ var CanvasRenderer = new Class({ this.drawCount = 0; /** - * [description] + * The width of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {number} + * @type {integer} * @since 3.0.0 */ - this.width = game.config.width; + this.width = 0; /** - * [description] + * The height of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {number} + * @type {integer} * @since 3.0.0 */ - this.height = game.config.height; + this.height = 0; /** - * [description] + * The local configuration settings of the CanvasRenderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {RendererConfig} + * @type {object} * @since 3.0.0 */ this.config = { clearBeforeRender: game.config.clearBeforeRender, backgroundColor: game.config.backgroundColor, resolution: game.config.resolution, - autoResize: game.config.autoResize, antialias: game.config.antialias, roundPixels: game.config.roundPixels }; /** - * [description] + * The scale mode which should be used by the CanvasRenderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode * @type {integer} @@ -95396,7 +102663,7 @@ var CanvasRenderer = new Class({ this.scaleMode = (game.config.antialias) ? ScaleModes.LINEAR : ScaleModes.NEAREST; /** - * [description] + * The canvas element which the Game uses. * * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas * @type {HTMLCanvasElement} @@ -95405,7 +102672,7 @@ var CanvasRenderer = new Class({ this.gameCanvas = game.canvas; /** - * [description] + * The canvas context used to render all Cameras in all Scenes during the game loop. * * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext * @type {CanvasRenderingContext2D} @@ -95414,7 +102681,7 @@ var CanvasRenderer = new Class({ this.gameContext = (this.game.config.context) ? this.game.config.context : this.gameCanvas.getContext('2d'); /** - * [description] + * The canvas context currently used by the CanvasRenderer for all rendering operations. * * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext * @type {CanvasRenderingContext2D} @@ -95423,7 +102690,9 @@ var CanvasRenderer = new Class({ this.currentContext = this.gameContext; /** - * [description] + * The blend modes supported by the Canvas Renderer. + * + * This object maps the {@link Phaser.BlendModes} to canvas compositing operations. * * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes * @type {array} @@ -95435,7 +102704,7 @@ var CanvasRenderer = new Class({ // image-rendering: pixelated; /** - * [description] + * The scale mode currently in use by the Canvas Renderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#currentScaleMode * @type {number} @@ -95445,34 +102714,24 @@ var CanvasRenderer = new Class({ this.currentScaleMode = 0; /** - * [description] + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback - * @type {?SnapshotCallback} - * @default null - * @since 3.0.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState + * @type {SnapshotState} + * @since 3.16.0 */ - this.snapshotCallback = null; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType - * @type {?string} - * @default null - * @since 3.0.0 - */ - this.snapshotType = null; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder - * @type {?number} - * @default null - * @since 3.0.0 - */ - this.snapshotEncoder = null; + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92 + }; /** * A temporary Transform Matrix, re-used internally during batching. @@ -95518,14 +102777,38 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Prepares the game canvas for rendering. * * @method Phaser.Renderer.Canvas.CanvasRenderer#init * @since 3.0.0 */ init: function () { - this.resize(this.width, this.height); + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height); + }, + + /** + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height) + { + this.resize(baseSize.width, baseSize.height); + } }, /** @@ -95534,24 +102817,13 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#resize * @since 3.0.0 * - * @param {integer} width - [description] - * @param {integer} height - [description] + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. */ resize: function (width, height) { - var resolution = this.config.resolution; - - this.width = width * resolution; - this.height = height * resolution; - - this.gameCanvas.width = this.width; - this.gameCanvas.height = this.height; - - if (this.config.autoResize) - { - this.gameCanvas.style.width = (this.width / resolution) + 'px'; - this.gameCanvas.style.height = (this.height / resolution) + 'px'; - } + this.width = width; + this.height = height; // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) if (this.scaleMode === ScaleModes.NEAREST) @@ -95561,31 +102833,31 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * A NOOP method for handling lost context. Intentionally empty. * * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost * @since 3.0.0 * - * @param {function} callback - [description] + * @param {function} callback - Ignored parameter. */ onContextLost: function () { }, /** - * [description] + * A NOOP method for handling restored context. Intentionally empty. * * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored * @since 3.0.0 * - * @param {function} callback - [description] + * @param {function} callback - Ignored parameter. */ onContextRestored: function () { }, /** - * [description] + * Resets the transformation matrix of the current context to the identity matrix, thus resetting any transformation. * * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform * @since 3.0.0 @@ -95596,14 +102868,14 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Sets the blend mode (compositing operation) of the current context. * * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode * @since 3.0.0 * - * @param {number} blendMode - [description] + * @param {string} blendMode - The new blend mode which should be used. * - * @return {this} [description] + * @return {this} This CanvasRenderer object. */ setBlendMode: function (blendMode) { @@ -95630,14 +102902,14 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Sets the global alpha of the current context. * * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha * @since 3.0.0 * - * @param {number} alpha - [description] + * @param {number} alpha - The new alpha to use, where 0 is fully transparent and 1 is fully opaque. * - * @return {this} [description] + * @return {this} This CanvasRenderer object. */ setAlpha: function (alpha) { @@ -95660,6 +102932,10 @@ var CanvasRenderer = new Class({ var width = this.width; var height = this.height; + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; + ctx.setTransform(1, 0, 0, 1, 0, 0); + if (config.clearBeforeRender) { ctx.clearRect(0, 0, width, height); @@ -95671,6 +102947,8 @@ var CanvasRenderer = new Class({ ctx.fillRect(0, 0, width, height); } + ctx.save(); + this.drawCount = 0; }, @@ -95680,10 +102958,10 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#render * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.DisplayList} children - [description] - * @param {number} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene to render. + * @param {Phaser.GameObjects.DisplayList} children - The Game Objects within the Scene to be rendered. + * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently unused. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ render: function (scene, children, interpolationPercentage, camera) { @@ -95697,12 +102975,18 @@ var CanvasRenderer = new Class({ var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; - var scissor = (cx !== 0 || cy !== 0 || cw !== ctx.canvas.width || ch !== ctx.canvas.height); + // Save context pre-clip + ctx.save(); + + if (this.game.scene.customViewports) + { + ctx.beginPath(); + ctx.rect(cx, cy, cw, ch); + ctx.clip(); + } 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 (!camera.transparent) { ctx.fillStyle = camera.backgroundColor.rgba; @@ -95715,17 +102999,9 @@ var CanvasRenderer = new Class({ this.drawCount += list.length; - if (scissor) - { - ctx.save(); - ctx.beginPath(); - ctx.rect(cx, cy, cw, ch); - ctx.clip(); - } - if (camera.renderToTexture) { - camera.emit('prerender', camera); + camera.emit(CameraEvents.PRE_RENDER, camera); } camera.matrix.copyToContext(ctx); @@ -95761,22 +103037,21 @@ var CanvasRenderer = new Class({ camera.dirty = false; - // Reset the camera scissor - if (scissor) - { - ctx.restore(); - } + // Restore pre-clip context + ctx.restore(); if (camera.renderToTexture) { - camera.emit('postrender', camera); + camera.emit(CameraEvents.POST_RENDER, camera); scene.sys.context.drawImage(camera.canvas, cx, cy); } }, /** - * [description] + * Restores the game context's global settings and takes a snapshot if one is scheduled. + * + * The post-render step happens after all Cameras in all Scenes have been rendered. * * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender * @since 3.0.0 @@ -95785,31 +103060,111 @@ var CanvasRenderer = new Class({ { var ctx = this.gameContext; - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = 'source-over'; + ctx.restore(); - if (this.snapshotCallback) + var state = this.snapshotState; + + if (state.callback) { - this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); - this.snapshotCallback = null; + CanvasSnapshot(this.gameCanvas, state); + + state.callback = null; } }, /** - * [description] + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot * @since 3.0.0 * - * @param {SnapshotCallback} callback - [description] - * @param {string} type - [description] - * @param {number} encoderOptions - [description] + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. */ snapshot: function (callback, type, encoderOptions) { - this.snapshotCallback = callback; - this.snapshotType = type; - this.snapshotEncoder = encoderOptions; + return this.snapshotArea(0, 0, this.gameCanvas.width, this.gameCanvas.height, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gameCanvas.width); + state.height = Math.min(height, this.gameCanvas.height); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; + + return this; }, /** @@ -95937,7 +103292,7 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Destroys all object references in the Canvas Renderer. * * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy * @since 3.0.0 @@ -95956,73 +103311,18 @@ module.exports = CanvasRenderer; /***/ }), -/* 427 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var BaseAnimation = __webpack_require__(205); var Class = __webpack_require__(0); - -/** - * This event is dispatched when an animation starts playing. - * - * Listen for it on the Game Object: `sprite.on('animationstart', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onStartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation restarts. - * - * Listen for it on the Game Object: `sprite.on('animationrestart', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onRestartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation repeats. - * - * Listen for it on the Game Object: `sprite.on('animationrepeat', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onRepeatEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {integer} repeatCount - The number of times this animation has repeated. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation updates. This happens when the animation frame changes, - * based on the animation frame rate and other factors like timeScale and delay. - * - * Listen for it on the Game Object: `sprite.on('animationupdate', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onUpdateEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation completes playing, either naturally or via Animation.stop. - * - * Listen for it on the Game Object: `sprite.on('animationcomplete', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onCompleteEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ +var Events = __webpack_require__(136); /** * @classdesc @@ -96061,7 +103361,7 @@ var Animation = new Class({ */ this.animationManager = parent.scene.sys.anims; - this.animationManager.once('remove', this.remove, this); + this.animationManager.once(Events.REMOVE_ANIMATION, this.remove, this); /** * Is an animation currently playing or not? @@ -96093,6 +103393,16 @@ var Animation = new Class({ */ this.currentFrame = null; + /** + * The key of the next Animation to be loaded into this Animation Controller when the current animation completes. + * + * @name Phaser.GameObjects.Components.Animation#nextAnim + * @type {?string} + * @default null + * @since 3.16.0 + */ + this.nextAnim = null; + /** * Time scale factor. * @@ -96205,9 +103515,10 @@ var Animation = new Class({ * An Internal trigger that's play the animation in reverse mode ('true') or not ('false'), * needed because forward can be changed by yoyo feature. * - * @name Phaser.GameObjects.Components.Animation#forward + * @name Phaser.GameObjects.Components.Animation#_reverse * @type {boolean} * @default false + * @private * @since 3.12.0 */ this._reverse = false; @@ -96300,6 +103611,37 @@ var Animation = new Class({ this._pendingStopValue; }, + /** + * Sets an animation to be played immediately after the current one completes. + * + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, or have the `stop` method called directly on it. + * + * An animation set to repeat forever will never enter a completed state. + * + * You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` callback). + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing. + * + * Call this method with no arguments to reset the chained animation. + * + * @method Phaser.GameObjects.Components.Animation#chain + * @since 3.16.0 + * + * @param {(string|Phaser.Animations.Animation)} [key] - The string-based key of the animation to play next, as defined previously in the Animation Manager. Or an Animation instance. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + */ + chain: function (key) + { + if (key instanceof BaseAnimation) + { + key = key.key; + } + + this.nextAnim = key; + + return this.parent; + }, + /** * Sets the amount of time, in milliseconds, that the animation will be delayed before starting playback. * @@ -96469,13 +103811,15 @@ var Animation = new Class({ }, /** - * Plays an Animation on the Game Object that owns this Animation Component. + * Plays an Animation on a Game Object that has the Animation component, such as a Sprite. + * + * Animations are stored in the global Animation Manager and are referenced by a unique string-based key. * * @method Phaser.GameObjects.Components.Animation#play * @fires Phaser.GameObjects.Components.Animation#onStartEvent * @since 3.0.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. + * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * @@ -96486,6 +103830,11 @@ var Animation = new Class({ if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (key instanceof BaseAnimation) + { + key = key.key; + } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) { return this.parent; @@ -96504,7 +103853,7 @@ var Animation = new Class({ * @fires Phaser.GameObjects.Components.Animation#onStartEvent * @since 3.12.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. + * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * @@ -96515,6 +103864,11 @@ var Animation = new Class({ if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (key instanceof BaseAnimation) + { + key = key.key; + } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) { return this.parent; @@ -96527,11 +103881,12 @@ var Animation = new Class({ }, /** - * Load an Animation and fires 'onStartEvent' event, - * extracted from 'play' method + * Load an Animation and fires 'onStartEvent' event, extracted from 'play' method. * * @method Phaser.GameObjects.Components.Animation#_startAnimation - * @fires Phaser.GameObjects.Components.Animation#onStartEvent + * @fires Phaser.Animations.Events#START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_KEY_ANIMATION_EVENT * @since 3.12.0 * * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. @@ -96559,26 +103914,33 @@ var Animation = new Class({ gameObject.visible = true; } - gameObject.emit('animationstart', this.currentAnim, this.currentFrame, gameObject); + var frame = this.currentFrame; + + anim.emit(Events.ANIMATION_START, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_START + key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_START, anim, frame, gameObject); return gameObject; }, /** - * Reverse an Animation that is already playing on the Game Object. + * Reverse the Animation that is already playing on the Game Object. * * @method Phaser.GameObjects.Components.Animation#reverse * @since 3.12.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. - * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - reverse: function (key) + reverse: function () { - if (!this.isPlaying || this.currentAnim.key !== key) { return this.parent; } - this._reverse = !this._reverse; - this.forward = !this.forward; + if (this.isPlaying) + { + this._reverse = !this._reverse; + + this.forward = !this.forward; + } return this.parent; }, @@ -96724,7 +104086,9 @@ var Animation = new Class({ * Restarts the current animation from its beginning, optionally including its delay value. * * @method Phaser.GameObjects.Components.Animation#restart - * @fires Phaser.GameObjects.Components.Animation#onRestartEvent + * @fires Phaser.Animations.Events#RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_KEY_ANIMATION_EVENT * @since 3.0.0 * * @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting. @@ -96735,7 +104099,9 @@ var Animation = new Class({ { if (includeDelay === undefined) { includeDelay = false; } - this.currentAnim.getFirstTick(this, includeDelay); + var anim = this.currentAnim; + + anim.getFirstTick(this, includeDelay); this.forward = true; this.isPlaying = true; @@ -96743,17 +104109,26 @@ var Animation = new Class({ this._paused = false; // Set frame - this.updateFrame(this.currentAnim.frames[0]); + this.updateFrame(anim.frames[0]); var gameObject = this.parent; + var frame = this.currentFrame; - gameObject.emit('animationrestart', this.currentAnim, this.currentFrame, gameObject); + anim.emit(Events.ANIMATION_RESTART, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_RESTART + anim.key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_RESTART, anim, frame, gameObject); return this.parent; }, /** * Immediately stops the current animation from playing and dispatches the `animationcomplete` event. + * + * If no animation is set, no event will be dispatched. + * + * If there is another animation queued (via the `chain` method) then it will start playing immediately. * * @method Phaser.GameObjects.Components.Animation#stop * @fires Phaser.GameObjects.Components.Animation#onCompleteEvent @@ -96768,8 +104143,26 @@ var Animation = new Class({ this.isPlaying = false; var gameObject = this.parent; + var anim = this.currentAnim; + var frame = this.currentFrame; - gameObject.emit('animationcomplete', this.currentAnim, this.currentFrame, gameObject); + if (anim) + { + anim.emit(Events.ANIMATION_COMPLETE, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_COMPLETE + anim.key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_COMPLETE, anim, frame, gameObject); + } + + if (this.nextAnim) + { + var key = this.nextAnim; + + this.nextAnim = null; + + this.play(key); + } return gameObject; }, @@ -96817,7 +104210,7 @@ var Animation = new Class({ * @fires Phaser.GameObjects.Components.Animation#onCompleteEvent * @since 3.4.0 * - * @param {Phaser.Animations.AnimationFrame} delay - The frame to check before stopping this animation. + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -96952,7 +104345,8 @@ var Animation = new Class({ * Internal frame change handler. * * @method Phaser.GameObjects.Components.Animation#updateFrame - * @fires Phaser.GameObjects.Components.Animation#onUpdateEvent + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE_EVENT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE_EVENT * @private * @since 3.0.0 * @@ -96971,7 +104365,9 @@ var Animation = new Class({ var anim = this.currentAnim; - gameObject.emit('animationupdate', anim, animationFrame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_UPDATE + anim.key, anim, animationFrame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_UPDATE, anim, animationFrame, gameObject); if (this._pendingStop === 3 && this._pendingStopValue === animationFrame) { @@ -96980,6 +104376,50 @@ var Animation = new Class({ } }, + /** + * Advances the animation to the next frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. + * + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in reverse, calling this method doesn't then change the direction to forwards. + * + * @method Phaser.GameObjects.Components.Animation#nextFrame + * @since 3.16.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + */ + nextFrame: function () + { + if (this.currentAnim) + { + this.currentAnim.nextFrame(this); + } + + return this.parent; + }, + + /** + * Advances the animation to the previous frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. + * + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in forwards, calling this method doesn't then change the direction to backwards. + * + * @method Phaser.GameObjects.Components.Animation#previousFrame + * @since 3.16.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + */ + previousFrame: function () + { + if (this.currentAnim) + { + this.currentAnim.previousFrame(this); + } + + return this.parent; + }, + /** * Sets if the current Animation will yoyo when it reaches the end. * A yoyo'ing animation will play through consecutively, and then reverse-play back to the start again. @@ -97024,7 +104464,7 @@ var Animation = new Class({ */ destroy: function () { - this.animationManager.off('remove', this.remove, this); + this.animationManager.off(Events.REMOVE_ANIMATION, this.remove, this); this.animationManager = null; this.parent = null; @@ -97039,12 +104479,12 @@ module.exports = Animation; /***/ }), -/* 428 */ +/* 461 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -97052,28 +104492,28 @@ module.exports = Animation; * Takes the given string and reverses it, returning the reversed string. * For example if given the string `Atari 520ST` it would return `TS025 iratA`. * - * @function Phaser.Utils.String.ReverseString + * @function Phaser.Utils.String.Reverse * @since 3.0.0 * * @param {string} string - The string to be reversed. * * @return {string} The reversed string. */ -var ReverseString = function (string) +var Reverse = function (string) { return string.split('').reverse().join(''); }; -module.exports = ReverseString; +module.exports = Reverse; /***/ }), -/* 429 */ +/* 462 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -97103,12 +104543,12 @@ module.exports = Format; /***/ }), -/* 430 */ +/* 463 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -97118,26 +104558,26 @@ module.exports = Format; module.exports = { - Format: __webpack_require__(429), - Pad: __webpack_require__(179), - Reverse: __webpack_require__(428), - UppercaseFirst: __webpack_require__(327), - UUID: __webpack_require__(295) + Format: __webpack_require__(462), + Pad: __webpack_require__(193), + Reverse: __webpack_require__(461), + UppercaseFirst: __webpack_require__(330), + UUID: __webpack_require__(299) }; /***/ }), -/* 431 */ +/* 464 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Creates a new Object using all values from obj1. @@ -97147,10 +104587,10 @@ var Clone = __webpack_require__(63); * @function Phaser.Utils.Objects.MergeRight * @since 3.0.0 * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] + * @param {object} obj1 - The first object to merge. + * @param {object} obj2 - The second object to merge. Keys from this object which also exist in `obj1` will be copied to `obj1`. * - * @return {object} [description] + * @return {object} The merged object. `obj1` and `obj2` are not modified. */ var MergeRight = function (obj1, obj2) { @@ -97171,12 +104611,12 @@ module.exports = MergeRight; /***/ }), -/* 432 */ +/* 465 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -97208,12 +104648,12 @@ module.exports = HasAll; /***/ }), -/* 433 */ +/* 466 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -97247,44 +104687,44 @@ module.exports = GetMinMaxValue; /***/ }), -/* 434 */ +/* 467 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.Utils.Object + * @namespace Phaser.Utils.Objects */ module.exports = { - Clone: __webpack_require__(63), - Extend: __webpack_require__(20), + Clone: __webpack_require__(70), + Extend: __webpack_require__(19), GetAdvancedValue: __webpack_require__(12), GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(433), + GetMinMaxValue: __webpack_require__(466), GetValue: __webpack_require__(4), - HasAll: __webpack_require__(432), - HasAny: __webpack_require__(298), - HasValue: __webpack_require__(85), + HasAll: __webpack_require__(465), + HasAny: __webpack_require__(302), + HasValue: __webpack_require__(91), IsPlainObject: __webpack_require__(8), - Merge: __webpack_require__(96), - MergeRight: __webpack_require__(431) + Merge: __webpack_require__(103), + MergeRight: __webpack_require__(464) }; /***/ }), -/* 435 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -97294,40 +104734,41 @@ module.exports = { module.exports = { - Array: __webpack_require__(164), - Objects: __webpack_require__(434), - String: __webpack_require__(430) + Array: __webpack_require__(174), + Objects: __webpack_require__(467), + String: __webpack_require__(463) }; /***/ }), -/* 436 */ +/* 469 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(203); -var PluginCache = __webpack_require__(15); -var TimelineBuilder = __webpack_require__(202); -var TWEEN_CONST = __webpack_require__(83); -var TweenBuilder = __webpack_require__(97); +var NumberTweenBuilder = __webpack_require__(219); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var TimelineBuilder = __webpack_require__(218); +var TWEEN_CONST = __webpack_require__(89); +var TweenBuilder = __webpack_require__(104); /** * @classdesc - * [description] + * The Tween Manager is a default Scene Plugin which controls and updates Tweens and Timelines. * * @class TweenManager * @memberof Phaser.Tweens * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which owns this Tween Manager. */ var TweenManager = new Class({ @@ -97336,7 +104777,7 @@ var TweenManager = new Class({ function TweenManager (scene) { /** - * [description] + * The Scene which owns this Tween Manager. * * @name Phaser.Tweens.TweenManager#scene * @type {Phaser.Scene} @@ -97345,7 +104786,7 @@ var TweenManager = new Class({ this.scene = scene; /** - * [description] + * The Systems object of the Scene which owns this Tween Manager. * * @name Phaser.Tweens.TweenManager#systems * @type {Phaser.Scenes.Systems} @@ -97354,7 +104795,9 @@ var TweenManager = new Class({ this.systems = scene.sys; /** - * [description] + * The time scale of the Tween Manager. + * + * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager. * * @name Phaser.Tweens.TweenManager#timeScale * @type {number} @@ -97364,7 +104807,7 @@ var TweenManager = new Class({ this.timeScale = 1; /** - * [description] + * An array of Tweens and Timelines which will be added to the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_add * @type {array} @@ -97374,7 +104817,7 @@ var TweenManager = new Class({ this._add = []; /** - * [description] + * An array of Tweens and Timelines pending to be later added to the Tween Manager. * * @name Phaser.Tweens.TweenManager#_pending * @type {array} @@ -97384,7 +104827,7 @@ var TweenManager = new Class({ this._pending = []; /** - * [description] + * An array of Tweens and Timelines which are still incomplete and are actively processed by the Tween Manager. * * @name Phaser.Tweens.TweenManager#_active * @type {array} @@ -97394,7 +104837,7 @@ var TweenManager = new Class({ this._active = []; /** - * [description] + * An array of Tweens and Timelines which will be removed from the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_destroy * @type {array} @@ -97404,7 +104847,7 @@ var TweenManager = new Class({ this._destroy = []; /** - * [description] + * The number of Tweens and Timelines which need to be processed by the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_toProcess * @type {integer} @@ -97414,8 +104857,8 @@ var TweenManager = new Class({ */ this._toProcess = 0; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -97428,7 +104871,7 @@ var TweenManager = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -97444,9 +104887,9 @@ var TweenManager = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); this.timeScale = 1; }, @@ -97457,9 +104900,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#createTimeline * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Timeline and its Tweens. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline object. */ createTimeline: function (config) { @@ -97472,9 +104915,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#timeline * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Timeline and its Tweens. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline object. */ timeline: function (config) { @@ -97496,9 +104939,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#create * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Tween as per {@link Phaser.Tweens.Builders.TweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Tween object. */ create: function (config) { @@ -97511,9 +104954,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#add * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Tween as per the {@link Phaser.Tweens.Builders.TweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Tween. */ add: function (config) { @@ -97532,7 +104975,7 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#existing * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to add. * * @return {Phaser.Tweens.TweenManager} This Tween Manager object. */ @@ -97551,9 +104994,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#addCounter * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Number Tween as per the {@link Phaser.Tweens.Builders.NumberTweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Number Tween. */ addCounter: function (config) { @@ -97567,7 +105010,9 @@ var TweenManager = new Class({ }, /** - * [description] + * Updates the Tween Manager's internal lists at the start of the frame. + * + * This method will return immediately if no changes have been indicated. * * @method Phaser.Tweens.TweenManager#preUpdate * @since 3.0.0 @@ -97645,12 +105090,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Updates all Tweens and Timelines of the Tween Manager. * * @method Phaser.Tweens.TweenManager#update * @since 3.0.0 * - * @param {number} timestamp - [description] + * @param {number} timestamp - The current time in milliseconds. * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ update: function (timestamp, delta) @@ -97677,12 +105122,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't. * * @method Phaser.Tweens.TweenManager#makeActive * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to check. * * @return {Phaser.Tweens.TweenManager} This Tween Manager object. */ @@ -97715,9 +105160,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#each * @since 3.0.0 * - * @param {function} callback - [description] - * @param {object} [scope] - [description] - * @param {...*} [args] - [description] + * @param {function} callback - The function to call. + * @param {object} [scope] - The scope (`this` object) to call the function with. + * @param {...*} [args] - The arguments to pass into the function. Its first argument will always be the Tween currently being iterated. */ each: function (callback, scope) { @@ -97737,12 +105182,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns an array of all active Tweens and Timelines in the Tween Manager. * * @method Phaser.Tweens.TweenManager#getAllTweens * @since 3.0.0 * - * @return {Phaser.Tweens.Tween[]} [description] + * @return {Phaser.Tweens.Tween[]} A new array containing references to all active Tweens and Timelines. */ getAllTweens: function () { @@ -97758,12 +105203,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns the scale of the time delta for all Tweens and Timelines owned by this Tween Manager. * * @method Phaser.Tweens.TweenManager#getGlobalTimeScale * @since 3.0.0 * - * @return {number} [description] + * @return {number} The scale of the time delta, usually 1. */ getGlobalTimeScale: function () { @@ -97771,14 +105216,14 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns an array of all Tweens or Timelines in the Tween Manager which affect the given target or array of targets. * * @method Phaser.Tweens.TweenManager#getTweensOf * @since 3.0.0 * - * @param {(object|array)} target - [description] + * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. * - * @return {Phaser.Tweens.Tween[]} [description] + * @return {Phaser.Tweens.Tween[]} A new array containing all Tweens and Timelines which affect the given target(s). */ getTweensOf: function (target) { @@ -97819,14 +105264,14 @@ var TweenManager = new Class({ }, /** - * [description] + * Checks if the given object is being affected by a playing Tween. * * @method Phaser.Tweens.TweenManager#isTweening * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - target Phaser.Tweens.Tween object * - * @return {boolean} [description] + * @return {boolean} returns if target tween object is active or not */ isTweening: function (target) { @@ -97847,12 +105292,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Stops all Tweens in this Tween Manager. They will be removed at the start of the frame. * * @method Phaser.Tweens.TweenManager#killAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ killAll: function () { @@ -97867,14 +105312,16 @@ var TweenManager = new Class({ }, /** - * [description] + * Stops all Tweens which affect the given target or array of targets. The Tweens will be removed from the Tween Manager at the start of the frame. + * + * @see {@link #getTweensOf} * * @method Phaser.Tweens.TweenManager#killTweensOf * @since 3.0.0 * - * @param {(object|array)} target - [description] + * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ killTweensOf: function (target) { @@ -97889,12 +105336,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Pauses all Tweens in this Tween Manager. * * @method Phaser.Tweens.TweenManager#pauseAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ pauseAll: function () { @@ -97909,12 +105356,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Resumes all Tweens in this Tween Manager. * * @method Phaser.Tweens.TweenManager#resumeAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ resumeAll: function () { @@ -97929,14 +105376,16 @@ var TweenManager = new Class({ }, /** - * [description] + * Sets a new scale of the time delta for this Tween Manager. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens. * * @method Phaser.Tweens.TweenManager#setGlobalTimeScale * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new scale of the time delta, where 1 is the normal speed. * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ setGlobalTimeScale: function (value) { @@ -97965,9 +105414,9 @@ var TweenManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -97981,7 +105430,7 @@ var TweenManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -97995,12 +105444,227 @@ module.exports = TweenManager; /***/ }), -/* 437 */ +/* 470 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Update Event. + * + * This event is dispatched by a Tween Timeline every time it updates, which can happen a lot of times per second, + * so be careful about listening to this event unless you absolutely require it. + * + * Listen to it from a Timeline instance using `Timeline.on('update', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('update', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_UPDATE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'update'; + + +/***/ }), +/* 471 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Start Event. + * + * This event is dispatched by a Tween Timeline when it starts. + * + * Listen to it from a Timeline instance using `Timeline.on('start', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('start', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_START + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'start'; + + +/***/ }), +/* 472 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Resume Event. + * + * This event is dispatched by a Tween Timeline when it is resumed from a paused state. + * + * Listen to it from a Timeline instance using `Timeline.on('resume', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('resume', listener); + * // At some point later ... + * timeline.resume(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_RESUME + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'resume'; + + +/***/ }), +/* 473 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Pause Event. + * + * This event is dispatched by a Tween Timeline when it is paused. + * + * Listen to it from a Timeline instance using `Timeline.on('pause', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('pause', listener); + * // At some point later ... + * timeline.pause(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_PAUSE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'pause'; + + +/***/ }), +/* 474 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Loop Event. + * + * This event is dispatched by a Tween Timeline every time it loops. + * + * Listen to it from a Timeline instance using `Timeline.on('loop', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * loop: 4, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('loop', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_LOOP + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + * @param {integer} loopCount - The number of loops left before this Timeline completes. + */ +module.exports = 'loop'; + + +/***/ }), +/* 475 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Complete Event. + * + * This event is dispatched by a Tween Timeline when it completes playback. + * + * Listen to it from a Timeline instance using `Timeline.on('complete', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('complete', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_COMPLETE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'complete'; + + +/***/ }), +/* 476 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -98067,12 +105731,12 @@ module.exports = [ /***/ }), -/* 438 */ +/* 477 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -98082,32 +105746,32 @@ module.exports = [ module.exports = { - GetBoolean: __webpack_require__(84), - GetEaseFunction: __webpack_require__(86), - GetNewValue: __webpack_require__(98), - GetProps: __webpack_require__(205), - GetTargets: __webpack_require__(131), - GetTweens: __webpack_require__(204), - GetValueOp: __webpack_require__(130), - NumberTweenBuilder: __webpack_require__(203), - TimelineBuilder: __webpack_require__(202), - TweenBuilder: __webpack_require__(97) + GetBoolean: __webpack_require__(90), + GetEaseFunction: __webpack_require__(92), + GetNewValue: __webpack_require__(105), + GetProps: __webpack_require__(221), + GetTargets: __webpack_require__(143), + GetTweens: __webpack_require__(220), + GetValueOp: __webpack_require__(142), + NumberTweenBuilder: __webpack_require__(219), + TimelineBuilder: __webpack_require__(218), + TweenBuilder: __webpack_require__(104) }; /***/ }), -/* 439 */ +/* 478 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(83); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(89); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Tweens @@ -98115,12 +105779,13 @@ var Extend = __webpack_require__(20); var Tweens = { - Builders: __webpack_require__(438), + Builders: __webpack_require__(477), + Events: __webpack_require__(216), - TweenManager: __webpack_require__(436), - Tween: __webpack_require__(128), - TweenData: __webpack_require__(127), - Timeline: __webpack_require__(201) + TweenManager: __webpack_require__(469), + Tween: __webpack_require__(140), + TweenData: __webpack_require__(139), + Timeline: __webpack_require__(217) }; @@ -98131,29 +105796,30 @@ module.exports = Tweens; /***/ }), -/* 440 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); -var TimerEvent = __webpack_require__(206); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var TimerEvent = __webpack_require__(222); /** * @classdesc - * [description] + * The Clock is a Scene plugin which creates and updates Timer Events for its Scene. * * @class Clock * @memberof Phaser.Time * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which owns this Clock. */ var Clock = new Class({ @@ -98162,7 +105828,7 @@ var Clock = new Class({ function Clock (scene) { /** - * [description] + * The Scene which owns this Clock. * * @name Phaser.Time.Clock#scene * @type {Phaser.Scene} @@ -98171,7 +105837,7 @@ var Clock = new Class({ this.scene = scene; /** - * [description] + * The Scene Systems object of the Scene which owns this Clock. * * @name Phaser.Time.Clock#systems * @type {Phaser.Scenes.Systems} @@ -98180,7 +105846,9 @@ var Clock = new Class({ this.systems = scene.sys; /** - * [description] + * The current time of the Clock, in milliseconds. + * + * If accessed externally, this is equivalent to the `time` parameter normally passed to a Scene's `update` method. * * @name Phaser.Time.Clock#now * @type {number} @@ -98192,7 +105860,9 @@ var Clock = new Class({ // which then influences anything using this Clock for calculations, like TimerEvents /** - * [description] + * The scale of the Clock's time delta. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Clock and anything which uses it, such as its Timer Events. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing the Clock. * * @name Phaser.Time.Clock#timeScale * @type {number} @@ -98202,7 +105872,9 @@ var Clock = new Class({ this.timeScale = 1; /** - * [description] + * Whether the Clock is paused (`true`) or active (`false`). + * + * When paused, the Clock will not update any of its Timer Events, thus freezing time. * * @name Phaser.Time.Clock#paused * @type {boolean} @@ -98212,7 +105884,7 @@ var Clock = new Class({ this.paused = false; /** - * [description] + * An array of all Timer Events whose delays haven't expired - these are actively updating Timer Events. * * @name Phaser.Time.Clock#_active * @type {Phaser.Time.TimerEvent[]} @@ -98223,7 +105895,7 @@ var Clock = new Class({ this._active = []; /** - * [description] + * An array of all Timer Events which will be added to the Clock at the start of the frame. * * @name Phaser.Time.Clock#_pendingInsertion * @type {Phaser.Time.TimerEvent[]} @@ -98234,7 +105906,7 @@ var Clock = new Class({ this._pendingInsertion = []; /** - * [description] + * An array of all Timer Events which will be removed from the Clock at the start of the frame. * * @name Phaser.Time.Clock#_pendingRemoval * @type {Phaser.Time.TimerEvent[]} @@ -98244,8 +105916,8 @@ var Clock = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -98258,7 +105930,7 @@ var Clock = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -98274,20 +105946,20 @@ var Clock = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * [description] + * Creates a Timer Event and adds it to the Clock at the start of the frame. * * @method Phaser.Time.Clock#addEvent * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The configuration for the Timer Event. * - * @return {Phaser.Time.TimerEvent} [description] + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ addEvent: function (config) { @@ -98299,17 +105971,19 @@ var Clock = new Class({ }, /** - * [description] + * Creates a Timer Event and adds it to the Clock at the start of the frame. + * + * This is a shortcut for {@link #addEvent} which can be shorter and is compatible with the syntax of the GreenSock Animation Platform (GSAP). * * @method Phaser.Time.Clock#delayedCall * @since 3.0.0 * - * @param {number} delay - [description] - * @param {function} callback - [description] - * @param {Array.<*>} args - [description] - * @param {*} callbackScope - [description] + * @param {number} delay - The delay of the function call, in milliseconds. + * @param {function} callback - The function to call after the delay expires. + * @param {Array.<*>} args - The arguments to call the function with. + * @param {*} callbackScope - The scope (`this` object) to call the function with. * - * @return {Phaser.Time.TimerEvent} [description] + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ delayedCall: function (delay, callback, args, callbackScope) { @@ -98317,12 +105991,12 @@ var Clock = new Class({ }, /** - * [description] + * Clears and recreates the array of pending Timer Events. * * @method Phaser.Time.Clock#clearPendingEvents * @since 3.0.0 * - * @return {Phaser.Time.Clock} [description] + * @return {Phaser.Time.Clock} This Clock object. */ clearPendingEvents: function () { @@ -98332,12 +106006,12 @@ var Clock = new Class({ }, /** - * [description] + * Schedules all active Timer Events for removal at the start of the frame. * * @method Phaser.Time.Clock#removeAllEvents * @since 3.0.0 * - * @return {Phaser.Time.Clock} [description] + * @return {Phaser.Time.Clock} This Clock object. */ removeAllEvents: function () { @@ -98347,7 +106021,7 @@ var Clock = new Class({ }, /** - * [description] + * Updates the arrays of active and pending Timer Events. Called at the start of the frame. * * @method Phaser.Time.Clock#preUpdate * @since 3.0.0 @@ -98398,7 +106072,7 @@ var Clock = new Class({ }, /** - * [description] + * Updates the Clock's internal time and all of its Timer Events. * * @method Phaser.Time.Clock#update * @since 3.0.0 @@ -98494,9 +106168,9 @@ var Clock = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -98511,7 +106185,7 @@ var Clock = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -98525,12 +106199,12 @@ module.exports = Clock; /***/ }), -/* 441 */ +/* 480 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -98540,24 +106214,24 @@ module.exports = Clock; module.exports = { - Clock: __webpack_require__(440), - TimerEvent: __webpack_require__(206) + Clock: __webpack_require__(479), + TimerEvent: __webpack_require__(222) }; /***/ }), -/* 442 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var ParseToTilemap = __webpack_require__(132); +var ParseToTilemap = __webpack_require__(144); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -98613,17 +106287,17 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 443 */ +/* 482 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); -var ParseToTilemap = __webpack_require__(132); +var GameObjectCreator = __webpack_require__(14); +var ParseToTilemap = __webpack_require__(144); /** * @typedef {object} TilemapConfig @@ -98674,12 +106348,12 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 444 */ +/* 483 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -98765,8 +106439,10 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer if (tileTexCoords) { - var halfWidth = tile.width / 2; - var halfHeight = tile.height / 2; + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; + var halfWidth = tileWidth / 2; + var halfHeight = tileHeight / 2; ctx.save(); @@ -98787,9 +106463,9 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer ctx.drawImage( image, tileTexCoords.x, tileTexCoords.y, - tile.width, tile.height, + tileWidth, tileHeight, -halfWidth, -halfHeight, - tile.width, tile.height + tileWidth, tileHeight ); ctx.restore(); @@ -98803,12 +106479,12 @@ module.exports = StaticTilemapLayerCanvasRenderer; /***/ }), -/* 445 */ +/* 484 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -98875,12 +106551,12 @@ module.exports = StaticTilemapLayerWebGLRenderer; /***/ }), -/* 446 */ +/* 485 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -98889,12 +106565,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(445); + renderWebGL = __webpack_require__(484); } if (true) { - renderCanvas = __webpack_require__(444); + renderCanvas = __webpack_require__(483); } module.exports = { @@ -98906,12 +106582,12 @@ module.exports = { /***/ }), -/* 447 */ +/* 486 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -99033,16 +106709,16 @@ module.exports = DynamicTilemapLayerCanvasRenderer; /***/ }), -/* 448 */ +/* 487 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -99128,7 +106804,7 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer src, texture, texture.width, texture.height, - (tw + x + tile.pixelX) * sx, (th + y + tile.pixelY) * sy, + x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), tile.width, tile.height, sx, sy, tile.rotation, @@ -99150,12 +106826,12 @@ module.exports = DynamicTilemapLayerWebGLRenderer; /***/ }), -/* 449 */ +/* 488 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -99164,12 +106840,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(448); + renderWebGL = __webpack_require__(487); } if (true) { - renderCanvas = __webpack_require__(447); + renderCanvas = __webpack_require__(486); } module.exports = { @@ -99181,16 +106857,16 @@ module.exports = { /***/ }), -/* 450 */ +/* 489 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tileset = __webpack_require__(99); +var Tileset = __webpack_require__(106); /** * [description] @@ -99232,17 +106908,17 @@ module.exports = ParseTilesets; /***/ }), -/* 451 */ +/* 490 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LayerData = __webpack_require__(78); -var Tile = __webpack_require__(55); +var LayerData = __webpack_require__(84); +var Tile = __webpack_require__(61); /** * [description] @@ -99316,16 +106992,16 @@ module.exports = ParseTileLayers; /***/ }), -/* 452 */ +/* 491 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Extend = __webpack_require__(20); +var Extend = __webpack_require__(19); /** * Copy properties from tileset to tiles. @@ -99389,12 +107065,12 @@ module.exports = AssignTileProperties; /***/ }), -/* 453 */ +/* 492 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -99462,28 +107138,28 @@ module.exports = BuildTilesetIndex; /***/ }), -/* 454 */ +/* 493 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(212); -var ObjectLayer = __webpack_require__(211); +var ParseObject = __webpack_require__(228); +var ObjectLayer = __webpack_require__(227); /** - * [description] + * Parses a Tiled JSON object into an array of ObjectLayer objects. * * @function Phaser.Tilemaps.Parsers.Tiled.ParseObjectLayers * @since 3.0.0 * - * @param {object} json - [description] + * @param {object} json - The Tiled JSON object. * - * @return {array} [description] + * @return {array} An array of all object layers in the tilemap as `ObjectLayer`s. */ var ParseObjectLayers = function (json) { @@ -99521,27 +107197,27 @@ module.exports = ParseObjectLayers; /***/ }), -/* 455 */ +/* 494 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasValue = __webpack_require__(85); +var HasValue = __webpack_require__(91); /** - * [description] + * Returns a new object that only contains the `keys` that were found on the object provided. If no `keys` are found, an empty object is returned. * * @function Phaser.Tilemaps.Parsers.Tiled.Pick * @since 3.0.0 * - * @param {object} object - [description] - * @param {array} keys - [description] + * @param {object} object - The object to pick the provided keys from. + * @param {array} keys - An array of properties to retrieve from the provided object. * - * @return {object} [description] + * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. */ var Pick = function (object, keys) { @@ -99564,18 +107240,18 @@ module.exports = Pick; /***/ }), -/* 456 */ +/* 495 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tileset = __webpack_require__(99); -var ImageCollection = __webpack_require__(213); -var ParseObject = __webpack_require__(212); +var Tileset = __webpack_require__(106); +var ImageCollection = __webpack_require__(229); +var ParseObject = __webpack_require__(228); /** * Tilesets & Image Collections @@ -99647,6 +107323,19 @@ var ParseTilesets = function (json) tiles[tile.id].objectgroup.objects = parsedObjects2; } } + + // Copy animation data + if (tile.animation) + { + if (tiles.hasOwnProperty(tile.id)) + { + tiles[tile.id].animation = tile.animation; + } + else + { + tiles[tile.id] = { animation: tile.animation }; + } + } } newSet.tileData = tiles; @@ -99720,12 +107409,12 @@ module.exports = ParseTilesets; /***/ }), -/* 457 */ +/* 496 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -99772,12 +107461,12 @@ module.exports = ParseImageLayers; /***/ }), -/* 458 */ +/* 497 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -99815,20 +107504,20 @@ module.exports = Base64Decode; /***/ }), -/* 459 */ +/* 498 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Base64Decode = __webpack_require__(458); +var Base64Decode = __webpack_require__(497); var GetFastValue = __webpack_require__(2); -var LayerData = __webpack_require__(78); -var ParseGID = __webpack_require__(214); -var Tile = __webpack_require__(55); +var LayerData = __webpack_require__(84); +var ParseGID = __webpack_require__(230); +var Tile = __webpack_require__(61); /** * [description] @@ -99941,12 +107630,12 @@ module.exports = ParseTileLayers; /***/ }), -/* 460 */ +/* 499 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -99956,28 +107645,28 @@ module.exports = ParseTileLayers; module.exports = { - Parse: __webpack_require__(217), - Parse2DArray: __webpack_require__(133), - ParseCSV: __webpack_require__(216), + Parse: __webpack_require__(233), + Parse2DArray: __webpack_require__(145), + ParseCSV: __webpack_require__(232), - Impact: __webpack_require__(210), - Tiled: __webpack_require__(215) + Impact: __webpack_require__(226), + Tiled: __webpack_require__(231) }; /***/ }), -/* 461 */ +/* 500 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); var Vector2 = __webpack_require__(3); /** @@ -100012,16 +107701,16 @@ module.exports = WorldToTileXY; /***/ }), -/* 462 */ +/* 501 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -100092,17 +107781,17 @@ module.exports = WeightedRandomize; /***/ }), -/* 463 */ +/* 502 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileToWorldX = __webpack_require__(101); -var TileToWorldY = __webpack_require__(100); +var TileToWorldX = __webpack_require__(108); +var TileToWorldY = __webpack_require__(107); var Vector2 = __webpack_require__(3); /** @@ -100136,16 +107825,16 @@ module.exports = TileToWorldXY; /***/ }), -/* 464 */ +/* 503 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -100187,17 +107876,17 @@ module.exports = SwapByIndex; /***/ }), -/* 465 */ +/* 504 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var ShuffleArray = __webpack_require__(122); +var GetTilesWithin = __webpack_require__(21); +var ShuffleArray = __webpack_require__(132); /** * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given @@ -100232,16 +107921,16 @@ module.exports = Shuffle; /***/ }), -/* 466 */ +/* 505 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. @@ -100275,12 +107964,12 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 467 */ +/* 506 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -100322,17 +108011,17 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 468 */ +/* 507 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); /** * Sets collision on the tiles within a layer by checking each tile's collision group data @@ -100382,18 +108071,18 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 469 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var HasValue = __webpack_require__(85); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var HasValue = __webpack_require__(91); /** * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property @@ -100457,18 +108146,18 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 470 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(134); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var SetLayerCollisionIndex = __webpack_require__(146); /** * Sets collision on all tiles in the given layer, except for tiles that have an index specified in @@ -100514,18 +108203,18 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 471 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(134); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var SetLayerCollisionIndex = __webpack_require__(146); /** * Sets collision on a range of tiles in a layer whose index is between the specified `start` and @@ -100582,18 +108271,18 @@ module.exports = SetCollisionBetween; /***/ }), -/* 472 */ +/* 511 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(134); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var SetLayerCollisionIndex = __webpack_require__(146); /** * Sets collision on the given tile or tiles within a layer by index. You can pass in either a @@ -100645,17 +108334,17 @@ module.exports = SetCollision; /***/ }), -/* 473 */ +/* 512 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var Color = __webpack_require__(347); +var GetTilesWithin = __webpack_require__(21); +var Color = __webpack_require__(354); var defaultTileColor = new Color(105, 210, 231, 150); var defaultCollidingTileColor = new Color(243, 134, 48, 200); @@ -100734,18 +108423,18 @@ module.exports = RenderDebug; /***/ }), -/* 474 */ +/* 513 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RemoveTileAt = __webpack_require__(218); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var RemoveTileAt = __webpack_require__(234); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Removes the tile at the given world coordinates in the specified layer and updates the layer's @@ -100775,17 +108464,17 @@ module.exports = RemoveTileAtWorldXY; /***/ }), -/* 475 */ +/* 514 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var GetRandom = __webpack_require__(162); +var GetTilesWithin = __webpack_require__(21); +var GetRandom = __webpack_require__(172); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -100833,17 +108522,17 @@ module.exports = Randomize; /***/ }), -/* 476 */ +/* 515 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CalculateFacesWithin = __webpack_require__(34); -var PutTileAt = __webpack_require__(135); +var CalculateFacesWithin = __webpack_require__(37); +var PutTileAt = __webpack_require__(147); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -100897,18 +108586,18 @@ module.exports = PutTilesAt; /***/ }), -/* 477 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PutTileAt = __webpack_require__(135); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var PutTileAt = __webpack_require__(147); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either @@ -100940,18 +108629,18 @@ module.exports = PutTileAtWorldXY; /***/ }), -/* 478 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasTileAt = __webpack_require__(219); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var HasTileAt = __webpack_require__(235); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns @@ -100980,18 +108669,18 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 479 */ +/* 518 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var GetTilesWithin = __webpack_require__(21); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. @@ -101030,23 +108719,23 @@ module.exports = GetTilesWithinWorldXY; /***/ }), -/* 480 */ +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Geom = __webpack_require__(274); -var GetTilesWithin = __webpack_require__(17); -var Intersects = __webpack_require__(273); +var Geom = __webpack_require__(279); +var GetTilesWithin = __webpack_require__(21); +var Intersects = __webpack_require__(278); var NOOP = __webpack_require__(1); -var TileToWorldX = __webpack_require__(101); -var TileToWorldY = __webpack_require__(100); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var TileToWorldX = __webpack_require__(108); +var TileToWorldY = __webpack_require__(107); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); var TriangleToRectangle = function (triangle, rect) { @@ -101127,18 +108816,18 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 481 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTileAt = __webpack_require__(102); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var GetTileAt = __webpack_require__(109); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Gets a tile at the given world coordinates from the given layer. @@ -101168,16 +108857,16 @@ module.exports = GetTileAtWorldXY; /***/ }), -/* 482 */ +/* 521 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * @callback EachTileCallback @@ -101218,16 +108907,16 @@ module.exports = ForEachTile; /***/ }), -/* 483 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * @callback FindTileCallback @@ -101272,12 +108961,12 @@ module.exports = FindTile; /***/ }), -/* 484 */ +/* 523 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101360,16 +109049,16 @@ module.exports = FindByIndex; /***/ }), -/* 485 */ +/* 524 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given @@ -101408,18 +109097,18 @@ module.exports = FilterTiles; /***/ }), -/* 486 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var CalculateFacesWithin = __webpack_require__(34); -var SetTileCollision = __webpack_require__(56); +var GetTilesWithin = __webpack_require__(21); +var CalculateFacesWithin = __webpack_require__(37); +var SetTileCollision = __webpack_require__(62); /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the @@ -101462,17 +109151,17 @@ module.exports = Fill; /***/ }), -/* 487 */ +/* 526 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SnapFloor = __webpack_require__(142); -var SnapCeil = __webpack_require__(243); +var SnapFloor = __webpack_require__(98); +var SnapCeil = __webpack_require__(375); /** * Returns the tiles in the given layer that are within the camera's viewport. This is used internally. @@ -101538,15 +109227,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawTop; y < drawBottom; y++) { - for (x = drawLeft; x < drawRight; x++) + for (x = drawLeft; mapData[y] && x < drawRight; x++) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -101557,15 +109246,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawTop; y < drawBottom; y++) { - for (x = drawRight; x >= drawLeft; x--) + for (x = drawRight; mapData[y] && x >= drawLeft; x--) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -101576,15 +109265,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawBottom; y >= drawTop; y--) { - for (x = drawLeft; x < drawRight; x++) + for (x = drawLeft; mapData[y] && x < drawRight; x++) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -101595,15 +109284,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawBottom; y >= drawTop; y--) { - for (x = drawRight; x >= drawLeft; x--) + for (x = drawRight; mapData[y] && x >= drawLeft; x--) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -101619,19 +109308,19 @@ module.exports = CullTiles; /***/ }), -/* 488 */ +/* 527 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileToWorldX = __webpack_require__(101); -var TileToWorldY = __webpack_require__(100); -var GetTilesWithin = __webpack_require__(17); -var ReplaceByIndex = __webpack_require__(220); +var TileToWorldX = __webpack_require__(108); +var TileToWorldY = __webpack_require__(107); +var GetTilesWithin = __webpack_require__(21); +var ReplaceByIndex = __webpack_require__(236); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -101704,17 +109393,17 @@ module.exports = CreateFromTiles; /***/ }), -/* 489 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var CalculateFacesWithin = __webpack_require__(34); +var GetTilesWithin = __webpack_require__(21); +var CalculateFacesWithin = __webpack_require__(37); /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile @@ -101769,12 +109458,12 @@ module.exports = Copy; /***/ }), -/* 490 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101784,35 +109473,35 @@ module.exports = Copy; module.exports = { - Components: __webpack_require__(103), - Parsers: __webpack_require__(460), + Components: __webpack_require__(110), + Parsers: __webpack_require__(499), - Formats: __webpack_require__(29), - ImageCollection: __webpack_require__(213), - ParseToTilemap: __webpack_require__(132), - Tile: __webpack_require__(55), - Tilemap: __webpack_require__(209), - TilemapCreator: __webpack_require__(443), - TilemapFactory: __webpack_require__(442), - Tileset: __webpack_require__(99), + Formats: __webpack_require__(31), + ImageCollection: __webpack_require__(229), + ParseToTilemap: __webpack_require__(144), + Tile: __webpack_require__(61), + Tilemap: __webpack_require__(225), + TilemapCreator: __webpack_require__(482), + TilemapFactory: __webpack_require__(481), + Tileset: __webpack_require__(106), - LayerData: __webpack_require__(78), - MapData: __webpack_require__(77), - ObjectLayer: __webpack_require__(211), + LayerData: __webpack_require__(84), + MapData: __webpack_require__(83), + ObjectLayer: __webpack_require__(227), - DynamicTilemapLayer: __webpack_require__(208), - StaticTilemapLayer: __webpack_require__(207) + DynamicTilemapLayer: __webpack_require__(224), + StaticTilemapLayer: __webpack_require__(223) }; /***/ }), -/* 491 */ +/* 530 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101847,17 +109536,17 @@ module.exports = CONST; /***/ }), -/* 492 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Extend = __webpack_require__(20); -var FilterMode = __webpack_require__(491); +var Extend = __webpack_require__(19); +var FilterMode = __webpack_require__(530); /** * @namespace Phaser.Textures @@ -101879,12 +109568,13 @@ var FilterMode = __webpack_require__(491); var Textures = { + Events: __webpack_require__(126), FilterMode: FilterMode, - Frame: __webpack_require__(113), - Parsers: __webpack_require__(316), - Texture: __webpack_require__(165), - TextureManager: __webpack_require__(318), - TextureSource: __webpack_require__(317) + Frame: __webpack_require__(121), + Parsers: __webpack_require__(319), + Texture: __webpack_require__(175), + TextureManager: __webpack_require__(321), + TextureSource: __webpack_require__(320) }; @@ -101894,12 +109584,12 @@ module.exports = Textures; /***/ }), -/* 493 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101909,23 +109599,24 @@ module.exports = Textures; module.exports = { - List: __webpack_require__(112), - Map: __webpack_require__(180), - ProcessQueue: __webpack_require__(228), - RTree: __webpack_require__(227), - Set: __webpack_require__(95) + List: __webpack_require__(120), + Map: __webpack_require__(194), + ProcessQueue: __webpack_require__(244), + RTree: __webpack_require__(243), + Set: __webpack_require__(102), + Size: __webpack_require__(333) }; /***/ }), -/* 494 */ +/* 533 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101960,37 +109651,40 @@ module.exports = { module.exports = { - SoundManagerCreator: __webpack_require__(325), + SoundManagerCreator: __webpack_require__(328), - BaseSound: __webpack_require__(114), - BaseSoundManager: __webpack_require__(115), + Events: __webpack_require__(69), - WebAudioSound: __webpack_require__(319), - WebAudioSoundManager: __webpack_require__(320), + BaseSound: __webpack_require__(122), + BaseSoundManager: __webpack_require__(123), - HTML5AudioSound: __webpack_require__(323), - HTML5AudioSoundManager: __webpack_require__(324), + WebAudioSound: __webpack_require__(322), + WebAudioSoundManager: __webpack_require__(323), - NoAudioSound: __webpack_require__(321), - NoAudioSoundManager: __webpack_require__(322) + HTML5AudioSound: __webpack_require__(326), + HTML5AudioSoundManager: __webpack_require__(327), + + NoAudioSound: __webpack_require__(324), + NoAudioSoundManager: __webpack_require__(325) }; /***/ }), -/* 495 */ +/* 534 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(16); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); /** * @classdesc @@ -102134,8 +109828,8 @@ var ScenePlugin = new Class({ */ this._willRemove = false; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(Events.BOOT, this.boot, this); + scene.sys.events.on(Events.START, this.pluginStart, this); }, /** @@ -102148,7 +109842,7 @@ var ScenePlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(Events.DESTROY, this.destroy, this); }, /** @@ -102164,7 +109858,7 @@ var ScenePlugin = new Class({ { this._target = null; - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(Events.SHUTDOWN, this.shutdown, this); }, /** @@ -102193,7 +109887,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#restart * @since 3.4.0 - * + * * @param {object} [data] - The Scene data. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. @@ -102209,8 +109903,8 @@ var ScenePlugin = new Class({ }, /** - * @typedef {object} Phaser.Scenes.ScenePlugin.SceneTransitionConfig - * + * @typedef {object} SceneTransitionConfig + * * @property {string} target - The Scene key to transition to. * @property {integer} [duration=1000] - The duration, in ms, for the transition to last. * @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`) @@ -102224,24 +109918,24 @@ var ScenePlugin = new Class({ /** * This will start a transition from the current Scene to the target Scene given. - * + * * The transition will last for the duration specified in milliseconds. - * + * * You can have the target Scene moved above or below this one in the display list. - * + * * You can specify an update callback. This callback will be invoked _every frame_ for the duration * of the transition. * * This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop. - * - * There are also 5 transition related events: This scene will emit the event `transitionto` when + * + * There are also 5 transition related events: This scene will emit the event `transitionout` when * the transition begins, which is typically the frame after calling this method. - * + * * The target Scene will emit the event `transitioninit` when that Scene's `init` method is called. * It will then emit the event `transitionstart` when its `create` method is called. * If the Scene was sleeping and has been woken up, it will emit the event `transitionwake` instead of these two, * as the Scenes `init` and `create` methods are not invoked when a Scene wakes up. - * + * * When the duration of the transition has elapsed it will emit the event `transitioncomplete`. * These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep. * @@ -102251,11 +109945,12 @@ var ScenePlugin = new Class({ * this Scenes update loop to stop, then the transition will also pause for that duration. There are * checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to * override this understand that until the target Scene completes it might never be unlocked for input events. - * + * * @method Phaser.Scenes.ScenePlugin#transition + * @fires Phaser.Scenes.Events#TRANSITION_OUT * @since 3.5.0 * - * @param {Phaser.Scenes.ScenePlugin.SceneTransitionConfig} config - The transition configuration object. + * @param {SceneTransitionConfig} config - The transition configuration object. * * @return {boolean} `true` is the transition was started, otherwise `false`. */ @@ -102317,9 +110012,9 @@ var ScenePlugin = new Class({ this.manager.start(key, GetFastValue(config, 'data')); } - this.systems.events.emit('transitionout', target, duration); + this.systems.events.emit(Events.TRANSITION_OUT, target, duration); - this.systems.events.on('update', this.step, this); + this.systems.events.on(Events.UPDATE, this.step, this); return true; }, @@ -102379,6 +110074,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#transitionComplete * @private + * @fires Phaser.Scenes.Events#TRANSITION_COMPLETE * @since 3.5.0 */ transitionComplete: function () @@ -102387,10 +110083,10 @@ var ScenePlugin = new Class({ var targetSettings = this._target.sys.settings; // Stop the step - this.systems.events.off('update', this.step, this); + this.systems.events.off(Events.UPDATE, this.step, this); // Notify target scene - targetSys.events.emit('transitioncomplete', this.scene); + targetSys.events.emit(Events.TRANSITION_COMPLETE, this.scene); // Clear target scene settings targetSettings.isTransition = false; @@ -102426,12 +110122,13 @@ var ScenePlugin = new Class({ * @param {string} key - The Scene key. * @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene. * @param {boolean} autoStart - Whether to start the Scene after it's added. + * @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ - add: function (key, sceneConfig, autoStart) + add: function (key, sceneConfig, autoStart, data) { - this.manager.add(key, sceneConfig, autoStart); + this.manager.add(key, sceneConfig, autoStart, data); return this; }, @@ -102459,7 +110156,7 @@ var ScenePlugin = new Class({ /** * Runs the given Scene, but does not change the state of this Scene. - * + * * If the given Scene is paused, it will resume it. If sleeping, it will wake it. * If not running at all, it will be started. * @@ -102590,7 +110287,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#stop * @since 3.0.0 * - * @param {string} key - The Scene to stop. + * @param {string} [key] - The Scene to stop. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -102660,7 +110357,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isSleeping * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is sleeping. */ @@ -102677,7 +110374,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isActive * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is active. */ @@ -102694,7 +110391,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isVisible * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is visible. */ @@ -102792,7 +110489,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#remove * @since 3.2.0 * - * @param {(string|Phaser.Scene)} key - The Scene to be removed. + * @param {(string|Phaser.Scene)} [key] - The Scene to be removed. * * @return {Phaser.Scenes.SceneManager} This SceneManager. */ @@ -102811,7 +110508,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveUp * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -102830,7 +110527,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveDown * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -102851,7 +110548,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#bringToTop * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -102872,7 +110569,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#sendToBack * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -102929,9 +110626,9 @@ var ScenePlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('shutdown', this.shutdown, this); - eventEmitter.off('postupdate', this.step, this); - eventEmitter.off('transitionout'); + eventEmitter.off(Events.SHUTDOWN, this.shutdown, this); + eventEmitter.off(Events.POST_UPDATE, this.step, this); + eventEmitter.off(Events.TRANSITION_OUT); }, /** @@ -102946,7 +110643,7 @@ var ScenePlugin = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(Events.START, this.start, this); this.scene = null; this.systems = null; @@ -102962,17 +110659,17 @@ module.exports = ScenePlugin; /***/ }), -/* 496 */ +/* 535 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(116); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(124); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Scenes @@ -102980,10 +110677,11 @@ var Extend = __webpack_require__(20); var Scene = { - SceneManager: __webpack_require__(329), - ScenePlugin: __webpack_require__(495), - Settings: __webpack_require__(326), - Systems: __webpack_require__(166) + Events: __webpack_require__(16), + SceneManager: __webpack_require__(332), + ScenePlugin: __webpack_require__(534), + Settings: __webpack_require__(329), + Systems: __webpack_require__(176) }; @@ -102994,17 +110692,74 @@ module.exports = Scene; /***/ }), -/* 497 */ +/* 536 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Extend = __webpack_require__(19); +var CONST = __webpack_require__(178); + +/** + * @namespace Phaser.Scale + * + * @borrows Phaser.Scale.Center.NO_CENTER as NO_CENTER + * @borrows Phaser.Scale.Center.CENTER_BOTH as CENTER_BOTH + * @borrows Phaser.Scale.Center.CENTER_HORIZONTALLY as CENTER_HORIZONTALLY + * @borrows Phaser.Scale.Center.CENTER_VERTICALLY as CENTER_VERTICALLY + * + * @borrows Phaser.Scale.Orientation.LANDSCAPE as LANDSCAPE + * @borrows Phaser.Scale.Orientation.PORTRAIT as PORTRAIT + * + * @borrows Phaser.Scale.ScaleModes.NONE as NONE + * @borrows Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT as WIDTH_CONTROLS_HEIGHT + * @borrows Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH as HEIGHT_CONTROLS_WIDTH + * @borrows Phaser.Scale.ScaleModes.FIT as FIT + * @borrows Phaser.Scale.ScaleModes.ENVELOP as ENVELOP + * @borrows Phaser.Scale.ScaleModes.RESIZE as RESIZE + * + * @borrows Phaser.Scale.Zoom.NO_ZOOM as NO_ZOOM + * @borrows Phaser.Scale.Zoom.ZOOM_2X as ZOOM_2X + * @borrows Phaser.Scale.Zoom.ZOOM_4X as ZOOM_4X + * @borrows Phaser.Scale.Zoom.MAX_ZOOM as MAX_ZOOM + */ + +var Scale = { + + Center: __webpack_require__(349), + Events: __webpack_require__(334), + Orientation: __webpack_require__(348), + ScaleManager: __webpack_require__(335), + ScaleModes: __webpack_require__(347), + Zoom: __webpack_require__(346) + +}; + +Scale = Extend(false, Scale, CONST.CENTER); +Scale = Extend(false, Scale, CONST.ORIENTATION); +Scale = Extend(false, Scale, CONST.SCALE_MODE); +Scale = Extend(false, Scale, CONST.ZOOM); + +module.exports = Scale; + + +/***/ }), +/* 537 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ -var BasePlugin = __webpack_require__(221); +var BasePlugin = __webpack_require__(237); var Class = __webpack_require__(0); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -103034,7 +110789,7 @@ var ScenePlugin = new Class({ this.scene = scene; this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); }, /** @@ -103082,12 +110837,12 @@ module.exports = ScenePlugin; /***/ }), -/* 498 */ +/* 538 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103097,47 +110852,53 @@ module.exports = ScenePlugin; module.exports = { - BasePlugin: __webpack_require__(221), - DefaultPlugins: __webpack_require__(167), - PluginCache: __webpack_require__(15), - PluginManager: __webpack_require__(331), - ScenePlugin: __webpack_require__(497) + BasePlugin: __webpack_require__(237), + DefaultPlugins: __webpack_require__(181), + PluginCache: __webpack_require__(17), + PluginManager: __webpack_require__(336), + ScenePlugin: __webpack_require__(537) }; /***/ }), -/* 499 */, -/* 500 */, -/* 501 */, -/* 502 */, -/* 503 */, -/* 504 */, -/* 505 */, -/* 506 */, -/* 507 */ +/* 539 */, +/* 540 */, +/* 541 */, +/* 542 */, +/* 543 */, +/* 544 */, +/* 545 */, +/* 546 */, +/* 547 */, +/* 548 */, +/* 549 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapY = __webpack_require__(229); +var GetOverlapY = __webpack_require__(245); /** - * [description] + * Separates two overlapping bodies on the Y-axis (vertically). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} [description] + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. */ var SeparateY = function (body1, body2, overlapOnly, bias) { @@ -103202,29 +110963,33 @@ module.exports = SeparateY; /***/ }), -/* 508 */ +/* 550 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapX = __webpack_require__(230); +var GetOverlapX = __webpack_require__(246); /** - * [description] + * Separates two overlapping bodies on the X-axis (horizontally). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateX * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} [description] + * @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`. */ var SeparateX = function (body1, body2, overlapOnly, bias) { @@ -103289,12 +111054,12 @@ module.exports = SeparateX; /***/ }), -/* 509 */ +/* 551 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103336,28 +111101,29 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 510 */ +/* 552 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(509); +var ProcessTileSeparationY = __webpack_require__(551); /** * Check the body against the given tile on the Y axis. + * Used internally by the SeparateTile function. * * @function Phaser.Physics.Arcade.Tilemap.TileCheckY * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileTop - [description] - * @param {number} tileBottom - [description] - * @param {number} tileBias - [description] + * @param {number} tileTop - The top position of the tile within the tile world. + * @param {number} tileBottom - The bottom position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * * @return {number} The amount of separation that occurred. */ @@ -103411,12 +111177,12 @@ module.exports = TileCheckY; /***/ }), -/* 511 */ +/* 553 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103458,28 +111224,29 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 512 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(511); +var ProcessTileSeparationX = __webpack_require__(553); /** * Check the body against the given tile on the X axis. + * Used internally by the SeparateTile function. * * @function Phaser.Physics.Arcade.Tilemap.TileCheckX * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileLeft - [description] - * @param {number} tileRight - [description] - * @param {number} tileBias - [description] + * @param {number} tileLeft - The left position of the tile within the tile world. + * @param {number} tileRight - The right position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * * @return {number} The amount of separation that occurred. */ @@ -103533,18 +111300,18 @@ module.exports = TileCheckX; /***/ }), -/* 513 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileCheckX = __webpack_require__(512); -var TileCheckY = __webpack_require__(510); -var TileIntersectsBody = __webpack_require__(226); +var TileCheckX = __webpack_require__(554); +var TileCheckY = __webpack_require__(552); +var TileIntersectsBody = __webpack_require__(242); /** * The core separation function to separate a physics body and a tile. @@ -103552,14 +111319,14 @@ var TileIntersectsBody = __webpack_require__(226); * @function Phaser.Physics.Arcade.Tilemap.SeparateTile * @since 3.0.0 * - * @param {number} i - [description] + * @param {number} i - The index of the tile within the map data. * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. - * @param {Phaser.Geom.Rectangle} tileWorldRect - [description] + * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against. - * @param {number} tileBias - [description] + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * - * @return {boolean} Returns true if the body was separated, otherwise false. + * @return {boolean} `true` if the body was separated, otherwise `false`. */ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias) { @@ -103646,29 +111413,29 @@ module.exports = SeparateTile; /***/ }), -/* 514 */ +/* 556 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object. * * @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks * @since 3.0.0 * - * @param {Phaser.Tilemaps.Tilemap} tile - [description] - * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Tilemaps.Tile} tile - The Tile to process. + * @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile. * - * @return {boolean} [description] + * @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair. */ var ProcessTileCallbacks = function (tile, sprite) { - // Tile callbacks take priority over layer level callbacks + // Tile callbacks take priority over layer level callbacks if (tile.collisionCallback) { return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile); @@ -103687,17 +111454,220 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 515 */ +/* 557 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * The Arcade Physics World Bounds Event. + * + * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_ + * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`. + * + * @event Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that hit the world bounds. + * @param {boolean} up - Is the Body blocked up? I.e. collided with the top of the world bounds. + * @param {boolean} down - Is the Body blocked down? I.e. collided with the bottom of the world bounds. + * @param {boolean} left - Is the Body blocked left? I.e. collided with the left of the world bounds. + * @param {boolean} right - Is the Body blocked right? I.e. collided with the right of the world bounds. + */ +module.exports = 'worldbounds'; + + +/***/ }), +/* 558 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_ + * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_OVERLAP + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the overlap. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body overlapped. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the overlap. + */ +module.exports = 'tileoverlap'; + + +/***/ }), +/* 559 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_ + * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_COLLIDE + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the collision. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body collided with. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the collision. + */ +module.exports = 'tilecollide'; + + +/***/ }), +/* 560 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Resume Event. + * + * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`. + * + * @event Phaser.Physics.Arcade.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 561 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Pause Event. + * + * This event is dispatched by an Arcade Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`. + * + * @event Phaser.Physics.Arcade.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 562 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least + * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#OVERLAP + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the overlap. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the overlap. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the overlap. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the overlap. + */ +module.exports = 'overlap'; + + +/***/ }), +/* 563 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least + * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#COLLIDE + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the collision. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the collision. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the collision. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the collision. + */ +module.exports = 'collide'; + + +/***/ }), +/* 564 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Provides methods for modifying the velocity of an Arcade Physics body. + * + * Should be applied as a mixin and not used directly. * * @name Phaser.Physics.Arcade.Components.Velocity * @since 3.0.0 @@ -103705,13 +111675,13 @@ module.exports = ProcessTileCallbacks; var Velocity = { /** - * [description] + * Sets the velocity of the Body. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left. + * @param {number} [y=x] - The vertical velocity of the body. Positive values move the body down, while negative values move it up. * * @return {this} This Game Object. */ @@ -103723,12 +111693,14 @@ var Velocity = { }, /** - * [description] + * Sets the horizontal component of the body's velocity. + * + * Positive values move the body to the right, while negative values move it to the left. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityX * @since 3.0.0 * - * @param {number} x - [description] + * @param {number} x - The new horizontal velocity. * * @return {this} This Game Object. */ @@ -103740,12 +111712,14 @@ var Velocity = { }, /** - * [description] + * Sets the vertical component of the body's velocity. + * + * Positive values move the body down, while negative values move it up. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityY * @since 3.0.0 * - * @param {number} y - [description] + * @param {number} y - The new vertical velocity of the body. * * @return {this} This Game Object. */ @@ -103757,13 +111731,13 @@ var Velocity = { }, /** - * [description] + * Sets the maximum velocity of the body. * * @method Phaser.Physics.Arcade.Components.Velocity#setMaxVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The new maximum horizontal velocity. + * @param {number} [y=x] - The new maximum vertical velocity. * * @return {this} This Game Object. */ @@ -103780,12 +111754,12 @@ module.exports = Velocity; /***/ }), -/* 516 */ +/* 565 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103862,17 +111836,17 @@ module.exports = Size; /***/ }), -/* 517 */ +/* 566 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the mass properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Mass * @since 3.0.0 @@ -103880,12 +111854,12 @@ module.exports = Size; var Mass = { /** - * [description] + * Sets the mass of the physics body * * @method Phaser.Physics.Arcade.Components.Mass#setMass * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - New value for the mass of the body. * * @return {this} This Game Object. */ @@ -103902,17 +111876,17 @@ module.exports = Mass; /***/ }), -/* 518 */ +/* 567 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the immovable properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Immovable * @since 3.0.0 @@ -103920,12 +111894,12 @@ module.exports = Mass; var Immovable = { /** - * [description] + * Sets Whether this Body can be moved by collisions with another Body. * * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable * @since 3.0.0 * - * @param {boolean} [value=true] - [description] + * @param {boolean} [value=true] - Sets if this body can be moved by collisions with another Body. * * @return {this} This Game Object. */ @@ -103944,12 +111918,12 @@ module.exports = Immovable; /***/ }), -/* 519 */ +/* 568 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104022,12 +111996,12 @@ module.exports = Gravity; /***/ }), -/* 520 */ +/* 569 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104100,17 +112074,17 @@ module.exports = Friction; /***/ }), -/* 521 */ +/* 570 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the enable properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Enable * @since 3.0.0 @@ -104224,17 +112198,17 @@ module.exports = Enable; /***/ }), -/* 522 */ +/* 571 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the drag properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Drag * @since 3.0.0 @@ -104242,13 +112216,24 @@ module.exports = Enable; var Drag = { /** - * [description] + * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDrag * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The amount of horizontal drag to apply. + * @param {number} [y=x] - The amount of vertical drag to apply. * * @return {this} This Game Object. */ @@ -104260,12 +112245,23 @@ var Drag = { }, /** - * [description] + * Sets the body's horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDragX * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of horizontal drag to apply. * * @return {this} This Game Object. */ @@ -104277,12 +112273,23 @@ var Drag = { }, /** - * [description] + * Sets the body's vertical drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDragY * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of vertical drag to apply. * * @return {this} This Game Object. */ @@ -104294,7 +112301,15 @@ var Drag = { }, /** - * [description] + * If this Body is using `drag` for deceleration this function controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. * * @method Phaser.Physics.Arcade.Components.Drag#setDamping * @since 3.10.0 @@ -104316,17 +112331,17 @@ module.exports = Drag; /***/ }), -/* 523 */ +/* 572 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the debug properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Debug * @since 3.0.0 @@ -104334,14 +112349,17 @@ module.exports = Drag; var Debug = { /** - * [description] + * Sets the debug values of this body. + * + * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole. + * Note that there is a performance cost in drawing debug displays. It should never be used in production. * * @method Phaser.Physics.Arcade.Components.Debug#setDebug * @since 3.0.0 * - * @param {boolean} showBody - [description] - * @param {boolean} showVelocity - [description] - * @param {number} bodyColor - [description] + * @param {boolean} showBody - Set to `true` to have this body render its outline to the debug display. + * @param {boolean} showVelocity - Set to `true` to have this body render a velocity marker to the debug display. + * @param {number} bodyColor - The color of the body outline when rendered to the debug display. * * @return {this} This Game Object. */ @@ -104355,12 +112373,12 @@ var Debug = { }, /** - * [description] + * Sets the color of the body outline when it renders to the debug display. * * @method Phaser.Physics.Arcade.Components.Debug#setDebugBodyColor * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The color of the body outline when rendered to the debug display. * * @return {this} This Game Object. */ @@ -104372,7 +112390,7 @@ var Debug = { }, /** - * [description] + * Set to `true` to have this body render its outline to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugShowBody * @type {boolean} @@ -104393,7 +112411,7 @@ var Debug = { }, /** - * [description] + * Set to `true` to have this body render a velocity marker to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugShowVelocity * @type {boolean} @@ -104414,7 +112432,7 @@ var Debug = { }, /** - * [description] + * The color of the body outline when it renders to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugBodyColor * @type {number} @@ -104440,17 +112458,17 @@ module.exports = Debug; /***/ }), -/* 524 */ +/* 573 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the bounce properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Bounce * @since 3.0.0 @@ -104458,13 +112476,16 @@ module.exports = Debug; var Bounce = { /** - * [description] + * Sets the bounce values of this body. + * + * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object. + * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounce * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. + * @param {number} [y=x] - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -104476,12 +112497,12 @@ var Bounce = { }, /** - * [description] + * Sets the horizontal bounce value for this body. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounceX * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -104493,12 +112514,12 @@ var Bounce = { }, /** - * [description] + * Sets the vertical bounce value for this body. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounceY * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -104510,12 +112531,12 @@ var Bounce = { }, /** - * [description] + * Sets if this body should collide with the world bounds or not. * * @method Phaser.Physics.Arcade.Components.Bounce#setCollideWorldBounds * @since 3.0.0 * - * @param {boolean} value - [description] + * @param {boolean} value - `true` if this body should collide with the world bounds, otherwise `false`. * * @return {this} This Game Object. */ @@ -104532,17 +112553,17 @@ module.exports = Bounce; /***/ }), -/* 525 */ +/* 574 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Angular * @since 3.0.0 @@ -104550,12 +112571,16 @@ module.exports = Bounce; var Angular = { /** - * [description] + * Sets the angular velocity of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularVelocity * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of angular velocity. * * @return {this} This Game Object. */ @@ -104567,12 +112592,16 @@ var Angular = { }, /** - * [description] + * Sets the angular acceleration of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularAcceleration * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of angular acceleration. * * @return {this} This Game Object. */ @@ -104584,12 +112613,12 @@ var Angular = { }, /** - * [description] + * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularDrag * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of drag. * * @return {this} This Game Object. */ @@ -104606,17 +112635,17 @@ module.exports = Angular; /***/ }), -/* 526 */ +/* 575 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Provides methods used for setting the acceleration properties of an Arcade Body. + * Provides methods used for setting the acceleration properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Acceleration * @since 3.0.0 @@ -104681,25 +112710,26 @@ module.exports = Acceleration; /***/ }), -/* 527 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var DistanceBetween = __webpack_require__(52); -var DistanceSquared = __webpack_require__(249); -var Factory = __webpack_require__(238); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(56); +var DistanceSquared = __webpack_require__(384); +var Factory = __webpack_require__(255); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(96); -var PluginCache = __webpack_require__(15); +var Merge = __webpack_require__(103); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); var Vector2 = __webpack_require__(3); -var World = __webpack_require__(233); +var World = __webpack_require__(250); /** * @classdesc @@ -104766,8 +112796,8 @@ var ArcadePhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -104783,7 +112813,7 @@ var ArcadePhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -104805,9 +112835,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -105154,9 +113184,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -105176,7 +113206,7 @@ var ArcadePhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -105190,23 +113220,23 @@ module.exports = ArcadePhysics; /***/ }), -/* 528 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(35); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(38); +var Extend = __webpack_require__(19); /** * @callback ArcadePhysicsCallback * - * @param {Phaser.GameObjects.GameObject} object1 - [description] - * @param {Phaser.GameObjects.GameObject} object2 - [description] + * @param {Phaser.GameObjects.GameObject} object1 - The first Body to separate. + * @param {Phaser.GameObjects.GameObject} object2 - The second Body to separate. */ /** @@ -105215,16 +113245,16 @@ var Extend = __webpack_require__(20); var Arcade = { - ArcadePhysics: __webpack_require__(527), - Body: __webpack_require__(232), - Collider: __webpack_require__(231), - Factory: __webpack_require__(238), - Group: __webpack_require__(235), - Image: __webpack_require__(237), - Sprite: __webpack_require__(104), - StaticBody: __webpack_require__(225), - StaticGroup: __webpack_require__(234), - World: __webpack_require__(233) + ArcadePhysics: __webpack_require__(576), + Body: __webpack_require__(249), + Collider: __webpack_require__(247), + Factory: __webpack_require__(255), + Group: __webpack_require__(252), + Image: __webpack_require__(254), + Sprite: __webpack_require__(111), + StaticBody: __webpack_require__(241), + StaticGroup: __webpack_require__(251), + World: __webpack_require__(250) }; @@ -105235,2090 +113265,25 @@ module.exports = Arcade; /***/ }), -/* 529 */ +/* 578 */ /***/ (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__(138); -var Matrix4 = __webpack_require__(240); -var Quaternion = __webpack_require__(239); - -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 - The vector to be rotated. - * @param {Phaser.Math.Vector3} axis - The axis to rotate around. - * @param {number} radians - The angle of rotation in radians. - * - * @return {Phaser.Math.Vector3} The given vector. - */ -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; - - -/***/ }), -/* 530 */ -/***/ (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 - * A representation of a vector in 4D space. - * - * A four-component vector. - * - * @class Vector4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. - */ -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 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector4#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector4#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - /** - * The w component of this Vector. - * - * @name Phaser.Math.Vector4#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.w = 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; - } - }, - - /** - * Make a clone of this Vector4. - * - * @method Phaser.Math.Vector4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} A clone of this Vector4. - */ - clone: function () - { - return new Vector4(this.x, this.y, this.z, this.w); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - this.w = src.w || 0; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict quality check against each Vector's components. - * - * @method Phaser.Math.Vector4#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The vector to check equality with. - * - * @return {boolean} A boolean indicating whether the two Vectors are equal or not. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); - }, - - /** - * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. - * - * @method Phaser.Math.Vector4#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. - * @param {number} y - The y value to set for this Vector. - * @param {number} z - The z value to set for this Vector. - * @param {number} w - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - set: function (x, y, z, w) - { - 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; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector4#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - this.w += v.w || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector4#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - this.w -= v.w || 0; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector4#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - - return this; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector4#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - 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); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector4#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return x * x + y * y + z * z + w * w; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector4#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - 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; - - 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; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector4#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. - * - * @return {number} The dot product of this Vector and the given Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector4#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - lerp: function (v, t) - { - 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; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector4#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - this.w *= v.w || 1; - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector4#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - this.w /= v.w || 1; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector4#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - 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); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector4#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - 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; - - return dx * dx + dy * dy + dz * dz + dw * dw; - }, - - /** - * Negate the `x`, `y`, `z` and `w` components of this Vector. - * - * @method Phaser.Math.Vector4#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector4#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var m = mat.val; - - 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; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector4#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformQuat: function (q) - { - // TODO: is this really the same as Vector3? - // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ - // 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; - - // 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; - - // 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; - }, - - /** - * Make this Vector the zero vector (0, 0, 0, 0). - * - * @method Phaser.Math.Vector4#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; - - return this; - } - -}); - -// 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; - -module.exports = Vector4; - - -/***/ }), -/* 531 */ -/***/ (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 two values are within the given `tolerance` of each other. - * - * @function Phaser.Math.Within - * @since 3.0.0 - * - * @param {number} a - The first value to use in the calculation. - * @param {number} b - The second value to use in the calculation. - * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. - * - * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. - */ -var Within = function (a, b, tolerance) -{ - return (Math.abs(a - b) <= tolerance); -}; - -module.exports = Within; - - -/***/ }), -/* 532 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @typedef {object} SinCosTable - * - * @property {number} sin - The sine value. - * @property {number} cos - The cosine value. - * @property {number} length - The length. - */ - -/** - * Generate a series of sine and cosine values. - * - * @function Phaser.Math.SinCosTableGenerator - * @since 3.0.0 - * - * @param {number} length - The number of values to generate. - * @param {number} [sinAmp=1] - The sine value amplitude. - * @param {number} [cosAmp=1] - The cosine value amplitude. - * @param {number} [frequency=1] - The frequency of the values. - * - * @return {SinCosTable} The generated values. - */ -var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) -{ - if (sinAmp === undefined) { sinAmp = 1; } - if (cosAmp === undefined) { cosAmp = 1; } - if (frequency === undefined) { frequency = 1; } - - frequency *= Math.PI / length; - - var cos = []; - var sin = []; - - for (var c = 0; c < length; c++) - { - cosAmp -= sinAmp * frequency; - sinAmp += cosAmp * frequency; - - cos[c] = cosAmp; - sin[c] = sinAmp; - } - - return { - sin: sin, - cos: cos, - length: length - }; -}; - -module.exports = SinCosTableGenerator; - - -/***/ }), -/* 533 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Round a value to a given decimal place. - * - * @function Phaser.Math.RoundTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var RoundTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.round(value * p) / p; -}; - -module.exports = RoundTo; - - -/***/ }), -/* 534 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random four-dimensional vector. - * - * @function Phaser.Math.RandomXYZW - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector4} The given Vector. - */ -var RandomXYZW = function (vec4, scale) -{ - if (scale === undefined) { scale = 1; } - - // TODO: 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; - - -/***/ }), -/* 535 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random position vector in a spherical area, optionally defined by the given radius. - * - * @function Phaser.Math.RandomXYZ - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. - * @param {number} [radius=1] - The radius. - * - * @return {Phaser.Math.Vector3} The given Vector. - */ -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; - - -/***/ }), -/* 536 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random unit vector. - * - * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. - * - * Optionally accepts a scale value to scale the resulting vector by. - * - * @function Phaser.Math.RandomXY - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector2} The given Vector. - */ -var RandomXY = function (vector, scale) -{ - if (scale === undefined) { scale = 1; } - - var r = Math.random() * 2 * Math.PI; - - vector.x = Math.cos(r) * scale; - vector.y = Math.sin(r) * scale; - - return vector; -}; - -module.exports = RandomXY; - - -/***/ }), -/* 537 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Work out what percentage `value` is of the range between `min` and `max`. - * If `max` isn't given then it will return the percentage of `value` to `min`. - * - * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. - * - * @function Phaser.Math.Percent - * @since 3.0.0 - * - * @param {number} value - The value to determine the percentage of. - * @param {number} min - The minimum value. - * @param {number} [max] - The maximum value. - * @param {number} [upperMax] - The mid-way point in the range that represents 100%. - * - * @return {number} A value between 0 and 1 representing the percentage. - */ -var Percent = function (value, min, max, upperMax) -{ - if (max === undefined) { max = min + 1; } - - var percentage = (value - min) / (max - min); - - if (percentage > 1) - { - if (upperMax !== undefined) - { - percentage = ((upperMax - value)) / (upperMax - max); - - if (percentage < 0) - { - percentage = 0; - } - } - else - { - percentage = 1; - } - } - else if (percentage < 0) - { - percentage = 0; - } - - return percentage; -}; - -module.exports = Percent; - - -/***/ }), -/* 538 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Subtract an `amount` from `value`, limiting the minimum result to `min`. - * - * @function Phaser.Math.MinSub - * @since 3.0.0 - * - * @param {number} value - The value to subtract from. - * @param {number} amount - The amount to subtract. - * @param {number} min - The minimum value to return. - * - * @return {number} The resulting value. - */ -var MinSub = function (value, amount, min) -{ - return Math.max(value - amount, min); -}; - -module.exports = MinSub; - - -/***/ }), -/* 539 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Add an `amount` to a `value`, limiting the maximum result to `max`. - * - * @function Phaser.Math.MaxAdd - * @since 3.0.0 - * - * @param {number} value - The value to add to. - * @param {number} amount - The amount to add. - * @param {number} max - The maximum value to return. - * - * @return {number} The resulting value. - */ -var MaxAdd = function (value, amount, max) -{ - return Math.min(value + amount, max); -}; - -module.exports = MaxAdd; - - -/***/ }), -/* 540 */ -/***/ (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 if a given value is an even number using a strict type check. - * - * @function Phaser.Math.IsEvenStrict - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEvenStrict = function (value) -{ - // Use strict equality === for "is number" test - return (value === parseFloat(value)) ? !(value % 2) : void 0; -}; - -module.exports = IsEvenStrict; - - -/***/ }), -/* 541 */ -/***/ (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 if a given value is an even number. - * - * @function Phaser.Math.IsEven - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEven = function (value) -{ - // Use abstract equality == for "is number" test - - // eslint-disable-next-line eqeqeq - return (value == parseFloat(value)) ? !(value % 2) : void 0; -}; - -module.exports = IsEven; - - -/***/ }), -/* 542 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the speed required to cover a distance in the time given. - * - * @function Phaser.Math.GetSpeed - * @since 3.0.0 - * - * @param {number} distance - The distance to travel in pixels. - * @param {integer} time - The time, in ms, to cover the distance in. - * - * @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given. - */ -var GetSpeed = function (distance, time) -{ - return (distance / time) / 1000; -}; - -module.exports = GetSpeed; - - -/***/ }), -/* 543 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Floors to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.FloorTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var FloorTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.floor(value * p) / p; -}; - -module.exports = FloorTo; - - -/***/ }), -/* 544 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates the positive difference of two given numbers. - * - * @function Phaser.Math.Difference - * @since 3.0.0 - * - * @param {number} a - The first number in the calculation. - * @param {number} b - The second number in the calculation. - * - * @return {number} The positive difference of the two given numbers. - */ -var Difference = function (a, b) -{ - return Math.abs(a - b); -}; - -module.exports = Difference; - - -/***/ }), -/* 545 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Ceils to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.CeilTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {number} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var CeilTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.ceil(value * p) / p; -}; - -module.exports = CeilTo; - - -/***/ }), -/* 546 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the mean average of the given values. - * - * @function Phaser.Math.Average - * @since 3.0.0 - * - * @param {number[]} values - The values to average. - * - * @return {number} The average value. - */ -var Average = function (values) -{ - var sum = 0; - - for (var i = 0; i < values.length; i++) - { - sum += (+values[i]); - } - - return sum / values.length; -}; - -module.exports = Average; - - -/***/ }), -/* 547 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using rounding. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. - * - * @function Phaser.Math.Snap.To - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapTo = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.round(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapTo; - - -/***/ }), -/* 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} - */ - -/** - * @namespace Phaser.Math.Snap - */ - -module.exports = { - - Ceil: __webpack_require__(243), - Floor: __webpack_require__(142), - To: __webpack_require__(547) - -}; - - -/***/ }), -/* 549 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Tests the value and returns `true` if it is a power of two. - * - * @function Phaser.Math.Pow2.IsValuePowerOfTwo - * @since 3.0.0 - * - * @param {number} value - The value to check if it's a power of two. - * - * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. - */ -var IsValuePowerOfTwo = function (value) -{ - return (value > 0 && (value & (value - 1)) === 0); -}; - -module.exports = IsValuePowerOfTwo; - - -/***/ }), -/* 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} - */ - -/** - * @namespace Phaser.Math.Pow2 - */ - -module.exports = { - - GetNext: __webpack_require__(294), - IsSize: __webpack_require__(117), - IsValue: __webpack_require__(549) - -}; - - -/***/ }), -/* 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 SmootherStep = __webpack_require__(182); - -/** - * A Smoother Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmootherStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmootherStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmootherStep(t, 0, 1); -}; - -module.exports = SmootherStepInterpolation; - - -/***/ }), -/* 552 */ -/***/ (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 Linear = __webpack_require__(119); - -/** - * A linear interpolation method. - * - * @function Phaser.Math.Interpolation.Linear - * @since 3.0.0 - * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {!number} k - The percentage of interpolation, between 0 and 1. - * - * @return {!number} The interpolated value. - */ -var LinearInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - - if (k < 0) - { - return Linear(v[0], v[1], f); - } - - if (k > 1) - { - return Linear(v[m], v[m - 1], m - f); - } - - return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); -}; - -module.exports = LinearInterpolation; - - -/***/ }), -/* 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 CatmullRom = __webpack_require__(171); - -/** - * A Catmull-Rom interpolation method. - * - * @function Phaser.Math.Interpolation.CatmullRom - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var CatmullRomInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - - if (v[0] === v[m]) - { - if (k < 0) - { - i = Math.floor(f = m * (1 + k)); - } - - return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); - } - else - { - if (k < 0) - { - return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); - } - - if (k > 1) - { - return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); - } - - return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); - } -}; - -module.exports = CatmullRomInterpolation; - - -/***/ }), -/* 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 Bernstein = __webpack_require__(245); - -/** - * A bezier interpolation method. - * - * @function Phaser.Math.Interpolation.Bezier - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var BezierInterpolation = function (v, k) -{ - var b = 0; - var n = v.length - 1; - - for (var i = 0; i <= n; i++) - { - b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); - } - - return b; -}; - -module.exports = BezierInterpolation; - - -/***/ }), -/* 555 */ -/***/ (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.Math.Interpolation - */ - -module.exports = { - - Bezier: __webpack_require__(554), - CatmullRom: __webpack_require__(553), - CubicBezier: __webpack_require__(354), - Linear: __webpack_require__(552), - QuadraticBezier: __webpack_require__(350), - SmoothStep: __webpack_require__(334), - SmootherStep: __webpack_require__(551) - -}; - - -/***/ }), -/* 556 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the fuzzy floor of the given value. - * - * @function Phaser.Math.Fuzzy.Floor - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The floor of the value. - */ -var Floor = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.floor(value + epsilon); -}; - -module.exports = Floor; - - -/***/ }), -/* 557 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the fuzzy ceiling of the given value. - * - * @function Phaser.Math.Fuzzy.Ceil - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The fuzzy ceiling of the value. - */ -var Ceil = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.ceil(value - epsilon); -}; - -module.exports = Ceil; - - -/***/ }), -/* 558 */ -/***/ (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.Math.Fuzzy - */ - -module.exports = { - - Ceil: __webpack_require__(557), - Equal: __webpack_require__(248), - Floor: __webpack_require__(556), - GreaterThan: __webpack_require__(247), - LessThan: __webpack_require__(246) - -}; - - -/***/ }), -/* 559 */ -/***/ (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.Math.Easing - */ - -module.exports = { - - Back: __webpack_require__(369), - Bounce: __webpack_require__(368), - Circular: __webpack_require__(367), - Cubic: __webpack_require__(366), - Elastic: __webpack_require__(365), - Expo: __webpack_require__(364), - Linear: __webpack_require__(363), - Quadratic: __webpack_require__(362), - Quartic: __webpack_require__(361), - Quintic: __webpack_require__(360), - Sine: __webpack_require__(359), - Stepped: __webpack_require__(358) - -}; - - -/***/ }), -/* 560 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points) to the power of `pow`. - * - * @function Phaser.Math.Distance.Power - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * @param {number} pow - The exponent. - * - * @return {number} The distance between each point. - */ -var DistancePower = function (x1, y1, x2, y2, pow) -{ - if (pow === undefined) { pow = 2; } - - return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); -}; - -module.exports = DistancePower; - - -/***/ }), -/* 561 */ -/***/ (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.Math.Distance - */ - -module.exports = { - - Between: __webpack_require__(52), - Power: __webpack_require__(560), - Squared: __webpack_require__(249) - -}; - - -/***/ }), -/* 562 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Gets the shortest angle between `angle1` and `angle2`. - * - * Both angles must be in the range -180 to 180, which is the same clamped - * range that `sprite.angle` uses, so you can pass in two sprite angles to - * this method and get the shortest angle back between the two of them. - * - * The angle returned will be in the same range. If the returned angle is - * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's - * a clockwise rotation. - * - * TODO: Wrap the angles in this function? - * - * @function Phaser.Math.Angle.ShortestBetween - * @since 3.0.0 - * - * @param {number} angle1 - The first angle in the range -180 to 180. - * @param {number} angle2 - The second angle in the range -180 to 180. - * - * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. - */ -var ShortestBetween = function (angle1, angle2) -{ - var difference = angle2 - angle1; - - if (difference === 0) - { - return 0; - } - - var times = Math.floor((difference - (-180)) / 360); - - return difference - (times * 360); - -}; - -module.exports = ShortestBetween; - - -/***/ }), -/* 563 */ -/***/ (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 MATH_CONST = __webpack_require__(16); - -/** - * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. - * - * @function Phaser.Math.Angle.RotateTo - * @since 3.0.0 - * - * @param {number} currentAngle - The current angle, in radians. - * @param {number} targetAngle - The target angle to rotate to, in radians. - * @param {number} [lerp=0.05] - The lerp value to add to the current angle. - * - * @return {number} The adjusted angle. - */ -var RotateTo = function (currentAngle, targetAngle, lerp) -{ - if (lerp === undefined) { lerp = 0.05; } - - if (currentAngle === targetAngle) - { - return currentAngle; - } - - if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) - { - currentAngle = targetAngle; - } - else - { - if (Math.abs(targetAngle - currentAngle) > Math.PI) - { - if (targetAngle < currentAngle) - { - targetAngle += MATH_CONST.PI2; - } - else - { - targetAngle -= MATH_CONST.PI2; - } - } - - if (targetAngle > currentAngle) - { - currentAngle += lerp; - } - else if (targetAngle < currentAngle) - { - currentAngle -= lerp; - } - } - - return currentAngle; -}; - -module.exports = RotateTo; - - -/***/ }), -/* 564 */ -/***/ (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 Normalize = __webpack_require__(250); - -/** - * Reverse the given angle. - * - * @function Phaser.Math.Angle.Reverse - * @since 3.0.0 - * - * @param {number} angle - The angle to reverse, in radians. - * - * @return {number} The reversed angle, in radians. - */ -var Reverse = function (angle) -{ - return Normalize(angle + Math.PI); -}; - -module.exports = Reverse; - - -/***/ }), -/* 565 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenPointsY - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point1 - The first point. - * @param {(Phaser.Geom.Point|object)} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPointsY = function (point1, point2) -{ - return Math.atan2(point2.x - point1.x, point2.y - point1.y); -}; - -module.exports = BetweenPointsY; - - -/***/ }), -/* 566 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * Calculates the angle of the vector from the first point to the second point. - * - * @function Phaser.Math.Angle.BetweenPoints - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point1 - The first point. - * @param {(Phaser.Geom.Point|object)} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPoints = function (point1, point2) -{ - return Math.atan2(point2.y - point1.y, point2.x - point1.x); -}; - -module.exports = BetweenPoints; - - -/***/ }), -/* 567 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenY - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var BetweenY = function (x1, y1, x2, y2) -{ - return Math.atan2(x2 - x1, y2 - y1); -}; - -module.exports = BetweenY; - - -/***/ }), -/* 568 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * @function Phaser.Math.Angle.Between - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var Between = function (x1, y1, x2, y2) -{ - return Math.atan2(y2 - y1, x2 - x1); -}; - -module.exports = Between; - - -/***/ }), -/* 569 */ -/***/ (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.Math.Angle - */ - -module.exports = { - - Between: __webpack_require__(568), - BetweenY: __webpack_require__(567), - BetweenPoints: __webpack_require__(566), - BetweenPointsY: __webpack_require__(565), - Reverse: __webpack_require__(564), - RotateTo: __webpack_require__(563), - ShortestBetween: __webpack_require__(562), - Normalize: __webpack_require__(250), - Wrap: __webpack_require__(199), - WrapDegrees: __webpack_require__(198) - -}; - - -/***/ }), -/* 570 */ -/***/ (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 CONST = __webpack_require__(16); -var Extend = __webpack_require__(20); - -/** - * @namespace Phaser.Math - */ - -var PhaserMath = { - - // Collections of functions - Angle: __webpack_require__(569), - Distance: __webpack_require__(561), - Easing: __webpack_require__(559), - Fuzzy: __webpack_require__(558), - Interpolation: __webpack_require__(555), - Pow2: __webpack_require__(550), - Snap: __webpack_require__(548), - - // Expose the RNG Class - RandomDataGenerator: __webpack_require__(404), - - // Single functions - Average: __webpack_require__(546), - Bernstein: __webpack_require__(245), - Between: __webpack_require__(170), - CatmullRom: __webpack_require__(171), - CeilTo: __webpack_require__(545), - Clamp: __webpack_require__(23), - DegToRad: __webpack_require__(31), - Difference: __webpack_require__(544), - Factorial: __webpack_require__(244), - FloatBetween: __webpack_require__(299), - FloorTo: __webpack_require__(543), - FromPercent: __webpack_require__(93), - GetSpeed: __webpack_require__(542), - IsEven: __webpack_require__(541), - IsEvenStrict: __webpack_require__(540), - Linear: __webpack_require__(119), - MaxAdd: __webpack_require__(539), - MinSub: __webpack_require__(538), - Percent: __webpack_require__(537), - RadToDeg: __webpack_require__(172), - RandomXY: __webpack_require__(536), - RandomXYZ: __webpack_require__(535), - RandomXYZW: __webpack_require__(534), - Rotate: __webpack_require__(242), - RotateAround: __webpack_require__(396), - RotateAroundDistance: __webpack_require__(183), - RoundAwayFromZero: __webpack_require__(314), - RoundTo: __webpack_require__(533), - SinCosTableGenerator: __webpack_require__(532), - SmootherStep: __webpack_require__(182), - SmoothStep: __webpack_require__(181), - TransformXY: __webpack_require__(332), - Within: __webpack_require__(531), - Wrap: __webpack_require__(53), - - // Vector classes - Vector2: __webpack_require__(3), - Vector3: __webpack_require__(138), - Vector4: __webpack_require__(530), - Matrix3: __webpack_require__(241), - Matrix4: __webpack_require__(240), - Quaternion: __webpack_require__(239), - RotateVec3: __webpack_require__(529) - -}; - -// Merge in the consts - -PhaserMath = Extend(false, PhaserMath, CONST); - -// Export it - -module.exports = PhaserMath; - - -/***/ }), -/* 571 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var CustomSet = __webpack_require__(95); +var CONST = __webpack_require__(15); +var CustomSet = __webpack_require__(102); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(75); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); -var XHRSettings = __webpack_require__(105); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var XHRSettings = __webpack_require__(112); /** * @classdesc @@ -107372,7 +113337,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#scene * @type {Phaser.Scene} - * @protected * @since 3.0.0 */ this.scene = scene; @@ -107382,7 +113346,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#systems * @type {Phaser.Scenes.Systems} - * @protected * @since 3.0.0 */ this.systems = scene.sys; @@ -107392,7 +113355,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#cacheManager * @type {Phaser.Cache.CacheManager} - * @protected * @since 3.7.0 */ this.cacheManager = scene.sys.cache; @@ -107402,11 +113364,20 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#textureManager * @type {Phaser.Textures.TextureManager} - * @protected * @since 3.7.0 */ this.textureManager = scene.sys.textures; + /** + * A reference to the global Scene Manager. + * + * @name Phaser.Loader.LoaderPlugin#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @protected + * @since 3.16.0 + */ + this.sceneManager = scene.sys.game.scene; + // Inject the available filetypes into the Loader FileTypesManager.install(this); @@ -107612,8 +113583,8 @@ var LoaderPlugin = new Class({ */ this.state = CONST.LOADER_IDLE; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.pluginStart, this); }, /** @@ -107626,7 +113597,7 @@ var LoaderPlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -107640,7 +113611,7 @@ var LoaderPlugin = new Class({ */ pluginStart: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -107760,16 +113731,6 @@ var LoaderPlugin = new Class({ return this; }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#addFileEvent - * @param {string} key - The key of the file that was added. - * @param {string} type - The type of the file that was added. - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that had the file added to it. - * @param {Phaser.Loader.File} loader - The File object that was added to the Loader. - */ - /** * Adds a file, or array of files, into the load queue. * @@ -107782,7 +113743,7 @@ var LoaderPlugin = new Class({ * however you can call this as long as the file given to it is well formed. * * @method Phaser.Loader.LoaderPlugin#addFile - * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @fires Phaser.Loader.Events#ADD * @since 3.0.0 * * @param {(Phaser.Loader.File|Phaser.Loader.File[])} file - The file, or array of files, to be added to the load queue. @@ -107804,7 +113765,7 @@ var LoaderPlugin = new Class({ { this.list.set(item); - this.emit('addfile', item.key, item.type, this, item); + this.emit(Events.ADD, item.key, item.type, this, item); if (this.isLoading()) { @@ -107970,13 +113931,6 @@ var LoaderPlugin = new Class({ return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE); }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#startEvent - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader instance that started. - */ - /** * Starts the Loader running. This will reset the progress and totals and then emit a `start` event. * If there is nothing in the queue the Loader will immediately complete, otherwise it will start @@ -107989,7 +113943,7 @@ var LoaderPlugin = new Class({ * If the Loader is already running this method will simply return. * * @method Phaser.Loader.LoaderPlugin#start - * @fires Phaser.Loader.LoaderPlugin#startEvent + * @fires Phaser.Loader.Events#START * @since 3.0.0 */ start: function () @@ -108005,7 +113959,7 @@ var LoaderPlugin = new Class({ this.totalComplete = 0; this.totalToLoad = this.list.size; - this.emit('start', this); + this.emit(Events.START, this); if (this.list.size === 0) { @@ -108022,32 +113976,24 @@ var LoaderPlugin = new Class({ this.checkLoadQueue(); - this.systems.events.on('update', this.update, this); + this.systems.events.on(SceneEvents.UPDATE, this.update, this); } }, - /** - * This event is fired when the Loader updates its progress, typically as a result of - * a file having completed loading. - * - * @event Phaser.Loader.LoaderPlugin#progressEvent - * @param {number} progress - The current progress of the load. A value between 0 and 1. - */ - /** * Called automatically during the load process. * It updates the `progress` value and then emits a progress event, which you can use to * display a loading bar in your game. * * @method Phaser.Loader.LoaderPlugin#updateProgress - * @fires Phaser.Loader.LoaderPlugin#progressEvent + * @fires Phaser.Loader.Events#PROGRESS * @since 3.0.0 */ updateProgress: function () { this.progress = 1 - ((this.list.size + this.inflight.size) / this.totalToLoad); - this.emit('progress', this.progress); + this.emit(Events.PROGRESS, this.progress); }, /** @@ -108104,20 +114050,6 @@ var LoaderPlugin = new Class({ }, this); }, - /** - * This event is fired when the a file successfully completes loading, _before_ it is processed. - * - * @event Phaser.Loader.LoaderPlugin#loadEvent - * @param {Phaser.Loader.File} file - The file that has completed loading. - */ - - /** - * This event is fired when the a file errors during load. - * - * @event Phaser.Loader.LoaderPlugin#loadErrorEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * An internal method called automatically by the XHRLoader belong to a File. * @@ -108125,8 +114057,8 @@ var LoaderPlugin = new Class({ * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue. * * @method Phaser.Loader.LoaderPlugin#nextFile - * @fires Phaser.Loader.LoaderPlugin#loadEvent - * @fires Phaser.Loader.LoaderPlugin#loadErrorEvent + * @fires Phaser.Loader.Events#FILE_LOAD + * @fires Phaser.Loader.Events#FILE_LOAD_ERROR * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File that just finished loading, or errored during load. @@ -108150,7 +114082,7 @@ var LoaderPlugin = new Class({ this.queue.set(file); - this.emit('load', file); + this.emit(Events.FILE_LOAD, file); file.onProcess(); } @@ -108160,7 +114092,7 @@ var LoaderPlugin = new Class({ this._deleteQueue.set(file); - this.emit('loaderror', file); + this.emit(Events.FILE_LOAD_ERROR, file); this.fileProcessComplete(file); } @@ -108222,14 +114154,6 @@ var LoaderPlugin = new Class({ } }, - /** - * This event is fired when the Loader has finished loading everything and the queue is empty. - * By this point every loaded file will now be in its associated cache and ready for use. - * - * @event Phaser.Loader.LoaderPlugin#completeEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * Called at the end when the load queue is exhausted and all files have either loaded or errored. * By this point every loaded file will now be in its associated cache and ready for use. @@ -108237,12 +114161,13 @@ var LoaderPlugin = new Class({ * Also clears down the Sets, puts progress to 1 and clears the deletion queue. * * @method Phaser.Loader.LoaderPlugin#loadComplete - * @fires Phaser.Loader.LoaderPlugin#completeEvent + * @fires Phaser.Loader.Events#COMPLETE + * @fires Phaser.Loader.Events#POST_PROCESS * @since 3.7.0 */ loadComplete: function () { - this.emit('loadcomplete', this); + this.emit(Events.POST_PROCESS, this); this.list.clear(); this.inflight.clear(); @@ -108252,14 +114177,14 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_COMPLETE; - this.systems.events.off('update', this.update, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); // Call 'destroy' on each file ready for deletion this._deleteQueue.iterateLocal('destroy'); this._deleteQueue.clear(); - this.emit('complete', this, this.totalComplete, this.totalFailed); + this.emit(Events.COMPLETE, this, this.totalComplete, this.totalFailed); }, /** @@ -108367,8 +114292,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_SHUTDOWN; - this.systems.events.off('update', this.update, this); - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -108385,8 +114310,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_DESTROYED; - this.systems.events.off('update', this.update, this); - this.systems.events.off('start', this.pluginStart, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.START, this.pluginStart, this); this.list = null; this.inflight = null; @@ -108396,6 +114321,7 @@ var LoaderPlugin = new Class({ this.systems = null; this.textureManager = null; this.cacheManager = null; + this.sceneManager = null; } }); @@ -108406,22 +114332,22 @@ module.exports = LoaderPlugin; /***/ }), -/* 572 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(57); -var TextFile = __webpack_require__(251); +var MultiFile = __webpack_require__(63); +var TextFile = __webpack_require__(256); /** * @typedef {object} Phaser.Loader.FileTypes.UnityAtlasFileConfig @@ -108471,6 +114397,8 @@ var UnityAtlasFile = new Class({ { var config = key; + key = GetFastValue(config, 'key'); + image = new ImageFile(loader, { key: key, url: GetFastValue(config, 'textureURL'), @@ -108511,7 +114439,7 @@ var UnityAtlasFile = new Class({ */ addToCache: function () { - if (this.failed === 0 && !this.complete) + if (this.isReadyToProcess()) { var image = this.files[0]; var text = this.files[1]; @@ -108658,19 +114586,19 @@ module.exports = UnityAtlasFile; /***/ }), -/* 573 */ +/* 580 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); -var TILEMAP_FORMATS = __webpack_require__(29); +var JSONFile = __webpack_require__(55); +var TILEMAP_FORMATS = __webpack_require__(31); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapJSONFileConfig @@ -108823,19 +114751,19 @@ module.exports = TilemapJSONFile; /***/ }), -/* 574 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); -var TILEMAP_FORMATS = __webpack_require__(29); +var JSONFile = __webpack_require__(55); +var TILEMAP_FORMATS = __webpack_require__(31); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapImpactFileConfig @@ -108988,22 +114916,22 @@ module.exports = TilemapImpactFile; /***/ }), -/* 575 */ +/* 582 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); -var TILEMAP_FORMATS = __webpack_require__(29); +var TILEMAP_FORMATS = __webpack_require__(31); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapCSVFileConfig @@ -109192,18 +115120,18 @@ module.exports = TilemapCSVFile; /***/ }), -/* 576 */ +/* 583 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -109549,18 +115477,18 @@ module.exports = SVGFile; /***/ }), -/* 577 */ +/* 584 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); /** * @typedef {object} Phaser.Loader.FileTypes.SpriteSheetFileConfig @@ -109751,18 +115679,18 @@ module.exports = SpriteSheetFile; /***/ }), -/* 578 */ +/* 585 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -109931,18 +115859,18 @@ module.exports = ScriptFile; /***/ }), -/* 579 */ +/* 586 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -110148,18 +116076,245 @@ module.exports = ScenePluginFile; /***/ }), -/* 580 */ +/* 587 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(8); + +/** + * @typedef {object} Phaser.Loader.FileTypes.SceneFileConfig + * + * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. + * @property {string} [url] - The absolute or relative URL to load the file from. + * @property {string} [extension='txt'] - The default file extension to use if no url is provided. + * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ + +/** + * @classdesc + * An external Scene JavaScript File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile. + * + * @class SceneFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var SceneFile = new Class({ + + Extends: File, + + initialize: + + function SceneFile (loader, key, url, xhrSettings) + { + var extension = 'js'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'text', + cache: loader.cacheManager.text, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.SceneFile#onProcess + * @since 3.16.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = this.xhrLoader.responseText; + + this.onProcessComplete(); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.SceneFile#addToCache + * @since 3.16.0 + */ + addToCache: function () + { + var code = this.data.concat('(function(){\n' + 'return new ' + this.key + '();\n' + '}).call(this);'); + + this.loader.sceneManager.add(this.key, eval(code)); + + this.complete = true; + } + +}); + +/** + * Adds an external Scene file, or array of Scene files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('Level1', 'src/Level1.js'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Scene Manager upon a successful load. + * + * For a Scene File it's vitally important that the key matches the class name in the JavaScript file. + * + * For example here is the source file: + * + * ```javascript + * class ExternalScene extends Phaser.Scene { + * + * constructor () + * { + * super('myScene'); + * } + * + * } + * ``` + * + * Because the class is called `ExternalScene` that is the exact same key you must use when loading it: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('ExternalScene', 'src/yourScene.js'); + * } + * ``` + * + * The key that is used within the Scene Manager can either be set to the same, or you can override it in the Scene + * constructor, as we've done in the example above, where the Scene key was changed to `myScene`. + * + * The key should be unique both in terms of files being loaded and Scenes already present in the Scene Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Scene Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.sceneFile({ + * key: 'Level1', + * url: 'src/Level1.js' + * }); + * ``` + * + * See the documentation for `Phaser.Loader.FileTypes.SceneFileConfig` for more details. + * + * Once the file has finished loading it will be added to the Scene Manager. + * + * ```javascript + * this.load.sceneFile('Level1', 'src/Level1.js'); + * // and later in your game ... + * this.scene.start('Level1'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `WORLD1.` and the key was `Story` the final key will be `WORLD1.Story` and + * this is what you would use to retrieve the text from the Scene Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Scene File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#sceneFile + * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @since 3.16.0 + * + * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig|Phaser.Loader.FileTypes.SceneFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {Phaser.Loader.LoaderPlugin} The Loader instance. + */ +FileTypesManager.register('sceneFile', 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 SceneFile(this, key[i])); + } + } + else + { + this.addFile(new SceneFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = SceneFile; + + +/***/ }), +/* 588 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -110275,7 +116430,14 @@ var PluginFile = new Class({ document.head.appendChild(this.data); - pluginManager.install(this.key, window[this.key], start, mapping); + var plugin = pluginManager.install(this.key, window[this.key], start, mapping); + + if (start || mapping) + { + // Install into the current Scene Systems and Scene + this.loader.systems[mapping] = plugin; + this.loader.scene[mapping] = plugin; + } } this.onProcessComplete(); @@ -110336,7 +116498,7 @@ var PluginFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.PluginFileConfig|Phaser.Loader.FileTypes.PluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function. - * @param {boolean} [start] - The plugin mapping configuration object. + * @param {boolean} [start] - Automatically start the plugin after loading? * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * @@ -110364,19 +116526,19 @@ module.exports = PluginFile; /***/ }), -/* 581 */ +/* 589 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); +var CONST = __webpack_require__(15); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); +var JSONFile = __webpack_require__(55); /** * @typedef {object} Phaser.Loader.FileTypes.PackFileConfig @@ -110592,22 +116754,22 @@ module.exports = PackFile; /***/ }), -/* 582 */ +/* 590 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(51); -var MultiFile = __webpack_require__(57); +var JSONFile = __webpack_require__(55); +var MultiFile = __webpack_require__(63); /** * @typedef {object} Phaser.Loader.FileTypes.MultiAtlasFileConfig @@ -110675,7 +116837,7 @@ var MultiAtlasFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.MultiFile#onFileComplete + * @method Phaser.Loader.FileTypes.MultiAtlasFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -110748,7 +116910,7 @@ var MultiAtlasFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.MultiFile#addToCache + * @method Phaser.Loader.FileTypes.MultiAtlasFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -110928,18 +117090,18 @@ module.exports = MultiAtlasFile; /***/ }), -/* 583 */ +/* 591 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -111197,18 +117359,18 @@ module.exports = HTMLTextureFile; /***/ }), -/* 584 */ +/* 592 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -111381,18 +117543,18 @@ module.exports = HTMLFile; /***/ }), -/* 585 */ +/* 593 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -111566,23 +117728,23 @@ module.exports = GLSLFile; /***/ }), -/* 586 */ +/* 594 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(57); -var ParseXMLBitmapFont = __webpack_require__(310); -var XMLFile = __webpack_require__(139); +var MultiFile = __webpack_require__(63); +var ParseXMLBitmapFont = __webpack_require__(314); +var XMLFile = __webpack_require__(150); /** * @typedef {object} Phaser.Loader.FileTypes.BitmapFontFileConfig @@ -111822,18 +117984,18 @@ module.exports = BitmapFontFile; /***/ }), -/* 587 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -112014,22 +118176,22 @@ module.exports = BinaryFile; /***/ }), -/* 588 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AudioFile = __webpack_require__(253); +var AudioFile = __webpack_require__(258); var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(51); -var MultiFile = __webpack_require__(57); +var JSONFile = __webpack_require__(55); +var MultiFile = __webpack_require__(63); /** * @typedef {object} Phaser.Loader.FileTypes.AudioSpriteFileConfig @@ -112115,7 +118277,7 @@ var AudioSpriteFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.AudioSpriteFile#onFileComplete + * @method Phaser.Loader.FileTypes.AudioSpriteFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -112151,7 +118313,7 @@ var AudioSpriteFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.AudioSpriteFile#addToCache + * @method Phaser.Loader.FileTypes.AudioSpriteFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -112315,22 +118477,22 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio /***/ }), -/* 589 */ +/* 597 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(57); -var XMLFile = __webpack_require__(139); +var MultiFile = __webpack_require__(63); +var XMLFile = __webpack_require__(150); /** * @typedef {object} Phaser.Loader.FileTypes.AtlasXMLFileConfig @@ -112570,22 +118732,22 @@ module.exports = AtlasXMLFile; /***/ }), -/* 590 */ +/* 598 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(51); -var MultiFile = __webpack_require__(57); +var JSONFile = __webpack_require__(55); +var MultiFile = __webpack_require__(63); /** * @typedef {object} Phaser.Loader.FileTypes.AtlasJSONFileConfig @@ -112832,18 +118994,19 @@ module.exports = AtlasJSONFile; /***/ }), -/* 591 */ +/* 599 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); +var JSONFile = __webpack_require__(55); +var LoaderEvents = __webpack_require__(75); /** * @classdesc @@ -112891,7 +119054,7 @@ var AnimationJSONFile = new Class({ onProcess: function () { // We need to hook into this event: - this.loader.once('loadcomplete', this.onLoadComplete, this); + this.loader.once(LoaderEvents.POST_PROCESS, this.onLoadComplete, this); // But the rest is the same as a normal JSON file JSONFile.prototype.onProcess.call(this); @@ -113034,12 +119197,12 @@ module.exports = AnimationJSONFile; /***/ }), -/* 592 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113049,48 +119212,49 @@ module.exports = AnimationJSONFile; module.exports = { - AnimationJSONFile: __webpack_require__(591), - AtlasJSONFile: __webpack_require__(590), - AtlasXMLFile: __webpack_require__(589), - AudioFile: __webpack_require__(253), - AudioSpriteFile: __webpack_require__(588), - BinaryFile: __webpack_require__(587), - BitmapFontFile: __webpack_require__(586), - GLSLFile: __webpack_require__(585), - HTML5AudioFile: __webpack_require__(252), - HTMLFile: __webpack_require__(584), - HTMLTextureFile: __webpack_require__(583), - ImageFile: __webpack_require__(58), - JSONFile: __webpack_require__(51), - MultiAtlasFile: __webpack_require__(582), - PackFile: __webpack_require__(581), - PluginFile: __webpack_require__(580), - ScenePluginFile: __webpack_require__(579), - ScriptFile: __webpack_require__(578), - SpriteSheetFile: __webpack_require__(577), - SVGFile: __webpack_require__(576), - TextFile: __webpack_require__(251), - TilemapCSVFile: __webpack_require__(575), - TilemapImpactFile: __webpack_require__(574), - TilemapJSONFile: __webpack_require__(573), - UnityAtlasFile: __webpack_require__(572), - XMLFile: __webpack_require__(139) + AnimationJSONFile: __webpack_require__(599), + AtlasJSONFile: __webpack_require__(598), + AtlasXMLFile: __webpack_require__(597), + AudioFile: __webpack_require__(258), + AudioSpriteFile: __webpack_require__(596), + BinaryFile: __webpack_require__(595), + BitmapFontFile: __webpack_require__(594), + GLSLFile: __webpack_require__(593), + HTML5AudioFile: __webpack_require__(257), + HTMLFile: __webpack_require__(592), + HTMLTextureFile: __webpack_require__(591), + ImageFile: __webpack_require__(64), + JSONFile: __webpack_require__(55), + MultiAtlasFile: __webpack_require__(590), + PackFile: __webpack_require__(589), + PluginFile: __webpack_require__(588), + SceneFile: __webpack_require__(587), + ScenePluginFile: __webpack_require__(586), + ScriptFile: __webpack_require__(585), + SpriteSheetFile: __webpack_require__(584), + SVGFile: __webpack_require__(583), + TextFile: __webpack_require__(256), + TilemapCSVFile: __webpack_require__(582), + TilemapImpactFile: __webpack_require__(581), + TilemapJSONFile: __webpack_require__(580), + UnityAtlasFile: __webpack_require__(579), + XMLFile: __webpack_require__(150) }; /***/ }), -/* 593 */ +/* 601 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(18); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(15); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Loader @@ -113098,16 +119262,18 @@ var Extend = __webpack_require__(20); var Loader = { - FileTypes: __webpack_require__(592), + Events: __webpack_require__(75), - File: __webpack_require__(21), + FileTypes: __webpack_require__(600), + + File: __webpack_require__(22), FileTypesManager: __webpack_require__(7), - GetURL: __webpack_require__(141), - LoaderPlugin: __webpack_require__(571), - MergeXHRSettings: __webpack_require__(140), - MultiFile: __webpack_require__(57), - XHRLoader: __webpack_require__(254), - XHRSettings: __webpack_require__(105) + GetURL: __webpack_require__(152), + LoaderPlugin: __webpack_require__(578), + MergeXHRSettings: __webpack_require__(151), + MultiFile: __webpack_require__(63), + XHRLoader: __webpack_require__(259), + XHRSettings: __webpack_require__(112) }; @@ -113118,12 +119284,12 @@ module.exports = Loader; /***/ }), -/* 594 */ +/* 602 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113134,19 +119300,19 @@ module.exports = Loader; /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(333) + TouchManager: __webpack_require__(337) }; /* eslint-enable */ /***/ }), -/* 595 */ +/* 603 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113157,19 +119323,19 @@ module.exports = { /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(336) + MouseManager: __webpack_require__(339) }; /* eslint-enable */ /***/ }), -/* 596 */ +/* 604 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113196,12 +119362,12 @@ module.exports = UpDuration; /***/ }), -/* 597 */ +/* 605 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113228,12 +119394,12 @@ module.exports = DownDuration; /***/ }), -/* 598 */ +/* 606 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113270,12 +119436,12 @@ module.exports = JustUp; /***/ }), -/* 599 */ +/* 607 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113312,127 +119478,16 @@ module.exports = JustDown; /***/ }), -/* 600 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Used internally by the Keyboard Plugin. - * - * @function Phaser.Input.Keyboard.ProcessKeyUp - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to process the event for. - * @param {KeyboardEvent} event - The native Keyboard event. - * - * @return {Phaser.Input.Keyboard.Key} The Key that was processed. - */ -var ProcessKeyUp = function (key, event) -{ - key.originalEvent = event; - - if (key.preventDefault) - { - event.preventDefault(); - } - - if (!key.enabled) - { - return; - } - - key.isDown = false; - key.isUp = true; - key.timeUp = event.timeStamp; - key.duration = key.timeUp - key.timeDown; - key.repeats = 0; - - key._justDown = false; - key._justUp = true; - key._tick = -1; - - return key; -}; - -module.exports = ProcessKeyUp; - - -/***/ }), -/* 601 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Used internally by the Keyboard Plugin. - * - * @function Phaser.Input.Keyboard.ProcessKeyDown - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to process the event for. - * @param {KeyboardEvent} event - The native Keyboard event. - * - * @return {Phaser.Input.Keyboard.Key} The Key that was processed. - */ -var ProcessKeyDown = function (key, event) -{ - key.originalEvent = event; - - if (key.preventDefault) - { - event.preventDefault(); - } - - if (!key.enabled) - { - return; - } - - key.altKey = event.altKey; - key.ctrlKey = event.ctrlKey; - key.shiftKey = event.shiftKey; - key.location = event.location; - - if (key.isDown === false) - { - key.isDown = true; - key.isUp = false; - key.timeDown = event.timeStamp; - key.duration = 0; - key._justDown = true; - key._justUp = false; - } - - key.repeats++; - - return key; -}; - -module.exports = ProcessKeyDown; - - -/***/ }), -/* 602 */ +/* 608 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var KeyCodes = __webpack_require__(143); +var KeyCodes = __webpack_require__(125); var KeyMap = {}; @@ -113445,12 +119500,12 @@ module.exports = KeyMap; /***/ }), -/* 603 */ +/* 609 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113480,12 +119535,12 @@ module.exports = ResetKeyCombo; /***/ }), -/* 604 */ +/* 610 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113522,16 +119577,16 @@ module.exports = AdvanceKeyCombo; /***/ }), -/* 605 */ +/* 611 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(604); +var AdvanceKeyCombo = __webpack_require__(610); /** * Used internally by the KeyCombo class. @@ -113603,26 +119658,27 @@ module.exports = ProcessKeyCombo; /***/ }), -/* 606 */ +/* 612 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); +var Events = __webpack_require__(113); +var GameEvents = __webpack_require__(26); var GetValue = __webpack_require__(4); -var InputPluginCache = __webpack_require__(106); -var Key = __webpack_require__(256); -var KeyCodes = __webpack_require__(143); -var KeyCombo = __webpack_require__(255); -var KeyMap = __webpack_require__(602); -var ProcessKeyDown = __webpack_require__(601); -var ProcessKeyUp = __webpack_require__(600); -var SnapFloor = __webpack_require__(142); +var InputEvents = __webpack_require__(52); +var InputPluginCache = __webpack_require__(114); +var Key = __webpack_require__(261); +var KeyCodes = __webpack_require__(125); +var KeyCombo = __webpack_require__(260); +var KeyMap = __webpack_require__(608); +var SnapFloor = __webpack_require__(98); /** * @classdesc @@ -113641,7 +119697,7 @@ var SnapFloor = __webpack_require__(142); * Or, to listen for a specific key: * * ```javascript - * this.input.keyboard.on('keydown_A', callback, context); + * this.input.keyboard.on('keydown-A', callback, context); * ``` * * You can also create Key objects, which you can then poll in your game loop: @@ -113649,6 +119705,10 @@ var SnapFloor = __webpack_require__(142); * ```javascript * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); * ``` + * + * If you have multiple parallel Scenes, each trying to get keyboard input, be sure to disable capture on them to stop them from + * stealing input from another Scene in the list. You can do this with `this.input.keyboard.enabled = false` within the + * Scene to stop all input, or `this.input.keyboard.preventDefault = false` to stop a Scene halting input on another Scene. * * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details. @@ -113675,6 +119735,15 @@ var KeyboardPlugin = new Class({ { EventEmitter.call(this); + /** + * A reference to the core game, so we can listen for visibility events. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#game + * @type {Phaser.Game} + * @since 3.16.0 + */ + this.game = sceneInputPlugin.systems.game; + /** * A reference to the Scene that this Input Plugin is responsible for. * @@ -113703,7 +119772,16 @@ var KeyboardPlugin = new Class({ this.sceneInputPlugin = sceneInputPlugin; /** - * A boolean that controls if the Keyboard Plugin is enabled or not. + * A reference to the global Keyboard Manager. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#manager + * @type {Phaser.Input.InputPlugin} + * @since 3.16.0 + */ + this.manager = sceneInputPlugin.manager.keyboard; + + /** + * A boolean that controls if this Keyboard Plugin is enabled or not. * Can be toggled on the fly. * * @name Phaser.Input.Keyboard.KeyboardPlugin#enabled @@ -113713,16 +119791,6 @@ var KeyboardPlugin = new Class({ */ this.enabled = true; - /** - * The Keyboard Event target, as defined in the Scene or Game Config. - * Typically the browser window, but can be any interactive DOM element. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#target - * @type {any} - * @since 3.10.0 - */ - this.target; - /** * An array of Key objects to process. * @@ -113741,38 +119809,8 @@ var KeyboardPlugin = new Class({ */ this.combos = []; - /** - * An internal event queue. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#queue - * @type {KeyboardEvent[]} - * @private - * @since 3.10.0 - */ - this.queue = []; - - /** - * Internal event handler. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#onKeyHandler - * @type {function} - * @private - * @since 3.10.0 - */ - this.onKeyHandler; - - /** - * Internal time value. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#time - * @type {number} - * @private - * @since 3.11.0 - */ - this.time = 0; - - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -113786,12 +119824,17 @@ var KeyboardPlugin = new Class({ boot: function () { var settings = this.settings.input; - var config = this.scene.sys.game.config; - this.enabled = GetValue(settings, 'keyboard', config.inputKeyboard); - this.target = GetValue(settings, 'keyboard.target', config.inputKeyboardEventTarget); + this.enabled = GetValue(settings, 'keyboard', true); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + var captures = GetValue(settings, 'keyboard.capture', null); + + if (captures) + { + this.addCaptures(captures); + } + + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -113805,12 +119848,18 @@ var KeyboardPlugin = new Class({ */ start: function () { - if (this.enabled) + if (this.sceneInputPlugin.manager.useQueue) { - this.startListeners(); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.on(InputEvents.MANAGER_PROCESS, this.update, this); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); + + this.game.events.on(GameEvents.BLUR, this.resetKeys, this); }, /** @@ -113827,59 +119876,153 @@ var KeyboardPlugin = new Class({ }, /** - * Starts the Keyboard Event listeners running. - * This is called automatically and does not need to be manually invoked. + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. * - * @method Phaser.Input.Keyboard.KeyboardPlugin#startListeners - * @private - * @since 3.10.0 + * This `addCapture` method enables consuming keyboard events for specific keys, so they don't bubble up the browser + * and cause the default behaviors. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable event capture for. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ - startListeners: function () + addCapture: function (keycode) { - var _this = this; + this.manager.addCapture(keycode); - var handler = function (event) - { - if (event.defaultPrevented || !_this.isActive()) - { - // Do nothing if event already handled - return; - } - - _this.queue.push(event); - - var key = _this.keys[event.keyCode]; - - if (key && key.preventDefault) - { - event.preventDefault(); - } - - }; - - this.onKeyHandler = handler; - - this.target.addEventListener('keydown', handler, false); - this.target.addEventListener('keyup', handler, false); - - // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + return this; }, /** - * Stops the Keyboard Event listeners. - * This is called automatically and does not need to be manually invoked. + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. * - * @method Phaser.Input.Keyboard.KeyboardPlugin#stopListeners - * @private - * @since 3.10.0 + * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable event capture for. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ - stopListeners: function () + removeCapture: function (keycode) { - this.target.removeEventListener('keydown', this.onKeyHandler); - this.target.removeEventListener('keyup', this.onKeyHandler); + this.manager.removeCapture(keycode); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + return this; + }, + + /** + * Returns an array that contains all of the keyboard captures currently enabled. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures + * @since 3.16.0 + * + * @return {integer[]} An array of all the currently capturing key codes. + */ + getCaptures: function () + { + return this.manager.captures; + }, + + /** + * Allows Phaser to prevent any key captures you may have defined from bubbling up the browser. + * You can use this to re-enable event capturing if you had paused it via `disableGlobalCapture`. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#enableGlobalCapture + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + enableGlobalCapture: function () + { + this.manager.preventDefault = true; + + return this; + }, + + /** + * Disables Phaser from preventing any key captures you may have defined, without actually removing them. + * You can use this to temporarily disable event capturing if, for example, you swap to a DOM element. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#disableGlobalCapture + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + disableGlobalCapture: function () + { + this.manager.preventDefault = false; + + return this; + }, + + /** + * Removes all keyboard captures. + * + * Note that this is a global change. It will clear all event captures across your game, not just for this specific Scene. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#clearCaptures + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + clearCaptures: function () + { + this.manager.clearCaptures(); + + return this; }, /** @@ -113939,11 +120082,16 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(object|string)} keys - An object containing Key Codes, or a comma-separated string. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * * @return {object} An object containing Key objects mapped to the input properties. */ - addKeys: function (keys) + addKeys: function (keys, enableCapture, emitOnRepeat) { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var output = {}; if (typeof keys === 'string') @@ -113956,7 +120104,7 @@ var KeyboardPlugin = new Class({ if (currentKey) { - output[currentKey] = this.addKey(currentKey); + output[currentKey] = this.addKey(currentKey, enableCapture, emitOnRepeat); } } } @@ -113964,7 +120112,7 @@ var KeyboardPlugin = new Class({ { for (var key in keys) { - output[key] = this.addKey(keys[key]); + output[key] = this.addKey(keys[key], enableCapture, emitOnRepeat); } } @@ -113982,11 +120130,16 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * * @return {Phaser.Input.Keyboard.Key} The newly created Key object, or a reference to it if it already existed in the keys array. */ - addKey: function (key) + addKey: function (key, enableCapture, emitOnRepeat) { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var keys = this.keys; if (key instanceof Key) @@ -114002,6 +120155,13 @@ var KeyboardPlugin = new Class({ keys[key.keyCode] = key; } + if (enableCapture) + { + this.addCapture(key.keyCode); + } + + key.setEmitOnRepeat(emitOnRepeat); + return key; } @@ -114013,6 +120173,13 @@ var KeyboardPlugin = new Class({ if (!keys[key]) { keys[key] = new Key(key); + + if (enableCapture) + { + this.addCapture(key); + } + + keys[key].setEmitOnRepeat(emitOnRepeat); } return keys[key]; @@ -114027,6 +120194,8 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ removeKey: function (key) { @@ -114050,6 +120219,8 @@ var KeyboardPlugin = new Class({ { keys[key] = undefined; } + + return this; }, /** @@ -114110,7 +120281,7 @@ var KeyboardPlugin = new Class({ * @param {Phaser.Input.Keyboard.Key} key - A Key object. * @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down. * - * @return {boolean} `True` if the Key is down within the duration specified, otherwise `false`. + * @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`. */ checkDown: function (key, duration) { @@ -114130,29 +120301,22 @@ var KeyboardPlugin = new Class({ }, /** - * Internal update handler called by the Input Manager, which is in turn invoked by the Game step. + * Internal update handler called by the Input Plugin, which is in turn invoked by the Game step. * * @method Phaser.Input.Keyboard.KeyboardPlugin#update * @private * @since 3.10.0 - * - * @param {number} time - The game loop time value. */ - update: function (time) + update: function () { - this.time = time; + var queue = this.manager.queue; + var len = queue.length; - var len = this.queue.length; - - if (!this.enabled || len === 0) + if (!this.isActive() || len === 0) { return; } - // Clears the queue array, and also means we don't work on array data that could potentially - // be modified during the processing phase - var queue = this.queue.splice(0, len); - var keys = this.keys; // Process the event queue, dispatching all of the events that have stored up @@ -114160,40 +120324,98 @@ var KeyboardPlugin = new Class({ { var event = queue[i]; var code = event.keyCode; + var key = keys[code]; + var repeat = false; + + // Override the default functions (it's too late for the browser to use them anyway, so we may as well) + if (event.cancelled === undefined) + { + // Event allowed to flow across all handlers in this Scene, and any other Scene in the Scene list + event.cancelled = 0; + + // Won't reach any more local (Scene level) handlers + event.stopImmediatePropagation = function () + { + event.cancelled = 1; + }; + + // Won't reach any more handlers in any Scene further down the Scene list + event.stopPropagation = function () + { + event.cancelled = -1; + }; + } + + if (event.cancelled === -1) + { + // This event has been stopped from broadcasting to any other Scene, so abort. + continue; + } if (event.type === 'keydown') { - if (KeyMap[code] && (keys[code] === undefined || keys[code].isDown === false)) + // Key specific callback first + if (key) { - // Will emit a keyboard or keyup event - this.emit(event.type, event); + repeat = key.isDown; - this.emit('keydown_' + KeyMap[code], event); + key.onDown(event); } - if (keys[code]) + if (!event.cancelled && (!key || !repeat)) { - ProcessKeyDown(keys[code], event); + if (KeyMap[code]) + { + this.emit(Events.KEY_DOWN + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. + this.emit('keydown_' + KeyMap[code], event); + } + + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_DOWN, event); + } } } else { - // Will emit a keyboard or keyup event - this.emit(event.type, event); - - this.emit('keyup_' + KeyMap[code], event); - - if (keys[code]) + // Key specific callback first + if (key) { - ProcessKeyUp(keys[code], event); + key.onUp(event); } + + if (!event.cancelled) + { + if (KeyMap[code]) + { + this.emit(Events.KEY_UP + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. + this.emit('keyup_' + KeyMap[code], event); + } + + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_UP, event); + } + } + } + + // Reset the cancel state for other Scenes to use + if (event.cancelled === 1) + { + event.cancelled = 0; } } }, /** * Resets all Key objects created by _this_ Keyboard Plugin back to their default un-pressed states. - * This can only reset keys created via the `addKey`, `addKeys` or `createCursors` methods. + * This can only reset keys created via the `addKey`, `addKeys` or `createCursorKeys` methods. * If you have created a Key object directly you'll need to reset it yourself. * * This method is called automatically when the Keyboard Plugin shuts down, but can be @@ -114201,6 +120423,8 @@ var KeyboardPlugin = new Class({ * * @method Phaser.Input.Keyboard.KeyboardPlugin#resetKeys * @since 3.15.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ resetKeys: function () { @@ -114233,7 +120457,16 @@ var KeyboardPlugin = new Class({ { this.resetKeys(); - this.stopListeners(); + if (this.sceneInputPlugin.manager.useQueue) + { + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.off(InputEvents.MANAGER_PROCESS, this.update, this); + } + + this.game.events.off(GameEvents.BLUR, this.resetKeys); this.removeAllListeners(); @@ -114251,6 +120484,17 @@ var KeyboardPlugin = new Class({ { this.shutdown(); + var keys = this.keys; + + for (var i = 0; i < keys.length; i++) + { + // Because it's a sparsely populated array + if (keys[i]) + { + keys[i].destroy(); + } + } + this.keys = []; this.combos = []; this.queue = []; @@ -114258,7 +120502,24 @@ var KeyboardPlugin = new Class({ this.scene = null; this.settings = null; this.sceneInputPlugin = null; - this.target = null; + this.manager = null; + }, + + /** + * Internal time value. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#time + * @type {number} + * @private + * @since 3.11.0 + */ + time: { + + get: function () + { + return this.sceneInputPlugin.manager.time; + } + } }); @@ -114277,12 +120538,243 @@ module.exports = KeyboardPlugin; /***/ }), -/* 607 */ +/* 613 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('up', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * @event Phaser.Input.Keyboard.Events#UP + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was released. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'up'; + + +/***/ }), +/* 614 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released + * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keyup-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#KEY_UP + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup-'; + + +/***/ }), +/* 615 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed + * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keydown-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#KEY_DOWN + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown-'; + + +/***/ }), +/* 616 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('down', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * @event Phaser.Input.Keyboard.Events#DOWN + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was pressed. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'down'; + + +/***/ }), +/* 617 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Combo Match Event. + * + * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched. + * + * Listen for this event from the Key Plugin after a combo has been created: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * @event Phaser.Input.Keyboard.Events#COMBO_MATCH + * + * @param {Phaser.Input.Keyboard.KeyCombo} keycombo - The Key Combo object that was matched. + * @param {KeyboardEvent} event - The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'keycombomatch'; + + +/***/ }), +/* 618 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`. + * + * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_UP + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup'; + + +/***/ }), +/* 619 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`. + * + * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_DOWN + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown'; + + +/***/ }), +/* 620 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114292,28 +120784,31 @@ module.exports = KeyboardPlugin; module.exports = { - KeyboardPlugin: __webpack_require__(606), + Events: __webpack_require__(113), - Key: __webpack_require__(256), - KeyCodes: __webpack_require__(143), + KeyboardManager: __webpack_require__(340), + KeyboardPlugin: __webpack_require__(612), - KeyCombo: __webpack_require__(255), + Key: __webpack_require__(261), + KeyCodes: __webpack_require__(125), - JustDown: __webpack_require__(599), - JustUp: __webpack_require__(598), - DownDuration: __webpack_require__(597), - UpDuration: __webpack_require__(596) + KeyCombo: __webpack_require__(260), + + JustDown: __webpack_require__(607), + JustUp: __webpack_require__(606), + DownDuration: __webpack_require__(605), + UpDuration: __webpack_require__(604) }; /***/ }), -/* 608 */ +/* 621 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114344,32 +120839,34 @@ module.exports = CreatePixelPerfectHandler; /***/ }), -/* 609 */ +/* 622 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); -var CircleContains = __webpack_require__(40); +var Circle = __webpack_require__(77); +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var CreateInteractiveObject = __webpack_require__(260); -var CreatePixelPerfectHandler = __webpack_require__(608); -var DistanceBetween = __webpack_require__(52); -var Ellipse = __webpack_require__(90); -var EllipseContains = __webpack_require__(89); +var CreateInteractiveObject = __webpack_require__(265); +var CreatePixelPerfectHandler = __webpack_require__(621); +var DistanceBetween = __webpack_require__(56); +var Ellipse = __webpack_require__(96); +var EllipseContains = __webpack_require__(95); +var Events = __webpack_require__(52); var EventEmitter = __webpack_require__(11); var GetFastValue = __webpack_require__(2); -var InputPluginCache = __webpack_require__(106); +var InputPluginCache = __webpack_require__(114); var IsPlainObject = __webpack_require__(8); -var PluginCache = __webpack_require__(15); -var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(39); -var Triangle = __webpack_require__(59); -var TriangleContains = __webpack_require__(69); +var PluginCache = __webpack_require__(17); +var Rectangle = __webpack_require__(10); +var RectangleContains = __webpack_require__(42); +var SceneEvents = __webpack_require__(16); +var Triangle = __webpack_require__(65); +var TriangleContains = __webpack_require__(74); /** * @classdesc @@ -114556,7 +121053,7 @@ var InputPlugin = new Class({ * Internal event propagation callback container. * * @name Phaser.Input.InputPlugin#_eventContainer - * @type {object} + * @type {Phaser.Input.EventData} * @private * @since 3.13.0 */ @@ -114673,6 +121170,16 @@ var InputPlugin = new Class({ */ this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; + /** + * A array containing the dragStates, for this Scene, index by the Pointer ID. + * + * @name Phaser.Input.InputPlugin#_dragState + * @type {integer[]} + * @private + * @since 3.16.0 + */ + this._dragState = []; + /** * A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID. * @@ -114693,8 +121200,8 @@ var InputPlugin = new Class({ */ this._validTypes = [ 'onDown', 'onUp', 'onOver', 'onOut', 'onMove', 'onDragStart', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDrop' ]; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -114702,6 +121209,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#boot + * @fires Phaser.Input.Events#BOOT * @private * @since 3.5.1 */ @@ -114711,10 +121219,10 @@ var InputPlugin = new Class({ this.displayList = this.systems.displayList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); // Registered input plugins listen for this - this.pluginEvents.emit('boot'); + this.pluginEvents.emit(Events.BOOT); }, /** @@ -114723,6 +121231,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#start + * @fires Phaser.Input.Events#START * @private * @since 3.5.0 */ @@ -114730,18 +121239,60 @@ var InputPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('transitionstart', this.transitionIn, this); - eventEmitter.on('transitionout', this.transitionOut, this); - eventEmitter.on('transitioncomplete', this.transitionComplete, this); - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); + eventEmitter.on(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.once('shutdown', this.shutdown, this); + if (this.manager.useQueue) + { + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + } + + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + + this.manager.events.on(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.on(Events.GAME_OVER, this.onGameOver, this); this.enabled = true; + // Populate the pointer drag states + this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + // Registered input plugins listen for this - this.pluginEvents.emit('start'); + this.pluginEvents.emit(Events.START); + }, + + /** + * Game Over handler. + * + * @method Phaser.Input.InputPlugin#onGameOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.2 + */ + onGameOver: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OVER, event.timeStamp, event); + } + }, + + /** + * Game Out handler. + * + * @method Phaser.Input.InputPlugin#onGameOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.2 + */ + onGameOut: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OUT, event.timeStamp, event); + } }, /** @@ -114749,13 +121300,14 @@ var InputPlugin = new Class({ * deleting old Game Objects. * * @method Phaser.Input.InputPlugin#preUpdate + * @fires Phaser.Input.Events#PRE_UPDATE * @private * @since 3.0.0 */ preUpdate: function () { // Registered input plugins listen for this - this.pluginEvents.emit('preUpdate'); + this.pluginEvents.emit(Events.PRE_UPDATE); var removeList = this._pendingRemoval; var insertList = this._pendingInsertion; @@ -114812,6 +121364,7 @@ var InputPlugin = new Class({ * Called automatically by the Scene Systems step. * * @method Phaser.Input.InputPlugin#update + * @fires Phaser.Input.Events#UPDATE * @private * @since 3.0.0 * @@ -114825,10 +121378,10 @@ var InputPlugin = new Class({ return; } - this.pluginEvents.emit('update', time, delta); - var manager = this.manager; + this.pluginEvents.emit(Events.UPDATE, time, delta); + // Another Scene above this one has already consumed the input events, or we're in transition if (manager.globalTopOnly && manager.ignoreEvents) { @@ -114856,8 +121409,9 @@ var InputPlugin = new Class({ } var pointers = this.manager.pointers; + var pointersTotal = this.manager.pointersTotal; - for (var i = 0; i < this.manager.pointersTotal; i++) + for (var i = 0; i < pointersTotal; i++) { var pointer = pointers[i]; @@ -114886,8 +121440,11 @@ var InputPlugin = new Class({ var total = this.processDragEvents(pointer, time); - // TODO: Enable for touch - if (!pointer.wasTouch) + // TODO: Enable for touch - the method needs recoding to take ALL pointers at once + // and process them all together, in the same batch, otherwise the justOut and stillOver + // arrays will get corrupted in multi-touch enabled games. For now, we'll enable it for + // single touch games (which is probably the majority anyway). + if (pointersTotal < 3 || !pointer.wasTouch) { total += this.processOverOutEvents(pointer); } @@ -114897,16 +121454,16 @@ var InputPlugin = new Class({ total += this.processDownEvents(pointer); } - if (pointer.justUp) - { - total += this.processUpEvents(pointer); - } - if (pointer.justMoved) { total += this.processMoveEvents(pointer); } + if (pointer.justUp) + { + total += this.processUpEvents(pointer); + } + if (total > 0 && manager.globalTopOnly) { // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame @@ -115097,6 +121654,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processDownEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. @@ -115127,7 +121688,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointerdown', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_DOWN, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -115135,7 +121696,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectdown', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_DOWN, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -115144,20 +121705,89 @@ var InputPlugin = new Class({ } } - // Contains ALL Game Objects currently over in the array + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - this.emit('pointerdown', pointer, currentlyOver); + if (pointer.downElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_DOWN, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_DOWN_OUTSIDE, pointer); + } } return total; }, + /** + * Returns the drag state of the given Pointer for this Input Plugin. + * + * The state will be one of the following: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#getDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. + * + * @return {integer} The drag state of the given Pointer. + */ + getDragState: function (pointer) + { + return this._dragState[pointer.id]; + }, + + /** + * Sets the drag state of the given Pointer for this Input Plugin. + * + * The state must be one of the following values: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#setDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. + * @param {integer} state - The drag state value. An integer between 0 and 5. + */ + setDragState: function (pointer, state) + { + this._dragState[pointer.id] = state; + }, + /** * An internal method that handles the Pointer drag events. * * @method Phaser.Input.InputPlugin#processDragEvents * @private + * @fires Phaser.Input.Events#DRAG_END + * @fires Phaser.Input.Events#DRAG_ENTER + * @fires Phaser.Input.Events#DRAG + * @fires Phaser.Input.Events#DRAG_LEAVE + * @fires Phaser.Input.Events#DRAG_OVER + * @fires Phaser.Input.Events#DRAG_START + * @fires Phaser.Input.Events#DROP + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @fires Phaser.Input.Events#GAMEOBJECT_DROP * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. @@ -115186,19 +121816,19 @@ var InputPlugin = new Class({ // 4 = Pointer actively dragging the draglist and has moved // 5 = Pointer actively dragging but has been released, notify draglist - if (pointer.dragState === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) + if (this.getDragState(pointer) === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) { - pointer.dragState = 1; + this.setDragState(pointer, 1); } - else if (pointer.dragState > 0 && !pointer.primaryDown && pointer.justUp) + else if (this.getDragState(pointer) > 0 && !pointer.primaryDown && pointer.justUp) { - pointer.dragState = 5; + this.setDragState(pointer, 5); } // Process the various drag states // 1 = Primary button down and objects below, so collect a draglist - if (pointer.dragState === 1) + if (this.getDragState(pointer) === 1) { // Get draggable objects, sort them, pick the top (or all) and store them somewhere var draglist = []; @@ -115215,7 +121845,7 @@ var InputPlugin = new Class({ if (draglist.length === 0) { - pointer.dragState = 0; + this.setDragState(pointer, 0); return 0; } @@ -115235,35 +121865,35 @@ var InputPlugin = new Class({ if (this.dragDistanceThreshold === 0 && this.dragTimeThreshold === 0) { // No drag criteria, so snap immediately to mode 3 - pointer.dragState = 3; + this.setDragState(pointer, 3); } else { // Check the distance / time - pointer.dragState = 2; + this.setDragState(pointer, 2); } } // 2 = Pointer being checked if meets drag criteria - if (pointer.dragState === 2) + if (this.getDragState(pointer) === 2) { // Has it moved far enough to be considered a drag? if (this.dragDistanceThreshold > 0 && DistanceBetween(pointer.x, pointer.y, pointer.downX, pointer.downY) >= this.dragDistanceThreshold) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } // Held down long enough to be considered a drag? if (this.dragTimeThreshold > 0 && (time >= pointer.downTime + this.dragTimeThreshold)) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } } // 3 = Pointer meets criteria and is freshly down, notify the draglist - if (pointer.dragState === 3) + if (this.getDragState(pointer) === 3) { list = this._drag[pointer.id]; @@ -115281,18 +121911,18 @@ var InputPlugin = new Class({ input.dragStartX = gameObject.x; input.dragStartY = gameObject.y; - gameObject.emit('dragstart', pointer, input.dragX, input.dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG_START, pointer, input.dragX, input.dragY); - this.emit('dragstart', pointer, gameObject); + this.emit(Events.DRAG_START, pointer, gameObject); } - pointer.dragState = 4; + this.setDragState(pointer, 4); return list.length; } // 4 = Pointer actively dragging the draglist and has moved - if (pointer.dragState === 4 && pointer.justMoved && !pointer.justUp) + if (this.getDragState(pointer) === 4 && pointer.justMoved && !pointer.justUp) { var dropZones = this._tempZones; @@ -115313,29 +121943,29 @@ var InputPlugin = new Class({ if (index === 0) { // We're still over it, and it's still the top of the display list, phew ... - gameObject.emit('dragover', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_OVER, pointer, input.target); - this.emit('dragover', pointer, gameObject, input.target); + this.emit(Events.DRAG_OVER, pointer, gameObject, input.target); } else if (index > 0) { // Still over it but it's no longer top of the display list (targets must always be at the top) - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { // Nope, we've moved on (or the target has!), leave the old target - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); // Anything new to replace it? // Yup! @@ -115343,9 +121973,9 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { @@ -115358,24 +121988,24 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } var dragX = pointer.x - gameObject.input.dragX; var dragY = pointer.y - gameObject.input.dragY; - gameObject.emit('drag', pointer, dragX, dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG, pointer, dragX, dragY); - this.emit('drag', pointer, gameObject, dragX, dragY); + this.emit(Events.DRAG, pointer, gameObject, dragX, dragY); } return list.length; } // 5 = Pointer was actively dragging but has been released, notify draglist - if (pointer.dragState === 5) + if (this.getDragState(pointer) === 5) { list = this._drag[pointer.id]; @@ -115396,9 +122026,9 @@ var InputPlugin = new Class({ if (input.target) { - gameObject.emit('drop', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DROP, pointer, input.target); - this.emit('drop', pointer, gameObject, input.target); + this.emit(Events.DROP, pointer, gameObject, input.target); input.target = null; @@ -115407,13 +122037,13 @@ var InputPlugin = new Class({ // And finally the dragend event - gameObject.emit('dragend', pointer, input.dragX, input.dragY, dropped); + gameObject.emit(Events.GAMEOBJECT_DRAG_END, pointer, input.dragX, input.dragY, dropped); - this.emit('dragend', pointer, gameObject, dropped); + this.emit(Events.DRAG_END, pointer, gameObject, dropped); } } - pointer.dragState = 0; + this.setDragState(pointer, 0); list.splice(0); } @@ -115425,6 +122055,9 @@ var InputPlugin = new Class({ * An internal method that handles the Pointer movement event. * * @method Phaser.Input.InputPlugin#processMoveEvents + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @fires Phaser.Input.Events#GAMEOBJECT_MOVE + * @fires Phaser.Input.Events#POINTER_MOVE * @private * @since 3.0.0 * @@ -115456,7 +122089,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointermove', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_MOVE, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -115464,7 +122097,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectmove', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_MOVE, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -115480,7 +122113,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointermove', pointer, currentlyOver); + this.emit(Events.POINTER_MOVE, pointer, currentlyOver); } return total; @@ -115491,6 +122124,12 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processOverOutEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_OVER + * @fires Phaser.Input.Events#POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @fires Phaser.Input.Events#GAMEOBJECT_OUT + * @fires Phaser.Input.Events#POINTER_OUT * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -115572,7 +122211,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerout', pointer, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); manager.resetCursor(gameObject.input); @@ -115584,7 +122223,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectout', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -115595,7 +122234,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerout', pointer, justOut); + this.emit(Events.POINTER_OUT, pointer, justOut); } } @@ -115620,7 +122259,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerover', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); manager.setCursor(gameObject.input); @@ -115632,7 +122271,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectover', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -115643,7 +122282,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerover', pointer, justOver); + this.emit(Events.POINTER_OVER, pointer, justOver); } } @@ -115661,6 +122300,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processUpEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @fires Phaser.Input.Events#GAMEOBJECT_UP + * @fires Phaser.Input.Events#POINTER_UP + * @fires Phaser.Input.Events#POINTER_UP_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -115688,9 +122331,15 @@ var InputPlugin = new Class({ continue; } - // pointerupoutside + gameObject.emit(Events.GAMEOBJECT_POINTER_UP, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - gameObject.emit('pointerup', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + // Clear over and emit 'pointerout' on touch. + if (pointer.wasTouch) + { + this._over[pointer.id] = []; + + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + } if (_eventData.cancelled) { @@ -115698,7 +122347,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectup', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_UP, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -115707,10 +122356,17 @@ var InputPlugin = new Class({ } } + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - // Contains ALL Game Objects currently up in the array - this.emit('pointerup', pointer, currentlyOver); + if (pointer.upElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_UP, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_UP_OUTSIDE, pointer); + } } return currentlyOver.length; @@ -116028,20 +122684,20 @@ var InputPlugin = new Class({ var width = 0; var height = 0; - if (frame) - { - width = frame.realWidth; - height = frame.realHeight; - } - else if (gameObject.width) + if (gameObject.width) { width = gameObject.width; height = gameObject.height; } + else if (frame) + { + width = frame.realWidth; + height = frame.realHeight; + } if (gameObject.type === 'Container' && (width === 0 || height === 0)) { - console.warn('Container.setInteractive() must specify a Shape or call setSize() first'); + console.warn('Container.setInteractive must specify a Shape or call setSize() first'); continue; } @@ -116315,6 +122971,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -116337,6 +122997,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this DOM event. @@ -116352,6 +123013,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -116374,6 +123039,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -116389,6 +123055,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -116411,6 +123081,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -116526,19 +123197,21 @@ var InputPlugin = new Class({ * We need to kill and reset all internal properties as well as stop listening to Scene events. * * @method Phaser.Input.InputPlugin#shutdown + * @fires Phaser.Input.Events#SHUTDOWN * @private * @since 3.0.0 */ shutdown: function () { // Registered input plugins listen for this - this.pluginEvents.emit('shutdown'); + this.pluginEvents.emit(Events.SHUTDOWN); this._temp.length = 0; this._list.length = 0; this._draggable.length = 0; this._pendingRemoval.length = 0; this._pendingInsertion.length = 0; + this._dragState.length = 0; for (var i = 0; i < 10; i++) { @@ -116550,13 +123223,21 @@ var InputPlugin = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('transitionstart', this.transitionIn, this); - eventEmitter.off('transitionout', this.transitionOut, this); - eventEmitter.off('transitioncomplete', this.transitionComplete, this); + eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + + if (this.manager.useQueue) + { + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + } + + this.manager.events.off(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.off(Events.GAME_OVER, this.onGameOver, this); + + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -116564,6 +123245,7 @@ var InputPlugin = new Class({ * We need to shutdown and then kill off all external references. * * @method Phaser.Input.InputPlugin#destroy + * @fires Phaser.Input.Events#DESTROY * @private * @since 3.0.0 */ @@ -116572,11 +123254,11 @@ var InputPlugin = new Class({ this.shutdown(); // Registered input plugins listen for this - this.pluginEvents.emit('destroy'); + this.pluginEvents.emit(Events.DESTROY); this.pluginEvents.removeAllListeners(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.cameras = null; @@ -116621,6 +123303,23 @@ var InputPlugin = new Class({ }, + /** + * Are any mouse or touch pointers currently over the game canvas? + * + * @name Phaser.Input.InputPlugin#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isOver: { + + get: function () + { + return this.manager.isOver; + } + + }, + /** * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` @@ -116845,12 +123544,12 @@ module.exports = InputPlugin; /***/ }), -/* 610 */ +/* 623 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -116896,12 +123595,12 @@ module.exports = { /***/ }), -/* 611 */ +/* 624 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -116935,12 +123634,12 @@ module.exports = { /***/ }), -/* 612 */ +/* 625 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -116985,12 +123684,12 @@ module.exports = { /***/ }), -/* 613 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117000,28 +123699,30 @@ module.exports = { module.exports = { - DUALSHOCK_4: __webpack_require__(612), - SNES_USB: __webpack_require__(611), - XBOX_360: __webpack_require__(610) + DUALSHOCK_4: __webpack_require__(625), + SNES_USB: __webpack_require__(624), + XBOX_360: __webpack_require__(623) }; /***/ }), -/* 614 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); -var Gamepad = __webpack_require__(257); +var Events = __webpack_require__(153); +var Gamepad = __webpack_require__(262); var GetValue = __webpack_require__(4); -var InputPluginCache = __webpack_require__(106); +var InputPluginCache = __webpack_require__(114); +var InputEvents = __webpack_require__(52); /** * @typedef {object} Pad @@ -117201,8 +123902,8 @@ var GamepadPlugin = new Class({ */ this._pad4; - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -117222,7 +123923,7 @@ var GamepadPlugin = new Class({ this.enabled = GetValue(settings, 'gamepad', config.inputGamepad) && game.device.input.gamepads; this.target = GetValue(settings, 'gamepad.target', config.inputGamepadEventTarget); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -117241,7 +123942,7 @@ var GamepadPlugin = new Class({ this.startListeners(); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -117295,7 +123996,7 @@ var GamepadPlugin = new Class({ // until more browsers support this // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); }, /** @@ -117311,7 +124012,7 @@ var GamepadPlugin = new Class({ this.target.removeEventListener('gamepadconnected', this.onGamepadHandler); this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); }, /** @@ -117458,6 +124159,8 @@ var GamepadPlugin = new Class({ * * @method Phaser.Input.Gamepad.GamepadPlugin#update * @private + * @fires Phaser.Input.Gamepad.Events#CONNECTED + * @fires Phaser.Input.Gamepad.Events#DISCONNECTED * @since 3.10.0 */ update: function () @@ -117486,11 +124189,11 @@ var GamepadPlugin = new Class({ if (event.type === 'gamepadconnected') { - this.emit('connected', pad, event); + this.emit(Events.CONNECTED, pad, event); } else if (event.type === 'gamepaddisconnected') { - this.emit('disconnected', pad, event); + this.emit(Events.DISCONNECTED, pad, event); } } }, @@ -117651,12 +124354,185 @@ module.exports = GamepadPlugin; /***/ }), -/* 615 */ +/* 628 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by a Gamepad instance when a button has been released on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('up', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP + * + * @param {integer} index - The index of the button that was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + */ +module.exports = 'up'; + + +/***/ }), +/* 629 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by a Gamepad instance when a button has been pressed on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('down', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * + * @param {integer} index - The index of the button that was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + */ +module.exports = 'down'; + + +/***/ }), +/* 630 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Disconnected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`. + * + * @event Phaser.Input.Gamepad.Events#DISCONNECTED + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was disconnected. + * @param {Event} event - The native DOM Event that triggered the disconnection. + */ +module.exports = 'disconnected'; + + +/***/ }), +/* 631 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Connected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`. + * + * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, + * this is for security reasons. However, it may also trust the page already, in which case you won't get the + * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads + * already connected. + * + * @event Phaser.Input.Gamepad.Events#CONNECTED + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was connected. + * @param {Event} event - The native DOM Event that triggered the connection. + */ +module.exports = 'connected'; + + +/***/ }), +/* 632 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`. + * + * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_UP + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was released. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'up'; + + +/***/ }), +/* 633 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`. + * + * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_DOWN + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was pressed. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'down'; + + +/***/ }), +/* 634 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117666,27 +124542,28 @@ module.exports = GamepadPlugin; module.exports = { - Axis: __webpack_require__(259), - Button: __webpack_require__(258), - Gamepad: __webpack_require__(257), - GamepadPlugin: __webpack_require__(614), + Axis: __webpack_require__(264), + Button: __webpack_require__(263), + Events: __webpack_require__(153), + Gamepad: __webpack_require__(262), + GamepadPlugin: __webpack_require__(627), - Configs: __webpack_require__(613) + Configs: __webpack_require__(626) }; /***/ }), -/* 616 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(337); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(341); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Input @@ -117694,15 +124571,16 @@ var Extend = __webpack_require__(20); var Input = { - CreateInteractiveObject: __webpack_require__(260), - Gamepad: __webpack_require__(615), - InputManager: __webpack_require__(338), - InputPlugin: __webpack_require__(609), - InputPluginCache: __webpack_require__(106), - Keyboard: __webpack_require__(607), - Mouse: __webpack_require__(595), - Pointer: __webpack_require__(335), - Touch: __webpack_require__(594) + CreateInteractiveObject: __webpack_require__(265), + Events: __webpack_require__(52), + Gamepad: __webpack_require__(634), + InputManager: __webpack_require__(342), + InputPlugin: __webpack_require__(622), + InputPluginCache: __webpack_require__(114), + Keyboard: __webpack_require__(620), + Mouse: __webpack_require__(603), + Pointer: __webpack_require__(338), + Touch: __webpack_require__(602) }; @@ -117713,30 +124591,30 @@ module.exports = Input; /***/ }), -/* 617 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(144); +var RotateAroundXY = __webpack_require__(154); /** - * [description] + * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. * * @function Phaser.Geom.Triangle.RotateAroundPoint * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} point - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {Phaser.Geom.Point} point - The Point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var RotateAroundPoint = function (triangle, point, angle) { @@ -117747,30 +124625,30 @@ module.exports = RotateAroundPoint; /***/ }), -/* 618 */ +/* 637 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(144); -var InCenter = __webpack_require__(261); +var RotateAroundXY = __webpack_require__(154); +var InCenter = __webpack_require__(266); /** - * [description] + * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. * * @function Phaser.Geom.Triangle.Rotate * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var Rotate = function (triangle, angle) { @@ -117783,16 +124661,16 @@ module.exports = Rotate; /***/ }), -/* 619 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); // The 2D area of a triangle. The area value is always non-negative. @@ -117819,12 +124697,12 @@ module.exports = Perimeter; /***/ }), -/* 620 */ +/* 639 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117855,12 +124733,12 @@ module.exports = Equals; /***/ }), -/* 621 */ +/* 640 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117886,27 +124764,27 @@ module.exports = CopyFrom; /***/ }), -/* 622 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(69); +var Contains = __webpack_require__(74); /** - * [description] + * Tests if a triangle contains a point. * * @function Phaser.Geom.Triangle.ContainsPoint * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Triangle} triangle - The triangle. + * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|any)} point - The point to test, or any point-like object with public `x` and `y` properties. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is within the triangle, otherwise `false`. */ var ContainsPoint = function (triangle, point) { @@ -117917,26 +124795,26 @@ module.exports = ContainsPoint; /***/ }), -/* 623 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); /** - * [description] + * Clones a Triangle object. * * @function Phaser.Geom.Triangle.Clone * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} source - [description] + * @param {Phaser.Geom.Triangle} source - The Triangle to clone. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} A new Triangle identical to the given one but separate from it. */ var Clone = function (source) { @@ -117947,31 +124825,31 @@ module.exports = Clone; /***/ }), -/* 624 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); +var Circle = __webpack_require__(77); // Adapted from https://gist.github.com/mutoo/5617691 /** - * [description] + * Finds the circumscribed circle (circumcircle) of a Triangle object. The circumcircle is the circle which touches all of the triangle's vertices. * * @function Phaser.Geom.Triangle.CircumCircle * @since 3.0.0 * * @generic {Phaser.Geom.Circle} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Circle} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use as input. + * @param {Phaser.Geom.Circle} [out] - An optional Circle to store the result in. * - * @return {Phaser.Geom.Circle} [description] + * @return {Phaser.Geom.Circle} The updated `out` Circle, or a new Circle if none was provided. */ var CircumCircle = function (triangle, out) { @@ -118030,12 +124908,12 @@ module.exports = CircumCircle; /***/ }), -/* 625 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118106,24 +124984,24 @@ module.exports = CircumCenter; /***/ }), -/* 626 */ +/* 645 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Centroid = __webpack_require__(263); -var Offset = __webpack_require__(262); +var Centroid = __webpack_require__(268); +var Offset = __webpack_require__(267); /** * @callback CenterFunction * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to return the center coordinates of. * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} The center point of the Triangle according to the function. */ /** @@ -118159,16 +125037,16 @@ module.exports = CenterOn; /***/ }), -/* 627 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); // 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) @@ -118208,17 +125086,17 @@ module.exports = BuildRight; /***/ }), -/* 628 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EarCut = __webpack_require__(64); -var Triangle = __webpack_require__(59); +var EarCut = __webpack_require__(71); +var Triangle = __webpack_require__(65); /** * [description] @@ -118283,16 +125161,16 @@ module.exports = BuildFromPolygon; /***/ }), -/* 629 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); /** * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). @@ -118327,26 +125205,26 @@ module.exports = BuildEquilateral; /***/ }), -/* 630 */ +/* 649 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // The 2D area of a triangle. The area value is always non-negative. /** - * [description] + * Returns the area of a Triangle. * * @function Phaser.Geom.Triangle.Area * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. * - * @return {number} [description] + * @return {number} The area of the Triangle, always non-negative. */ var Area = function (triangle) { @@ -118366,70 +125244,70 @@ module.exports = Area; /***/ }), -/* 631 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); -Triangle.Area = __webpack_require__(630); -Triangle.BuildEquilateral = __webpack_require__(629); -Triangle.BuildFromPolygon = __webpack_require__(628); -Triangle.BuildRight = __webpack_require__(627); -Triangle.CenterOn = __webpack_require__(626); -Triangle.Centroid = __webpack_require__(263); -Triangle.CircumCenter = __webpack_require__(625); -Triangle.CircumCircle = __webpack_require__(624); -Triangle.Clone = __webpack_require__(623); -Triangle.Contains = __webpack_require__(69); -Triangle.ContainsArray = __webpack_require__(147); -Triangle.ContainsPoint = __webpack_require__(622); -Triangle.CopyFrom = __webpack_require__(621); -Triangle.Decompose = __webpack_require__(269); -Triangle.Equals = __webpack_require__(620); -Triangle.GetPoint = __webpack_require__(278); -Triangle.GetPoints = __webpack_require__(277); -Triangle.InCenter = __webpack_require__(261); -Triangle.Perimeter = __webpack_require__(619); -Triangle.Offset = __webpack_require__(262); -Triangle.Random = __webpack_require__(184); -Triangle.Rotate = __webpack_require__(618); -Triangle.RotateAroundPoint = __webpack_require__(617); -Triangle.RotateAroundXY = __webpack_require__(144); +Triangle.Area = __webpack_require__(649); +Triangle.BuildEquilateral = __webpack_require__(648); +Triangle.BuildFromPolygon = __webpack_require__(647); +Triangle.BuildRight = __webpack_require__(646); +Triangle.CenterOn = __webpack_require__(645); +Triangle.Centroid = __webpack_require__(268); +Triangle.CircumCenter = __webpack_require__(644); +Triangle.CircumCircle = __webpack_require__(643); +Triangle.Clone = __webpack_require__(642); +Triangle.Contains = __webpack_require__(74); +Triangle.ContainsArray = __webpack_require__(157); +Triangle.ContainsPoint = __webpack_require__(641); +Triangle.CopyFrom = __webpack_require__(640); +Triangle.Decompose = __webpack_require__(274); +Triangle.Equals = __webpack_require__(639); +Triangle.GetPoint = __webpack_require__(283); +Triangle.GetPoints = __webpack_require__(282); +Triangle.InCenter = __webpack_require__(266); +Triangle.Perimeter = __webpack_require__(638); +Triangle.Offset = __webpack_require__(267); +Triangle.Random = __webpack_require__(198); +Triangle.Rotate = __webpack_require__(637); +Triangle.RotateAroundPoint = __webpack_require__(636); +Triangle.RotateAroundXY = __webpack_require__(154); module.exports = Triangle; /***/ }), -/* 632 */ +/* 651 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // Scales the width and height of this Rectangle by the given amounts. /** - * [description] + * Scales the width and height of this Rectangle by the given amounts. * * @function Phaser.Geom.Rectangle.Scale * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The `Rectangle` object that will be scaled by the specified amount(s). + * @param {number} x - The factor by which to scale the rectangle horizontally. + * @param {number} y - The amount by which to scale the rectangle vertically. If this is not specified, the rectangle will be scaled by the factor `x` in both directions. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The rectangle object with updated `width` and `height` properties as calculated from the scaling factor(s). */ var Scale = function (rect, x, y) { @@ -118445,12 +125323,12 @@ module.exports = Scale; /***/ }), -/* 633 */ +/* 652 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118474,17 +125352,17 @@ module.exports = SameDimensions; /***/ }), -/* 634 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Between = __webpack_require__(170); -var ContainsRect = __webpack_require__(264); +var Between = __webpack_require__(184); +var ContainsRect = __webpack_require__(269); var Point = __webpack_require__(6); /** @@ -118545,17 +125423,17 @@ module.exports = RandomOutside; /***/ }), -/* 635 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var DegToRad = __webpack_require__(31); +var DegToRad = __webpack_require__(34); /** * [description] @@ -118602,25 +125480,25 @@ module.exports = PerimeterPoint; /***/ }), -/* 636 */ +/* 655 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if two Rectangles overlap. If a Rectangle is within another Rectangle, the two will be considered overlapping. Thus, the Rectangles are treated as "solid". * * @function Phaser.Geom.Rectangle.Overlaps * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the two Rectangles overlap, `false` otherwise. */ var Overlaps = function (rectA, rectB) { @@ -118636,12 +125514,12 @@ module.exports = Overlaps; /***/ }), -/* 637 */ +/* 656 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118670,12 +125548,12 @@ module.exports = OffsetPoint; /***/ }), -/* 638 */ +/* 657 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118705,12 +125583,12 @@ module.exports = Offset; /***/ }), -/* 639 */ +/* 658 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118749,12 +125627,12 @@ module.exports = MergeXY; /***/ }), -/* 640 */ +/* 659 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118796,12 +125674,12 @@ module.exports = MergeRect; /***/ }), -/* 641 */ +/* 660 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118845,17 +125723,17 @@ module.exports = MergePoints; /***/ }), -/* 642 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); -var Intersects = __webpack_require__(148); +var Rectangle = __webpack_require__(10); +var Intersects = __webpack_require__(158); /** * Takes two Rectangles and first checks to see if they intersect. @@ -118896,34 +125774,33 @@ module.exports = Intersection; /***/ }), -/* 643 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(175); +var CenterOn = __webpack_require__(189); -// 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 -// to the left and right by the x value, and to the top and the bottom by the y value. /** - * [description] + * Increases the size of a Rectangle by a specified amount. + * + * The center of the Rectangle stays the same. The amounts are added to each side, so the actual increase in width or height is two times bigger than the respective argument. * * @function Phaser.Geom.Rectangle.Inflate * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to inflate. + * @param {number} x - How many pixels the left and the right side should be moved by horizontally. + * @param {number} y - How many pixels the top and the bottom side should be moved by vertically. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The inflated Rectangle. */ var Inflate = function (rect, x, y) { @@ -118939,12 +125816,12 @@ module.exports = Inflate; /***/ }), -/* 644 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118980,12 +125857,12 @@ module.exports = GetSize; /***/ }), -/* 645 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119018,12 +125895,12 @@ module.exports = GetCenter; /***/ }), -/* 646 */ +/* 665 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119053,26 +125930,26 @@ module.exports = FloorAll; /***/ }), -/* 647 */ +/* 666 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rounds down (floors) the top left X and Y co-ordinates of the given Rectangle to the largest integer less than or equal to them * * @function Phaser.Geom.Rectangle.Floor * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle to floor the top left X and Y co-ordinates of * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The rectangle that was passed to this function with its co-ordinates floored. */ var Floor = function (rect) { @@ -119086,33 +125963,33 @@ module.exports = Floor; /***/ }), -/* 648 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(145); - -// Fits the target rectangle around the source rectangle. -// Preserves aspect ration. -// Scales and centers the target rectangle to the source rectangle +var GetAspectRatio = __webpack_require__(155); /** - * [description] + * Adjusts the target rectangle, changing its width, height and position, + * so that it fully covers the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitInside` function, the target rectangle may extend further out than the source. * * @function Phaser.Geom.Rectangle.FitOutside * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @param {Phaser.Geom.Rectangle} target - [description] - * @param {Phaser.Geom.Rectangle} source - [description] + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envlope the target in. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ var FitOutside = function (target, source) { @@ -119139,33 +126016,33 @@ module.exports = FitOutside; /***/ }), -/* 649 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(145); - -// Fits the target rectangle into the source rectangle. -// Preserves aspect ratio. -// Scales and centers the target rectangle to the source rectangle +var GetAspectRatio = __webpack_require__(155); /** - * [description] + * Adjusts the target rectangle, changing its width, height and position, + * so that it fits inside the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitOutside` function, there may be some space inside the source area not covered. * * @function Phaser.Geom.Rectangle.FitInside * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @param {Phaser.Geom.Rectangle} target - [description] - * @param {Phaser.Geom.Rectangle} source - [description] + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envlope the target in. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ var FitInside = function (target, source) { @@ -119192,25 +126069,25 @@ module.exports = FitInside; /***/ }), -/* 650 */ +/* 669 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Compares the `x`, `y`, `width` and `height` properties of two rectangles. * * @function Phaser.Geom.Rectangle.Equals * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {Phaser.Geom.Rectangle} toCompare - [description] + * @param {Phaser.Geom.Rectangle} rect - Rectangle A + * @param {Phaser.Geom.Rectangle} toCompare - Rectangle B * - * @return {boolean} [description] + * @return {boolean} `true` if the rectangles' properties are an exact match, otherwise `false`. */ var Equals = function (rect, toCompare) { @@ -119226,12 +126103,12 @@ module.exports = Equals; /***/ }), -/* 651 */ +/* 670 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119257,16 +126134,16 @@ module.exports = CopyFrom; /***/ }), -/* 652 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(39); +var Contains = __webpack_require__(42); /** * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. @@ -119288,16 +126165,16 @@ module.exports = ContainsPoint; /***/ }), -/* 653 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Creates a new Rectangle which is identical to the given one. @@ -119318,26 +126195,26 @@ module.exports = Clone; /***/ }), -/* 654 */ +/* 673 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rounds a Rectangle's position and size up to the smallest integer greater than or equal to each respective value. * * @function Phaser.Geom.Rectangle.CeilAll * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to modify. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified Rectangle. */ var CeilAll = function (rect) { @@ -119353,12 +126230,12 @@ module.exports = CeilAll; /***/ }), -/* 655 */ +/* 674 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119386,24 +126263,24 @@ module.exports = Ceil; /***/ }), -/* 656 */ +/* 675 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the area of the given Rectangle object. * * @function Phaser.Geom.Rectangle.Area * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle to calculate the area of. * - * @return {number} [description] + * @return {number} The area of the Rectangle object. */ var Area = function (rect) { @@ -119414,26 +126291,26 @@ module.exports = Area; /***/ }), -/* 657 */ +/* 676 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Reverses the order of the points of a Polygon. * * @function Phaser.Geom.Polygon.Reverse * @since 3.0.0 * * @generic {Phaser.Geom.Polygon} O - [polygon,$return] * - * @param {Phaser.Geom.Polygon} polygon - [description] + * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. * - * @return {Phaser.Geom.Polygon} [description] + * @return {Phaser.Geom.Polygon} The modified Polygon. */ var Reverse = function (polygon) { @@ -119446,12 +126323,12 @@ module.exports = Reverse; /***/ }), -/* 658 */ +/* 677 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119489,16 +126366,16 @@ module.exports = GetNumberArray; /***/ }), -/* 659 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(150); +var Contains = __webpack_require__(160); /** * [description] @@ -119520,26 +126397,26 @@ module.exports = ContainsPoint; /***/ }), -/* 660 */ +/* 679 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(151); +var Polygon = __webpack_require__(161); /** - * [description] + * Create a new polygon which is a copy of the specified polygon * * @function Phaser.Geom.Polygon.Clone * @since 3.0.0 * - * @param {Phaser.Geom.Polygon} polygon - [description] + * @param {Phaser.Geom.Polygon} polygon - The polygon to create a clone of * - * @return {Phaser.Geom.Polygon} [description] + * @return {Phaser.Geom.Polygon} A new separate Polygon cloned from the specified polygon, based on the same points. */ var Clone = function (polygon) { @@ -119550,54 +126427,54 @@ module.exports = Clone; /***/ }), -/* 661 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(151); +var Polygon = __webpack_require__(161); -Polygon.Clone = __webpack_require__(660); -Polygon.Contains = __webpack_require__(150); -Polygon.ContainsPoint = __webpack_require__(659); -Polygon.GetAABB = __webpack_require__(285); -Polygon.GetNumberArray = __webpack_require__(658); -Polygon.GetPoints = __webpack_require__(284); -Polygon.Perimeter = __webpack_require__(283); -Polygon.Reverse = __webpack_require__(657); -Polygon.Smooth = __webpack_require__(282); +Polygon.Clone = __webpack_require__(679); +Polygon.Contains = __webpack_require__(160); +Polygon.ContainsPoint = __webpack_require__(678); +Polygon.GetAABB = __webpack_require__(290); +Polygon.GetNumberArray = __webpack_require__(677); +Polygon.GetPoints = __webpack_require__(289); +Polygon.Perimeter = __webpack_require__(288); +Polygon.Reverse = __webpack_require__(676); +Polygon.Smooth = __webpack_require__(287); module.exports = Polygon; /***/ }), -/* 662 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetMagnitude = __webpack_require__(267); +var GetMagnitude = __webpack_require__(272); /** - * [description] + * Changes the magnitude (length) of a two-dimensional vector without changing its direction. * * @function Phaser.Geom.Point.SetMagnitude * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [point,$return] * - * @param {Phaser.Geom.Point} point - [description] - * @param {number} magnitude - [description] + * @param {Phaser.Geom.Point} point - The Point to treat as the end point of the vector. + * @param {number} magnitude - The new magnitude of the vector. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The modified Point. */ var SetMagnitude = function (point, magnitude) { @@ -119619,12 +126496,12 @@ module.exports = SetMagnitude; /***/ }), -/* 663 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119663,17 +126540,17 @@ module.exports = ProjectUnit; /***/ }), -/* 664 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var GetMagnitudeSq = __webpack_require__(266); +var GetMagnitudeSq = __webpack_require__(271); /** * [description] @@ -119709,29 +126586,29 @@ module.exports = Project; /***/ }), -/* 665 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * [description] + * Inverts a Point's coordinates. * * @function Phaser.Geom.Point.Negative * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Point} point - The Point to invert. + * @param {Phaser.Geom.Point} [out] - The Point to return the inverted coordinates in. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The modified `out` Point, or a new Point if none was provided. */ var Negative = function (point, out) { @@ -119744,12 +126621,12 @@ module.exports = Negative; /***/ }), -/* 666 */ +/* 685 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119774,31 +126651,31 @@ module.exports = Invert; /***/ }), -/* 667 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * Interpolate two given Point objects, based on `t` value. Return result either as new Point if `out` parameter is omitted or load result into Point passed as `out` parameter and return it. For `out` parameter you can also use any object with public x/y properties. + * [description] * * @function Phaser.Geom.Point.Interpolate * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} pointA - [description] - * @param {Phaser.Geom.Point} pointB - [description] - * @param {number} [t=0] - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Point} pointA - The starting `Point` for the interpolation. + * @param {Phaser.Geom.Point} pointB - The target `Point` for the interpolation. + * @param {number} [t=0] - The amount to interpolate between the two points. Generally, a value between 0 (returns the starting `Point`) and 1 (returns the target `Point`). If omitted, 0 is used. + * @param {(Phaser.Geom.Point|object)} [out] - An optional `Point` object whose `x` and `y` values will be set to the result of the interpolation (can also be any object with `x` and `y` properties). If omitted, a new `Point` created and returned. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} Either the object from the `out` argument with the properties `x` and `y` set to the result of the interpolation or a newly created `Point` object. */ var Interpolate = function (pointA, pointB, t, out) { @@ -119815,16 +126692,16 @@ module.exports = Interpolate; /***/ }), -/* 668 */ +/* 687 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Calculates the Axis Aligned Bounding Box (or aabb) from an array of points. @@ -119885,19 +126762,20 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 669 */ +/* 688 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * [description] + * Get the centroid or geometric center of a plane figure (the arithmetic mean position of all the points in the figure). + * Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin. * * @function Phaser.Geom.Point.GetCentroid * @since 3.0.0 @@ -119948,12 +126826,12 @@ module.exports = GetCentroid; /***/ }), -/* 670 */ +/* 689 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119978,12 +126856,12 @@ module.exports = Floor; /***/ }), -/* 671 */ +/* 690 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120007,12 +126885,12 @@ module.exports = Equals; /***/ }), -/* 672 */ +/* 691 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120038,12 +126916,12 @@ module.exports = CopyFrom; /***/ }), -/* 673 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120068,12 +126946,12 @@ module.exports = Clone; /***/ }), -/* 674 */ +/* 693 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120098,43 +126976,43 @@ module.exports = Ceil; /***/ }), -/* 675 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -Point.Ceil = __webpack_require__(674); -Point.Clone = __webpack_require__(673); -Point.CopyFrom = __webpack_require__(672); -Point.Equals = __webpack_require__(671); -Point.Floor = __webpack_require__(670); -Point.GetCentroid = __webpack_require__(669); -Point.GetMagnitude = __webpack_require__(267); -Point.GetMagnitudeSq = __webpack_require__(266); -Point.GetRectangleFromPoints = __webpack_require__(668); -Point.Interpolate = __webpack_require__(667); -Point.Invert = __webpack_require__(666); -Point.Negative = __webpack_require__(665); -Point.Project = __webpack_require__(664); -Point.ProjectUnit = __webpack_require__(663); -Point.SetMagnitude = __webpack_require__(662); +Point.Ceil = __webpack_require__(693); +Point.Clone = __webpack_require__(692); +Point.CopyFrom = __webpack_require__(691); +Point.Equals = __webpack_require__(690); +Point.Floor = __webpack_require__(689); +Point.GetCentroid = __webpack_require__(688); +Point.GetMagnitude = __webpack_require__(272); +Point.GetMagnitudeSq = __webpack_require__(271); +Point.GetRectangleFromPoints = __webpack_require__(687); +Point.Interpolate = __webpack_require__(686); +Point.Invert = __webpack_require__(685); +Point.Negative = __webpack_require__(684); +Point.Project = __webpack_require__(683); +Point.ProjectUnit = __webpack_require__(682); +Point.SetMagnitude = __webpack_require__(681); module.exports = Point; /***/ }), -/* 676 */ +/* 695 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120157,12 +127035,12 @@ module.exports = Width; /***/ }), -/* 677 */ +/* 696 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120185,12 +127063,12 @@ module.exports = Slope; /***/ }), -/* 678 */ +/* 697 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120225,16 +127103,16 @@ module.exports = SetToAngle; /***/ }), -/* 679 */ +/* 698 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(146); +var RotateAroundXY = __webpack_require__(156); /** * Rotate a line around a point by the given angle in radians. @@ -120259,16 +127137,16 @@ module.exports = RotateAroundPoint; /***/ }), -/* 680 */ +/* 699 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(146); +var RotateAroundXY = __webpack_require__(156); /** * Rotate a line around its midpoint by the given angle in radians. @@ -120295,17 +127173,17 @@ module.exports = Rotate; /***/ }), -/* 681 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Angle = __webpack_require__(68); -var NormalAngle = __webpack_require__(268); +var Angle = __webpack_require__(73); +var NormalAngle = __webpack_require__(273); /** * Calculate the reflected angle between two lines. @@ -120329,12 +127207,12 @@ module.exports = ReflectAngle; /***/ }), -/* 682 */ +/* 701 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120357,12 +127235,12 @@ module.exports = PerpSlope; /***/ }), -/* 683 */ +/* 702 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120395,27 +127273,28 @@ module.exports = Offset; /***/ }), -/* 684 */ +/* 703 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(73); /** - * [description] + * The Y value of the normal of the given line. + * The normal of a line is a vector that points perpendicular from it. * * @function Phaser.Geom.Line.NormalY * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Line} line - The line to calculate the normal of. * - * @return {number} [description] + * @return {number} The Y value of the normal of the Line. */ var NormalY = function (line) { @@ -120426,17 +127305,17 @@ module.exports = NormalY; /***/ }), -/* 685 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(73); /** * [description] @@ -120457,12 +127336,12 @@ module.exports = NormalX; /***/ }), -/* 686 */ +/* 705 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120485,17 +127364,64 @@ module.exports = Height; /***/ }), -/* 687 */ +/* 706 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Get the shortest distance from a Line to the given Point. + * + * @function Phaser.Geom.Line.GetShortestDistance + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the distance from. + * @param {(Phaser.Geom.Point|object)} point - The point to get the shortest distance to. + * + * @return {number} The shortest distance from the line to the point. + */ +var GetShortestDistance = function (line, point) +{ + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return false; + } + + var s = (((y1 - point.y) * (x2 - x1)) - ((x1 - point.x) * (y2 - y1))) / L2; + + return Math.abs(s) * Math.sqrt(L2); +}; + +module.exports = GetShortestDistance; + + +/***/ }), +/* 707 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(73); var Point = __webpack_require__(6); /** @@ -120529,12 +127455,67 @@ module.exports = GetNormal; /***/ }), -/* 688 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Point = __webpack_require__(6); + +/** + * Get the nearest point on a line perpendicular to the given point. + * + * @function Phaser.Geom.Line.GetNearestPoint + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the nearest point on. + * @param {(Phaser.Geom.Point|object)} point - The point to get the nearest point to. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the nearest point on the line. + * + * @return {(Phaser.Geom.Point|object)} The nearest point on the line. + */ +var GetNearestPoint = function (line, point, out) +{ + if (out === undefined) { out = new Point(); } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return out; + } + + var r = (((point.x - x1) * (x2 - x1)) + ((point.y - y1) * (y2 - y1))) / L2; + + out.x = x1 + (r * (x2 - x1)); + out.y = y1 + (r * (y2 - y1)); + + return out; +}; + +module.exports = GetNearestPoint; + + +/***/ }), +/* 709 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120567,12 +127548,70 @@ module.exports = GetMidPoint; /***/ }), -/* 689 */ +/* 710 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Length = __webpack_require__(58); + +/** + * Extends the start and end points of a Line by the given amounts. + * + * The amounts can be positive or negative. Positive points will increase the length of the line, + * while negative ones will decrease it. + * + * If no `right` value is provided it will extend the length of the line equally in both directions. + * + * Pass a value of zero to leave the start or end point unchanged. + * + * @function Phaser.Geom.Line.Extend + * @since 3.16.0 + * + * @param {Phaser.Geom.Line} line - The line instance to extend. + * @param {number} left - The amount to extend the start of the line by. + * @param {number} [right] - The amount to extend the end of the line by. If not given it will be set to the `left` value. + * + * @return {Phaser.Geom.Line} The modified Line instance. + */ +var Extend = function (line, left, right) +{ + if (right === undefined) { right = left; } + + var length = Length(line); + + var slopX = line.x2 - line.x1; + var slopY = line.y2 - line.y1; + + if (left) + { + line.x1 = line.x1 - slopX / length * left; + line.y1 = line.y1 - slopY / length * left; + } + + if (right) + { + line.x2 = line.x2 + slopX / length * right; + line.y2 = line.y2 + slopY / length * right; + } + + return line; +}; + +module.exports = Extend; + + +/***/ }), +/* 711 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120601,12 +127640,12 @@ module.exports = Equals; /***/ }), -/* 690 */ +/* 712 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120632,16 +127671,16 @@ module.exports = CopyFrom; /***/ }), -/* 691 */ +/* 713 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(54); +var Line = __webpack_require__(59); /** * Clone the given line. @@ -120662,12 +127701,12 @@ module.exports = Clone; /***/ }), -/* 692 */ +/* 714 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120702,70 +127741,75 @@ module.exports = CenterOn; /***/ }), -/* 693 */ +/* 715 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(54); +var Line = __webpack_require__(59); -Line.Angle = __webpack_require__(68); -Line.BresenhamPoints = __webpack_require__(385); -Line.CenterOn = __webpack_require__(692); -Line.Clone = __webpack_require__(691); -Line.CopyFrom = __webpack_require__(690); -Line.Equals = __webpack_require__(689); -Line.GetMidPoint = __webpack_require__(688); -Line.GetNormal = __webpack_require__(687); -Line.GetPoint = __webpack_require__(397); -Line.GetPoints = __webpack_require__(189); -Line.Height = __webpack_require__(686); -Line.Length = __webpack_require__(65); -Line.NormalAngle = __webpack_require__(268); -Line.NormalX = __webpack_require__(685); -Line.NormalY = __webpack_require__(684); -Line.Offset = __webpack_require__(683); -Line.PerpSlope = __webpack_require__(682); -Line.Random = __webpack_require__(188); -Line.ReflectAngle = __webpack_require__(681); -Line.Rotate = __webpack_require__(680); -Line.RotateAroundPoint = __webpack_require__(679); -Line.RotateAroundXY = __webpack_require__(146); -Line.SetToAngle = __webpack_require__(678); -Line.Slope = __webpack_require__(677); -Line.Width = __webpack_require__(676); +Line.Angle = __webpack_require__(73); +Line.BresenhamPoints = __webpack_require__(416); +Line.CenterOn = __webpack_require__(714); +Line.Clone = __webpack_require__(713); +Line.CopyFrom = __webpack_require__(712); +Line.Equals = __webpack_require__(711); +Line.Extend = __webpack_require__(710); +Line.GetMidPoint = __webpack_require__(709); +Line.GetNearestPoint = __webpack_require__(708); +Line.GetNormal = __webpack_require__(707); +Line.GetPoint = __webpack_require__(429); +Line.GetPoints = __webpack_require__(203); +Line.GetShortestDistance = __webpack_require__(706); +Line.Height = __webpack_require__(705); +Line.Length = __webpack_require__(58); +Line.NormalAngle = __webpack_require__(273); +Line.NormalX = __webpack_require__(704); +Line.NormalY = __webpack_require__(703); +Line.Offset = __webpack_require__(702); +Line.PerpSlope = __webpack_require__(701); +Line.Random = __webpack_require__(202); +Line.ReflectAngle = __webpack_require__(700); +Line.Rotate = __webpack_require__(699); +Line.RotateAroundPoint = __webpack_require__(698); +Line.RotateAroundXY = __webpack_require__(156); +Line.SetToAngle = __webpack_require__(697); +Line.Slope = __webpack_require__(696); +Line.Width = __webpack_require__(695); module.exports = Line; /***/ }), -/* 694 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ContainsArray = __webpack_require__(147); -var Decompose = __webpack_require__(269); -var LineToLine = __webpack_require__(107); +var ContainsArray = __webpack_require__(157); +var Decompose = __webpack_require__(274); +var LineToLine = __webpack_require__(115); /** - * [description] + * Checks if two Triangles intersect. + * + * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". * * @function Phaser.Geom.Intersects.TriangleToTriangle * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangleA - [description] - * @param {Phaser.Geom.Triangle} triangleB - [description] + * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. + * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Triangles intersect, otherwise `false`. */ var TriangleToTriangle = function (triangleA, triangleB) { @@ -120831,17 +127875,17 @@ module.exports = TriangleToTriangle; /***/ }), -/* 695 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(69); -var LineToLine = __webpack_require__(107); +var Contains = __webpack_require__(74); +var LineToLine = __webpack_require__(115); /** * Checks if a Triangle and a Line intersect. @@ -120887,28 +127931,30 @@ module.exports = TriangleToLine; /***/ }), -/* 696 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToCircle = __webpack_require__(272); -var Contains = __webpack_require__(69); +var LineToCircle = __webpack_require__(277); +var Contains = __webpack_require__(74); /** - * [description] + * Checks if a Triangle and a Circle intersect. + * + * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. * * @function Phaser.Geom.Intersects.TriangleToCircle * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Circle} circle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. + * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Triangle and the `Circle` intersect, otherwise `false`. */ var TriangleToCircle = function (triangle, circle) { @@ -120950,29 +127996,29 @@ module.exports = TriangleToCircle; /***/ }), -/* 697 */ +/* 719 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Check if rectangle intersects with values. * * @function Phaser.Geom.Intersects.RectangleToValues * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} left - [description] - * @param {number} right - [description] - * @param {number} top - [description] - * @param {number} bottom - [description] - * @param {number} [tolerance=0] - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle object + * @param {number} left - The x coordinate of the left of the Rectangle. + * @param {number} right - The x coordinate of the right of the Rectangle. + * @param {number} top - The y coordinate of the top of the Rectangle. + * @param {number} bottom - The y coordinate of the bottom of the Rectangle. + * @param {number} [tolerance=0] - Tolerance allowed in the calculation, expressed in pixels. * - * @return {boolean} [description] + * @return {boolean} Returns true if there is an intersection. */ var RectangleToValues = function (rect, left, right, top, bottom, tolerance) { @@ -120990,19 +128036,19 @@ module.exports = RectangleToValues; /***/ }), -/* 698 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToLine = __webpack_require__(107); -var Contains = __webpack_require__(39); -var ContainsArray = __webpack_require__(147); -var Decompose = __webpack_require__(270); +var LineToLine = __webpack_require__(115); +var Contains = __webpack_require__(42); +var ContainsArray = __webpack_require__(157); +var Decompose = __webpack_require__(275); /** * Checks for intersection between Rectangle shape and Triangle shape. @@ -121083,27 +128129,27 @@ module.exports = RectangleToTriangle; /***/ }), -/* 699 */ +/* 721 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PointToLine = __webpack_require__(271); +var PointToLine = __webpack_require__(276); /** - * [description] + * Checks if a Point is located on the given line segment. * * @function Phaser.Geom.Intersects.PointToLineSegment * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Point} point - The Point to check for intersection. + * @param {Phaser.Geom.Line} line - The line segment to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point is on the given line segment, otherwise `false`. */ var PointToLineSegment = function (point, line) { @@ -121124,12 +128170,12 @@ module.exports = PointToLineSegment; /***/ }), -/* 700 */ +/* 722 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121147,10 +128193,10 @@ module.exports = PointToLineSegment; * @function Phaser.Geom.Intersects.LineToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] - * @param {(Phaser.Geom.Rectangle|object)} rect - [description] + * @param {Phaser.Geom.Line} line - The Line to check for intersection. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Line and the Rectangle intersect, `false` otherwise. */ var LineToRectangle = function (line, rect) { @@ -121225,17 +128271,17 @@ module.exports = LineToRectangle; /***/ }), -/* 701 */ +/* 723 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); -var RectangleToRectangle = __webpack_require__(148); +var Rectangle = __webpack_require__(10); +var RectangleToRectangle = __webpack_require__(158); /** * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. @@ -121274,25 +128320,25 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 702 */ +/* 724 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks for intersection between a circle and a rectangle. * * @function Phaser.Geom.Intersects.CircleToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Circle} circle - [description] - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Circle} circle - The circle to be checked. + * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. * - * @return {boolean} [description] + * @return {boolean} `true` if the two objects intersect, otherwise `false`. */ var CircleToRectangle = function (circle, rect) { @@ -121328,16 +128374,16 @@ module.exports = CircleToRectangle; /***/ }), -/* 703 */ +/* 725 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DistanceBetween = __webpack_require__(52); +var DistanceBetween = __webpack_require__(56); /** * Checks if two Circles intersect. @@ -121359,12 +128405,12 @@ module.exports = CircleToCircle; /***/ }), -/* 704 */ +/* 726 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121393,12 +128439,12 @@ module.exports = OffsetPoint; /***/ }), -/* 705 */ +/* 727 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121428,16 +128474,16 @@ module.exports = Offset; /***/ }), -/* 706 */ +/* 728 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Returns the bounds of the Ellipse object. @@ -121468,12 +128514,12 @@ module.exports = GetBounds; /***/ }), -/* 707 */ +/* 729 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121503,12 +128549,12 @@ module.exports = Equals; /***/ }), -/* 708 */ +/* 730 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121535,16 +128581,16 @@ module.exports = CopyFrom; /***/ }), -/* 709 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(89); +var Contains = __webpack_require__(95); /** * Check to see if the Ellipse contains all four points of the given Rectangle object. @@ -121571,16 +128617,16 @@ module.exports = ContainsRect; /***/ }), -/* 710 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(89); +var Contains = __webpack_require__(95); /** * Check to see if the Ellipse contains the given Point object. @@ -121602,16 +128648,16 @@ module.exports = ContainsPoint; /***/ }), -/* 711 */ +/* 733 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(90); +var Ellipse = __webpack_require__(96); /** * Creates a new Ellipse instance based on the values contained in the given source. @@ -121632,12 +128678,12 @@ module.exports = Clone; /***/ }), -/* 712 */ +/* 734 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121666,43 +128712,43 @@ module.exports = Area; /***/ }), -/* 713 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(90); +var Ellipse = __webpack_require__(96); -Ellipse.Area = __webpack_require__(712); -Ellipse.Circumference = __webpack_require__(306); -Ellipse.CircumferencePoint = __webpack_require__(156); -Ellipse.Clone = __webpack_require__(711); -Ellipse.Contains = __webpack_require__(89); -Ellipse.ContainsPoint = __webpack_require__(710); -Ellipse.ContainsRect = __webpack_require__(709); -Ellipse.CopyFrom = __webpack_require__(708); -Ellipse.Equals = __webpack_require__(707); -Ellipse.GetBounds = __webpack_require__(706); -Ellipse.GetPoint = __webpack_require__(308); -Ellipse.GetPoints = __webpack_require__(307); -Ellipse.Offset = __webpack_require__(705); -Ellipse.OffsetPoint = __webpack_require__(704); -Ellipse.Random = __webpack_require__(185); +Ellipse.Area = __webpack_require__(734); +Ellipse.Circumference = __webpack_require__(309); +Ellipse.CircumferencePoint = __webpack_require__(166); +Ellipse.Clone = __webpack_require__(733); +Ellipse.Contains = __webpack_require__(95); +Ellipse.ContainsPoint = __webpack_require__(732); +Ellipse.ContainsRect = __webpack_require__(731); +Ellipse.CopyFrom = __webpack_require__(730); +Ellipse.Equals = __webpack_require__(729); +Ellipse.GetBounds = __webpack_require__(728); +Ellipse.GetPoint = __webpack_require__(311); +Ellipse.GetPoints = __webpack_require__(310); +Ellipse.Offset = __webpack_require__(727); +Ellipse.OffsetPoint = __webpack_require__(726); +Ellipse.Random = __webpack_require__(199); module.exports = Ellipse; /***/ }), -/* 714 */ +/* 736 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121731,12 +128777,12 @@ module.exports = OffsetPoint; /***/ }), -/* 715 */ +/* 737 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121766,16 +128812,16 @@ module.exports = Offset; /***/ }), -/* 716 */ +/* 738 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Returns the bounds of the Circle object. @@ -121806,12 +128852,12 @@ module.exports = GetBounds; /***/ }), -/* 717 */ +/* 739 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121840,12 +128886,12 @@ module.exports = Equals; /***/ }), -/* 718 */ +/* 740 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121872,16 +128918,16 @@ module.exports = CopyFrom; /***/ }), -/* 719 */ +/* 741 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(40); +var Contains = __webpack_require__(43); /** * Check to see if the Circle contains all four points of the given Rectangle object. @@ -121908,16 +128954,16 @@ module.exports = ContainsRect; /***/ }), -/* 720 */ +/* 742 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(40); +var Contains = __webpack_require__(43); /** * Check to see if the Circle contains the given Point object. @@ -121939,16 +128985,16 @@ module.exports = ContainsPoint; /***/ }), -/* 721 */ +/* 743 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); +var Circle = __webpack_require__(77); /** * Creates a new Circle instance based on the values contained in the given source. @@ -121969,12 +129015,12 @@ module.exports = Clone; /***/ }), -/* 722 */ +/* 744 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121997,49 +129043,50 @@ module.exports = Area; /***/ }), -/* 723 */ +/* 745 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); +var Circle = __webpack_require__(77); -Circle.Area = __webpack_require__(722); -Circle.Circumference = __webpack_require__(402); -Circle.CircumferencePoint = __webpack_require__(192); -Circle.Clone = __webpack_require__(721); -Circle.Contains = __webpack_require__(40); -Circle.ContainsPoint = __webpack_require__(720); -Circle.ContainsRect = __webpack_require__(719); -Circle.CopyFrom = __webpack_require__(718); -Circle.Equals = __webpack_require__(717); -Circle.GetBounds = __webpack_require__(716); -Circle.GetPoint = __webpack_require__(405); -Circle.GetPoints = __webpack_require__(403); -Circle.Offset = __webpack_require__(715); -Circle.OffsetPoint = __webpack_require__(714); -Circle.Random = __webpack_require__(191); +Circle.Area = __webpack_require__(744); +Circle.Circumference = __webpack_require__(436); +Circle.CircumferencePoint = __webpack_require__(207); +Circle.Clone = __webpack_require__(743); +Circle.Contains = __webpack_require__(43); +Circle.ContainsPoint = __webpack_require__(742); +Circle.ContainsRect = __webpack_require__(741); +Circle.CopyFrom = __webpack_require__(740); +Circle.Equals = __webpack_require__(739); +Circle.GetBounds = __webpack_require__(738); +Circle.GetPoint = __webpack_require__(438); +Circle.GetPoints = __webpack_require__(437); +Circle.Offset = __webpack_require__(737); +Circle.OffsetPoint = __webpack_require__(736); +Circle.Random = __webpack_require__(206); module.exports = Circle; /***/ }), -/* 724 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(275); -var PluginCache = __webpack_require__(15); +var LightsManager = __webpack_require__(280); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -122099,7 +129146,7 @@ var LightsPlugin = new Class({ if (!scene.sys.settings.isBooted) { - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); } LightsManager.call(this); @@ -122115,8 +129162,8 @@ var LightsPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); + eventEmitter.on(SceneEvents.SHUTDOWN, this.shutdown, this); + eventEmitter.on(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -122143,19 +129190,19 @@ module.exports = LightsPlugin; /***/ }), -/* 725 */ +/* 747 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Quad = __webpack_require__(149); +var Quad = __webpack_require__(159); /** * Creates a new Quad Game Object and returns it. @@ -122193,20 +129240,20 @@ GameObjectCreator.register('quad', function (config, addToScene) /***/ }), -/* 726 */ +/* 748 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); var GetValue = __webpack_require__(4); -var Mesh = __webpack_require__(108); +var Mesh = __webpack_require__(116); /** * Creates a new Mesh Game Object and returns it. @@ -122248,16 +129295,16 @@ GameObjectCreator.register('mesh', function (config, addToScene) /***/ }), -/* 727 */ +/* 749 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Quad = __webpack_require__(149); +var Quad = __webpack_require__(159); var GameObjectFactory = __webpack_require__(5); /** @@ -122294,16 +129341,16 @@ if (true) /***/ }), -/* 728 */ +/* 750 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Mesh = __webpack_require__(108); +var Mesh = __webpack_require__(116); var GameObjectFactory = __webpack_require__(5); /** @@ -122344,12 +129391,12 @@ if (true) /***/ }), -/* 729 */ +/* 751 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122373,16 +129420,16 @@ module.exports = MeshCanvasRenderer; /***/ }), -/* 730 */ +/* 752 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -122445,7 +129492,7 @@ var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera var meshVerticesLength = vertices.length; var vertexCount = Math.floor(meshVerticesLength * 0.5); - if (pipeline.vertexCount + vertexCount >= pipeline.vertexCapacity) + if (pipeline.vertexCount + vertexCount > pipeline.vertexCapacity) { pipeline.flush(); } @@ -122470,8 +129517,8 @@ var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (camera.roundPixels) { - tx |= 0; - ty |= 0; + tx = Math.round(tx); + ty = Math.round(ty); } vertexViewF32[++vertexOffset] = tx; @@ -122491,12 +129538,12 @@ module.exports = MeshWebGLRenderer; /***/ }), -/* 731 */ +/* 753 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122505,12 +129552,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(730); + renderWebGL = __webpack_require__(752); } if (true) { - renderCanvas = __webpack_require__(729); + renderCanvas = __webpack_require__(751); } module.exports = { @@ -122522,18 +129569,18 @@ module.exports = { /***/ }), -/* 732 */ +/* 754 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Zone = __webpack_require__(125); +var Zone = __webpack_require__(137); /** * Creates a new Zone Game Object and returns it. @@ -122561,19 +129608,19 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 733 */ +/* 755 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var TileSprite = __webpack_require__(152); +var TileSprite = __webpack_require__(162); /** * @typedef {object} TileSprite @@ -122627,19 +129674,19 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) /***/ }), -/* 734 */ +/* 756 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Text = __webpack_require__(153); +var Text = __webpack_require__(163); /** * Creates a new Text Game Object and returns it. @@ -122714,18 +129761,18 @@ GameObjectCreator.register('text', function (config, addToScene) /***/ }), -/* 735 */ +/* 757 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(109); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BitmapText = __webpack_require__(117); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); var GetValue = __webpack_require__(4); @@ -122767,20 +129814,20 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) /***/ }), -/* 736 */ +/* 758 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var BuildGameObjectAnimation = __webpack_require__(311); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var BuildGameObjectAnimation = __webpack_require__(315); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Sprite = __webpack_require__(61); +var Sprite = __webpack_require__(67); /** * @typedef {object} SpriteConfig @@ -122828,19 +129875,19 @@ GameObjectCreator.register('sprite', function (config, addToScene) /***/ }), -/* 737 */ +/* 759 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var RenderTexture = __webpack_require__(154); +var RenderTexture = __webpack_require__(164); /** * @typedef {object} RenderTextureConfig @@ -122887,19 +129934,19 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) /***/ }), -/* 738 */ +/* 760 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); var GetFastValue = __webpack_require__(2); -var ParticleEmitterManager = __webpack_require__(155); +var ParticleEmitterManager = __webpack_require__(165); /** * Creates a new Particle Emitter Manager Game Object and returns it. @@ -122944,19 +129991,19 @@ GameObjectCreator.register('particles', function (config, addToScene) /***/ }), -/* 739 */ +/* 761 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Image = __webpack_require__(87); +var Image = __webpack_require__(93); /** * Creates a new Image Game Object and returns it. @@ -122994,17 +130041,17 @@ GameObjectCreator.register('image', function (config, addToScene) /***/ }), -/* 740 */ +/* 762 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); -var Group = __webpack_require__(88); +var GameObjectCreator = __webpack_require__(14); +var Group = __webpack_require__(94); /** * Creates a new Group Game Object and returns it. @@ -123014,7 +130061,7 @@ var Group = __webpack_require__(88); * @method Phaser.GameObjects.GameObjectCreator#group * @since 3.0.0 * - * @param {GroupConfig} config - The configuration object this Game Object will use to create itself. + * @param {GroupConfig|GroupCreateConfig} config - The configuration object this Game Object will use to create itself. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ @@ -123027,17 +130074,17 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 741 */ +/* 763 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); -var Graphics = __webpack_require__(158); +var GameObjectCreator = __webpack_require__(14); +var Graphics = __webpack_require__(168); /** * Creates a new Graphics Game Object and returns it. @@ -123075,18 +130122,18 @@ GameObjectCreator.register('graphics', function (config, addToScene) /***/ }), -/* 742 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(159); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BitmapText = __webpack_require__(169); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); /** @@ -123135,19 +130182,19 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) /***/ }), -/* 743 */ +/* 765 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var Container = __webpack_require__(160); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var Container = __webpack_require__(170); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); /** @@ -123184,18 +130231,18 @@ GameObjectCreator.register('container', function (config, addToScene) /***/ }), -/* 744 */ +/* 766 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Blitter = __webpack_require__(161); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var Blitter = __webpack_require__(171); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); /** @@ -123234,17 +130281,17 @@ GameObjectCreator.register('blitter', function (config, addToScene) /***/ }), -/* 745 */ +/* 767 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Triangle = __webpack_require__(279); +var Triangle = __webpack_require__(284); /** * Creates a new Triangle Shape Game Object and adds it to the Scene. @@ -123285,16 +130332,16 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f /***/ }), -/* 746 */ +/* 768 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Star = __webpack_require__(280); +var Star = __webpack_require__(285); var GameObjectFactory = __webpack_require__(5); /** @@ -123337,17 +130384,17 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad /***/ }), -/* 747 */ +/* 769 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Rectangle = __webpack_require__(281); +var Rectangle = __webpack_require__(286); /** * Creates a new Rectangle Shape Game Object and adds it to the Scene. @@ -123382,17 +130429,17 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor /***/ }), -/* 748 */ +/* 770 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Polygon = __webpack_require__(286); +var Polygon = __webpack_require__(291); /** * Creates a new Polygon Shape Game Object and adds it to the Scene. @@ -123435,17 +130482,17 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp /***/ }), -/* 749 */ +/* 771 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Line = __webpack_require__(287); +var Line = __webpack_require__(292); /** * Creates a new Line Shape Game Object and adds it to the Scene. @@ -123486,17 +130533,17 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, /***/ }), -/* 750 */ +/* 772 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var IsoTriangle = __webpack_require__(288); +var IsoTriangle = __webpack_require__(293); /** * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. @@ -123539,17 +130586,17 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed /***/ }), -/* 751 */ +/* 773 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var IsoBox = __webpack_require__(289); +var IsoBox = __webpack_require__(294); /** * Creates a new IsoBox Shape Game Object and adds it to the Scene. @@ -123590,17 +130637,17 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill /***/ }), -/* 752 */ +/* 774 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Grid = __webpack_require__(290); +var Grid = __webpack_require__(295); /** * Creates a new Grid Shape Game Object and adds it to the Scene. @@ -123645,16 +130692,16 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel /***/ }), -/* 753 */ +/* 775 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(291); +var Ellipse = __webpack_require__(296); var GameObjectFactory = __webpack_require__(5); /** @@ -123697,17 +130744,17 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, /***/ }), -/* 754 */ +/* 776 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Curve = __webpack_require__(292); +var Curve = __webpack_require__(297); /** * Creates a new Curve Shape Game Object and adds it to the Scene. @@ -123747,16 +130794,16 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) /***/ }), -/* 755 */ +/* 777 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arc = __webpack_require__(293); +var Arc = __webpack_require__(298); var GameObjectFactory = __webpack_require__(5); /** @@ -123820,16 +130867,16 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph /***/ }), -/* 756 */ +/* 778 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Zone = __webpack_require__(125); +var Zone = __webpack_require__(137); var GameObjectFactory = __webpack_require__(5); /** @@ -123862,16 +130909,16 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 757 */ +/* 779 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileSprite = __webpack_require__(152); +var TileSprite = __webpack_require__(162); var GameObjectFactory = __webpack_require__(5); /** @@ -123906,16 +130953,16 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 758 */ +/* 780 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Text = __webpack_require__(153); +var Text = __webpack_require__(163); var GameObjectFactory = __webpack_require__(5); /** @@ -123971,16 +131018,16 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 759 */ +/* 781 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(109); +var BitmapText = __webpack_require__(117); var GameObjectFactory = __webpack_require__(5); /** @@ -124035,17 +131082,17 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align /***/ }), -/* 760 */ +/* 782 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Sprite = __webpack_require__(61); +var Sprite = __webpack_require__(67); /** * Creates a new Sprite Game Object and adds it to the Scene. @@ -124082,17 +131129,17 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 761 */ +/* 783 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var RenderTexture = __webpack_require__(154); +var RenderTexture = __webpack_require__(164); /** * Creates a new Render Texture Game Object and adds it to the Scene. @@ -124120,17 +131167,17 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height) /***/ }), -/* 762 */ +/* 784 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var PathFollower = __webpack_require__(296); +var PathFollower = __webpack_require__(300); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -124168,17 +131215,17 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 763 */ +/* 785 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var ParticleEmitterManager = __webpack_require__(155); +var ParticleEmitterManager = __webpack_require__(165); /** * Creates a new Particle Emitter Manager Game Object and adds it to the Scene. @@ -124214,16 +131261,16 @@ GameObjectFactory.register('particles', function (key, frame, emitters) /***/ }), -/* 764 */ +/* 786 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Image = __webpack_require__(87); +var Image = __webpack_require__(93); var GameObjectFactory = __webpack_require__(5); /** @@ -124256,16 +131303,16 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 765 */ +/* 787 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Group = __webpack_require__(88); +var Group = __webpack_require__(94); var GameObjectFactory = __webpack_require__(5); /** @@ -124277,7 +131324,7 @@ var GameObjectFactory = __webpack_require__(5); * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument. - * @param {GroupConfig} [config] - A Group Configuration object. + * @param {GroupConfig|GroupCreateConfig} [config] - A Group Configuration object. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ @@ -124288,16 +131335,16 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 766 */ +/* 788 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Graphics = __webpack_require__(158); +var Graphics = __webpack_require__(168); var GameObjectFactory = __webpack_require__(5); /** @@ -124327,16 +131374,58 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 767 */ +/* 789 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DynamicBitmapText = __webpack_require__(159); +var Extern = __webpack_require__(312); +var GameObjectFactory = __webpack_require__(5); + +/** + * Creates a new Extern Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Extern Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#extern + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Extern} The Game Object that was created. + */ +GameObjectFactory.register('extern', function () +{ + var extern = new Extern(this.scene); + + this.displayList.add(extern); + this.updateList.add(extern); + + return extern; +}); + +// 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 + + +/***/ }), +/* 790 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var DynamicBitmapText = __webpack_require__(169); var GameObjectFactory = __webpack_require__(5); /** @@ -124396,17 +131485,17 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 768 */ +/* 791 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Container = __webpack_require__(160); +var Container = __webpack_require__(170); var GameObjectFactory = __webpack_require__(5); /** @@ -124430,16 +131519,16 @@ GameObjectFactory.register('container', function (x, y, children) /***/ }), -/* 769 */ +/* 792 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Blitter = __webpack_require__(161); +var Blitter = __webpack_require__(171); var GameObjectFactory = __webpack_require__(5); /** @@ -124472,18 +131561,18 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) /***/ }), -/* 770 */ +/* 793 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -124537,6 +131626,9 @@ var TriangleCanvasRenderer = function (renderer, src, interpolationPercentage, c ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -124544,17 +131636,17 @@ module.exports = TriangleCanvasRenderer; /***/ }), -/* 771 */ +/* 794 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StrokePathWebGL = __webpack_require__(60); -var Utils = __webpack_require__(10); +var StrokePathWebGL = __webpack_require__(66); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -124647,12 +131739,12 @@ module.exports = TriangleWebGLRenderer; /***/ }), -/* 772 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124661,12 +131753,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(771); + renderWebGL = __webpack_require__(794); } if (true) { - renderCanvas = __webpack_require__(770); + renderCanvas = __webpack_require__(793); } module.exports = { @@ -124678,18 +131770,18 @@ module.exports = { /***/ }), -/* 773 */ +/* 796 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -124753,6 +131845,9 @@ var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -124760,17 +131855,17 @@ module.exports = StarCanvasRenderer; /***/ }), -/* 774 */ +/* 797 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -124838,12 +131933,12 @@ module.exports = StarWebGLRenderer; /***/ }), -/* 775 */ +/* 798 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124852,12 +131947,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(774); + renderWebGL = __webpack_require__(797); } if (true) { - renderCanvas = __webpack_require__(773); + renderCanvas = __webpack_require__(796); } module.exports = { @@ -124869,18 +131964,18 @@ module.exports = { /***/ }), -/* 776 */ +/* 799 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -124933,6 +132028,9 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -124940,17 +132038,17 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 777 */ +/* 800 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StrokePathWebGL = __webpack_require__(60); -var Utils = __webpack_require__(10); +var StrokePathWebGL = __webpack_require__(66); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -125011,7 +132109,9 @@ var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, c fillTint.TR = fillTintColor; fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; - + + pipeline.setTexture2D(); + pipeline.batchFillRect( -dx, -dy, @@ -125030,12 +132130,12 @@ module.exports = RectangleWebGLRenderer; /***/ }), -/* 778 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125044,12 +132144,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(777); + renderWebGL = __webpack_require__(800); } if (true) { - renderCanvas = __webpack_require__(776); + renderCanvas = __webpack_require__(799); } module.exports = { @@ -125061,18 +132161,18 @@ module.exports = { /***/ }), -/* 779 */ +/* 802 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -125136,6 +132236,9 @@ var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -125143,17 +132246,17 @@ module.exports = PolygonCanvasRenderer; /***/ }), -/* 780 */ +/* 803 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -125221,12 +132324,12 @@ module.exports = PolygonWebGLRenderer; /***/ }), -/* 781 */ +/* 804 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125235,12 +132338,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(780); + renderWebGL = __webpack_require__(803); } if (true) { - renderCanvas = __webpack_require__(779); + renderCanvas = __webpack_require__(802); } module.exports = { @@ -125252,17 +132355,17 @@ module.exports = { /***/ }), -/* 782 */ +/* 805 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -125299,6 +132402,9 @@ var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -125306,16 +132412,16 @@ module.exports = LineCanvasRenderer; /***/ }), -/* 783 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -125399,12 +132505,12 @@ module.exports = LineWebGLRenderer; /***/ }), -/* 784 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125413,12 +132519,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(783); + renderWebGL = __webpack_require__(806); } if (true) { - renderCanvas = __webpack_require__(782); + renderCanvas = __webpack_require__(805); } module.exports = { @@ -125430,17 +132536,17 @@ module.exports = { /***/ }), -/* 785 */ +/* 808 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -125534,6 +132640,9 @@ var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage ctx.fill(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -125541,16 +132650,16 @@ module.exports = IsoTriangleCanvasRenderer; /***/ }), -/* 786 */ +/* 809 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -125718,12 +132827,12 @@ module.exports = IsoTriangleWebGLRenderer; /***/ }), -/* 787 */ +/* 810 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125732,12 +132841,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(786); + renderWebGL = __webpack_require__(809); } if (true) { - renderCanvas = __webpack_require__(785); + renderCanvas = __webpack_require__(808); } module.exports = { @@ -125749,17 +132858,17 @@ module.exports = { /***/ }), -/* 788 */ +/* 811 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -125840,6 +132949,9 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam ctx.fill(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -125847,16 +132959,16 @@ module.exports = IsoBoxCanvasRenderer; /***/ }), -/* 789 */ +/* 812 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -126005,12 +133117,12 @@ module.exports = IsoBoxWebGLRenderer; /***/ }), -/* 790 */ +/* 813 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126019,12 +133131,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(789); + renderWebGL = __webpack_require__(812); } if (true) { - renderCanvas = __webpack_require__(788); + renderCanvas = __webpack_require__(811); } module.exports = { @@ -126036,18 +133148,18 @@ module.exports = { /***/ }), -/* 791 */ +/* 814 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -126100,6 +133212,9 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -126107,16 +133222,16 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 792 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -126333,12 +133448,12 @@ module.exports = GridWebGLRenderer; /***/ }), -/* 793 */ +/* 816 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126347,12 +133462,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(792); + renderWebGL = __webpack_require__(815); } if (true) { - renderCanvas = __webpack_require__(791); + renderCanvas = __webpack_require__(814); } module.exports = { @@ -126364,18 +133479,18 @@ module.exports = { /***/ }), -/* 794 */ +/* 817 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -126439,6 +133554,9 @@ var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -126446,17 +133564,17 @@ module.exports = EllipseCanvasRenderer; /***/ }), -/* 795 */ +/* 818 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -126524,12 +133642,12 @@ module.exports = EllipseWebGLRenderer; /***/ }), -/* 796 */ +/* 819 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126538,12 +133656,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(795); + renderWebGL = __webpack_require__(818); } if (true) { - renderCanvas = __webpack_require__(794); + renderCanvas = __webpack_require__(817); } module.exports = { @@ -126555,18 +133673,18 @@ module.exports = { /***/ }), -/* 797 */ +/* 820 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -126633,6 +133751,9 @@ var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, came ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -126640,17 +133761,17 @@ module.exports = CurveCanvasRenderer; /***/ }), -/* 798 */ +/* 821 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -126718,12 +133839,12 @@ module.exports = CurveWebGLRenderer; /***/ }), -/* 799 */ +/* 822 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126732,12 +133853,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(798); + renderWebGL = __webpack_require__(821); } if (true) { - renderCanvas = __webpack_require__(797); + renderCanvas = __webpack_require__(820); } module.exports = { @@ -126749,19 +133870,19 @@ module.exports = { /***/ }), -/* 800 */ +/* 823 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DegToRad = __webpack_require__(31); -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var DegToRad = __webpack_require__(34); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -126815,6 +133936,9 @@ var ArcCanvasRenderer = function (renderer, src, interpolationPercentage, camera ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -126822,17 +133946,17 @@ module.exports = ArcCanvasRenderer; /***/ }), -/* 801 */ +/* 824 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -126900,12 +134024,12 @@ module.exports = ArcWebGLRenderer; /***/ }), -/* 802 */ +/* 825 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126914,12 +134038,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(801); + renderWebGL = __webpack_require__(824); } if (true) { - renderCanvas = __webpack_require__(800); + renderCanvas = __webpack_require__(823); } module.exports = { @@ -126931,12 +134055,12 @@ module.exports = { /***/ }), -/* 803 */ +/* 826 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126966,16 +134090,16 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 804 */ +/* 827 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -127026,12 +134150,12 @@ module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 805 */ +/* 828 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127040,12 +134164,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(804); + renderWebGL = __webpack_require__(827); } if (true) { - renderCanvas = __webpack_require__(803); + renderCanvas = __webpack_require__(826); } module.exports = { @@ -127057,12 +134181,12 @@ module.exports = { /***/ }), -/* 806 */ +/* 829 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127074,7 +134198,7 @@ var CanvasPool = __webpack_require__(24); * @function Phaser.GameObjects.Text.MeasureText * @since 3.0.0 * - * @param {Phaser.GameObjects.Text.TextStyle} textStyle - The TextStyle object to measure. + * @param {Phaser.GameObjects.TextStyle} textStyle - The TextStyle object to measure. * * @return {object} An object containing the ascent, descent and fontSize of the TextStyle. */ @@ -127192,19 +134316,19 @@ module.exports = MeasureText; /***/ }), -/* 807 */ +/* 830 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(12); var GetValue = __webpack_require__(4); -var MeasureText = __webpack_require__(806); +var MeasureText = __webpack_require__(829); // Key: [ Object Key, Default Value ] @@ -127260,10 +134384,14 @@ var propertyMap = { /** * @classdesc - * Style settings for a Text object. + * A TextStyle class manages all of the style settings for a Text object. + * + * Text Game Objects create a TextStyle instance automatically, which is + * accessed via the `Text.style` property. You do not normally need to + * instantiate one yourself. * * @class TextStyle - * @memberof Phaser.GameObjects.Text + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -127279,7 +134407,7 @@ var TextStyle = new Class({ /** * The Text object that this TextStyle is styling. * - * @name Phaser.GameObjects.Text.TextStyle#parent + * @name Phaser.GameObjects.TextStyle#parent * @type {Phaser.GameObjects.Text} * @since 3.0.0 */ @@ -127288,7 +134416,7 @@ var TextStyle = new Class({ /** * The font family. * - * @name Phaser.GameObjects.Text.TextStyle#fontFamily + * @name Phaser.GameObjects.TextStyle#fontFamily * @type {string} * @default 'Courier' * @since 3.0.0 @@ -127298,7 +134426,7 @@ var TextStyle = new Class({ /** * The font size. * - * @name Phaser.GameObjects.Text.TextStyle#fontSize + * @name Phaser.GameObjects.TextStyle#fontSize * @type {string} * @default '16px' * @since 3.0.0 @@ -127308,7 +134436,7 @@ var TextStyle = new Class({ /** * The font style. * - * @name Phaser.GameObjects.Text.TextStyle#fontStyle + * @name Phaser.GameObjects.TextStyle#fontStyle * @type {string} * @since 3.0.0 */ @@ -127317,7 +134445,7 @@ var TextStyle = new Class({ /** * The background color. * - * @name Phaser.GameObjects.Text.TextStyle#backgroundColor + * @name Phaser.GameObjects.TextStyle#backgroundColor * @type {string} * @since 3.0.0 */ @@ -127326,7 +134454,7 @@ var TextStyle = new Class({ /** * The text fill color. * - * @name Phaser.GameObjects.Text.TextStyle#color + * @name Phaser.GameObjects.TextStyle#color * @type {string} * @default '#fff' * @since 3.0.0 @@ -127336,7 +134464,7 @@ var TextStyle = new Class({ /** * The text stroke color. * - * @name Phaser.GameObjects.Text.TextStyle#stroke + * @name Phaser.GameObjects.TextStyle#stroke * @type {string} * @default '#fff' * @since 3.0.0 @@ -127346,7 +134474,7 @@ var TextStyle = new Class({ /** * The text stroke thickness. * - * @name Phaser.GameObjects.Text.TextStyle#strokeThickness + * @name Phaser.GameObjects.TextStyle#strokeThickness * @type {number} * @default 0 * @since 3.0.0 @@ -127356,7 +134484,7 @@ var TextStyle = new Class({ /** * The horizontal shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetX + * @name Phaser.GameObjects.TextStyle#shadowOffsetX * @type {number} * @default 0 * @since 3.0.0 @@ -127366,7 +134494,7 @@ var TextStyle = new Class({ /** * The vertical shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetY + * @name Phaser.GameObjects.TextStyle#shadowOffsetY * @type {number} * @default 0 * @since 3.0.0 @@ -127376,7 +134504,7 @@ var TextStyle = new Class({ /** * The shadow color. * - * @name Phaser.GameObjects.Text.TextStyle#shadowColor + * @name Phaser.GameObjects.TextStyle#shadowColor * @type {string} * @default '#000' * @since 3.0.0 @@ -127386,7 +134514,7 @@ var TextStyle = new Class({ /** * The shadow blur radius. * - * @name Phaser.GameObjects.Text.TextStyle#shadowBlur + * @name Phaser.GameObjects.TextStyle#shadowBlur * @type {number} * @default 0 * @since 3.0.0 @@ -127396,7 +134524,7 @@ var TextStyle = new Class({ /** * Whether shadow stroke is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowStroke + * @name Phaser.GameObjects.TextStyle#shadowStroke * @type {boolean} * @default false * @since 3.0.0 @@ -127406,7 +134534,7 @@ var TextStyle = new Class({ /** * Whether shadow fill is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowFill + * @name Phaser.GameObjects.TextStyle#shadowFill * @type {boolean} * @default false * @since 3.0.0 @@ -127416,7 +134544,7 @@ var TextStyle = new Class({ /** * The text alignment. * - * @name Phaser.GameObjects.Text.TextStyle#align + * @name Phaser.GameObjects.TextStyle#align * @type {string} * @default 'left' * @since 3.0.0 @@ -127426,7 +134554,7 @@ var TextStyle = new Class({ /** * The maximum number of lines to draw. * - * @name Phaser.GameObjects.Text.TextStyle#maxLines + * @name Phaser.GameObjects.TextStyle#maxLines * @type {integer} * @default 0 * @since 3.0.0 @@ -127438,7 +134566,7 @@ var TextStyle = new Class({ * * `0` means no fixed with. * - * @name Phaser.GameObjects.Text.TextStyle#fixedWidth + * @name Phaser.GameObjects.TextStyle#fixedWidth * @type {number} * @default 0 * @since 3.0.0 @@ -127450,7 +134578,7 @@ var TextStyle = new Class({ * * `0` means no fixed height. * - * @name Phaser.GameObjects.Text.TextStyle#fixedHeight + * @name Phaser.GameObjects.TextStyle#fixedHeight * @type {number} * @default 0 * @since 3.0.0 @@ -127461,7 +134589,7 @@ var TextStyle = new Class({ * The resolution the text is rendered to its internal canvas at. * The default is 0, which means it will use the resolution set in the Game Config. * - * @name Phaser.GameObjects.Text.TextStyle#resolution + * @name Phaser.GameObjects.TextStyle#resolution * @type {number} * @default 0 * @since 3.12.0 @@ -127471,7 +134599,7 @@ var TextStyle = new Class({ /** * Whether the text should render right to left. * - * @name Phaser.GameObjects.Text.TextStyle#rtl + * @name Phaser.GameObjects.TextStyle#rtl * @type {boolean} * @default false * @since 3.0.0 @@ -127481,7 +134609,7 @@ var TextStyle = new Class({ /** * The test string to use when measuring the font. * - * @name Phaser.GameObjects.Text.TextStyle#testString + * @name Phaser.GameObjects.TextStyle#testString * @type {string} * @default '|MÉqgy' * @since 3.0.0 @@ -127491,7 +134619,7 @@ var TextStyle = new Class({ /** * The amount of horizontal padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineX + * @name Phaser.GameObjects.TextStyle#baselineX * @type {number} * @default 1.2 * @since 3.3.0 @@ -127501,7 +134629,7 @@ var TextStyle = new Class({ /** * The amount of vertical padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineY + * @name Phaser.GameObjects.TextStyle#baselineY * @type {number} * @default 1.4 * @since 3.3.0 @@ -127511,7 +134639,7 @@ var TextStyle = new Class({ /** * The font style, size and family. * - * @name Phaser.GameObjects.Text.TextStyle#_font + * @name Phaser.GameObjects.TextStyle#_font * @type {string} * @private * @since 3.0.0 @@ -127551,7 +134679,7 @@ var TextStyle = new Class({ * backgroundColor: '#ff00ff' * }); * - * @method Phaser.GameObjects.Text.TextStyle#setStyle + * @method Phaser.GameObjects.TextStyle#setStyle * @since 3.0.0 * * @param {object} style - The style settings to set. @@ -127589,15 +134717,13 @@ var TextStyle = new Class({ // Allow for 'font' override var font = GetValue(style, 'font', null); - if (font === null) + if (font !== null) { - this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); - } - else - { - this._font = font; + this.setFont(font, false); } + this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); + // Allow for 'fill' to be used in place of 'color' var fill = GetValue(style, 'fill', null); @@ -127619,7 +134745,7 @@ var TextStyle = new Class({ /** * Synchronize the font settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncFont + * @method Phaser.GameObjects.TextStyle#syncFont * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -127633,7 +134759,7 @@ var TextStyle = new Class({ /** * Synchronize the text style settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncStyle + * @method Phaser.GameObjects.TextStyle#syncStyle * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -127654,7 +134780,7 @@ var TextStyle = new Class({ /** * Synchronize the shadow settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncShadow + * @method Phaser.GameObjects.TextStyle#syncShadow * @since 3.0.0 * * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. @@ -127681,7 +134807,7 @@ var TextStyle = new Class({ /** * Update the style settings for the parent Text object. * - * @method Phaser.GameObjects.Text.TextStyle#update + * @method Phaser.GameObjects.TextStyle#update * @since 3.0.0 * * @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics. @@ -127708,15 +134834,18 @@ var TextStyle = new Class({ * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. * - * @method Phaser.GameObjects.Text.TextStyle#setFont + * @method Phaser.GameObjects.TextStyle#setFont * @since 3.0.0 * * @param {(string|object)} font - The font family or font settings to set. + * @param {boolean} [updateText=true] - Whether to update the text immediately. * * @return {Phaser.GameObjects.Text} The parent Text object. */ - setFont: function (font) + setFont: function (font, updateText) { + if (updateText === undefined) { updateText = true; } + var fontFamily = font; var fontSize = ''; var fontStyle = ''; @@ -127727,14 +134856,27 @@ var TextStyle = new Class({ fontSize = GetValue(font, 'fontSize', '16px'); fontStyle = GetValue(font, 'fontStyle', ''); } + else + { + var fontSplit = font.split(' '); + + var i = 0; + + fontStyle = (fontSplit.length > 2) ? fontSplit[i++] : ''; + fontSize = fontSplit[i++] || '16px'; + fontFamily = fontSplit[i++] || 'Courier'; + } if (fontFamily !== this.fontFamily || fontSize !== this.fontSize || fontStyle !== this.fontStyle) { this.fontFamily = fontFamily; this.fontSize = fontSize; this.fontStyle = fontStyle; - - this.update(true); + + if (updateText) + { + this.update(true); + } } return this.parent; @@ -127743,7 +134885,7 @@ var TextStyle = new Class({ /** * Set the font family. * - * @method Phaser.GameObjects.Text.TextStyle#setFontFamily + * @method Phaser.GameObjects.TextStyle#setFontFamily * @since 3.0.0 * * @param {string} family - The font family. @@ -127765,7 +134907,7 @@ var TextStyle = new Class({ /** * Set the font style. * - * @method Phaser.GameObjects.Text.TextStyle#setFontStyle + * @method Phaser.GameObjects.TextStyle#setFontStyle * @since 3.0.0 * * @param {string} style - The font style. @@ -127787,7 +134929,7 @@ var TextStyle = new Class({ /** * Set the font size. * - * @method Phaser.GameObjects.Text.TextStyle#setFontSize + * @method Phaser.GameObjects.TextStyle#setFontSize * @since 3.0.0 * * @param {(number|string)} size - The font size. @@ -127814,7 +134956,7 @@ var TextStyle = new Class({ /** * Set the test string to use when measuring the font. * - * @method Phaser.GameObjects.Text.TextStyle#setTestString + * @method Phaser.GameObjects.TextStyle#setTestString * @since 3.0.0 * * @param {string} string - The test string to use when measuring the font. @@ -127833,7 +134975,7 @@ var TextStyle = new Class({ * * Pass in `0` for either of these parameters to disable fixed width or height respectively. * - * @method Phaser.GameObjects.Text.TextStyle#setFixedSize + * @method Phaser.GameObjects.TextStyle#setFixedSize * @since 3.0.0 * * @param {number} width - The fixed width to set. @@ -127862,7 +135004,7 @@ var TextStyle = new Class({ /** * Set the background color. * - * @method Phaser.GameObjects.Text.TextStyle#setBackgroundColor + * @method Phaser.GameObjects.TextStyle#setBackgroundColor * @since 3.0.0 * * @param {string} color - The background color. @@ -127879,7 +135021,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setFill + * @method Phaser.GameObjects.TextStyle#setFill * @since 3.0.0 * * @param {string} color - The text fill color. @@ -127896,7 +135038,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setColor + * @method Phaser.GameObjects.TextStyle#setColor * @since 3.0.0 * * @param {string} color - The text fill color. @@ -127919,7 +135061,7 @@ var TextStyle = new Class({ * * Please use with caution, as the more high res Text you have, the more memory it uses up. * - * @method Phaser.GameObjects.Text.TextStyle#setResolution + * @method Phaser.GameObjects.TextStyle#setResolution * @since 3.12.0 * * @param {number} value - The resolution for this Text object to use. @@ -127936,7 +135078,7 @@ var TextStyle = new Class({ /** * Set the stroke settings. * - * @method Phaser.GameObjects.Text.TextStyle#setStroke + * @method Phaser.GameObjects.TextStyle#setStroke * @since 3.0.0 * * @param {string} color - The stroke color. @@ -127972,7 +135114,7 @@ var TextStyle = new Class({ * Calling this method always re-measures the parent Text object, * so only call it when you actually change the shadow settings. * - * @method Phaser.GameObjects.Text.TextStyle#setShadow + * @method Phaser.GameObjects.TextStyle#setShadow * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -128006,7 +135148,7 @@ var TextStyle = new Class({ /** * Set the shadow offset. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowOffset + * @method Phaser.GameObjects.TextStyle#setShadowOffset * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -128028,7 +135170,7 @@ var TextStyle = new Class({ /** * Set the shadow color. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowColor + * @method Phaser.GameObjects.TextStyle#setShadowColor * @since 3.0.0 * * @param {string} [color='#000'] - The shadow color. @@ -128047,7 +135189,7 @@ var TextStyle = new Class({ /** * Set the shadow blur radius. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowBlur + * @method Phaser.GameObjects.TextStyle#setShadowBlur * @since 3.0.0 * * @param {number} [blur=0] - The shadow blur radius. @@ -128066,7 +135208,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow stroke. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowStroke + * @method Phaser.GameObjects.TextStyle#setShadowStroke * @since 3.0.0 * * @param {boolean} enabled - Whether shadow stroke is enabled or not. @@ -128083,7 +135225,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow fill. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowFill + * @method Phaser.GameObjects.TextStyle#setShadowFill * @since 3.0.0 * * @param {boolean} enabled - Whether shadow fill is enabled or not. @@ -128102,7 +135244,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by width. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapWidth + * @method Phaser.GameObjects.TextStyle#setWordWrapWidth * @since 3.0.0 * * @param {number} width - The maximum width of a line in pixels. Set to null to remove wrapping. @@ -128127,7 +135269,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by callback. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapCallback + * @method Phaser.GameObjects.TextStyle#setWordWrapCallback * @since 3.0.0 * * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the @@ -128153,7 +135295,7 @@ var TextStyle = new Class({ * * Expects values like `'left'`, `'right'`, `'center'` or `'justified'`. * - * @method Phaser.GameObjects.Text.TextStyle#setAlign + * @method Phaser.GameObjects.TextStyle#setAlign * @since 3.0.0 * * @param {string} align - The text alignment. @@ -128172,7 +135314,7 @@ var TextStyle = new Class({ /** * Set the maximum number of lines to draw. * - * @method Phaser.GameObjects.Text.TextStyle#setMaxLines + * @method Phaser.GameObjects.TextStyle#setMaxLines * @since 3.0.0 * * @param {integer} [max=0] - The maximum number of lines to draw. @@ -128191,7 +135333,7 @@ var TextStyle = new Class({ /** * Get the current text metrics. * - * @method Phaser.GameObjects.Text.TextStyle#getTextMetrics + * @method Phaser.GameObjects.TextStyle#getTextMetrics * @since 3.0.0 * * @return {BitmapTextMetrics} The text metrics. @@ -128210,7 +135352,7 @@ var TextStyle = new Class({ /** * Build a JSON representation of this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#toJSON + * @method Phaser.GameObjects.TextStyle#toJSON * @since 3.0.0 * * @return {object} A JSON representation of this Text Style. @@ -128232,7 +135374,7 @@ var TextStyle = new Class({ /** * Destroy this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#destroy + * @method Phaser.GameObjects.TextStyle#destroy * @since 3.0.0 */ destroy: function () @@ -128246,12 +135388,12 @@ module.exports = TextStyle; /***/ }), -/* 808 */ +/* 831 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128282,16 +135424,16 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 809 */ +/* 832 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -128347,12 +135489,12 @@ module.exports = TextWebGLRenderer; /***/ }), -/* 810 */ +/* 833 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128361,12 +135503,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(809); + renderWebGL = __webpack_require__(832); } if (true) { - renderCanvas = __webpack_require__(808); + renderCanvas = __webpack_require__(831); } module.exports = { @@ -128378,12 +135520,12 @@ module.exports = { /***/ }), -/* 811 */ +/* 834 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128460,12 +135602,12 @@ module.exports = GetTextSize; /***/ }), -/* 812 */ +/* 835 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128576,12 +135718,12 @@ module.exports = ParseRetroFont; /***/ }), -/* 813 */ +/* 836 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128692,17 +135834,17 @@ module.exports = RETRO_FONT_CONST; /***/ }), -/* 814 */ +/* 837 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RETRO_FONT_CONST = __webpack_require__(813); -var Extend = __webpack_require__(20); +var RETRO_FONT_CONST = __webpack_require__(836); +var Extend = __webpack_require__(19); /** * @typedef {object} Phaser.GameObjects.RetroFont.Config @@ -128724,7 +135866,7 @@ var Extend = __webpack_require__(20); * @since 3.6.0 */ -var RetroFont = { Parse: __webpack_require__(812) }; +var RetroFont = { Parse: __webpack_require__(835) }; // Merge in the consts RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); @@ -128733,12 +135875,12 @@ module.exports = RetroFont; /***/ }), -/* 815 */ +/* 838 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128766,16 +135908,16 @@ module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 816 */ +/* 839 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -128829,12 +135971,12 @@ module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 817 */ +/* 840 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128843,12 +135985,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(816); + renderWebGL = __webpack_require__(839); } if (true) { - renderCanvas = __webpack_require__(815); + renderCanvas = __webpack_require__(838); } module.exports = { @@ -128860,12 +136002,12 @@ module.exports = { /***/ }), -/* 818 */ +/* 841 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128875,20 +136017,20 @@ module.exports = { module.exports = { - DeathZone: __webpack_require__(301), - EdgeZone: __webpack_require__(300), - RandomZone: __webpack_require__(297) + DeathZone: __webpack_require__(304), + EdgeZone: __webpack_require__(303), + RandomZone: __webpack_require__(301) }; /***/ }), -/* 819 */ +/* 842 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128987,8 +136129,8 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol if (roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); @@ -129004,16 +136146,16 @@ module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 820 */ +/* 843 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -129127,25 +136269,22 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola if (roundPixels) { - tx0 |= 0; - ty0 |= 0; - - tx1 |= 0; - ty1 |= 0; - - tx2 |= 0; - ty2 |= 0; - - tx3 |= 0; - ty3 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); + + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); + + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); + + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } var tint = getTint(particle.tint, alpha); - if (pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect)) - { - pipeline.setTexture2D(texture, 0); - } + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, 0); } } }; @@ -129154,12 +136293,12 @@ module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 821 */ +/* 844 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -129168,12 +136307,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(820); + renderWebGL = __webpack_require__(843); } if (true) { - renderCanvas = __webpack_require__(819); + renderCanvas = __webpack_require__(842); } module.exports = { @@ -129185,20 +136324,20 @@ module.exports = { /***/ }), -/* 822 */ +/* 845 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(299); -var GetEaseFunction = __webpack_require__(86); +var FloatBetween = __webpack_require__(374); +var GetEaseFunction = __webpack_require__(92); var GetFastValue = __webpack_require__(2); -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * The returned value sets what the property will be at the START of the particle's life, on emit. @@ -129268,14 +136407,14 @@ var Wrap = __webpack_require__(53); /** * @typedef {object} EmitterOpCustomEmitConfig * - * @property {EmitterOpOnEmitCallback} onEmit - [description] + * @property {EmitterOpOnEmitCallback} onEmit - A callback that is invoked each time the emitter emits a particle. */ /** * @typedef {object} EmitterOpCustomUpdateConfig * - * @property {EmitterOpOnEmitCallback} [onEmit] - [description] - * @property {EmitterOpOnUpdateCallback} onUpdate - [description] + * @property {EmitterOpOnEmitCallback} [onEmit] - A callback that is invoked each time the emitter emits a particle. + * @property {EmitterOpOnUpdateCallback} onUpdate - A callback that is invoked each time the emitter updates. */ /** @@ -129854,12 +136993,12 @@ module.exports = EmitterOp; /***/ }), -/* 823 */ +/* 846 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -129869,22 +137008,22 @@ module.exports = EmitterOp; module.exports = { - GravityWell: __webpack_require__(304), - Particle: __webpack_require__(303), - ParticleEmitter: __webpack_require__(302), - ParticleEmitterManager: __webpack_require__(155), - Zones: __webpack_require__(818) + GravityWell: __webpack_require__(307), + Particle: __webpack_require__(306), + ParticleEmitter: __webpack_require__(305), + ParticleEmitterManager: __webpack_require__(165), + Zones: __webpack_require__(841) }; /***/ }), -/* 824 */ +/* 847 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -129912,12 +137051,12 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 825 */ +/* 848 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -129945,12 +137084,12 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 826 */ +/* 849 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -129959,12 +137098,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(825); + renderWebGL = __webpack_require__(848); } if (true) { - renderCanvas = __webpack_require__(824); + renderCanvas = __webpack_require__(847); } module.exports = { @@ -129976,12 +137115,12 @@ module.exports = { /***/ }), -/* 827 */ +/* 850 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130009,12 +137148,12 @@ module.exports = SpriteCanvasRenderer; /***/ }), -/* 828 */ +/* 851 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130042,12 +137181,12 @@ module.exports = SpriteWebGLRenderer; /***/ }), -/* 829 */ +/* 852 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130056,12 +137195,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(828); + renderWebGL = __webpack_require__(851); } if (true) { - renderCanvas = __webpack_require__(827); + renderCanvas = __webpack_require__(850); } module.exports = { @@ -130073,17 +137212,17 @@ module.exports = { /***/ }), -/* 830 */ +/* 853 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Commands = __webpack_require__(157); -var Utils = __webpack_require__(10); +var Commands = __webpack_require__(167); +var Utils = __webpack_require__(9); // TODO: Remove the use of this var Point = function (x, y, width) @@ -130125,12 +137264,12 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca return; } - var pipeline = this.pipeline; + var pipeline = renderer.currentPipeline; var camMatrix = pipeline._tempMatrix1; var graphicsMatrix = pipeline._tempMatrix2; var currentMatrix = pipeline._tempMatrix4; - + renderer.setPipeline(pipeline); currentMatrix.loadIdentity(); @@ -130438,12 +137577,12 @@ module.exports = GraphicsWebGLRenderer; /***/ }), -/* 831 */ +/* 854 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130452,15 +137591,15 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(830); + renderWebGL = __webpack_require__(853); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(305); + renderCanvas = __webpack_require__(308); } if (true) { - renderCanvas = __webpack_require__(305); + renderCanvas = __webpack_require__(308); } module.exports = { @@ -130472,16 +137611,122 @@ module.exports = { /***/ }), -/* 832 */ +/* 855 */ +/***/ (function(module, exports) { + + + +/***/ }), +/* 856 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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.Extern#renderWebGL + * @since 3.16.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Extern} 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. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +{ + var pipeline = renderer.currentPipeline; + + renderer.clearPipeline(); + + var camMatrix = renderer._tempMatrix1; + var spriteMatrix = renderer._tempMatrix2; + var calcMatrix = renderer._tempMatrix3; + + spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = src.x; + spriteMatrix.f = src.y; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + else + { + spriteMatrix.e -= camera.scrollX * src.scrollFactorX; + spriteMatrix.f -= camera.scrollY * src.scrollFactorY; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + + // Callback + src.render.call(src, renderer, camera, calcMatrix); + + renderer.rebindPipeline(pipeline); +}; + +module.exports = ExternWebGLRenderer; + + +/***/ }), +/* 857 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTransform = __webpack_require__(22); +var renderWebGL = __webpack_require__(1); +var renderCanvas = __webpack_require__(1); + +if (true) +{ + renderWebGL = __webpack_require__(856); +} + +if (true) +{ + renderCanvas = __webpack_require__(855); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 858 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -130513,6 +137758,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc var textureFrame = src.frame; var displayCallback = src.displayCallback; + var callbackData = src.callbackData; var cameraScrollX = camera.scrollX * src.scrollFactorX; var cameraScrollY = camera.scrollY * src.scrollFactorY; @@ -130538,7 +137784,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc var lastGlyph = null; var lastCharCode = 0; - // var ctx = renderer.currentContext; var image = src.frame.source.image; var textureX = textureFrame.cutX; @@ -130549,7 +137794,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (src.cropWidth > 0 && src.cropHeight > 0) { - ctx.save(); ctx.beginPath(); ctx.rect(0, 0, src.cropWidth, src.cropHeight); ctx.clip(); @@ -130598,7 +137842,15 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (displayCallback) { - var output = displayCallback({ tint: { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }, index: index, charCode: charCode, x: x, y: y, scale: scale, rotation: 0, data: glyph.data }); + callbackData.index = index; + callbackData.charCode = charCode; + callbackData.x = x; + callbackData.y = y; + callbackData.scale = scale; + callbackData.rotation = rotation; + callbackData.data = glyph.data; + + var output = displayCallback(callbackData); x = output.x; y = output.y; @@ -130614,8 +137866,8 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (camera.roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.save(); @@ -130636,11 +137888,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc lastCharCode = charCode; } - if (src.cropWidth > 0 && src.cropHeight > 0) - { - ctx.restore(); - } - + // Restore the context saved in SetTransform ctx.restore(); }; @@ -130648,16 +137896,16 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 833 */ +/* 859 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -130926,20 +138174,20 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); } if (crop) @@ -130954,12 +138202,12 @@ module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 834 */ +/* 860 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130968,12 +138216,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(833); + renderWebGL = __webpack_require__(859); } if (true) { - renderCanvas = __webpack_require__(832); + renderCanvas = __webpack_require__(858); } module.exports = { @@ -130985,13 +138233,13 @@ module.exports = { /***/ }), -/* 835 */ +/* 861 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131083,13 +138331,13 @@ module.exports = ContainerCanvasRenderer; /***/ }), -/* 836 */ +/* 862 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131180,13 +138428,13 @@ module.exports = ContainerWebGLRenderer; /***/ }), -/* 837 */ +/* 863 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131195,12 +138443,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(836); + renderWebGL = __webpack_require__(862); } if (true) { - renderCanvas = __webpack_require__(835); + renderCanvas = __webpack_require__(861); } module.exports = { @@ -131212,12 +138460,12 @@ module.exports = { /***/ }), -/* 838 */ +/* 864 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131240,7 +138488,7 @@ var Class = __webpack_require__(0); * handled via the Blitter parent. * * @class Bob - * @memberof Phaser.GameObjects.Blitter + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -131259,7 +138507,7 @@ var Bob = new Class({ /** * The Blitter object that this Bob belongs to. * - * @name Phaser.GameObjects.Blitter.Bob#parent + * @name Phaser.GameObjects.Bob#parent * @type {Phaser.GameObjects.Blitter} * @since 3.0.0 */ @@ -131268,7 +138516,7 @@ var Bob = new Class({ /** * The x position of this Bob, relative to the x position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#x + * @name Phaser.GameObjects.Bob#x * @type {number} * @since 3.0.0 */ @@ -131277,7 +138525,7 @@ var Bob = new Class({ /** * The y position of this Bob, relative to the y position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#y + * @name Phaser.GameObjects.Bob#y * @type {number} * @since 3.0.0 */ @@ -131287,7 +138535,7 @@ var Bob = new Class({ * The frame that the Bob uses to render with. * To change the frame use the `Bob.setFrame` method. * - * @name Phaser.GameObjects.Blitter.Bob#frame + * @name Phaser.GameObjects.Bob#frame * @type {Phaser.Textures.Frame} * @protected * @since 3.0.0 @@ -131297,7 +138545,7 @@ var Bob = new Class({ /** * A blank object which can be used to store data related to this Bob in. * - * @name Phaser.GameObjects.Blitter.Bob#data + * @name Phaser.GameObjects.Bob#data * @type {object} * @default {} * @since 3.0.0 @@ -131307,7 +138555,7 @@ var Bob = new Class({ /** * The visible state of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_visible + * @name Phaser.GameObjects.Bob#_visible * @type {boolean} * @private * @since 3.0.0 @@ -131317,7 +138565,7 @@ var Bob = new Class({ /** * The alpha value of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_alpha + * @name Phaser.GameObjects.Bob#_alpha * @type {number} * @private * @default 1 @@ -131330,7 +138578,7 @@ var Bob = new Class({ * A Bob that is flipped horizontally will render inversed on the horizontal axis. * Flipping always takes place from the middle of the texture. * - * @name Phaser.GameObjects.Blitter.Bob#flipX + * @name Phaser.GameObjects.Bob#flipX * @type {boolean} * @since 3.0.0 */ @@ -131341,7 +138589,7 @@ var Bob = new Class({ * A Bob 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. * - * @name Phaser.GameObjects.Blitter.Bob#flipY + * @name Phaser.GameObjects.Bob#flipY * @type {boolean} * @since 3.0.0 */ @@ -131353,12 +138601,12 @@ var Bob = new Class({ * The frame must be part of the Texture the parent Blitter is using. * If no value is given it will use the default frame of the Blitter parent. * - * @method Phaser.GameObjects.Blitter.Bob#setFrame + * @method Phaser.GameObjects.Bob#setFrame * @since 3.0.0 * * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFrame: function (frame) { @@ -131377,10 +138625,10 @@ var Bob = new Class({ /** * Resets the horizontal and vertical flipped state of this Bob back to their default un-flipped state. * - * @method Phaser.GameObjects.Blitter.Bob#resetFlip + * @method Phaser.GameObjects.Bob#resetFlip * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ resetFlip: function () { @@ -131397,14 +138645,14 @@ var Bob = new Class({ * * Also resets the flipX and flipY values, sets alpha back to 1 and visible to true. * - * @method Phaser.GameObjects.Blitter.Bob#reset + * @method Phaser.GameObjects.Bob#reset * @since 3.0.0 * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ reset: function (x, y, frame) { @@ -131430,12 +138678,12 @@ var Bob = new Class({ /** * Sets the horizontal flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipX + * @method Phaser.GameObjects.Bob#setFlipX * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipX: function (value) { @@ -131447,12 +138695,12 @@ var Bob = new Class({ /** * Sets the vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipY + * @method Phaser.GameObjects.Bob#setFlipY * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipY: function (value) { @@ -131464,13 +138712,13 @@ var Bob = new Class({ /** * Sets the horizontal and vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlip + * @method Phaser.GameObjects.Bob#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.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlip: function (x, y) { @@ -131485,12 +138733,12 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setVisible + * @method Phaser.GameObjects.Bob#setVisible * @since 3.0.0 * * @param {boolean} value - The visible state of the Game Object. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setVisible: function (value) { @@ -131505,12 +138753,12 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setAlpha + * @method Phaser.GameObjects.Bob#setAlpha * @since 3.0.0 * * @param {number} value - The alpha value used for this Bob. Between 0 and 1. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setAlpha: function (value) { @@ -131523,7 +138771,7 @@ var Bob = new Class({ * Destroys this Bob instance. * Removes itself from the Blitter and clears the parent, frame and data properties. * - * @method Phaser.GameObjects.Blitter.Bob#destroy + * @method Phaser.GameObjects.Bob#destroy * @since 3.0.0 */ destroy: function () @@ -131542,7 +138790,7 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#visible + * @name Phaser.GameObjects.Bob#visible * @type {boolean} * @since 3.0.0 */ @@ -131566,7 +138814,7 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#alpha + * @name Phaser.GameObjects.Bob#alpha * @type {number} * @since 3.0.0 */ @@ -131591,12 +138839,12 @@ module.exports = Bob; /***/ }), -/* 839 */ +/* 865 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131674,8 +138922,8 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca { if (roundPixels) { - dx |= 0; - dy |= 0; + dx = Math.round(dx); + dy = Math.round(dy); } ctx.drawImage( @@ -131719,16 +138967,16 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 840 */ +/* 866 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -131830,15 +139078,15 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); } // TL x/y, BL x/y, BR x/y, TR x/y - if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect)) + if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, 0)) { prevTextureSourceIndex = -1; } @@ -131849,12 +139097,12 @@ module.exports = BlitterWebGLRenderer; /***/ }), -/* 841 */ +/* 867 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131863,12 +139111,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(840); + renderWebGL = __webpack_require__(866); } if (true) { - renderCanvas = __webpack_require__(839); + renderCanvas = __webpack_require__(865); } module.exports = { @@ -131880,16 +139128,16 @@ module.exports = { /***/ }), -/* 842 */ +/* 868 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTransform = __webpack_require__(22); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -132033,8 +139281,8 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, if (roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.save(); @@ -132055,16 +139303,16 @@ module.exports = BitmapTextCanvasRenderer; /***/ }), -/* 843 */ +/* 869 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -132263,20 +139511,20 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); } }; @@ -132284,12 +139532,12 @@ module.exports = BitmapTextWebGLRenderer; /***/ }), -/* 844 */ +/* 870 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132298,12 +139546,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(843); + renderWebGL = __webpack_require__(869); } if (true) { - renderCanvas = __webpack_require__(842); + renderCanvas = __webpack_require__(868); } module.exports = { @@ -132315,16 +139563,16 @@ module.exports = { /***/ }), -/* 845 */ +/* 871 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(310); +var ParseXMLBitmapFont = __webpack_require__(314); /** * Parse an XML Bitmap Font from an Atlas. @@ -132368,12 +139616,12 @@ module.exports = ParseFromAtlas; /***/ }), -/* 846 */ +/* 872 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132610,17 +139858,18 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 847 */ +/* 873 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -132694,8 +139943,8 @@ var UpdateList = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -132708,7 +139957,7 @@ var UpdateList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -132724,9 +139973,9 @@ var UpdateList = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -132896,9 +140145,9 @@ var UpdateList = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -132912,7 +140161,7 @@ var UpdateList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -132943,12 +140192,12 @@ module.exports = UpdateList; /***/ }), -/* 848 */ +/* 874 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132991,16 +140240,16 @@ module.exports = Swap; /***/ }), -/* 849 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Scans the array for elements with the given property. If found, the property is set to the `value`. @@ -133046,12 +140295,12 @@ module.exports = SetAll; /***/ }), -/* 850 */ +/* 876 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133084,12 +140333,12 @@ module.exports = SendToBack; /***/ }), -/* 851 */ +/* 877 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133127,16 +140376,16 @@ module.exports = Replace; /***/ }), -/* 852 */ +/* 878 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(91); +var SpliceOne = __webpack_require__(97); /** * Removes a random object from the given array and returns it. @@ -133165,16 +140414,16 @@ module.exports = RemoveRandomElement; /***/ }), -/* 853 */ +/* 879 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Removes the item within the given range in the array. @@ -133228,16 +140477,16 @@ module.exports = RemoveBetween; /***/ }), -/* 854 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(91); +var SpliceOne = __webpack_require__(97); /** * Removes the item from the given position in the array. @@ -133279,16 +140528,16 @@ module.exports = RemoveAt; /***/ }), -/* 855 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RoundAwayFromZero = __webpack_require__(314); +var RoundAwayFromZero = __webpack_require__(372); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -133325,7 +140574,7 @@ var RoundAwayFromZero = __webpack_require__(314); * @param {number} [end=null] - The end of the range. * @param {number} [step=1] - The value to increment or decrement by. * - * @return {number[]} [description] + * @return {number[]} The array of number values. */ var NumberArrayStep = function (start, end, step) { @@ -133356,12 +140605,12 @@ module.exports = NumberArrayStep; /***/ }), -/* 856 */ +/* 882 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133420,12 +140669,12 @@ module.exports = NumberArray; /***/ }), -/* 857 */ +/* 883 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133445,10 +140694,10 @@ var MoveUp = function (array, item) { var currentIndex = array.indexOf(item); - if (currentIndex !== -1 && currentIndex < array.length - 2) + if (currentIndex !== -1 && currentIndex < array.length - 1) { + // The element one above `item` in the array var item2 = array[currentIndex + 1]; - var index2 = array.indexOf(item2); array[currentIndex] = item2; @@ -133462,12 +140711,12 @@ module.exports = MoveUp; /***/ }), -/* 858 */ +/* 884 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133509,12 +140758,12 @@ module.exports = MoveTo; /***/ }), -/* 859 */ +/* 885 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133551,16 +140800,16 @@ module.exports = MoveDown; /***/ }), -/* 860 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Returns the first element in the array. @@ -133610,16 +140859,16 @@ module.exports = GetFirst; /***/ }), -/* 861 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Returns all elements in the array. @@ -133672,16 +140921,16 @@ module.exports = GetAll; /***/ }), -/* 862 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Passes each element in the array, between the start and end indexes, to the given callback. @@ -133728,12 +140977,12 @@ module.exports = EachInRange; /***/ }), -/* 863 */ +/* 889 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133774,16 +141023,16 @@ module.exports = Each; /***/ }), -/* 864 */ +/* 890 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Returns the total number of elements in the array which have a property matching the given value. @@ -133826,12 +141075,12 @@ module.exports = CountAllMatching; /***/ }), -/* 865 */ +/* 891 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133864,12 +141113,12 @@ module.exports = BringToTop; /***/ }), -/* 866 */ +/* 892 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133986,12 +141235,12 @@ module.exports = AddAt; /***/ }), -/* 867 */ +/* 893 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134103,26 +141352,26 @@ module.exports = Add; /***/ }), -/* 868 */ +/* 894 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(111); +var RotateMatrix = __webpack_require__(119); /** - * [description] + * Rotates the array matrix to the left (or -90 degrees) * * @function Phaser.Utils.Array.Matrix.RotateRight * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var RotateRight = function (matrix) { @@ -134133,26 +141382,26 @@ module.exports = RotateRight; /***/ }), -/* 869 */ +/* 895 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(111); +var RotateMatrix = __webpack_require__(119); /** - * [description] + * Rotates the array matrix to the left (or 90 degrees) * * @function Phaser.Utils.Array.Matrix.RotateLeft * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var RotateLeft = function (matrix) { @@ -134163,26 +141412,26 @@ module.exports = RotateLeft; /***/ }), -/* 870 */ +/* 896 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(111); +var RotateMatrix = __webpack_require__(119); /** - * [description] + * Rotates the array matrix 180 degrees. * * @function Phaser.Utils.Array.Matrix.Rotate180 * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var Rotate180 = function (matrix) { @@ -134193,40 +141442,45 @@ module.exports = Rotate180; /***/ }), -/* 871 */ +/* 897 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Reverses the rows in the given Array Matrix. * * @function Phaser.Utils.Array.Matrix.ReverseRows * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array matrix to reverse the rows for. * - * @return {array} [description] + * @return {array} The column reversed matrix. */ var ReverseRows = function (matrix) { - return matrix.reverse(); + for (var i = 0; i < matrix.length; i++) + { + matrix[i].reverse(); + } + + return matrix; }; module.exports = ReverseRows; /***/ }), -/* 872 */ +/* 898 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134242,32 +141496,24 @@ module.exports = ReverseRows; */ var ReverseColumns = function (matrix) { - for (var i = 0; i < matrix.length; i++) - { - matrix[i].reverse(); - } - - return matrix; + return matrix.reverse(); }; module.exports = ReverseColumns; /***/ }), -/* 873 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pad = __webpack_require__(179); -var CheckMatrix = __webpack_require__(163); - -// Generates a string (which you can pass to console.log) from the given -// Array Matrix. +var Pad = __webpack_require__(193); +var CheckMatrix = __webpack_require__(173); /** * Generates a string (which you can pass to console.log) from the given Array Matrix. @@ -134335,12 +141581,12 @@ module.exports = MatrixToString; /***/ }), -/* 874 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134350,33 +141596,34 @@ module.exports = MatrixToString; module.exports = { - CheckMatrix: __webpack_require__(163), - MatrixToString: __webpack_require__(873), - ReverseColumns: __webpack_require__(872), - ReverseRows: __webpack_require__(871), - Rotate180: __webpack_require__(870), - RotateLeft: __webpack_require__(869), - RotateMatrix: __webpack_require__(111), - RotateRight: __webpack_require__(868), - TransposeMatrix: __webpack_require__(315) + CheckMatrix: __webpack_require__(173), + MatrixToString: __webpack_require__(899), + ReverseColumns: __webpack_require__(898), + ReverseRows: __webpack_require__(897), + Rotate180: __webpack_require__(896), + RotateLeft: __webpack_require__(895), + RotateMatrix: __webpack_require__(119), + RotateRight: __webpack_require__(894), + TransposeMatrix: __webpack_require__(318) }; /***/ }), -/* 875 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var List = __webpack_require__(112); -var PluginCache = __webpack_require__(15); -var StableSort = __webpack_require__(110); +var List = __webpack_require__(120); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var StableSort = __webpack_require__(118); /** * @classdesc @@ -134432,8 +141679,8 @@ var DisplayList = new Class({ */ this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -134446,7 +141693,7 @@ var DisplayList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -134460,7 +141707,7 @@ var DisplayList = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -134507,46 +141754,8 @@ var DisplayList = new Class({ }, /** - * Given an array of Game Objects, sort the array and return it, so that - * the objects are in index order with the lowest at the bottom. - * - * @method Phaser.GameObjects.DisplayList#sortGameObjects - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects to sort. - * - * @return {array} The sorted array of Game Objects. - */ - sortGameObjects: function (gameObjects) - { - if (gameObjects === undefined) { gameObjects = this.list; } - - this.scene.sys.depthSort(); - - return gameObjects.sort(this.sortIndexHandler.bind(this)); - }, - - /** - * Get the top-most Game Object in the given array of Game Objects, after sorting it. - * - * Note that the given array is sorted in place, even though it isn't returned directly it will still be updated. - * - * @method Phaser.GameObjects.DisplayList#getTopGameObject - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects. - * - * @return {Phaser.GameObjects.GameObject} The top-most Game Object in the array of Game Objects. - */ - getTopGameObject: function (gameObjects) - { - this.sortGameObjects(gameObjects); - - return gameObjects[gameObjects.length - 1]; - }, - - /** - * All members of the group. + * Returns an array which contains all objects currently on the Display List. + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. * * @method Phaser.GameObjects.DisplayList#getChildren * @since 3.12.0 @@ -134577,7 +141786,7 @@ var DisplayList = new Class({ this.list.length = 0; - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -134592,7 +141801,7 @@ var DisplayList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -134606,12 +141815,12 @@ module.exports = DisplayList; /***/ }), -/* 876 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134621,93 +141830,97 @@ module.exports = DisplayList; var GameObjects = { - DisplayList: __webpack_require__(875), - GameObjectCreator: __webpack_require__(13), + Events: __webpack_require__(133), + + DisplayList: __webpack_require__(901), + GameObjectCreator: __webpack_require__(14), GameObjectFactory: __webpack_require__(5), - UpdateList: __webpack_require__(847), + UpdateList: __webpack_require__(873), - Components: __webpack_require__(14), + Components: __webpack_require__(13), - BuildGameObject: __webpack_require__(28), - BuildGameObjectAnimation: __webpack_require__(311), - GameObject: __webpack_require__(19), - BitmapText: __webpack_require__(109), - Blitter: __webpack_require__(161), - Container: __webpack_require__(160), - DynamicBitmapText: __webpack_require__(159), - Graphics: __webpack_require__(158), - Group: __webpack_require__(88), - Image: __webpack_require__(87), - Particles: __webpack_require__(823), - PathFollower: __webpack_require__(296), - RenderTexture: __webpack_require__(154), - RetroFont: __webpack_require__(814), - Sprite: __webpack_require__(61), - Text: __webpack_require__(153), - TileSprite: __webpack_require__(152), - Zone: __webpack_require__(125), + BuildGameObject: __webpack_require__(30), + BuildGameObjectAnimation: __webpack_require__(315), + GameObject: __webpack_require__(18), + BitmapText: __webpack_require__(117), + Blitter: __webpack_require__(171), + Container: __webpack_require__(170), + DynamicBitmapText: __webpack_require__(169), + Extern: __webpack_require__(312), + Graphics: __webpack_require__(168), + Group: __webpack_require__(94), + Image: __webpack_require__(93), + Particles: __webpack_require__(846), + PathFollower: __webpack_require__(300), + RenderTexture: __webpack_require__(164), + RetroFont: __webpack_require__(837), + Sprite: __webpack_require__(67), + Text: __webpack_require__(163), + TileSprite: __webpack_require__(162), + Zone: __webpack_require__(137), // Shapes - Shape: __webpack_require__(27), - Arc: __webpack_require__(293), - Curve: __webpack_require__(292), - Ellipse: __webpack_require__(291), - Grid: __webpack_require__(290), - IsoBox: __webpack_require__(289), - IsoTriangle: __webpack_require__(288), - Line: __webpack_require__(287), - Polygon: __webpack_require__(286), - Rectangle: __webpack_require__(281), - Star: __webpack_require__(280), - Triangle: __webpack_require__(279), + Shape: __webpack_require__(29), + Arc: __webpack_require__(298), + Curve: __webpack_require__(297), + Ellipse: __webpack_require__(296), + Grid: __webpack_require__(295), + IsoBox: __webpack_require__(294), + IsoTriangle: __webpack_require__(293), + Line: __webpack_require__(292), + Polygon: __webpack_require__(291), + Rectangle: __webpack_require__(286), + Star: __webpack_require__(285), + Triangle: __webpack_require__(284), // Game Object Factories Factories: { - Blitter: __webpack_require__(769), - Container: __webpack_require__(768), - DynamicBitmapText: __webpack_require__(767), - Graphics: __webpack_require__(766), - Group: __webpack_require__(765), - Image: __webpack_require__(764), - Particles: __webpack_require__(763), - PathFollower: __webpack_require__(762), - RenderTexture: __webpack_require__(761), - Sprite: __webpack_require__(760), - StaticBitmapText: __webpack_require__(759), - Text: __webpack_require__(758), - TileSprite: __webpack_require__(757), - Zone: __webpack_require__(756), + Blitter: __webpack_require__(792), + Container: __webpack_require__(791), + DynamicBitmapText: __webpack_require__(790), + Extern: __webpack_require__(789), + Graphics: __webpack_require__(788), + Group: __webpack_require__(787), + Image: __webpack_require__(786), + Particles: __webpack_require__(785), + PathFollower: __webpack_require__(784), + RenderTexture: __webpack_require__(783), + Sprite: __webpack_require__(782), + StaticBitmapText: __webpack_require__(781), + Text: __webpack_require__(780), + TileSprite: __webpack_require__(779), + Zone: __webpack_require__(778), // Shapes - Arc: __webpack_require__(755), - Curve: __webpack_require__(754), - Ellipse: __webpack_require__(753), - Grid: __webpack_require__(752), - IsoBox: __webpack_require__(751), - IsoTriangle: __webpack_require__(750), - Line: __webpack_require__(749), - Polygon: __webpack_require__(748), - Rectangle: __webpack_require__(747), - Star: __webpack_require__(746), - Triangle: __webpack_require__(745) + Arc: __webpack_require__(777), + Curve: __webpack_require__(776), + Ellipse: __webpack_require__(775), + Grid: __webpack_require__(774), + IsoBox: __webpack_require__(773), + IsoTriangle: __webpack_require__(772), + Line: __webpack_require__(771), + Polygon: __webpack_require__(770), + Rectangle: __webpack_require__(769), + Star: __webpack_require__(768), + Triangle: __webpack_require__(767) }, Creators: { - Blitter: __webpack_require__(744), - Container: __webpack_require__(743), - DynamicBitmapText: __webpack_require__(742), - Graphics: __webpack_require__(741), - Group: __webpack_require__(740), - Image: __webpack_require__(739), - Particles: __webpack_require__(738), - RenderTexture: __webpack_require__(737), - Sprite: __webpack_require__(736), - StaticBitmapText: __webpack_require__(735), - Text: __webpack_require__(734), - TileSprite: __webpack_require__(733), - Zone: __webpack_require__(732) + Blitter: __webpack_require__(766), + Container: __webpack_require__(765), + DynamicBitmapText: __webpack_require__(764), + Graphics: __webpack_require__(763), + Group: __webpack_require__(762), + Image: __webpack_require__(761), + Particles: __webpack_require__(760), + RenderTexture: __webpack_require__(759), + Sprite: __webpack_require__(758), + StaticBitmapText: __webpack_require__(757), + Text: __webpack_require__(756), + TileSprite: __webpack_require__(755), + Zone: __webpack_require__(754) } }; @@ -134718,835 +141931,31 @@ if (false) if (true) { // WebGL only Game Objects - GameObjects.Mesh = __webpack_require__(108); - GameObjects.Quad = __webpack_require__(149); + GameObjects.Mesh = __webpack_require__(116); + GameObjects.Quad = __webpack_require__(159); - GameObjects.Factories.Mesh = __webpack_require__(728); - GameObjects.Factories.Quad = __webpack_require__(727); + GameObjects.Factories.Mesh = __webpack_require__(750); + GameObjects.Factories.Quad = __webpack_require__(749); - GameObjects.Creators.Mesh = __webpack_require__(726); - GameObjects.Creators.Quad = __webpack_require__(725); + GameObjects.Creators.Mesh = __webpack_require__(748); + GameObjects.Creators.Quad = __webpack_require__(747); - GameObjects.Light = __webpack_require__(276); + GameObjects.Light = __webpack_require__(281); - __webpack_require__(275); - __webpack_require__(724); + __webpack_require__(280); + __webpack_require__(746); } module.exports = GameObjects; /***/ }), -/* 877 */ +/* 903 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Visibility Handler hidden event. - * - * The document in which the Game is embedded has entered a hidden state. - * - * @event Phaser.Boot.VisibilityHandler#hidden - */ - -/** - * Visibility Handler visible event. - * - * The document in which the Game is embedded has entered a visible state. - * - * @event Phaser.Boot.VisibilityHandler#visible - */ - -/** - * Visibility Handler blur event. - * - * The window in which the Game is embedded has entered a blurred state. - * - * @event Phaser.Boot.VisibilityHandler#blur - */ - -/** - * Visibility Handler focus event. - * - * The window in which the Game is embedded has entered a focused state. - * - * @event Phaser.Boot.VisibilityHandler#focus - */ - -/** - * The Visibility Handler is responsible for listening out for document level visibility change events. - * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses - * the provided Event Emitter and fires the related events. - * - * @function Phaser.Boot.VisibilityHandler - * @fires Phaser.Boot.VisibilityHandler#hidden - * @fires Phaser.Boot.VisibilityHandler#visible - * @fires Phaser.Boot.VisibilityHandler#blur - * @fires Phaser.Boot.VisibilityHandler#focus - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. - */ -var VisibilityHandler = function (game) -{ - var hiddenVar; - var eventEmitter = game.events; - - if (document.hidden !== undefined) - { - hiddenVar = 'visibilitychange'; - } - else - { - var vendors = [ 'webkit', 'moz', 'ms' ]; - - vendors.forEach(function (prefix) - { - if (document[prefix + 'Hidden'] !== undefined) - { - document.hidden = function () - { - return document[prefix + 'Hidden']; - }; - - hiddenVar = prefix + 'visibilitychange'; - } - - }); - } - - var onChange = function (event) - { - if (document.hidden || event.type === 'pause') - { - eventEmitter.emit('hidden'); - } - else - { - eventEmitter.emit('visible'); - } - }; - - if (hiddenVar) - { - document.addEventListener(hiddenVar, onChange, false); - } - - window.onblur = function () - { - eventEmitter.emit('blur'); - }; - - window.onfocus = function () - { - eventEmitter.emit('focus'); - }; - - // Automatically give the window focus unless config says otherwise - if (window.focus && game.config.autoFocus) - { - window.focus(); - - game.canvas.addEventListener('mousedown', function () - { - window.focus(); - }, { passive: true }); - } - - if (game.canvas) - { - game.canvas.onmouseout = function () - { - game.isOver = false; - eventEmitter.emit('mouseout'); - }; - - game.canvas.onmouseover = function () - { - game.isOver = true; - eventEmitter.emit('mouseover'); - }; - } -}; - -module.exports = VisibilityHandler; - - -/***/ }), -/* 878 */ -/***/ (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 GetValue = __webpack_require__(4); -var NOOP = __webpack_require__(1); -var RequestAnimationFrame = __webpack_require__(341); - -// Frame Rate config -// fps: { -// min: 10, -// target: 60, -// forceSetTimeOut: false, -// deltaHistory: 10, -// panicMax: 120 -// } - -// http://www.testufo.com/#test=animation-time-graph - -/** - * @callback TimeStepCallback - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} average - The Delta Average. - * @param {number} interpolation - Interpolation - how far between what is expected and where we are? - */ - -/** - * @classdesc - * [description] - * - * @class TimeStep - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. - * @param {FPSConfig} config - */ -var TimeStep = new Class({ - - initialize: - - function TimeStep (game, config) - { - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.Boot.TimeStep#game - * @type {Phaser.Game} - * @readonly - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#raf - * @type {Phaser.DOM.RequestAnimationFrame} - * @readonly - * @since 3.0.0 - */ - this.raf = new RequestAnimationFrame(); - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * - * @name Phaser.Boot.TimeStep#started - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.started = false; - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * The difference between this value and `started` is that `running` is toggled when - * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if - * the TimeStep is actually stopped, not just paused. - * - * @name Phaser.Boot.TimeStep#running - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.running = false; - - /** - * The minimum fps rate you want the Time Step to run at. - * - * @name Phaser.Boot.TimeStep#minFps - * @type {integer} - * @default 5 - * @since 3.0.0 - */ - this.minFps = GetValue(config, 'min', 5); - - /** - * The target fps rate for the Time Step to run at. - * - * Setting this value will not actually change the speed at which the browser runs, that is beyond - * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step - * is spiraling out of control. - * - * @name Phaser.Boot.TimeStep#targetFps - * @type {integer} - * @default 60 - * @since 3.0.0 - */ - this.targetFps = GetValue(config, 'target', 60); - - /** - * The minFps value in ms. - * Defaults to 200ms between frames (i.e. super slow!) - * - * @name Phaser.Boot.TimeStep#_min - * @type {number} - * @private - * @since 3.0.0 - */ - this._min = 1000 / this.minFps; - - /** - * The targetFps value in ms. - * Defaults to 16.66ms between frames (i.e. normal) - * - * @name Phaser.Boot.TimeStep#_target - * @type {number} - * @private - * @since 3.0.0 - */ - this._target = 1000 / this.targetFps; - - /** - * An exponential moving average of the frames per second. - * - * @name Phaser.Boot.TimeStep#actualFps - * @type {integer} - * @readonly - * @default 60 - * @since 3.0.0 - */ - this.actualFps = this.targetFps; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#nextFpsUpdate - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.nextFpsUpdate = 0; - - /** - * The number of frames processed this second. - * - * @name Phaser.Boot.TimeStep#framesThisSecond - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.framesThisSecond = 0; - - /** - * A callback to be invoked each time the Time Step steps. - * - * @name Phaser.Boot.TimeStep#callback - * @type {TimeStepCallback} - * @default NOOP - * @since 3.0.0 - */ - this.callback = NOOP; - - /** - * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting - * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. - * - * @name Phaser.Boot.TimeStep#forceSetTimeOut - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#time - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.time = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#startTime - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.startTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#lastTime - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.lastTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#frame - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.frame = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#inFocus - * @type {boolean} - * @readonly - * @default true - * @since 3.0.0 - */ - this.inFocus = true; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#_pauseTime - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._pauseTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#_coolDown - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._coolDown = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#delta - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.delta = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaIndex - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.deltaIndex = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaHistory - * @type {integer[]} - * @since 3.0.0 - */ - this.deltaHistory = []; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaSmoothingMax - * @type {integer} - * @default 10 - * @since 3.0.0 - */ - this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#panicMax - * @type {integer} - * @default 120 - * @since 3.0.0 - */ - this.panicMax = GetValue(config, 'panicMax', 120); - - /** - * The actual elapsed time in ms between one update and the next. - * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. - * So please be careful when using this value in calculations. - * - * @name Phaser.Boot.TimeStep#rawDelta - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.rawDelta = 0; - }, - - /** - * Called when the DOM window.onBlur event triggers. - * - * @method Phaser.Boot.TimeStep#blur - * @since 3.0.0 - */ - blur: function () - { - this.inFocus = false; - }, - - /** - * Called when the DOM window.onFocus event triggers. - * - * @method Phaser.Boot.TimeStep#focus - * @since 3.0.0 - */ - focus: function () - { - this.inFocus = true; - - this.resetDelta(); - }, - - /** - * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) - * - * @method Phaser.Boot.TimeStep#pause - * @since 3.0.0 - */ - pause: function () - { - this._pauseTime = window.performance.now(); - }, - - /** - * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) - * - * @method Phaser.Boot.TimeStep#resume - * @since 3.0.0 - */ - resume: function () - { - this.resetDelta(); - - this.startTime += this.time - this._pauseTime; - }, - - /** - * [description] - * - * @method Phaser.Boot.TimeStep#resetDelta - * @since 3.0.0 - */ - resetDelta: function () - { - var now = window.performance.now(); - - this.time = now; - this.lastTime = now; - this.nextFpsUpdate = now + 1000; - this.framesThisSecond = 0; - this.frame = 0; - - // Pre-populate smoothing array - - for (var i = 0; i < this.deltaSmoothingMax; i++) - { - this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); - } - - this.delta = 0; - this.deltaIndex = 0; - - this._coolDown = this.panicMax; - }, - - /** - * Starts the Time Step running, if it is not already doing so. - * Called automatically by the Game Boot process. - * - * @method Phaser.Boot.TimeStep#start - * @since 3.0.0 - * - * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. - */ - start: function (callback) - { - if (this.started) - { - return this; - } - - this.started = true; - this.running = true; - - for (var i = 0; i < this.deltaSmoothingMax; i++) - { - this.deltaHistory[i] = this._target; - } - - this.resetDelta(); - - this.startTime = window.performance.now(); - - this.callback = callback; - - this.raf.start(this.step.bind(this), this.forceSetTimeOut); - }, - - /** - * The main step method. This is called each time the browser updates, either by Request Animation Frame, - * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. - * You generally should never call this method directly. - * - * @method Phaser.Boot.TimeStep#step - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - */ - step: function (time) - { - this.frame++; - - var before = time - this.lastTime; - - if (before < 0) - { - // Because, Chrome. - before = 0; - } - - this.rawDelta = before; - - var idx = this.deltaIndex; - var history = this.deltaHistory; - var max = this.deltaSmoothingMax; - - // delta time (time is in ms) - var dt = before; - - // When a browser switches tab, then comes back again, it takes around 10 frames before - // the delta time settles down so we employ a 'cooling down' period before we start - // trusting the delta values again, to avoid spikes flooding through our delta average - - if (this._coolDown > 0 || !this.inFocus) - { - this._coolDown--; - - dt = Math.min(dt, this._target); - } - - if (dt > this._min) - { - // Probably super bad start time or browser tab context loss, - // so use the last 'sane' dt value - - dt = history[idx]; - - // Clamp delta to min (in case history has become corrupted somehow) - dt = Math.min(dt, this._min); - } - - // Smooth out the delta over the previous X frames - - // add the delta to the smoothing array - history[idx] = dt; - - // adjusts the delta history array index based on the smoothing count - // this stops the array growing beyond the size of deltaSmoothingMax - this.deltaIndex++; - - if (this.deltaIndex > max) - { - this.deltaIndex = 0; - } - - // Delta Average - var avg = 0; - - // Loop the history array, adding the delta values together - - for (var i = 0; i < max; i++) - { - avg += history[i]; - } - - // Then divide by the array length to get the average delta - avg /= max; - - // Set as the world delta value - this.delta = avg; - - // Real-world timer advance - this.time += this.rawDelta; - - // Update the estimate of the frame rate, `fps`. Every second, the number - // of frames that occurred in that second are included in an exponential - // moving average of all frames per second, with an alpha of 0.25. This - // means that more recent seconds affect the estimated frame rate more than - // older seconds. - // - // When a browser window is NOT minimized, but is covered up (i.e. you're using - // another app which has spawned a window over the top of the browser), then it - // will start to throttle the raf callback time. It waits for a while, and then - // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. - // So if the game was running at 60fps, and the player opens a new window, then - // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. - // - // When they make the game visible again, the frame rate is increased at a rate of - // approx. 8fps, back up to 60fps (or the max it can obtain) - // - // There is no easy way to determine if this drop in frame rate is because the - // browser is throttling raf, or because the game is struggling with performance - // because you're asking it to do too much on the device. - - if (time > this.nextFpsUpdate) - { - // Compute the new exponential moving average with an alpha of 0.25. - this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; - this.nextFpsUpdate = time + 1000; - this.framesThisSecond = 0; - } - - this.framesThisSecond++; - - // Interpolation - how far between what is expected and where we are? - var interpolation = avg / this._target; - - this.callback(time, avg, interpolation); - - // Shift time value over - this.lastTime = time; - }, - - /** - * Manually calls TimeStep.step, passing in the performance.now value to it. - * - * @method Phaser.Boot.TimeStep#tick - * @since 3.0.0 - */ - tick: function () - { - this.step(window.performance.now()); - }, - - /** - * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. - * - * @method Phaser.Boot.TimeStep#sleep - * @since 3.0.0 - */ - sleep: function () - { - if (this.running) - { - this.raf.stop(); - - this.running = false; - } - }, - - /** - * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. - * The `seamless` argument controls if the wake-up should adjust the start time or not. - * - * @method Phaser.Boot.TimeStep#wake - * @since 3.0.0 - * - * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. - */ - wake: function (seamless) - { - if (this.running) - { - this.sleep(); - } - else if (seamless) - { - this.startTime += -this.lastTime + (this.lastTime = window.performance.now()); - } - - this.raf.start(this.step.bind(this), this.useRAF); - - this.running = true; - - this.step(window.performance.now()); - }, - - /** - * Stops the TimeStep running. - * - * @method Phaser.Boot.TimeStep#stop - * @since 3.0.0 - * - * @return {Phaser.Boot.TimeStep} The TimeStep object. - */ - stop: function () - { - this.running = false; - this.started = false; - - this.raf.stop(); - - return this; - }, - - /** - * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null - * any objects. - * - * @method Phaser.Boot.TimeStep#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); - - this.callback = NOOP; - - this.raf = null; - this.game = null; - } - -}); - -module.exports = TimeStep; - - -/***/ }), -/* 879 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135711,12 +142120,12 @@ TextureImporter: /***/ }), -/* 880 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135738,8 +142147,8 @@ var GetFastValue = __webpack_require__(2); * @param {object} config - An object describing how to parse the Sprite Sheet. * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. - * @param {number} [config.startFrame=0] - [description] - * @param {number} [config.endFrame=-1] - [description] + * @param {number} [config.startFrame=0] - Index of the start frame in the sprite sheet + * @param {number} [config.endFrame=-1] - Index of the end frame in the sprite sheet. -1 mean all the rest of the frames * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. * @@ -135833,27 +142242,33 @@ var SpriteSheetFromAtlas = function (texture, frame, config) { var destX = (leftRow) ? leftPad : 0; var destY = (topRow) ? topPad : 0; - var destWidth = frameWidth; - var destHeight = frameHeight; + + var trimWidth = 0; + var trimHeight = 0; if (leftRow) { - destWidth = leftWidth; + trimWidth += (frameWidth - leftWidth); } - else if (rightRow) + + if (rightRow) { - destWidth = rightWidth; + trimWidth += (frameWidth - rightWidth); } if (topRow) { - destHeight = topHeight; + trimHeight += (frameHeight - topHeight); } - else if (bottomRow) + + if (bottomRow) { - destHeight = bottomHeight; + trimHeight += (frameHeight - bottomHeight); } + var destWidth = frameWidth - trimWidth; + var destHeight = frameHeight - trimHeight; + sheetFrame.cutWidth = destWidth; sheetFrame.cutHeight = destHeight; @@ -135868,7 +142283,7 @@ var SpriteSheetFromAtlas = function (texture, frame, config) } else if (rightRow) { - frameX += rightRow; + frameX += rightWidth; } else { @@ -135902,12 +142317,12 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 881 */ +/* 905 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136027,16 +142442,16 @@ module.exports = SpriteSheet; /***/ }), -/* 882 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -136126,16 +142541,16 @@ module.exports = JSONHash; /***/ }), -/* 883 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -136233,12 +142648,12 @@ module.exports = JSONArray; /***/ }), -/* 884 */ +/* 908 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136268,12 +142683,12 @@ module.exports = Image; /***/ }), -/* 885 */ +/* 909 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136303,12 +142718,12 @@ module.exports = Canvas; /***/ }), -/* 886 */ +/* 910 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136384,19 +142799,20 @@ module.exports = AtlasXML; /***/ }), -/* 887 */ +/* 911 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Color = __webpack_require__(37); -var IsSizePowerOfTwo = __webpack_require__(117); -var Texture = __webpack_require__(165); +var Clamp = __webpack_require__(23); +var Color = __webpack_require__(32); +var IsSizePowerOfTwo = __webpack_require__(127); +var Texture = __webpack_require__(175); /** * @classdesc @@ -136612,6 +143028,148 @@ var CanvasTexture = new Class({ return this.update(); }, + /** + * Draws the given texture frame to this CanvasTexture, then updates the internal + * ImageData buffer and arrays. + * + * @method Phaser.Textures.CanvasTexture#drawFrame + * @since 3.16.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {integer} [x=0] - The x coordinate to draw the source at. + * @param {integer} [y=0] - The y coordinate to draw the source at. + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + drawFrame: function (key, frame, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + var textureFrame = this.manager.getFrame(key, frame); + + if (textureFrame) + { + var cd = textureFrame.canvasData; + + var width = textureFrame.cutWidth; + var height = textureFrame.cutHeight; + var res = textureFrame.source.resolution; + + this.context.drawImage( + textureFrame.source.image, + cd.x, cd.y, + width, + height, + x, y, + width / res, + height / res + ); + + return this.update(); + } + else + { + return this; + } + }, + + /** + * Sets a pixel in the CanvasTexture to the given color and alpha values. + * + * This is an expensive operation to run in large quantities, so use sparingly. + * + * @method Phaser.Textures.CanvasTexture#setPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @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=255] - The alpha value. A number between 0 and 255. + * + * @return {this} This CanvasTexture. + */ + setPixel: function (x, y, red, green, blue, alpha) + { + if (alpha === undefined) { alpha = 255; } + + x = Math.abs(Math.floor(x)); + y = Math.abs(Math.floor(y)); + + var index = this.getIndex(x, y); + + if (index > -1) + { + var imageData = this.context.getImageData(x, y, 1, 1); + + imageData.data[0] = red; + imageData.data[1] = green; + imageData.data[2] = blue; + imageData.data[3] = alpha; + + this.context.putImageData(imageData, x, y); + } + + return this; + }, + + /** + * Puts the ImageData into the context of this CanvasTexture at the given coordinates. + * + * @method Phaser.Textures.CanvasTexture#putData + * @since 3.16.0 + * + * @param {ImageData} imageData - The ImageData to put at the given location. + * @param {integer} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {integer} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. + * + * @return {this} This CanvasTexture. + */ + putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) + { + if (dirtyX === undefined) { dirtyX = 0; } + if (dirtyY === undefined) { dirtyY = 0; } + if (dirtyWidth === undefined) { dirtyWidth = imageData.width; } + if (dirtyHeight === undefined) { dirtyHeight = imageData.height; } + + this.context.putImageData(imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight); + + return this; + }, + + /** + * Gets an ImageData region from this CanvasTexture from the position and size specified. + * You can write this back using `CanvasTexture.putData`, or manipulate it. + * + * @method Phaser.Textures.CanvasTexture#getData + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {integer} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. + * + * @return {ImageData} The ImageData extracted from this CanvasTexture. + */ + getData: function (x, y, width, height) + { + x = Clamp(Math.floor(x), 0, this.width - 1); + y = Clamp(Math.floor(y), 0, this.height - 1); + width = Clamp(width, 1, this.width - x); + height = Clamp(height, 1, this.height - y); + + var imageData = this.context.getImageData(x, y, width, height); + + return imageData; + }, + /** * Get the color of a specific pixel from this texture and store it in a Color object. * @@ -136621,9 +143179,9 @@ var CanvasTexture = new Class({ * @method Phaser.Textures.CanvasTexture#getPixel * @since 3.13.0 * - * @param {integer} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {Phaser.Display.Color} [out] - An object into which 4 properties will be set: r, g, b and a. If not provided a Color object will be created. + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. * * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. */ @@ -136634,16 +143192,115 @@ var CanvasTexture = new Class({ out = new Color(); } - var index = ~~(x + (y * this.width)); + var index = this.getIndex(x, y); - index *= 4; + if (index > -1) + { + var data = this.data; - var r = this.data[index]; - var g = this.data[++index]; - var b = this.data[++index]; - var a = this.data[++index]; + var r = data[index + 0]; + var g = data[index + 1]; + var b = data[index + 2]; + var a = data[index + 3]; - return out.setTo(r, g, b, a); + out.setTo(r, g, b, a); + } + + return out; + }, + + /** + * An object containing the position and color data for a single pixel in a CanvasTexture. + * + * @typedef {object} PixelConfig + * + * @property {integer} x - The x-coordinate of the pixel. + * @property {integer} y - The y-coordinate of the pixel. + * @property {integer} color - The color of the pixel, not including the alpha channel. + * @property {float} alpha - The alpha of the pixel, between 0 and 1. + */ + + /** + * Returns an array containing all of the pixels in the given region. + * + * If the requested region extends outside the bounds of this CanvasTexture, + * the region is truncated to fit. + * + * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, + * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. + * + * @method Phaser.Textures.CanvasTexture#getPixels + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} width - The width of the region to get. Must be an integer. + * @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. + * + * @return {PixelConfig[]} An array of Pixel objects. + */ + getPixels: function (x, y, width, height) + { + if (height === undefined) { height = width; } + + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); + + var left = Clamp(x, 0, this.width); + var right = Clamp(x + width, 0, this.width); + var top = Clamp(y, 0, this.height); + var bottom = Clamp(y + height, 0, this.height); + + var pixel = new Color(); + + var out = []; + + for (var py = top; py < bottom; py++) + { + var row = []; + + for (var px = left; px < right; px++) + { + pixel = this.getPixel(px, py, pixel); + + row.push({ x: px, y: py, color: pixel.color, alpha: pixel.alphaGL }); + } + + out.push(row); + } + + return out; + }, + + /** + * Returns the Image Data index for the given pixel in this CanvasTexture. + * + * The index can be used to read directly from the `this.data` array. + * + * The index points to the red value in the array. The subsequent 3 indexes + * point to green, blue and alpha respectively. + * + * @method Phaser.Textures.CanvasTexture#getIndex + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @return {integer} + */ + getIndex: function (x, y) + { + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); + + if (x < this.width && y < this.height) + { + return (x + y * this.width) * 4; + } + else + { + return -1; + } }, /** @@ -136690,16 +143347,27 @@ var CanvasTexture = new Class({ }, /** - * Clears this Canvas Texture, resetting it back to transparent. + * Clears the given region of this Canvas Texture, resetting it back to transparent. + * If no region is given, the whole Canvas Texture is cleared. * * @method Phaser.Textures.CanvasTexture#clear * @since 3.7.0 + * + * @param {integer} [x=0] - The x coordinate of the top-left of the region to clear. + * @param {integer} [y=0] - The y coordinate of the top-left of the region to clear. + * @param {integer} [width] - The width of the region. + * @param {integer} [height] - The height of the region. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ - clear: function () + clear: function (x, y, width, height) { - this.context.clearRect(0, 0, this.width, this.height); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + + this.context.clearRect(x, y, width, height); return this.update(); }, @@ -136737,6 +143405,25 @@ var CanvasTexture = new Class({ } return this; + }, + + /** + * Destroys this Texture and releases references to its sources and frames. + * + * @method Phaser.Textures.CanvasTexture#destroy + * @since 3.16.0 + */ + destroy: function () + { + Texture.prototype.destroy.call(this); + + this._source = null; + this.canvas = null; + this.context = null; + this.imageData = null; + this.data = null; + this.pixels = null; + this.buffer = null; } }); @@ -136745,12 +143432,633 @@ module.exports = CanvasTexture; /***/ }), -/* 888 */ +/* 912 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Volume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their volume changes. + * + * Listen to it from a Sound instance using `Sound.on('volume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('volume', listener); + * music.play(); + * music.setVolume(0.5); + * ``` + * + * @event Phaser.Sound.Events#VOLUME + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} volume - The new volume of the Sound. + */ +module.exports = 'volume'; + + +/***/ }), +/* 913 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Unlocked Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched during the update loop when the Sound Manager becomes unlocked. For + * Web Audio this is on the first user gesture on the page. + * + * Listen to it from a Scene using: `this.sound.on('unlocked', listener)`. + * + * @event Phaser.Sound.Events#UNLOCKED + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'unlocked'; + + +/***/ }), +/* 914 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Stop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are stopped. + * + * Listen to it from a Sound instance using `Sound.on('stop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('stop', listener); + * music.play(); + * music.stop(); + * ``` + * + * @event Phaser.Sound.Events#STOP + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'stop'; + + +/***/ }), +/* 915 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Stop All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `stopAll` method is invoked and after all current Sounds + * have been stopped. + * + * Listen to it from a Scene using: `this.sound.on('stopall', listener)`. + * + * @event Phaser.Sound.Events#STOP_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'stopall'; + + +/***/ }), +/* 916 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Seek Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are seeked to a new position. + * + * Listen to it from a Sound instance using `Sound.on('seek', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('seek', listener); + * music.play(); + * music.setSeek(5000); + * ``` + * + * @event Phaser.Sound.Events#SEEK + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'seek'; + + +/***/ }), +/* 917 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Resume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are resumed from a paused state. + * + * Listen to it from a Sound instance using `Sound.on('resume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('resume', listener); + * music.play(); + * music.pause(); + * music.resume(); + * ``` + * + * @event Phaser.Sound.Events#RESUME + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'resume'; + + +/***/ }), +/* 918 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `resumeAll` method is invoked and after all current Sounds + * have been resumed. + * + * Listen to it from a Scene using: `this.sound.on('resumeall', listener)`. + * + * @event Phaser.Sound.Events#RESUME_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'resumeall'; + + +/***/ }), +/* 919 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Rate Change Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their rate changes. + * + * Listen to it from a Sound instance using `Sound.on('rate', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('rate', listener); + * music.play(); + * music.setRate(0.5); + * ``` + * + * @event Phaser.Sound.Events#RATE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} rate - The new rate of the Sound. + */ +module.exports = 'rate'; + + +/***/ }), +/* 920 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Play Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are played. + * + * Listen to it from a Sound instance using `Sound.on('play', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('play', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#PLAY + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'play'; + + +/***/ }), +/* 921 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Pause Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are paused. + * + * Listen to it from a Sound instance using `Sound.on('pause', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('pause', listener); + * music.play(); + * music.pause(); + * ``` + * + * @event Phaser.Sound.Events#PAUSE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'pause'; + + +/***/ }), +/* 922 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `pauseAll` method is invoked and after all current Sounds + * have been paused. + * + * Listen to it from a Scene using: `this.sound.on('pauseall', listener)`. + * + * @event Phaser.Sound.Events#PAUSE_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'pauseall'; + + +/***/ }), +/* 923 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Mute Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their mute state changes. + * + * Listen to it from a Sound instance using `Sound.on('mute', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('mute', listener); + * music.play(); + * music.setMute(true); + * ``` + * + * @event Phaser.Sound.Events#MUTE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound is now muted, otherwise `false`. + */ +module.exports = 'mute'; + + +/***/ }), +/* 924 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Looped Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they loop during playback. + * + * Listen to it from a Sound instance using `Sound.on('looped', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('looped', listener); + * music.setLoop(true); + * music.play(); + * ``` + * + * This is not to be confused with the [LOOP]{@linkcode Phaser.Sound.Events#event:LOOP} event, which only emits when the loop state of a Sound is changed. + * + * @event Phaser.Sound.Events#LOOPED + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'looped'; + + +/***/ }), +/* 925 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Loop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their loop state is changed. + * + * Listen to it from a Sound instance using `Sound.on('loop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('loop', listener); + * music.setLoop(true); + * ``` + * + * This is not to be confused with the [LOOPED]{@linkcode Phaser.Sound.Events#event:LOOPED} event, which emits each time a Sound loops during playback. + * + * @event Phaser.Sound.Events#LOOP + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} loop - The new loop value. `true` if the Sound will loop, otherwise `false`. + */ +module.exports = 'loop'; + + +/***/ }), +/* 926 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Volume Event. + * + * This event is dispatched by the Sound Manager when its `volume` property is changed, either directly + * or via the `setVolume` method. This changes the volume of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('volume', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_VOLUME + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {number} volume - The new global volume of the Sound Manager. + */ +module.exports = 'volume'; + + +/***/ }), +/* 927 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Rate Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `rate` property of the Sound Manager is changed, which globally + * adjusts the playback rate of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_RATE + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} rate - The updated rate value. + */ +module.exports = 'rate'; + + +/***/ }), +/* 928 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Mute Event. + * + * This event is dispatched by the Sound Manager when its `mute` property is changed, either directly + * or via the `setMute` method. This changes the mute state of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('mute', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_MUTE + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. + */ +module.exports = 'mute'; + + +/***/ }), +/* 929 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Detune Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `detune` property of the Sound Manager is changed, which globally + * adjusts the detuning of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_DETUNE + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} detune - The updated detune value. + */ +module.exports = 'detune'; + + +/***/ }), +/* 930 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Detune Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their detune value changes. + * + * Listen to it from a Sound instance using `Sound.on('detune', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('detune', listener); + * music.play(); + * music.setDetune(200); + * ``` + * + * @event Phaser.Sound.Events#DETUNE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'detune'; + + +/***/ }), +/* 931 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Destroy Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are destroyed, either + * directly or via a Sound Manager. + * + * Listen to it from a Sound instance using `Sound.on('destroy', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('destroy', listener); + * music.destroy(); + * ``` + * + * @event Phaser.Sound.Events#DESTROY + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 932 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Complete Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they complete playback. + * + * Listen to it from a Sound instance using `Sound.on('complete', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('complete', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#COMPLETE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'complete'; + + +/***/ }), +/* 933 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136772,6 +144080,7 @@ var InjectionMap = { cache: 'cache', plugins: 'plugins', registry: 'registry', + scale: 'scale', sound: 'sound', textures: 'textures', @@ -136805,12 +144114,12 @@ module.exports = InjectionMap; /***/ }), -/* 889 */ +/* 934 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136822,9 +144131,9 @@ var GetFastValue = __webpack_require__(2); * @function Phaser.Scenes.GetScenePlugins * @since 3.0.0 * - * @param {Phaser.Scenes.Systems} sys - [description] + * @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins. * - * @return {array} [description] + * @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object. */ var GetScenePlugins = function (sys) { @@ -136852,17 +144161,17 @@ module.exports = GetScenePlugins; /***/ }), -/* 890 */ +/* 935 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(327); +var UppercaseFirst = __webpack_require__(330); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -136914,137 +144223,5252 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 891 */ +/* 936 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Start Event. + * + * This event is dispatched when the Loader starts running. At this point load progress is zero. + * + * This event is dispatched even if there aren't any files in the load queue. + * + * Listen to it from a Scene using: `this.load.on('start', listener)`. + * + * @event Phaser.Loader.Events#START + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'start'; + + +/***/ }), +/* 937 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Progress Event. + * + * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading. + * + * Listen to it from a Scene using: `this.load.on('progress', listener)`. + * + * @event Phaser.Loader.Events#PROGRESS + * + * @param {number} progress - The current progress of the load. A value between 0 and 1. + */ +module.exports = 'progress'; + + +/***/ }), +/* 938 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Post Process Event. + * + * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue. + * It is dispatched before the internal lists are cleared and each File is destroyed. + * + * Use this hook to perform any last minute processing of files that can only happen once the + * Loader has completed, but prior to it emitting the `complete` event. + * + * Listen to it from a Scene using: `this.load.on('postprocess', listener)`. + * + * @event Phaser.Loader.Events#POST_PROCESS + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'postprocess'; + + +/***/ }), +/* 939 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Progress Event. + * + * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and + * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen. + * + * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`. + * + * @event Phaser.Loader.Events#FILE_PROGRESS + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + * @param {number} percentComplete - A value between 0 and 1 indicating how 'complete' this file is. + */ +module.exports = 'fileprogress'; + + +/***/ }), +/* 940 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Event. + * + * This event is dispatched by the Loader Plugin when a file finishes loading, + * but _before_ it is processed and added to the internal Phaser caches. + * + * Listen to it from a Scene using: `this.load.on('load', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD + * + * @param {Phaser.Loader.File} file - A reference to the File which just finished loading. + */ +module.exports = 'load'; + + +/***/ }), +/* 941 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Error Event. + * + * This event is dispatched by the Loader Plugin when a file fails to load. + * + * Listen to it from a Scene using: `this.load.on('loaderror', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD_ERROR + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + */ +module.exports = 'loaderror'; + + +/***/ }), +/* 942 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * It uses a special dynamic event name constructed from the key and type of the file. + * + * For example, if you have loaded an `image` with a key of `monster`, you can listen for it + * using the following: + * + * ```javascript + * this.load.on('filecomplete-image-monster', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a texture `atlas` with a key of `Level1`: + * + * ```javascript + * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: + * + * ```javascript + * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_KEY_COMPLETE + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete-'; + + +/***/ }), +/* 943 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`. + * + * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_COMPLETE + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete'; + + +/***/ }), +/* 944 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Complete Event. + * + * This event is dispatched when the Loader has fully processed everything in the load queue. + * By this point every loaded file will now be in its associated cache and ready for use. + * + * Listen to it from a Scene using: `this.load.on('complete', listener)`. + * + * @event Phaser.Loader.Events#COMPLETE + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {integer} totalComplete - The total number of files that successfully loaded. + * @param {integer} totalFailed - The total number of files that failed to load. + */ +module.exports = 'complete'; + + +/***/ }), +/* 945 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Add File Event. + * + * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue. + * + * Listen to it from a Scene using: `this.load.on('addfile', listener)`. + * + * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them. + * + * @event Phaser.Loader.Events#ADD + * + * @param {string} key - The unique key of the file that was added to the Loader. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} string of the file that was added to the Loader, i.e. `image`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {Phaser.Loader.File} file - A reference to the File which was added to the Loader. + */ +module.exports = 'addfile'; + + +/***/ }), +/* 946 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetInnerHeight = function (iOS) +{ + // Based on code by @tylerjpeterson + + if (!iOS) + { + return window.innerHeight; + } + + var axis = Math.abs(window.orientation); + + var size = { w: 0, h: 0 }; + + var ruler = document.createElement('div'); + + ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); + + document.documentElement.appendChild(ruler); + + size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; + size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; + + document.documentElement.removeChild(ruler); + + ruler = null; + + if (Math.abs(window.orientation) !== 90) + { + return size.h; + } + else + { + return size.w; + } +}; + +module.exports = GetInnerHeight; + + +/***/ }), +/* 947 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * This event is dispatched whenever the Scale Manager detects a resize event from the browser. + * It sends three parameters to the callback, each of them being Size components. You can read + * the `width`, `height`, `aspectRatio` and other properties of these components to help with + * scaling your own game content. + * + * @event Phaser.Scale.Events#RESIZE + * + * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size multiplied by resolution. + * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. + */ +module.exports = 'resize'; + + +/***/ }), +/* 948 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#ORIENTATION_CHANGE + * + * @param {string} orientation - + */ +module.exports = 'orientationchange'; + + +/***/ }), +/* 949 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#LEAVE_FULLSCREEN + */ +module.exports = 'leavefullscreen'; + + +/***/ }), +/* 950 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + */ +module.exports = 'fullscreenunsupported'; + + +/***/ }), +/* 951 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#ENTER_FULLSCREEN + */ +module.exports = 'enterfullscreen'; + + +/***/ }), +/* 952 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `update` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#UPDATE + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; + + +/***/ }), +/* 953 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Start Event. + * + * This internal event is dispatched by the Input Plugin when it has finished setting-up, + * signalling to all of its internal systems to start. + * + * @event Phaser.Input.Events#START + */ +module.exports = 'start'; + + +/***/ }), +/* 954 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Shutdown Event. + * + * This internal event is dispatched by the Input Plugin when it shuts down, signalling to all of its systems to shut themselves down. + * + * @event Phaser.Input.Events#SHUTDOWN + */ +module.exports = 'shutdown'; + + +/***/ }), +/* 955 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Pre-Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `preUpdate` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#PRE_UPDATE + */ +module.exports = 'preupdate'; + + +/***/ }), +/* 956 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Pointer Lock Change Event. + * + * This event is dispatched by the Input Manager when it is processing a native Pointer Lock Change DOM Event. + * + * @event Phaser.Input.Events#POINTERLOCK_CHANGE + * + * @param {Event} event - The native DOM Event. + * @param {boolean} locked - The locked state of the Mouse Pointer. + */ +module.exports = 'pointerlockchange'; + + +/***/ }), +/* 957 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerupoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP_OUTSIDE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerupoutside'; + + +/***/ }), +/* 958 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerup'; + + +/***/ }), +/* 959 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerover', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOver - An array containing all interactive Game Objects that the pointer moved over when the event was created. + */ +module.exports = 'pointerover'; + + +/***/ }), +/* 960 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOut - An array containing all interactive Game Objects that the pointer moved out of when the event was created. + */ +module.exports = 'pointerout'; + + +/***/ }), +/* 961 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointermove', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointermove'; + + +/***/ }), +/* 962 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdownoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN_OUTSIDE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerdownoutside'; + + +/***/ }), +/* 963 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdown', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerdown'; + + +/***/ }), +/* 964 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Update Event. + * + * This internal event is dispatched by the Input Manager as part of its update step. + * + * @event Phaser.Input.Events#MANAGER_UPDATE + */ +module.exports = 'update'; + + +/***/ }), +/* 965 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Process Event. + * + * This internal event is dispatched by the Input Manager when not using the legacy queue system, + * and it wants the Input Plugins to update themselves. + * + * @event Phaser.Input.Events#MANAGER_PROCESS + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'process'; + + +/***/ }), +/* 966 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Boot Event. + * + * This internal event is dispatched by the Input Manager when it boots. + * + * @event Phaser.Input.Events#MANAGER_BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 967 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released while over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectup', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when released. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectup'; + + +/***/ }), +/* 968 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Up Event. + * + * This event is dispatched by an interactive Game Object if a pointer is released while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerup', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerup'; + + +/***/ }), +/* 969 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerover'; + + +/***/ }), +/* 970 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Out Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves out of it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerout', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerout'; + + +/***/ }), +/* 971 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Move Event. + * + * This event is dispatched by an interactive Game Object if a pointer is moved while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointermove', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointermove'; + + +/***/ }), +/* 972 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Down Event. + * + * This event is dispatched by an interactive Game Object if a pointer is pressed down on it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerdown', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerdown'; + + +/***/ }), +/* 973 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectover', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved over. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectover'; + + +/***/ }), +/* 974 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectout', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved out of. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectout'; + + +/***/ }), +/* 975 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved across _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectmove', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was moved on. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectmove'; + + +/***/ }), +/* 976 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drop Event. + * + * This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target. + * + * Listen to this event from a Game Object using: `gameObject.on('drop', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DROP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; + + +/***/ }), +/* 977 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Start Event. + * + * This event is dispatched by an interactive Game Object if a pointer starts to drag it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragstart', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * There are lots of useful drag related properties that are set within the Game Object when dragging occurs. + * For example, `gameObject.input.dragStartX`, `dragStartY` and so on. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_START + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 978 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it over a drag target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from a Game Object using: `gameObject.on('dragover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; + + +/***/ }), +/* 979 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Leave Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragleave', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; + + +/***/ }), +/* 980 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves while dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('drag', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; + + +/***/ }), +/* 981 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Enter Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it into a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragenter', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; + + +/***/ }), +/* 982 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag End Event. + * + * This event is dispatched by an interactive Game Object if a pointer stops dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragend', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive](Phaser.GameObjects.GameObject#setInteractive) for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_END + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer stopped dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer stopped dragging the Game Object, in world space. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 983 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down on _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectdown', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was pressed down on. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectdown'; + + +/***/ }), +/* 984 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Over Event. + * + * This event is dispatched by the Input Plugin if the active pointer enters the game canvas and is now + * over of it, having previously been elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameover', listener)`. + * + * @event Phaser.Input.Events#GAME_OVER + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas over. + */ +module.exports = 'gameover'; + + +/***/ }), +/* 985 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Out Event. + * + * This event is dispatched by the Input Plugin if the active pointer leaves the game canvas and is now + * outside of it, elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameout', listener)`. + * + * @event Phaser.Input.Events#GAME_OUT + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas out. + */ +module.exports = 'gameout'; + + +/***/ }), +/* 986 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drop Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drops a Game Object on a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('drop', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DROP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DROP} event instead. + * + * @event Phaser.Input.Events#DROP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer was dragging. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; + + +/***/ }), +/* 987 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Start Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer starts to drag any Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragstart', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_START]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_START} event instead. + * + * @event Phaser.Input.Events#DRAG_START + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 988 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object over a Drag Target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from within a Scene using: `this.input.on('dragover', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_OVER} event instead. + * + * @event Phaser.Input.Events#DRAG_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; + + +/***/ }), +/* 989 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Leave Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object out of a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragleave', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_LEAVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_LEAVE} event instead. + * + * @event Phaser.Input.Events#DRAG_LEAVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; + + +/***/ }), +/* 990 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves while dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('drag', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG} event instead. + * + * @event Phaser.Input.Events#DRAG + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; + + +/***/ }), +/* 991 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Enter Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object into a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragenter', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_ENTER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_ENTER} event instead. + * + * @event Phaser.Input.Events#DRAG_ENTER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; + + +/***/ }), +/* 992 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag End Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer stops dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragend', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_END]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_END} event instead. + * + * @event Phaser.Input.Events#DRAG_END + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer stopped dragging. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 993 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Destroy Event. + * + * This internal event is dispatched by the Input Plugin when it is destroyed, signalling to all of its systems to destroy themselves. + * + * @event Phaser.Input.Events#DESTROY + */ +module.exports = 'destroy'; + + +/***/ }), +/* 994 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Boot Event. + * + * This internal event is dispatched by the Input Plugin when it boots, signalling to all of its systems to create themselves. + * + * @event Phaser.Input.Events#BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 995 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(26); +var AddToDOM = __webpack_require__(179); +var AnimationManager = __webpack_require__(415); +var CacheManager = __webpack_require__(412); +var CanvasPool = __webpack_require__(24); +var Class = __webpack_require__(0); +var Config = __webpack_require__(390); +var CreateRenderer = __webpack_require__(367); +var DataManager = __webpack_require__(134); +var DebugHeader = __webpack_require__(365); +var Device = __webpack_require__(389); +var DOMContentLoaded = __webpack_require__(351); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(26); +var InputManager = __webpack_require__(342); +var PluginCache = __webpack_require__(17); +var PluginManager = __webpack_require__(336); +var ScaleManager = __webpack_require__(335); +var SceneManager = __webpack_require__(332); +var SoundManagerCreator = __webpack_require__(328); +var TextureEvents = __webpack_require__(126); +var TextureManager = __webpack_require__(321); +var TimeStep = __webpack_require__(364); +var VisibilityHandler = __webpack_require__(362); + +if (false) +{ var CreateDOMContainer; } + +if (false) +{ var FacebookInstantGamesPlugin; } /** - * Called automatically by Phaser.Game and responsible for creating the console.log debug header. + * @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 can customize or disable the header via the Game Config object. + * 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. * - * @function Phaser.Boot.DebugHeader + * @class Game + * @memberof Phaser + * @constructor + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE * @since 3.0.0 * - * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. + * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. */ -var DebugHeader = function (game) -{ - var config = game.config; +var Game = new Class({ - if (config.hideBanner) + initialize: + + function Game (config) { - return; - } + /** + * 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.Core.Config} + * @readonly + * @since 3.0.0 + */ + this.config = new Config(config); - var renderType = 'WebGL'; + /** + * 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; - if (config.renderType === CONST.CANVAS) + if (false) + {} + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * This is created automatically by Phaser unless you provide a `canvas` property + * in your Game Config. + * + * @name Phaser.Game#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = null; + + /** + * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. + * If the game is running under Canvas it will be a 2d Canvas Rendering Context. + * If the game is running under WebGL it will be a WebGL Rendering Context. + * This context is created automatically by Phaser unless you provide a `context` property + * in your Game Config. + * + * @name Phaser.Game#context + * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} + * @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 {Phaser.Events.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); + + /** + * An instance of the Data Manager + * + * @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); + + /** + * 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.DeviceConf} + * @since 3.0.0 + */ + this.device = Device; + + /** + * An instance of the Scale Manager. + * + * The Scale Manager is a global system responsible for handling scaling of the game canvas. + * + * @name Phaser.Game#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scale = new ScaleManager(this, this.config); + + /** + * 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.Sound.BaseSoundManager} + * @since 3.0.0 + */ + this.sound = SoundManagerCreator.create(this); + + /** + * 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.Core.TimeStep} + * @since 3.0.0 + */ + this.loop = new TimeStep(this, this.config.fps); + + /** + * 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.Plugins.PluginManager} + * @since 3.0.0 + */ + this.plugins = new PluginManager(this, this.config); + + if (false) + {} + + /** + * Is this Game pending destruction at the start of the next frame? + * + * @name Phaser.Game#pendingDestroy + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.pendingDestroy = false; + + /** + * Remove the Canvas once the destroy is over? + * + * @name Phaser.Game#removeCanvas + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.removeCanvas = false; + + /** + * Remove everything when the game is destroyed. + * You cannot create a new Phaser instance on the same web page after doing this. + * + * @name Phaser.Game#noReturn + * @type {boolean} + * @private + * @since 3.12.0 + */ + this.noReturn = false; + + /** + * Does the window the game is running in currently have focus or not? + * This is modified by the VisibilityHandler. + * + * @name Phaser.Game#hasFocus + * @type {boolean} + * @readonly + * @since 3.9.0 + */ + this.hasFocus = false; + + // Wait for the DOM Ready event, then call boot. + DOMContentLoaded(this.boot.bind(this)); + }, + + /** + * 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.Core.Events#BOOT + * @listens Phaser.Textures.Events#READY + * @since 3.0.0 + */ + boot: function () { - renderType = 'Canvas'; - } - else if (config.renderType === CONST.HEADLESS) - { - renderType = 'Headless'; - } - - var audioConfig = config.audio; - var deviceAudio = game.device.audio; - - var audioType; - - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) - { - audioType = 'Web Audio'; - } - else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) - { - audioType = 'No Audio'; - } - else - { - audioType = 'HTML5 Audio'; - } - - if (!game.device.browser.ie) - { - var c = ''; - var args = [ c ]; - - if (Array.isArray(config.bannerBackgroundColor)) + if (!PluginCache.hasCore('EventEmitter')) { - var lastColor; + console.warn('Aborting. Core Plugins missing.'); + return; + } - config.bannerBackgroundColor.forEach(function (color) - { - c = c.concat('%c '); + this.isBooted = true; - args.push('background: ' + color); + this.config.preBoot(this); - lastColor = color; + this.scale.preBoot(); - }); + CreateRenderer(this); - // inject the text color - args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + if (false) + {} + + DebugHeader(this); + + AddToDOM(this.canvas, this.config.parent); + + // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready. + // So it will emit this internal event when done: + this.textures.once(TextureEvents.READY, this.texturesReady, this); + + this.events.emit(Events.BOOT); + }, + + /** + * Called automatically when the Texture Manager has finished setting up and preparing the + * default textures. + * + * @method Phaser.Game#texturesReady + * @private + * @fires Phaser.Game#ready + * @since 3.12.0 + */ + texturesReady: function () + { + // Start all the other systems + this.events.emit(Events.READY); + + this.start(); + }, + + /** + * 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; + + this.config.postBoot(this); + + if (this.renderer) + { + this.loop.start(this.step.bind(this)); } else { - c = c.concat('%c '); - - args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + this.loop.start(this.headlessStep.bind(this)); } - // URL link background color (always white) - args.push('background: #fff'); + VisibilityHandler(this); - if (config.gameTitle) - { - c = c.concat(config.gameTitle); + var eventEmitter = this.events; - if (config.gameVersion) - { - c = c.concat(' v' + config.gameVersion); - } + eventEmitter.on(Events.HIDDEN, this.onHidden, this); + eventEmitter.on(Events.VISIBLE, this.onVisible, this); + eventEmitter.on(Events.BLUR, this.onBlur, this); + eventEmitter.on(Events.FOCUS, this.onFocus, this); + }, - if (!config.hidePhaser) - { - c = c.concat(' / '); - } - } - - var fb = ( false) ? undefined : ''; - - if (!config.hidePhaser) - { - c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); - } - - c = c.concat(' %c ' + config.gameURL); - - // Inject the new string back into the args array - args[0] = c; - - console.log.apply(console, args); - } - else if (window['console']) + /** + * 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.Core.Events#PRE_STEP_EVENT + * @fires Phaser.Core.Events#STEP_EVENT + * @fires Phaser.Core.Events#POST_STEP_EVENT + * @fires Phaser.Core.Events#PRE_RENDER_EVENT + * @fires Phaser.Core.Events#POST_RENDER_EVENT + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + step: function (time, delta) { - console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); - } -}; + if (this.pendingDestroy) + { + return this.runDestroy(); + } -module.exports = DebugHeader; + var eventEmitter = this.events; + + // Global Managers like Input and Sound update in the prestep + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + // This is mostly meant for user-land code and plugins + + eventEmitter.emit(Events.STEP, time, delta); + + // Update the Scene Manager and all active Scenes + + this.scene.update(time, delta); + + // Our final event before rendering starts + + eventEmitter.emit(Events.POST_STEP, time, delta); + + var renderer = this.renderer; + + // Run the Pre-render (clearing the canvas, setting background colors, etc) + + renderer.preRender(); + + eventEmitter.emit(Events.PRE_RENDER, renderer, time, delta); + + // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. + + this.scene.render(renderer); + + // The Post-Render call. Tidies up loose end, takes snapshots, etc. + + renderer.postRender(); + + // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. + + eventEmitter.emit(Events.POST_RENDER, renderer, time, delta); + }, + + /** + * 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 {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + headlessStep: function (time, delta) + { + var eventEmitter = this.events; + + // Global Managers + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + eventEmitter.emit(Events.STEP, time, delta); + + // Scenes + + this.scene.update(time, delta); + + eventEmitter.emit(Events.POST_STEP, time, delta); + + // Render + + eventEmitter.emit(Events.PRE_RENDER); + + eventEmitter.emit(Events.POST_RENDER); + }, + + /** + * 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.Core.Events#PAUSE + * @since 3.0.0 + */ + onHidden: function () + { + this.loop.pause(); + + this.events.emit(Events.PAUSE); + }, + + /** + * Called automatically by the Visibility Handler. + * This will resume the main loop and then emit a resume event. + * + * @method Phaser.Game#onVisible + * @protected + * @fires Phaser.Core.Events#RESUME + * @since 3.0.0 + */ + onVisible: function () + { + this.loop.resume(); + + this.events.emit(Events.RESUME); + }, + + /** + * 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.hasFocus = false; + + this.loop.blur(); + }, + + /** + * 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.hasFocus = true; + + this.loop.focus(); + }, + + /** + * Returns the current game frame. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * + * @method Phaser.Game#getFrame + * @since 3.16.0 + * + * @return {number} The current game frame. + */ + getFrame: function () + { + return this.loop.frame; + }, + + /** + * Returns the current game timestamp. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * + * @method Phaser.Game#getTime + * @since 3.16.0 + * + * @return {number} The current game timestamp. + */ + getTime: function () + { + return this.loop.frame.time; + }, + + /** + * Flags this Game instance as needing to be destroyed on the next frame. + * It will wait until the current frame has completed and then call `runDestroy` internally. + * + * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up + * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. + * + * @method Phaser.Game#destroy + * @fires Phaser.Core.Events#DESTROY + * @since 3.0.0 + * + * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. + * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. + */ + destroy: function (removeCanvas, noReturn) + { + if (noReturn === undefined) { noReturn = false; } + + this.pendingDestroy = true; + + this.removeCanvas = removeCanvas; + this.noReturn = noReturn; + }, + + /** + * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * + * @method Phaser.Game#runDestroy + * @private + * @since 3.5.0 + */ + runDestroy: function () + { + this.events.emit(Events.DESTROY); + + this.events.removeAllListeners(); + + this.scene.destroy(); + + if (this.renderer) + { + this.renderer.destroy(); + } + + if (this.removeCanvas && this.canvas) + { + CanvasPool.remove(this.canvas); + + if (this.canvas.parentNode) + { + this.canvas.parentNode.removeChild(this.canvas); + } + } + + if (false) + {} + + this.loop.destroy(); + + this.pendingDestroy = false; + } + +}); + +module.exports = Game; + +/** + * "Computers are good at following instructions, but not at reading your mind." - Donald Knuth + */ /***/ }), -/* 892 */ +/* 996 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var EE = __webpack_require__(11); +var PluginCache = __webpack_require__(17); + +/** + * @classdesc + * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. + * + * @class EventEmitter + * @memberof Phaser.Events + * @constructor + * @since 3.0.0 + */ +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 () + { + this.removeAllListeners(); + } + +}); + +/** + * Return an array listing the events for which the emitter has registered listeners. + * + * @method Phaser.Events.EventEmitter#eventNames + * @since 3.0.0 + * + * @return {array} + */ + +/** + * Return the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#listeners + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {array} The registered listeners. + */ + +/** + * Return the number of listeners listening to a given event. + * + * @method Phaser.Events.EventEmitter#listenerCount + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {number} The number of listeners. + */ + +/** + * Calls each of the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#emit + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {...*} [args] - Additional arguments that will be passed to the event handler. + * + * @return {boolean} `true` if the event had listeners, else `false`. + */ + +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#on + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#addListener + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Add a one-time listener for a given event. + * + * @method Phaser.Events.EventEmitter#once + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#removeListener + * @since 3.0.0 + * + * @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 {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#off + * @since 3.0.0 + * + * @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 {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove all listeners, or those of the specified event. + * + * @method Phaser.Events.EventEmitter#removeAllListeners + * @since 3.0.0 + * + * @param {(string|symbol)} [event] - The event name. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +PluginCache.register('EventEmitter', EventEmitter, 'events'); + +module.exports = EventEmitter; + + +/***/ }), +/* 997 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Events + */ + +module.exports = { EventEmitter: __webpack_require__(996) }; + + +/***/ }), +/* 998 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.DOM + */ + +var Dom = { + + AddToDOM: __webpack_require__(179), + DOMContentLoaded: __webpack_require__(351), + GetScreenOrientation: __webpack_require__(350), + GetTarget: __webpack_require__(345), + ParseXML: __webpack_require__(344), + RemoveFromDOM: __webpack_require__(343), + RequestAnimationFrame: __webpack_require__(363) + +}; + +module.exports = Dom; + + +/***/ }), +/* 999 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Masks + */ + +module.exports = { + + BitmapMask: __webpack_require__(426), + GeometryMask: __webpack_require__(425) + +}; + + +/***/ }), +/* 1000 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ComponentToHex = __webpack_require__(353); + +/** + * 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 (prefix === '#') + { + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + } + else + { + return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + } +}; + +module.exports = RGBToString; + + +/***/ }), +/* 1001 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Between = __webpack_require__(184); +var Color = __webpack_require__(32); + +/** + * 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; } + + return new Color(Between(min, max), Between(min, max), Between(min, max)); +}; + +module.exports = RandomRGB; + + +/***/ }), +/* 1002 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Linear = __webpack_require__(129); + +/** + * @namespace Phaser.Display.Color.Interpolate + * @memberof Phaser.Display.Color + * @since 3.0.0 + */ + +/** + * Interpolates between the two given color ranges over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + var t = index / length; + + return { + r: Linear(r1, r2, t), + g: Linear(g1, g2, t), + b: Linear(b1, b2, t) + }; +}; + +/** + * Interpolates between the two given color objects over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + 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 + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); +}; + +module.exports = { + + RGBWithRGB: RGBWithRGB, + ColorWithRGB: ColorWithRGB, + ColorWithColor: ColorWithColor + +}; + + +/***/ }), +/* 1003 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var HSVToRGB = __webpack_require__(190); + +/** + * 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 {ColorObject[]} 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++) + { + colors.push(HSVToRGB(c / 359, s, v)); + } + + return colors; +}; + +module.exports = HSVColorWheel; + + +/***/ }), +/* 1004 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Color = __webpack_require__(32); +var HueToComponent = __webpack_require__(352); + +/** + * 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 q = (l < 0.5) ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + + r = HueToComponent(p, q, h + 1 / 3); + g = HueToComponent(p, q, h); + b = HueToComponent(p, q, h - 1 / 3); + } + + var color = new Color(); + + return color.setGLTo(r, g, b, 1); +}; + +module.exports = HSLToColor; + + +/***/ }), +/* 1005 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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) + { + output.a = color >>> 24; + } + + return output; +}; + +module.exports = ColorToRGBA; + + +/***/ }), +/* 1006 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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'; } + + var vendors = [ + '-webkit-', + '-khtml-', + '-moz-', + '-ms-', + '' + ]; + + vendors.forEach(function (vendor) + { + canvas.style[vendor + 'user-select'] = value; + }); + + canvas.style['-webkit-touch-callout'] = value; + canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; + + return canvas; +}; + +module.exports = UserSelect; + + +/***/ }), +/* 1007 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = TouchAction; + + +/***/ }), +/* 1008 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Canvas + */ + +module.exports = { + + CanvasInterpolation: __webpack_require__(366), + CanvasPool: __webpack_require__(24), + Smoothing: __webpack_require__(130), + TouchAction: __webpack_require__(1007), + UserSelect: __webpack_require__(1006) + +}; + + +/***/ }), +/* 1009 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = GetOffsetY; + + +/***/ }), +/* 1010 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = GetOffsetX; + + +/***/ }), +/* 1011 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Bounds + */ + +module.exports = { + + CenterOn: __webpack_require__(444), + GetBottom: __webpack_require__(51), + GetCenterX: __webpack_require__(81), + GetCenterY: __webpack_require__(78), + GetLeft: __webpack_require__(49), + GetOffsetX: __webpack_require__(1010), + GetOffsetY: __webpack_require__(1009), + GetRight: __webpack_require__(47), + GetTop: __webpack_require__(45), + SetBottom: __webpack_require__(50), + SetCenterX: __webpack_require__(80), + SetCenterY: __webpack_require__(79), + SetLeft: __webpack_require__(48), + SetRight: __webpack_require__(46), + SetTop: __webpack_require__(44) + +}; + + +/***/ }), +/* 1012 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(47); +var GetTop = __webpack_require__(45); +var SetBottom = __webpack_require__(50); +var SetRight = __webpack_require__(46); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopRight; + + +/***/ }), +/* 1013 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetLeft = __webpack_require__(49); +var GetTop = __webpack_require__(45); +var SetBottom = __webpack_require__(50); +var SetLeft = __webpack_require__(48); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopLeft; + + +/***/ }), +/* 1014 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterX = __webpack_require__(81); +var GetTop = __webpack_require__(45); +var SetBottom = __webpack_require__(50); +var SetCenterX = __webpack_require__(80); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopCenter; + + +/***/ }), +/* 1015 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(47); +var GetTop = __webpack_require__(45); +var SetLeft = __webpack_require__(48); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = RightTop; + + +/***/ }), +/* 1016 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterY = __webpack_require__(78); +var GetRight = __webpack_require__(47); +var SetCenterY = __webpack_require__(79); +var SetLeft = __webpack_require__(48); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = RightCenter; + + +/***/ }), +/* 1017 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetRight = __webpack_require__(47); +var SetBottom = __webpack_require__(50); +var SetLeft = __webpack_require__(48); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = RightBottom; + + +/***/ }), +/* 1018 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetLeft = __webpack_require__(49); +var GetTop = __webpack_require__(45); +var SetRight = __webpack_require__(46); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = LeftTop; + + +/***/ }), +/* 1019 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterY = __webpack_require__(78); +var GetLeft = __webpack_require__(49); +var SetCenterY = __webpack_require__(79); +var SetRight = __webpack_require__(46); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftCenter; + + +/***/ }), +/* 1020 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetLeft = __webpack_require__(49); +var SetBottom = __webpack_require__(50); +var SetRight = __webpack_require__(46); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftBottom; + + +/***/ }), +/* 1021 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetRight = __webpack_require__(47); +var SetRight = __webpack_require__(46); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomRight; + + +/***/ }), +/* 1022 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetLeft = __webpack_require__(49); +var SetLeft = __webpack_require__(48); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomLeft; + + +/***/ }), +/* 1023 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetCenterX = __webpack_require__(81); +var SetCenterX = __webpack_require__(80); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomCenter; + + +/***/ }), +/* 1024 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.To + */ + +module.exports = { + + BottomCenter: __webpack_require__(1023), + BottomLeft: __webpack_require__(1022), + BottomRight: __webpack_require__(1021), + LeftBottom: __webpack_require__(1020), + LeftCenter: __webpack_require__(1019), + LeftTop: __webpack_require__(1018), + RightBottom: __webpack_require__(1017), + RightCenter: __webpack_require__(1016), + RightTop: __webpack_require__(1015), + TopCenter: __webpack_require__(1014), + TopLeft: __webpack_require__(1013), + TopRight: __webpack_require__(1012) + +}; + + +/***/ }), +/* 1025 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.In + */ + +module.exports = { + + BottomCenter: __webpack_require__(448), + BottomLeft: __webpack_require__(447), + BottomRight: __webpack_require__(446), + Center: __webpack_require__(445), + LeftCenter: __webpack_require__(443), + QuickSet: __webpack_require__(449), + RightCenter: __webpack_require__(442), + TopCenter: __webpack_require__(441), + TopLeft: __webpack_require__(440), + TopRight: __webpack_require__(439) + +}; + + +/***/ }), +/* 1026 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(208); +var Extend = __webpack_require__(19); + +/** + * @namespace Phaser.Display.Align + */ + +var Align = { + + In: __webpack_require__(1025), + To: __webpack_require__(1024) + +}; + +// Merge in the consts +Align = Extend(false, Align, CONST); + +module.exports = Align; + + +/***/ }), +/* 1027 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display + */ + +module.exports = { + + Align: __webpack_require__(1026), + Bounds: __webpack_require__(1011), + Canvas: __webpack_require__(1008), + Color: __webpack_require__(354), + Masks: __webpack_require__(999) + +}; + + +/***/ }), +/* 1028 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(134); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); + +/** + * @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 - A reference to the Scene that this DataManager belongs to. + */ +var DataManagerPlugin = new Class({ + + Extends: DataManager, + + initialize: + + function DataManagerPlugin (scene) + { + DataManager.call(this, scene, scene.sys.events); + + /** + * A reference to the Scene that this DataManager belongs to. + * + * @name Phaser.Data.DataManagerPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * A reference to the Scene's Systems. + * + * @name Phaser.Data.DataManagerPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, + + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Data.DataManagerPlugin#boot + * @private + * @since 3.5.1 + */ + boot: function () + { + this.events = this.systems.events; + + this.events.once(SceneEvents.DESTROY, this.destroy, this); + }, + + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Data.DataManagerPlugin#start + * @private + * @since 3.5.0 + */ + start: function () + { + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Data.DataManagerPlugin#shutdown + * @private + * @since 3.5.0 + */ + shutdown: function () + { + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.Data.DataManagerPlugin#destroy + * @since 3.5.0 + */ + destroy: function () + { + DataManager.prototype.destroy.call(this); + + this.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; + } + +}); + +PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); + +module.exports = DataManagerPlugin; + + +/***/ }), +/* 1029 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data + */ + +module.exports = { + + DataManager: __webpack_require__(134), + DataManagerPlugin: __webpack_require__(1028), + Events: __webpack_require__(420) + +}; + + +/***/ }), +/* 1030 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(3); + +/** + * @classdesc + * A MoveTo Curve is a very simple curve consisting of only a single point. Its intended use is to move the ending point in a Path. + * + * @class MoveTo + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - `x` pixel coordinate. + * @param {number} [y] - `y` pixel coordinate. + */ +var MoveTo = new Class({ + + initialize: + + function MoveTo (x, y) + { + // Skip length calcs in paths + + /** + * Denotes that this Curve does not influence the bounds, points, and drawing of its parent Path. Must be `false` or some methods in the parent Path will throw errors. + * + * @name Phaser.Curves.MoveTo#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; + + /** + * The lone point which this curve consists of. + * + * @name Phaser.Curves.MoveTo#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = new Vector2(x, y); + }, + + /** + * Get point at relative position in curve according to length. + * + * @method Phaser.Curves.MoveTo#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.p0); + }, + + /** + * Retrieves the point at given position in the curve. This will always return this curve's only point. + * + * @method Phaser.Curves.MoveTo#getPointAt + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} u - The position in the path to retrieve, between 0 and 1. Not used. + * @param {Phaser.Math.Vector2} [out] - An optional vector in which to store the point. + * + * @return {Phaser.Math.Vector2} The modified `out` vector, or a new `Vector2` if none was provided. + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, + + /** + * Gets the resolution of this curve. + * + * @method Phaser.Curves.MoveTo#getResolution + * @since 3.0.0 + * + * @return {number} The resolution of this curve. For a MoveTo the value is always 1. + */ + getResolution: function () + { + return 1; + }, + + /** + * Gets the length of this curve. + * + * @method Phaser.Curves.MoveTo#getLength + * @since 3.0.0 + * + * @return {number} The length of this curve. For a MoveTo the value is always 0. + */ + getLength: function () + { + return 0; + }, + + /** + * Converts this curve into a JSON-serializable object. + * + * @method Phaser.Curves.MoveTo#toJSON + * @since 3.0.0 + * + * @return {JSONCurve} A primitive object with the curve's type and only point. + */ + toJSON: function () + { + return { + type: 'MoveTo', + points: [ + this.p0.x, this.p0.y + ] + }; + } + +}); + +module.exports = MoveTo; + + +/***/ }), +/* 1031 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 CubicBezierCurve = __webpack_require__(359); +var EllipseCurve = __webpack_require__(358); +var GameObjectFactory = __webpack_require__(5); +var LineCurve = __webpack_require__(357); +var MovePathTo = __webpack_require__(1030); +var QuadraticBezierCurve = __webpack_require__(356); +var Rectangle = __webpack_require__(10); +var SplineCurve = __webpack_require__(355); +var Vector2 = __webpack_require__(3); + +/** + * @typedef {object} JSONPath + * + * @property {string} type - The of the curve. + * @property {number} x - The X coordinate of the curve's starting point. + * @property {number} y - The Y coordinate of the path's starting point. + * @property {boolean} autoClose - The path is auto closed. + * @property {JSONCurve[]} curves - The list of the curves + */ + +/** + * @classdesc + * A Path combines multiple Curves into one continuous compound curve. It does not matter how many Curves are in the Path or what type they are. + * + * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. + * + * @class Path + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link JSONPath}. + * @param {number} [y=0] - The Y coordinate of the Path's starting point. + */ +var Path = new Class({ + + initialize: + + function Path (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + /** + * The name of this Path. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.Curves.Path#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; + + /** + * The list of Curves which make up this Path. + * + * @name Phaser.Curves.Path#curves + * @type {Phaser.Curves.Curve[]} + * @default [] + * @since 3.0.0 + */ + this.curves = []; + + /** + * The cached length of each Curve in the Path. + * + * Used internally by {@link #getCurveLengths}. + * + * @name Phaser.Curves.Path#cacheLengths + * @type {number[]} + * @default [] + * @since 3.0.0 + */ + this.cacheLengths = []; + + /** + * Automatically closes the path. + * + * @name Phaser.Curves.Path#autoClose + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.autoClose = false; + + /** + * The starting point of the Path. + * + * This is not necessarily equivalent to the starting point of the first Curve in the Path. In an empty Path, it's also treated as the ending point. + * + * @name Phaser.Curves.Path#startPoint + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.startPoint = new Vector2(); + + /** + * A temporary vector used to avoid object creation when adding a Curve to the Path. + * + * @name Phaser.Curves.Path#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2A = new Vector2(); + + /** + * A temporary vector used to avoid object creation when adding a Curve to the Path. + * + * @name Phaser.Curves.Path#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2B = new Vector2(); + + if (typeof x === 'object') + { + this.fromJSON(x); + } + else + { + this.startPoint.set(x, y); + } + }, + + /** + * Appends a Curve to the end of the Path. + * + * The Curve does not have to start where the Path ends or, for an empty Path, at its defined starting point. + * + * @method Phaser.Curves.Path#add + * @since 3.0.0 + * + * @param {Phaser.Curves.Curve} curve - The Curve to append. + * + * @return {Phaser.Curves.Path} This Path object. + */ + add: function (curve) + { + this.curves.push(curve); + + return this; + }, + + /** + * Creates a circular Ellipse Curve positioned at the end of the Path. + * + * @method Phaser.Curves.Path#circleTo + * @since 3.0.0 + * + * @param {number} radius - The radius of the circle. + * @param {boolean} [clockwise=false] - `true` to create a clockwise circle as opposed to a counter-clockwise circle. + * @param {number} [rotation=0] - The rotation of the circle in degrees. + * + * @return {Phaser.Curves.Path} This Path object. + */ + circleTo: function (radius, clockwise, rotation) + { + if (clockwise === undefined) { clockwise = false; } + + return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); + }, + + /** + * Ensures that the Path is closed. + * + * A closed Path starts and ends at the same point. If the Path is not closed, a straight Line Curve will be created from the ending point directly to the starting point. During the check, the actual starting point of the Path, i.e. the starting point of the first Curve, will be used as opposed to the Path's defined {@link startPoint}, which could differ. + * + * Calling this method on an empty Path will result in an error. + * + * @method Phaser.Curves.Path#closePath + * @since 3.0.0 + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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)); + } + + return this; + }, + + /** + * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. + * + * @method Phaser.Curves.Path#cubicBezierTo + * @since 3.0.0 + * + * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vec2, the p1 value. + * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vec2, the p2 value. + * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vec2, the p3 value. + * @param {number} [control1Y] - The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments. + * @param {number} [control2X] - The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. + * @param {number} [control2Y] - The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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) + { + 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 + + /** + * Creates a Quadratic Bezier Curve starting at the ending point of the Path. + * + * @method Phaser.Curves.Path#quadraticBezierTo + * @since 3.2.0 + * + * @param {(number|Phaser.Math.Vector2[])} x - The X coordinate of the second control point or, if it's a `Vector2`, the first control point. + * @param {number} [y] - The Y coordinate of the second control point or, if `x` is a `Vector2`, the second control point. + * @param {number} [controlX] - If `x` is not a `Vector2`, the X coordinate of the first control point. + * @param {number} [controlY] - If `x` is not a `Vector2`, the Y coordinate of the first control point. + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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)); + }, + + /** + * Draws all Curves in the Path to a Graphics Game Object. + * + * @method Phaser.Curves.Path#draw + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.Graphics} G - [out,$return] + * + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. + * @param {integer} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. + * + * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. + */ + 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; + }, + + /** + * 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 - The horizontal radius of the ellipse. + * @param {number} yRadius - The vertical radius of the ellipse. + * @param {number} startAngle - The start angle of the ellipse, in degrees. + * @param {number} endAngle - The end angle of the ellipse, in degrees. + * @param {boolean} clockwise - Whether the ellipse should be rotated clockwise (`true`) or counter-clockwise (`false`). + * @param {number} rotation - The rotation of the ellipse, in degrees. + * + * @return {Phaser.Curves.Path} This Path object. + */ + ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + { + 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); + }, + + /** + * Creates a Path from a Path Configuration object. + * + * The provided object should be a {@link JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. + * + * @method Phaser.Curves.Path#fromJSON + * @since 3.0.0 + * + * @param {object} data - The JSON object containing the Path data. + * + * @return {Phaser.Curves.Path} This Path object. + */ + fromJSON: function (data) + { + // 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++) + { + 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; + }, + + /** + * Returns a Rectangle with a position and size matching the bounds of this Path. + * + * @method Phaser.Curves.Path#getBounds + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. + * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. + * + * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. + */ + 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; + + 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]; + + 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); + } + + out.right = maxRight; + out.bottom = maxBottom; + + return out; + }, + + /** + * Returns an array containing the length of the Path at the end of each Curve. + * + * The result of this method will be cached to avoid recalculating it in subsequent calls. The cache is only invalidated when the {@link #curves} array changes in length, leading to potential inaccuracies if a Curve in the Path is changed, or if a Curve is removed and another is added in its place. + * + * @method Phaser.Curves.Path#getCurveLengths + * @since 3.0.0 + * + * @return {number[]} An array containing the length of the Path at the end of each one of its Curves. + */ + getCurveLengths: function () + { + // We use cache values if curves and cache array are same length + + if (this.cacheLengths.length === this.curves.length) + { + return this.cacheLengths; + } + + // Get length of sub-curve + // Push sums into cached array + + var lengths = []; + var sums = 0; + + for (var i = 0; i < this.curves.length; i++) + { + sums += this.curves[i].getLength(); + + lengths.push(sums); + } + + this.cacheLengths = lengths; + + return lengths; + }, + + /** + * Returns the ending point of the Path. + * + * A Path's ending point is equivalent to the ending point of the last Curve in the Path. For an empty Path, the ending point is at the Path's defined {@link #startPoint}. + * + * @method Phaser.Curves.Path#getEndPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - The object to store the point in. + * + * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. + */ + getEndPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + if (this.curves.length > 0) + { + this.curves[this.curves.length - 1].getPoint(1, out); + } + else + { + out.copy(this.startPoint); + } + + return out; + }, + + /** + * Returns the total length of the Path. + * + * @see {@link #getCurveLengths} + * + * @method Phaser.Curves.Path#getLength + * @since 3.0.0 + * + * @return {number} The total length of the Path. + */ + getLength: function () + { + var lens = this.getCurveLengths(); + + return lens[lens.length - 1]; + }, + + // 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') + + /** + * Calculates the coordinates of the point at the given normalized location (between 0 and 1) on the Path. + * + * The location is relative to the entire Path, not to an individual Curve. A location of 0.5 is always in the middle of the Path and is thus an equal distance away from both its starting and ending points. In a Path with one Curve, it would be in the middle of the Curve; in a Path with two Curves, it could be anywhere on either one of them depending on their lengths. + * + * @method Phaser.Curves.Path#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The location of the point to return, between 0 and 1. + * @param {Phaser.Math.Vector2} [out] - The object in which to store the calculated point. + * + * @return {?Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + */ + 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) + { + 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++; + } + + // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) + { + points.push(points[0]); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getRandomPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * + * @return {Phaser.Math.Vector2} [description] + */ + getRandomPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); + }, + + /** + * Creates a straight Line Curve from the ending point of the Path to the given coordinates. + * + * @method Phaser.Curves.Path#getSpacedPoints + * @since 3.0.0 + * + * @param {integer} [divisions=40] - The X coordinate of the line's ending point, or the line's ending point as a `Vector2`. + * + * @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)); + } + + if (this.autoClose) + { + points.push(points[0]); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + 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.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._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.Curves.Path#splineTo + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2[]} points - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + splineTo: function (points) + { + points.unshift(this.getEndPoint()); + + return this.add(new SplineCurve(points)); + }, + + /** + * [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)); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#toJSON + * @since 3.0.0 + * + * @return {JSONPath} [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.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; + + +/***/ }), +/* 1032 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Curves + */ + +/** + * @typedef {object} JSONCurve + * + * @property {string} type - The of the curve + * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` + */ + +module.exports = { + Path: __webpack_require__(1031), + + CubicBezier: __webpack_require__(359), + Curve: __webpack_require__(76), + Ellipse: __webpack_require__(358), + Line: __webpack_require__(357), + QuadraticBezier: __webpack_require__(356), + Spline: __webpack_require__(355) +}; + + +/***/ }), +/* 1033 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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. + * + * @name Phaser.Create.Palettes.MSX + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1034 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.JMP + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1035 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.CGA + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1036 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @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 {Palette} + */ +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' +}; + + +/***/ }), +/* 1037 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Palette + * + * @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. + */ + +/** + * @namespace Phaser.Create.Palettes + */ + +module.exports = { + + ARNE16: __webpack_require__(360), + C64: __webpack_require__(1036), + CGA: __webpack_require__(1035), + JMP: __webpack_require__(1034), + MSX: __webpack_require__(1033) + +}; + + +/***/ }), +/* 1038 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Create + */ + +module.exports = { + + GenerateTexture: __webpack_require__(361), + Palettes: __webpack_require__(1037) + +}; + + +/***/ }), +/* 1039 */ /***/ (function(module, exports) { module.exports = [ @@ -137079,7 +149503,7 @@ module.exports = [ /***/ }), -/* 893 */ +/* 1040 */ /***/ (function(module, exports) { module.exports = [ @@ -137123,12 +149547,12 @@ module.exports = [ /***/ }), -/* 894 */ +/* 1041 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137714,7 +150138,7 @@ module.exports = ModelViewProjection; /***/ }), -/* 895 */ +/* 1042 */ /***/ (function(module, exports) { module.exports = [ @@ -137738,6 +150162,7 @@ module.exports = [ 'uniform sampler2D uNormSampler;', 'uniform vec3 uAmbientLightColor;', 'uniform Light uLights[kMaxLights];', + 'uniform mat3 uInverseRotationMatrix;', '', 'varying vec2 outTexCoord;', 'varying vec4 outTint;', @@ -137747,7 +150172,7 @@ module.exports = [ ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);', ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', - ' vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));', + ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', '', ' for (int index = 0; index < kMaxLights; ++index)', @@ -137772,7 +150197,7 @@ module.exports = [ /***/ }), -/* 896 */ +/* 1043 */ /***/ (function(module, exports) { module.exports = [ @@ -137791,7 +150216,7 @@ module.exports = [ /***/ }), -/* 897 */ +/* 1044 */ /***/ (function(module, exports) { module.exports = [ @@ -137827,136 +150252,2629 @@ module.exports = [ /***/ }), -/* 898 */ -/***/ (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__(348); -var CanvasPool = __webpack_require__(24); -var CONST = __webpack_require__(26); -var Features = __webpack_require__(168); - -/** - * 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.antialias) - { - CanvasPool.disableSmoothing(); - } - - // Does the game config provide its own canvas element to use? - if (config.canvas) - { - game.canvas = config.canvas; - - game.canvas.width = game.config.width; - game.canvas.height = game.config.height; - } - else - { - game.canvas = CanvasPool.create(game, config.width * config.resolution, config.height * config.resolution, 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.antialias) - { - CanvasInterpolation.setCrisp(game.canvas); - } - - // Zoomed? - 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__(426); - WebGLRenderer = __webpack_require__(423); - - // Let the config pick the renderer type, as both are included - if (config.renderType === CONST.WEBGL) - { - game.renderer = new WebGLRenderer(game); - } - else - { - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } - } - - if (false) - {} - - if (false) - {} -}; - -module.exports = CreateRenderer; - - -/***/ }), -/* 899 */ +/* 1045 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Remove Event. + * + * This event is dispatched by the Texture Manager when a texture is removed from it. + * + * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`. + * + * If you have any Game Objects still using the removed texture, they will start throwing + * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. + * + * @event Phaser.Textures.Events#REMOVE + * + * @param {string} key - The key of the Texture that was removed from the Texture Manager. + */ +module.exports = 'removetexture'; + + +/***/ }), +/* 1046 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * This internal event signifies that the Texture Manager is now ready and the Game can continue booting. + * + * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking + * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game + * instance, which tells the Game to carry on booting. + * + * @event Phaser.Textures.Events#READY + */ +module.exports = 'ready'; + + +/***/ }), +/* 1047 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Event. + * + * This event is dispatched by the Texture Manager when a texture has finished loading on it. + * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`. + * + * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event. + * + * @event Phaser.Textures.Events#LOAD + * + * @param {string} key - The key of the Texture that was loaded by the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was loaded by the Texture Manager. + */ +module.exports = 'onload'; + + +/***/ }), +/* 1048 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Error Event. + * + * This event is dispatched by the Texture Manager when a texture it requested to load failed. + * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`. + * + * @event Phaser.Textures.Events#ERROR + * + * @param {string} key - The key of the Texture that failed to load into the Texture Manager. + */ +module.exports = 'onerror'; + + +/***/ }), +/* 1049 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Add Event. + * + * This event is dispatched by the Texture Manager when a texture is added to it. + * + * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`. + * + * @event Phaser.Textures.Events#ADD + * + * @param {string} key - The key of the Texture that was added to the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. + */ +module.exports = 'addtexture'; + + +/***/ }), +/* 1050 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Vector3 = __webpack_require__(182); +var Matrix4 = __webpack_require__(369); +var Quaternion = __webpack_require__(368); + +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 - The vector to be rotated. + * @param {Phaser.Math.Vector3} axis - The axis to rotate around. + * @param {number} radians - The angle of rotation in radians. + * + * @return {Phaser.Math.Vector3} The given vector. + */ +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; + + +/***/ }), +/* 1051 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 + * A representation of a vector in 4D space. + * + * A four-component vector. + * + * @class Vector4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +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 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector4#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector4#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + /** + * The w component of this Vector. + * + * @name Phaser.Math.Vector4#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.w = 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; + } + }, + + /** + * Make a clone of this Vector4. + * + * @method Phaser.Math.Vector4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} A clone of this Vector4. + */ + clone: function () + { + return new Vector4(this.x, this.y, this.z, this.w); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + this.w = src.w || 0; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict quality check against each Vector's components. + * + * @method Phaser.Math.Vector4#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The vector to check equality with. + * + * @return {boolean} A boolean indicating whether the two Vectors are equal or not. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); + }, + + /** + * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. + * + * @method Phaser.Math.Vector4#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. + * @param {number} y - The y value to set for this Vector. + * @param {number} z - The z value to set for this Vector. + * @param {number} w - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + set: function (x, y, z, w) + { + 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; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector4#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + this.w += v.w || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector4#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + this.w -= v.w || 0; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector4#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + scale: function (scale) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; + + return this; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector4#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + 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); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector4#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return x * x + y * y + z * z + w * w; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector4#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + 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; + + 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; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector4#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. + * + * @return {number} The dot product of this Vector and the given Vector. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector4#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + lerp: function (v, t) + { + 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; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector4#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + this.w *= v.w || 1; + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector4#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + this.w /= v.w || 1; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector4#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + 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); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector4#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + 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; + + return dx * dx + dy * dy + dz * dz + dw * dw; + }, + + /** + * Negate the `x`, `y`, `z` and `w` components of this Vector. + * + * @method Phaser.Math.Vector4#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + this.w = -this.w; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector4#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var m = mat.val; + + 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; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector4#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformQuat: function (q) + { + // TODO: is this really the same as Vector3? + // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ + // 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; + + // 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; + + // 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; + }, + + /** + * Make this Vector the zero vector (0, 0, 0, 0). + * + * @method Phaser.Math.Vector4#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 0; + + return this; + } + +}); + +// 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; + +module.exports = Vector4; + + +/***/ }), +/* 1052 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Checks if the two values are within the given `tolerance` of each other. + * + * @function Phaser.Math.Within + * @since 3.0.0 + * + * @param {number} a - The first value to use in the calculation. + * @param {number} b - The second value to use in the calculation. + * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. + * + * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. + */ +var Within = function (a, b, tolerance) +{ + return (Math.abs(a - b) <= tolerance); +}; + +module.exports = Within; + + +/***/ }), +/* 1053 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} SinCosTable + * + * @property {number} sin - The sine value. + * @property {number} cos - The cosine value. + * @property {number} length - The length. + */ + +/** + * Generate a series of sine and cosine values. + * + * @function Phaser.Math.SinCosTableGenerator + * @since 3.0.0 + * + * @param {number} length - The number of values to generate. + * @param {number} [sinAmp=1] - The sine value amplitude. + * @param {number} [cosAmp=1] - The cosine value amplitude. + * @param {number} [frequency=1] - The frequency of the values. + * + * @return {SinCosTable} The generated values. + */ +var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) +{ + if (sinAmp === undefined) { sinAmp = 1; } + if (cosAmp === undefined) { cosAmp = 1; } + if (frequency === undefined) { frequency = 1; } + + frequency *= Math.PI / length; + + var cos = []; + var sin = []; + + for (var c = 0; c < length; c++) + { + cosAmp -= sinAmp * frequency; + sinAmp += cosAmp * frequency; + + cos[c] = cosAmp; + sin[c] = sinAmp; + } + + return { + sin: sin, + cos: cos, + length: length + }; +}; + +module.exports = SinCosTableGenerator; + + +/***/ }), +/* 1054 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Round a value to a given decimal place. + * + * @function Phaser.Math.RoundTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {integer} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var RoundTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.round(value * p) / p; +}; + +module.exports = RoundTo; + + +/***/ }), +/* 1055 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random four-dimensional vector. + * + * @function Phaser.Math.RandomXYZW + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector4} The given Vector. + */ +var RandomXYZW = function (vec4, scale) +{ + if (scale === undefined) { scale = 1; } + + // TODO: 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; + + +/***/ }), +/* 1056 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random position vector in a spherical area, optionally defined by the given radius. + * + * @function Phaser.Math.RandomXYZ + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. + * @param {number} [radius=1] - The radius. + * + * @return {Phaser.Math.Vector3} The given Vector. + */ +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; + + +/***/ }), +/* 1057 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random unit vector. + * + * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. + * + * Optionally accepts a scale value to scale the resulting vector by. + * + * @function Phaser.Math.RandomXY + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector2} The given Vector. + */ +var RandomXY = function (vector, scale) +{ + if (scale === undefined) { scale = 1; } + + var r = Math.random() * 2 * Math.PI; + + vector.x = Math.cos(r) * scale; + vector.y = Math.sin(r) * scale; + + return vector; +}; + +module.exports = RandomXY; + + +/***/ }), +/* 1058 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Work out what percentage `value` is of the range between `min` and `max`. + * If `max` isn't given then it will return the percentage of `value` to `min`. + * + * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. + * + * @function Phaser.Math.Percent + * @since 3.0.0 + * + * @param {number} value - The value to determine the percentage of. + * @param {number} min - The minimum value. + * @param {number} [max] - The maximum value. + * @param {number} [upperMax] - The mid-way point in the range that represents 100%. + * + * @return {number} A value between 0 and 1 representing the percentage. + */ +var Percent = function (value, min, max, upperMax) +{ + if (max === undefined) { max = min + 1; } + + var percentage = (value - min) / (max - min); + + if (percentage > 1) + { + if (upperMax !== undefined) + { + percentage = ((upperMax - value)) / (upperMax - max); + + if (percentage < 0) + { + percentage = 0; + } + } + else + { + percentage = 1; + } + } + else if (percentage < 0) + { + percentage = 0; + } + + return percentage; +}; + +module.exports = Percent; + + +/***/ }), +/* 1059 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Subtract an `amount` from `value`, limiting the minimum result to `min`. + * + * @function Phaser.Math.MinSub + * @since 3.0.0 + * + * @param {number} value - The value to subtract from. + * @param {number} amount - The amount to subtract. + * @param {number} min - The minimum value to return. + * + * @return {number} The resulting value. + */ +var MinSub = function (value, amount, min) +{ + return Math.max(value - amount, min); +}; + +module.exports = MinSub; + + +/***/ }), +/* 1060 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Add an `amount` to a `value`, limiting the maximum result to `max`. + * + * @function Phaser.Math.MaxAdd + * @since 3.0.0 + * + * @param {number} value - The value to add to. + * @param {number} amount - The amount to add. + * @param {number} max - The maximum value to return. + * + * @return {number} The resulting value. + */ +var MaxAdd = function (value, amount, max) +{ + return Math.min(value + amount, max); +}; + +module.exports = MaxAdd; + + +/***/ }), +/* 1061 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check if a given value is an even number using a strict type check. + * + * @function Phaser.Math.IsEvenStrict + * @since 3.0.0 + * + * @param {number} value - The number to perform the check with. + * + * @return {boolean} Whether the number is even or not. + */ +var IsEvenStrict = function (value) +{ + // Use strict equality === for "is number" test + return (value === parseFloat(value)) ? !(value % 2) : void 0; +}; + +module.exports = IsEvenStrict; + + +/***/ }), +/* 1062 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check if a given value is an even number. + * + * @function Phaser.Math.IsEven + * @since 3.0.0 + * + * @param {number} value - The number to perform the check with. + * + * @return {boolean} Whether the number is even or not. + */ +var IsEven = function (value) +{ + // Use abstract equality == for "is number" test + + // eslint-disable-next-line eqeqeq + return (value == parseFloat(value)) ? !(value % 2) : void 0; +}; + +module.exports = IsEven; + + +/***/ }), +/* 1063 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the speed required to cover a distance in the time given. + * + * @function Phaser.Math.GetSpeed + * @since 3.0.0 + * + * @param {number} distance - The distance to travel in pixels. + * @param {integer} time - The time, in ms, to cover the distance in. + * + * @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given. + */ +var GetSpeed = function (distance, time) +{ + return (distance / time) / 1000; +}; + +module.exports = GetSpeed; + + +/***/ }), +/* 1064 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Floors to some place comparative to a `base`, default is 10 for decimal place. + * + * The `place` is represented by the power applied to `base` to get that place. + * + * @function Phaser.Math.FloorTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {integer} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var FloorTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.floor(value * p) / p; +}; + +module.exports = FloorTo; + + +/***/ }), +/* 1065 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the positive difference of two given numbers. + * + * @function Phaser.Math.Difference + * @since 3.0.0 + * + * @param {number} a - The first number in the calculation. + * @param {number} b - The second number in the calculation. + * + * @return {number} The positive difference of the two given numbers. + */ +var Difference = function (a, b) +{ + return Math.abs(a - b); +}; + +module.exports = Difference; + + +/***/ }), +/* 1066 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Ceils to some place comparative to a `base`, default is 10 for decimal place. + * + * The `place` is represented by the power applied to `base` to get that place. + * + * @function Phaser.Math.CeilTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {number} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var CeilTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.ceil(value * p) / p; +}; + +module.exports = CeilTo; + + +/***/ }), +/* 1067 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the mean average of the given values. + * + * @function Phaser.Math.Average + * @since 3.0.0 + * + * @param {number[]} values - The values to average. + * + * @return {number} The average value. + */ +var Average = function (values) +{ + var sum = 0; + + for (var i = 0; i < values.length; i++) + { + sum += (+values[i]); + } + + return sum / values.length; +}; + +module.exports = Average; + + +/***/ }), +/* 1068 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A seeded Random Data Generator. + * + * Access via `Phaser.Math.RND` which is an instance of this class pre-defined + * by Phaser. Or, create your own instance to use as you require. + * + * The `Math.RND` generator is seeded by the Game Config property value `seed`. + * If no such config property exists, a random number is used. + * + * If you create your own instance of this class you should provide a seed for it. + * If no seed is given it will use a 'random' one based on Date.now. + * + * @class RandomDataGenerator + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. + */ +var RandomDataGenerator = new Class({ + + initialize: + + function RandomDataGenerator (seeds) + { + if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } + + /** + * 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; + + /** + * Signs to choose from. + * + * @name Phaser.Math.RandomDataGenerator#signs + * @type {number[]} + * @since 3.0.0 + */ + this.signs = [ -1, 1 ]; + + if (seeds) + { + this.init(seeds); + } + }, + + /** + * Private random helper. + * + * @method Phaser.Math.RandomDataGenerator#rnd + * @since 3.0.0 + * @private + * + * @return {number} A random number. + */ + rnd: function () + { + 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 {string} data - The value to hash. + * + * @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++) + { + 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 + }, + + /** + * Initialize the state of the random data generator. + * + * @method Phaser.Math.RandomDataGenerator#init + * @since 3.0.0 + * + * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. + */ + 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 {string[]} 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 {*} 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 {*} 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(','); + }, + + /** + * Shuffles the given array, using the current seed. + * + * @method Phaser.Math.RandomDataGenerator#shuffle + * @since 3.7.0 + * + * @param {array} [array] - The array to be shuffled. + * + * @return {array} The shuffled array. + */ + shuffle: function (array) + { + var len = array.length - 1; + + for (var i = len; i > 0; i--) + { + var randomIndex = Math.floor(this.frac() * (i + 1)); + var itemAtIndex = array[randomIndex]; + + array[randomIndex] = array[i]; + array[i] = itemAtIndex; + } + + return array; + } + +}); + +module.exports = RandomDataGenerator; + + +/***/ }), +/* 1069 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using rounding. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. + * + * @function Phaser.Math.Snap.To + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapTo = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.round(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapTo; + + +/***/ }), +/* 1070 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Snap + */ + +module.exports = { + + Ceil: __webpack_require__(375), + Floor: __webpack_require__(98), + To: __webpack_require__(1069) + +}; + + +/***/ }), +/* 1071 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Tests the value and returns `true` if it is a power of two. + * + * @function Phaser.Math.Pow2.IsValuePowerOfTwo + * @since 3.0.0 + * + * @param {number} value - The value to check if it's a power of two. + * + * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. + */ +var IsValuePowerOfTwo = function (value) +{ + return (value > 0 && (value & (value - 1)) === 0); +}; + +module.exports = IsValuePowerOfTwo; + + +/***/ }), +/* 1072 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Pow2 + */ + +module.exports = { + + GetNext: __webpack_require__(376), + IsSize: __webpack_require__(127), + IsValue: __webpack_require__(1071) + +}; + + +/***/ }), +/* 1073 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SmootherStep = __webpack_require__(196); + +/** + * A Smoother Step interpolation method. + * + * @function Phaser.Math.Interpolation.SmootherStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The interpolated value. + */ +var SmootherStepInterpolation = function (t, min, max) +{ + return min + (max - min) * SmootherStep(t, 0, 1); +}; + +module.exports = SmootherStepInterpolation; + + +/***/ }), +/* 1074 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Linear = __webpack_require__(129); + +/** + * A linear interpolation method. + * + * @function Phaser.Math.Interpolation.Linear + * @since 3.0.0 + * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {!number} k - The percentage of interpolation, between 0 and 1. + * + * @return {!number} The interpolated value. + */ +var LinearInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + + if (k < 0) + { + return Linear(v[0], v[1], f); + } + else if (k > 1) + { + return Linear(v[m], v[m - 1], m - f); + } + else + { + return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); + } +}; + +module.exports = LinearInterpolation; + + +/***/ }), +/* 1075 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CatmullRom = __webpack_require__(185); + +/** + * A Catmull-Rom interpolation method. + * + * @function Phaser.Math.Interpolation.CatmullRom + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var CatmullRomInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + + if (v[0] === v[m]) + { + if (k < 0) + { + i = Math.floor(f = m * (1 + k)); + } + + return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); + } + else + { + if (k < 0) + { + return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); + } + + if (k > 1) + { + return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); + } + + return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); + } +}; + +module.exports = CatmullRomInterpolation; + + +/***/ }), +/* 1076 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Bernstein = __webpack_require__(381); + +/** + * A bezier interpolation method. + * + * @function Phaser.Math.Interpolation.Bezier + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var BezierInterpolation = function (v, k) +{ + var b = 0; + var n = v.length - 1; + + for (var i = 0; i <= n; i++) + { + b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); + } + + return b; +}; + +module.exports = BezierInterpolation; + + +/***/ }), +/* 1077 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Interpolation + */ + +module.exports = { + + Bezier: __webpack_require__(1076), + CatmullRom: __webpack_require__(1075), + CubicBezier: __webpack_require__(379), + Linear: __webpack_require__(1074), + QuadraticBezier: __webpack_require__(378), + SmoothStep: __webpack_require__(377), + SmootherStep: __webpack_require__(1073) + +}; + + +/***/ }), +/* 1078 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the fuzzy floor of the given value. + * + * @function Phaser.Math.Fuzzy.Floor + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The floor of the value. + */ +var Floor = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.floor(value + epsilon); +}; + +module.exports = Floor; + + +/***/ }), +/* 1079 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the fuzzy ceiling of the given value. + * + * @function Phaser.Math.Fuzzy.Ceil + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The fuzzy ceiling of the value. + */ +var Ceil = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.ceil(value - epsilon); +}; + +module.exports = Ceil; + + +/***/ }), +/* 1080 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Fuzzy + */ + +module.exports = { + + Ceil: __webpack_require__(1079), + Equal: __webpack_require__(186), + Floor: __webpack_require__(1078), + GreaterThan: __webpack_require__(383), + LessThan: __webpack_require__(382) + +}; + + +/***/ }), +/* 1081 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing + */ + +module.exports = { + + Back: __webpack_require__(402), + Bounce: __webpack_require__(401), + Circular: __webpack_require__(400), + Cubic: __webpack_require__(399), + Elastic: __webpack_require__(398), + Expo: __webpack_require__(397), + Linear: __webpack_require__(396), + Quadratic: __webpack_require__(395), + Quartic: __webpack_require__(394), + Quintic: __webpack_require__(393), + Sine: __webpack_require__(392), + Stepped: __webpack_require__(391) + +}; + + +/***/ }), +/* 1082 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the distance between two sets of coordinates (points) to the power of `pow`. + * + * @function Phaser.Math.Distance.Power + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * @param {number} pow - The exponent. + * + * @return {number} The distance between each point. + */ +var DistancePower = function (x1, y1, x2, y2, pow) +{ + if (pow === undefined) { pow = 2; } + + return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); +}; + +module.exports = DistancePower; + + +/***/ }), +/* 1083 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Distance + */ + +module.exports = { + + Between: __webpack_require__(56), + Power: __webpack_require__(1082), + Squared: __webpack_require__(384) + +}; + + +/***/ }), +/* 1084 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Gets the shortest angle between `angle1` and `angle2`. + * + * Both angles must be in the range -180 to 180, which is the same clamped + * range that `sprite.angle` uses, so you can pass in two sprite angles to + * this method and get the shortest angle back between the two of them. + * + * The angle returned will be in the same range. If the returned angle is + * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's + * a clockwise rotation. + * + * TODO: Wrap the angles in this function? + * + * @function Phaser.Math.Angle.ShortestBetween + * @since 3.0.0 + * + * @param {number} angle1 - The first angle in the range -180 to 180. + * @param {number} angle2 - The second angle in the range -180 to 180. + * + * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. + */ +var ShortestBetween = function (angle1, angle2) +{ + var difference = angle2 - angle1; + + if (difference === 0) + { + return 0; + } + + var times = Math.floor((difference - (-180)) / 360); + + return difference - (times * 360); + +}; + +module.exports = ShortestBetween; + + +/***/ }), +/* 1085 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var MATH_CONST = __webpack_require__(20); + +/** + * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. + * + * @function Phaser.Math.Angle.RotateTo + * @since 3.0.0 + * + * @param {number} currentAngle - The current angle, in radians. + * @param {number} targetAngle - The target angle to rotate to, in radians. + * @param {number} [lerp=0.05] - The lerp value to add to the current angle. + * + * @return {number} The adjusted angle. + */ +var RotateTo = function (currentAngle, targetAngle, lerp) +{ + if (lerp === undefined) { lerp = 0.05; } + + if (currentAngle === targetAngle) + { + return currentAngle; + } + + if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) + { + currentAngle = targetAngle; + } + else + { + if (Math.abs(targetAngle - currentAngle) > Math.PI) + { + if (targetAngle < currentAngle) + { + targetAngle += MATH_CONST.PI2; + } + else + { + targetAngle -= MATH_CONST.PI2; + } + } + + if (targetAngle > currentAngle) + { + currentAngle += lerp; + } + else if (targetAngle < currentAngle) + { + currentAngle -= lerp; + } + } + + return currentAngle; +}; + +module.exports = RotateTo; + + +/***/ }), +/* 1086 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Normalize = __webpack_require__(385); + +/** + * Reverse the given angle. + * + * @function Phaser.Math.Angle.Reverse + * @since 3.0.0 + * + * @param {number} angle - The angle to reverse, in radians. + * + * @return {number} The reversed angle, in radians. + */ +var Reverse = function (angle) +{ + return Normalize(angle + Math.PI); +}; + +module.exports = Reverse; + + +/***/ }), +/* 1087 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Takes an angle in Phasers default clockwise format and converts it so that + * 0 is North, 90 is West, 180 is South and 270 is East, + * therefore running counter-clockwise instead of clockwise. + * + * You can pass in the angle from a Game Object using: + * + * ```javascript + * var converted = CounterClockwise(gameobject.rotation); + * ``` + * + * All values for this function are in radians. + * + * @function Phaser.Math.Angle.CounterClockwise + * @since 3.16.0 + * + * @param {number} angle - The angle to convert, in radians. + * + * @return {number} The converted angle, in radians. + */ +var CounterClockwise = function (angle) +{ + return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2); +}; + +module.exports = CounterClockwise; + + +/***/ }), +/* 1088 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenY + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var BetweenY = function (x1, y1, x2, y2) +{ + return Math.atan2(x2 - x1, y2 - y1); +}; + +module.exports = BetweenY; + + +/***/ }), +/* 1089 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenPointsY + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point1 - The first point. + * @param {(Phaser.Geom.Point|object)} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPointsY = function (point1, point2) +{ + return Math.atan2(point2.x - point1.x, point2.y - point1.y); +}; + +module.exports = BetweenPointsY; + + +/***/ }), +/* 1090 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * Calculates the angle of the vector from the first point to the second point. + * + * @function Phaser.Math.Angle.BetweenPoints + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point1 - The first point. + * @param {(Phaser.Geom.Point|object)} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPoints = function (point1, point2) +{ + return Math.atan2(point2.y - point1.y, point2.x - point1.x); +}; + +module.exports = BetweenPoints; + + +/***/ }), +/* 1091 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Angle + */ + +module.exports = { + + Between: __webpack_require__(386), + BetweenPoints: __webpack_require__(1090), + BetweenPointsY: __webpack_require__(1089), + BetweenY: __webpack_require__(1088), + CounterClockwise: __webpack_require__(1087), + Normalize: __webpack_require__(385), + Reverse: __webpack_require__(1086), + RotateTo: __webpack_require__(1085), + ShortestBetween: __webpack_require__(1084), + Wrap: __webpack_require__(214), + WrapDegrees: __webpack_require__(213) + +}; + + +/***/ }), +/* 1092 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137990,22 +152908,23 @@ function init () { var i; - var fs = [ - 'requestFullscreen', - 'requestFullScreen', - 'webkitRequestFullscreen', - 'webkitRequestFullScreen', - 'msRequestFullscreen', - 'msRequestFullScreen', - 'mozRequestFullScreen', - 'mozRequestFullscreen' - ]; + var suffix1 = 'Fullscreen'; + var suffix2 = 'FullScreen'; - var element = document.createElement('div'); + var fs = [ + 'request' + suffix1, + 'request' + suffix2, + 'webkitRequest' + suffix1, + 'webkitRequest' + suffix2, + 'msRequest' + suffix1, + 'msRequest' + suffix2, + 'mozRequest' + suffix2, + 'mozRequest' + suffix1 + ]; for (i = 0; i < fs.length; i++) { - if (element[fs[i]]) + if (document.documentElement[fs[i]]) { Fullscreen.available = true; Fullscreen.request = fs[i]; @@ -138014,14 +152933,14 @@ function init () } var cfs = [ - 'cancelFullScreen', - 'exitFullscreen', - 'webkitCancelFullScreen', - 'webkitExitFullscreen', - 'msCancelFullScreen', - 'msExitFullscreen', - 'mozCancelFullScreen', - 'mozExitFullscreen' + 'cancel' + suffix2, + 'exit' + suffix1, + 'webkitCancel' + suffix2, + 'webkitExit' + suffix1, + 'msCancel' + suffix2, + 'msExit' + suffix1, + 'mozCancel' + suffix2, + 'mozExit' + suffix1 ]; if (Fullscreen.available) @@ -138037,11 +152956,14 @@ function init () } // Keyboard Input? - if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT']) + // Safari 5.1 says it supports fullscreen keyboard, but is lying. + if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT'] && !(/ Version\/5\.1(?:\.\d+)? Safari\//).test(navigator.userAgent)) { Fullscreen.keyboard = true; } + Object.defineProperty(Fullscreen, 'active', { get: function () { return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } }); + return Fullscreen; } @@ -138049,12 +152971,12 @@ module.exports = init(); /***/ }), -/* 900 */ +/* 1093 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138134,16 +153056,16 @@ module.exports = init(); /***/ }), -/* 901 */ +/* 1094 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Browser = __webpack_require__(118); +var Browser = __webpack_require__(128); /** * Determines the audio playback capabilities of the device running this Phaser Game instance. @@ -138259,17 +153181,17 @@ module.exports = init(); /***/ }), -/* 902 */ +/* 1095 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); -var Browser = __webpack_require__(118); +var OS = __webpack_require__(99); +var Browser = __webpack_require__(128); /** * Determines the input support of the browser running this Phaser Game instance. @@ -138338,1730 +153260,7 @@ module.exports = init(); /***/ }), -/* 903 */ -/***/ (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__(26); -var Device = __webpack_require__(340); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(4); -var IsPlainObject = __webpack_require__(8); -var MATH = __webpack_require__(16); -var NOOP = __webpack_require__(1); -var DefaultPlugins = __webpack_require__(167); -var ValueToColor = __webpack_require__(178); - -/** - * This callback type is completely empty, a no-operation. - * - * @callback NOOP - */ - -/** - * @callback BootCallback - * - * @param {Phaser.Game} game - The game. - */ - -/** - * @typedef {object} InputConfig - * - * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. - * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. - * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. - * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. - * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. - */ - -/** - * @typedef {object} MouseInputConfig - * - * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether mouse input events have preventDefault() called on them. - */ - -/** - * @typedef {object} KeyboardInputConfig - * - * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. - */ - -/** - * @typedef {object} TouchInputConfig - * - * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. - */ - -/** - * @typedef {object} GamepadInputConfig - * - * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. - */ - -/** - * @typedef {object} BannerConfig - * - * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. - * @property {string} [text='#ffffff'] - The color of the banner text. - * @property {string[]} [background] - The background colors of the banner. - */ - -/** - * @typedef {object} FPSConfig - * - * @property {integer} [min=10] - The minimum acceptable rendering rate, in frames per second. - * @property {integer} [target=60] - The optimum rendering rate, in frames per second. - * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. - * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. - * @property {integer} [panicMax=120] - [description] - */ - -/** - * @typedef {object} RenderConfig - * - * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. - * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. - * @property {boolean} [autoResize=true] - Automatically resize the Game Canvas if you resize the renderer. - * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. - * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. - * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. - * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. - * @property {boolean} [preserveDrawingBuffer=false] - In WebGL mode, the drawing buffer won't be cleared automatically each frame. - * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. - * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. - * @property {integer} [batchSize=2000] - The default WebGL batch size. - * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - -/** - * @typedef {object} ScaleConfig - * - * @property {(integer|string)} [width=1024] - The base width of your game. - * @property {(integer|string)} [height=768] - The base height of your game. - * @property {integer} [zoom=1] - The zoom value of the game canvas. - * @property {number} [resolution=1] - The rendering resolution of the canvas. - * @property {(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {integer} [mode=0] - The scale mode to apply to the canvas. SHOW_ALL, EXACT_FIT, USER_SCALE, or RESIZE. - * @property {integer} [minWidth] - The minimum width the canvas can be scaled down to. - * @property {integer} [minHeight] - The minimum height the canvas can be scaled down to. - * @property {integer} [maxWidth] - The maximum width the canvas can be scaled up to. - * @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to. - */ - -/** - * @typedef {object} CallbacksConfig - * - * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. - * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. - */ - -/** - * @typedef {object} LoaderConfig - * - * @property {string} [baseURL] - An URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. - * @property {string} [path] - An URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. - * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. - * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. - * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. - * @property {boolean} [async=true] - Should the XHR request use async or not? - * @property {string} [user] - Optional username for the XHR request. - * @property {string} [password] - Optional password for the XHR request. - * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. - */ - -/** - * @typedef {object} DOMContainerConfig - * - * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. - * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. - */ - -/** - * @typedef {object} ImagesConfig - * - * @property {string} [default] - URL to use for the 'default' texture. - * @property {string} [missing] - URL to use for the 'missing' texture. - */ - -/** - * @typedef {object} PhysicsConfig - * - * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. - * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. - * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. - * @property {object} [matter] - Matter Physics configuration. - */ - -/** - * @typedef {object} PluginObjectItem - * - * @property {string} [key] - A key to identify the plugin in the Plugin Manager. - * @property {*} [plugin] - The plugin itself. Usually a class/constructor. - * @property {boolean} [start] - Whether the plugin should be started automatically. - * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). - * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). - * @property {*} [data] - Arbitrary data passed to the plugin's init() method. - * - * @example - * // Global plugin - * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } - * @example - * // Scene plugin - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - */ - -/** - * @typedef {object} PluginObject - * - * @property {?PluginObjectItem[]} [global] - Global plugins to install. - * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. - * @property {string[]} [default] - The default set of scene plugins (names). - * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. - */ - -/** - * @typedef {object} GameConfig - * - * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. - * @property {(integer|string)} [height=768] - The height of the game, in game pixels. - * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. - * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. - * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. - * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. - * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. - * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. - * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. - * @property {string[]} [seed] - Seed for the random number generator. - * @property {string} [title=''] - The title of the game. Shown in the browser console. - * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. - * @property {string} [version=''] - The version of the game. Shown in the browser console. - * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. - * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. - * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). - * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. - * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. - * @property {FPSConfig} [fps] - Game loop configuration. - * @property {RenderConfig} [render] - Game renderer configuration. - * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. - * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. - * @property {LoaderConfig} [loader] - Loader configuration. - * @property {ImagesConfig} [images] - Images configuration. - * @property {object} [physics] - Physics configuration. - * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. - */ - -/** - * @classdesc - * The active game configuration settings, parsed from a {@link GameConfig} object. - * - * @class Config - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. - * - * @see Phaser.Game#config - */ -var Config = new Class({ - - initialize: - - function Config (config) - { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; - - var defaultBannerTextColor = '#ffffff'; - - /** - * @const {(integer|string)} Phaser.Boot.Config#width - [description] - */ - this.width = GetValue(config, 'width', 1024); - - /** - * @const {(integer|string)} Phaser.Boot.Config#height - [description] - */ - this.height = GetValue(config, 'height', 768); - - /** - * @const {number} Phaser.Boot.Config#zoom - [description] - */ - this.zoom = GetValue(config, 'zoom', 1); - - /** - * @const {number} Phaser.Boot.Config#resolution - [description] - */ - this.resolution = GetValue(config, 'resolution', 1); - - /** - * @const {?*} Phaser.Boot.Config#parent - [description] - */ - this.parent = GetValue(config, 'parent', null); - - /** - * @const {integer} Phaser.Boot.Config#scaleMode - [description] - */ - this.scaleMode = GetValue(config, 'scaleMode', 0); - - /** - * @const {boolean} Phaser.Boot.Config#expandParent - [description] - */ - this.expandParent = GetValue(config, 'expandParent', false); - - /** - * @const {integer} Phaser.Boot.Config#minWidth - [description] - */ - this.minWidth = GetValue(config, 'minWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxWidth - [description] - */ - this.maxWidth = GetValue(config, 'maxWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#minHeight - [description] - */ - this.minHeight = GetValue(config, 'minHeight', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxHeight - [description] - */ - this.maxHeight = GetValue(config, 'maxHeight', 0); - - // Scale Manager - Anything set in here over-rides anything set above - - var scaleConfig = GetValue(config, 'scale', null); - - if (scaleConfig) - { - this.width = GetValue(scaleConfig, 'width', this.width); - this.height = GetValue(scaleConfig, 'height', this.height); - this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); - this.parent = GetValue(scaleConfig, 'parent', this.parent); - this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); - this.expandParent = GetValue(scaleConfig, 'mode', this.expandParent); - this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); - this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); - this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); - this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); - } - - /** - * @const {number} Phaser.Boot.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) - */ - this.renderType = GetValue(config, 'type', CONST.AUTO); - - /** - * @const {?HTMLCanvasElement} Phaser.Boot.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. - */ - this.canvas = GetValue(config, 'canvas', null); - - /** - * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Boot.Config#context - Force Phaser to use your own Canvas context instead of creating one. - */ - this.context = GetValue(config, 'context', null); - - /** - * @const {?string} Phaser.Boot.Config#canvasStyle - [description] - */ - this.canvasStyle = GetValue(config, 'canvasStyle', null); - - /** - * @const {?object} Phaser.Boot.Config#sceneConfig - [description] - */ - this.sceneConfig = GetValue(config, 'scene', null); - - /** - * @const {string[]} Phaser.Boot.Config#seed - [description] - */ - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - - MATH.RND.init(this.seed); - - /** - * @const {string} Phaser.Boot.Config#gameTitle - The title of the game. - */ - this.gameTitle = GetValue(config, 'title', ''); - - /** - * @const {string} Phaser.Boot.Config#gameURL - The URL of the game. - */ - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - - /** - * @const {string} Phaser.Boot.Config#gameVersion - The version of the game. - */ - this.gameVersion = GetValue(config, 'version', ''); - - /** - * @const {boolean} Phaser.Boot.Config#autoFocus - [description] - */ - this.autoFocus = GetValue(config, 'autoFocus', true); - - // DOM Element Container - - /** - * @const {?boolean} Phaser.Boot.Config#domCreateContainer - [description] - */ - this.domCreateContainer = GetValue(config, 'dom.createContainer', false); - - /** - * @const {?boolean} Phaser.Boot.Config#domBehindCanvas - [description] - */ - this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); - - // Input - - /** - * @const {boolean} Phaser.Boot.Config#inputKeyboard - [description] - */ - this.inputKeyboard = GetValue(config, 'input.keyboard', true); - - /** - * @const {*} Phaser.Boot.Config#inputKeyboardEventTarget - [description] - */ - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); - - /** - * @const {(boolean|object)} Phaser.Boot.Config#inputMouse - [description] - */ - this.inputMouse = GetValue(config, 'input.mouse', true); - - /** - * @const {?*} Phaser.Boot.Config#inputMouseEventTarget - [description] - */ - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputMouseCapture - [description] - */ - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouch - [description] - */ - this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); - - /** - * @const {?*} Phaser.Boot.Config#inputTouchEventTarget - [description] - */ - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouchCapture - [description] - */ - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); - - /** - * @const {integer} Phaser.Boot.Config#inputActivePointers - [description] - */ - this.inputActivePointers = GetValue(config, 'input.activePointers', 1); - - /** - * @const {boolean} Phaser.Boot.Config#inputGamepad - [description] - */ - this.inputGamepad = GetValue(config, 'input.gamepad', false); - - /** - * @const {*} Phaser.Boot.Config#inputGamepadEventTarget - [description] - */ - this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); - - /** - * @const {boolean} Phaser.Boot.Config#disableContextMenu - Set to `true` to disable context menu. Default value is `false`. - */ - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - - /** - * @const {any} Phaser.Boot.Config#audio - [description] - */ - this.audio = GetValue(config, 'audio'); - - // If you do: { banner: false } it won't display any banner at all - - /** - * @const {boolean} Phaser.Boot.Config#hideBanner - [description] - */ - this.hideBanner = (GetValue(config, 'banner', null) === false); - - /** - * @const {boolean} Phaser.Boot.Config#hidePhaser - [description] - */ - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - - /** - * @const {string} Phaser.Boot.Config#bannerTextColor - [description] - */ - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - - /** - * @const {string[]} Phaser.Boot.Config#bannerBackgroundColor - [description] - */ - 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 - // } - - /** - * @const {?FPSConfig} Phaser.Boot.Config#fps - [description] - */ - this.fps = GetValue(config, 'fps', null); - - // Renderer Settings - // These can either be in a `render` object within the Config, or specified on their own - - var renderConfig = GetValue(config, 'render', config); - - /** - * @const {boolean} Phaser.Boot.Config#autoResize - Automatically resize the Game Canvas if you resize the renderer. - */ - this.autoResize = GetValue(renderConfig, 'autoResize', true); - - /** - * @const {boolean} Phaser.Boot.Config#antialias - [description] - */ - this.antialias = GetValue(renderConfig, 'antialias', true); - - /** - * @const {boolean} Phaser.Boot.Config#roundPixels - [description] - */ - this.roundPixels = GetValue(renderConfig, 'roundPixels', false); - - /** - * @const {boolean} Phaser.Boot.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). - */ - this.pixelArt = GetValue(renderConfig, 'pixelArt', false); - - if (this.pixelArt) - { - this.antialias = false; - this.roundPixels = true; - } - - /** - * @const {boolean} Phaser.Boot.Config#transparent - [description] - */ - this.transparent = GetValue(renderConfig, 'transparent', false); - - /** - * @const {boolean} Phaser.Boot.Config#clearBeforeRender - [description] - */ - this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); - - /** - * @const {boolean} Phaser.Boot.Config#premultipliedAlpha - [description] - */ - this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); - - /** - * @const {boolean} Phaser.Boot.Config#preserveDrawingBuffer - [description] - */ - this.preserveDrawingBuffer = GetValue(renderConfig, 'preserveDrawingBuffer', false); - - /** - * @const {boolean} Phaser.Boot.Config#failIfMajorPerformanceCaveat - [description] - */ - this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); - - /** - * @const {string} Phaser.Boot.Config#powerPreference - [description] - */ - this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); - - /** - * @const {integer} Phaser.Boot.Config#batchSize - The default WebGL Batch size. - */ - this.batchSize = GetValue(renderConfig, 'batchSize', 2000); - - /** - * @const {integer} Phaser.Boot.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - this.maxLights = GetValue(renderConfig, 'maxLights', 10); - - var bgc = GetValue(config, 'backgroundColor', 0); - - /** - * @const {Phaser.Display.Color} Phaser.Boot.Config#backgroundColor - [description] - */ - this.backgroundColor = ValueToColor(bgc); - - if (bgc === 0 && this.transparent) - { - this.backgroundColor.alpha = 0; - } - - // Callbacks - - /** - * @const {BootCallback} Phaser.Boot.Config#preBoot - [description] - */ - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); - - /** - * @const {BootCallback} Phaser.Boot.Config#postBoot - [description] - */ - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); - - // Physics - // physics: { - // system: 'impact', - // setBounds: true, - // gravity: 0, - // cellSize: 64 - // } - - /** - * @const {object} Phaser.Boot.Config#physics - [description] - */ - this.physics = GetValue(config, 'physics', {}); - - /** - * @const {boolean} Phaser.Boot.Config#defaultPhysicsSystem - [description] - */ - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); - - // Loader Defaults - - /** - * @const {string} Phaser.Boot.Config#loaderBaseURL - [description] - */ - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPath - [description] - */ - this.loaderPath = GetValue(config, 'loader.path', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). - */ - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); - - /** - * @const {(string|undefined)} Phaser.Boot.Config#loaderCrossOrigin - [description] - */ - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - - /** - * @const {string} Phaser.Boot.Config#loaderResponseType - [description] - */ - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - - /** - * @const {boolean} Phaser.Boot.Config#loaderAsync - [description] - */ - this.loaderAsync = GetValue(config, 'loader.async', true); - - /** - * @const {string} Phaser.Boot.Config#loaderUser - [description] - */ - this.loaderUser = GetValue(config, 'loader.user', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPassword - [description] - */ - this.loaderPassword = GetValue(config, 'loader.password', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderTimeout - [description] - */ - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); - - // Plugins - - /* - * Allows `plugins` property to either be an array, in which case it just replaces - * the default plugins like previously, or a config object. - * - * plugins: { - * global: [ - * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, - * ], - * scene: [ - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - * ], - * default: [], OR - * defaultMerge: [ - * 'ModPlayer' - * ] - * } - */ - - /** - * @const {any} Phaser.Boot.Config#installGlobalPlugins - [description] - */ - this.installGlobalPlugins = []; - - /** - * @const {any} Phaser.Boot.Config#installScenePlugins - [description] - */ - this.installScenePlugins = []; - - var plugins = GetValue(config, 'plugins', null); - var defaultPlugins = DefaultPlugins.DefaultScene; - - if (plugins) - { - // Old 3.7 array format? - if (Array.isArray(plugins)) - { - this.defaultPlugins = plugins; - } - else if (IsPlainObject(plugins)) - { - this.installGlobalPlugins = GetFastValue(plugins, 'global', []); - this.installScenePlugins = GetFastValue(plugins, 'scene', []); - - if (Array.isArray(plugins.default)) - { - defaultPlugins = plugins.default; - } - else if (Array.isArray(plugins.defaultMerge)) - { - defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); - } - } - } - - /** - * @const {any} Phaser.Boot.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). - */ - this.defaultPlugins = defaultPlugins; - - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - - /** - * @const {string} Phaser.Boot.Config#defaultImage - [description] - */ - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - - /** - * @const {string} Phaser.Boot.Config#missingImage - [description] - */ - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); - - if (window) - { - if (window.FORCE_WEBGL) - { - this.renderType = CONST.WEBGL; - } - else if (window.FORCE_CANVAS) - { - this.renderType = CONST.CANVAS; - } - } - } - -}); - -module.exports = Config; - - -/***/ }), -/* 904 */ -/***/ (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 AddToDOM = __webpack_require__(169); -var AnimationManager = __webpack_require__(381); -var CacheManager = __webpack_require__(379); -var CanvasPool = __webpack_require__(24); -var Class = __webpack_require__(0); -var Config = __webpack_require__(903); -var CreateRenderer = __webpack_require__(898); -var DataManager = __webpack_require__(123); -var DebugHeader = __webpack_require__(891); -var Device = __webpack_require__(340); -var DOMContentLoaded = __webpack_require__(344); -var EventEmitter = __webpack_require__(11); -var InputManager = __webpack_require__(338); -var PluginCache = __webpack_require__(15); -var PluginManager = __webpack_require__(331); -var SceneManager = __webpack_require__(329); -var SoundManagerCreator = __webpack_require__(325); -var TextureManager = __webpack_require__(318); -var TimeStep = __webpack_require__(878); -var VisibilityHandler = __webpack_require__(877); - -if (false) -{ var CreateDOMContainer; } - -if (false) -{ var FacebookInstantGamesPlugin; } - -/** - * @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 {GameConfig} [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; - - if (false) - {} - - /** - * A reference to the HTML Canvas Element that Phaser uses to render the game. - * This is created automatically by Phaser unless you provide a `canvas` property - * in your Game Config. - * - * @name Phaser.Game#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = null; - - /** - * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. - * If the game is running under Canvas it will be a 2d Canvas Rendering Context. - * If the game is running under WebGL it will be a WebGL Rendering Context. - * This context is created automatically by Phaser unless you provide a `context` property - * in your Game Config. - * - * @name Phaser.Game#context - * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} - * @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 {Phaser.Events.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); - - /** - * An instance of the Data Manager - * - * @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); - - /** - * 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.DeviceConf} - * @since 3.0.0 - */ - this.device = Device; - - /** - * 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.Sound.BaseSoundManager} - * @since 3.0.0 - */ - this.sound = SoundManagerCreator.create(this); - - /** - * 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); - - /** - * 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.Plugins.PluginManager} - * @since 3.0.0 - */ - this.plugins = new PluginManager(this, this.config); - - if (false) - {} - - /** - * Is this Game pending destruction at the start of the next frame? - * - * @name Phaser.Game#pendingDestroy - * @type {boolean} - * @private - * @since 3.5.0 - */ - this.pendingDestroy = false; - - /** - * Remove the Canvas once the destroy is over? - * - * @name Phaser.Game#removeCanvas - * @type {boolean} - * @private - * @since 3.5.0 - */ - this.removeCanvas = false; - - /** - * Remove everything when the game is destroyed. - * You cannot create a new Phaser instance on the same web page after doing this. - * - * @name Phaser.Game#noReturn - * @type {boolean} - * @private - * @since 3.12.0 - */ - this.noReturn = false; - - /** - * Does the window the game is running in currently have focus or not? - * This is modified by the VisibilityHandler. - * - * @name Phaser.Game#hasFocus - * @type {boolean} - * @readonly - * @since 3.9.0 - */ - this.hasFocus = false; - - /** - * Is the mouse pointer currently over the game canvas or not? - * This is modified by the VisibilityHandler. - * - * @name Phaser.Game#isOver - * @type {boolean} - * @readonly - * @since 3.10.0 - */ - this.isOver = true; - - // Wait for the DOM Ready event, then call boot. - DOMContentLoaded(this.boot.bind(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`. - * - * @method Phaser.Game#boot - * @protected - * @fires Phaser.Game#boot - * @since 3.0.0 - */ - boot: function () - { - if (!PluginCache.hasCore('EventEmitter')) - { - console.warn('Aborting. Core Plugins missing.'); - return; - } - - this.isBooted = true; - - this.config.preBoot(this); - - CreateRenderer(this); - - if (false) - {} - - 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 internal event when done: - this.events.once('texturesready', this.texturesReady, this); - }, - - /** - * Called automatically when the Texture Manager has finished setting up and preparing the - * default textures. - * - * @method Phaser.Game#texturesReady - * @private - * @fires Phaser.Game#ready - * @since 3.12.0 - */ - texturesReady: function () - { - // Start all the other systems - this.events.emit('ready'); - - this.start(); - }, - - /** - * 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; - - this.config.postBoot(this); - - if (this.renderer) - { - this.loop.start(this.step.bind(this)); - } - else - { - this.loop.start(this.headlessStep.bind(this)); - } - - VisibilityHandler(this); - - var eventEmitter = this.events; - - eventEmitter.on('hidden', this.onHidden, this); - eventEmitter.on('visible', this.onVisible, this); - eventEmitter.on('blur', this.onBlur, this); - eventEmitter.on('focus', this.onFocus, this); - }, - - /** - * Game Pre-Step event. - * - * Listen for it using the event type `prestep`. - * - * This event is dispatched before the main Step starts. - * By this point none of the Scene updates have happened. - * Hook into it from plugins or systems that need to update before the Scene Manager does. - * - * @event Phaser.Game#prestepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Step event. - * - * Listen for it using the event type `step`. - * - * This event is dispatched after Pre-Step and before the Scene Manager steps. - * Hook into it from plugins or systems that need to update before the Scene Manager does, but after core Systems. - * - * @event Phaser.Game#stepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Post-Step event. - * - * Listen for it using the event type `poststep`. - * - * This event is dispatched after the Scene Manager has updated. - * Hook into it from plugins or systems that need to do things before the render starts. - * - * @event Phaser.Game#poststepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Pre-Render event. - * - * Listen for it using the event type `prerender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * Game Post-Render event. - * - * Listen for it using the event type `postrender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * 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#prestepEvent - * @fires Phaser.Game#stepEvent - * @fires Phaser.Game#poststepEvent - * @fires Phaser.Game#prerenderEvent - * @fires Phaser.Game#postrenderEvent - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - step: function (time, delta) - { - if (this.pendingDestroy) - { - return this.runDestroy(); - } - - var eventEmitter = this.events; - - // Global Managers like Input and Sound update in the prestep - - eventEmitter.emit('prestep', time, delta); - - // This is mostly meant for user-land code and plugins - - eventEmitter.emit('step', time, delta); - - // Update the Scene Manager and all active Scenes - - this.scene.update(time, delta); - - // Our final event before rendering starts - - eventEmitter.emit('poststep', time, delta); - - var renderer = this.renderer; - - // Run the Pre-render (clearing the canvas, setting background colors, etc) - - renderer.preRender(); - - eventEmitter.emit('prerender', renderer, time, delta); - - // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. - - this.scene.render(renderer); - - // The Post-Render call. Tidies up loose end, takes snapshots, etc. - - renderer.postRender(); - - // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. - - eventEmitter.emit('postrender', renderer, time, delta); - }, - - /** - * 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 {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - headlessStep: function (time, delta) - { - var eventEmitter = this.events; - - // Global Managers - - eventEmitter.emit('prestep', time, delta); - - eventEmitter.emit('step', time, delta); - - // Scenes - - this.scene.update(time, delta); - - eventEmitter.emit('poststep', time, delta); - - // Render - - eventEmitter.emit('prerender'); - - eventEmitter.emit('postrender'); - }, - - /** - * Game Pause event. - * - * Listen for it using the event type `pause`. - * - * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. - * - * @event Phaser.Game#pauseEvent - */ - - /** - * 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(); - - this.events.emit('pause'); - }, - - /** - * Game Resume event. - * - * Listen for it using the event type `resume`. - * - * 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.Game#onVisible - * @protected - * @fires Phaser.Game#resumeEvent - * @since 3.0.0 - */ - onVisible: function () - { - this.loop.resume(); - - this.events.emit('resume'); - }, - - /** - * 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.hasFocus = false; - - this.loop.blur(); - }, - - /** - * 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.hasFocus = true; - - this.loop.focus(); - }, - - /** - * Game Resize event. - * - * Listen for it using the event type `resize`. - * - * @event Phaser.Game#resizeEvent - * @param {number} width - The new width of the Game. - * @param {number} height - The new height of the Game. - */ - - /** - * Updates the Game Config with the new width and height values given. - * Then resizes the Renderer and Input Manager scale. - * - * @method Phaser.Game#resize - * @fires Phaser.Game#resizeEvent - * @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; - - if (false) - {} - - this.renderer.resize(width, height); - - this.input.resize(); - - this.scene.resize(width, height); - - this.events.emit('resize', width, height); - }, - - /** - * Game Destroy event. - * - * Listen for it using the event type `destroy`. - * - * @event Phaser.Game#destroyEvent - */ - - /** - * Flags this Game instance as needing to be destroyed on the next frame. - * It will wait until the current frame has completed and then call `runDestroy` internally. - * - * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up - * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. - * - * @method Phaser.Game#destroy - * @fires Phaser.Game#destroyEvent - * @since 3.0.0 - * - * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. - * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. - */ - destroy: function (removeCanvas, noReturn) - { - if (noReturn === undefined) { noReturn = false; } - - this.pendingDestroy = true; - - this.removeCanvas = removeCanvas; - this.noReturn = noReturn; - }, - - /** - * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. - * - * @method Phaser.Game#runDestroy - * @private - * @since 3.5.0 - */ - runDestroy: function () - { - this.events.emit('destroy'); - - this.events.removeAllListeners(); - - this.scene.destroy(); - - if (this.renderer) - { - this.renderer.destroy(); - } - - if (this.removeCanvas && this.canvas) - { - CanvasPool.remove(this.canvas); - - if (this.canvas.parentNode) - { - this.canvas.parentNode.removeChild(this.canvas); - } - } - - if (false) - {} - - this.loop.destroy(); - - this.pendingDestroy = false; - } - -}); - -module.exports = Game; - - -/***/ }), -/* 905 */ -/***/ (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 EE = __webpack_require__(11); -var PluginCache = __webpack_require__(15); - -/** - * @classdesc - * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. - * - * @class EventEmitter - * @memberof Phaser.Events - * @constructor - * @since 3.0.0 - */ -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 () - { - this.removeAllListeners(); - } - -}); - -/** - * Return an array listing the events for which the emitter has registered listeners. - * - * @method Phaser.Events.EventEmitter#eventNames - * @since 3.0.0 - * - * @return {array} - */ - -/** - * Return the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#listeners - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {array} The registered listeners. - */ - -/** - * Return the number of listeners listening to a given event. - * - * @method Phaser.Events.EventEmitter#listenerCount - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {number} The number of listeners. - */ - -/** - * Calls each of the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#emit - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {...*} [args] - Additional arguments that will be passed to the event handler. - * - * @return {boolean} `true` if the event had listeners, else `false`. - */ - -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#on - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#addListener - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Add a one-time listener for a given event. - * - * @method Phaser.Events.EventEmitter#once - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#removeListener - * @since 3.0.0 - * - * @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 {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#off - * @since 3.0.0 - * - * @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 {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove all listeners, or those of the specified event. - * - * @method Phaser.Events.EventEmitter#removeAllListeners - * @since 3.0.0 - * - * @param {(string|symbol)} [event] - The event name. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -PluginCache.register('EventEmitter', EventEmitter, 'events'); - -module.exports = EventEmitter; - - -/***/ }), -/* 906 */ -/***/ (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.Events - */ - -module.exports = { EventEmitter: __webpack_require__(905) }; - - -/***/ }), -/* 907 */ +/* 1096 */ /***/ (function(module, exports) { // shim for using process in browser @@ -140251,2597 +153450,601 @@ process.umask = function() { return 0; }; /***/ }), -/* 908 */ +/* 1097 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.DOM - */ - -var Dom = { - - AddToDOM: __webpack_require__(169), - DOMContentLoaded: __webpack_require__(344), - ParseXML: __webpack_require__(343), - RemoveFromDOM: __webpack_require__(342), - RequestAnimationFrame: __webpack_require__(341) - -}; - -module.exports = Dom; - - -/***/ }), -/* 909 */ -/***/ (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.Display.Masks + * @namespace Phaser.Core */ module.exports = { - BitmapMask: __webpack_require__(394), - GeometryMask: __webpack_require__(393) + Config: __webpack_require__(390), + CreateRenderer: __webpack_require__(367), + DebugHeader: __webpack_require__(365), + Events: __webpack_require__(26), + TimeStep: __webpack_require__(364), + VisibilityHandler: __webpack_require__(362) }; /***/ }), -/* 910 */ -/***/ (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 ComponentToHex = __webpack_require__(346); - -/** - * 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 (prefix === '#') - { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - else - { - return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); - } -}; - -module.exports = RGBToString; - - -/***/ }), -/* 911 */ -/***/ (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 Between = __webpack_require__(170); -var Color = __webpack_require__(37); - -/** - * 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; } - - return new Color(Between(min, max), Between(min, max), Between(min, max)); -}; - -module.exports = RandomRGB; - - -/***/ }), -/* 912 */ -/***/ (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 Linear = __webpack_require__(119); - -/** - * Interpolates color values - * - * @namespace Phaser.Display.Color.Interpolate - * @since 3.0.0 - */ - -/** - * 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; } - - var t = index / length; - - return { - r: Linear(r1, r2, t), - g: Linear(g1, g2, t), - b: Linear(b1, b2, t) - }; -}; - -/** - * 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; } - - 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; } - - return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); -}; - -module.exports = { - - RGBWithRGB: RGBWithRGB, - ColorWithRGB: ColorWithRGB, - ColorWithColor: ColorWithColor - -}; - - -/***/ }), -/* 913 */ -/***/ (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 HSVToRGB = __webpack_require__(176); - -/** - * 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 {ColorObject[]} 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++) - { - colors.push(HSVToRGB(c / 359, s, v)); - } - - return colors; -}; - -module.exports = HSVColorWheel; - - -/***/ }), -/* 914 */ -/***/ (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__(37); -var HueToComponent = __webpack_require__(345); - -/** - * 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 q = (l < 0.5) ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - - r = HueToComponent(p, q, h + 1 / 3); - g = HueToComponent(p, q, h); - b = HueToComponent(p, q, h - 1 / 3); - } - - var color = new Color(); - - return color.setGLTo(r, g, b, 1); -}; - -module.exports = HSLToColor; - - -/***/ }), -/* 915 */ +/* 1098 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Systems Wake Event. + * + * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('wake', listener)`. + * + * @event Phaser.Scenes.Events#WAKE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was woken up. */ -var ColorToRGBA = function (color) -{ - var output = { - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF, - a: 255 - }; - - if (color > 16777215) - { - output.a = color >>> 24; - } - - return output; -}; - -module.exports = ColorToRGBA; +module.exports = 'wake'; /***/ }), -/* 916 */ +/* 1099 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Systems Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('update', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ -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; - }); - - canvas.style['-webkit-touch-callout'] = value; - canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - - return canvas; -}; - -module.exports = UserSelect; +module.exports = 'update'; /***/ }), -/* 917 */ +/* 1100 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Wake Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before + * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead. + * + * Listen to it from a Scene using `this.scene.events.on('transitionwake', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_WAKE + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -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; -}; - -module.exports = TouchAction; +module.exports = 'transitionwake'; /***/ }), -/* 918 */ -/***/ (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.Display.Canvas - */ - -module.exports = { - - CanvasInterpolation: __webpack_require__(348), - CanvasPool: __webpack_require__(24), - Smoothing: __webpack_require__(120), - TouchAction: __webpack_require__(917), - UserSelect: __webpack_require__(916) - -}; - - -/***/ }), -/* 919 */ +/* 1101 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Start Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep. + * + * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method, + * this event is dispatched anyway. + * + * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is + * dispatched instead of this event. + * + * Listen to it from a Scene using `this.scene.events.on('transitionstart', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_START + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -var GetOffsetY = function (gameObject) -{ - return gameObject.height * gameObject.originY; -}; - -module.exports = GetOffsetY; +module.exports = 'transitionstart'; /***/ }), -/* 920 */ +/* 1102 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Out Event. + * + * This event is dispatched by a Scene when it initiates a transition to another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('transitionout', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_OUT + * + * @param {Phaser.Scene} target - A reference to the Scene that is being transitioned to. + * @param {number} duration - The duration of the transition in ms. */ -var GetOffsetX = function (gameObject) -{ - return gameObject.width * gameObject.originX; -}; - -module.exports = GetOffsetX; +module.exports = 'transitionout'; /***/ }), -/* 921 */ -/***/ (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.Display.Bounds - */ - -module.exports = { - - CenterOn: __webpack_require__(411), - GetBottom: __webpack_require__(48), - GetCenterX: __webpack_require__(75), - GetCenterY: __webpack_require__(72), - GetLeft: __webpack_require__(46), - GetOffsetX: __webpack_require__(920), - GetOffsetY: __webpack_require__(919), - GetRight: __webpack_require__(44), - GetTop: __webpack_require__(42), - SetBottom: __webpack_require__(47), - SetCenterX: __webpack_require__(74), - SetCenterY: __webpack_require__(73), - SetLeft: __webpack_require__(45), - SetRight: __webpack_require__(43), - SetTop: __webpack_require__(41) - -}; - - -/***/ }), -/* 922 */ -/***/ (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__(44); -var GetTop = __webpack_require__(42); -var SetBottom = __webpack_require__(47); -var SetRight = __webpack_require__(43); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopRight; - - -/***/ }), -/* 923 */ -/***/ (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 GetLeft = __webpack_require__(46); -var GetTop = __webpack_require__(42); -var SetBottom = __webpack_require__(47); -var SetLeft = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopLeft; - - -/***/ }), -/* 924 */ -/***/ (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 GetCenterX = __webpack_require__(75); -var GetTop = __webpack_require__(42); -var SetBottom = __webpack_require__(47); -var SetCenterX = __webpack_require__(74); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopCenter; - - -/***/ }), -/* 925 */ -/***/ (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__(44); -var GetTop = __webpack_require__(42); -var SetLeft = __webpack_require__(45); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = RightTop; - - -/***/ }), -/* 926 */ -/***/ (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 GetCenterY = __webpack_require__(72); -var GetRight = __webpack_require__(44); -var SetCenterY = __webpack_require__(73); -var SetLeft = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = RightCenter; - - -/***/ }), -/* 927 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetRight = __webpack_require__(44); -var SetBottom = __webpack_require__(47); -var SetLeft = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = RightBottom; - - -/***/ }), -/* 928 */ -/***/ (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 GetLeft = __webpack_require__(46); -var GetTop = __webpack_require__(42); -var SetRight = __webpack_require__(43); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = LeftTop; - - -/***/ }), -/* 929 */ -/***/ (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 GetCenterY = __webpack_require__(72); -var GetLeft = __webpack_require__(46); -var SetCenterY = __webpack_require__(73); -var SetRight = __webpack_require__(43); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = LeftCenter; - - -/***/ }), -/* 930 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetLeft = __webpack_require__(46); -var SetBottom = __webpack_require__(47); -var SetRight = __webpack_require__(43); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = LeftBottom; - - -/***/ }), -/* 931 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetRight = __webpack_require__(44); -var SetRight = __webpack_require__(43); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomRight; - - -/***/ }), -/* 932 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetLeft = __webpack_require__(46); -var SetLeft = __webpack_require__(45); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomLeft; - - -/***/ }), -/* 933 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetCenterX = __webpack_require__(75); -var SetCenterX = __webpack_require__(74); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomCenter; - - -/***/ }), -/* 934 */ -/***/ (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.Display.Align.To - */ - -module.exports = { - - BottomCenter: __webpack_require__(933), - BottomLeft: __webpack_require__(932), - BottomRight: __webpack_require__(931), - LeftBottom: __webpack_require__(930), - LeftCenter: __webpack_require__(929), - LeftTop: __webpack_require__(928), - RightBottom: __webpack_require__(927), - RightCenter: __webpack_require__(926), - RightTop: __webpack_require__(925), - TopCenter: __webpack_require__(924), - TopLeft: __webpack_require__(923), - TopRight: __webpack_require__(922) - -}; - - -/***/ }), -/* 935 */ -/***/ (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.Display.Align.In - */ - -module.exports = { - - BottomCenter: __webpack_require__(415), - BottomLeft: __webpack_require__(414), - BottomRight: __webpack_require__(413), - Center: __webpack_require__(412), - LeftCenter: __webpack_require__(410), - QuickSet: __webpack_require__(416), - RightCenter: __webpack_require__(409), - TopCenter: __webpack_require__(408), - TopLeft: __webpack_require__(407), - TopRight: __webpack_require__(406) - -}; - - -/***/ }), -/* 936 */ -/***/ (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 CONST = __webpack_require__(193); -var Extend = __webpack_require__(20); - -/** - * @namespace Phaser.Display.Align - */ - -var Align = { - - In: __webpack_require__(935), - To: __webpack_require__(934) - -}; - -// Merge in the consts -Align = Extend(false, Align, CONST); - -module.exports = Align; - - -/***/ }), -/* 937 */ -/***/ (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.Display - */ - -module.exports = { - - Align: __webpack_require__(936), - Bounds: __webpack_require__(921), - Canvas: __webpack_require__(918), - Color: __webpack_require__(347), - Masks: __webpack_require__(909) - -}; - - -/***/ }), -/* 938 */ -/***/ (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__(123); -var PluginCache = __webpack_require__(15); - -/** - * @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 - A reference to the Scene that this DataManager belongs to. - */ -var DataManagerPlugin = new Class({ - - Extends: DataManager, - - initialize: - - function DataManagerPlugin (scene) - { - DataManager.call(this, scene, scene.sys.events); - - /** - * A reference to the Scene that this DataManager belongs to. - * - * @name Phaser.Data.DataManagerPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene's Systems. - * - * @name Phaser.Data.DataManagerPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Data.DataManagerPlugin#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.events = this.systems.events; - - this.events.once('destroy', this.destroy, this); - }, - - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Data.DataManagerPlugin#start - * @private - * @since 3.5.0 - */ - start: function () - { - this.events.once('shutdown', this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.Data.DataManagerPlugin#shutdown - * @private - * @since 3.5.0 - */ - shutdown: function () - { - this.systems.events.off('shutdown', this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Data.DataManagerPlugin#destroy - * @since 3.5.0 - */ - destroy: function () - { - DataManager.prototype.destroy.call(this); - - this.events.off('start', this.start, this); - - this.scene = null; - this.systems = null; - } - -}); - -PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); - -module.exports = DataManagerPlugin; - - -/***/ }), -/* 939 */ -/***/ (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__(123), - DataManagerPlugin: __webpack_require__(938) - -}; - - -/***/ }), -/* 940 */ -/***/ (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__(3); - -/** - * @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); - }, - - /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.MoveTo#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - 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 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, - - /** - * Gets the resolution of this curve. - * - * @method Phaser.Curves.MoveTo#getResolution - * @since 3.0.0 - * - * @return {number} The resolution of this curve. For a MoveTo the value is always 1. - */ - getResolution: function () - { - return 1; - }, - - /** - * Gets the length of this curve. - * - * @method Phaser.Curves.MoveTo#getLength - * @since 3.0.0 - * - * @return {number} The length of this curve. For a MoveTo the value is always 0. - */ - getLength: function () - { - return 0; - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#toJSON - * @since 3.0.0 - * - * @return {JSONCurve} [description] - */ - toJSON: function () - { - return { - type: 'MoveTo', - points: [ - this.p0.x, this.p0.y - ] - }; - } - -}); - -module.exports = MoveTo; - - -/***/ }), -/* 941 */ -/***/ (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 CubicBezierCurve = __webpack_require__(355); -var EllipseCurve = __webpack_require__(353); -var GameObjectFactory = __webpack_require__(5); -var LineCurve = __webpack_require__(352); -var MovePathTo = __webpack_require__(940); -var QuadraticBezierCurve = __webpack_require__(351); -var Rectangle = __webpack_require__(9); -var SplineCurve = __webpack_require__(349); -var Vector2 = __webpack_require__(3); - -/** - * @typedef {object} JSONPath - * - * @property {string} type - The of the curve. - * @property {number} x - [description] - * @property {number} y - [description] - * @property {boolean} autoClose - The path is auto closed. - * @property {JSONCurve[]} curves - The list of the curves - */ - -/** - * @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({ - - initialize: - - function Path (x, y) - { - 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 {Phaser.Curves.Curve[]} - * @default [] - * @since 3.0.0 - */ - this.curves = []; - - /** - * [description] - * - * @name Phaser.Curves.Path#cacheLengths - * @type {number[]} - * @default [] - * @since 3.0.0 - */ - this.cacheLengths = []; - - /** - * Automatically closes the path. - * - * @name Phaser.Curves.Path#autoClose - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.autoClose = false; - - /** - * [description] - * - * @name Phaser.Curves.Path#startPoint - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.startPoint = new Vector2(); - - /** - * [description] - * - * @name Phaser.Curves.Path#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); - - /** - * [description] - * - * @name Phaser.Curves.Path#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); - - if (typeof x === 'object') - { - this.fromJSON(x); - } - else - { - this.startPoint.set(x, y); - } - }, - - /** - * [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); - - return this; - }, - - /** - * [description] - * - * @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] - */ - circleTo: function (radius, clockwise, rotation) - { - if (clockwise === undefined) { clockwise = false; } - - return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); - }, - - /** - * [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)); - } - - return this; - }, - - /** - * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. - * - * @method Phaser.Curves.Path#cubicBezierTo - * @since 3.0.0 - * - * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vec2, the p1 value. - * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vec2, the p2 value. - * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vec2, the p3 value. - * @param {number} [control1Y] - The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments. - * @param {number} [control2X] - The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. - * @param {number} [control2Y] - The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. - * - * @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) - { - 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.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] - */ - 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.Curves.Path#draw - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.Graphics} G - [out,$return] - * - * @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]; - - if (!curve.active) - { - continue; - } - - curve.draw(graphics, pointsTotal); - } - - return graphics; - }, - - /** - * 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); - - 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.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.curves = []; - this.cacheLengths = []; - - this.startPoint.set(data.x, data.y); - - this.autoClose = data.autoClose; - - for (var i = 0; i < data.curves.length; i++) - { - 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; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getBounds - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @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; - - 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]; - - 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); - } - - out.right = maxRight; - out.bottom = maxBottom; - - return out; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getCurveLengths - * @since 3.0.0 - * - * @return {number[]} [description] - */ - getCurveLengths: function () - { - // We use cache values if curves and cache array are same length - - if (this.cacheLengths.length === this.curves.length) - { - return this.cacheLengths; - } - - // Get length of sub-curve - // Push sums into cached array - - var lengths = []; - var sums = 0; - - for (var i = 0; i < this.curves.length; i++) - { - sums += this.curves[i].getLength(); - - lengths.push(sums); - } - - this.cacheLengths = lengths; - - return lengths; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getEndPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getEndPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - if (this.curves.length > 0) - { - this.curves[this.curves.length - 1].getPoint(1, out); - } - else - { - out.copy(this.startPoint); - } - - return out; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lens = this.getCurveLengths(); - - return lens[lens.length - 1]; - }, - - // 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 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @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(); } - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; - - while (i < curveLengths.length) - { - 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++; - } - - // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) - { - points.push(points[0]); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getRandomPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. - * - * @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)); - } - - if (this.autoClose) - { - points.push(points[0]); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getStartPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - 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.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._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.Curves.Path#splineTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2[]} points - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - splineTo: function (points) - { - points.unshift(this.getEndPoint()); - - return this.add(new SplineCurve(points)); - }, - - /** - * [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)); - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#toJSON - * @since 3.0.0 - * - * @return {JSONPath} [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.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; - - -/***/ }), -/* 942 */ -/***/ (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.Curves - */ - -/** - * @typedef {object} JSONCurve - * - * @property {string} type - The of the curve - * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` - */ - -module.exports = { - Path: __webpack_require__(941), - - CubicBezier: __webpack_require__(355), - Curve: __webpack_require__(70), - Ellipse: __webpack_require__(353), - Line: __webpack_require__(352), - QuadraticBezier: __webpack_require__(351), - Spline: __webpack_require__(349) -}; - - -/***/ }), -/* 943 */ +/* 1103 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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. - * - * @name Phaser.Create.Palettes.MSX - * @since 3.0.0 - * - * @type {Palette} + * The Scene Transition Init Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method, + * this event is not dispatched. + * + * Listen to it from a Scene using `this.scene.events.on('transitioninit', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_INIT + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -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' -}; +module.exports = 'transitioninit'; /***/ }), -/* 944 */ +/* 1104 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.JMP - * @since 3.0.0 - * - * @type {Palette} + * The Scene Transition Complete Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration + * of the transition. + * + * Listen to it from a Scene using `this.scene.events.on('transitioncomplete', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_COMPLETE + * + * @param {Phaser.Scene} scene -The Scene on which the transitioned completed. */ -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' -}; +module.exports = 'transitioncomplete'; /***/ }), -/* 945 */ +/* 1105 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.CGA - * @since 3.0.0 - * - * @type {Palette} + * The Scene Systems Start Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('start', listener)`. + * + * @event Phaser.Scenes.Events#START + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. */ -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' -}; +module.exports = 'start'; /***/ }), -/* 946 */ +/* 1106 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @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 {Palette} + * The Scene Systems Sleep Event. + * + * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('sleep', listener)`. + * + * @event Phaser.Scenes.Events#SLEEP + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was sent to sleep. */ -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' -}; +module.exports = 'sleep'; /***/ }), -/* 947 */ +/* 1107 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Shutdown Event. + * + * This event is dispatched by a Scene during the Scene Systems shutdown process. + * + * Listen to it from a Scene using `this.scene.events.on('shutdown', listener)`. + * + * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding + * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not + * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources. + * + * @event Phaser.Scenes.Events#SHUTDOWN + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was shutdown. + */ +module.exports = 'shutdown'; + + +/***/ }), +/* 1108 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Resume Event. + * + * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('resume', listener)`. + * + * @event Phaser.Scenes.Events#RESUME + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was resumed. + */ +module.exports = 'resume'; + + +/***/ }), +/* 1109 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Render Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('render', listener)`. + * + * A Scene will only render if it is visible and active. + * By the time this event is dispatched, the Scene will have already been rendered. + * + * @event Phaser.Scenes.Events#RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. + */ +module.exports = 'render'; + + +/***/ }), +/* 1110 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Ready Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. + * By this point in the process the Scene is now fully active and rendering. + * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event. + * + * Listen to it from a Scene using `this.scene.events.on('ready', listener)`. + * + * @event Phaser.Scenes.Events#READY + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was started. + */ +module.exports = 'ready'; + + +/***/ }), +/* 1111 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pre Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('preupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#PRE_UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'preupdate'; + + +/***/ }), +/* 1112 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Post Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('postupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#POST_UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'postupdate'; + + +/***/ }), +/* 1113 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pause Event. + * + * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an + * action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('pause', listener)`. + * + * @event Phaser.Scenes.Events#PAUSE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was paused. + */ +module.exports = 'pause'; + + +/***/ }), +/* 1114 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Destroy Event. + * + * This event is dispatched by a Scene during the Scene Systems destroy process. + * + * Listen to it from a Scene using `this.scene.events.on('destroy', listener)`. + * + * You should destroy any resources that may be in use by your Scene in this event handler. + * + * @event Phaser.Scenes.Events#DESTROY + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1115 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Boot Event. + * + * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('boot', listener)`. + * + * @event Phaser.Scenes.Events#BOOT + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'boot'; + + +/***/ }), +/* 1116 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} Palette - * - * @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. - */ - -/** - * @namespace Phaser.Create.Palettes - */ - -module.exports = { - - ARNE16: __webpack_require__(356), - C64: __webpack_require__(946), - CGA: __webpack_require__(945), - JMP: __webpack_require__(944), - MSX: __webpack_require__(943) - -}; - - -/***/ }), -/* 948 */ -/***/ (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.Create - */ - -module.exports = { - - GenerateTexture: __webpack_require__(357), - Palettes: __webpack_require__(947) - -}; - - -/***/ }), -/* 949 */ -/***/ (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 Camera = __webpack_require__(378); +var Camera = __webpack_require__(411); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); -var RectangleContains = __webpack_require__(39); +var PluginCache = __webpack_require__(17); +var RectangleContains = __webpack_require__(42); +var SceneEvents = __webpack_require__(16); /** * @typedef {object} InputJSONCameraObject @@ -142967,17 +154170,8 @@ var CameraManager = new Class({ */ this.main; - /** - * This scale affects all cameras. It's used by the Scale Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#baseScale - * @type {number} - * @since 3.0.0 - */ - this.baseScale = 1; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -142986,6 +154180,7 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#boot * @private + * @listens Phaser.Scenes.Events#DESTROY * @since 3.5.1 */ boot: function () @@ -143005,7 +154200,7 @@ var CameraManager = new Class({ this.main = this.cameras[0]; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -143015,6 +154210,8 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#start * @private + * @listens Phaser.Scenes.Events#UPDATE + * @listens Phaser.Scenes.Events#SHUTDOWN * @since 3.5.0 */ start: function () @@ -143039,8 +154236,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -143055,7 +154252,7 @@ var CameraManager = new Class({ * By default Cameras are transparent and will render anything that they can see based on their `scrollX` * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. * - * The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after creation if required. * * See the Camera class documentation for more details. @@ -143076,8 +154273,8 @@ var CameraManager = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (makeMain === undefined) { makeMain = false; } if (name === undefined) { name = ''; } @@ -143104,7 +154301,7 @@ var CameraManager = new Class({ * * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. * - * The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after addition if required. * * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the @@ -143245,8 +154442,8 @@ var CameraManager = new Class({ config = [ config ]; } - var gameWidth = this.scene.sys.game.config.width; - var gameHeight = this.scene.sys.game.config.height; + var gameWidth = this.scene.sys.scale.width; + var gameHeight = this.scene.sys.scale.height; for (var i = 0; i < config.length; i++) { @@ -143431,8 +154628,6 @@ var CameraManager = new Class({ { var scene = this.scene; var cameras = this.cameras; - var baseScale = this.baseScale; - var resolution = renderer.config.resolution; for (var i = 0; i < this.cameras.length; i++) { @@ -143440,7 +154635,8 @@ var CameraManager = new Class({ if (camera.visible && camera.alpha > 0) { - camera.preRender(baseScale, resolution); + // Hard-coded to 1 for now + camera.preRender(1); renderer.render(scene, children, interpolation, camera); } @@ -143479,14 +154675,14 @@ var CameraManager = new Class({ * @protected * @since 3.0.0 * - * @param {number} timestep - The timestep value. - * @param {number} delta - The delta value since the last frame. + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - update: function (timestep, delta) + update: function (time, delta) { for (var i = 0; i < this.cameras.length; i++) { - this.cameras[i].update(timestep, delta); + this.cameras[i].update(time, delta); } }, @@ -143528,8 +154724,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -143544,7 +154740,7 @@ var CameraManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -143558,18 +154754,19 @@ module.exports = CameraManager; /***/ }), -/* 950 */ +/* 1117 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(174); +var EaseMap = __webpack_require__(188); +var Events = __webpack_require__(40); /** * @classdesc @@ -143701,36 +154898,18 @@ var Zoom = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the Zoom effect begins to run on a camera. - * - * @event CameraZoomStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} zoom - The destination zoom value. - */ - - /** - * This event is fired when the Zoom effect completes. - * - * @event CameraZoomCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - */ - /** * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#start - * @fires CameraZoomStartEvent - * @fires CameraZoomCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. * @param {CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * and the current camera zoom value. @@ -143778,7 +154957,7 @@ var Zoom = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerazoomstart', this.camera, this, duration, zoom); + this.camera.emit(Events.ZOOM_START, this.camera, this, duration, zoom); return cam; }, @@ -143829,6 +155008,7 @@ var Zoom = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -143838,7 +155018,7 @@ var Zoom = new Class({ this.isRunning = false; - this.camera.emit('camerazoomcomplete', this.camera, this); + this.camera.emit(Events.ZOOM_COMPLETE, this.camera, this); }, /** @@ -143875,17 +155055,18 @@ module.exports = Zoom; /***/ }), -/* 951 */ +/* 1118 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(40); var Vector2 = __webpack_require__(3); /** @@ -144026,30 +155207,12 @@ var Shake = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the shake effect begins to run on a camera. - * - * @event CameraShakeStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} intensity - The intensity of the effect. - */ - - /** - * This event is fired when the shake effect completes. - * - * @event CameraShakeCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - */ - /** * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Shake#start - * @fires CameraShakeStartEvent - * @fires CameraShakeCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -144094,7 +155257,7 @@ var Shake = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerashakestart', this.camera, this, duration, intensity); + this.camera.emit(Events.SHAKE_START, this.camera, this, duration, intensity); return this.camera; }, @@ -144150,8 +155313,8 @@ var Shake = new Class({ if (this.camera.roundPixels) { - this._offsetX |= 0; - this._offsetY |= 0; + this._offsetX = Math.round(this._offsetX); + this._offsetY = Math.round(this._offsetY); } } else @@ -144164,6 +155327,7 @@ var Shake = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Shake#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -144176,7 +155340,7 @@ var Shake = new Class({ this.isRunning = false; - this.camera.emit('camerashakecomplete', this.camera, this); + this.camera.emit(Events.SHAKE_COMPLETE, this.camera, this); }, /** @@ -144217,12 +155381,12 @@ module.exports = Shake; /***/ }), -/* 952 */ +/* 1119 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144259,12 +155423,12 @@ module.exports = Stepped; /***/ }), -/* 953 */ +/* 1120 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144298,12 +155462,12 @@ module.exports = InOut; /***/ }), -/* 954 */ +/* 1121 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144337,12 +155501,12 @@ module.exports = Out; /***/ }), -/* 955 */ +/* 1122 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144376,12 +155540,12 @@ module.exports = In; /***/ }), -/* 956 */ +/* 1123 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144411,12 +155575,12 @@ module.exports = InOut; /***/ }), -/* 957 */ +/* 1124 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144439,12 +155603,12 @@ module.exports = Out; /***/ }), -/* 958 */ +/* 1125 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144467,12 +155631,12 @@ module.exports = In; /***/ }), -/* 959 */ +/* 1126 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144502,12 +155666,12 @@ module.exports = InOut; /***/ }), -/* 960 */ +/* 1127 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144530,12 +155694,12 @@ module.exports = Out; /***/ }), -/* 961 */ +/* 1128 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144558,12 +155722,12 @@ module.exports = In; /***/ }), -/* 962 */ +/* 1129 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144593,12 +155757,12 @@ module.exports = InOut; /***/ }), -/* 963 */ +/* 1130 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144621,12 +155785,12 @@ module.exports = Out; /***/ }), -/* 964 */ +/* 1131 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144649,12 +155813,12 @@ module.exports = In; /***/ }), -/* 965 */ +/* 1132 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144677,12 +155841,12 @@ module.exports = Linear; /***/ }), -/* 966 */ +/* 1133 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144712,12 +155876,12 @@ module.exports = InOut; /***/ }), -/* 967 */ +/* 1134 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144740,12 +155904,12 @@ module.exports = Out; /***/ }), -/* 968 */ +/* 1135 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144768,12 +155932,12 @@ module.exports = In; /***/ }), -/* 969 */ +/* 1136 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144785,7 +155949,7 @@ module.exports = In; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -144830,12 +155994,12 @@ module.exports = InOut; /***/ }), -/* 970 */ +/* 1137 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144847,7 +156011,7 @@ module.exports = InOut; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -144885,12 +156049,12 @@ module.exports = Out; /***/ }), -/* 971 */ +/* 1138 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144902,7 +156066,7 @@ module.exports = Out; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -144940,12 +156104,12 @@ module.exports = In; /***/ }), -/* 972 */ +/* 1139 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144975,12 +156139,12 @@ module.exports = InOut; /***/ }), -/* 973 */ +/* 1140 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145003,12 +156167,12 @@ module.exports = Out; /***/ }), -/* 974 */ +/* 1141 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145031,12 +156195,12 @@ module.exports = In; /***/ }), -/* 975 */ +/* 1142 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145066,12 +156230,12 @@ module.exports = InOut; /***/ }), -/* 976 */ +/* 1143 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145094,12 +156258,12 @@ module.exports = Out; /***/ }), -/* 977 */ +/* 1144 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145122,12 +156286,12 @@ module.exports = In; /***/ }), -/* 978 */ +/* 1145 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145186,12 +156350,12 @@ module.exports = InOut; /***/ }), -/* 979 */ +/* 1146 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145229,12 +156393,12 @@ module.exports = Out; /***/ }), -/* 980 */ +/* 1147 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145274,12 +156438,12 @@ module.exports = In; /***/ }), -/* 981 */ +/* 1148 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145314,12 +156478,12 @@ module.exports = InOut; /***/ }), -/* 982 */ +/* 1149 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145345,12 +156509,12 @@ module.exports = Out; /***/ }), -/* 983 */ +/* 1150 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145376,19 +156540,20 @@ module.exports = In; /***/ }), -/* 984 */ +/* 1151 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var EaseMap = __webpack_require__(188); +var Events = __webpack_require__(40); var Vector2 = __webpack_require__(3); -var EaseMap = __webpack_require__(174); /** * @classdesc @@ -145534,39 +156699,20 @@ var Pan = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the pan effect begins to run on a camera. - * - * @event CameraPanStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} x - The destination scroll x coordinate. - * @param {number} y - The destination scroll y coordinate. - */ - - /** - * This event is fired when the pan effect completes. - * - * @event CameraPanCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - */ - /** * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Pan#start - * @fires CameraPanStartEvent - * @fires CameraPanCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -145617,7 +156763,7 @@ var Pan = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerapanstart', this.camera, this, duration, x, y); + this.camera.emit(Events.PAN_START, this.camera, this, duration, x, y); return cam; }, @@ -145679,6 +156825,7 @@ var Pan = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Pan#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -145688,7 +156835,7 @@ var Pan = new Class({ this.isRunning = false; - this.camera.emit('camerapancomplete', this.camera, this); + this.camera.emit(Events.PAN_COMPLETE, this.camera, this); }, /** @@ -145727,17 +156874,18 @@ module.exports = Pan; /***/ }), -/* 985 */ +/* 1152 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(40); /** * @classdesc @@ -145888,32 +157036,12 @@ var Flash = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the flash effect begins to run on a camera. - * - * @event CameraFlashStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the flash effect completes. - * - * @event CameraFlashCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - */ - /** * Flashes the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Flash#start - * @fires CameraFlashStartEvent - * @fires CameraFlashCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -145956,7 +157084,7 @@ var Flash = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('cameraflashstart', this.camera, this, duration, red, green, blue); + this.camera.emit(Events.FLASH_START, this.camera, this, duration, red, green, blue); return this.camera; }, @@ -146057,6 +157185,7 @@ var Flash = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Flash#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -146066,7 +157195,7 @@ var Flash = new Class({ this.isRunning = false; - this.camera.emit('cameraflashcomplete', this.camera, this); + this.camera.emit(Events.FLASH_COMPLETE, this.camera, this); }, /** @@ -146103,17 +157232,18 @@ module.exports = Flash; /***/ }), -/* 986 */ +/* 1153 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(40); /** * @classdesc @@ -146289,54 +157419,12 @@ var Fade = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the fade in effect begins to run on a camera. - * - * @event CameraFadeInStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade out effect begins to run on a camera. - * - * @event CameraFadeOutStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade in effect completes. - * - * @event CameraFadeInCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - - /** - * This event is fired when the fade out effect completes. - * - * @event CameraFadeOutCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - /** * Fades the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Fade#start - * @fires CameraFadeInStartEvent - * @fires CameraFadeInCompleteEvent - * @fires CameraFadeOutStartEvent - * @fires CameraFadeOutCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START * @since 3.5.0 * * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) @@ -146383,7 +157471,7 @@ var Fade = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - var eventName = (direction) ? 'camerafadeoutstart' : 'camerafadeinstart'; + var eventName = (direction) ? Events.FADE_OUT_START : Events.FADE_IN_START; this.camera.emit(eventName, this.camera, this, duration, red, green, blue); @@ -146486,6 +157574,8 @@ var Fade = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Fade#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -146496,7 +157586,7 @@ var Fade = new Class({ this.isRunning = false; this.isComplete = true; - var eventName = (this.direction) ? 'camerafadeoutcomplete' : 'camerafadeincomplete'; + var eventName = (this.direction) ? Events.FADE_OUT_COMPLETE : Events.FADE_IN_COMPLETE; this.camera.emit(eventName, this.camera, this); }, @@ -146536,12 +157626,387 @@ module.exports = Fade; /***/ }), -/* 987 */ +/* 1154 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Start Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} zoom - The destination zoom value. + */ +module.exports = 'camerazoomstart'; + + +/***/ }), +/* 1155 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Complete Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + */ +module.exports = 'camerazoomcomplete'; + + +/***/ }), +/* 1156 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Start Event. + * + * This event is dispatched by a Camera instance when the Shake Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} intensity - The intensity of the effect. + */ +module.exports = 'camerashakestart'; + + +/***/ }), +/* 1157 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Complete Event. + * + * This event is dispatched by a Camera instance when the Shake Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + */ +module.exports = 'camerashakecomplete'; + + +/***/ }), +/* 1158 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pre-Render Event. + * + * This event is dispatched by a Camera instance when it is about to render. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('prerender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#PRE_RENDER + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that is about to render to a texture. + */ +module.exports = 'prerender'; + + +/***/ }), +/* 1159 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Post-Render Event. + * + * This event is dispatched by a Camera instance after is has finished rendering. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('postrender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#POST_RENDER + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that has finished rendering to a texture. + */ +module.exports = 'postrender'; + + +/***/ }), +/* 1160 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Start Event. + * + * This event is dispatched by a Camera instance when the Pan Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} x - The destination scroll x coordinate. + * @param {number} y - The destination scroll y coordinate. + */ +module.exports = 'camerapanstart'; + + +/***/ }), +/* 1161 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Complete Event. + * + * This event is dispatched by a Camera instance when the Pan Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + */ +module.exports = 'camerapancomplete'; + + +/***/ }), +/* 1162 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Start Event. + * + * This event is dispatched by a Camera instance when the Flash Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'cameraflashstart'; + + +/***/ }), +/* 1163 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Complete Event. + * + * This event is dispatched by a Camera instance when the Flash Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + */ +module.exports = 'cameraflashcomplete'; + + +/***/ }), +/* 1164 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Start Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeoutstart'; + + +/***/ }), +/* 1165 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Complete Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutcomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeoutcomplete'; + + +/***/ }), +/* 1166 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Start Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeinstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeinstart'; + + +/***/ }), +/* 1167 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Complete Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeincomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeincomplete'; + + +/***/ }), +/* 1168 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Destroy Camera Event. + * + * This event is dispatched by a Camera instance when it is destroyed by the Camera Manager. + * + * @event Phaser.Cameras.Scene2D.Events#DESTROY + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. + */ +module.exports = 'cameradestroy'; + + +/***/ }), +/* 1169 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -146551,40 +158016,27 @@ module.exports = Fade; module.exports = { - Camera: __webpack_require__(378), - CameraManager: __webpack_require__(949), - Effects: __webpack_require__(370) + Camera: __webpack_require__(411), + CameraManager: __webpack_require__(1116), + Effects: __webpack_require__(403), + Events: __webpack_require__(40) }; /***/ }), -/* 988 */ +/* 1170 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 -// }; - /** * @typedef {object} SmoothedKeyControlConfig * @@ -146602,14 +158054,36 @@ var GetValue = __webpack_require__(4); /** * @classdesc - * [description] + * A Smoothed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * Unlike the Fixed Camera Control you can also provide physics values for acceleration, drag and maxSpeed for smoothing effects. + * + * ```javascript + * + * 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 + * }; + * ``` + * + * You must call the `update` method of this controller every frame. * * @class SmoothedKeyControl * @memberof Phaser.Cameras.Controls * @constructor * @since 3.0.0 * - * @param {SmoothedKeyControlConfig} config - [description] + * @param {SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. */ var SmoothedKeyControl = new Class({ @@ -146797,7 +158271,7 @@ var SmoothedKeyControl = new Class({ } /** - * [description] + * Internal property to track the speed of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX * @type {number} @@ -146808,7 +158282,7 @@ var SmoothedKeyControl = new Class({ this._speedX = 0; /** - * [description] + * Internal property to track the speed of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY * @type {number} @@ -146819,7 +158293,7 @@ var SmoothedKeyControl = new Class({ this._speedY = 0; /** - * [description] + * Internal property to track the zoom of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom * @type {number} @@ -146887,12 +158361,14 @@ var SmoothedKeyControl = new Class({ }, /** - * [description] + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. * * @method Phaser.Cameras.Controls.SmoothedKeyControl#update * @since 3.0.0 * - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ update: function (delta) { @@ -147048,25 +158524,18 @@ module.exports = SmoothedKeyControl; /***/ }), -/* 989 */ +/* 1171 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 camControl = new CameraControl({ -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// speed: float OR { x: 0, y: 0 } -// }) - /** * @typedef {object} FixedKeyControlConfig * @@ -147083,14 +158552,29 @@ var GetValue = __webpack_require__(4); /** * @classdesc - * [description] + * A Fixed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * + * ```javascript + * var camControl = new FixedKeyControl({ + * camera: this.cameras.main, + * left: cursors.left, + * right: cursors.right, + * speed: float OR { x: 0, y: 0 } + * }); + * ``` + * + * Movement is precise and has no 'smoothing' applied to it. + * + * You must call the `update` method of this controller every frame. * * @class FixedKeyControl * @memberof Phaser.Cameras.Controls * @constructor * @since 3.0.0 * - * @param {FixedKeyControlConfig} config - [description] + * @param {FixedKeyControlConfig} config - The Fixed Key Control configuration object. */ var FixedKeyControl = new Class({ @@ -147212,7 +158696,7 @@ var FixedKeyControl = new Class({ } /** - * [description] + * Internal property to track the current zoom level. * * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom * @type {number} @@ -147280,7 +158764,9 @@ var FixedKeyControl = new Class({ }, /** - * [description] + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. * * @method Phaser.Cameras.Controls.FixedKeyControl#update * @since 3.0.0 @@ -147358,12 +158844,12 @@ module.exports = FixedKeyControl; /***/ }), -/* 990 */ +/* 1172 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147373,19 +158859,19 @@ module.exports = FixedKeyControl; module.exports = { - FixedKeyControl: __webpack_require__(989), - SmoothedKeyControl: __webpack_require__(988) + FixedKeyControl: __webpack_require__(1171), + SmoothedKeyControl: __webpack_require__(1170) }; /***/ }), -/* 991 */ +/* 1173 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147395,19 +158881,67 @@ module.exports = { module.exports = { - Controls: __webpack_require__(990), - Scene2D: __webpack_require__(987) + Controls: __webpack_require__(1172), + Scene2D: __webpack_require__(1169) }; /***/ }), -/* 992 */ +/* 1174 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Remove Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time an object is removed from it. + * + * @event Phaser.Cache.Events#REMOVE + * + * @param {Phaser.Cache.BaseCache} cache - The cache from which the object was removed. + * @param {string} key - The key of the object removed from the cache. + * @param {*} object - A reference to the object that was removed from the cache. + */ +module.exports = 'remove'; + + +/***/ }), +/* 1175 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Add Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time a new object is added to it. + * + * @event Phaser.Cache.Events#ADD + * + * @param {Phaser.Cache.BaseCache} cache - The cache to which the object was added. + * @param {string} key - The key of the object added to the cache. + * @param {*} object - A reference to the object that was added to the cache. + */ +module.exports = 'add'; + + +/***/ }), +/* 1176 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147417,19 +158951,336 @@ module.exports = { module.exports = { - BaseCache: __webpack_require__(380), - CacheManager: __webpack_require__(379) + BaseCache: __webpack_require__(414), + CacheManager: __webpack_require__(412), + Events: __webpack_require__(413) }; /***/ }), -/* 993 */ +/* 1177 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Visible Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a visible state, previously having been hidden. + * + * Only browsers that support the Visibility API will cause this event to be emitted. + * + * @event Phaser.Core.Events#VISIBLE + */ +module.exports = 'visible'; + + +/***/ }), +/* 1178 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Step Event. + * + * This event is dispatched after the Game Pre-Step and before the Scene Manager steps. + * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have. + * + * @event Phaser.Core.Events#STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'step'; + + +/***/ }), +/* 1179 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Resume Event. + * + * This event is dispatched when the game loop leaves a paused state and resumes running. + * + * @event Phaser.Core.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 1180 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Ready Event. + * + * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, + * and all local systems are now able to start. + * + * @event Phaser.Core.Events#READY + */ +module.exports = 'ready'; + + +/***/ }), +/* 1181 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Pre-Step Event. + * + * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. + * Hook into it from plugins or systems that need to update before the Scene Manager does. + * + * @event Phaser.Core.Events#PRE_STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'prestep'; + + +/***/ }), +/* 1182 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PRE_RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'prerender'; + + +/***/ }), +/* 1183 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Step Event. + * + * This event is dispatched after the Scene Manager has updated. + * Hook into it from plugins or systems that need to do things before the render starts. + * + * @event Phaser.Core.Events#POST_STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'poststep'; + + +/***/ }), +/* 1184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Render Event. + * + * This event is dispatched right at the end of the render process. + * + * Every Scene will have rendered and been drawn to the canvas by the time this event is fired. + * Use it for any last minute post-processing before the next game step begins. + * + * @event Phaser.Core.Events#POST_RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'postrender'; + + +/***/ }), +/* 1185 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 1186 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Hidden Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted. + * + * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which + * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something + * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games) + * + * @event Phaser.Core.Events#HIDDEN + */ +module.exports = 'hidden'; + + +/***/ }), +/* 1187 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Focus Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it. + * + * @event Phaser.Core.Events#FOCUS + */ +module.exports = 'focus'; + + +/***/ }), +/* 1188 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Destroy Event. + * + * This event is dispatched when the game instance has been told to destroy itself. + * Lots of internal systems listen to this event in order to clear themselves out. + * Custom plugins and game code should also do the same. + * + * @event Phaser.Core.Events#DESTROY + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1189 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Boot Event. + * + * This event is dispatched when the Phaser Game instance 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.Core.Events#BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 1190 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Blur Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps + * tab, or if they simply remove focus from the browser to another app. + * + * @event Phaser.Core.Events#BLUR + */ +module.exports = 'blur'; + + +/***/ }), +/* 1191 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147439,25 +159290,26 @@ module.exports = { module.exports = { - Animation: __webpack_require__(384), - AnimationFrame: __webpack_require__(382), - AnimationManager: __webpack_require__(381) + Animation: __webpack_require__(205), + AnimationFrame: __webpack_require__(433), + AnimationManager: __webpack_require__(415), + Events: __webpack_require__(136) }; /***/ }), -/* 994 */ +/* 1192 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author samme - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * Wrap each item's coordinates within a rectangle's area. @@ -147496,12 +159348,12 @@ module.exports = WrapInRectangle; /***/ }), -/* 995 */ +/* 1193 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147532,12 +159384,12 @@ module.exports = ToggleVisible; /***/ }), -/* 996 */ +/* 1194 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147595,16 +159447,16 @@ module.exports = Spread; /***/ }), -/* 997 */ +/* 1195 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmoothStep = __webpack_require__(181); +var MathSmoothStep = __webpack_require__(195); /** * Smoothstep is a sigmoid-like interpolation and clamping function. @@ -147653,16 +159505,16 @@ module.exports = SmoothStep; /***/ }), -/* 998 */ +/* 1196 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmootherStep = __webpack_require__(182); +var MathSmootherStep = __webpack_require__(196); /** * Smootherstep is a sigmoid-like interpolation and clamping function. @@ -147711,16 +159563,16 @@ module.exports = SmootherStep; /***/ }), -/* 999 */ +/* 1197 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayShuffle = __webpack_require__(122); +var ArrayShuffle = __webpack_require__(132); /** * Shuffles the array in place. The shuffled array is both modified and returned. @@ -147744,12 +159596,12 @@ module.exports = Shuffle; /***/ }), -/* 1000 */ +/* 1198 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147874,16 +159726,16 @@ module.exports = ShiftPosition; /***/ }), -/* 1001 */ +/* 1199 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `y` @@ -147915,16 +159767,16 @@ module.exports = SetY; /***/ }), -/* 1002 */ +/* 1200 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` @@ -147962,16 +159814,16 @@ module.exports = SetXY; /***/ }), -/* 1003 */ +/* 1201 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `x` @@ -148003,16 +159855,16 @@ module.exports = SetX; /***/ }), -/* 1004 */ +/* 1202 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `visible` @@ -148041,12 +159893,12 @@ module.exports = SetVisible; /***/ }), -/* 1005 */ +/* 1203 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -148080,16 +159932,16 @@ module.exports = SetTint; /***/ }), -/* 1006 */ +/* 1204 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleY` @@ -148121,16 +159973,16 @@ module.exports = SetScaleY; /***/ }), -/* 1007 */ +/* 1205 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleX` @@ -148162,16 +160014,16 @@ module.exports = SetScaleX; /***/ }), -/* 1008 */ +/* 1206 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` @@ -148209,16 +160061,16 @@ module.exports = SetScale; /***/ }), -/* 1009 */ +/* 1207 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `rotation` @@ -148250,16 +160102,16 @@ module.exports = SetRotation; /***/ }), -/* 1010 */ +/* 1208 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` @@ -148297,12 +160149,12 @@ module.exports = SetOrigin; /***/ }), -/* 1011 */ +/* 1209 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -148336,16 +160188,16 @@ module.exports = SetHitArea; /***/ }), -/* 1012 */ +/* 1210 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `depth` @@ -148377,16 +160229,16 @@ module.exports = SetDepth; /***/ }), -/* 1013 */ +/* 1211 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `blendMode` @@ -148417,16 +160269,16 @@ module.exports = SetBlendMode; /***/ }), -/* 1014 */ +/* 1212 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `alpha` @@ -148458,16 +160310,16 @@ module.exports = SetAlpha; /***/ }), -/* 1015 */ +/* 1213 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `scaleY` property, @@ -148499,16 +160351,16 @@ module.exports = ScaleY; /***/ }), -/* 1016 */ +/* 1214 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, @@ -148546,16 +160398,16 @@ module.exports = ScaleXY; /***/ }), -/* 1017 */ +/* 1215 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `scaleX` property, @@ -148587,16 +160439,16 @@ module.exports = ScaleX; /***/ }), -/* 1018 */ +/* 1216 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathRotateAroundDistance = __webpack_require__(183); +var MathRotateAroundDistance = __webpack_require__(197); /** * Rotates an array of Game Objects around a point by the given angle and distance. @@ -148636,17 +160488,17 @@ module.exports = RotateAroundDistance; /***/ }), -/* 1019 */ +/* 1217 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundDistance = __webpack_require__(183); -var DistanceBetween = __webpack_require__(52); +var RotateAroundDistance = __webpack_require__(197); +var DistanceBetween = __webpack_require__(56); /** * Rotates each item around the given point by the given angle. @@ -148682,16 +160534,16 @@ module.exports = RotateAround; /***/ }), -/* 1020 */ +/* 1218 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `rotation` property, @@ -148723,16 +160575,16 @@ module.exports = Rotate; /***/ }), -/* 1021 */ +/* 1219 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(184); +var Random = __webpack_require__(198); /** * Takes an array of Game Objects and positions them at random locations within the Triangle. @@ -148763,16 +160615,16 @@ module.exports = RandomTriangle; /***/ }), -/* 1022 */ +/* 1220 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(187); +var Random = __webpack_require__(201); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -148801,16 +160653,16 @@ module.exports = RandomRectangle; /***/ }), -/* 1023 */ +/* 1221 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(188); +var Random = __webpack_require__(202); /** * Takes an array of Game Objects and positions them at random locations on the Line. @@ -148841,16 +160693,16 @@ module.exports = RandomLine; /***/ }), -/* 1024 */ +/* 1222 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(185); +var Random = __webpack_require__(199); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -148881,16 +160733,16 @@ module.exports = RandomEllipse; /***/ }), -/* 1025 */ +/* 1223 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(191); +var Random = __webpack_require__(206); /** * Takes an array of Game Objects and positions them at random locations within the Circle. @@ -148921,12 +160773,12 @@ module.exports = RandomCircle; /***/ }), -/* 1026 */ +/* 1224 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -148958,16 +160810,16 @@ module.exports = PlayAnimation; /***/ }), -/* 1027 */ +/* 1225 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BresenhamPoints = __webpack_require__(385); +var BresenhamPoints = __webpack_require__(416); /** * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. @@ -149019,18 +160871,18 @@ module.exports = PlaceOnTriangle; /***/ }), -/* 1028 */ +/* 1226 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MarchingAnts = __webpack_require__(388); -var RotateLeft = __webpack_require__(387); -var RotateRight = __webpack_require__(386); +var MarchingAnts = __webpack_require__(419); +var RotateLeft = __webpack_require__(418); +var RotateRight = __webpack_require__(417); /** * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. @@ -149077,16 +160929,16 @@ module.exports = PlaceOnRectangle; /***/ }), -/* 1029 */ +/* 1227 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetPoints = __webpack_require__(189); +var GetPoints = __webpack_require__(203); /** * Positions an array of Game Objects on evenly spaced points of a Line. @@ -149121,12 +160973,12 @@ module.exports = PlaceOnLine; /***/ }), -/* 1030 */ +/* 1228 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149173,12 +161025,12 @@ module.exports = PlaceOnEllipse; /***/ }), -/* 1031 */ +/* 1229 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149222,16 +161074,16 @@ module.exports = PlaceOnCircle; /***/ }), -/* 1032 */ +/* 1230 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `y` property, @@ -149263,16 +161115,16 @@ module.exports = IncY; /***/ }), -/* 1033 */ +/* 1231 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, @@ -149310,16 +161162,16 @@ module.exports = IncXY; /***/ }), -/* 1034 */ +/* 1232 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `x` property, @@ -149351,16 +161203,16 @@ module.exports = IncX; /***/ }), -/* 1035 */ +/* 1233 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `alpha` property, @@ -149392,12 +161244,151 @@ module.exports = IncAlpha; /***/ }), -/* 1036 */ +/* 1234 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Destroy Event. + * + * This event is dispatched when a Game Object instance is being destroyed. + * + * Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`. + * + * @event Phaser.GameObjects.Events#DESTROY + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object which is being destroyed. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1235 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Set Data Event. + * + * This event is dispatched by a Data Manager when a new item is added to the data store. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the addition of a new data item on a Game Object you would use: `sprite.data.on('setdata', listener)`. + * + * @event Phaser.Data.Events#SET_DATA + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'setdata'; + + +/***/ }), +/* 1236 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Data Event. + * + * This event is dispatched by a Data Manager when an item is removed from it. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the removal of a data item on a Game Object you would use: `sprite.data.on('removedata', listener)`. + * + * @event Phaser.Data.Events#REMOVE_DATA + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was removed from the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'removedata'; + + +/***/ }), +/* 1237 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Key Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the change of a specific data item from a Game Object you would use: `sprite.data.on('changedata-key', listener)`, + * where `key` is the unique string key of the data item. For example, if you have a data item stored called `gold` + * then you can listen for `sprite.data.on('changedata-gold')`. + * + * @event Phaser.Data.Events#CHANGE_DATA_KEY + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + * @param {any} previousValue - The previous item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'changedata-'; + + +/***/ }), +/* 1238 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * a change data event from a Game Object you would use: `sprite.data.on('changedata', listener)`. + * + * This event is dispatched for all items that change in the Data Manager. + * To listen for the change of a specific item, use the `CHANGE_DATA_KEY_EVENT` event. + * + * @event Phaser.Data.Events#CHANGE_DATA + * + * @param {any} parent - A reference to the object that the Data Manager responsible for this event belongs to. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The new value of the item in the Data Manager. + * @param {any} previousValue - The previous value of the item in the Data Manager. + */ +module.exports = 'changedata'; + + +/***/ }), +/* 1239 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149731,12 +161722,12 @@ module.exports = Tint; /***/ }), -/* 1037 */ +/* 1240 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149939,12 +161930,12 @@ module.exports = TextureCrop; /***/ }), -/* 1038 */ +/* 1241 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150069,12 +162060,12 @@ module.exports = Texture; /***/ }), -/* 1039 */ +/* 1242 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150256,16 +162247,16 @@ module.exports = Size; /***/ }), -/* 1040 */ +/* 1243 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ScaleModes = __webpack_require__(94); +var ScaleModes = __webpack_require__(101); /** * Provides methods used for getting and setting the scale of a Game Object. @@ -150327,12 +162318,12 @@ module.exports = ScaleMode; /***/ }), -/* 1041 */ +/* 1244 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150530,17 +162521,17 @@ module.exports = Origin; /***/ }), -/* 1042 */ +/* 1245 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); -var RotateAround = __webpack_require__(396); +var Rectangle = __webpack_require__(10); +var RotateAround = __webpack_require__(428); var Vector2 = __webpack_require__(3); /** @@ -150812,12 +162803,12 @@ module.exports = GetBounds; /***/ }), -/* 1043 */ +/* 1246 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150960,12 +162951,12 @@ module.exports = Flip; /***/ }), -/* 1044 */ +/* 1247 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151085,12 +163076,12 @@ module.exports = Crop; /***/ }), -/* 1045 */ +/* 1248 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151234,20 +163225,500 @@ module.exports = ComputedSize; /***/ }), -/* 1046 */ +/* 1249 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Update Event. + * + * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_UPDATE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate'; + + +/***/ }), +/* 1250 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Start Event. + * + * This event is dispatched by a Sprite when an animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_START` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart'; + + +/***/ }), +/* 1251 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Restart Event. + * + * This event is dispatched by a Sprite when an animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_RESTART` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart'; + + +/***/ }), +/* 1252 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Repeat Event. + * + * This event is dispatched by a Sprite when an animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_REPEAT` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat'; + + +/***/ }), +/* 1253 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Update Event. + * + * This event is dispatched by a Sprite when a specific animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationupdate-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate-'; + + +/***/ }), +/* 1254 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Start Event. + * + * This event is dispatched by a Sprite when a specific animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationstart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart-'; + + +/***/ }), +/* 1255 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Restart Event. + * + * This event is dispatched by a Sprite when a specific animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrestart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart-'; + + +/***/ }), +/* 1256 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Repeat Event. + * + * This event is dispatched by a Sprite when a specific animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrepeat-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat-'; + + +/***/ }), +/* 1257 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Complete Event. + * + * This event is dispatched by a Sprite when a specific animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationcomplete-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete-'; + + +/***/ }), +/* 1258 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Complete Event. + * + * This event is dispatched by a Sprite when an animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_COMPLETE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete'; + + +/***/ }), +/* 1259 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Animations Event. + * + * This event is dispatched when the global Animation Manager resumes, having been previously paused. + * + * When this happens all current animations will continue updating again. + * + * @event Phaser.Animations.Events#RESUME_ALL + */ +module.exports = 'resumeall'; + + +/***/ }), +/* 1260 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Animation Event. + * + * This event is dispatched when an animation is removed from the global Animation Manager. + * + * @event Phaser.Animations.Events#REMOVE_ANIMATION + * + * @param {string} key - The key of the Animation that was removed from the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the removed Animation. + */ +module.exports = 'remove'; + + +/***/ }), +/* 1261 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Animations Event. + * + * This event is dispatched when the global Animation Manager is told to pause. + * + * When this happens all current animations will stop updating, although it doesn't necessarily mean + * that the game has paused as well. + * + * @event Phaser.Animations.Events#PAUSE_ALL + */ +module.exports = 'pauseall'; + + +/***/ }), +/* 1262 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Start Event. + * + * This event is dispatched by an Animation instance when it starts playing. + * + * Be careful with the volume of events this could generate. If a group of Sprites all play the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that started playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'start'; + + +/***/ }), +/* 1263 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Restart Event. + * + * This event is dispatched by an Animation instance when it restarts. + * + * Be careful with the volume of events this could generate. If a group of Sprites all restart the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that restarted playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'restart'; + + +/***/ }), +/* 1264 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Repeat Event. + * + * This event is dispatched when a currently playing animation repeats. + * + * The event is dispatched directly from the Animation object itself. Which means that listeners + * bound to this event will be invoked every time the Animation repeats, for every Game Object that may have it. + * + * @event Phaser.Animations.Events#ANIMATION_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that repeated. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation was on when it repeated. + */ +module.exports = 'repeat'; + + +/***/ }), +/* 1265 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Complete Event. + * + * This event is dispatched by an Animation instance when it completes, i.e. finishes playing or is manually stopped. + * + * Be careful with the volume of events this could generate. If a group of Sprites all complete the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'complete'; + + +/***/ }), +/* 1266 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Add Animation Event. + * + * This event is dispatched when a new animation is added to the global Animation Manager. + * + * This can happen either as a result of an animation instance being added to the Animation Manager, + * or the Animation Manager creating a new animation directly. + * + * @event Phaser.Animations.Events#ADD_ANIMATION + * + * @param {string} key - The key of the Animation that was added to the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the newly created Animation. + */ +module.exports = 'add'; + + +/***/ }), +/* 1267 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AlignIn = __webpack_require__(416); -var CONST = __webpack_require__(193); +var AlignIn = __webpack_require__(449); +var CONST = __webpack_require__(208); var GetFastValue = __webpack_require__(2); var NOOP = __webpack_require__(1); -var Zone = __webpack_require__(125); +var Zone = __webpack_require__(137); var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); @@ -151358,12 +163829,12 @@ module.exports = GridAlign; /***/ }), -/* 1047 */ +/* 1268 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151416,12 +163887,12 @@ module.exports = GetLast; /***/ }), -/* 1048 */ +/* 1269 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151474,12 +163945,12 @@ module.exports = GetFirst; /***/ }), -/* 1049 */ +/* 1270 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151519,16 +163990,16 @@ module.exports = Call; /***/ }), -/* 1050 */ +/* 1271 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `angle` property, @@ -151560,7 +164031,7 @@ module.exports = Angle; /***/ }), -/* 1051 */ +/* 1272 */ /***/ (function(module, exports) { /** @@ -151613,7 +164084,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o /***/ }), -/* 1052 */ +/* 1273 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {// References: @@ -151683,10 +164154,10 @@ if (!global.cancelAnimationFrame) { }; } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(200))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(215))) /***/ }), -/* 1053 */ +/* 1274 */ /***/ (function(module, exports) { /** @@ -151723,7 +164194,7 @@ if (!global.cancelAnimationFrame) { /***/ }), -/* 1054 */ +/* 1275 */ /***/ (function(module, exports) { // ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc @@ -151735,7 +164206,7 @@ if (!Math.trunc) { /***/ }), -/* 1055 */ +/* 1276 */ /***/ (function(module, exports) { /** @@ -151750,7 +164221,7 @@ if (!window.console) /***/ }), -/* 1056 */ +/* 1277 */ /***/ (function(module, exports) { /* Copyright 2013 Chris Wilson @@ -151937,7 +164408,7 @@ BiquadFilterNode.type and OscillatorNode.type. /***/ }), -/* 1057 */ +/* 1278 */ /***/ (function(module, exports) { /** @@ -151953,7 +164424,7 @@ if (!Array.isArray) /***/ }), -/* 1058 */ +/* 1279 */ /***/ (function(module, exports) { /** @@ -151993,51 +164464,51 @@ if (!Array.prototype.forEach) /***/ }), -/* 1059 */ +/* 1280 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(1058); -__webpack_require__(1057); -__webpack_require__(1056); -__webpack_require__(1055); -__webpack_require__(1054); -__webpack_require__(1053); -__webpack_require__(1052); -__webpack_require__(1051); +__webpack_require__(1279); +__webpack_require__(1278); +__webpack_require__(1277); +__webpack_require__(1276); +__webpack_require__(1275); +__webpack_require__(1274); +__webpack_require__(1273); +__webpack_require__(1272); /***/ }), -/* 1060 */, -/* 1061 */, -/* 1062 */, -/* 1063 */, -/* 1064 */, -/* 1065 */, -/* 1066 */, -/* 1067 */, -/* 1068 */, -/* 1069 */, -/* 1070 */, -/* 1071 */, -/* 1072 */, -/* 1073 */, -/* 1074 */, -/* 1075 */, -/* 1076 */, -/* 1077 */, -/* 1078 */ +/* 1281 */, +/* 1282 */, +/* 1283 */, +/* 1284 */, +/* 1285 */, +/* 1286 */, +/* 1287 */, +/* 1288 */, +/* 1289 */, +/* 1290 */, +/* 1291 */, +/* 1292 */, +/* 1293 */, +/* 1294 */, +/* 1295 */, +/* 1296 */, +/* 1297 */, +/* 1298 */, +/* 1299 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -__webpack_require__(1059); +__webpack_require__(1280); -var CONST = __webpack_require__(26); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(28); +var Extend = __webpack_require__(19); /** * @namespace Phaser @@ -152045,36 +164516,38 @@ var Extend = __webpack_require__(20); var Phaser = { - Actions: __webpack_require__(417), - Animation: __webpack_require__(993), - Cache: __webpack_require__(992), - Cameras: __webpack_require__(991), + Actions: __webpack_require__(450), + Animations: __webpack_require__(1191), + Cache: __webpack_require__(1176), + Cameras: __webpack_require__(1173), + Core: __webpack_require__(1097), Class: __webpack_require__(0), - Create: __webpack_require__(948), - Curves: __webpack_require__(942), - Data: __webpack_require__(939), - Display: __webpack_require__(937), - DOM: __webpack_require__(908), - Events: __webpack_require__(906), - Game: __webpack_require__(904), - GameObjects: __webpack_require__(876), - Geom: __webpack_require__(274), - Input: __webpack_require__(616), - Loader: __webpack_require__(593), - Math: __webpack_require__(570), + Create: __webpack_require__(1038), + Curves: __webpack_require__(1032), + Data: __webpack_require__(1029), + Display: __webpack_require__(1027), + DOM: __webpack_require__(998), + Events: __webpack_require__(997), + Game: __webpack_require__(995), + GameObjects: __webpack_require__(902), + Geom: __webpack_require__(279), + Input: __webpack_require__(635), + Loader: __webpack_require__(601), + Math: __webpack_require__(387), Physics: { - Arcade: __webpack_require__(528) + Arcade: __webpack_require__(577) }, - Plugins: __webpack_require__(498), - Scene: __webpack_require__(328), - Scenes: __webpack_require__(496), - Sound: __webpack_require__(494), - Structs: __webpack_require__(493), - Textures: __webpack_require__(492), - Tilemaps: __webpack_require__(490), - Time: __webpack_require__(441), - Tweens: __webpack_require__(439), - Utils: __webpack_require__(435) + Plugins: __webpack_require__(538), + Scale: __webpack_require__(536), + Scene: __webpack_require__(331), + Scenes: __webpack_require__(535), + Sound: __webpack_require__(533), + Structs: __webpack_require__(532), + Textures: __webpack_require__(531), + Tilemaps: __webpack_require__(529), + Time: __webpack_require__(480), + Tweens: __webpack_require__(478), + Utils: __webpack_require__(468) }; @@ -152094,7 +164567,7 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(200))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(215))) /***/ }) /******/ ]); diff --git a/dist/phaser-arcade-physics.min.js b/dist/phaser-arcade-physics.min.js index 785c2b9a2..cfcd86aff 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()}(window,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.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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=1078)}([function(t,e){function i(t,e,i){var n=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&n.value&&"object"==typeof n.value&&(n=n.value),!(!n||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(n))&&(void 0===n.enumerable&&(n.enumerable=!0),void 0===n.configurable&&(n.configurable=!0),n)}function n(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function s(t,e,s,r){for(var a in e)if(e.hasOwnProperty(a)){var h=i(e,a,s);if(!1!==h){if(n((r||t).prototype,a)){if(o.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=e[a]}}function r(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i0&&(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){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o=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=l},function(t,e){t.exports={getTintFromFloats:function(t,e,i,n){return((255&(255*n|0))<<24|(255&(255*t|0))<<16|(255&(255*e|0))<<8|255&(255*i|0))>>>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;no.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&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return i.unshift(this.scene.sys.displayList.getIndex(t)),i},destroy:function(t){if(void 0===t&&(t=!1),this.scene&&!this.ignoreDestroy){this.preDestroy&&this.preDestroy.call(this),this.emit("destroy",this);var e=this.scene.sys;t||(e.displayList.remove(this),e.updateList.remove(this)),this.input&&(e.input.clear(this),this.input=void 0),this.data&&(this.data.destroy(),this.data=void 0),this.body&&(this.body.destroy(),this.body=void 0),t||e.queueDepthSort(),this.active=!1,this.visible=!1,this.scene=void 0,this.parentContainer=void 0,this.removeAllListeners()}}});a.RENDER_MASK=15,t.exports=a},function(t,e,i){var n=i(8),s=function(){var t,e,i,r,o,a,h=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof h&&(c=h,h=arguments[1]||{},l=2),u===l&&(h=this,--l);l=400&&t.status<=599&&(i=!1),this.resetXHR(),this.loader.nextFile(this,i)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit("fileprogress",this,this.percentComplete))},onProcess:function(){this.state=s.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=s.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=s.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit("filecomplete",e,i,t),this.loader.emit("filecomplete-"+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});u.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},u.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=u},function(t,e){t.exports=function(t,e,i,n,s){var r=n.alpha*i.alpha;if(r<=0)return!1;var o=t._tempMatrix1.copyFromArray(n.matrix.matrix),a=t._tempMatrix2.applyITRS(i.x,i.y,i.rotation,i.scaleX,i.scaleY),h=t._tempMatrix3;return s?(o.multiplyWithOffset(s,-n.scrollX*i.scrollFactorX,-n.scrollY*i.scrollFactorY),a.e=i.x,a.f=i.y,o.multiply(a,h)):(a.e-=n.scrollX*i.scrollFactorX,a.f-=n.scrollY*i.scrollFactorY,o.multiply(a,h)),e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=r,e.save(),h.setToContext(e),!0}},function(t,e){t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},function(t,e,i){var n,s,r,o=i(26),a=i(120),h=[],l=!1;t.exports={create2D:function(t,e,i){return n(t,e,i,o.CANVAS)},create:n=function(t,e,i,n,r){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=o.CANVAS),void 0===r&&(r=!1);var c=s(n);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:n},n===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),r&&(c.parent=u),u.width=e,u.height=i,l&&n===o.CANVAS&&a.disable(u.getContext("2d")),u},createWebGL:function(t,e,i){return n(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:s=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n={VERSION:"3.15.1",BlendModes:i(66),ScaleModes:i(94),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=n},function(t,e,i){var n=i(0),s=i(14),r=i(19),o=i(54),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Transform,s.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.initPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]}});t.exports=a},function(t,e,i){var n=i(66),s=i(12),r=i(94);t.exports=function(t,e,i){e.x=s(i,"x",0),e.y=s(i,"y",0),e.depth=s(i,"depth",0),e.flipX=s(i,"flipX",!1),e.flipY=s(i,"flipY",!1);var o=s(i,"scale",null);"number"==typeof o?e.setScale(o):null!==o&&(e.scaleX=s(o,"x",1),e.scaleY=s(o,"y",1));var a=s(i,"scrollFactor",null);"number"==typeof a?e.setScrollFactor(a):null!==a&&(e.scrollFactorX=s(a,"x",1),e.scrollFactorY=s(a,"y",1)),e.rotation=s(i,"rotation",0);var h=s(i,"angle",null);null!==h&&(e.angle=h),e.alpha=s(i,"alpha",1);var l=s(i,"origin",null);if("number"==typeof l)e.setOrigin(l);else if(null!==l){var u=s(l,"x",.5),c=s(l,"y",.5);e.setOrigin(u,c)}return e.scaleMode=s(i,"scaleMode",r.DEFAULT),e.blendMode=s(i,"blendMode",n.NORMAL),e.visible=s(i,"visible",!0),s(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},function(t,e){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e){t.exports=function(t,e,i){var n=i||e.fillColor,s=e.fillAlpha,r=(16711680&n)>>>16,o=(65280&n)>>>8,a=255&n;t.fillStyle="rgba("+r+","+o+","+a+","+s+")"}},function(t,e,i){var n=i(16);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e){t.exports=function(t,e,i,n,s,r){var o;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=s;o=0;o--)t[o][e]+=i+a*n,a++;return t}},,function(t,e,i){var n=i(102),s=i(17);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;d>>16,r=(65280&i)>>>8,o=255&i;t.strokeStyle="rgba("+s+","+r+","+o+","+n+")",t.lineWidth=e.lineWidth}},function(t,e,i){var n=i(0),s=i(177),r=i(376),o=i(176),a=i(375),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=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,n)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=n,this._locked=!1,this.update(s)},setGLTo:function(t,e,i,n){return void 0===n&&(n=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=n,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,n=this.b,o=this.a;return this._color=s(e,i,n),this._color32=r(e,i,n,o),this._rgba="rgba("+e+","+i+","+n+","+o/255+")",t&&a(e,i,n,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t));return this.setTo(i,n,s)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,n=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),n=Math.max(0,Math.min(255,n-Math.round(-t/100*255))),this.setTo(e,i,n)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,n,s,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},scaleY:{get:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3];return n[0]=s*i+o*e,n[1]=r*i+a*e,n[2]=s*-e+o*i,n[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,s=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=n[0],c=n[1],d=n[2],f=n[3],p=n[4],g=n[5],v=void 0===e?this:e;return v.a=u*s+c*o,v.b=u*r+c*a,v.c=d*s+f*o,v.d=d*r+f*a,v.e=p*s+g*o+h,v.f=p*r+g*a+l,v},multiplyWithOffset:function(t,e,i){var n=this.matrix,s=t.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=e*r+i*a+n[4],u=e*o+i*h+n[5],c=s[0],d=s[1],f=s[2],p=s[3],g=s[4],v=s[5];return n[0]=c*r+d*a,n[1]=c*o+d*h,n[2]=f*r+p*a,n[3]=f*o+p*h,n[4]=g*r+v*a+l,n[5]=g*o+v*h+u,this},transform:function(t,e,i,n,s,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+n*l,o[3]=i*h+n*u,o[4]=s*a+r*l+c,o[5]=s*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],l=n[5];return i.x=t*s+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=e*s-i*n;return t[0]=s/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-s*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;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],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,s,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],s=e[2],r=e[3],o=i*i,a=n*n,h=s*s,l=r*r,u=Math.sqrt(o+h),c=Math.sqrt(a+l);return t.translateX=e[4],t.translateY=e[5],t.scaleX=u,t.scaleY=c,t.rotation=Math.acos(i/u)*(Math.atan(-s/i)<0?-1:1),t},applyITRS:function(t,e,i,n,s){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*n,r[1]=o*n,r[2]=-o*s,r[3]=a*s,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=r*c*e+-o*c*t+(-u*r+l*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=r},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){t.exports=function(t,e,i){return t.radius>0&&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){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x+t.width-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y+t.height-t.height*t.originY}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e,i){var n=i(0),s=i(18),r=i(21),o=i(7),a=i(2),h=i(4),l=i(8),u=new n({Extends:r,initialize:function(t,e,i,n,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:n,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=s.FILE_POPULATED)},onProcess:function(){if(this.state!==s.FILE_POPULATED){this.state=s.FILE_PROCESSING;var t=JSON.parse(this.xhrLoader.responseText),e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;sthis.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=h},function(t,e,i){var n=i(0),s=i(14),r=i(265),o=new n({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.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=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.loader=t,this.type=e,this.key=i,this.files=n,this.complete=!1,this.pending=n.length,this.failed=0,this.config={};for(var s=0;s=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=l},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=t.strokeTint,a=n.getTintAppendFloatAlphaAndSwap(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-s,f=h[1]-r;e.closePath||(l-=2);for(var p=2;ps||e>=i||i>s||e+i>s){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},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,i){"use strict";function n(t,e,i){i=i||2;var n,a,h,l,u,f,g,v=e&&e.length,m=v?e[0]*i:t.length,y=s(t,0,m,i,!0),x=[];if(!y)return x;if(v&&(y=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 w=i;wh&&(h=u),f>l&&(l=f);g=Math.max(h-n,l-a)}return o(y,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=b(r,t[r],t[r+1],o);return o&&y(o,o.next)&&(_(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!==m(n.prev,n,n.next))n=n.next;else{if(_(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=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(m(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)&&m(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(m(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)&&m(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)&&m(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)&&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),_(n),_(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=T(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)&&w(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=T(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 m(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 x(t,e,i,n){return!!(y(t,e)&&y(i,n)||y(t,n)&&y(i,e))||m(t,e,i)>0!=m(t,e,n)>0&&m(i,n,t)>0!=m(i,n,e)>0}function w(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function T(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 b(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.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){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){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 Math.atan2(t.y2-t.y1,t.x2-t.x1)}},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,m=(l*f-u*c)*g;return v>=0&&m>=0&&v+m<1}},function(t,e,i){var n=i(0),s=i(173),r=i(9),o=i(3),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){var n=i(0),s=i(40),r=i(405),o=i(403),a=i(191),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){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},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,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},,function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","map"),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.widthInPixels=s(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.tileHeight),this.format=s(t,"format",null),this.orientation=s(t,"orientation","orthogonal"),this.renderOrder=s(t,"renderOrder","right-down"),this.version=s(t,"version","1"),this.properties=s(t,"properties",{}),this.layers=s(t,"layers",[]),this.images=s(t,"images",[]),this.objects=s(t,"objects",{}),this.collision=s(t,"collision",{}),this.tilesets=s(t,"tilesets",[]),this.imageCollections=s(t,"imageCollections",[]),this.tiles=s(t,"tiles",[])}});t.exports=r},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","layer"),this.x=s(t,"x",0),this.y=s(t,"y",0),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.baseTileWidth=s(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=s(t,"baseTileHeight",this.tileHeight),this.widthInPixels=s(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=s(t,"alpha",1),this.visible=s(t,"visible",!0),this.properties=s(t,"properties",{}),this.indexes=s(t,"indexes",[]),this.collideIndexes=s(t,"collideIndexes",[]),this.callbacks=s(t,"callbacks",[]),this.bodies=s(t,"bodies",[]),this.data=s(t,"data",[]),this.tilemapLayer=s(t,"tilemapLayer",null)}});t.exports=r},function(t,e){t.exports=function(t,e,i){return t>=0&&t=0&&e=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof s&&(l.x=s),"number"==typeof r&&(l.y=r),l):n?this.create(s,r,o,a,h):null},get:function(t,e,i,n,s){return this.getFirst(!1,!0,t,e,i,n,s)},getFirstAlive:function(t,e,i,n,s,r){return this.getFirst(!0,t,e,i,n,s,r)},getFirstDead:function(t,e,i,n,s,r){return this.getFirst(!1,t,e,i,n,s,r)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=t.length)){for(var i=t.length-1,n=t[e],s=e;s-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 t=this.firstgid&&t=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e,i){var n=i(0),s=i(14),r=i(19),o=i(731),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,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"),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.lengthl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(a-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){for(var i=[null],n=2;n0?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=a},function(t,e,i){var n=i(0),s=i(23),r=i(20),o=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.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(r,o,n,s)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var s=this.data,r=s.cut;r.x=i,r.y=n,r.w=t,r.h=e,r.r=i+t,r.b=n+e,s.sourceSize.w=t,s.sourceSize.h=e,s.spriteSourceSize.w=t,s.spriteSourceSize.h=e,s.radius=.5*Math.sqrt(t*t+e*e);var o=s.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,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,a.r=i+s,a.b=n+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()},setCropUVs:function(t,e,i,n,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=s(e,0,d)),g=l+(i=s(i,0,f)),v=n=s(n,0,d-e),m=r=s(r,0,f-i),y=this.data;if(y.trim){var x=y.spriteSourceSize,w=e+(n=s(n,0,u-e)),T=i+(r=s(r,0,c-i));if(!(x.rw||x.y>T)){var b=Math.max(x.x,e),_=Math.max(x.y,i),S=Math.min(x.r,w)-b,A=Math.min(x.b,T)-_;v=S,m=A,p=o?h+(u-(b-x.x)-S):h+(b-x.x),g=a?l+(c-(_-x.y)-A):l+(_-x.y),e=b,i=_,n=S,r=A}else p=0,g=0,v=0,m=0}else o&&(p=h+(u-e-n)),a&&(g=l+(c-i-r));var C=this.source.width,M=this.source.height;return t.u0=Math.max(0,p/C),t.v0=Math.max(0,g/M),t.u1=Math.min(1,(p+v)/C),t.v1=Math.min(1,(g+m)/M),t.x=e,t.y=i,t.cx=p,t.cy=g,t.cw=v,t.ch=m,t.width=n,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(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=r(!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}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(0),s=i(11),r=i(20),o=i(1),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={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},this.currentConfig=this.config,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 "+t.name+" already exists in Sound"),!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.warn("Audio Marker: "+t.name+" missing in 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!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in 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,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit("destroy",this),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)}});t.exports=a},function(t,e,i){var n=i(0),s=i(63),r=i(11),o=i(1),a=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.on("prestep",this.update,this),t.events.once("destroy",this.destroy,this)},add:o,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var r=s(e),o=i.spritemap[n];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:r})}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:o,onBlur:o,onFocus:o,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)})},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit("rate",this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit("detune",this,t)}}});t.exports=a},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){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n,s=i(92),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=function(t,e,i){return(e-t)*i+t}},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;i-m&&b>-y&&T-m&&S>-y&&_s&&(t=s),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,s=Math.max(n,n+e.height-i);return ts&&(t=s),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=l(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,s){return this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,s?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),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){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.config=t.sys.game.config,this.sceneManager=t.sys.game.scene;var e=this.config.resolution;return this.resolution=e,this._cx=this._x*e,this._cy=this._y*e,this._cw=this._width*e,this._ch=this._height*e,this.updateSystem(),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),0===t&&(t=.001),this.zoom=t,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},update:function(){},updateSystem:function(){if(this.config){var t=0!==this._x||0!==this._y||this.config.width!==this._width||this.config.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit("cameradestroy",this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this._bounds=null,this.scene=null,this.config=null,this.sceneManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this._cx=t*this.resolution,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._cy=t*this.resolution,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this._cw=t*this.resolution,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this._ch=t*this.resolution,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoom}},displayHeight:{get:function(){return this.height/this.zoom}}});t.exports=c},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;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=new(i(0))({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once("destroy",this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;n0&&(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)),this.parent.makeActive(this))}},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.play(),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){this.state===o.ACTIVE&&void 0!==t&&this.seek(t),this.state!==o.REMOVED&&(this.state!==o.PAUSED&&this.state!==o.PENDING_ADD||(this.parent._destroy.push(this),this.parent._toProcess++),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={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1}},function(t,e){function i(t){return!!t.getStart&&"function"==typeof t.getStart}function n(t){return!!t.getEnd&&"function"==typeof t.getEnd}var s=function(t,e){var r,o,a=function(t,e,i){return i},h=function(t,e,i){return i},l=typeof e;if("number"===l)a=function(){return e};else if("string"===l){var u=e[0],c=parseFloat(e.substr(2));switch(u){case"+":a=function(t,e,i){return i+c};break;case"-":a=function(t,e,i){return i-c};break;case"*":a=function(t,e,i){return i*c};break;case"/":a=function(t,e,i){return i/c};break;default:a=function(){return parseFloat(e)}}}else"function"===l?a=e:"object"===l&&(i(o=e)||n(o))?(n(e)&&(a=e.getEnd),i(e)&&(h=e.getStart)):e.hasOwnProperty("value")&&(r=s(t,e.value));return r||(r={getEnd:a,getStart:h}),r};t.exports=s},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"targets",null);return null===e?e:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(29),s=i(77),r=i(217),o=i(209);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",n.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new s({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},function(t,e,i){var n=i(29),s=i(78),r=i(77),o=i(55);t.exports=function(t,e,i,a,h){for(var l=new s({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:n.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;p0&&(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],m=s[12],y=s[13],x=s[14],w=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+m)*w,this.y=(e*o+i*u+n*p+y)*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(18),r=i(21),o=i(7),a=i(2),h=i(8),l=i(343),u=new n({Extends:r,initialize:function(t,e,i,n){var s="xml";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),s=a(o,"extension",s)}var l={type:"xml",cache:t.cacheManager.xml,extension:s,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,l)},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=l(this.xhrLoader.responseText),this.data?this.onProcessComplete():(console.warn("Invalid XMLFile: "+this.key),this.onProcessError())}});o.register("xml",function(t,e,i){if(Array.isArray(t))for(var n=0;n=0&&r>=0&&s+r<1&&(n.push({x:e[T].x,y:e[T].y}),i)));T++);return n}},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(0),s=i(108),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()},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,t=this.frame,this.uv[0]=t.u0,this.uv[1]=t.v0,this.uv[2]=t.u0,this.uv[3]=t.v1,this.uv[4]=t.u1,this.uv[5]=t.v1,this.uv[6]=t.u0,this.uv[7]=t.v0,this.uv[8]=t.u1,this.uv[9]=t.v1,this.uv[10]=t.u1,this.uv[11]=t.v0,this},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){for(var n=!1,s=-1,r=t.points.length-1;++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 m=u[c].length?c:c+1,y=u.slice(m).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=y+" "+(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],h0&&(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(h[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(h[p],o,a));return e.restore(),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),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&&c(this.canvas),s.remove(this.canvas),this.texture.destroy()}});t.exports=p},function(t,e,i){var n=i(121),s=i(24),r=i(0),o=i(14),a=i(26),h=i(113),l=i(19),u=i(817),c=i(295),d=new r({Extends:l,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Crop,o.Depth,o.Flip,o.GetBounds,o.Mask,o.Origin,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Tint,o.Transform,o.Visible,u],initialize:function(t,e,i,r,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=32),void 0===o&&(o=32),l.call(this,t,"RenderTexture"),this.renderer=t.sys.game.renderer,this.textureManager=t.sys.textures,this.globalTint=16777215,this.globalAlpha=1,this.canvas=s.create2D(this,r,o),this.context=this.canvas.getContext("2d"),this.framebuffer=null,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(c(),this.canvas),this.frame=this.texture.get(),this._saved=!1,this.camera=new n(0,0,r,o),this.dirty=!1,this.gl=null;var h=this.renderer;if(h.type===a.WEBGL){var u=h.gl;this.gl=u,this.drawGameObject=this.batchGameObjectWebGL,this.framebuffer=h.createFramebuffer(r,o,this.frame.source.glTexture,!1)}else h.type===a.CANVAS&&(this.drawGameObject=this.batchGameObjectCanvas);this.camera.setScene(t),this.setPosition(e,i),this.setSize(r,o),this.setOrigin(0,0),this.initPipeline()},setSize:function(t,e){return this.resize(t,e)},resize:function(t,e){if(void 0===e&&(e=t),t!==this.width||e!==this.height){if(this.canvas.width=t,this.canvas.height=e,this.gl){var i=this.gl;this.renderer.deleteTexture(this.frame.source.glTexture),this.renderer.deleteFramebuffer(this.framebuffer),this.frame.source.glTexture=this.renderer.createTexture2D(0,i.NEAREST,i.NEAREST,i.CLAMP_TO_EDGE,i.CLAMP_TO_EDGE,i.RGBA,null,t,e,!1),this.framebuffer=this.renderer.createFramebuffer(t,e,this.frame.source.glTexture,!1),this.frame.glTexture=this.frame.source.glTexture}this.frame.source.width=t,this.frame.source.height=e,this.camera.setSize(t,e),this.frame.setSize(t,e),this.width=t,this.height=e}return this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e){void 0===e&&(e=1);var i=255&(t>>16|0),n=255&(t>>8|0),s=255&(0|t);if(this.gl){this.renderer.setFramebuffer(this.framebuffer);var r=this.gl;r.clearColor(i/255,n/255,s/255,e),r.clear(r.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null)}else this.context.fillStyle="rgb("+i+","+n+","+s+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height);return this},clear:function(){if(this.dirty){if(this.gl){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null)}else{var e=this.context;e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this.canvas.width,this.canvas.height),e.restore()}this.dirty=!1}return this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.gl;if(this.camera.preRender(1,1,1),r){this.renderer.setFramebuffer(this.framebuffer);var o=this.pipeline;o.projOrtho(0,this.width,0,this.height,-1e3,1e3),this.batchList(t,e,i,n,s),o.flush(),this.renderer.setFramebuffer(null),o.projOrtho(0,o.width,o.height,0,-1e3,1e3)}else this.renderer.setContext(this.context),this.batchList(t,e,i,n,s),this.renderer.setContext();return this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.gl,a=this.textureManager.getFrame(t,e);if(a){if(this.camera.preRender(1,1,1),o){this.renderer.setFramebuffer(this.framebuffer);var h=this.pipeline;h.projOrtho(0,this.width,0,this.height,-1e3,1e3),h.batchTextureFrame(a,i,n,r,s,this.camera.matrix,null),h.flush(),this.renderer.setFramebuffer(null),h.projOrtho(0,h.width,h.height,0,-1e3,1e3)}else this.batchTextureFrame(a,i,n,s,r);this.dirty=!0}return this},batchList:function(t,e,i,n,s){for(var r=0;r0?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;s-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,o=r.game.renderer;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),w.TargetCamera.setScene(this.scene),w.TargetCamera.setViewport(0,0,e,i),w.TargetCamera.scrollX=this.x,w.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var a=(n=r.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(s=a.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(o,this,0,w.TargetCamera,null,s,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});w.TargetCamera=new n,t.exports=w},function(t,e,i){var n=i(109),s=i(0),r=i(834),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a){n.call(this,t,e,i,s,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(164),s=i(66),r=i(0),o=i(14),a=i(19),h=i(9),l=i(837),u=i(309),c=i(3),d=new r({Extends:a,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.ScrollFactor,o.Transform,o.Visible,l],initialize:function(t,e,i,n){a.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._displayList=t.sys.displayList,this._sortKey="",this._sysEvents=t.sys.events,this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new h),t.setTo(this.x,this.y,0,0),this.list.length>0)for(var e=this.list,i=new h,n=0;n-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){var i,n=[null],s=this.list.slice(),r=s.length;for(i=2;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}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[],this._displayList=null}});t.exports=d},function(t,e,i){var n=i(841),s=i(838),r=i(0),o=i(14),a=i(113),h=i(19),l=i(112),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,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(),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},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]}},function(t,e){t.exports=function(t){if(!Array.isArray(t)||t.length<2||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){t&&(this.settings.data=t),this.settings.status=s.START,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this),this.events.emit("ready",this,t)},resize:function(t,e){this.events.emit("resize",t,e)},shutdown:function(t){this.events.off("transitioninit"),this.events.off("transitionstart"),this.events.off("transitioncomplete"),this.events.off("transitionout"),this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this,t)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this),this.events.removeAllListeners();for(var t=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],e=0;e=(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=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},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=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x2-t.x1,s=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=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,i){var n=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random()*Math.PI*2,s=Math.sqrt(Math.random());return e.x=t.x+s*Math.cos(i)*t.width/2,e.y=t.y+s*Math.sin(i)*t.height/2,e}},function(t,e){var i={defaultPipeline:null,pipeline:null,initPipeline:function(t){void 0===t&&(t="TextureTintPipeline");var e=this.scene.sys.game.renderer;return!!(e&&e.gl&&e.hasPipeline(t))&&(this.defaultPipeline=e.getPipeline(t),this.pipeline=this.defaultPipeline,!0)},setPipeline:function(t){var e=this.scene.sys.game.renderer;return e&&e.gl&&e.hasPipeline(t)&&(this.pipeline=e.getPipeline(t)),this},resetPipeline:function(){return this.pipeline=this.defaultPipeline,null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=i},function(t,e,i){var n=i(6);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(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},function(t,e,i){var n=i(65),s=i(6);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)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(6);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(6);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){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(0),s=i(64),r=i(2),o=i(894),a=i(893),h=i(892),l=i(38),u=i(10),c=i(197),d=new n({Extends:c,Mixins:[o],initialize:function(t){var e=t.renderer.config;c.call(this,{game:t.game,renderer:t.renderer,gl:t.renderer.gl,topology:r(t,"topology",t.renderer.gl.TRIANGLES),vertShader:r(t,"vertShader",h),fragShader:r(t,"fragShader",a),vertexCapacity:r(t,"vertexCapacity",6*e.batchSize),vertexSize:r(t,"vertexSize",5*Float32Array.BYTES_PER_ELEMENT+4*Uint8Array.BYTES_PER_ELEMENT),attributes:[{name:"inPosition",size:2,type:t.renderer.gl.FLOAT,normalized:!1,offset:0},{name:"inTexCoord",size:2,type:t.renderer.gl.FLOAT,normalized:!1,offset:2*Float32Array.BYTES_PER_ELEMENT},{name:"inTintEffect",size:1,type:t.renderer.gl.FLOAT,normalized:!1,offset:4*Float32Array.BYTES_PER_ELEMENT},{name:"inTint",size:4,type:t.renderer.gl.UNSIGNED_BYTE,normalized:!0,offset:5*Float32Array.BYTES_PER_ELEMENT}]}),this.vertexViewF32=new Float32Array(this.vertexData),this.vertexViewU32=new Uint32Array(this.vertexData),this.maxQuads=e.batchSize,this.batches=[],this._tempMatrix1=new l,this._tempMatrix2=new l,this._tempMatrix3=new l,this._tempMatrix4=new l,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.tintEffect=2,this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[],this.mvpInit()},onBind:function(){return c.prototype.onBind.call(this),this.mvpUpdate(),0===this.batches.length&&this.pushBatch(),this},resize:function(t,e,i){return c.prototype.resize.call(this,t,e,i),this.projOrtho(0,this.width,this.height,0,-1e3,1e3),this},setTexture2D:function(t,e){t||(t=this.renderer.blankTexture.glTexture,e=0);var i=this.batches;0===i.length&&this.pushBatch();var n=i[i.length-1];return e>0?(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.vertexCount,r=this.topology,o=this.vertexSize,a=this.renderer,h=this.batches,l=0,u=null;if(0===h.length||0===s)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,s*o));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(a.setTexture2D(u.texture,0),n.drawArrays(r,u.first,l)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},batchSprite:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix1,s=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,l=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,g=o.cutWidth,v=o.cutHeight,m=-t.displayOriginX+f,y=-t.displayOriginY+p;if(t.isCropped){var x=t._crop;x.flipX===t.flipX&&x.flipY===t.flipY||o.updateCropUVs(x,t.flipX,t.flipY),h=x.u0,l=x.v0,c=x.u1,d=x.v1,g=x.width,v=x.height,f=x.x,p=x.y,m=-t.displayOriginX+f,y=-t.displayOriginY+p}t.flipX&&(m+=g,g*=-1),t.flipY&&(y+=v,v*=-1);var w=m+g,T=y+v;s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y,n.multiply(s,r)):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY,n.multiply(s,r));var b=r.getX(m,y),_=r.getY(m,y),S=r.getX(m,T),A=r.getY(m,T),C=r.getX(w,T),M=r.getY(w,T),E=r.getX(w,y),P=r.getY(w,y),L=u.getTintAppendFloatAlpha(t._tintTL,e.alpha*t._alphaTL),F=u.getTintAppendFloatAlpha(t._tintTR,e.alpha*t._alphaTR),k=u.getTintAppendFloatAlpha(t._tintBL,e.alpha*t._alphaBL),R=u.getTintAppendFloatAlpha(t._tintBR,e.alpha*t._alphaBR);e.roundPixels&&(b|=0,_|=0,S|=0,A|=0,C|=0,M|=0,E|=0,P|=0),this.setTexture2D(a,0);var O=t._isTinted&&t.tintFill;this.batchQuad(b,_,S,A,C,M,E,P,h,l,c,d,L,F,k,R,O)},batchQuad:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v){var m=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),m=!0);var y=this.vertexViewF32,x=this.vertexViewU32,w=this.vertexCount*this.vertexComponentCount-1;return y[++w]=t,y[++w]=e,y[++w]=h,y[++w]=l,y[++w]=v,x[++w]=d,y[++w]=i,y[++w]=n,y[++w]=h,y[++w]=c,y[++w]=v,x[++w]=p,y[++w]=s,y[++w]=r,y[++w]=u,y[++w]=c,y[++w]=v,x[++w]=g,y[++w]=t,y[++w]=e,y[++w]=h,y[++w]=l,y[++w]=v,x[++w]=d,y[++w]=s,y[++w]=r,y[++w]=u,y[++w]=c,y[++w]=v,x[++w]=g,y[++w]=o,y[++w]=a,y[++w]=u,y[++w]=l,y[++w]=v,x[++w]=f,this.vertexCount+=6,m},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f){var p=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),p=!0);var g=this.vertexViewF32,v=this.vertexViewU32,m=this.vertexCount*this.vertexComponentCount-1;return g[++m]=t,g[++m]=e,g[++m]=o,g[++m]=a,g[++m]=f,v[++m]=u,g[++m]=i,g[++m]=n,g[++m]=o,g[++m]=l,g[++m]=f,v[++m]=c,g[++m]=s,g[++m]=r,g[++m]=h,g[++m]=l,g[++m]=f,v[++m]=d,this.vertexCount+=3,p},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,m,y,x,w,T,b,_,S,A,C,M,E,P,L){this.renderer.setPipeline(this,t);var F=this._tempMatrix1,k=this._tempMatrix2,R=this._tempMatrix3,O=m/i+C,D=y/n+M,I=(m+x)/i+C,B=(y+w)/n+M,Y=o,X=a,z=-g,N=-v;if(t.isCropped){var U=t._crop;Y=U.width,X=U.height,o=U.width,a=U.height;var G=m=U.x,W=y=U.y;c&&(G=x-U.x-U.width),d&&!e.isRenderTexture&&(W=w-U.y-U.height),O=G/i+C,D=W/n+M,I=(G+U.width)/i+C,B=(W+U.height)/n+M,z=-g+m,N=-v+y}d^=!L&&e.isRenderTexture?1:0,c&&(Y*=-1,z+=o),d&&(X*=-1,N+=a);var V=z+Y,H=N+X;k.applyITRS(s,r,u,h,l),F.copyFrom(E.matrix),P?(F.multiplyWithOffset(P,-E.scrollX*f,-E.scrollY*p),k.e=s,k.f=r,F.multiply(k,R)):(k.e-=E.scrollX*f,k.f-=E.scrollY*p,F.multiply(k,R));var j=R.getX(z,N),q=R.getY(z,N),K=R.getX(z,H),J=R.getY(z,H),Z=R.getX(V,H),Q=R.getY(V,H),$=R.getX(V,N),tt=R.getY(V,N);E.roundPixels&&(j|=0,q|=0,K|=0,J|=0,Z|=0,Q|=0,$|=0,tt|=0),this.setTexture2D(e,0),this.batchQuad(j,q,K,J,Z,Q,$,tt,O,D,I,B,T,b,_,S,A)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.setPipeline(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),f=h.getY(e,i),p=h.getX(e,c),g=h.getY(e,c),v=h.getX(l,c),m=h.getY(l,c),y=h.getX(l,i),x=h.getY(l,i);this.setTexture2D(t.glTexture,0),n=u.getTintAppendFloatAlpha(n,s),this.batchQuad(d,f,p,g,v,m,y,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0)},drawFillRect:function(t,e,i,n,s,r){var o=t+i,a=e+n,h=u.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,h,h,h,h,2)},batchFillRect:function(t,e,i,n,s,r){this.renderer.setPipeline(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),m=this.currentFrame,y=m.u0,x=m.v0,w=m.u1,T=m.v1;this.batchQuad(l,u,c,d,f,p,g,v,y,x,w,T,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.fillTint.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,m=g.v0,y=g.u1,x=g.v1;this.batchTri(l,u,c,d,f,p,v,m,y,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=s,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=this.tintEffect,f=0;f0&&H[4]?this.batchQuad(R,O,P,L,H[0],H[1],H[2],H[3],U,G,W,V,B,Y,X,z,I):(j[0]=R,j[1]=O,j[2]=P,j[3]=L,j[4]=1),h&&j[4]?this.batchQuad(M,E,F,k,j[0],j[1],j[2],j[3],U,G,W,V,B,Y,X,z,I):(H[0]=M,H[1]=E,H[2]=F,H[3]=k,H[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),s=i(10),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,this.active=!1},boot:function(){},addAttribute:function(t,e,i,n,s){return this.attributes.push({name:t,size:e,type:this.renderer.glFormats[i],normalized:n,offset:s}),this},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},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},setFloat1v:function(t,e){return this.renderer.setFloat1v(this.program,t,e),this},setFloat2v:function(t,e){return this.renderer.setFloat2v(this.program,t,e),this},setFloat3v:function(t,e){return this.renderer.setFloat3v(this.program,t,e),this},setFloat4v:function(t,e){return this.renderer.setFloat4v(this.program,t,e),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){return n(t,-180,180)}},function(t,e,i){var n=i(53);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},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,i){var n=i(0),s=i(11),r=i(97),o=i(83),a=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.isTimeline=!0,this.data=[],this.totalData=0,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},add:function(t){return this.queue(r(this,t))},queue:function(t){return this.isPlaying()||(t.parent=this,t.parentIsTimeline=!0,this.data.push(t),this.totalData=this.data.length),this},hasOffset:function(t){return null!==t.offset},isOffsetAbsolute:function(t){return"number"==typeof t},isOffsetRelative:function(t){if("string"===typeof t){var e=t[0];if("-"===e||"+"===e)return!0}return!1},getRelativeOffset:function(t,e){var i=t[0],n=parseFloat(t.substr(2)),s=e;switch(i){case"+":s+=n;break;case"-":s-=n}return Math.max(0,s)},calcDuration:function(){for(var t=0,e=0,i=0,n=0;n0?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;s0?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 m=0;m0){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(0),s=i(14),r=i(26),o=i(19),a=i(446),h=i(103),l=i(38),u=i(10),c=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,a){o.call(this,t,"StaticTilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.culledTiles=[],this.skipCull=!1,this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=h.CullTiles,this.renderer=t.sys.game.renderer,this.vertexBuffer=[],this.bufferData=[],this.vertexViewF32=[],this.vertexViewU32=[],this.dirty=[],this.vertexCount=[],this._renderOrder=0,this._tempMatrix=new l,this.gidMap=[],this.setTilesets(n),this.setAlpha(this.layer.alpha),this.setPosition(s,a),this.setOrigin(),this.setSize(this.layer.tileWidth*this.layer.width,this.layer.tileHeight*this.layer.height),this.updateVBOData(),this.initPipeline("TextureTintPipeline"),t.sys.game.config.renderType===r.WEBGL&&t.sys.game.renderer.onContextRestored(function(){this.updateVBOData()},this)},setTilesets:function(t){var e=[],i=[],n=this.tilemap;Array.isArray(t)||(t=[t]);for(var s=0;sv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(1===p)for(o=0;o=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(2===p)for(o=u-1;o>=0;o--)for(a=0;av||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(3===p)for(o=u-1;o>=0;o--)for(a=l-1;a>=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));this.dirty[e]=!1,null===m?(m=i.createVertexBuffer(y,n.STATIC_DRAW),this.vertexBuffer[e]=m):(i.setVertexBuffer(m),n.bufferSubData(n.ARRAY_BUFFER,0,y))}return this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=a.x/n,l=a.y/s,c=(a.x+e.width)/n,d=(a.y+e.height)/s,f=this._tempMatrix,p=e.width,g=e.height,v=p/2,m=g/2,y=-v,x=-m;e.flipX&&(p*=-1,y+=e.width),e.flipY&&(g*=-1,x+=e.height);var w=y+p,T=x+g;f.applyITRS(v+e.pixelX,m+e.pixelY,e.rotation,1,1);var b=u.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),_=f.getX(y,x),S=f.getY(y,x),A=f.getX(y,T),C=f.getY(y,T),M=f.getX(w,T),E=f.getY(w,T),P=f.getX(w,x),L=f.getY(w,x);r.roundPixels&&(_|=0,S|=0,A|=0,C|=0,M|=0,E|=0,P|=0,L|=0);var F=this.vertexViewF32[o],k=this.vertexViewU32[o];return F[++t]=_,F[++t]=S,F[++t]=h,F[++t]=l,F[++t]=0,k[++t]=b,F[++t]=A,F[++t]=C,F[++t]=h,F[++t]=d,F[++t]=0,k[++t]=b,F[++t]=M,F[++t]=E,F[++t]=c,F[++t]=d,F[++t]=0,k[++t]=b,F[++t]=_,F[++t]=S,F[++t]=h,F[++t]=l,F[++t]=0,k[++t]=b,F[++t]=M,F[++t]=E,F[++t]=c,F[++t]=d,F[++t]=0,k[++t]=b,F[++t]=P,F[++t]=L,F[++t]=c,F[++t]=l,F[++t]=0,k[++t]=b,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),t>=0&&t<4){this._renderOrder=t;for(var e=0;e=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return a.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,s){return a.CreateFromTiles(t,e,i,n,s,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,s,r,o){return a.Copy(t,e,i,n,s,r,o,this.layer),this},destroy:function(){this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this)},fill:function(t,e,i,n,s,r){return a.Fill(t,e,i,n,s,r,this.layer),this},filterTiles:function(t,e,i,n,s,r,o){return a.FilterTiles(t,e,i,n,s,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,s,r,o){return a.FindTile(t,e,i,n,s,r,o,this.layer)},forEachTile:function(t,e,i,n,s,r,o){return a.ForEachTile(t,e,i,n,s,r,o,this.layer),this},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return a.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,s){return a.GetTilesWithin(t,e,i,n,s,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,s,r){return a.GetTilesWithinWorldXY(t,e,i,n,s,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return a.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,s){return a.PutTileAtWorldXY(t,e,i,n,s,this.layer)},putTilesAt:function(t,e,i,n){return a.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,s){return a.Randomize(t,e,i,n,s,this.layer),this},removeTileAt:function(t,e,i,n){return a.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,s){return a.RemoveTileAtWorldXY(t,e,i,n,s,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,s,r){return a.ReplaceByIndex(t,e,i,n,s,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i){return a.SetCollision(t,e,i,this.layer),this},setCollisionBetween:function(t,e,i,n){return a.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,s,r){return a.SetTileLocationCallback(t,e,i,n,s,r,this.layer),this},shuffle:function(t,e,i,n){return a.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,s,r){return a.SwapByIndex(t,e,i,n,s,r,this.layer),this},tileToWorldX:function(t,e){return a.TileToWorldX(t,e,this.layer)},tileToWorldY:function(t,e){return a.TileToWorldY(t,e,this.layer)},tileToWorldXY:function(t,e,i,n){return a.TileToWorldXY(t,e,i,n,this.layer)},weightedRandomize:function(t,e,i,n,s){return a.WeightedRandomize(t,e,i,n,s,this.layer),this},worldToTileX:function(t,e,i){return a.WorldToTileX(t,e,i,this.layer)},worldToTileY:function(t,e,i){return a.WorldToTileY(t,e,i,this.layer)},worldToTileXY:function(t,e,i,n,s){return a.WorldToTileXY(t,e,i,n,s,this.layer)}});t.exports=h},function(t,e,i){var n=i(0),s=i(31),r=i(208),o=i(20),a=i(29),h=i(78),l=i(242),u=i(207),c=i(55),d=i(103),f=i(99),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.renderOrder=e.renderOrder,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},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},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 Tileset Image: "+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 for Tileset: "+t),null;var u=this.tilesets[l];return u?(u.setTileSize(i,n),u.setSpacing(s,r),u.setImage(h),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),(u=new f(t,o,i,n,s,r)).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("Invalid Tilemap Layer ID: "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;fa&&(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(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","object layer"),this.opacity=s(t,"opacity",1),this.properties=s(t,"properties",{}),this.propertyTypes=s(t,"propertytypes",{}),this.type=s(t,"type","objectgroup"),this.visible=s(t,"visible",!0),this.objects=s(t,"objects",[])}});t.exports=r},function(t,e,i){var n=i(455),s=i(214),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=n(t,o);if(a.x+=e,a.y+=i,t.gid){var h=s(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?(a.ellipse=t.ellipse,a.width=t.width,a.height=t.height):t.text?(a.width=t.width,a.height=t.height,a.text=t.text):(a.rectangle=!0,a.width=t.width,a.height=t.height);return a}},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&&t-1}return!1}},function(t,e,i){var n=i(17);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l0?(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)},postUpdate:function(){},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=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(313);function s(t){if(!(this instanceof s))return new s(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=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,m,y;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),m=Math.min(f.maxX,p.maxX),y=Math.min(f.maxY,p.maxY),o=Math.max(0,m-g)*Math.max(0,y-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)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=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;te._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.up=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},function(t,e,i){var n=i(35);t.exports=function(t,e,i,s){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.left=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},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,i){var n=i(40),s=i(0),r=i(35),o=i(172),a=i(9),h=i(39),l=i(3),u=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;this.world=t,this.gameObject=e,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new l,this.position=new l(e.x,e.y),this.prev=new l(e.x,e.y),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=n,this.sourceWidth=i,this.sourceHeight=n,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(n/2),this.center=new l(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new l,this.newVelocity=new l,this.deltaMax=new l,this.acceleration=new l,this.allowDrag=!0,this.drag=new l,this.allowGravity=!0,this.gravity=new l,this.bounce=new l,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new l(1e4,1e4),this.friction=new l(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.moves=!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.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.physicsType=r.DYNAMIC_BODY,this._reset=!0,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._bounds=new a},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=o(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var n=!1;if(this.syncBounds){var s=t.getBounds(this._bounds);this.width=s.width,this.height=s.height,n=!0}else{var r=Math.abs(e.scaleX),a=Math.abs(e.scaleY);this._sx===r&&this._sy===a||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*a,this._sx=r,this._sy=a,n=!0)}n&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},update:function(t){this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds();var e=this.transform;if(this.position.x=e.x+e.scaleX*(this.offset.x-e.displayOriginX),this.position.y=e.y+e.scaleY*(this.offset.y-e.displayOriginY),this.updateCenter(),this.rotation=e.rotation,this.preRotation=this.rotation,this._reset&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves){this.world.updateMotion(this,t);var i=this.velocity.x,n=this.velocity.y;this.newVelocity.set(i*t,n*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(n,i),this.speed=Math.sqrt(i*i+n*n),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit("worldbounds",this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y},postUpdate:function(){this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y,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._dx<0?this.facing=r.FACING_LEFT:this._dx>0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),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(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),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):h(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._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},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.width/2):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 void 0===t&&(t=!0),this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),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},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=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 void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=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=i(232),s=i(23),r=i(0),o=i(231),a=i(35),h=i(52),l=i(11),u=i(248),c=i(247),d=i(246),f=i(230),p=i(229),g=i(4),v=i(228),m=i(514),y=i(9),x=i(227),w=i(513),T=i(508),b=i(507),_=i(95),S=i(225),A=i(226),C=i(38),M=i(3),E=i(53),P=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.bodies=new _,this.staticBodies=new _,this.pendingDestroy=new _,this.colliders=new v,this.gravity=new M(g(e,"gravity.x",0),g(e,"gravity.y",0)),this.bounds=new y(g(e,"x",0),g(e,"y",0),g(e,"width",t.sys.game.config.width),g(e,"height",t.sys.game.config.height)),this.checkCollision={up:g(e,"checkCollision.up",!0),down:g(e,"checkCollision.down",!0),left:g(e,"checkCollision.left",!0),right:g(e,"checkCollision.right",!0)},this.fps=g(e,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=g(e,"timeScale",1),this.OVERLAP_BIAS=g(e,"overlapBias",4),this.TILE_BIAS=g(e,"tileBias",16),this.forceX=g(e,"forceX",!1),this.isPaused=g(e,"isPaused",!1),this._total=0,this.drawDebug=g(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:g(e,"debugShowBody",!0),debugShowStaticBody:g(e,"debugShowStaticBody",!0),debugShowVelocity:g(e,"debugShowVelocity",!0),bodyDebugColor:g(e,"debugBodyColor",16711935),staticBodyDebugColor:g(e,"debugStaticBodyColor",255),velocityDebugColor:g(e,"debugVelocityColor",65280)},this.maxEntries=g(e,"maxEntries",16),this.useTree=g(e,"useTree",!0),this.tree=new x(this.maxEntries),this.staticTree=new x(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new C,this._tempMatrix2=new C,this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=a.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=s;)this._elapsed-=s,i++,this.step(n);this.stepsLastFrame=i}},step:function(t){var e,i,n=this.bodies.entries,s=n.length;for(e=0;e0){var l=this.tree,u=this.staticTree;for(o=(r=s.entries).length,t=0;ta.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(u.x,u.y,l.right,l.y)-u.radius):u.y>l.bottom&&(u.xl.right&&(a=h(u.x,u.y,l.right,l.bottom)-u.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 c=t.velocity.x,d=t.velocity.y,g=t.mass,v=e.velocity.x,m=e.velocity.y,y=e.mass,x=c*Math.cos(o)+d*Math.sin(o),w=c*Math.sin(o)-d*Math.cos(o),T=v*Math.cos(o)+m*Math.sin(o),b=v*Math.sin(o)-m*Math.cos(o),_=((g-y)*x+2*y*T)/(g+y),S=(2*g*x+(y-g)*T)/(g+y);t.immovable||(t.velocity.x=(_*Math.cos(o)-w*Math.sin(o))*t.bounce.x,t.velocity.y=(w*Math.cos(o)+_*Math.sin(o))*t.bounce.y,c=t.velocity.x,d=t.velocity.y),e.immovable||(e.velocity.x=(S*Math.cos(o)-b*Math.sin(o))*e.bounce.x,e.velocity.y=(b*Math.cos(o)+S*Math.sin(o))*e.bounce.y,v=e.velocity.x,m=e.velocity.y),Math.abs(o)0&&!t.immovable&&v>c?t.velocity.x*=-1:v<0&&!e.immovable&&c0&&!t.immovable&&m>d?t.velocity.y*=-1:m<0&&!e.immovable&&dMath.PI/2&&(c<0&&!t.immovable&&v0&&!e.immovable&&c>v?e.velocity.x*=-1:d<0&&!t.immovable&&m0&&!e.immovable&&c>m&&(e.velocity.y*=-1));var A=this._frameTime;return t.immovable||(t.x+=t.velocity.x*A-a*Math.cos(o),t.y+=t.velocity.y*A-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*A+a*Math.cos(o),e.y+=e.velocity.y*A+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),t.postUpdate(),e.postUpdate(),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?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):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.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);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,h,l,u=t.body;if(0!==e.length&&u&&u.enable)if(this.useTree){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===a.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(h=d.length,o=0;oc.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,p=e.getTilesWithinWorldXY(a,h,l,u);if(0===p.length)return!1;for(var g={left:0,right:0,top:0,bottom:0},v=0;v0&&(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(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(16),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],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],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],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},zero:function(){var t=this.val;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=0,this},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){var t=this.val;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},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],s=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=s,t[11]=t[14],t[12]=n,t[13]=r,t[14]=o,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=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15],m=e*o-i*r,y=e*a-n*r,x=e*h-s*r,w=i*a-n*o,T=i*h-s*o,b=n*h-s*a,_=l*p-u*f,S=l*g-c*f,A=l*v-d*f,C=u*g-c*p,M=u*v-d*p,E=c*v-d*g,P=m*E-y*M+x*C+w*A-T*S+b*_;return P?(P=1/P,t[0]=(o*E-a*M+h*C)*P,t[1]=(n*M-i*E-s*C)*P,t[2]=(p*b-g*T+v*w)*P,t[3]=(c*T-u*b-d*w)*P,t[4]=(a*A-r*E-h*S)*P,t[5]=(e*E-n*A+s*S)*P,t[6]=(g*x-f*b-v*y)*P,t[7]=(l*b-c*x+d*y)*P,t[8]=(r*M-o*A+h*_)*P,t[9]=(i*A-e*M-s*_)*P,t[10]=(f*T-p*x+v*m)*P,t[11]=(u*x-l*T-d*m)*P,t[12]=(o*S-r*C-a*_)*P,t[13]=(e*C-i*S+n*_)*P,t[14]=(p*y-f*w-g*m)*P,t[15]=(l*w-u*y+c*m)*P,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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return t[0]=o*(c*v-d*g)-u*(a*v-h*g)+p*(a*d-h*c),t[1]=-(i*(c*v-d*g)-u*(n*v-s*g)+p*(n*d-s*c)),t[2]=i*(a*v-h*g)-o*(n*v-s*g)+p*(n*h-s*a),t[3]=-(i*(a*d-h*c)-o*(n*d-s*c)+u*(n*h-s*a)),t[4]=-(r*(c*v-d*g)-l*(a*v-h*g)+f*(a*d-h*c)),t[5]=e*(c*v-d*g)-l*(n*v-s*g)+f*(n*d-s*c),t[6]=-(e*(a*v-h*g)-r*(n*v-s*g)+f*(n*h-s*a)),t[7]=e*(a*d-h*c)-r*(n*d-s*c)+l*(n*h-s*a),t[8]=r*(u*v-d*p)-l*(o*v-h*p)+f*(o*d-h*u),t[9]=-(e*(u*v-d*p)-l*(i*v-s*p)+f*(i*d-s*u)),t[10]=e*(o*v-h*p)-r*(i*v-s*p)+f*(i*h-s*o),t[11]=-(e*(o*d-h*u)-r*(i*d-s*u)+l*(i*h-s*o)),t[12]=-(r*(u*g-c*p)-l*(o*g-a*p)+f*(o*c-a*u)),t[13]=e*(u*g-c*p)-l*(i*g-n*p)+f*(i*c-n*u),t[14]=-(e*(o*g-a*p)-r*(i*g-n*p)+f*(i*a-n*o)),t[15]=e*(o*c-a*u)-r*(i*c-n*u)+l*(i*a-n*o),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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return(e*o-i*r)*(c*v-d*g)-(e*a-n*r)*(u*v-d*p)+(e*h-s*r)*(u*g-c*p)+(i*a-n*o)*(l*v-d*f)-(i*h-s*o)*(l*g-c*f)+(n*h-s*a)*(l*p-u*f)},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=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],m=e[15],y=t.val,x=y[0],w=y[1],T=y[2],b=y[3];return e[0]=x*i+w*o+T*u+b*p,e[1]=x*n+w*a+T*c+b*g,e[2]=x*s+w*h+T*d+b*v,e[3]=x*r+w*l+T*f+b*m,x=y[4],w=y[5],T=y[6],b=y[7],e[4]=x*i+w*o+T*u+b*p,e[5]=x*n+w*a+T*c+b*g,e[6]=x*s+w*h+T*d+b*v,e[7]=x*r+w*l+T*f+b*m,x=y[8],w=y[9],T=y[10],b=y[11],e[8]=x*i+w*o+T*u+b*p,e[9]=x*n+w*a+T*c+b*g,e[10]=x*s+w*h+T*d+b*v,e[11]=x*r+w*l+T*f+b*m,x=y[12],w=y[13],T=y[14],b=y[15],e[12]=x*i+w*o+T*u+b*p,e[13]=x*n+w*a+T*c+b*g,e[14]=x*s+w*h+T*d+b*v,e[15]=x*r+w*l+T*f+b*m,this},multiplyLocal:function(t){var e=[],i=this.val,n=t.val;return e[0]=i[0]*n[0]+i[1]*n[4]+i[2]*n[8]+i[3]*n[12],e[1]=i[0]*n[1]+i[1]*n[5]+i[2]*n[9]+i[3]*n[13],e[2]=i[0]*n[2]+i[1]*n[6]+i[2]*n[10]+i[3]*n[14],e[3]=i[0]*n[3]+i[1]*n[7]+i[2]*n[11]+i[3]*n[15],e[4]=i[4]*n[0]+i[5]*n[4]+i[6]*n[8]+i[7]*n[12],e[5]=i[4]*n[1]+i[5]*n[5]+i[6]*n[9]+i[7]*n[13],e[6]=i[4]*n[2]+i[5]*n[6]+i[6]*n[10]+i[7]*n[14],e[7]=i[4]*n[3]+i[5]*n[7]+i[6]*n[11]+i[7]*n[15],e[8]=i[8]*n[0]+i[9]*n[4]+i[10]*n[8]+i[11]*n[12],e[9]=i[8]*n[1]+i[9]*n[5]+i[10]*n[9]+i[11]*n[13],e[10]=i[8]*n[2]+i[9]*n[6]+i[10]*n[10]+i[11]*n[14],e[11]=i[8]*n[3]+i[9]*n[7]+i[10]*n[11]+i[11]*n[15],e[12]=i[12]*n[0]+i[13]*n[4]+i[14]*n[8]+i[15]*n[12],e[13]=i[12]*n[1]+i[13]*n[5]+i[14]*n[9]+i[15]*n[13],e[14]=i[12]*n[2]+i[13]*n[6]+i[14]*n[10]+i[15]*n[14],e[15]=i[12]*n[3]+i[13]*n[7]+i[14]*n[11]+i[15]*n[15],this.fromArray(e)},translate:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[12]=s[0]*e+s[4]*i+s[8]*n+s[12],s[13]=s[1]*e+s[5]*i+s[9]*n+s[13],s[14]=s[2]*e+s[6]*i+s[10]*n+s[14],s[15]=s[3]*e+s[7]*i+s[11]*n+s[15],this},scale:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[0]=s[0]*e,s[1]=s[1]*e,s[2]=s[2]*e,s[3]=s[3]*e,s[4]=s[4]*i,s[5]=s[5]*i,s[6]=s[6]*i,s[7]=s[7]*i,s[8]=s[8]*n,s[9]=s[9]*n,s[10]=s[10]*n,s[11]=s[11]*n,this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,o=t.y,a=t.z,h=s*r,l=s*o;return this.fromArray([h*r+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*r,0,h*a-n*o,l*a+n*r,s*a*a+i,0,0,0,0,1]),this},rotate:function(t,e){var i=this.val,n=e.x,s=e.y,r=e.z,o=Math.sqrt(n*n+s*s+r*r);if(Math.abs(o)<1e-6)return null;n*=o=1/o,s*=o,r*=o;var a=Math.sin(t),h=Math.cos(t),l=1-h,u=i[0],c=i[1],d=i[2],f=i[3],p=i[4],g=i[5],v=i[6],m=i[7],y=i[8],x=i[9],w=i[10],T=i[11],b=n*n*l+h,_=s*n*l+r*a,S=r*n*l-s*a,A=n*s*l-r*a,C=s*s*l+h,M=r*s*l+n*a,E=n*r*l+s*a,P=s*r*l-n*a,L=r*r*l+h;return i[0]=u*b+p*_+y*S,i[1]=c*b+g*_+x*S,i[2]=d*b+v*_+w*S,i[3]=f*b+m*_+T*S,i[4]=u*A+p*C+y*M,i[5]=c*A+g*C+x*M,i[6]=d*A+v*C+w*M,i[7]=f*A+m*C+T*M,i[8]=u*E+p*P+y*L,i[9]=c*E+g*P+x*L,i[10]=d*E+v*P+w*L,i[11]=f*E+m*P+T*L,this},rotateX:function(t){var e=this.val,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},rotateY:function(t){var e=this.val,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},rotateZ:function(t){var e=this.val,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},fromRotationTranslation:function(t,e){var i=this.val,n=t.x,s=t.y,r=t.z,o=t.w,a=n+n,h=s+s,l=r+r,u=n*a,c=n*h,d=n*l,f=s*h,p=s*l,g=r*l,v=o*a,m=o*h,y=o*l;return i[0]=1-(f+g),i[1]=c+y,i[2]=d-m,i[3]=0,i[4]=c-y,i[5]=1-(u+g),i[6]=p+v,i[7]=0,i[8]=d+m,i[9]=p-v,i[10]=1-(u+f),i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},fromQuat:function(t){var e=this.val,i=t.x,n=t.y,s=t.z,r=t.w,o=i+i,a=n+n,h=s+s,l=i*o,u=i*a,c=i*h,d=n*a,f=n*h,p=s*h,g=r*o,v=r*a,m=r*h;return e[0]=1-(d+p),e[1]=u+m,e[2]=c-v,e[3]=0,e[4]=u-m,e[5]=1-(l+p),e[6]=f+g,e[7]=0,e[8]=c+v,e[9]=f-g,e[10]=1-(l+d),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},frustum:function(t,e,i,n,s,r){var o=this.val,a=1/(e-t),h=1/(n-i),l=1/(s-r);return o[0]=2*s*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*s*h,o[6]=0,o[7]=0,o[8]=(e+t)*a,o[9]=(n+i)*h,o[10]=(r+s)*l,o[11]=-1,o[12]=0,o[13]=0,o[14]=r*s*2*l,o[15]=0,this},perspective:function(t,e,i,n){var s=this.val,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},perspectiveLH:function(t,e,i,n){var s=this.val;return s[0]=2*i/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/e,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=-n/(i-n),s[11]=1,s[12]=0,s[13]=0,s[14]=i*n/(i-n),s[15]=0,this},ortho:function(t,e,i,n,s,r){var o=this.val,a=t-e,h=i-n,l=s-r;return a=0===a?a:1/a,h=0===h?h:1/h,l=0===l?l:1/l,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},lookAt:function(t,e,i){var n=this.val,s=t.x,r=t.y,o=t.z,a=i.x,h=i.y,l=i.z,u=e.x,c=e.y,d=e.z;if(Math.abs(s-u)<1e-6&&Math.abs(r-c)<1e-6&&Math.abs(o-d)<1e-6)return this.identity();var f=s-u,p=r-c,g=o-d,v=1/Math.sqrt(f*f+p*p+g*g),m=h*(g*=v)-l*(p*=v),y=l*(f*=v)-a*g,x=a*p-h*f;(v=Math.sqrt(m*m+y*y+x*x))?(m*=v=1/v,y*=v,x*=v):(m=0,y=0,x=0);var w=p*x-g*y,T=g*m-f*x,b=f*y-p*m;return(v=Math.sqrt(w*w+T*T+b*b))?(w*=v=1/v,T*=v,b*=v):(w=0,T=0,b=0),n[0]=m,n[1]=w,n[2]=f,n[3]=0,n[4]=y,n[5]=T,n[6]=p,n[7]=0,n[8]=x,n[9]=b,n[10]=g,n[11]=0,n[12]=-(m*s+y*r+x*o),n[13]=-(w*s+T*r+b*o),n[14]=-(f*s+p*r+g*o),n[15]=1,this},yawPitchRoll:function(t,e,i){this.zero(),s.zero(),r.zero();var n=this.val,o=s.val,a=r.val,h=Math.sin(i),l=Math.cos(i);return n[10]=1,n[15]=1,n[0]=l,n[1]=h,n[4]=-h,n[5]=l,h=Math.sin(e),l=Math.cos(e),o[0]=1,o[15]=1,o[5]=l,o[10]=l,o[9]=-h,o[6]=h,h=Math.sin(t),l=Math.cos(t),a[5]=1,a[15]=1,a[0]=l,a[2]=-h,a[8]=h,a[10]=l,this.multiplyLocal(s),this.multiplyLocal(r),this},setWorldMatrix:function(t,e,i,n,o){return this.yawPitchRoll(t.y,t.x,t.z),s.scaling(i.x,i.y,i.z),r.xyz(e.x,e.y,e.z),this.multiplyLocal(s),this.multiplyLocal(r),void 0!==n&&this.multiplyLocal(n),void 0!==o&&this.multiplyLocal(o),this}}),s=new n,r=new n;t.exports=n},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],m=c[5],y=c[6],x=c[7],w=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+m*h,e[4]=g*n+v*o+m*l,e[5]=g*s+v*a+m*u,e[6]=y*i+x*r+w*h,e[7]=y*n+x*o+w*l,e[8]=y*s+x*a+w*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,m=this.val;return m[0]=1-(c+f),m[3]=l+v,m[6]=u-g,m[1]=l-v,m[4]=1-(h+f),m[7]=d+p,m[2]=u+g,m[5]=d-p,m[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],m=e[14],y=e[15],x=n*h-s*a,w=n*l-r*a,T=n*u-o*a,b=s*l-r*h,_=s*u-o*h,S=r*u-o*l,A=c*v-d*g,C=c*m-f*g,M=c*y-p*g,E=d*m-f*v,P=d*y-p*v,L=f*y-p*m,F=x*L-w*P+T*E+b*M-_*C+S*A;return F?(F=1/F,i[0]=(h*L-l*P+u*E)*F,i[1]=(l*M-a*L-u*C)*F,i[2]=(a*P-h*M+u*A)*F,i[3]=(r*P-s*L-o*E)*F,i[4]=(n*L-r*M+o*C)*F,i[5]=(s*M-n*P-o*A)*F,i[6]=(v*S-m*_+y*b)*F,i[7]=(m*T-g*S-y*w)*F,i[8]=(g*_-v*T+y*x)*F,this):null}});t.exports=n},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,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e,i){var n=i(244);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),te-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)=0?t:t+2*Math.PI}},function(t,e,i){var n=i(0),s=i(18),r=i(21),o=i(7),a=i(2),h=i(8),l=new n({Extends:r,initialize:function(t,e,i,n){var s="txt";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),s=a(o,"extension",s)}var l={type:"text",cache:t.cacheManager.text,extension:s,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,l)},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("text",function(t,e,i){if(Array.isArray(t))for(var n=0;n=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),s>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",e,this,t),this.pad.emit("down",i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit("up",e,this,t),this.pad.emit("up",i,t,this))},destroy:function(){this.pad=null,this.events=null}});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=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom0){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,i){t.exports={CircleToCircle:i(703),CircleToRectangle:i(702),GetRectangleIntersection:i(701),LineToCircle:i(272),LineToLine:i(107),LineToRectangle:i(700),PointToLine:i(271),PointToLineSegment:i(699),RectangleToRectangle:i(148),RectangleToTriangle:i(698),RectangleToValues:i(697),TriangleToCircle:i(696),TriangleToLine:i(695),TriangleToTriangle:i(694)}},function(t,e,i){t.exports={Circle:i(723),Ellipse:i(713),Intersects:i(273),Line:i(693),Point:i(675),Polygon:i(661),Rectangle:i(265),Triangle:i(631)}},function(t,e,i){var n=i(0),s=i(276),r=i(10),o=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1,this.maxLights=-1},enable:function(){return-1===this.maxLights&&(this.maxLights=this.scene.sys.game.renderer.config.maxLights),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,r=t.y+t.height/2,o=(t.width+t.height)/2,a={x:0,y:0},h=t.matrix,l=this.systems.game.config.height;i.length=0;for(var u=0;u0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],o):h=new s(t,e,i,a[0],a[1],a[2],o),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=o},function(t,e,i){var n=i(0),s=i(10),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(65),s=i(6);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(6),s=i(65);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=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(0),s=i(27),r=i(59),o=i(772),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),s.call(this,t,"Triangle",new r(n,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,n,s,r){return this.geom.setTo(t,e,i,n,s,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(775),s=i(0),r=i(64),o=i(27),a=new s({Extends:o,Mixins:[n],initialize:function(t,e,i,n,s,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===s&&(s=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=s,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,s=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var l=0;l0&&r.push(i([0,0],n[0])),e=0;e1&&r.push(i([0,0],n[n.length-1])),t.setTo(r)}},function(t,e,i){var n=i(65),s=i(54);t.exports=function(t){for(var e=t.points,i=0,r=0;rc+v)){var m=g.getPoint((u-c)/v);o.push(m);break}c+=v}return o}},function(t,e,i){var n=i(9);t.exports=function(t,e){void 0===e&&(e=new n);for(var i,s=1/0,r=1/0,o=-s,a=-r,h=0;h0&&(s=-h.PI2+s%h.PI2):s>h.PI2?s=h.PI2:s<0&&(s=h.PI2+s%h.PI2);for(var u,c=[a+Math.cos(n)*i,l+Math.sin(n)*i];e<1;)u=s*e+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=s+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(n)*i,l+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},function(t,e){t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<this._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=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=i(66),s=i(0),r=i(14),o=i(301),a=i(300),h=i(822),l=i(2),u=i(162),c=i(298),d=i(85),f=i(303),p=i(297),g=i(9),v=i(110),m=i(3),y=i(53),x=new s({Mixins:[r.BlendMode,r.Mask,r.ScrollFactor,r.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=f,this.x=new h(e,"x",0),this.y=new h(e,"y",0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",4294967295),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3),this.angle=new h(e,"angle",{min:0,max:360}),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new m,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&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=i(0),s=i(31),r=i(52),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.tint=16777215,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.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.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},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);s>>16,y=(65280&p)>>>8,x=255&p,c.strokeStyle="rgba("+m+","+y+","+x+","+d+")",c.lineWidth=v,w+=3;break;case n.FILL_STYLE:g=l[w+1],f=l[w+2],m=(16711680&g)>>>16,y=(65280&g)>>>8,x=255&g,c.fillStyle="rgba("+m+","+y+","+x+","+f+")",w+=2;break;case n.BEGIN_PATH:c.beginPath();break;case n.CLOSE_PATH:c.closePath();break;case n.FILL_PATH:h||c.fill();break;case n.STROKE_PATH:h||c.stroke();break;case n.FILL_RECT:h?c.rect(l[w+1],l[w+2],l[w+3],l[w+4]):c.fillRect(l[w+1],l[w+2],l[w+3],l[w+4]),w+=4;break;case n.FILL_TRIANGLE:c.beginPath(),c.moveTo(l[w+1],l[w+2]),c.lineTo(l[w+3],l[w+4]),c.lineTo(l[w+5],l[w+6]),c.closePath(),h||c.fill(),w+=6;break;case n.STROKE_TRIANGLE:c.beginPath(),c.moveTo(l[w+1],l[w+2]),c.lineTo(l[w+3],l[w+4]),c.lineTo(l[w+5],l[w+6]),c.closePath(),h||c.stroke(),w+=6;break;case n.LINE_TO:c.lineTo(l[w+1],l[w+2]),w+=2;break;case n.MOVE_TO:c.moveTo(l[w+1],l[w+2]),w+=2;break;case n.LINE_FX_TO:c.lineTo(l[w+1],l[w+2]),w+=5;break;case n.MOVE_FX_TO:c.moveTo(l[w+1],l[w+2]),w+=5;break;case n.SAVE:c.save();break;case n.RESTORE:c.restore();break;case n.TRANSLATE:c.translate(l[w+1],l[w+2]),w+=2;break;case n.SCALE:c.scale(l[w+1],l[w+2]),w+=2;break;case n.ROTATE:c.rotate(l[w+1]),w+=1;break;case n.GRADIENT_FILL_STYLE:w+=5;break;case n.GRADIENT_LINE_STYLE:w+=6;break;case n.SET_TEXTURE:w+=2}c.restore()}}},function(t,e){t.exports=function(t){var e=t.width/2,i=t.height/2,n=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*n/(10+Math.sqrt(4-3*n)))}},function(t,e,i){var n=i(306),s=i(156),r=i(93),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(4),s=i(122),r=function(t,e,i){for(var n=[],s=0;sr;){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,m=o;for(n(t,r,e),a(t[o],g)>0&&n(t,r,o);v0;)m--}0===a(t[r],g)?n(t,r,m):n(t,++m,o),m<=e&&(r=m+1),e<=m&&(o=m-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){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e){t.exports=function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n}},function(t,e,i){t.exports={AtlasXML:i(886),Canvas:i(885),Image:i(884),JSONArray:i(883),JSONHash:i(882),SpriteSheet:i(881),SpriteSheetFromAtlas:i(880),UnityYAML:i(879)}},function(t,e,i){var n=i(24),s=i(0),r=i(117),o=i(94),a=new s({initialize:function(t,e,i,n){var s=t.manager.game;this.renderer=s.renderer,this.texture=t,this.source=e,this.image=e,this.compressionAlgorithm=null,this.resolution=1,this.width=i||e.naturalWidth||e.width||0,this.height=n||e.naturalHeight||e.height||0,this.scaleMode=o.DEFAULT,this.isCanvas=e instanceof HTMLCanvasElement,this.isRenderTexture="RenderTexture"===e.type,this.isPowerOf2=r(this.width,this.height),this.glTexture=null,this.init(s)},init:function(t){this.renderer&&(this.renderer.gl?this.isCanvas?this.glTexture=this.renderer.canvasToTexture(this.image):this.isRenderTexture?(this.image=this.source.canvas,this.glTexture=this.renderer.createTextureFromSource(null,this.width,this.height,this.scaleMode)):this.glTexture=this.renderer.createTextureFromSource(this.image,this.width,this.height,this.scaleMode):this.isRenderTexture&&(this.image=this.source.canvas)),t.config.antialias||this.setFilter(1)},setFilter:function(t){this.renderer.gl&&this.renderer.setTextureFilter(this.glTexture,t)},update:function(){this.renderer.gl&&this.isCanvas&&(this.glTexture=this.renderer.canvasToTexture(this.image,this.glTexture))},destroy:function(){this.glTexture&&this.renderer.deleteTexture(this.glTexture),this.isCanvas&&n.remove(this.image),this.renderer=null,this.texture=null,this.source=null,this.image=null,this.glTexture=null}});t.exports=a},function(t,e,i){var n=i(24),s=i(887),r=i(0),o=i(37),a=i(26),h=i(11),l=i(357),u=i(4),c=i(316),d=i(165),f=new r({Extends:h,initialize:function(t){h.call(this),this.game=t,this.name="TextureManager",this.list={},this._tempCanvas=n.create2D(this,1,1),this._tempContext=this._tempCanvas.getContext("2d"),this._pending=0,t.events.once("boot",this.boot,this)},boot:function(){this._pending=2,this.on("onload",this.updatePending,this),this.on("onerror",this.updatePending,this),this.addBase64("__DEFAULT",this.game.config.defaultImage),this.addBase64("__MISSING",this.game.config.missingImage),this.game.events.once("destroy",this.destroy,this)},updatePending:function(){this._pending--,0===this._pending&&(this.off("onload"),this.off("onerror"),this.game.events.emit("texturesready"))},checkKey:function(t){return!this.exists(t)||(console.error("Texture key already in use: "+t),!1)},remove:function(t){if("string"==typeof t){if(!this.exists(t))return console.warn("No texture found matching key: "+t),this;t=this.get(t)}return this.list.hasOwnProperty(t.key)&&(delete this.list[t.key],t.destroy(),this.emit("removetexture",t.key)),this},addBase64:function(t,e){if(this.checkKey(t)){var i=this,n=new Image;n.onerror=function(){i.emit("onerror",t)},n.onload=function(){var e=i.create(t,n);c.Image(e,0),i.emit("addtexture",t,e),i.emit("onload",t,e)},n.src=e}return this},getBase64:function(t,e,i,s){void 0===i&&(i="image/png"),void 0===s&&(s=.92);var r="",o=this.getFrame(t,e);if(o){var a=o.canvasData,h=n.create2D(this,a.width,a.height);h.getContext("2d").drawImage(o.source.image,a.x,a.y,a.width,a.height,0,0,a.width,a.height),r=h.toDataURL(i,s),n.remove(h)}return r},addImage:function(t,e,i){var n=null;return this.checkKey(t)&&(n=this.create(t,e),c.Image(n,0),i&&n.setDataSource(i),this.emit("addtexture",t,n)),n},addRenderTexture:function(t,e){var i=null;return this.checkKey(t)&&((i=this.create(t,e)).add("__BASE",0,0,0,e.width,e.height),this.emit("addtexture",t,i)),i},generate:function(t,e){if(this.checkKey(t)){var i=n.create(this,1,1);return e.canvas=i,l(e),this.addCanvas(t,i)}return null},createCanvas:function(t,e,i){if(void 0===e&&(e=256),void 0===i&&(i=256),this.checkKey(t)){var s=n.create(this,e,i,a.CANVAS,!0);return this.addCanvas(t,s)}return null},addCanvas:function(t,e,i){void 0===i&&(i=!1);var n=null;return i?n=new s(this,t,e,e.width,e.height):this.checkKey(t)&&(n=new s(this,t,e,e.width,e.height),this.list[t]=n,this.emit("addtexture",t,n)),n},addAtlas:function(t,e,i,n){return Array.isArray(i.textures)||Array.isArray(i.frames)?this.addAtlasJSONArray(t,e,i,n):this.addAtlasJSONHash(t,e,i,n)},addAtlasJSONArray:function(t,e,i,n){var s=null;if(this.checkKey(t)){if(s=this.create(t,e),Array.isArray(i))for(var r=1===i.length,o=0;o=r.x&&t=r.y&&e=r.x&&t=r.y&&e0)&&(!!n.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)&&(!!n.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!n.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(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||this.emit("mute",this,t)}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||this.emit("volume",this,t)}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||(this.calculateRate(),this.emit("rate",this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||(this.calculateRate(),this.emit("detune",this,t))}},setDetune:function(t){return this.detune=t,this},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))}},setSeek:function(t){return this.seek=t,this},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))}},setLoop:function(t){return this.loop=t,this}});t.exports=s},function(t,e,i){var n=i(115),s=i(0),r=i(323),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(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each(function(e,i){for(var n=0;n-1&&(delete this.keys[n],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,i=t.sys,n=i.settings;t.init&&(t.init.call(t,n.data),n.status=s.INIT,n.isTransition&&i.events.emit("transitioninit",n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=s.LOADING,e.once("complete",this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>s.START&&n.settings.status<=s.RUNNING&&n.step(t,e)}},resize:function(t,e){for(var i=0;i=s.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)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.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e=0;){var a=e[o];-1!==(r=t.indexOf(a))?(n(t,r),i&&i.call(s,a)):e.pop(),o--}return e}},function(t,e,i){var n=i(0),s=i(11),r=i(7),o=i(13),a=i(5),h=i(2),l=i(15),u=i(330),c=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once("boot",this.boot,this)},boot:function(){var t,e,i,n,s,r,o,a=this.game.config,l=a.installGlobalPlugins;for(l=l.concat(this._pendingGlobal),t=0;t10&&(t=10-this.pointersTotal);for(var i=0;i0},queueTouchStart:function(t){if(this.queue.push(s.TOUCH_START,t),this._hasDownCallback){var e=this.domCallbacks;this._hasDownCallback=this.processDomCallbacks(e.downOnce,e.down,t)}},queueTouchMove:function(t){if(this.queue.push(s.TOUCH_MOVE,t),this._hasMoveCallback){var e=this.domCallbacks;this._hasMoveCallback=this.processDomCallbacks(e.moveOnce,e.move,t)}},queueTouchEnd:function(t){if(this.queue.push(s.TOUCH_END,t),this._hasUpCallback){var e=this.domCallbacks;this._hasUpCallback=this.processDomCallbacks(e.upOnce,e.up,t)}},queueTouchCancel:function(t){this.queue.push(s.TOUCH_CANCEL,t)},queueMouseDown:function(t){if(this.queue.push(s.MOUSE_DOWN,t),this._hasDownCallback){var e=this.domCallbacks;this._hasDownCallback=this.processDomCallbacks(e.downOnce,e.down,t)}},queueMouseMove:function(t){if(this.queue.push(s.MOUSE_MOVE,t),this._hasMoveCallback){var e=this.domCallbacks;this._hasMoveCallback=this.processDomCallbacks(e.moveOnce,e.move,t)}},queueMouseUp:function(t){if(this.queue.push(s.MOUSE_UP,t),this._hasUpCallback){var e=this.domCallbacks;this._hasUpCallback=this.processDomCallbacks(e.upOnce,e.up,t)}},addUpCallback:function(t,e){return void 0===e&&(e=!0),e?this.domCallbacks.upOnce.push(t):this.domCallbacks.up.push(t),this._hasUpCallback=!0,this},addDownCallback:function(t,e){return void 0===e&&(e=!0),e?this.domCallbacks.downOnce.push(t):this.domCallbacks.down.push(t),this._hasDownCallback=!0,this},addMoveCallback:function(t,e){return void 0===e&&(e=!1),e?this.domCallbacks.moveOnce.push(t):this.domCallbacks.move.push(t),this._hasMoveCallback=!0,this},inputCandidate:function(t,e){var i=t.input;if(!i||!i.enabled||!t.willRender(e))return!1;var n=!0,s=t.parentContainer;if(s)do{if(!s.willRender(e)){n=!1;break}s=s.parentContainer}while(s);return n},hitTest:function(t,e,i,n){void 0===n&&(n=this._tempHitTest);var s=this._tempPoint,r=i.scrollX,o=i.scrollY;n.length=0;var a=t.x,h=t.y;1!==i.resolution&&(a+=i._x,h+=i._y),i.getWorldPoint(a,h,s),t.worldX=s.x,t.worldY=s.y;for(var l={x:0,y:0},u=this._tempMatrix,d=this._tempMatrix2,f=0;f1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e){t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},function(t,e,i){var n=i(37);n.ColorToRGBA=i(915),n.ComponentToHex=i(346),n.GetColor=i(177),n.GetColor32=i(376),n.HexStringToColor=i(377),n.HSLToColor=i(914),n.HSVColorWheel=i(913),n.HSVToRGB=i(176),n.HueToComponent=i(345),n.IntegerToColor=i(374),n.IntegerToRGB=i(373),n.Interpolate=i(912),n.ObjectToColor=i(372),n.RandomRGB=i(911),n.RGBStringToColor=i(371),n.RGBToHSV=i(375),n.RGBToString=i(910),n.ValueToColor=i(178),t.exports=n},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","crisp-edges","-moz-crisp-edges","-webkit-optimize-contrast","optimize-contrast","pixelated"].forEach(function(e){t.style["image-rendering"]=e}),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(171),s=i(0),r=i(70),o=i(3),a=new s({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.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;ei;)n-=i;n16777215?{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(37),s=i(373);t.exports=function(t){var e=s(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(ef.right&&(p=u(p,p+(v-f.right),this.lerp.x)),mf.bottom&&(g=u(g,g+(m-f.bottom),this.lerp.y))):(p=u(p,v-l,this.lerp.x),g=u(g,m-c,this.lerp.y))}this.useBounds&&(p=this.clampX(p),g=this.clampY(g)),this.roundPixels&&(l=Math.round(l),c=Math.round(c)),this.scrollX=p,this.scrollY=g;var y=p+s,x=g+o;this.midPoint.set(y,x);var w=i/a,T=n/a;this.worldView.setTo(y-w/2,x-T/2,w,T),h.loadIdentity(),h.scale(e,e),h.translate(this.x+l,this.y+c),h.rotate(this.rotation),h.scale(a,a),h.translate(-l,-c),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=o(i,0,1),n=o(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var a=this.width/2,h=this.height/2,l=t.x-s,u=t.y-r;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},function(t,e,i){var n=i(380),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.html=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","html","obj","tilemap","xml"],e=0;ee.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=i(23),s=i(0),r=i(383),o=i(382),a=i(4),h=new s({initialize:function(t,e,i){this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,a(i,"frames",[]),a(i,"defaultTextureKey",null)),this.frameRate=a(i,"frameRate",null),this.duration=a(i,"duration",null),null===this.duration&&null===this.frameRate?(this.frameRate=24,this.duration=this.frameRate/this.frames.length*1e3):this.duration&&null===this.frameRate?this.frameRate=this.frames.length/(this.duration/1e3):this.duration=this.frames.length/this.frameRate*1e3,this.msPerFrame=1e3/this.frameRate,this.skipMissedFrames=a(i,"skipMissedFrames",!0),this.delay=a(i,"delay",0),this.repeat=a(i,"repeat",0),this.repeatDelay=a(i,"repeatDelay",0),this.yoyo=a(i,"yoyo",!1),this.showOnStart=a(i,"showOnStart",!1),this.hideOnComplete=a(i,"hideOnComplete",!1),this.paused=!1,this.manager.on("pauseall",this.pause,this),this.manager.on("resumeall",this.resume,this)},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){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 t>=0&&t0){s.isLast=!0,s.nextFrame=l[0],l[0].prevFrame=s;var v=1/(l.length-1);for(r=0;r=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,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);var i=this.frames[e];0!==e||t.forward||(i=this.getLastFrame()),t.updateFrame(i)},getFrameByProgress:function(t){return t=n(t,0,1),r(t,this.frames,"progress")},nextFrame:function(t){var e=t.currentFrame;e.isLast?t._yoyo?this.handleYoyoFrame(t,!1):t.repeatCounter>0?t._reverse&&t.forward?t.forward=!1:this.repeatAnimation(t):this.completeAnimation(t):this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t._reverse===!e&&t.repeatCounter>0)return t.forward=e,void this.repeatAnimation(t);if(t._reverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else this.completeAnimation(t)},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t._yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?t._reverse&&!t.forward?(t.currentFrame=this.getLastFrame(),this.repeatAnimation(t)):(t.forward=!0,this.repeatAnimation(t)):this.completeAnimation(t):this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.updateFrame(e),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){if(2===t._pendingStop)return this.completeAnimation(t);t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t._repeatDelay):(t.repeatCounter--,t.updateFrame(t.currentFrame[t.forward?"nextFrame":"prevFrame"]),t.isPlaying&&(this.getNextTick(t),t.pendingRepeat=!1,t.parent.emit("animationrepeat",this,t.currentFrame,t.repeatCounter,t.parent)))},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(){this.manager.off("pauseall",this.pause,this),this.manager.off("resumeall",this.resume,this),this.manager.remove(this.key);for(var t=0;t-h&&(c-=h,n+=l),f=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){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,i){var n=i(16),s=i(38),r=i(199),o=i(198),a={_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 o(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=r(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},setRandomPosition:function(t,e,i,n){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),this.x=t+Math.random()*i,this.y=e+Math.random()*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},getLocalTransformMatrix:function(t){return void 0===t&&(t=new s),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new s),void 0===e&&(e=new s);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t}};t.exports=a},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){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,i){var n=new(i(0))({initialize:function(t,e){this.geometryMask=e},setShape:function(t){this.geometryMask=t},preRenderWebGL:function(t,e,i){var n=t.gl,s=this.geometryMask;t.flush(),n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.NOTEQUAL,1,1),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),s.renderWebGL(t,s,0,i),t.flush(),n.colorMask(!0,!0,!0,!0),n.stencilFunc(n.EQUAL,1,1),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)},postRenderWebGL:function(t){var e=t.gl;t.flush(),e.disable(e.STENCIL_TEST)},preRenderCanvas:function(t,e,i){var n=this.geometryMask;t.currentContext.save(),n.renderCanvas(t,n,0,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){var i=t.sys.game.renderer;if(this.renderer=i,this.bitmapMask=e,this.maskTexture=null,this.mainTexture=null,this.dirty=!0,this.mainFramebuffer=null,this.maskFramebuffer=null,this.invertAlpha=!1,i&&i.gl){var n=i.width,s=i.height,r=0==(n&n-1)&&0==(s&s-1),o=i.gl,a=r?o.REPEAT:o.CLAMP_TO_EDGE,h=o.LINEAR;this.mainTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.maskTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.mainFramebuffer=i.createFramebuffer(n,s,this.mainTexture,!1),this.maskFramebuffer=i.createFramebuffer(n,s,this.maskTexture,!1),i.onContextRestored(function(t){var e=t.width,i=t.height,n=0==(e&e-1)&&0==(i&i-1),s=t.gl,r=n?s.REPEAT:s.CLAMP_TO_EDGE,o=s.LINEAR;this.mainTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.maskTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.mainFramebuffer=t.createFramebuffer(e,i,this.mainTexture,!1),this.maskFramebuffer=t.createFramebuffer(e,i,this.maskTexture,!1)},this)}},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BitmapMaskPipeline.beginMask(this,e,i)},postRenderWebGL:function(t){t.pipelines.BitmapMaskPipeline.endMask(this)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null;var t=this.renderer;t&&t.gl&&(t.deleteTexture(this.mainTexture),t.deleteTexture(this.maskTexture),t.deleteFramebuffer(this.mainFramebuffer),t.deleteFramebuffer(this.maskFramebuffer)),this.mainTexture=null,this.maskTexture=null,this.mainFramebuffer=null,this.maskFramebuffer=null,this.renderer=null}});t.exports=n},function(t,e,i){var n=i(394),s=i(393),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t){return void 0===t&&this.texture&&(t=this),new n(this.scene,t)},createGeometryMask:function(t){return void 0===t&&"Graphics"===this.type&&(t=this),new s(this.scene,t)}};t.exports=r},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x-e,a=t.y-i;return t.x=o*s-a*r+e,t.y=o*r+a*s+i,t}},function(t,e,i){var n=i(6);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(190),s=i(124);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=s(t)/i);for(var o=0;o=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e,i){var n=i(23),s={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,s){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=n(t,0,1),this._alphaTR=n(e,0,1),this._alphaBL=n(i,0,1),this._alphaBR=n(s,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=n(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=n(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=n(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=n(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=n(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=s},function(t,e){t.exports=function(t){return Math.PI*t.radius*2}},function(t,e,i){var n=i(402),s=i(192),r=i(93),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h>>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;e0;i--){var n=Math.floor(this.frac()*(e+1)),s=t[n];t[n]=t[i],t[i]=s}return t}});t.exports=n},function(t,e,i){var n=i(192),s=i(93),r=i(16),o=i(6);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(44),s=i(42),r=i(43),o=i(41);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(46),s=i(42),r=i(45),o=i(41);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(75),s=i(42),r=i(74),o=i(41);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(72),s=i(44),r=i(73),o=i(43);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(72),s=i(46),r=i(73),o=i(45);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(74),s=i(73);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(411),s=i(75),r=i(72);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(48),s=i(44),r=i(47),o=i(43);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(48),s=i(46),r=i(47),o=i(45);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(48),s=i(75),r=i(47),o=i(74);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(193),s=[];s[n.BOTTOM_CENTER]=i(415),s[n.BOTTOM_LEFT]=i(414),s[n.BOTTOM_RIGHT]=i(413),s[n.CENTER]=i(412),s[n.LEFT_CENTER]=i(410),s[n.RIGHT_CENTER]=i(409),s[n.TOP_CENTER]=i(408),s[n.TOP_LEFT]=i(407),s[n.TOP_RIGHT]=i(406);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e,i){t.exports={Angle:i(1050),Call:i(1049),GetFirst:i(1048),GetLast:i(1047),GridAlign:i(1046),IncAlpha:i(1035),IncX:i(1034),IncXY:i(1033),IncY:i(1032),PlaceOnCircle:i(1031),PlaceOnEllipse:i(1030),PlaceOnLine:i(1029),PlaceOnRectangle:i(1028),PlaceOnTriangle:i(1027),PlayAnimation:i(1026),PropertyValueInc:i(32),PropertyValueSet:i(25),RandomCircle:i(1025),RandomEllipse:i(1024),RandomLine:i(1023),RandomRectangle:i(1022),RandomTriangle:i(1021),Rotate:i(1020),RotateAround:i(1019),RotateAroundDistance:i(1018),ScaleX:i(1017),ScaleXY:i(1016),ScaleY:i(1015),SetAlpha:i(1014),SetBlendMode:i(1013),SetDepth:i(1012),SetHitArea:i(1011),SetOrigin:i(1010),SetRotation:i(1009),SetScale:i(1008),SetScaleX:i(1007),SetScaleY:i(1006),SetTint:i(1005),SetVisible:i(1004),SetX:i(1003),SetXY:i(1002),SetY:i(1001),ShiftPosition:i(1e3),Shuffle:i(999),SmootherStep:i(998),SmoothStep:i(997),Spread:i(996),ToggleVisible:i(995),WrapInRectangle:i(994)}},,,function(t,e,i){var n=i(0),s=i(895),r=i(196),o=10,a=new n({Extends:r,initialize:function(t){o=t.maxLights,t.fragShader=s.replace("%LIGHT_COUNT%",o.toString()),r.call(this,t),this.defaultNormalMap},boot:function(){this.defaultNormalMap=this.game.textures.getFrame("__DEFAULT")},onBind:function(t){r.prototype.onBind.call(this);var e=this.renderer,i=this.program;return this.mvpUpdate(),e.setInt1(i,"uNormSampler",1),e.setFloat2(i,"uResolution",this.width,this.height),t&&this.setNormalMap(t),this},onRender:function(t,e){this.active=!1;var i=t.sys.lights;if(!i||i.lights.length<=0||!i.active)return this;var n=i.cull(e),s=Math.min(n.length,o);if(0===s)return this;this.active=!0;var r,a=this.renderer,h=this.program,l=e.matrix,u={x:0,y:0},c=a.height;for(r=0;r0&&n>0&&s.scissor(t,this.drawingBufferHeight-e-n,i,n))},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},setPipeline:function(t,e){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(e),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==r.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,!0)},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},setBlankTexture:function(t){void 0===t&&(t=!1),!t&&0===this.currentActiveTextureUnit&&this.currentTextures[0]||this.setTexture2D(this.blankTexture.glTexture,0)},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,i=this.width,n=this.height;return t!==this.currentFramebuffer&&(t&&t.renderTexture?(i=t.renderTexture.width,n=t.renderTexture.height):this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),e.viewport(0,0,i,n),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 s=this.gl,a=s.NEAREST,h=s.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,o(e,i)&&(h=s.REPEAT),n===r.ScaleModes.LINEAR&&this.config.antialias&&(a=s.LINEAR),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,s.RGBA,t):this.createTexture2D(0,a,a,h,h,s.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){l=void 0===l||null===l||l;var u=this.gl,c=u.createTexture();return 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){var e=this.nativeTextures.indexOf(t);return-1!==e&&a(this.nativeTextures,e),this.gl.deleteTexture(t),this.currentTextures[0]===t&&this.setBlankTexture(!0),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=t._cx,i=t._cy,n=t._cw,s=t._ch,r=this.pipelines.TextureTintPipeline,o=t.backgroundColor;if(t.renderToTexture){this.flush(),this.pushScissor(e,i,n,-s),this.setFramebuffer(t.framebuffer);var a=this.gl;a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),r.projOrtho(e,n+e,i,s+i,-1e3,1e3),o.alphaGL>0&&r.drawFillRect(e,i,n+e,s+i,l.getTintFromFloats(o.redGL,o.greenGL,o.blueGL,1),o.alphaGL),t.emit("prerender",t)}else this.pushScissor(e,i,n,s),o.alphaGL>0&&r.drawFillRect(e,i,n,s,l.getTintFromFloats(o.redGL,o.greenGL,o.blueGL,1),o.alphaGL)},postRenderCamera:function(t){var e=this.pipelines.TextureTintPipeline;if(t.flashEffect.postRenderWebGL(e,l.getTintFromFloats),t.fadeEffect.postRenderWebGL(e,l.getTintFromFloats),t.dirty=!1,this.popScissor(),t.renderToTexture){e.flush(),this.setFramebuffer(null),t.emit("postrender",t),e.projOrtho(0,e.width,e.height,0,-1e3,1e3);var i=l.getTintAppendFloatAlpha;(t.pipeline?t.pipeline:e).batchTexture(t,t.glTexture,t.width,t.height,t.x,t.y,t.width,t.height,t.zoom,t.zoom,t.rotation,t.flipX,!t.flipY,1,1,0,0,0,0,t.width,t.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),t._isTinted&&t.tintFill,0,0,this.defaultCamera,null),this.setBlankTexture(!0)}},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;for(var n in this.config.clearBeforeRender&&(t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)),t.enable(t.SCISSOR_TEST),i)i[n].onPreRender();this.currentScissor=[0,0,this.width,this.height],this.scissorStack=[this.currentScissor],this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.setPipeline(this.pipelines.TextureTintPipeline)}},render:function(t,e,i,n){if(!this.contextLost){var s=e.list,o=s.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;l=0?g=-(g+d):g<0&&(g=Math.abs(g)-d)),-1===y&&(v>=0?v=-(v+f):v<0&&(v=Math.abs(v)-f))}a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y,o.multiply(a,h)):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY,o.multiply(a,h)),r.save(),h.setToContext(r),r.scale(m,y),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=s,r.drawImage(e.source.image,u,c,d,f,g,v,d/p,f/p),r.restore()}},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=u},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.once("remove",this.remove,this),this.isPlaying=!1,this.currentAnim=null,this.currentFrame=null,this._timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this._delay=0,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this.forward=!0,this._reverse=!1,this.accumulator=0,this.nextTick=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},setDelay:function(t){return void 0===t&&(t=0),this._delay=t,this.parent},getDelay:function(){return this._delay},delayedPlay:function(t,e,i){return this.play(e,!0,i),this.nextTick+=t,this.parent},getCurrentKey:function(){if(this.currentAnim)return this.currentAnim.key},load:function(t,e){return void 0===e&&(e=0),this.isPlaying&&this.stop(),this.animationManager.load(this,t,e),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.updateFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.updateFrame(t),this.parent},isPaused:{get:function(){return this._paused}},play:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!0,this._reverse=!1,this._startAnimation(t,i))},playReverse:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!1,this._reverse=!0,this._startAnimation(t,i))},_startAnimation:function(t,e){this.load(t,e);var i=this.currentAnim,n=this.parent;return this.repeatCounter=-1===this._repeat?Number.MAX_VALUE:this._repeat,i.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,i.showOnStart&&(n.visible=!0),n.emit("animationstart",this.currentAnim,this.currentFrame,n),n},reverse:function(t){return this.isPlaying&&this.currentAnim.key===t?(this._reverse=!this._reverse,this.forward=!this.forward,this.parent):this.parent},getProgress:function(){var t=this.currentFrame.progress;return this.forward||(t=1-t),t},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},remove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},getRepeat:function(){return this._repeat},setRepeat:function(t){return this._repeat=t,this.repeatCounter=0,this.parent},getRepeatDelay:function(){return this._repeatDelay},setRepeatDelay:function(t){return this._repeatDelay=t,this.parent},restart:function(t){void 0===t&&(t=!1),this.currentAnim.getFirstTick(this,t),this.forward=!0,this.isPlaying=!0,this.pendingRepeat=!1,this._paused=!1,this.updateFrame(this.currentAnim.frames[0]);var e=this.parent;return e.emit("animationrestart",this.currentAnim,this.currentFrame,e),this.parent},stop:function(){this._pendingStop=0,this.isPlaying=!1;var t=this.parent;return t.emit("animationcomplete",this.currentAnim,this.currentFrame,t),t},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopOnRepeat:function(){return this._pendingStop=2,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},setTimeScale:function(t){return void 0===t&&(t=1),this._timeScale=t,this.parent},getTimeScale:function(){return this._timeScale},getTotalFrames:function(){return this.currentAnim.frames.length},update:function(t,e){if(this.currentAnim&&this.isPlaying&&!this.currentAnim.paused){if(this.accumulator+=e*this._timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.currentAnim.completeAnimation(this);this.accumulator>=this.nextTick&&this.currentAnim.setFrame(this)}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),e.setSizeToFrame(),t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin(),e},updateFrame:function(t){var e=this.setCurrentFrame(t);if(this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;e.emit("animationupdate",i,t,e),3===this._pendingStop&&this._pendingStopValue===t&&this.currentAnim.completeAnimation(this)}},setYoyo:function(t){return void 0===t&&(t=!1),this._yoyo=t,this.parent},getYoyo:function(){return this._yoyo},destroy:function(){this.animationManager.off("remove",this.remove,this),this.animationManager=null,this.parent=null,this.currentAnim=null,this.currentFrame=null}});t.exports=n},function(t,e){t.exports=function(t){return t.split("").reverse().join("")}},function(t,e){t.exports=function(t,e){return t.replace(/%([0-9]+)/g,function(t,i){return e[Number(i)-1]})}},function(t,e,i){t.exports={Format:i(429),Pad:i(179),Reverse:i(428),UppercaseFirst:i(327),UUID:i(295)}},function(t,e,i){var n=i(63);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){t.exports=function(t,e){for(var i=0;i-1&&(e.state=a.REMOVED,s.splice(r,1)):(e.state=a.REMOVED,n.splice(r,1))}for(i.length=0,i=this._add,t=0;t-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&&(t.currentPipeline&&t.currentPipeline.vertexCount>0&&t.flush(),r.vertexBuffer=e.vertexBuffer[a],t.setPipeline(r),t.setTexture2D(s[a].glTexture,0),t.gl.drawArrays(r.topology,0,e.vertexCount[a]));r.vertexBuffer=o,r.viewIdentity(),r.modelIdentity()}},function(t,e,i){var n=i(1),s=i(1);n=i(445),s=i(444),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){t.exports=function(t,e,i,n,s){e.cull(n);var r=e.culledTiles,o=r.length;if(0!==o){var a=t._tempMatrix1,h=t._tempMatrix2,l=t._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(n.matrix);var u=t.currentContext,c=e.gidMap;u.save(),s?(a.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l),l.copyToContext(u)):(h.e-=n.scrollX*e.scrollFactorX,h.f-=n.scrollY*e.scrollFactorY,h.copyToContext(u));for(var d=n.alpha*e.alpha,f=0;f-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(20);t.exports=function(t){for(var e,i,s,r,o,a=0;a1){if(Array.isArray(l.tiles)){for(var c={},d={},f=0;f>>0;return n}},function(t,e,i){var n=i(458),s=i(2),r=i(78),o=i(214),a=i(55);t.exports=function(t,e){for(var i=[],h=0;h0){var m=new a(u,v.gid,c,f.length,t.tilewidth,t.tileheight);m.rotation=v.rotation,m.flipX=v.flipped,d.push(m)}else{var y=e?null:new a(u,-1,c,f.length,t.tilewidth,t.tileheight);d.push(y)}++c===l.width&&(f.push(d),c=0,d=[])}u.data=f,i.push(u)}}return i}},function(t,e,i){t.exports={Parse:i(217),Parse2DArray:i(133),ParseCSV:i(216),Impact:i(210),Tiled:i(215)}},function(t,e,i){var n=i(50),s=i(49),r=i(3);t.exports=function(t,e,i,o,a,h){return void 0===o&&(o=new r(0,0)),o.x=n(t,i,a,h),o.y=s(e,i,a,h),o}},function(t,e,i){var n=i(17);t.exports=function(t,e,i,s,r,o){if(void 0!==r){var a,h=n(t,e,i,s,null,o),l=0;for(a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e,i){var n=i(56),s=i(34),r=i(85);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;ae)){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(56),s=i(34),r=i(134);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;a=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;r=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);else if(2===r)for(a=x;a>=y;a--)for(o=v;o=y;a--)for(o=m;o>=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);return u.tilesDrawn=i.length,u.tilesTotal=d*f,i}},function(t,e,i){var n=i(101),s=i(100),r=i(17),o=i(220);t.exports=function(t,e,i,a,h,l){void 0===i&&(i={}),Array.isArray(t)||(t=[t]);var u=l.tilemapLayer;void 0===a&&(a=u.scene),void 0===h&&(h=a.cameras.main);var c,d=r(0,0,l.width,l.height,null,l),f=[];for(c=0;c=0&&p=0&&g=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off("update",this.step,this),t.events.emit("transitioncomplete",this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(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)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off("shutdown",this.shutdown,this),t.off("postupdate",this.step,this),t.off("transitionout")},destroy:function(){this.shutdown(),this.scene.sys.events.off("start",this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});o.register("ScenePlugin",a,"scenePlugin"),t.exports=a},function(t,e,i){var n=i(116),s=i(20),r={SceneManager:i(329),ScenePlugin:i(495),Settings:i(326),Systems:i(166)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(221),s=new(i(0))({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once("boot",this.boot,this)},boot:function(){}});t.exports=s},function(t,e,i){t.exports={BasePlugin:i(221),DefaultPlugins:i(167),PluginCache:i(15),PluginManager:i(331),ScenePlugin:i(497)}},,,,,,,,,function(t,e,i){var n=i(229);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){var n=i(230);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){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,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(509);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.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,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(511);t.exports=function(t,e,i,s,r){var o=0;return t.deltaX()<0&&!t.blocked.left&&e.collideRight&&t.checkCollision.left?e.faceRight&&t.x0&&!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,i){var n=i(512),s=i(510),r=i(226);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,m=0,y=1;if(e.deltaAbsX()>e.deltaAbsY()?m=-1:e.deltaAbsX()=0;a--){var h=e[a],l=o(s,r,h.x,h.y);l=0;a--){var h=e[a],l=o(s,r,h.x,h.y);l>i&&(n=h,i=l)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var o=Math.atan2(i-t.y,e-t.x);return s>0&&(n=r(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(o,n),o},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),void 0===i&&(i=new c),i.setToPolar(s(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new c),i.setToPolar(t,e)},shutdown:function(){if(this.world){var t=this.systems.events;t.off("update",this.world.update,this.world),t.off("postupdate",this.world.postUpdate,this.world),t.off("shutdown",this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off("start",this.start,this),this.scene=null,this.systems=null}});u.register("ArcadePhysics",f,"arcadePhysics"),t.exports=f},function(t,e,i){var n=i(35),s=i(20),r={ArcadePhysics:i(527),Body:i(232),Collider:i(231),Factory:i(238),Group:i(235),Image:i(237),Sprite:i(104),StaticBody:i(225),StaticGroup:i(234),World:i(233)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(138),s=i(240),r=i(239),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=new(i(0))({initialize:function(t,e,i,n){this.x=0,this.y=0,this.z=0,this.w=0,"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)},clone:function(){return new n(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this.w=t.w||0,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},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||0,this.w+=t.w||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this.w-=t.w||0,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},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){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},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;o1?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,i){return Math.max(t-e,i)}},function(t,e){t.exports=function(t,e,i){return Math.min(t+e,i)}},function(t,e){t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t,e){return t/e/1e3}},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.floor(t*n)/n}},function(t,e){t.exports=function(t,e){return Math.abs(t-e)}},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.ceil(t*n)/n}},function(t,e){t.exports=function(t){for(var e=0,i=0;i0&&0==(t&t-1)}},function(t,e,i){t.exports={GetNext:i(294),IsSize:i(117),IsValue:i(549)}},function(t,e,i){var n=i(182);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){var n=i(119);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,i){var n=i(171);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return t[0]===t[i]?(e<0&&(r=Math.floor(s=i*(1+e))),n(s-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(n(-s,t[0],t[0],t[1],t[1])-t[0]):e>1?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[i=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit("start",this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on("update",this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit("progress",this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=s.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0&&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,i){var n=i(0),s=i(11),r=i(4),o=i(106),a=i(256),h=i(143),l=i(255),u=i(602),c=i(601),d=i(600),f=i(142),p=new n({Extends:s,initialize:function(t){s.call(this),this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.enabled=!0,this.target,this.keys=[],this.combos=[],this.queue=[],this.onKeyHandler,this.time=0,t.pluginEvents.once("boot",this.boot,this),t.pluginEvents.on("start",this.start,this)},boot:function(){var t=this.settings.input,e=this.scene.sys.game.config;this.enabled=r(t,"keyboard",e.inputKeyboard),this.target=r(t,"keyboard.target",e.inputKeyboardEventTarget),this.sceneInputPlugin.pluginEvents.once("destroy",this.destroy,this)},start:function(){this.enabled&&this.startListeners(),this.sceneInputPlugin.pluginEvents.once("shutdown",this.shutdown,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},startListeners:function(){var t=this,e=function(e){if(!e.defaultPrevented&&t.isActive()){t.queue.push(e);var i=t.keys[e.keyCode];i&&i.preventDefault&&e.preventDefault()}};this.onKeyHandler=e,this.target.addEventListener("keydown",e,!1),this.target.addEventListener("keyup",e,!1),this.sceneInputPlugin.pluginEvents.on("update",this.update,this)},stopListeners:function(){this.target.removeEventListener("keydown",this.onKeyHandler),this.target.removeEventListener("keyup",this.onKeyHandler),this.sceneInputPlugin.pluginEvents.off("update",this.update)},createCursorKeys:function(){return this.addKeys({up:h.UP,down:h.DOWN,left:h.LEFT,right:h.RIGHT,space:h.SPACE,shift:h.SHIFT})},addKeys:function(t){var e={};if("string"==typeof t){t=t.split(",");for(var i=0;i-1?e[i]=t:e[t.keyCode]=t,t}return"string"==typeof t&&(t=h[t.toUpperCase()]),e[t]||(e[t]=new a(t)),e[t]},removeKey:function(t){var e=this.keys;if(t instanceof a){var i=e.indexOf(t);i>-1&&(this.keys[i]=void 0)}else"string"==typeof t&&(t=h[t.toUpperCase()]);e[t]&&(e[t]=void 0)},createCombo:function(t,e){return new l(this,t,e)},checkDown:function(t,e){if(this.enabled&&t.isDown){var i=f(this.time-t.timeDown,e);if(i>t._tick)return t._tick=i,!0}return!1},update:function(t){this.time=t;var e=this.queue.length;if(this.enabled&&0!==e)for(var i=this.queue.splice(0,e),n=this.keys,s=0;s=e}}},function(t,e,i){var n=i(71),s=i(40),r=i(0),o=i(260),a=i(608),h=i(52),l=i(90),u=i(89),c=i(11),d=i(2),f=i(106),p=i(8),g=i(15),v=i(9),m=i(39),y=i(59),x=i(69),w=new r({Extends:c,initialize:function(t){c.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new c,this.enabled=!0,this.displayList,this.cameras,f.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once("destroy",this.destroy,this),this.pluginEvents.emit("boot")},start:function(){var t=this.systems.events;t.on("transitionstart",this.transitionIn,this),t.on("transitionout",this.transitionOut,this),t.on("transitioncomplete",this.transitionComplete,this),t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.once("shutdown",this.shutdown,this),this.enabled=!0,this.pluginEvents.emit("start")},preUpdate:function(){this.pluginEvents.emit("preUpdate");var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,n=e.length;if(0!==i||0!==n){for(var s=this._list,r=0;r-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._pendingRemoval.length=0,this._list=s.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},update:function(t,e){if(this.isActive()){this.pluginEvents.emit("update",t,e);var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(n=!0,this._pollTimer=this.pollRate)),n)for(var s=this.manager.pointers,r=0;r0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}}},clear:function(t){var e=t.input;if(e){this.queueForRemoval(t),e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,this.manager.resetCursor(e),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&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,s}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,s=this._eventContainer;n.cancelled=!1;for(var r=!1,o=0;o0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var a=[];for(i=0;i1&&(this.sortGameObjects(a),this.topOnly&&a.splice(1)),this._drag[t.id]=a,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&h(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)}return s.length}if(5===t.dragState){for(s=this._drag[t.id],i=0;i0){for(this.sortGameObjects(s),e=0;e0){for(this.sortGameObjects(r),e=0;e-1&&this._draggable.splice(s,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return a(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,s=!1,r=!1,a=!1;if(p(e)){var h=e;e=d(h,"hitArea",null),i=d(h,"hitAreaCallback",null),n=d(h,"draggable",!1),s=d(h,"dropZone",!1),r=d(h,"cursor",!1),a=d(h,"useHandCursor",!1);var l=d(h,"pixelPerfect",!1),u=d(h,"alphaTolerance",1);l&&(e={},i=this.makePixelPerfect(u)),e&&i||this.setHitAreaFromTexture(t)}else"function"!=typeof e||i||(i=e,e={});for(var c=0;c0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)e.x&&t.ye.y}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},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,i){var n=Math.min(t.x,e),s=Math.max(t.right,e);t.x=n,t.width=s-n;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},function(t,e){t.exports=function(t,e){var i=Math.min(t.x,e.x),n=Math.max(t.right,e.right);t.x=i,t.width=n-i;var s=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=s,t.height=r-s,t}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;on(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,i){var n=i(145);t.exports=function(t,e){var i=n(t);return ii&&(i=h.x),h.xr&&(r=h.y),h.ye.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(69),s=i(107);t.exports=function(t,e){return!!(n(t,e.getPointA())||n(t,e.getPointB())||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},function(t,e,i){var n=i(272),s=i(69);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottomt.right+r||it.bottom+r||st.right||e.rightt.bottom||e.bottom0}},function(t,e,i){var n=i(271);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){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(9),s=i(148);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=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(52);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){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(9);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){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(89);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,i){var n=i(89);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(90);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(90);n.Area=i(712),n.Circumference=i(306),n.CircumferencePoint=i(156),n.Clone=i(711),n.Contains=i(89),n.ContainsPoint=i(710),n.ContainsRect=i(709),n.CopyFrom=i(708),n.Equals=i(707),n.GetBounds=i(706),n.GetPoint=i(308),n.GetPoints=i(307),n.Offset=i(705),n.OffsetPoint=i(704),n.Random=i(185),t.exports=n},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(9);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){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e,i){var n=i(40);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,i){var n=i(40);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(71);t.exports=function(t){return new n(t.x,t.y,t.radius)}},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(71);n.Area=i(722),n.Circumference=i(402),n.CircumferencePoint=i(192),n.Clone=i(721),n.Contains=i(40),n.ContainsPoint=i(720),n.ContainsRect=i(719),n.CopyFrom=i(718),n.Equals=i(717),n.GetBounds=i(716),n.GetPoint=i(405),n.GetPoints=i(403),n.Offset=i(715),n.OffsetPoint=i(714),n.Random=i(191),t.exports=n},function(t,e,i){var n=i(0),s=i(275),r=i(15),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(28),s=i(13),r=i(12),o=i(149);s.register("quad",function(t,e){void 0===t&&(t={});var i=r(t,"x",0),s=r(t,"y",0),a=r(t,"key",null),h=r(t,"frame",null),l=new o(this.scene,i,s,a,h);return void 0!==e&&(t.add=e),n(this.scene,l,t),l})},function(t,e,i){var n=i(28),s=i(13),r=i(12),o=i(4),a=i(108);s.register("mesh",function(t,e){void 0===t&&(t={});var i=r(t,"key",null),s=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"colors",[]),u=o(t,"alphas",[]),c=o(t,"uv",[]),d=new a(this.scene,0,0,h,c,l,u,i,s);return void 0!==e&&(t.add=e),n(this.scene,d,t),d})},function(t,e,i){var n=i(149);i(5).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(108);i(5).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){t.exports=function(){}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=this.pipeline;t.setPipeline(o,e);var a=o._tempMatrix1,h=o._tempMatrix2,l=o._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(s.matrix),r?(a.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l)):(h.e-=s.scrollX*e.scrollFactorX,h.f-=s.scrollY*e.scrollFactorY,a.multiply(h,l));var u=e.frame.glTexture,c=e.vertices,d=e.uv,f=e.colors,p=e.alphas,g=c.length,v=Math.floor(.5*g);o.vertexCount+v>=o.vertexCapacity&&o.flush(),o.setTexture2D(u,0);for(var m=o.vertexViewF32,y=o.vertexViewU32,x=o.vertexCount*o.vertexComponentCount-1,w=0,T=e.tintFill,b=0;b0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.fillColor,e.fillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,M=0;M0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.altFillColor,e.altFillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,M=0;M0){var F=o.strokeTint,k=n.getTintAppendFloatAlphaAndSwap(e.outlineFillColor,e.outlineFillAlpha*d);for(F.TL=k,F.TR=k,F.BL=k,F.BR=k,C=1;Cr;h--){for(l=0;l0&&r.maxLines1&&(d+=f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(4);t.exports=function(t,e){var i=e.width,s=e.height,r=Math.floor(i/2),o=Math.floor(s/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),l=n(e,"offset.x",0),u=n(e,"offset.y",0),c=n(e,"spacing.x",0),d=n(e,"spacing.y",0),f=n(e,"lineSpacing",0),p=n(e,"charsPerRow",null);null===p&&(p=t.sys.textures.getFrame(h).width/i)>a.length&&(p=a.length);for(var g=l,v=u,m={retroFont:!0,font:h,size:i,lineHeight:s+f,chars:{}},y=0,x=0;x?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(813),s=i(20),r={Parse:i(812)};r=s(!1,r,n),t.exports=r},function(t,e){t.exports=function(t,e,i,n,s){t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a,h,e.scaleX,e.scaleY,e.rotation,e.flipX,!e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r),t.setBlankTexture(!0)}},function(t,e,i){var n=i(1),s=i(1);n=i(816),s=i(815),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){t.exports={DeathZone:i(301),EdgeZone:i(300),RandomZone:i(297)}},function(t,e){t.exports=function(t,e,i,n,s){var r=e.emitters.list,o=r.length;if(0!==o){var a=t._tempMatrix1.copyFrom(n.matrix),h=t._tempMatrix2,l=t._tempMatrix3,u=t._tempMatrix4.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);a.multiply(u);var c=n.roundPixels,d=t.currentContext;d.save();for(var f=0;f0&&(X=X%b-b):X>b?X=b:X<0&&(X=b+X%b),null===C&&(C=new o(D+Math.cos(Y)*B,I+Math.sin(Y)*B,v),_.push(C),O+=.01);O<1+N;)T=X*O+Y,x=D+Math.cos(T)*B,w=I+Math.sin(T)*B,C.points.push(new r(x,w,v)),O+=.01;T=X+Y,x=D+Math.cos(T)*B,w=I+Math.sin(T)*B,C.points.push(new r(x,w,v));break;case n.FILL_RECT:u.setTexture2D(E),u.batchFillRect(p[++P],p[++P],p[++P],p[++P],f,c);break;case n.FILL_TRIANGLE:u.setTexture2D(E),u.batchFillTriangle(p[++P],p[++P],p[++P],p[++P],p[++P],p[++P],f,c);break;case n.STROKE_TRIANGLE:u.setTexture2D(E),u.batchStrokeTriangle(p[++P],p[++P],p[++P],p[++P],p[++P],p[++P],v,f,c);break;case n.LINE_TO:null!==C?C.points.push(new r(p[++P],p[++P],v)):(C=new o(p[++P],p[++P],v),_.push(C));break;case n.MOVE_TO:C=new o(p[++P],p[++P],v),_.push(C);break;case n.SAVE:a.push(f.copyToArray());break;case n.RESTORE:f.copyFromArray(a.pop());break;case n.TRANSLATE:D=p[++P],I=p[++P],f.translate(D,I);break;case n.SCALE:D=p[++P],I=p[++P],f.scale(D,I);break;case n.ROTATE:f.rotate(p[++P]);break;case n.SET_TEXTURE:var U=p[++P],G=p[++P];u.currentFrame=U,u.setTexture2D(U.glTexture,0),u.tintEffect=G,E=U.glTexture;break;case n.CLEAR_TEXTURE:u.currentFrame=t.blankTexture,u.tintEffect=2,E=t.blankTexture.glTexture}}}},function(t,e,i){var n=i(1),s=i(1);n=i(830),s=i(305),s=i(305),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(22);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length,h=t.currentContext;if(0!==a&&n(t,h,e,s,r)){var l=e.frame,u=e.displayCallback,c=s.scrollX*e.scrollFactorX,d=s.scrollY*e.scrollFactorY,f=e.fontData.chars,p=e.fontData.lineHeight,g=0,v=0,m=0,y=0,x=null,w=0,T=0,b=0,_=0,S=0,A=0,C=null,M=0,E=e.frame.source.image,P=l.cutX,L=l.cutY,F=0,k=e.fontSize/e.fontData.size;e.cropWidth>0&&e.cropHeight>0&&(h.save(),h.beginPath(),h.rect(0,0,e.cropWidth,e.cropHeight),h.clip());for(var R=0;R0&&e.cropHeight>0&&h.restore(),h.restore()}}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length;if(0!==a){var h=this.pipeline;t.setPipeline(h,e);var l=e.cropWidth>0||e.cropHeight>0;l&&(h.flush(),t.pushScissor(e.x,e.y,e.cropWidth*e.scaleX,e.cropHeight*e.scaleY));var u=h._tempMatrix1,c=h._tempMatrix2,d=h._tempMatrix3,f=h._tempMatrix4;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(s.matrix),r?(u.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d)):(c.e-=s.scrollX*e.scrollFactorX,c.f-=s.scrollY*e.scrollFactorY,u.multiply(c,d));var p=e.frame,g=p.glTexture,v=p.cutX,m=p.cutY,y=g.width,x=g.height,w=e._isTinted&&e.tintFill,T=n.getTintAppendFloatAlpha(e._tintTL,s.alpha*e._alphaTL),b=n.getTintAppendFloatAlpha(e._tintTR,s.alpha*e._alphaTR),_=n.getTintAppendFloatAlpha(e._tintBL,s.alpha*e._alphaBL),S=n.getTintAppendFloatAlpha(e._tintBR,s.alpha*e._alphaBR);h.setTexture2D(g,0);var A,C,M=0,E=0,P=0,L=0,F=e.letterSpacing,k=0,R=0,O=0,D=0,I=e.scrollX,B=e.scrollY,Y=e.fontData,X=Y.chars,z=Y.lineHeight,N=e.fontSize/Y.size,U=0,G=e._align,W=0,V=0;e.getTextBounds(!1);var H=e._bounds.lines;1===G?V=(H.longest-H.lengths[0])/2:2===G&&(V=H.longest-H.lengths[0]);for(var j=s.roundPixels,q=e.displayCallback,K=e.callbackData,J=0;Jv&&(r=v),o>m&&(o=m);var L=v+g.xAdvance,F=m+u;aA&&(A=M),MA&&(A=M),M-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;i0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e),s=t.indexOf(i);return-1!==n&&-1===s&&(t[n]=i,!0)}},function(t,e,i){var n=i(91);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return n(t,s)}},function(t,e,i){var n=i(62);t.exports=function(t,e,i,s,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(s)for(var h=0;ht.length-1)throw new Error("Index out of bounds");var r=n(t,e);return i&&i.call(s,r),r}},function(t,e,i){var n=i(314);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var s=[],r=Math.max(n((e-t)/(i||1)),0),o=0;o=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var n=t[i-1],s=t.indexOf(n);t[i]=n,t[s]=e}return t}},function(t,e,i){var n=i(62);t.exports=function(t,e,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=t.length),n(t,s,r))for(var o=s;o0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),s&&s.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),s&&s.call(r,l)}return e}},function(t,e){t.exports=function(t,e,i,n,s){if(void 0===s&&(s=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(s,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.pop(),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;a0||!this.inFocus)&&(this._coolDown--,r=Math.min(r,this._target)),r>this._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var o=0,a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),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){var i=0,n=function(t,e,n,s){var r=i-s.y-s.height;t.add(n,e,s.x,r,s.width,s.height)};t.exports=function(t,e,s){var r=t.source[e];t.add("__BASE",e,0,0,r.width,r.height),i=r.height;for(var o=s.split("\n"),a=/^[ ]*(- )*(\w+)+[: ]+(.*)/,h="",l="",u={x:0,y:0,width:0,height:0},c=0;cx||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var C=l,M=l,E=0,P=e.sourceIndex,L=0;Lg||c<-g)&&(c=0),c<0&&(c=g+c),-1!==d&&(g=c+(d+1));for(var v=f,m=f,y=0,x=0,w=0;wr&&(y=T-r),b>o&&(x=b-o),t.add(w,e,i+v,s+m,h-y,l-x),(v+=h+p)+h>r&&(v=f,m+=l+p)}return t}},function(t,e,i){var n=i(63);t.exports=function(t,e,i){if(i.frames){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);var r,o=i.frames;for(var a in o){var h=o[a];r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h),h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted()),r.customData=n(h)}for(var l in i)"frames"!==l&&(Array.isArray(i[l])?t.customData[l]=i[l].slice(0):t.customData[l]=i[l]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},function(t,e,i){var n=i(63);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;a=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,i){var n=i(92),s=i(118),r={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=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(0),s=i(26),r=i(340),o=i(2),a=i(4),h=i(8),l=i(16),u=i(1),c=i(167),d=i(178),f=new n({initialize:function(t){void 0===t&&(t={});this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.resolution=a(t,"resolution",1),this.parent=a(t,"parent",null),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!1),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.resolution=a(e,"resolution",this.resolution),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"mode",this.expandParent),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",s.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),l.RND.init(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMouseCapture=a(t,"input.mouse.capture",!0),this.inputTouch=a(t,"input.touch",r.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio"),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.autoResize=a(i,"autoResize",!0),this.antialias=a(i,"antialias",!0),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",!1),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.preserveDrawingBuffer=a(i,"preserveDrawingBuffer",!1),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",2e3),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",u),this.postBoot=a(t,"callbacks.postBoot",u),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path",""),this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),p=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?p=f.default:Array.isArray(f.defaultMerge)&&(p=p.concat(f.defaultMerge)))),this.defaultPlugins=p;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=s.WEBGL:window.FORCE_CANVAS&&(this.renderType=s.CANVAS))}});t.exports=f},function(t,e,i){var n=i(169),s=i(381),r=i(379),o=i(24),a=i(0),h=i(903),l=i(898),u=i(123),c=i(891),d=i(340),f=i(344),p=i(11),g=i(338),v=i(15),m=i(331),y=i(329),x=i(325),w=i(318),T=i(878),b=i(877),_=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new p,this.anims=new s(this),this.textures=new w(this),this.cache=new r(this),this.registry=new u(this),this.input=new g(this,this.config),this.scene=new y(this,this.config.sceneConfig),this.device=d,this.sound=x.create(this),this.loop=new T(this,this.config.fps),this.plugins=new m(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isOver=!0,f(this.boot.bind(this))},boot:function(){v.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),l(this),c(this),n(this.canvas,this.config.parent),this.events.emit("boot"),this.events.once("texturesready",this.texturesReady,this)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit("ready"),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),b(this);var t=this.events;t.on("hidden",this.onHidden,this),t.on("visible",this.onVisible,this),t.on("blur",this.onBlur,this),t.on("focus",this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit("prestep",t,e),i.emit("step",t,e),this.scene.update(t,e),i.emit("poststep",t,e);var n=this.renderer;n.preRender(),i.emit("prerender",n,t,e),this.scene.render(n),n.postRender(),i.emit("postrender",n,t,e)},headlessStep:function(t,e){var i=this.events;i.emit("prestep",t,e),i.emit("step",t,e),this.scene.update(t,e),i.emit("poststep",t,e),i.emit("prerender"),i.emit("postrender")},onHidden:function(){this.loop.pause(),this.events.emit("pause")},onVisible:function(){this.loop.resume(),this.events.emit("resume")},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},resize:function(t,e){this.config.width=t,this.config.height=e,this.renderer.resize(t,e),this.input.resize(),this.scene.resize(t,e),this.events.emit("resize",t,e)},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.events.emit("destroy"),this.events.removeAllListeners(),this.scene.destroy(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=_},function(t,e,i){var n=i(0),s=i(11),r=i(15),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){t.exports={EventEmitter:i(905)}},function(t,e){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,l=[],u=!1,c=-1;function d(){u&&h&&(u=!1,h.length?l=h.concat(l):c=-1,l.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=l.length;e;){for(h=l,l=[];++c1)for(var i=1;i>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e){t.exports=function(t,e){void 0===e&&(e="none");return["-webkit-","-khtml-","-moz-","-ms-",""].forEach(function(i){t.style[i+"user-select"]=e}),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},function(t,e,i){t.exports={CanvasInterpolation:i(348),CanvasPool:i(24),Smoothing:i(120),TouchAction:i(917),UserSelect:i(916)}},function(t,e){t.exports=function(t){return t.height*t.originY}},function(t,e){t.exports=function(t){return t.width*t.originX}},function(t,e,i){t.exports={CenterOn:i(411),GetBottom:i(48),GetCenterX:i(75),GetCenterY:i(72),GetLeft:i(46),GetOffsetX:i(920),GetOffsetY:i(919),GetRight:i(44),GetTop:i(42),SetBottom:i(47),SetCenterX:i(74),SetCenterY:i(73),SetLeft:i(45),SetRight:i(43),SetTop:i(41)}},function(t,e,i){var n=i(44),s=i(42),r=i(47),o=i(43);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(46),s=i(42),r=i(47),o=i(45);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)-a),t}},function(t,e,i){var n=i(75),s=i(42),r=i(47),o=i(74);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(44),s=i(42),r=i(45),o=i(41);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(72),s=i(44),r=i(73),o=i(45);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(48),s=i(44),r=i(47),o=i(45);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(42),r=i(43),o=i(41);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(72),s=i(46),r=i(73),o=i(43);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(48),s=i(46),r=i(47),o=i(43);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(48),s=i(44),r=i(43),o=i(41);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){var n=i(48),s=i(46),r=i(45),o=i(41);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)+a),t}},function(t,e,i){var n=i(48),s=i(75),r=i(74),o=i(41);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){t.exports={BottomCenter:i(933),BottomLeft:i(932),BottomRight:i(931),LeftBottom:i(930),LeftCenter:i(929),LeftTop:i(928),RightBottom:i(927),RightCenter:i(926),RightTop:i(925),TopCenter:i(924),TopLeft:i(923),TopRight:i(922)}},function(t,e,i){t.exports={BottomCenter:i(415),BottomLeft:i(414),BottomRight:i(413),Center:i(412),LeftCenter:i(410),QuickSet:i(416),RightCenter:i(409),TopCenter:i(408),TopLeft:i(407),TopRight:i(406)}},function(t,e,i){var n=i(193),s=i(20),r={In:i(935),To:i(934)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Align:i(936),Bounds:i(921),Canvas:i(918),Color:i(347),Masks:i(909)}},function(t,e,i){var n=i(0),s=i(123),r=i(15),o=new n({Extends:s,initialize:function(t){s.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.events=this.systems.events,this.events.once("destroy",this.destroy,this)},start:function(){this.events.once("shutdown",this.shutdown,this)},shutdown:function(){this.systems.events.off("shutdown",this.shutdown,this)},destroy:function(){s.prototype.destroy.call(this),this.events.off("start",this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",o,"data"),t.exports=o},function(t,e,i){t.exports={DataManager:i(123),DataManagerPlugin:i(938)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e){this.active=!1,this.p0=new s(t,e)},getPoint:function(t,e){return void 0===e&&(e=new s),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},function(t,e,i){var n=i(0),s=i(355),r=i(353),o=i(5),a=i(352),h=i(940),l=i(351),u=i(9),c=i(349),d=i(3),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,n),h=new d(r,o),l=new d(t,e)),this.add(new s(u,a,h,l))},quadraticBezierTo:function(t,e,i,n){var s,r,o=this.getEndPoint();return t instanceof d?(s=t,r=e):(s=new d(i,n),r=new d(t,e)),this.add(new l(o,s,r))},draw:function(t,e){for(var i=0;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;e0&&(h.preRender(r,o),t.render(n,e,i,h))}},resetAll:function(){for(var t=0;t=1?1:1/e*(1+(e*t|0))}},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){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:1-Math.cos(t*Math.PI/2)}},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--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return t*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 1- --t*t*t*t}},function(t,e){t.exports=function(t){return t*t*t*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*(2-t)}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return 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 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},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,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),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},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){return--t*t*t+1}},function(t,e){t.exports=function(t){return t*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 Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},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 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){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,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,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e,i){var n=i(23),s=i(0),r=i(3),o=i(174),a=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new r,this.current=new r,this.destination=new r,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,a){void 0===i&&(i=1e3),void 0===n&&(n=o.Linear),void 0===s&&(s=!1),void 0===r&&(r=null),void 0===a&&(a=this.camera.scene);var h=this.camera;return!s&&this.isRunning?h:(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(h.scrollX,h.scrollY),this.destination.set(t,e),h.getScroll(t,e,this.current),"string"==typeof n&&o.hasOwnProperty(n)?this.ease=o[n]:"function"==typeof n&&(this.ease=n),this._elapsed=0,this._onUpdate=r,this._onUpdateScope=a,this.camera.emit("camerapanstart",this.camera,this,i,t,e),h)},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var s=this.camera;if(this._elapsed0?(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){var n=i(0),s=i(4),r=new n({initialize:function(t){this.camera=s(t,"camera",null),this.left=s(t,"left",null),this.right=s(t,"right",null),this.up=s(t,"up",null),this.down=s(t,"down",null),this.zoomIn=s(t,"zoomIn",null),this.zoomOut=s(t,"zoomOut",null),this.zoomSpeed=s(t,"zoomSpeed",.01),this.speedX=0,this.speedY=0;var e=s(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=s(t,"speed.x",0),this.speedY=s(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoom<.1&&(e.zoom=.1)):this.zoomOut&&this.zoomOut.isDown&&(e.zoom+=this.zoomSpeed)}},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={FixedKeyControl:i(989),SmoothedKeyControl:i(988)}},function(t,e,i){t.exports={Controls:i(990),Scene2D:i(987)}},function(t,e,i){t.exports={BaseCache:i(380),CacheManager:i(379)}},function(t,e,i){t.exports={Animation:i(384),AnimationFrame:i(382),AnimationManager:i(381)}},function(t,e,i){var n=i(53);t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=0;s1)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?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,_isTinted:!1,tintFill:!1,clearTint:function(){return this.setTint(16777215),this._isTinted=!1,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._isTinted=!0,this.tintFill=!1,this},setTintFill:function(t,e,i,n){return this.setTint(t,e,i,n),this.tintFill=!0,this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t),this._isTinted=!0}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t),this._isTinted=!0}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t),this._isTinted=!0}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t),this._isTinted=!0}},tint:{set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){return this._isTinted}}};t.exports=n},function(t,e){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},function(t,e){var i={texture:null,frame:null,isCropped:!1,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),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,i){var n=i(94),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={_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(9),s=i(396),r=i(3),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,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getTopRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomLeft:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBounds:function(t){var e,i,s,r,o,a,h,l;if(void 0===t&&(t=new n),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),s=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),s=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),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){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){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},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}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},function(t,e,i){var n=i(416),s=i(193),r=i(2),o=i(1),a=new(i(125))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1);t.exports=function(t,e){void 0===e&&(e={});var i=r(e,"width",-1),o=r(e,"height",-1),h=r(e,"cellWidth",1),l=r(e,"cellHeight",h),u=r(e,"position",s.TOP_LEFT),c=r(e,"x",0),d=r(e,"y",0),f=0,p=0,g=i*h,v=o*l;a.setPosition(c,d),a.setSize(h,l);for(var m=0;m>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s0&&(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,n.RIGHT=new n(1,0),n.LEFT=new n(-1,0),n.UP=new n(0,-1),n.DOWN=new n(0,1),n.ONE=new n(1,1),t.exports=n},function(t,e){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o>>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;n=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=u},function(t,e,i){"use strict";var n=Object.prototype.hasOwnProperty,s="~";function r(){}function o(t,e,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new function(t,e,i){this.fn=t,this.context=e,this.once=i||!1}(i,n||t,r),a=s?s+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function h(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),h.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)n.call(t,e)&&i.push(s?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},h.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,r=i.length,o=new Array(r);no.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var l=[],c=e;c=400&&t.status<=599&&(n=!1),this.resetXHR(),this.loader.nextFile(this,n)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete))},onProcess:function(){this.state=s.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=s.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=s.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit(r.FILE_COMPLETE,e,i,t),this.loader.emit(r.FILE_KEY_COMPLETE+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});c.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},c.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=c},function(t,e){t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},function(t,e,i){var n,s,r,o=i(28),a=i(130),h=[],u=!1;t.exports={create2D:function(t,e,i){return n(t,e,i,o.CANVAS)},create:n=function(t,e,i,n,r){var l;void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=o.CANVAS),void 0===r&&(r=!1);var c=s(n);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:n},n===o.CANVAS&&h.push(c),l=c.canvas):(c.parent=t,l=c.canvas),r&&(c.parent=l),l.width=e,l.height=i,u&&n===o.CANVAS&&a.disable(l.getContext("2d")),l},createWebGL:function(t,e,i){return n(t,e,i,o.WEBGL)},disableSmoothing:function(){u=!0},enableSmoothing:function(){u=!1},first:s=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n={VERSION:"3.16.2",BlendModes:i(60),ScaleModes:i(101),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=n},function(t,e,i){var n=i(0),s=i(13),r=i(18),o=i(59),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Transform,s.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.initPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]}});t.exports=a},function(t,e,i){var n=i(60),s=i(12),r=i(101);t.exports=function(t,e,i){e.x=s(i,"x",0),e.y=s(i,"y",0),e.depth=s(i,"depth",0),e.flipX=s(i,"flipX",!1),e.flipY=s(i,"flipY",!1);var o=s(i,"scale",null);"number"==typeof o?e.setScale(o):null!==o&&(e.scaleX=s(o,"x",1),e.scaleY=s(o,"y",1));var a=s(i,"scrollFactor",null);"number"==typeof a?e.setScrollFactor(a):null!==a&&(e.scrollFactorX=s(a,"x",1),e.scrollFactorY=s(a,"y",1)),e.rotation=s(i,"rotation",0);var h=s(i,"angle",null);null!==h&&(e.angle=h),e.alpha=s(i,"alpha",1);var u=s(i,"origin",null);if("number"==typeof u)e.setOrigin(u);else if(null!==u){var l=s(u,"x",.5),c=s(u,"y",.5);e.setOrigin(l,c)}return e.scaleMode=s(i,"scaleMode",r.DEFAULT),e.blendMode=s(i,"blendMode",n.NORMAL),e.visible=s(i,"visible",!0),s(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},function(t,e){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e,i){var n=i(0),s=i(191),r=i(409),o=i(190),a=i(408),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=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,n)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=n,this._locked=!1,this.update(s)},setGLTo:function(t,e,i,n){return void 0===n&&(n=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=n,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,n=this.b,o=this.a;return this._color=s(e,i,n),this._color32=r(e,i,n,o),this._rgba="rgba("+e+","+i+","+n+","+o/255+")",t&&a(e,i,n,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t));return this.setTo(i,n,s)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,n=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),n=Math.max(0,Math.min(255,n-Math.round(-t/100*255))),this.setTo(e,i,n)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},function(t,e){t.exports=function(t,e,i){var n=i||e.fillColor,s=e.fillAlpha,r=(16711680&n)>>>16,o=(65280&n)>>>8,a=255&n;t.fillStyle="rgba("+r+","+o+","+a+","+s+")"}},function(t,e,i){var n=i(20);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e){t.exports=function(t,e,i,n,s,r){var o;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=s;o=0;o--)t[o][e]+=i+a*n,a++;return t}},,function(t,e,i){var n=i(109),s=i(21);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>>16,r=(65280&i)>>>8,o=255&i;t.strokeStyle="rgba("+s+","+r+","+o+","+n+")",t.lineWidth=e.lineWidth}},function(t,e,i){t.exports={DESTROY:i(1168),FADE_IN_COMPLETE:i(1167),FADE_IN_START:i(1166),FADE_OUT_COMPLETE:i(1165),FADE_OUT_START:i(1164),FLASH_COMPLETE:i(1163),FLASH_START:i(1162),PAN_COMPLETE:i(1161),PAN_START:i(1160),POST_RENDER:i(1159),PRE_RENDER:i(1158),SHAKE_COMPLETE:i(1157),SHAKE_START:i(1156),ZOOM_COMPLETE:i(1155),ZOOM_START:i(1154)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,n,s,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},scaleY:{get:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3];return n[0]=s*i+o*e,n[1]=r*i+a*e,n[2]=s*-e+o*i,n[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,s=i[0],r=i[1],o=i[2],a=i[3],h=i[4],u=i[5],l=n[0],c=n[1],d=n[2],f=n[3],p=n[4],g=n[5],v=void 0===e?this:e;return v.a=l*s+c*o,v.b=l*r+c*a,v.c=d*s+f*o,v.d=d*r+f*a,v.e=p*s+g*o+h,v.f=p*r+g*a+u,v},multiplyWithOffset:function(t,e,i){var n=this.matrix,s=t.matrix,r=n[0],o=n[1],a=n[2],h=n[3],u=e*r+i*a+n[4],l=e*o+i*h+n[5],c=s[0],d=s[1],f=s[2],p=s[3],g=s[4],v=s[5];return n[0]=c*r+d*a,n[1]=c*o+d*h,n[2]=f*r+p*a,n[3]=f*o+p*h,n[4]=g*r+v*a+u,n[5]=g*o+v*h+l,this},transform:function(t,e,i,n,s,r){var o=this.matrix,a=o[0],h=o[1],u=o[2],l=o[3],c=o[4],d=o[5];return o[0]=t*a+e*u,o[1]=t*h+e*l,o[2]=i*a+n*u,o[3]=i*h+n*l,o[4]=s*a+r*u+c,o[5]=s*h+r*l+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],u=n[5];return i.x=t*s+e*o+h,i.y=t*r+e*a+u,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=e*s-i*n;return t[0]=s/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-s*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;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],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,s,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],s=e[2],r=e[3],o=i*r-n*s;if(t.translateX=e[4],t.translateY=e[5],i||n){var a=Math.sqrt(i*i+n*n);t.rotation=n>0?Math.acos(i/a):-Math.acos(i/a),t.scaleX=a,t.scaleY=o/a}else if(s||r){var h=Math.sqrt(s*s+r*r);t.rotation=.5*Math.PI-(r>0?Math.acos(-s/h):-Math.acos(s/h)),t.scaleX=o/h,t.scaleY=h}else t.rotation=0,t.scaleX=0,t.scaleY=0;return t},applyITRS:function(t,e,i,n,s){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*n,r[1]=o*n,r[2]=-o*s,r[3]=a*s,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],u=n[4],l=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(l*a-u*h)*c,i.y=r*c*e+-o*c*t+(-l*r+u*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=r},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){t.exports=function(t,e,i){return t.radius>0&&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){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x+t.width-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y+t.height-t.height*t.originY}},function(t,e,i){t.exports={BOOT:i(994),DESTROY:i(993),DRAG_END:i(992),DRAG_ENTER:i(991),DRAG:i(990),DRAG_LEAVE:i(989),DRAG_OVER:i(988),DRAG_START:i(987),DROP:i(986),GAME_OUT:i(985),GAME_OVER:i(984),GAMEOBJECT_DOWN:i(983),GAMEOBJECT_DRAG_END:i(982),GAMEOBJECT_DRAG_ENTER:i(981),GAMEOBJECT_DRAG:i(980),GAMEOBJECT_DRAG_LEAVE:i(979),GAMEOBJECT_DRAG_OVER:i(978),GAMEOBJECT_DRAG_START:i(977),GAMEOBJECT_DROP:i(976),GAMEOBJECT_MOVE:i(975),GAMEOBJECT_OUT:i(974),GAMEOBJECT_OVER:i(973),GAMEOBJECT_POINTER_DOWN:i(972),GAMEOBJECT_POINTER_MOVE:i(971),GAMEOBJECT_POINTER_OUT:i(970),GAMEOBJECT_POINTER_OVER:i(969),GAMEOBJECT_POINTER_UP:i(968),GAMEOBJECT_UP:i(967),MANAGER_BOOT:i(966),MANAGER_PROCESS:i(965),MANAGER_UPDATE:i(964),POINTER_DOWN:i(963),POINTER_DOWN_OUTSIDE:i(962),POINTER_MOVE:i(961),POINTER_OUT:i(960),POINTER_OVER:i(959),POINTER_UP:i(958),POINTER_UP_OUTSIDE:i(957),POINTERLOCK_CHANGE:i(956),PRE_UPDATE:i(955),SHUTDOWN:i(954),START:i(953),UPDATE:i(952)}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e,i){var n=i(0),s=i(15),r=i(22),o=i(7),a=i(2),h=i(4),u=i(8),l=new n({Extends:r,initialize:function(t,e,i,n,o){var l="json";if(u(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),l=a(c,"extension",l),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:l,responseType:"text",key:e,url:i,xhrSettings:n,config:o};r.call(this,t,d),u(i)&&(this.data=o?h(i,o):i,this.state=s.FILE_POPULATED)},onProcess:function(){if(this.state!==s.FILE_POPULATED){this.state=s.FILE_PROCESSING;var t=JSON.parse(this.xhrLoader.responseText),e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;sthis.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=h},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,ERASE:17,SOURCE_IN:18,SOURCE_OUT:19,SOURCE_ATOP:20,DESTINATION_OVER:21,DESTINATION_IN:22,DESTINATION_OUT:23,DESTINATION_ATOP:24,LIGHTER:25,COPY:26,XOR:27}},function(t,e,i){var n=i(0),s=i(13),r=i(270),o=new n({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.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},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.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return 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=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.loader=t,this.type=e,this.key=i,this.files=n,this.complete=!1,this.pending=n.length,this.failed=0,this.config={};for(var s=0;s=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=u},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=t.strokeTint,a=n.getTintAppendFloatAlphaAndSwap(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,u=h.length-1,l=e.lineWidth,c=l/2,d=h[0]-s,f=h[1]-r;e.closePath||(u-=2);for(var p=2;ps||e>=i||i>s||e+i>s){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},function(t,e,i){t.exports={COMPLETE:i(932),DESTROY:i(931),DETUNE:i(930),GLOBAL_DETUNE:i(929),GLOBAL_MUTE:i(928),GLOBAL_RATE:i(927),GLOBAL_VOLUME:i(926),LOOP:i(925),LOOPED:i(924),MUTE:i(923),PAUSE_ALL:i(922),PAUSE:i(921),PLAY:i(920),RATE:i(919),RESUME_ALL:i(918),RESUME:i(917),SEEK:i(916),STOP_ALL:i(915),STOP:i(914),UNLOCKED:i(913),VOLUME:i(912)}},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,i){"use strict";function n(t,e,i){i=i||2;var n,a,h,u,l,f,g,v=e&&e.length,m=v?e[0]*i:t.length,y=s(t,0,m,i,!0),x=[];if(!y||y.next===y.prev)return x;if(v&&(y=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 T=i;Th&&(h=l),f>u&&(u=f);g=0!==(g=Math.max(h-n,u-a))?1/g:0}return o(y,x,i,n,a,g),x}function s(t,e,i,n,s){var r,o;if(s===E(t,e,i,n)>0)for(r=e;r=e;r-=n)o=_(r,t[r],t[r+1],o);return o&&y(o,o.next)&&(b(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!==m(n.prev,n,n.next))n=n.next;else{if(b(n),(n=e=n.prev)===n.next)break;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),b(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(m(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)&&m(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(m(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.prevZ,v=t.nextZ;p&&p.z>=c&&v&&v.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)&&m(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,v!==t.prev&&v!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&m(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;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)&&m(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;v&&v.z<=d;){if(v!==t.prev&&v!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&m(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function u(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!y(s,r)&&x(s,n,n.next,r)&&T(s,r)&&T(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),b(n),b(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=w(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)&&T(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)&&T(t,e)&&T(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 m(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 x(t,e,i,n){return!!(y(t,e)&&y(i,n)||y(t,n)&&y(i,e))||m(t,e,i)>0!=m(t,e,n)>0&&m(i,n,t)>0!=m(i,n,e)>0}function T(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(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,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 b(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 E(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){t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},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,m=(u*f-l*c)*g;return v>=0&&m>=0&&v+m<1}},function(t,e,i){t.exports={ADD:i(945),COMPLETE:i(944),FILE_COMPLETE:i(943),FILE_KEY_COMPLETE:i(942),FILE_LOAD_ERROR:i(941),FILE_LOAD:i(940),FILE_PROGRESS:i(939),POST_PROCESS:i(938),PROGRESS:i(937),START:i(936)}},function(t,e,i){var n=i(0),s=i(180),r=i(10),o=i(3),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){var n=i(0),s=i(43),r=i(438),o=i(437),a=i(206),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){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},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,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},,function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","map"),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.widthInPixels=s(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.tileHeight),this.format=s(t,"format",null),this.orientation=s(t,"orientation","orthogonal"),this.renderOrder=s(t,"renderOrder","right-down"),this.version=s(t,"version","1"),this.properties=s(t,"properties",{}),this.layers=s(t,"layers",[]),this.images=s(t,"images",[]),this.objects=s(t,"objects",{}),this.collision=s(t,"collision",{}),this.tilesets=s(t,"tilesets",[]),this.imageCollections=s(t,"imageCollections",[]),this.tiles=s(t,"tiles",[])}});t.exports=r},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","layer"),this.x=s(t,"x",0),this.y=s(t,"y",0),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.baseTileWidth=s(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=s(t,"baseTileHeight",this.tileHeight),this.widthInPixels=s(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=s(t,"alpha",1),this.visible=s(t,"visible",!0),this.properties=s(t,"properties",{}),this.indexes=s(t,"indexes",[]),this.collideIndexes=s(t,"collideIndexes",[]),this.callbacks=s(t,"callbacks",[]),this.bodies=s(t,"bodies",[]),this.data=s(t,"data",[]),this.tilemapLayer=s(t,"tilemapLayer",null)}});t.exports=r},function(t,e){t.exports=function(t,e,i){return t>=0&&t=0&&e=0;l--)if((u=d[l]).active===i){if(++c===e)break}else u=null;return u?("number"==typeof s&&(u.x=s),"number"==typeof r&&(u.y=r),u):n?this.create(s,r,o,a,h):null},get:function(t,e,i,n,s){return this.getFirst(!1,!0,t,e,i,n,s)},getFirstAlive:function(t,e,i,n,s,r){return this.getFirst(!0,t,e,i,n,s,r)},getFirstDead:function(t,e,i,n,s,r){return this.getFirst(!1,t,e,i,n,s,r)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=t.length)){for(var i=t.length-1,n=t[e],s=e;s-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 t=this.firstgid&&t=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e,i){var n=i(0),s=i(13),r=i(18),o=i(753),a=i(1),h=new n({Extends:r,Mixins:[s.BlendMode,s.Depth,s.GetBounds,s.Mask,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"),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.lengthu&&(r=u),o>u&&(o=u),a=s,h=r;;)if(a-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){for(var i=[null],n=2;n0?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=a},function(t,e,i){var n=i(0),s=i(23),r=i(19),o=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.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(r,o,n,s)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var s=this.data,r=s.cut;r.x=i,r.y=n,r.w=t,r.h=e,r.r=i+t,r.b=n+e,s.sourceSize.w=t,s.sourceSize.h=e,s.spriteSourceSize.w=t,s.spriteSourceSize.h=e,s.radius=.5*Math.sqrt(t*t+e*e);var o=s.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,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,a.r=i+s,a.b=n+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()},setCropUVs:function(t,e,i,n,r,o,a){var h=this.cutX,u=this.cutY,l=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=s(e,0,d)),g=u+(i=s(i,0,f)),v=n=s(n,0,d-e),m=r=s(r,0,f-i),y=this.data;if(y.trim){var x=y.spriteSourceSize,T=e+(n=s(n,0,l-e)),w=i+(r=s(r,0,c-i));if(!(x.rT||x.y>w)){var _=Math.max(x.x,e),b=Math.max(x.y,i),A=Math.min(x.r,T)-_,E=Math.min(x.b,w)-b;v=A,m=E,p=o?h+(l-(_-x.x)-A):h+(_-x.x),g=a?u+(c-(b-x.y)-E):u+(b-x.y),e=_,i=b,n=A,r=E}else p=0,g=0,v=0,m=0}else o&&(p=h+(l-e-n)),a&&(g=u+(c-i-r));var S=this.source.width,C=this.source.height;return t.u0=Math.max(0,p/S),t.v0=Math.max(0,g/C),t.u1=Math.min(1,(p+v)/S),t.v1=Math.min(1,(g+m)/C),t.x=e,t.y=i,t.cx=p,t.cy=g,t.cw=v,t.ch=m,t.width=n,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(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=r(!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}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(0),s=i(11),r=i(69),o=i(19),a=i(1),h=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={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},this.currentConfig=this.config,this.config=o(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 "+t.name+" already exists in Sound"),!1):(t=o(!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]=o(!0,this.markers[t.name],t),!0):(console.warn("Audio Marker: "+t.name+" missing in 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!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in 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=o(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:a,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit(r.DESTROY,this),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)}});t.exports=h},function(t,e,i){var n=i(0),s=i(70),r=i(11),o=i(69),a=i(26),h=i(1),u=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on(a.BLUR,function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on(a.FOCUS,function(){this.pauseOnBlur&&this.onFocus()},this),t.events.on(a.PRE_STEP,this.update,this),t.events.once(a.DESTROY,this.destroy,this)},add:h,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var r=s(e),o=i.spritemap[n];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:r})}return i},play:function(t,e){var i=this.add(t);return i.once(o.COMPLETE,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(o.COMPLETE,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(o.PAUSE_ALL,this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit(o.RESUME_ALL,this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit(o.STOP_ALL,this)},unlock:h,onBlur:h,onFocus:h,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit(o.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)})},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit(o.GLOBAL_RATE,this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit(o.GLOBAL_DETUNE,this,t)}}});t.exports=u},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){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,NUMPAD_ZERO:96,NUMPAD_ONE:97,NUMPAD_TWO:98,NUMPAD_THREE:99,NUMPAD_FOUR:100,NUMPAD_FIVE:101,NUMPAD_SIX:102,NUMPAD_SEVEN:103,NUMPAD_EIGHT:104,NUMPAD_NINE:105,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,SEMICOLON_FIREFOX:59,COLON:58,COMMA_FIREFOX_WINDOWS:60,COMMA_FIREFOX:62,BRACKET_RIGHT_FIREFOX:174,BRACKET_LEFT_FIREFOX:175}},function(t,e,i){t.exports={ADD:i(1049),ERROR:i(1048),LOAD:i(1047),READY:i(1046),REMOVE:i(1045)}},function(t,e){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n,s=i(99),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=function(t,e,i){return(e-t)*i+t}},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;iC&&wE&&_s&&(t=s),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,s=Math.max(n,n+e.height-i);return ts&&(t=s),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=l(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,s){return void 0===s&&(s=!1),this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,s?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(t){void 0===t&&(t=new h);var e=this._bounds;return t.setTo(e.x,e.y,e.width,e.height),t},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){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.sceneManager=t.sys.game.scene,this.scaleManager=t.sys.scale;var e=this.scaleManager.resolution;return this.resolution=e,this._cx=this._x*e,this._cy=this._y*e,this._cw=this._width*e,this._ch=this._height*e,this.updateSystem(),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),0===t&&(t=.001),this.zoom=t,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},update:function(){},updateSystem:function(){if(this.scaleManager){var t=0!==this._x||0!==this._y||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit(a.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this._cx=t*this.resolution,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._cy=t*this.resolution,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this._cw=t*this.resolution,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this._ch=t*this.resolution,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoom}},displayHeight:{get:function(){return this.height/this.zoom}}});t.exports=d},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;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){t.exports={DESTROY:i(1234)}},function(t,e,i){var n=i(0),s=i(420),r=new n({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once("destroy",this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;n0&&(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)return this;this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;return 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)),this.parent.makeActive(this)),this},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.play(),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}return this},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}return this},stop:function(t){return this.state===o.ACTIVE&&void 0!==t&&this.seek(t),this.state!==o.REMOVED&&(this.state!==o.PAUSED&&this.state!==o.PENDING_ADD||(this.parent._destroy.push(this),this.parent._toProcess++),this.state=o.PENDING_REMOVE),this},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={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1}},function(t,e){function i(t){return!!t.getStart&&"function"==typeof t.getStart}function n(t){return!!t.getEnd&&"function"==typeof t.getEnd}var s=function(t,e){var r,o,a=function(t,e,i){return i},h=function(t,e,i){return i},u=typeof e;if("number"===u)a=function(){return e};else if("string"===u){var l=e[0],c=parseFloat(e.substr(2));switch(l){case"+":a=function(t,e,i){return i+c};break;case"-":a=function(t,e,i){return i-c};break;case"*":a=function(t,e,i){return i*c};break;case"/":a=function(t,e,i){return i/c};break;default:a=function(){return parseFloat(e)}}}else"function"===u?a=e:"object"===u&&(i(o=e)||n(o))?(n(e)&&(a=e.getEnd),i(e)&&(h=e.getStart)):e.hasOwnProperty("value")&&(r=s(t,e.value));return r||(r={getEnd:a,getStart:h}),r};t.exports=s},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"targets",null);return null===e?e:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(31),s=i(83),r=i(233),o=i(225);t.exports=function(t,e,i,a,h,u,l,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===u&&(u=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(l))d=r(void 0!==e?e:"map",n.ARRAY_2D,l,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new s({tileWidth:i,tileHeight:a,width:h,height:u})),new o(t,d)}},function(t,e,i){var n=i(31),s=i(84),r=i(83),o=i(61);t.exports=function(t,e,i,a,h){for(var u=new s({tileWidth:i,tileHeight:a}),l=new r({name:t,tileWidth:i,tileHeight:a,format:n.ARRAY_2D,layers:[u]}),c=[],d=e.length,f=0,p=0;p=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){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(0),s=i(116),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()},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,t=this.frame,this.uv[0]=t.u0,this.uv[1]=t.v0,this.uv[2]=t.u0,this.uv[3]=t.v1,this.uv[4]=t.u1,this.uv[5]=t.v1,this.uv[6]=t.u0,this.uv[7]=t.v0,this.uv[8]=t.u1,this.uv[9]=t.v1,this.uv[10]=t.u1,this.uv[11]=t.v0,this},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){for(var n=!1,s=-1,r=t.points.length-1;++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 m=l[c].length?c:c+1,y=l.slice(m).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=y+" "+(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],h0&&(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(h[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(h[p],o,a));return e.restore(),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),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&&c(this.canvas),s.remove(this.canvas),this.texture.destroy()}});t.exports=p},function(t,e,i){var n=i(60),s=i(131),r=i(24),o=i(0),a=i(13),h=i(28),u=i(121),l=i(18),c=i(840),d=i(9),f=i(299),p=new o({Extends:l,Mixins:[a.Alpha,a.BlendMode,a.ComputedSize,a.Crop,a.Depth,a.Flip,a.GetBounds,a.Mask,a.Origin,a.Pipeline,a.ScaleMode,a.ScrollFactor,a.Tint,a.Transform,a.Visible,c],initialize:function(t,e,i,n,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=32),void 0===o&&(o=32),l.call(this,t,"RenderTexture"),this.renderer=t.sys.game.renderer,this.textureManager=t.sys.textures,this.globalTint=16777215,this.globalAlpha=1,this.canvas=r.create2D(this,n,o),this.context=this.canvas.getContext("2d"),this.framebuffer=null,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(f(),this.canvas),this.frame=this.texture.get(),this._saved=!1,this._eraseMode=!1,this.camera=new s(0,0,n,o),this.dirty=!1,this.gl=null;var a=this.renderer;if(a.type===h.WEBGL){var u=a.gl;this.gl=u,this.drawGameObject=this.batchGameObjectWebGL,this.framebuffer=a.createFramebuffer(n,o,this.frame.source.glTexture,!1)}else a.type===h.CANVAS&&(this.drawGameObject=this.batchGameObjectCanvas);this.camera.setScene(t),this.setPosition(e,i),this.setSize(n,o),this.setOrigin(0,0),this.initPipeline()},setSize:function(t,e){return this.resize(t,e)},resize:function(t,e){if(void 0===e&&(e=t),t!==this.width||e!==this.height){if(this.canvas.width=t,this.canvas.height=e,this.gl){var i=this.gl;this.renderer.deleteTexture(this.frame.source.glTexture),this.renderer.deleteFramebuffer(this.framebuffer),this.frame.source.glTexture=this.renderer.createTexture2D(0,i.NEAREST,i.NEAREST,i.CLAMP_TO_EDGE,i.CLAMP_TO_EDGE,i.RGBA,null,t,e,!1),this.framebuffer=this.renderer.createFramebuffer(t,e,this.frame.source.glTexture,!1),this.frame.glTexture=this.frame.source.glTexture}this.frame.source.width=t,this.frame.source.height=e,this.camera.setSize(t,e),this.frame.setSize(t,e),this.width=t,this.height=e}return this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e){void 0===e&&(e=1);var i=255&(t>>16|0),n=255&(t>>8|0),s=255&(0|t);if(this.gl){var r=this.renderer,o=this.getBounds();r.setFramebuffer(this.framebuffer,!0),this.pipeline.drawFillRect(o.x,o.y,o.right,o.bottom,d.getTintFromFloats(i/255,n/255,s/255,1),e),r.setFramebuffer(null,!0)}else this.context.fillStyle="rgba("+i+","+n+","+s+","+e+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height);return this},clear:function(){if(this.dirty){var t=this.gl;if(t){var e=this.renderer;e.setFramebuffer(this.framebuffer,!0),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),e.setFramebuffer(null,!0)}else{var i=this.context;i.save(),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.restore()}this.dirty=!1}return this},erase:function(t,e,i){this._eraseMode=!0;var s=this.renderer.currentBlendMode;return this.renderer.setBlendMode(n.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(s),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.gl;if(this.camera.preRender(1,1),r){var o=this.camera._cx,a=this.camera._cy,h=this.camera._cw,u=this.camera._ch;this.renderer.setFramebuffer(this.framebuffer,!1),this.renderer.pushScissor(o,a,h,u,u);var l=this.pipeline;l.projOrtho(0,this.width,0,this.height,-1e3,1e3),this.batchList(t,e,i,n,s),l.flush(),this.renderer.setFramebuffer(null,!1),this.renderer.popScissor(),l.projOrtho(0,l.width,l.height,0,-1e3,1e3)}else this.renderer.setContext(this.context),this.batchList(t,e,i,n,s),this.renderer.setContext();return this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.gl,a=this.textureManager.getFrame(t,e);if(a){if(this.camera.preRender(1,1),o){var h=this.camera._cx,u=this.camera._cy,l=this.camera._cw,c=this.camera._ch;this.renderer.setFramebuffer(this.framebuffer,!1),this.renderer.pushScissor(h,u,l,c,c);var d=this.pipeline;d.projOrtho(0,this.width,0,this.height,-1e3,1e3),d.batchTextureFrame(a,i,n,r,s,this.camera.matrix,null),d.flush(),this.renderer.setFramebuffer(null,!1),this.renderer.popScissor(),d.projOrtho(0,d.width,d.height,0,-1e3,1e3)}else this.batchTextureFrame(a,i,n,s,r);this.dirty=!0}return this},batchList:function(t,e,i,n,s){for(var r=0;r0?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;s-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,o=r.game.renderer;if(void 0===e&&(e=r.scale.width),void 0===i&&(i=r.scale.height),T.TargetCamera.setScene(this.scene),T.TargetCamera.setViewport(0,0,e,i),T.TargetCamera.scrollX=this.x,T.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var a=(n=r.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(s=a.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(o,this,0,T.TargetCamera,null,s,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});T.TargetCamera=new n,t.exports=T},function(t,e,i){var n=i(117),s=i(0),r=i(860),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a){n.call(this,t,e,i,s,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={parent:this,color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(174),s=i(60),r=i(0),o=i(13),a=i(133),h=i(18),u=i(10),l=i(863),c=i(313),d=i(3),f=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.ScrollFactor,o.Transform,o.Visible,l],initialize:function(t,e,i,n){h.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._displayList=t.sys.displayList,this._sortKey="",this._sysEvents=t.sys.events,this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new u),t.setTo(this.x,this.y,0,0),this.list.length>0)for(var e=this.list,i=new u,n=0;n-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){var i,n=[null],s=this.list.slice(),r=s.length;for(i=2;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}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[],this._displayList=null}});t.exports=f},function(t,e,i){var n=i(867),s=i(864),r=i(0),o=i(13),a=i(121),h=i(18),u=i(120),l=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,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(),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},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=l},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]}},function(t,e){t.exports=function(t){if(!Array.isArray(t)||t.length<2||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){t&&(this.settings.data=t),this.settings.status=s.START,this.settings.active=!0,this.settings.visible=!0,this.events.emit(o.START,this),this.events.emit(o.READY,this,t)},shutdown:function(t){this.events.off(o.TRANSITION_INIT),this.events.off(o.TRANSITION_START),this.events.off(o.TRANSITION_COMPLETE),this.events.off(o.TRANSITION_OUT),this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit(o.SHUTDOWN,this,t)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit(o.DESTROY,this),this.events.removeAllListeners();for(var t=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],e=0;e=0;){var a=e[o];-1!==(r=t.indexOf(a))?(n(t,r),i&&i.call(s,a)):e.pop(),o--}return e}},function(t,e,i){var n={CENTER:i(349),ORIENTATION:i(348),SCALE_MODE:i(347),ZOOM:i(346)};t.exports=n},function(t,e){t.exports=function(t,e){var i;if(e)"string"==typeof e?i=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(i=e);else if(t.parentElement)return t;return i||(i=document.body),i.appendChild(t),t}},function(t,e,i){var n=i(10);t.exports=function(t,e){if(void 0===e&&(e=new n),0===t.length)return e;for(var i,s,r,o=Number.MAX_VALUE,a=Number.MAX_VALUE,h=Number.MIN_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,l=0;l0&&(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],m=s[12],y=s[13],x=s[14],T=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*u+n*f+m)*T,this.y=(e*o+i*l+n*p+y)*T,this.z=(e*a+i*c+n*g+x)*T,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}});n.ZERO=new n,n.RIGHT=new n(1,0,0),n.LEFT=new n(-1,0,0),n.UP=new n(0,-1,0),n.DOWN=new n(0,1,0),n.FORWARD=new n(0,0,1),n.BACK=new n(0,0,-1),n.ONE=new n(1,1,1),t.exports=n},function(t,e,i){var n=i(20);t.exports=function(t){return t*n.RAD_TO_DEG}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e){t.exports=function(t,e,i,n,s){var r=.5*(n-e),o=.5*(s-i),a=t*t;return(2*i-2*n+r+o)*(t*a)+(-3*i+3*n-2*r-o)*a+r*t+i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)=(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=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},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=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x2-t.x1,s=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=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,i){var n=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random()*Math.PI*2,s=Math.sqrt(Math.random());return e.x=t.x+s*Math.cos(i)*t.width/2,e.y=t.y+s*Math.sin(i)*t.height/2,e}},function(t,e){var i={defaultPipeline:null,pipeline:null,initPipeline:function(t){void 0===t&&(t="TextureTintPipeline");var e=this.scene.sys.game.renderer;return!!(e&&e.gl&&e.hasPipeline(t))&&(this.defaultPipeline=e.getPipeline(t),this.pipeline=this.defaultPipeline,!0)},setPipeline:function(t){var e=this.scene.sys.game.renderer;return e&&e.gl&&e.hasPipeline(t)&&(this.pipeline=e.getPipeline(t)),this},resetPipeline:function(){return this.pipeline=this.defaultPipeline,null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=i},function(t,e,i){var n=i(6);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(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},function(t,e,i){var n=i(58),s=i(6);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)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(23),s=i(0),r=i(11),o=i(136),a=i(434),h=i(433),u=i(4),l=new s({Extends:r,initialize:function(t,e,i){r.call(this),this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,u(i,"frames",[]),u(i,"defaultTextureKey",null)),this.frameRate=u(i,"frameRate",null),this.duration=u(i,"duration",null),null===this.duration&&null===this.frameRate?(this.frameRate=24,this.duration=this.frameRate/this.frames.length*1e3):this.duration&&null===this.frameRate?this.frameRate=this.frames.length/(this.duration/1e3):this.duration=this.frames.length/this.frameRate*1e3,this.msPerFrame=1e3/this.frameRate,this.skipMissedFrames=u(i,"skipMissedFrames",!0),this.delay=u(i,"delay",0),this.repeat=u(i,"repeat",0),this.repeatDelay=u(i,"repeatDelay",0),this.yoyo=u(i,"yoyo",!1),this.showOnStart=u(i,"showOnStart",!1),this.hideOnComplete=u(i,"hideOnComplete",!1),this.paused=!1,this.manager.on(o.PAUSE_ALL,this.pause,this),this.manager.on(o.RESUME_ALL,this.resume,this)},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){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 t>=0&&t0){s.isLast=!0,s.nextFrame=a[0],a[0].prevFrame=s;var v=1/(a.length-1);for(r=0;r=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,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);var i=this.frames[e];0!==e||t.forward||(i=this.getLastFrame()),t.updateFrame(i)},getFrameByProgress:function(t){return t=n(t,0,1),a(t,this.frames,"progress")},nextFrame:function(t){var e=t.currentFrame;e.isLast?t._yoyo?this.handleYoyoFrame(t,!1):t.repeatCounter>0?t._reverse&&t.forward?t.forward=!1:this.repeatAnimation(t):this.completeAnimation(t):this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t._reverse===!e&&t.repeatCounter>0)return t.forward=e,void this.repeatAnimation(t);if(t._reverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else this.completeAnimation(t)},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t._yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?t._reverse&&!t.forward?(t.currentFrame=this.getLastFrame(),this.repeatAnimation(t)):(t.forward=!0,this.repeatAnimation(t)):this.completeAnimation(t):this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.updateFrame(e),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){if(2===t._pendingStop)return this.completeAnimation(t);if(t._repeatDelay>0&&!1===t.pendingRepeat)t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t._repeatDelay;else if(t.repeatCounter--,t.updateFrame(t.currentFrame[t.forward?"nextFrame":"prevFrame"]),t.isPlaying){this.getNextTick(t),t.pendingRepeat=!1;var e=t.currentFrame,i=t.parent;this.emit(o.ANIMATION_REPEAT,this,e),i.emit(o.SPRITE_ANIMATION_KEY_REPEAT+this.key,this,e,t.repeatCounter,i),i.emit(o.SPRITE_ANIMATION_REPEAT,this,e,t.repeatCounter,i)}},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(){this.removeAllListeners(),this.manager.off(o.PAUSE_ALL,this.pause,this),this.manager.off(o.RESUME_ALL,this.resume,this),this.manager.remove(this.key);for(var t=0;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(6);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){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(0),s=i(71),r=i(2),o=i(1041),a=i(1040),h=i(1039),u=i(41),l=i(9),c=i(212),d=new n({Extends:c,Mixins:[o],initialize:function(t){var e=t.renderer.config;c.call(this,{game:t.game,renderer:t.renderer,gl:t.renderer.gl,topology:r(t,"topology",t.renderer.gl.TRIANGLES),vertShader:r(t,"vertShader",h),fragShader:r(t,"fragShader",a),vertexCapacity:r(t,"vertexCapacity",6*e.batchSize),vertexSize:r(t,"vertexSize",5*Float32Array.BYTES_PER_ELEMENT+4*Uint8Array.BYTES_PER_ELEMENT),attributes:[{name:"inPosition",size:2,type:t.renderer.gl.FLOAT,normalized:!1,offset:0},{name:"inTexCoord",size:2,type:t.renderer.gl.FLOAT,normalized:!1,offset:2*Float32Array.BYTES_PER_ELEMENT},{name:"inTintEffect",size:1,type:t.renderer.gl.FLOAT,normalized:!1,offset:4*Float32Array.BYTES_PER_ELEMENT},{name:"inTint",size:4,type:t.renderer.gl.UNSIGNED_BYTE,normalized:!0,offset:5*Float32Array.BYTES_PER_ELEMENT}]}),this.vertexViewF32=new Float32Array(this.vertexData),this.vertexViewU32=new Uint32Array(this.vertexData),this.maxQuads=e.batchSize,this.batches=[],this._tempMatrix1=new u,this._tempMatrix2=new u,this._tempMatrix3=new u,this._tempMatrix4=new u,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.tintEffect=2,this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[],this.mvpInit()},onBind:function(){return c.prototype.onBind.call(this),this.mvpUpdate(),this},resize:function(t,e,i){return c.prototype.resize.call(this,t,e,i),this.projOrtho(0,this.width,this.height,0,-1e3,1e3),this},setTexture2D:function(t,e){return void 0===t&&(t=this.renderer.blankTexture.glTexture),void 0===e&&(e=0),this.requireTextureBatch(t,e)&&this.pushBatch(t,e),this},requireTextureBatch:function(t,e){var i=this.batches,n=i.length;return!(n>0)||!((e>0?i[n-1].textures[e-1]:i[n-1].texture)===t)},pushBatch:function(t,e){if(0===e)this.batches.push({first:this.vertexCount,texture:t,textures:[]});else{var i=[];i[e-1]=t,this.batches.push({first:this.vertexCount,texture:null,textures:i})}},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.vertexCount,r=this.topology,o=this.vertexSize,a=this.renderer,h=this.batches,u=h.length,l=0,c=null;if(0===u||0===s)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,s*o));for(var d=0;d0){for(e=0;e0){for(e=0;e0&&(a.setTexture2D(c.texture,0,!1),n.drawArrays(r,c.first,l)),this.vertexCount=0,h.length=0,this.flushLocked=!1,this},batchSprite:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix1,s=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,u=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,g=o.cutWidth,v=o.cutHeight,m=-t.displayOriginX+f,y=-t.displayOriginY+p;if(t.isCropped){var x=t._crop;x.flipX===t.flipX&&x.flipY===t.flipY||o.updateCropUVs(x,t.flipX,t.flipY),h=x.u0,u=x.v0,c=x.u1,d=x.v1,g=x.width,v=x.height,f=x.x,p=x.y,m=-t.displayOriginX+f,y=-t.displayOriginY+p}t.flipX&&(m+=g,g*=-1),t.flipY&&(y+=v,v*=-1);var T=m+g,w=y+v;s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y,n.multiply(s,r)):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY,n.multiply(s,r));var _=r.getX(m,y),b=r.getY(m,y),A=r.getX(m,w),E=r.getY(m,w),S=r.getX(T,w),C=r.getY(T,w),M=r.getX(T,y),O=r.getY(T,y),P=l.getTintAppendFloatAlpha(t._tintTL,e.alpha*t._alphaTL),R=l.getTintAppendFloatAlpha(t._tintTR,e.alpha*t._alphaTR),L=l.getTintAppendFloatAlpha(t._tintBL,e.alpha*t._alphaBL),F=l.getTintAppendFloatAlpha(t._tintBR,e.alpha*t._alphaBR);e.roundPixels&&(_=Math.round(_),b=Math.round(b),A=Math.round(A),E=Math.round(E),S=Math.round(S),C=Math.round(C),M=Math.round(M),O=Math.round(O)),this.setTexture2D(a,0);var D=t._isTinted&&t.tintFill;this.batchQuad(_,b,A,E,S,C,M,O,h,u,c,d,P,R,L,F,D,a,0)},batchQuad:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,m,y){var x=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),x=!0,this.setTexture2D(m,y));var T=this.vertexViewF32,w=this.vertexViewU32,_=this.vertexCount*this.vertexComponentCount-1;return T[++_]=t,T[++_]=e,T[++_]=h,T[++_]=u,T[++_]=v,w[++_]=d,T[++_]=i,T[++_]=n,T[++_]=h,T[++_]=c,T[++_]=v,w[++_]=p,T[++_]=s,T[++_]=r,T[++_]=l,T[++_]=c,T[++_]=v,w[++_]=g,T[++_]=t,T[++_]=e,T[++_]=h,T[++_]=u,T[++_]=v,w[++_]=d,T[++_]=s,T[++_]=r,T[++_]=l,T[++_]=c,T[++_]=v,w[++_]=g,T[++_]=o,T[++_]=a,T[++_]=l,T[++_]=u,T[++_]=v,w[++_]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g){var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),this.setTexture2D(p,g),v=!0);var m=this.vertexViewF32,y=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return m[++x]=t,m[++x]=e,m[++x]=o,m[++x]=a,m[++x]=f,y[++x]=l,m[++x]=i,m[++x]=n,m[++x]=o,m[++x]=u,m[++x]=f,y[++x]=c,m[++x]=s,m[++x]=r,m[++x]=h,m[++x]=u,m[++x]=f,y[++x]=d,this.vertexCount+=3,v},batchTexture:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,m,y,x,T,w,_,b,A,E,S,C,M,O,P){this.renderer.setPipeline(this,t);var R=this._tempMatrix1,L=this._tempMatrix2,F=this._tempMatrix3,D=m/i+S,k=y/n+C,I=(m+x)/i+S,B=(y+T)/n+C,Y=o,N=a,X=-g,z=-v;if(t.isCropped){var U=t._crop;Y=U.width,N=U.height,o=U.width,a=U.height;var G=m=U.x,W=y=U.y;c&&(G=x-U.x-U.width),d&&!e.isRenderTexture&&(W=T-U.y-U.height),D=G/i+S,k=W/n+C,I=(G+U.width)/i+S,B=(W+U.height)/n+C,X=-g+m,z=-v+y}d^=!P&&e.isRenderTexture?1:0,c&&(Y*=-1,X+=o),d&&(N*=-1,z+=a);var V=X+Y,H=z+N;L.applyITRS(s,r,l,h,u),R.copyFrom(M.matrix),O?(R.multiplyWithOffset(O,-M.scrollX*f,-M.scrollY*p),L.e=s,L.f=r,R.multiply(L,F)):(L.e-=M.scrollX*f,L.f-=M.scrollY*p,R.multiply(L,F));var j=F.getX(X,z),q=F.getY(X,z),K=F.getX(X,H),J=F.getY(X,H),Z=F.getX(V,H),Q=F.getY(V,H),$=F.getX(V,z),tt=F.getY(V,z);M.roundPixels&&(j=Math.round(j),q=Math.round(q),K=Math.round(K),J=Math.round(J),Z=Math.round(Z),Q=Math.round(Q),$=Math.round($),tt=Math.round(tt)),this.setTexture2D(e,0),this.batchQuad(j,q,K,J,Z,Q,$,tt,D,k,I,B,w,_,b,A,E,e,0)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.setPipeline(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,u=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),f=h.getY(e,i),p=h.getX(e,c),g=h.getY(e,c),v=h.getX(u,c),m=h.getY(u,c),y=h.getX(u,i),x=h.getY(u,i);this.setTexture2D(t.glTexture,0),n=l.getTintAppendFloatAlpha(n,s),this.batchQuad(d,f,p,g,v,m,y,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,0)},drawFillRect:function(t,e,i,n,s,r){var o=t+i,a=e+n;this.setTexture2D();var h=l.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,h,h,h,h,2)},batchFillRect:function(t,e,i,n,s,r){this.renderer.setPipeline(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,u=o.getX(t,e),l=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),m=this.currentFrame,y=m.u0,x=m.v0,T=m.u1,w=m.v1;this.batchQuad(u,l,c,d,f,p,g,v,y,x,T,w,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.fillTint.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var u=h.getX(t,e),l=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,m=g.v0,y=g.u1,x=g.v1;this.batchTri(u,l,c,d,f,p,v,m,y,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var u=this.tempTriangle;u[0].x=t,u[0].y=e,u[0].width=o,u[1].x=i,u[1].y=n,u[1].width=o,u[2].x=s,u[2].y=r,u[2].width=o,u[3].x=t,u[3].y=e,u[3].width=o,this.batchStrokePath(u,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var r,o,a=t.length,h=this.polygonCache,u=this.fillTint.TL,l=this.fillTint.TR,c=this.fillTint.BL,d=this.tintEffect,f=0;f0&&H[4]?this.batchQuad(F,D,O,P,H[0],H[1],H[2],H[3],U,G,W,V,B,Y,N,X,I):(j[0]=F,j[1]=D,j[2]=O,j[3]=P,j[4]=1),h&&j[4]?this.batchQuad(C,M,R,L,j[0],j[1],j[2],j[3],U,G,W,V,B,Y,N,X,I):(H[0]=C,H[1]=M,H[2]=R,H[3]=L,H[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),s=i(9),r=new n({initialize:function(t){this.name="WebGLPipeline",this.game=t.game,this.view=t.game.canvas,this.resolution=1,this.width=0,this.height=0,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,this.active=!1},boot:function(){},addAttribute:function(t,e,i,n,s){return this.attributes.push({name:t,size:e,type:this.renderer.glFormats[i],normalized:n,offset:s}),this},shouldFlush:function(){return this.vertexCount>=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this.resolution=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},setFloat1v:function(t,e){return this.renderer.setFloat1v(this.program,t,e),this},setFloat2v:function(t,e){return this.renderer.setFloat2v(this.program,t,e),this},setFloat3v:function(t,e){return this.renderer.setFloat3v(this.program,t,e),this},setFloat4v:function(t,e){return this.renderer.setFloat4v(this.program,t,e),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(57);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n=i(57);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},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,i){t.exports={TIMELINE_COMPLETE:i(475),TIMELINE_LOOP:i(474),TIMELINE_PAUSE:i(473),TIMELINE_RESUME:i(472),TIMELINE_START:i(471),TIMELINE_UPDATE:i(470)}},function(t,e,i){var n=i(0),s=i(11),r=i(216),o=i(104),a=i(89),h=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.isTimeline=!0,this.data=[],this.totalData=0,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=a.PENDING_ADD,this._pausedState=a.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===a.ACTIVE},add:function(t){return this.queue(o(this,t))},queue:function(t){return this.isPlaying()||(t.parent=this,t.parentIsTimeline=!0,this.data.push(t),this.totalData=this.data.length),this},hasOffset:function(t){return null!==t.offset},isOffsetAbsolute:function(t){return"number"==typeof t},isOffsetRelative:function(t){if("string"===typeof t){var e=t[0];if("-"===e||"+"===e)return!0}return!1},getRelativeOffset:function(t,e){var i=t[0],n=parseFloat(t.substr(2)),s=e;switch(i){case"+":s+=n;break;case"-":s-=n}return Math.max(0,s)},calcDuration:function(){for(var t=0,e=0,i=0,n=0;n0?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=a.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(r.TIMELINE_LOOP,this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=a.LOOP_DELAY):this.state=a.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=a.COMPLETE_DELAY;else{this.state=a.PENDING_REMOVE;var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit(r.TIMELINE_COMPLETE,this)}},update:function(t,e){if(this.state!==a.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 a.ACTIVE:for(var n=this.totalData,s=0;s0?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 m=0;m0){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(0),s=i(13),r=i(28),o=i(18),a=i(485),h=i(110),u=i(41),l=i(9),c=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,a){o.call(this,t,"StaticTilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.culledTiles=[],this.skipCull=!1,this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=h.CullTiles,this.renderer=t.sys.game.renderer,this.vertexBuffer=[],this.bufferData=[],this.vertexViewF32=[],this.vertexViewU32=[],this.dirty=[],this.vertexCount=[],this._renderOrder=0,this._tempMatrix=new u,this.gidMap=[],this.setTilesets(n),this.setAlpha(this.layer.alpha),this.setPosition(s,a),this.setOrigin(),this.setSize(e.tileWidth*this.layer.width,e.tileHeight*this.layer.height),this.updateVBOData(),this.initPipeline("TextureTintPipeline"),t.sys.game.config.renderType===r.WEBGL&&t.sys.game.renderer.onContextRestored(function(){this.updateVBOData()},this)},setTilesets:function(t){var e=[],i=[],n=this.tilemap;Array.isArray(t)||(t=[t]);for(var s=0;sv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(1===p)for(o=0;o=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(2===p)for(o=l-1;o>=0;o--)for(a=0;av||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(3===p)for(o=l-1;o>=0;o--)for(a=u-1;a>=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));this.dirty[e]=!1,null===m?(m=i.createVertexBuffer(y,n.STATIC_DRAW),this.vertexBuffer[e]=m):(i.setVertexBuffer(m),n.bufferSubData(n.ARRAY_BUFFER,0,y))}return this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=i.tileWidth,u=i.tileHeight,c=h/2,d=u/2,f=a.x/n,p=a.y/s,g=(a.x+h)/n,v=(a.y+u)/s,m=this._tempMatrix,y=-c,x=-d;e.flipX&&(h*=-1,y+=i.tileWidth),e.flipY&&(u*=-1,x+=i.tileHeight);var T=y+h,w=x+u;m.applyITRS(c+e.pixelX,d+e.pixelY,e.rotation,1,1);var _=l.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),b=m.getX(y,x),A=m.getY(y,x),E=m.getX(y,w),S=m.getY(y,w),C=m.getX(T,w),M=m.getY(T,w),O=m.getX(T,x),P=m.getY(T,x);r.roundPixels&&(b=Math.round(b),A=Math.round(A),E=Math.round(E),S=Math.round(S),C=Math.round(C),M=Math.round(M),O=Math.round(O),P=Math.round(P));var R=this.vertexViewF32[o],L=this.vertexViewU32[o];return R[++t]=b,R[++t]=A,R[++t]=f,R[++t]=p,R[++t]=0,L[++t]=_,R[++t]=E,R[++t]=S,R[++t]=f,R[++t]=v,R[++t]=0,L[++t]=_,R[++t]=C,R[++t]=M,R[++t]=g,R[++t]=v,R[++t]=0,L[++t]=_,R[++t]=b,R[++t]=A,R[++t]=f,R[++t]=p,R[++t]=0,L[++t]=_,R[++t]=C,R[++t]=M,R[++t]=g,R[++t]=v,R[++t]=0,L[++t]=_,R[++t]=O,R[++t]=P,R[++t]=g,R[++t]=p,R[++t]=0,L[++t]=_,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),t>=0&&t<4){this._renderOrder=t;for(var e=0;e=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return a.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,s){return a.CreateFromTiles(t,e,i,n,s,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,s,r,o){return a.Copy(t,e,i,n,s,r,o,this.layer),this},destroy:function(){this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this)},fill:function(t,e,i,n,s,r){return a.Fill(t,e,i,n,s,r,this.layer),this},filterTiles:function(t,e,i,n,s,r,o){return a.FilterTiles(t,e,i,n,s,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,s,r,o){return a.FindTile(t,e,i,n,s,r,o,this.layer)},forEachTile:function(t,e,i,n,s,r,o){return a.ForEachTile(t,e,i,n,s,r,o,this.layer),this},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return a.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,s){return a.GetTilesWithin(t,e,i,n,s,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,s,r){return a.GetTilesWithinWorldXY(t,e,i,n,s,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return a.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,s){return a.PutTileAtWorldXY(t,e,i,n,s,this.layer)},putTilesAt:function(t,e,i,n){return a.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,s){return a.Randomize(t,e,i,n,s,this.layer),this},removeTileAt:function(t,e,i,n){return a.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,s){return a.RemoveTileAtWorldXY(t,e,i,n,s,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,s,r){return a.ReplaceByIndex(t,e,i,n,s,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i){return a.SetCollision(t,e,i,this.layer),this},setCollisionBetween:function(t,e,i,n){return a.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,s,r){return a.SetTileLocationCallback(t,e,i,n,s,r,this.layer),this},shuffle:function(t,e,i,n){return a.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,s,r){return a.SwapByIndex(t,e,i,n,s,r,this.layer),this},tileToWorldX:function(t,e){return a.TileToWorldX(t,e,this.layer)},tileToWorldY:function(t,e){return a.TileToWorldY(t,e,this.layer)},tileToWorldXY:function(t,e,i,n){return a.TileToWorldXY(t,e,i,n,this.layer)},weightedRandomize:function(t,e,i,n,s){return a.WeightedRandomize(t,e,i,n,s,this.layer),this},worldToTileX:function(t,e,i){return a.WorldToTileX(t,e,i,this.layer)},worldToTileY:function(t,e,i){return a.WorldToTileY(t,e,i,this.layer)},worldToTileXY:function(t,e,i,n,s){return a.WorldToTileXY(t,e,i,n,s,this.layer)}});t.exports=h},function(t,e,i){var n=i(0),s=i(34),r=i(224),o=i(19),a=i(31),h=i(84),u=i(373),l=i(223),c=i(61),d=i(110),f=i(106),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.renderOrder=e.renderOrder,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},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},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 Tileset Image: "+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 for Tileset: "+t),null;var l=this.tilesets[u];return l?(l.setTileSize(i,n),l.setSpacing(s,r),l.setImage(h),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),(l=new f(t,o,i,n,s,r)).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("Invalid Tilemap Layer ID: "+t),null;for(var l,d=new h({name:t,tileWidth:a,tileHeight:u,width:s,height:o}),f=0;fa&&(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(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","object layer"),this.opacity=s(t,"opacity",1),this.properties=s(t,"properties",{}),this.propertyTypes=s(t,"propertytypes",{}),this.type=s(t,"type","objectgroup"),this.visible=s(t,"visible",!0),this.objects=s(t,"objects",[])}});t.exports=r},function(t,e,i){var n=i(494),s=i(230),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=n(t,o);if(a.x+=e,a.y+=i,t.gid){var h=s(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?(a.ellipse=t.ellipse,a.width=t.width,a.height=t.height):t.text?(a.width=t.width,a.height=t.height,a.text=t.text):(a.rectangle=!0,a.width=t.width,a.height=t.height);return a}},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&&t-1}return!1}},function(t,e,i){var n=i(21);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),u=0;u0?(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.setPosition(t,e),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)},postUpdate:function(){},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,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),this.isCircle?t.strokeCircle(i,n,this.width/2):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=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(317);function s(t){if(!(this instanceof s))return new s(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=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,m,y;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),m=Math.min(f.maxX,p.maxX),y=Math.min(f.maxY,p.maxY),o=Math.max(0,m-g)*Math.max(0,y-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)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=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;te._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.up=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},function(t,e,i){var n=i(38);t.exports=function(t,e,i,s){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.left=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},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,i){t.exports={COLLIDE:i(563),OVERLAP:i(562),PAUSE:i(561),RESUME:i(560),TILE_COLLIDE:i(559),TILE_OVERLAP:i(558),WORLD_BOUNDS:i(557)}},function(t,e,i){var n=i(43),s=i(0),r=i(38),o=i(248),a=i(183),h=i(10),u=i(42),l=i(3),c=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;this.world=t,this.gameObject=e,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new l,this.position=new l(e.x,e.y),this.prev=new l(e.x,e.y),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=n,this.sourceWidth=i,this.sourceHeight=n,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(n/2),this.center=new l(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new l,this.newVelocity=new l,this.deltaMax=new l,this.acceleration=new l,this.allowDrag=!0,this.drag=new l,this.allowGravity=!0,this.gravity=new l,this.bounce=new l,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new l(1e4,1e4),this.maxSpeed=-1,this.friction=new l(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.moves=!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.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.physicsType=r.DYNAMIC_BODY,this._reset=!0,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._bounds=new h},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=a(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var n=!1;if(this.syncBounds){var s=t.getBounds(this._bounds);this.width=s.width,this.height=s.height,n=!0}else{var r=Math.abs(e.scaleX),o=Math.abs(e.scaleY);this._sx===r&&this._sy===o||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*o,this._sx=r,this._sy=o,n=!0)}n&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},update:function(t){this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds();var e=this.transform;if(this.position.x=e.x+e.scaleX*(this.offset.x-e.displayOriginX),this.position.y=e.y+e.scaleY*(this.offset.y-e.displayOriginY),this.updateCenter(),this.rotation=e.rotation,this.preRotation=this.rotation,this._reset&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves){this.world.updateMotion(this,t);var i=this.velocity.x,n=this.velocity.y;this.newVelocity.set(i*t,n*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(n,i),this.speed=Math.sqrt(i*i+n*n),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit(o.WORLD_BOUNDS,this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y},postUpdate:function(){this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y,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._dx<0?this.facing=r.FACING_LEFT:this._dx>0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),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(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),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):u(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._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&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(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.width/2):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,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 void 0===t&&(t=!0),this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),this},setMaxSpeed:function(t){return this.maxSpeed=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},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=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 void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=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=c},function(t,e,i){var n=i(249),s=i(23),r=i(0),o=i(247),a=i(38),h=i(56),u=i(11),l=i(248),c=i(186),d=i(383),f=i(382),p=i(246),g=i(245),v=i(4),m=i(244),y=i(556),x=i(10),T=i(243),w=i(555),_=i(550),b=i(549),A=i(102),E=i(241),S=i(242),C=i(41),M=i(3),O=i(57),P=new r({Extends:u,initialize:function(t,e){u.call(this),this.scene=t,this.bodies=new A,this.staticBodies=new A,this.pendingDestroy=new A,this.late=new A,this._late=!1,this.colliders=new m,this.gravity=new M(v(e,"gravity.x",0),v(e,"gravity.y",0)),this.bounds=new x(v(e,"x",0),v(e,"y",0),v(e,"width",t.sys.scale.width),v(e,"height",t.sys.scale.height)),this.checkCollision={up:v(e,"checkCollision.up",!0),down:v(e,"checkCollision.down",!0),left:v(e,"checkCollision.left",!0),right:v(e,"checkCollision.right",!0)},this.fps=v(e,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=v(e,"timeScale",1),this.OVERLAP_BIAS=v(e,"overlapBias",4),this.TILE_BIAS=v(e,"tileBias",16),this.forceX=v(e,"forceX",!1),this.isPaused=v(e,"isPaused",!1),this._total=0,this.drawDebug=v(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:v(e,"debugShowBody",!0),debugShowStaticBody:v(e,"debugShowStaticBody",!0),debugShowVelocity:v(e,"debugShowVelocity",!0),bodyDebugColor:v(e,"debugBodyColor",16711935),staticBodyDebugColor:v(e,"debugStaticBodyColor",255),velocityDebugColor:v(e,"debugVelocityColor",65280)},this.maxEntries=v(e,"maxEntries",16),this.useTree=v(e,"useTree",!0),this.tree=new T(this.maxEntries),this.staticTree=new T(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new C,this._tempMatrix2=new C,this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=a.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=s;)this._elapsed-=s,i++,this.step(n);this.stepsLastFrame=i,this._late=!0}},step:function(t){var e,i,n=this.bodies.entries,s=n.length;for(e=0;e0){for(n=(e=h.entries).length,t=0;t0){var l=this.tree,c=this.staticTree;for(n=(e=o.entries).length,t=0;t-1&&t.velocity.length()>g&&t.velocity.normalize().scale(g)},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,c=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)u.right&&(a=h(c.x,c.y,u.right,u.y)-c.radius):c.y>u.bottom&&(c.xu.right&&(a=h(c.x,c.y,u.right,u.bottom)-c.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(l.OVERLAP,t.gameObject,e.gameObject,t,e),0!==a;var d=t.velocity.x,f=t.velocity.y,v=t.mass,m=e.velocity.x,y=e.velocity.y,x=e.mass,T=d*Math.cos(o)+f*Math.sin(o),w=d*Math.sin(o)-f*Math.cos(o),_=m*Math.cos(o)+y*Math.sin(o),b=m*Math.sin(o)-y*Math.cos(o),A=((v-x)*T+2*x*_)/(v+x),E=(2*v*T+(x-v)*_)/(v+x);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,d=t.velocity.x,f=t.velocity.y),e.immovable||(e.velocity.x=(E*Math.cos(o)-b*Math.sin(o))*e.bounce.x,e.velocity.y=(b*Math.cos(o)+E*Math.sin(o))*e.bounce.y,m=e.velocity.x,y=e.velocity.y),Math.abs(o)0&&!t.immovable&&m>d?t.velocity.x*=-1:m<0&&!e.immovable&&d0&&!t.immovable&&y>f?t.velocity.y*=-1:y<0&&!e.immovable&&fMath.PI/2&&(d<0&&!t.immovable&&m0&&!e.immovable&&d>m?e.velocity.x*=-1:f<0&&!t.immovable&&y0&&!e.immovable&&d>y&&(e.velocity.y*=-1));var S=this._frameTime;return t.immovable||(t.x+=t.velocity.x*S-a*Math.cos(o),t.y+=t.velocity.y*S-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*S+a*Math.cos(o),e.y+=e.velocity.y*S+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit(l.COLLIDE,t.gameObject,e.gameObject,t,e),t.postUpdate(),e.postUpdate(),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?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):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.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);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,h,u,l=t.body;if(0!==e.length&&l&&l.enable)if(this.useTree){var c=this.treeMinMax;c.minX=l.left,c.minY=l.top,c.maxX=l.right,c.maxY=l.bottom;var d=e.physicsType===a.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(h=d.length,o=0;od.baseTileWidth){var f=(d.tileWidth-d.baseTileWidth)*e.scaleX;a-=f,u+=f}d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var p,g=e.getTilesWithinWorldXY(a,h,u,c);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},m=0;m=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),s>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},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=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=0&&l<=1){var c=((s-h)*(r-n)-(n-a)*(o-s))/u;return Math.abs(c)*Math.sqrt(u)<=i}return Math.sqrt((r-a)*(r-a)+(o-h)*(o-h))<=i}},function(t,e,i){var n=i(43),s=new(i(6));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,i){t.exports={CircleToCircle:i(725),CircleToRectangle:i(724),GetRectangleIntersection:i(723),LineToCircle:i(277),LineToLine:i(115),LineToRectangle:i(722),PointToLine:i(276),PointToLineSegment:i(721),RectangleToRectangle:i(158),RectangleToTriangle:i(720),RectangleToValues:i(719),TriangleToCircle:i(718),TriangleToLine:i(717),TriangleToTriangle:i(716)}},function(t,e,i){t.exports={Circle:i(745),Ellipse:i(735),Intersects:i(278),Line:i(715),Point:i(694),Polygon:i(680),Rectangle:i(270),Triangle:i(650)}},function(t,e,i){var n=i(0),s=i(281),r=i(9),o=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1,this.maxLights=-1},enable:function(){return-1===this.maxLights&&(this.maxLights=this.scene.sys.game.renderer.config.maxLights),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,r=t.y+t.height/2,o=(t.width+t.height)/2,a={x:0,y:0},h=t.matrix,u=this.systems.game.config.height;i.length=0;for(var l=0;l0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],o):h=new s(t,e,i,a[0],a[1],a[2],o),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=o},function(t,e,i){var n=i(0),s=i(9),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(58),s=i(6);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(6),s=i(58);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=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(0),s=i(29),r=i(65),o=i(795),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h,u,l,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===u&&(u=128),void 0===l&&(l=128),s.call(this,t,"Triangle",new r(n,o,a,h,u,l));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,n,s,r){return this.geom.setTo(t,e,i,n,s,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(798),s=i(0),r=i(71),o=i(29),a=new s({Extends:o,Mixins:[n],initialize:function(t,e,i,n,s,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===s&&(s=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=s,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,s=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var u=0;u0&&r.push(i([0,0],n[0])),e=0;e1&&r.push(i([0,0],n[n.length-1])),t.setTo(r)}},function(t,e,i){var n=i(58),s=i(59);t.exports=function(t){for(var e=t.points,i=0,r=0;rc+v)){var m=g.getPoint((l-c)/v);o.push(m);break}c+=v}return o}},function(t,e,i){var n=i(10);t.exports=function(t,e){void 0===e&&(e=new n);for(var i,s=1/0,r=1/0,o=-s,a=-r,h=0;h0&&(s=-h.PI2+s%h.PI2):s>h.PI2?s=h.PI2:s<0&&(s=h.PI2+s%h.PI2);for(var l,c=[a+Math.cos(n)*i,u+Math.sin(n)*i];e<1;)l=s*e+n,c.push(a+Math.cos(l)*i,u+Math.sin(l)*i),e+=t;return l=s+n,c.push(a+Math.cos(l)*i,u+Math.sin(l)*i),c.push(a+Math.cos(n)*i,u+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=l},function(t,e){t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}},function(t,e,i){var n=i(0),s=i(34),r=i(90),o=i(4),a=i(67),h=i(89),u=i(3),l=new n({Extends:a,initialize:function(t,e,i,n,s,r){a.call(this,t,i,n,s,r),this.path=e,this.rotateToPath=!1,this.pathRotationOffset=0,this.pathOffset=new u(i,n),this.pathVector=new u,this.pathTween,this.pathConfig=null,this._prevDirection=h.PLAYING_FORWARD},setPath:function(t,e){void 0===e&&(e=this.pathConfig);var i=this.pathTween;return i&&i.isPlaying()&&i.stop(),this.path=t,e&&this.startFollow(e),this},setRotateToPath:function(t,e){return void 0===e&&(e=0),this.rotateToPath=t,this.pathRotationOffset=e,this},isFollowing:function(){var t=this.pathTween;return t&&t.isPlaying()},startFollow:function(t,e){void 0===t&&(t={}),void 0===e&&(e=0);var i=this.pathTween;i&&i.isPlaying()&&i.stop(),"number"==typeof t&&(t={duration:t}),t.from=0,t.to=1;var n=r(t,"positionOnPath",!1);this.rotateToPath=r(t,"rotateToPath",!1),this.pathRotationOffset=o(t,"rotationOffset",0);var a=o(t,"startAt",e);if(a&&(t.onStart=function(t){var e=t.data[0];e.progress=a,e.elapsed=e.duration*a;var i=e.ease(e.progress);e.current=e.start+(e.end-e.start)*i,e.target[e.key]=e.current}),this.pathTween=this.scene.sys.tweens.addCounter(t),this.path.getStartPoint(this.pathOffset),n&&(this.x=this.pathOffset.x,this.y=this.pathOffset.y),this.pathOffset.x=this.x-this.pathOffset.x,this.pathOffset.y=this.y-this.pathOffset.y,this._prevDirection=h.PLAYING_FORWARD,this.rotateToPath){var u=this.path.getPoint(.1);this.rotation=Math.atan2(u.y-this.y,u.x-this.x)+s(this.pathRotationOffset)}return this.pathConfig=t,this},pauseFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.pause(),this},resumeFollow:function(){var t=this.pathTween;return t&&t.isPaused()&&t.resume(),this},stopFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.stop(),this},preUpdate:function(t,e){this.anims.update(t,e);var i=this.pathTween;if(i){var n=i.data[0];if(n.state!==h.PLAYING_FORWARD&&n.state!==h.PLAYING_BACKWARD)return;var r=this.pathVector;this.path.getPoint(i.getValue(),r),r.add(this.pathOffset);var o=this.x,a=this.y;this.setPosition(r.x,r.y);var u=this.x-o,l=this.y-a;if(0===u&&0===l)return;if(n.state!==this._prevDirection)return void(this._prevDirection=n.state);this.rotateToPath&&(this.rotation=Math.atan2(l,u)+s(this.pathRotationOffset))}}});t.exports=l},function(t,e,i){var n=i(0),s=i(3),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){t.exports=function(t,e){for(var i=0;ithis._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=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=i(60),s=i(0),r=i(13),o=i(304),a=i(303),h=i(845),u=i(2),l=i(172),c=i(302),d=i(91),f=i(306),p=i(301),g=i(10),v=i(118),m=i(3),y=i(57),x=new s({Mixins:[r.BlendMode,r.Mask,r.ScrollFactor,r.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=f,this.x=new h(e,"x",0),this.y=new h(e,"y",0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",4294967295),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3),this.angle=new h(e,"angle",{min:0,max:360}),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new m,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&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){var l=this.deathCallback,c=this.deathCallbackScope;for(o=h-1;o>=0;o--){var d=a[o];s.splice(d.index,1),r.push(d.particle),l&&l.call(c,d.particle),d.particle.resetPosition()}}this.on&&(0===this.frequency?this.emitParticle():this.frequency>0&&(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}});t.exports=x},function(t,e,i){var n=i(0),s=i(34),r=i(56),o=new n({initialize:function(t){this.emitter=t,this.frame=null,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.tint=16777215,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},resetPosition:function(){this.x=0,this.y=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")},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.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},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);s>>16,y=(65280&p)>>>8,x=255&p,c.strokeStyle="rgba("+m+","+y+","+x+","+d+")",c.lineWidth=v,T+=3;break;case n.FILL_STYLE:g=u[T+1],f=u[T+2],m=(16711680&g)>>>16,y=(65280&g)>>>8,x=255&g,c.fillStyle="rgba("+m+","+y+","+x+","+f+")",T+=2;break;case n.BEGIN_PATH:c.beginPath();break;case n.CLOSE_PATH:c.closePath();break;case n.FILL_PATH:h||c.fill();break;case n.STROKE_PATH:h||c.stroke();break;case n.FILL_RECT:h?c.rect(u[T+1],u[T+2],u[T+3],u[T+4]):c.fillRect(u[T+1],u[T+2],u[T+3],u[T+4]),T+=4;break;case n.FILL_TRIANGLE:c.beginPath(),c.moveTo(u[T+1],u[T+2]),c.lineTo(u[T+3],u[T+4]),c.lineTo(u[T+5],u[T+6]),c.closePath(),h||c.fill(),T+=6;break;case n.STROKE_TRIANGLE:c.beginPath(),c.moveTo(u[T+1],u[T+2]),c.lineTo(u[T+3],u[T+4]),c.lineTo(u[T+5],u[T+6]),c.closePath(),h||c.stroke(),T+=6;break;case n.LINE_TO:c.lineTo(u[T+1],u[T+2]),T+=2;break;case n.MOVE_TO:c.moveTo(u[T+1],u[T+2]),T+=2;break;case n.LINE_FX_TO:c.lineTo(u[T+1],u[T+2]),T+=5;break;case n.MOVE_FX_TO:c.moveTo(u[T+1],u[T+2]),T+=5;break;case n.SAVE:c.save();break;case n.RESTORE:c.restore();break;case n.TRANSLATE:c.translate(u[T+1],u[T+2]),T+=2;break;case n.SCALE:c.scale(u[T+1],u[T+2]),T+=2;break;case n.ROTATE:c.rotate(u[T+1]),T+=1;break;case n.GRADIENT_FILL_STYLE:T+=5;break;case n.GRADIENT_LINE_STYLE:T+=6;break;case n.SET_TEXTURE:T+=2}c.restore()}}},function(t,e){t.exports=function(t){var e=t.width/2,i=t.height/2,n=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*n/(10+Math.sqrt(4-3*n)))}},function(t,e,i){var n=i(309),s=i(166),r=i(100),o=i(20);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(4),s=i(132),r=function(t,e,i){for(var n=[],s=0;se?1:0}var s=function(t,e,r,o,a){for(void 0===r&&(r=0),void 0===o&&(o=t.length-1),void 0===a&&(a=n);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));s(t,e,f,p,a)}var g=t[e],v=r,m=o;for(i(t,r,e),a(t[o],g)>0&&i(t,r,o);v0;)m--}0===a(t[r],g)?i(t,r,m):i(t,++m,o),m<=e&&(r=m+1),e<=m&&(o=m-1)}};t.exports=s},function(t,e){t.exports=function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n}},function(t,e,i){t.exports={AtlasXML:i(910),Canvas:i(909),Image:i(908),JSONArray:i(907),JSONHash:i(906),SpriteSheet:i(905),SpriteSheetFromAtlas:i(904),UnityYAML:i(903)}},function(t,e,i){var n=i(24),s=i(0),r=i(127),o=i(101),a=new s({initialize:function(t,e,i,n){var s=t.manager.game;this.renderer=s.renderer,this.texture=t,this.source=e,this.image=e,this.compressionAlgorithm=null,this.resolution=1,this.width=i||e.naturalWidth||e.width||0,this.height=n||e.naturalHeight||e.height||0,this.scaleMode=o.DEFAULT,this.isCanvas=e instanceof HTMLCanvasElement,this.isRenderTexture="RenderTexture"===e.type,this.isPowerOf2=r(this.width,this.height),this.glTexture=null,this.init(s)},init:function(t){this.renderer&&(this.renderer.gl?this.isCanvas?this.glTexture=this.renderer.canvasToTexture(this.image):this.isRenderTexture?(this.image=this.source.canvas,this.glTexture=this.renderer.createTextureFromSource(null,this.width,this.height,this.scaleMode)):this.glTexture=this.renderer.createTextureFromSource(this.image,this.width,this.height,this.scaleMode):this.isRenderTexture&&(this.image=this.source.canvas)),t.config.antialias||this.setFilter(1)},setFilter:function(t){this.renderer.gl&&this.renderer.setTextureFilter(this.glTexture,t)},update:function(){this.renderer.gl&&this.isCanvas&&(this.glTexture=this.renderer.canvasToTexture(this.image,this.glTexture))},destroy:function(){this.glTexture&&this.renderer.deleteTexture(this.glTexture),this.isCanvas&&n.remove(this.image),this.renderer=null,this.texture=null,this.source=null,this.image=null,this.glTexture=null}});t.exports=a},function(t,e,i){var n=i(24),s=i(911),r=i(0),o=i(32),a=i(28),h=i(11),u=i(126),l=i(26),c=i(361),d=i(4),f=i(319),p=i(175),g=new r({Extends:h,initialize:function(t){h.call(this),this.game=t,this.name="TextureManager",this.list={},this._tempCanvas=n.create2D(this,1,1),this._tempContext=this._tempCanvas.getContext("2d"),this._pending=0,t.events.once(l.BOOT,this.boot,this)},boot:function(){this._pending=2,this.on(u.LOAD,this.updatePending,this),this.on(u.ERROR,this.updatePending,this),this.addBase64("__DEFAULT",this.game.config.defaultImage),this.addBase64("__MISSING",this.game.config.missingImage),this.game.events.once(l.DESTROY,this.destroy,this)},updatePending:function(){this._pending--,0===this._pending&&(this.off(u.LOAD),this.off(u.ERROR),this.emit(u.READY))},checkKey:function(t){return!this.exists(t)||(console.error("Texture key already in use: "+t),!1)},remove:function(t){if("string"==typeof t){if(!this.exists(t))return console.warn("No texture found matching key: "+t),this;t=this.get(t)}return this.list.hasOwnProperty(t.key)&&(delete this.list[t.key],t.destroy(),this.emit(u.REMOVE,t.key)),this},addBase64:function(t,e){if(this.checkKey(t)){var i=this,n=new Image;n.onerror=function(){i.emit(u.ERROR,t)},n.onload=function(){var e=i.create(t,n);f.Image(e,0),i.emit(u.ADD,t,e),i.emit(u.LOAD,t,e)},n.src=e}return this},getBase64:function(t,e,i,s){void 0===i&&(i="image/png"),void 0===s&&(s=.92);var r="",o=this.getFrame(t,e);if(o){var a=o.canvasData,h=n.create2D(this,a.width,a.height);h.getContext("2d").drawImage(o.source.image,a.x,a.y,a.width,a.height,0,0,a.width,a.height),r=h.toDataURL(i,s),n.remove(h)}return r},addImage:function(t,e,i){var n=null;return this.checkKey(t)&&(n=this.create(t,e),f.Image(n,0),i&&n.setDataSource(i),this.emit(u.ADD,t,n)),n},addRenderTexture:function(t,e){var i=null;return this.checkKey(t)&&((i=this.create(t,e)).add("__BASE",0,0,0,e.width,e.height),this.emit(u.ADD,t,i)),i},generate:function(t,e){if(this.checkKey(t)){var i=n.create(this,1,1);return e.canvas=i,c(e),this.addCanvas(t,i)}return null},createCanvas:function(t,e,i){if(void 0===e&&(e=256),void 0===i&&(i=256),this.checkKey(t)){var s=n.create(this,e,i,a.CANVAS,!0);return this.addCanvas(t,s)}return null},addCanvas:function(t,e,i){void 0===i&&(i=!1);var n=null;return i?n=new s(this,t,e,e.width,e.height):this.checkKey(t)&&(n=new s(this,t,e,e.width,e.height),this.list[t]=n,this.emit(u.ADD,t,n)),n},addAtlas:function(t,e,i,n){return Array.isArray(i.textures)||Array.isArray(i.frames)?this.addAtlasJSONArray(t,e,i,n):this.addAtlasJSONHash(t,e,i,n)},addAtlasJSONArray:function(t,e,i,n){var s=null;if(this.checkKey(t)){if(s=this.create(t,e),Array.isArray(i))for(var r=1===i.length,o=0;o=r.x&&t=r.y&&e=r.x&&t=r.y&&e0)&&(!!n.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit(r.PAUSE,this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!n.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit(r.RESUME,this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!n.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit(r.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(r.COMPLETE,this);this.previousTime=s}},destroy:function(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.updateMute(),this.emit(r.MUTE,this,t))}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.updateVolume(),this.emit(r.VOLUME,this,t))}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,r.RATE,t)||(this.calculateRate(),this.emit(r.RATE,this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,r.DETUNE,t)||(this.calculateRate(),this.emit(r.DETUNE,this,t))}},setDetune:function(t){return this.detune=t,this},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(r.SEEK,this,t))}},setSeek:function(t){return this.seek=t,this},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(r.LOOP,this,t))}},setLoop:function(t){return this.loop=t,this}});t.exports=o},function(t,e,i){var n=i(123),s=i(0),r=i(69),o=i(326),a=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 o(this,t,e);return this.sounds.push(i),i},unlock:function(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each(function(e,i){for(var n=0;n-1&&(delete this.keys[n],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,i=t.sys,n=i.settings;t.init&&(t.init.call(t,n.data),n.status=s.INIT,n.isTransition&&i.events.emit(r.TRANSITION_INIT,n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=s.LOADING,e.once(h.COMPLETE,this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>s.START&&n.settings.status<=s.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=s.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)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.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(ethis._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatio0&&(t=(e=r(e,n.y))*this.aspectRatio)):(i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,n.x>0&&(e=(t=r(t,n.x))*(1/this.aspectRatio))),this._width=t,this._height=e,this},fitTo:function(t,e){return this.constrain(t,e,!0)},envelop:function(t,e){return this.constrain(t,e,!1)},setWidth:function(t){return this.setSize(t,this._height)},setHeight:function(t){return this.setSize(this._width,t)},toString:function(){return"[{ Size (width="+this._width+" height="+this._height+" aspectRatio="+this.aspectRatio+" aspectMode="+this.aspectMode+") }]"},copy:function(t){return t.setAspectMode(this.aspectMode),t.aspectRatio=this.aspectRatio,t.setSize(this.width,this.height)},destroy:function(){this._parent=null,this.snapTo=null},width:{get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},height:{get:function(){return this._height},set:function(t){this.setSize(this._width,t)}}});a.NONE=0,a.WIDTH_CONTROLS_HEIGHT=1,a.HEIGHT_CONTROLS_WIDTH=2,a.FIT=3,a.ENVELOP=4,t.exports=a},function(t,e,i){t.exports={ENTER_FULLSCREEN:i(951),FULLSCREEN_UNSUPPORTED:i(950),LEAVE_FULLSCREEN:i(949),ORIENTATION_CHANGE:i(948),RESIZE:i(947)}},function(t,e,i){var n=i(178),s=i(0),r=i(11),o=i(334),a=i(26),h=i(946),u=i(345),l=i(350),c=i(1),d=i(10),f=i(333),p=i(98),g=i(3),v=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.canvas,this.canvasBounds=new d,this.parent=null,this.parentIsWindow=!1,this.parentSize=new f,this.gameSize=new f,this.baseSize=new f,this.displaySize=new f,this.scaleMode=n.SCALE_MODE.NONE,this.resolution=1,this.zoom=1,this.displayScale=new g(1,1),this.autoRound=!1,this.autoCenter=n.CENTER.NO_CENTER,this.orientation=n.ORIENTATION.LANDSCAPE,this.fullscreen,this.fullscreenTarget=null,this._createdFullscreenTarget=!1,this._requestedFullscreenChange=!1,this.dirty=!1,this.resizeInterval=500,this._lastCheck=0,this._checkOrientation=!1,this.listeners={orientationChange:c,windowResize:c,fullScreenChange:c,fullScreenError:c}},preBoot:function(){this.parseConfig(this.game.config),this.game.events.once("boot",this.boot,this)},boot:function(){var t=this.game;this.canvas=t.canvas,this.fullscreen=t.device.fullscreen,this.scaleMode!==n.SCALE_MODE.RESIZE&&this.displaySize.setAspectMode(this.scaleMode),this.scaleMode===n.SCALE_MODE.NONE?this.resize(this.width,this.height):(this.getParentBounds(),this.parentSize.width>0&&this.parentSize.height>0&&this.displaySize.setParent(this.parentSize),this.refresh()),t.events.on(a.PRE_STEP,this.step,this),this.startListeners()},parseConfig:function(t){this.getParent(t),this.getParentBounds();var e=t.width,i=t.height,s=t.scaleMode,r=t.resolution,o=t.zoom,a=t.autoRound;if("string"==typeof e){var h=this.parentSize.width;0===h&&(h=window.innerWidth);var u=parseInt(e,10)/100;e=Math.floor(h*u)}if("string"==typeof i){var c=this.parentSize.height;0===c&&(c=window.innerHeight);var d=parseInt(i,10)/100;i=Math.floor(c*d)}this.resolution=1,this.scaleMode=s,this.autoRound=a,this.autoCenter=t.autoCenter,this.resizeInterval=t.resizeInterval,a&&(e=Math.floor(e),i=Math.floor(i)),this.gameSize.setSize(e,i),o===n.ZOOM.MAX_ZOOM&&(o=this.getMaxZoom()),this.zoom=o,this.baseSize.setSize(e*r,i*r),a&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),t.minWidth>0&&this.displaySize.setMin(t.minWidth*o,t.minHeight*o),t.maxWidth>0&&this.displaySize.setMax(t.maxWidth*o,t.maxHeight*o),this.displaySize.setSize(e,i),this.orientation=l(e,i)},getParent:function(t){var e=t.parent;if(null!==e){if(this.parent=u(e),this.parentIsWindow=this.parent===document.body,t.expandParent&&t.scaleMode!==n.SCALE_MODE.NONE){var i=this.parent.getBoundingClientRect();(this.parentIsWindow||0===i.height)&&(document.documentElement.style.height="100%",document.body.style.height="100%",i=this.parent.getBoundingClientRect(),this.parentIsWindow||0!==i.height||(this.parent.style.overflow="hidden",this.parent.style.width="100%",this.parent.style.height="100%"))}t.fullscreenTarget&&!this.fullscreenTarget&&(this.fullscreenTarget=u(t.fullscreenTarget))}},getParentBounds:function(){if(!this.parent)return!1;var t=this.parentSize,e=this.parent.getBoundingClientRect();this.parentIsWindow&&this.game.device.os.iOS&&(e.height=h(!0));var i=this.resolution,n=e.width*i,s=e.height*i;return(t.width!==n||t.height!==s)&&(t.setSize(n,s),!0)},lockOrientation:function(t){var e=screen.lockOrientation||screen.mozLockOrientation||screen.msLockOrientation;return!!e&&e(t)},setParentSize:function(t,e){return this.parentSize.setSize(t,e),this.refresh()},setGameSize:function(t,e){var i=this.autoRound,n=this.resolution;return i&&(t=Math.floor(t),e=Math.floor(e)),this.gameSize.resize(t,e),this.baseSize.resize(t*n,e*n),this.updateBounds(),this.displayScale.set(t/this.canvasBounds.width,e/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this.updateOrientation(),this.refresh()},resize:function(t,e){var i=this.zoom,n=this.resolution,s=this.autoRound;s&&(t=Math.floor(t),e=Math.floor(e)),this.gameSize.resize(t,e),this.baseSize.resize(t*n,e*n),this.displaySize.setSize(t*i*n,e*i*n),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height;var r=this.canvas.style,a=t*i,h=e*i;return s&&(a=Math.floor(a),h=Math.floor(h)),a===t&&h===e||(r.width=a+"px",r.height=h+"px"),this.getParentBounds(),this.updateCenter(),this.updateBounds(),this.displayScale.set(t/this.canvasBounds.width,e/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this.updateOrientation(),this},setZoom:function(t){return this.zoom=t,this.refresh()},setMaxZoom:function(){return this.zoom=this.getMaxZoom(),this.refresh()},refresh:function(){return this.updateScale(),this.updateBounds(),this.updateOrientation(),this.displayScale.set(this.baseSize.width/this.canvasBounds.width,this.baseSize.height/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this},updateOrientation:function(){if(this._checkOrientation){this._checkOrientation=!1;var t=l(this.width,this.height);t!==this.orientation&&(this.orientation=t,this.emit(o.ORIENTATION_CHANGE,t))}},updateScale:function(){var t,e,i=this.canvas.style,s=this.gameSize.width,r=this.gameSize.height,o=this.zoom,a=this.autoRound;this.scaleMode===n.SCALE_MODE.NONE?(this.displaySize.setSize(s*o*1,r*o*1),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),o>1&&(i.width=t+"px",i.height=e+"px")):this.scaleMode===n.SCALE_MODE.RESIZE?(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),this.gameSize.setSize(this.displaySize.width,this.displaySize.height),this.baseSize.setSize(1*this.displaySize.width,1*this.displaySize.height),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),this.canvas.width=t,this.canvas.height=e):(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),i.width=t+"px",i.height=e+"px"),this.getParentBounds(),this.updateCenter()},getMaxZoom:function(){var t=p(this.parentSize.width,this.gameSize.width,0,!0),e=p(this.parentSize.height,this.gameSize.height,0,!0);return Math.max(Math.min(t,e),1)},updateCenter:function(){var t=this.autoCenter;if(t!==n.CENTER.NO_CENTER){var e=this.canvas,i=e.style,s=e.getBoundingClientRect(),r=s.width,o=s.height,a=Math.floor((this.parentSize.width-r)/2),h=Math.floor((this.parentSize.height-o)/2);t===n.CENTER.CENTER_HORIZONTALLY?h=0:t===n.CENTER.CENTER_VERTICALLY&&(a=0),i.marginLeft=a+"px",i.marginTop=h+"px"}},updateBounds:function(){var t=this.canvasBounds,e=this.canvas.getBoundingClientRect();t.x=e.left+(window.pageXOffset||0)-(document.documentElement.clientLeft||0),t.y=e.top+(window.pageYOffset||0)-(document.documentElement.clientTop||0),t.width=e.width,t.height=e.height},transformX:function(t){return(t-this.canvasBounds.left)*this.displayScale.x},transformY:function(t){return(t-this.canvasBounds.top)*this.displayScale.y},startFullscreen:function(t){void 0===t&&(t={navigationUI:"hide"});var e=this.fullscreen;if(e.available){if(!e.active){var i=this.getFullscreenTarget();this._requestedFullscreenChange=!0,e.keyboard?i[e.request](Element.ALLOW_KEYBOARD_INPUT):i[e.request](t),this.getParentBounds(),this.refresh(),this.emit(o.ENTER_FULLSCREEN)}}else this.emit(o.FULLSCREEN_UNSUPPORTED)},getFullscreenTarget:function(){if(!this.fullscreenTarget){var t=document.createElement("div");t.style.margin="0",t.style.padding="0",t.style.width="100%",t.style.height="100%",this.fullscreenTarget=t,this._createdFullscreenTarget=!0}this._createdFullscreenTarget&&(this.canvas.parentNode.insertBefore(this.fullscreenTarget,this.canvas),this.fullscreenTarget.appendChild(this.canvas));return this.fullscreenTarget},stopFullscreen:function(){var t=this.fullscreen;if(!t.available)return this.emit(o.FULLSCREEN_UNSUPPORTED),!1;if(t.active&&(this._requestedFullscreenChange=!0,document[t.cancel]()),this._createdFullscreenTarget){var e=this.fullscreenTarget;if(e&&e.parentNode){var i=e.parentNode;i.insertBefore(this.canvas,e),i.removeChild(e)}}this.emit(o.LEAVE_FULLSCREEN),this.refresh()},toggleFullscreen:function(t){this.fullscreen.active?this.stopFullscreen():this.startFullscreen(t)},startListeners:function(){var t=this,e=this.listeners;if(e.orientationChange=function(){t._checkOrientation=!0,t.dirty=!0},e.windowResize=function(){t.dirty=!0},window.addEventListener("orientationchange",e.orientationChange,!1),window.addEventListener("resize",e.windowResize,!1),this.fullscreen.available){e.fullScreenChange=function(e){return t.onFullScreenChange(e)},e.fullScreenError=function(e){return t.onFullScreenError(e)};["webkit","moz",""].forEach(function(t){document.addEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.addEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.addEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.addEventListener("MSFullscreenError",e.fullScreenError,!1)}},onFullScreenChange:function(){this._requestedFullscreenChange||this.stopFullscreen(),this._requestedFullscreenChange=!1},onFullScreenError:function(){},step:function(t,e){this.parent&&(this._lastCheck+=e,(this.dirty||this._lastCheck>this.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var t=this.listeners;window.removeEventListener("orientationchange",t.orientationChange,!1),window.removeEventListener("resize",t.windowResize,!1);["webkit","moz",""].forEach(function(e){document.removeEventListener(e+"fullscreenchange",t.fullScreenChange,!1),document.removeEventListener(e+"fullscreenerror",t.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",t.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",t.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy(),this.fullscreenTarget=null},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===n.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===n.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(0),s=i(26),r=i(11),o=i(7),a=i(14),h=i(5),u=i(2),l=i(17),c=i(177),d=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once(s.BOOT,this.boot,this)},boot:function(){var t,e,i,n,r,o,a,h=this.game.config,l=h.installGlobalPlugins;for(l=l.concat(this._pendingGlobal),t=0;t-1&&e.preventDefault()}},this.onKeyUp=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.useQueue||t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}};var e=this.target;e&&(e.addEventListener("keydown",this.onKeyDown,!1),e.addEventListener("keyup",this.onKeyUp,!1),this.enabled=!0)},stopListeners:function(){var t=this.target;t.removeEventListener("keydown",this.onKeyDown,!1),t.removeEventListener("keyup",this.onKeyUp,!1),this.enabled=!1},postUpdate:function(){this.queue=[]},addCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},removeCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},clearCaptures:function(){this.captures=[],this.preventDefault=!1},destroy:function(){this.stopListeners(),this.clearCaptures(),this.queue=[],this.manager.game.events.off(r.POST_RENDER,this.postUpdate,this),this.target=null,this.enabled=!1,this.manager=null}});t.exports=u},function(t,e){t.exports={MOUSE_DOWN:0,MOUSE_MOVE:1,MOUSE_UP:2,TOUCH_START:3,TOUCH_MOVE:4,TOUCH_END:5,TOUCH_CANCEL:7,POINTER_LOCK_CHANGE:6}},function(t,e,i){var n=i(0),s=i(341),r=i(11),o=i(52),a=i(26),h=i(340),u=i(339),l=i(338),c=i(337),d=i(41),f=i(371),p=new n({initialize:function(t,e){this.game=t,this.scaleManager,this.canvas,this.config=e,this.enabled=!0,this.events=new r,this.queue=[],this.domCallbacks={up:[],down:[],move:[],upOnce:[],downOnce:[],moveOnce:[]},this.isOver=!0,this._hasUpCallback=!1,this._hasDownCallback=!1,this._hasMoveCallback=!1,this._customCursor="",this._setCursor=0,this.defaultCursor="",this.keyboard=e.inputKeyboard?new h(this):null,this.mouse=e.inputMouse?new u(this):null,this.touch=e.inputTouch?new c(this):null,this.pointers=[],this.pointersTotal=e.inputActivePointers,e.inputTouch&&1===this.pointersTotal&&(this.pointersTotal=2);for(var i=0;i<=this.pointersTotal;i++){var n=new l(this,i);n.smoothFactor=e.inputSmoothFactor,this.pointers.push(n)}this.mousePointer=e.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.dirty=!1,this.globalTopOnly=!0,this.ignoreEvents=!1,this.useQueue=e.inputQueue,this.time=0,this._updatedThisFrame=!1,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new d,this._tempMatrix2=new d,t.events.once(a.BOOT,this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.scaleManager=this.game.scale,this.events.emit(o.MANAGER_BOOT),this.useQueue?this.game.events.on(a.PRE_STEP,this.legacyUpdate,this):this.game.events.on(a.PRE_STEP,this.preStep,this),this.game.events.on(a.POST_STEP,this.postUpdate,this),this.game.events.once(a.DESTROY,this.destroy,this)},setCanvasOver:function(t){this.isOver=!0,this.events.emit(o.GAME_OVER,t)},setCanvasOut:function(t){this.isOver=!1,this.events.emit(o.GAME_OUT,t)},update:function(t){this._updatedThisFrame||(this._setCursor=0,this._updatedThisFrame=!0),this.events.emit(o.MANAGER_UPDATE),this.ignoreEvents=!1,this.dirty=!0;for(var e=this.pointers,i=0;i10&&(t=10-this.pointersTotal);for(var i=0;i0},updateInputPlugins:function(t,e){for(var i=this.game.scene.getScenes(!0,!0),n=0;ni.width?n.PORTRAIT:n.LANDSCAPE;if("number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?n.PORTRAIT:n.LANDSCAPE;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return n.PORTRAIT;if(window.matchMedia("(orientation: landscape)").matches)return n.LANDSCAPE}return e>t?n.PORTRAIT:n.LANDSCAPE}},function(t,e,i){var n=i(99);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,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e){t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},function(t,e,i){var n=i(32);n.ColorToRGBA=i(1005),n.ComponentToHex=i(353),n.GetColor=i(191),n.GetColor32=i(409),n.HexStringToColor=i(410),n.HSLToColor=i(1004),n.HSVColorWheel=i(1003),n.HSVToRGB=i(190),n.HueToComponent=i(352),n.IntegerToColor=i(407),n.IntegerToRGB=i(406),n.Interpolate=i(1002),n.ObjectToColor=i(405),n.RandomRGB=i(1001),n.RGBStringToColor=i(404),n.RGBToHSV=i(408),n.RGBToString=i(1e3),n.ValueToColor=i(192),t.exports=n},function(t,e,i){var n=i(185),s=i(0),r=i(76),o=i(3),a=new s({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.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;ei;)n-=i;n0||!this.inFocus)&&(this._coolDown--,r=Math.min(r,this._target)),r>this._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var o=0,a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},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,i){var n=i(28);t.exports=function(t){var e=t.config;if(!e.hideBanner){var i="WebGL";e.renderType===n.CANVAS?i="Canvas":e.renderType===n.HEADLESS&&(i="Headless");var s,r=e.audio,o=t.device.audio;if(s=!o.webAudio||r&&r.disableWebAudio?r&&r.noAudio||!o.webAudio&&!o.audioData?"No Audio":"HTML5 Audio":"Web Audio",t.device.browser.ie)window.console&&console.log("Phaser v"+n.VERSION+" / https://phaser.io");else{var a,h="",u=[h];Array.isArray(e.bannerBackgroundColor)?(e.bannerBackgroundColor.forEach(function(t){h=h.concat("%c "),u.push("background: "+t),a=t}),u[u.length-1]="color: "+e.bannerTextColor+"; background: "+a):(h=h.concat("%c "),u.push("color: "+e.bannerTextColor+"; background: "+e.bannerBackgroundColor)),u.push("background: #fff"),e.gameTitle&&(h=h.concat(e.gameTitle),e.gameVersion&&(h=h.concat(" v"+e.gameVersion)),e.hidePhaser||(h=h.concat(" / "))),e.hidePhaser||(h=h.concat("Phaser v"+n.VERSION+" ("+i+" | "+s+")")),h=h.concat(" %c "+e.gameURL),u[0]=h,console.log.apply(console,u)}}}},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","crisp-edges","-moz-crisp-edges","-webkit-optimize-contrast","optimize-contrast","pixelated"].forEach(function(e){t.style["image-rendering"]=e}),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(366),s=i(24),r=i(28),o=i(187);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===r.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==r.HEADLESS)if(e.renderType===r.CANVAS||e.renderType!==r.CANVAS&&!o.webGL){if(!o.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=r.CANVAS}else e.renderType=r.WEBGL;e.antialias||s.disableSmoothing();var a,h,u=t.scale.baseSize,l=u.width,c=u.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=l,t.canvas.height=c):t.canvas=s.create(t,l,c,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||n.setCrisp(t.canvas),e.renderType!==r.HEADLESS&&(a=i(459),h=i(456),e.renderType===r.WEBGL?t.renderer=new h(t):(t.renderer=new a(t),t.context=t.renderer.gameContext))}},function(t,e,i){var n=i(0),s=i(182),r=i(370),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(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(16),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],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],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],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},zero:function(){var t=this.val;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=0,this},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){var t=this.val;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},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],s=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=s,t[11]=t[14],t[12]=n,t[13]=r,t[14]=o,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=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15],m=e*o-i*r,y=e*a-n*r,x=e*h-s*r,T=i*a-n*o,w=i*h-s*o,_=n*h-s*a,b=u*p-l*f,A=u*g-c*f,E=u*v-d*f,S=l*g-c*p,C=l*v-d*p,M=c*v-d*g,O=m*M-y*C+x*S+T*E-w*A+_*b;return O?(O=1/O,t[0]=(o*M-a*C+h*S)*O,t[1]=(n*C-i*M-s*S)*O,t[2]=(p*_-g*w+v*T)*O,t[3]=(c*w-l*_-d*T)*O,t[4]=(a*E-r*M-h*A)*O,t[5]=(e*M-n*E+s*A)*O,t[6]=(g*x-f*_-v*y)*O,t[7]=(u*_-c*x+d*y)*O,t[8]=(r*C-o*E+h*b)*O,t[9]=(i*E-e*C-s*b)*O,t[10]=(f*w-p*x+v*m)*O,t[11]=(l*x-u*w-d*m)*O,t[12]=(o*A-r*S-a*b)*O,t[13]=(e*S-i*A+n*b)*O,t[14]=(p*y-f*T-g*m)*O,t[15]=(u*T-l*y+c*m)*O,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],l=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return t[0]=o*(c*v-d*g)-l*(a*v-h*g)+p*(a*d-h*c),t[1]=-(i*(c*v-d*g)-l*(n*v-s*g)+p*(n*d-s*c)),t[2]=i*(a*v-h*g)-o*(n*v-s*g)+p*(n*h-s*a),t[3]=-(i*(a*d-h*c)-o*(n*d-s*c)+l*(n*h-s*a)),t[4]=-(r*(c*v-d*g)-u*(a*v-h*g)+f*(a*d-h*c)),t[5]=e*(c*v-d*g)-u*(n*v-s*g)+f*(n*d-s*c),t[6]=-(e*(a*v-h*g)-r*(n*v-s*g)+f*(n*h-s*a)),t[7]=e*(a*d-h*c)-r*(n*d-s*c)+u*(n*h-s*a),t[8]=r*(l*v-d*p)-u*(o*v-h*p)+f*(o*d-h*l),t[9]=-(e*(l*v-d*p)-u*(i*v-s*p)+f*(i*d-s*l)),t[10]=e*(o*v-h*p)-r*(i*v-s*p)+f*(i*h-s*o),t[11]=-(e*(o*d-h*l)-r*(i*d-s*l)+u*(i*h-s*o)),t[12]=-(r*(l*g-c*p)-u*(o*g-a*p)+f*(o*c-a*l)),t[13]=e*(l*g-c*p)-u*(i*g-n*p)+f*(i*c-n*l),t[14]=-(e*(o*g-a*p)-r*(i*g-n*p)+f*(i*a-n*o)),t[15]=e*(o*c-a*l)-r*(i*c-n*l)+u*(i*a-n*o),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],l=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return(e*o-i*r)*(c*v-d*g)-(e*a-n*r)*(l*v-d*p)+(e*h-s*r)*(l*g-c*p)+(i*a-n*o)*(u*v-d*f)-(i*h-s*o)*(u*g-c*f)+(n*h-s*a)*(u*p-l*f)},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=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],m=e[15],y=t.val,x=y[0],T=y[1],w=y[2],_=y[3];return e[0]=x*i+T*o+w*l+_*p,e[1]=x*n+T*a+w*c+_*g,e[2]=x*s+T*h+w*d+_*v,e[3]=x*r+T*u+w*f+_*m,x=y[4],T=y[5],w=y[6],_=y[7],e[4]=x*i+T*o+w*l+_*p,e[5]=x*n+T*a+w*c+_*g,e[6]=x*s+T*h+w*d+_*v,e[7]=x*r+T*u+w*f+_*m,x=y[8],T=y[9],w=y[10],_=y[11],e[8]=x*i+T*o+w*l+_*p,e[9]=x*n+T*a+w*c+_*g,e[10]=x*s+T*h+w*d+_*v,e[11]=x*r+T*u+w*f+_*m,x=y[12],T=y[13],w=y[14],_=y[15],e[12]=x*i+T*o+w*l+_*p,e[13]=x*n+T*a+w*c+_*g,e[14]=x*s+T*h+w*d+_*v,e[15]=x*r+T*u+w*f+_*m,this},multiplyLocal:function(t){var e=[],i=this.val,n=t.val;return e[0]=i[0]*n[0]+i[1]*n[4]+i[2]*n[8]+i[3]*n[12],e[1]=i[0]*n[1]+i[1]*n[5]+i[2]*n[9]+i[3]*n[13],e[2]=i[0]*n[2]+i[1]*n[6]+i[2]*n[10]+i[3]*n[14],e[3]=i[0]*n[3]+i[1]*n[7]+i[2]*n[11]+i[3]*n[15],e[4]=i[4]*n[0]+i[5]*n[4]+i[6]*n[8]+i[7]*n[12],e[5]=i[4]*n[1]+i[5]*n[5]+i[6]*n[9]+i[7]*n[13],e[6]=i[4]*n[2]+i[5]*n[6]+i[6]*n[10]+i[7]*n[14],e[7]=i[4]*n[3]+i[5]*n[7]+i[6]*n[11]+i[7]*n[15],e[8]=i[8]*n[0]+i[9]*n[4]+i[10]*n[8]+i[11]*n[12],e[9]=i[8]*n[1]+i[9]*n[5]+i[10]*n[9]+i[11]*n[13],e[10]=i[8]*n[2]+i[9]*n[6]+i[10]*n[10]+i[11]*n[14],e[11]=i[8]*n[3]+i[9]*n[7]+i[10]*n[11]+i[11]*n[15],e[12]=i[12]*n[0]+i[13]*n[4]+i[14]*n[8]+i[15]*n[12],e[13]=i[12]*n[1]+i[13]*n[5]+i[14]*n[9]+i[15]*n[13],e[14]=i[12]*n[2]+i[13]*n[6]+i[14]*n[10]+i[15]*n[14],e[15]=i[12]*n[3]+i[13]*n[7]+i[14]*n[11]+i[15]*n[15],this.fromArray(e)},translate:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[12]=s[0]*e+s[4]*i+s[8]*n+s[12],s[13]=s[1]*e+s[5]*i+s[9]*n+s[13],s[14]=s[2]*e+s[6]*i+s[10]*n+s[14],s[15]=s[3]*e+s[7]*i+s[11]*n+s[15],this},translateXYZ:function(t,e,i){var n=this.val;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},scale:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[0]=s[0]*e,s[1]=s[1]*e,s[2]=s[2]*e,s[3]=s[3]*e,s[4]=s[4]*i,s[5]=s[5]*i,s[6]=s[6]*i,s[7]=s[7]*i,s[8]=s[8]*n,s[9]=s[9]*n,s[10]=s[10]*n,s[11]=s[11]*n,this},scaleXYZ:function(t,e,i){var n=this.val;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},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,o=t.y,a=t.z,h=s*r,u=s*o;return this.fromArray([h*r+i,h*o-n*a,h*a+n*o,0,h*o+n*a,u*o+i,u*a-n*r,0,h*a-n*o,u*a+n*r,s*a*a+i,0,0,0,0,1]),this},rotate:function(t,e){var i=this.val,n=e.x,s=e.y,r=e.z,o=Math.sqrt(n*n+s*s+r*r);if(Math.abs(o)<1e-6)return null;n*=o=1/o,s*=o,r*=o;var a=Math.sin(t),h=Math.cos(t),u=1-h,l=i[0],c=i[1],d=i[2],f=i[3],p=i[4],g=i[5],v=i[6],m=i[7],y=i[8],x=i[9],T=i[10],w=i[11],_=n*n*u+h,b=s*n*u+r*a,A=r*n*u-s*a,E=n*s*u-r*a,S=s*s*u+h,C=r*s*u+n*a,M=n*r*u+s*a,O=s*r*u-n*a,P=r*r*u+h;return i[0]=l*_+p*b+y*A,i[1]=c*_+g*b+x*A,i[2]=d*_+v*b+T*A,i[3]=f*_+m*b+w*A,i[4]=l*E+p*S+y*C,i[5]=c*E+g*S+x*C,i[6]=d*E+v*S+T*C,i[7]=f*E+m*S+w*C,i[8]=l*M+p*O+y*P,i[9]=c*M+g*O+x*P,i[10]=d*M+v*O+T*P,i[11]=f*M+m*O+w*P,this},rotateX:function(t){var e=this.val,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},rotateY:function(t){var e=this.val,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},rotateZ:function(t){var e=this.val,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},fromRotationTranslation:function(t,e){var i=this.val,n=t.x,s=t.y,r=t.z,o=t.w,a=n+n,h=s+s,u=r+r,l=n*a,c=n*h,d=n*u,f=s*h,p=s*u,g=r*u,v=o*a,m=o*h,y=o*u;return i[0]=1-(f+g),i[1]=c+y,i[2]=d-m,i[3]=0,i[4]=c-y,i[5]=1-(l+g),i[6]=p+v,i[7]=0,i[8]=d+m,i[9]=p-v,i[10]=1-(l+f),i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},fromQuat:function(t){var e=this.val,i=t.x,n=t.y,s=t.z,r=t.w,o=i+i,a=n+n,h=s+s,u=i*o,l=i*a,c=i*h,d=n*a,f=n*h,p=s*h,g=r*o,v=r*a,m=r*h;return e[0]=1-(d+p),e[1]=l+m,e[2]=c-v,e[3]=0,e[4]=l-m,e[5]=1-(u+p),e[6]=f+g,e[7]=0,e[8]=c+v,e[9]=f-g,e[10]=1-(u+d),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},frustum:function(t,e,i,n,s,r){var o=this.val,a=1/(e-t),h=1/(n-i),u=1/(s-r);return o[0]=2*s*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*s*h,o[6]=0,o[7]=0,o[8]=(e+t)*a,o[9]=(n+i)*h,o[10]=(r+s)*u,o[11]=-1,o[12]=0,o[13]=0,o[14]=r*s*2*u,o[15]=0,this},perspective:function(t,e,i,n){var s=this.val,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},perspectiveLH:function(t,e,i,n){var s=this.val;return s[0]=2*i/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/e,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=-n/(i-n),s[11]=1,s[12]=0,s[13]=0,s[14]=i*n/(i-n),s[15]=0,this},ortho:function(t,e,i,n,s,r){var o=this.val,a=t-e,h=i-n,u=s-r;return a=0===a?a:1/a,h=0===h?h:1/h,u=0===u?u:1/u,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},lookAt:function(t,e,i){var n=this.val,s=t.x,r=t.y,o=t.z,a=i.x,h=i.y,u=i.z,l=e.x,c=e.y,d=e.z;if(Math.abs(s-l)<1e-6&&Math.abs(r-c)<1e-6&&Math.abs(o-d)<1e-6)return this.identity();var f=s-l,p=r-c,g=o-d,v=1/Math.sqrt(f*f+p*p+g*g),m=h*(g*=v)-u*(p*=v),y=u*(f*=v)-a*g,x=a*p-h*f;(v=Math.sqrt(m*m+y*y+x*x))?(m*=v=1/v,y*=v,x*=v):(m=0,y=0,x=0);var T=p*x-g*y,w=g*m-f*x,_=f*y-p*m;return(v=Math.sqrt(T*T+w*w+_*_))?(T*=v=1/v,w*=v,_*=v):(T=0,w=0,_=0),n[0]=m,n[1]=T,n[2]=f,n[3]=0,n[4]=y,n[5]=w,n[6]=p,n[7]=0,n[8]=x,n[9]=_,n[10]=g,n[11]=0,n[12]=-(m*s+y*r+x*o),n[13]=-(T*s+w*r+_*o),n[14]=-(f*s+p*r+g*o),n[15]=1,this},yawPitchRoll:function(t,e,i){this.zero(),s.zero(),r.zero();var n=this.val,o=s.val,a=r.val,h=Math.sin(i),u=Math.cos(i);return n[10]=1,n[15]=1,n[0]=u,n[1]=h,n[4]=-h,n[5]=u,h=Math.sin(e),u=Math.cos(e),o[0]=1,o[15]=1,o[5]=u,o[10]=u,o[9]=-h,o[6]=h,h=Math.sin(t),u=Math.cos(t),a[5]=1,a[15]=1,a[0]=u,a[2]=-h,a[8]=h,a[10]=u,this.multiplyLocal(s),this.multiplyLocal(r),this},setWorldMatrix:function(t,e,i,n,o){return this.yawPitchRoll(t.y,t.x,t.z),s.scaling(i.x,i.y,i.z),r.xyz(e.x,e.y,e.z),this.multiplyLocal(s),this.multiplyLocal(r),void 0!==n&&this.multiplyLocal(n),void 0!==o&&this.multiplyLocal(o),this}}),s=new n,r=new n;t.exports=n},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],m=c[5],y=c[6],x=c[7],T=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+m*h,e[4]=g*n+v*o+m*u,e[5]=g*s+v*a+m*l,e[6]=y*i+x*r+T*h,e[7]=y*n+x*o+T*u,e[8]=y*s+x*a+T*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,m=this.val;return m[0]=1-(c+f),m[3]=u+v,m[6]=l-g,m[1]=u-v,m[4]=1-(h+f),m[7]=d+p,m[2]=l+g,m[5]=d-p,m[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],m=e[14],y=e[15],x=n*h-s*a,T=n*u-r*a,w=n*l-o*a,_=s*u-r*h,b=s*l-o*h,A=r*l-o*u,E=c*v-d*g,S=c*m-f*g,C=c*y-p*g,M=d*m-f*v,O=d*y-p*v,P=f*y-p*m,R=x*P-T*O+w*M+_*C-b*S+A*E;return R?(R=1/R,i[0]=(h*P-u*O+l*M)*R,i[1]=(u*C-a*P-l*S)*R,i[2]=(a*O-h*C+l*E)*R,i[3]=(r*O-s*P-o*M)*R,i[4]=(n*P-r*C+o*S)*R,i[5]=(s*C-n*O-o*E)*R,i[6]=(v*A-m*b+y*_)*R,i[7]=(m*w-g*A-y*T)*R,i[8]=(g*b-v*w+y*x)*R,this):null}});t.exports=n},function(t,e,i){var n=i(3);t.exports=function(t,e,i,s,r,o,a,h){void 0===h&&(h=new n);var u=Math.sin(r),l=Math.cos(r),c=l*o,d=u*o,f=-u*a,p=l*a,g=1/(c*p+f*-d);return h.x=p*g*t+-f*g*e+(s*f-i*p)*g,h.y=c*g*e+-d*g*t+(-s*c+i*d)*g,h}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},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,e){return Math.random()*(e-t)+t}},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e){t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<e-i}},function(t,e){t.exports=function(t,e,i,n){var s=t-i,r=e-n;return s*s+r*r}},function(t,e){t.exports=function(t){return(t%=2*Math.PI)>=0?t:t+2*Math.PI}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e,i){var n=i(20),s=i(19),r={Angle:i(1091),Distance:i(1083),Easing:i(1081),Fuzzy:i(1080),Interpolation:i(1077),Pow2:i(1072),Snap:i(1070),RandomDataGenerator:i(1068),Average:i(1067),Bernstein:i(381),Between:i(184),CatmullRom:i(185),CeilTo:i(1066),Clamp:i(23),DegToRad:i(34),Difference:i(1065),Factorial:i(380),FloatBetween:i(374),FloorTo:i(1064),FromPercent:i(100),GetSpeed:i(1063),IsEven:i(1062),IsEvenStrict:i(1061),Linear:i(129),MaxAdd:i(1060),MinSub:i(1059),Percent:i(1058),RadToDeg:i(183),RandomXY:i(1057),RandomXYZ:i(1056),RandomXYZW:i(1055),Rotate:i(373),RotateAround:i(428),RotateAroundDistance:i(197),RoundAwayFromZero:i(372),RoundTo:i(1054),SinCosTableGenerator:i(1053),SmootherStep:i(196),SmoothStep:i(195),TransformXY:i(371),Within:i(1052),Wrap:i(57),Vector2:i(3),Vector3:i(182),Vector4:i(1051),Matrix3:i(370),Matrix4:i(369),Quaternion:i(368),RotateVec3:i(1050)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n,s,r,o=i(24),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){t.exports={os:i(99),browser:i(128),features:i(187),input:i(1095),audio:i(1094),video:i(1093),fullscreen:i(1092),canvasFeatures:i(388)}},function(t,e,i){var n=i(0),s=i(28),r=i(389),o=i(2),a=i(4),h=i(8),u=i(387),l=i(1),c=i(181),d=i(192),f=new n({initialize:function(t){void 0===t&&(t={});this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.resolution=a(t,"resolution",1),this.parent=a(t,"parent",void 0),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!0),this.autoRound=a(t,"autoRound",!1),this.autoCenter=a(t,"autoCenter",0),this.resizeInterval=a(t,"resizeInterval",500),this.fullscreenTarget=a(t,"fullscreenTarget",null),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.resolution=a(e,"resolution",this.resolution),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"expandParent",this.expandParent),this.autoRound=a(e,"autoRound",this.autoRound),this.autoCenter=a(e,"autoCenter",this.autoCenter),this.resizeInterval=a(e,"resizeInterval",this.resizeInterval),this.fullscreenTarget=a(e,"fullscreenTarget",this.fullscreenTarget),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",s.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.customEnvironment=a(t,"customEnvironment",!1),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),u.RND=new u.RandomDataGenerator(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputKeyboardCapture=a(t,"input.keyboard.capture",[]),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMouseCapture=a(t,"input.mouse.capture",!0),this.inputTouch=a(t,"input.touch",r.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputSmoothFactor=a(t,"input.smoothFactor",0),this.inputQueue=a(t,"input.queue",!1),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio"),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.antialias=a(i,"antialias",!0),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",1!==this.zoom),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",2e3),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",l),this.postBoot=a(t,"callbacks.postBoot",l),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path",""),this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),p=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?p=f.default:Array.isArray(f.defaultMerge)&&(p=p.concat(f.defaultMerge)))),this.defaultPlugins=p;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=s.WEBGL:window.FORCE_CANVAS&&(this.renderType=s.CANVAS))}});t.exports=f},function(t,e,i){t.exports=i(1119)},function(t,e,i){t.exports={In:i(1122),Out:i(1121),InOut:i(1120)}},function(t,e,i){t.exports={In:i(1125),Out:i(1124),InOut:i(1123)}},function(t,e,i){t.exports={In:i(1128),Out:i(1127),InOut:i(1126)}},function(t,e,i){t.exports={In:i(1131),Out:i(1130),InOut:i(1129)}},function(t,e,i){t.exports=i(1132)},function(t,e,i){t.exports={In:i(1135),Out:i(1134),InOut:i(1133)}},function(t,e,i){t.exports={In:i(1138),Out:i(1137),InOut:i(1136)}},function(t,e,i){t.exports={In:i(1141),Out:i(1140),InOut:i(1139)}},function(t,e,i){t.exports={In:i(1144),Out:i(1143),InOut:i(1142)}},function(t,e,i){t.exports={In:i(1147),Out:i(1146),InOut:i(1145)}},function(t,e,i){t.exports={In:i(1150),Out:i(1149),InOut:i(1148)}},function(t,e,i){t.exports={Fade:i(1153),Flash:i(1152),Pan:i(1151),Shake:i(1118),Zoom:i(1117)}},function(t,e,i){var n=i(32);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,i){var n=i(32);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e){t.exports=function(t){return t>16777215?{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(32),s=i(406);t.exports=function(t){var e=s(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,u=r;return r!==s&&(r===t?a=(e-i)/o+(ed.right&&(f=l(f,f+(g-d.right),this.lerp.x)),vd.bottom&&(p=l(p,p+(v-d.bottom),this.lerp.y))):(f=l(f,g-h,this.lerp.x),p=l(p,v-u,this.lerp.y))}this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.roundPixels&&(h=Math.round(h),u=Math.round(u)),this.scrollX=f,this.scrollY=p;var m=f+n,y=p+s;this.midPoint.set(m,y);var x=e/o,T=i/o;this.worldView.setTo(m-x/2,y-T/2,x,T),a.applyITRS(this.x+h,this.y+u,this.rotation,o,o),a.translate(-h,-u),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=o(i,0,1),n=o(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var a=this.width/2,h=this.height/2,u=t.x-s,l=t.y-r;return this.midPoint.set(u,l),this.scrollX=u-a,this.scrollY=l-h,this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},function(t,e,i){var n=i(414),s=i(0),r=i(26),o=new s({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.html=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once(r.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","html","obj","tilemap","xml"],e=0;e-h&&(c-=h,n+=u),f=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,i){t.exports={CHANGE_DATA:i(1238),CHANGE_DATA_KEY:i(1237),REMOVE_DATA:i(1236),SET_DATA:i(1235)}},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,i){var n=i(20),s=i(41),r=i(214),o=i(213),a={_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 o(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=r(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},setRandomPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===n&&(n=this.scene.sys.scale.height),this.x=t+Math.random()*i,this.y=e+Math.random()*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},getLocalTransformMatrix:function(t){return void 0===t&&(t=new s),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new s),void 0===e&&(e=new s);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t}};t.exports=a},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){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,i){var n=new(i(0))({initialize:function(t,e){this.geometryMask=e,this.invertAlpha=!1},setShape:function(t){this.geometryMask=t},preRenderWebGL:function(t,e,i){var n=t.gl,s=this.geometryMask;t.flush(),n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.NOTEQUAL,1,1),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),s.renderWebGL(t,s,0,i),t.flush(),n.colorMask(!0,!0,!0,!0),this.invertAlpha?n.stencilFunc(n.NOTEQUAL,1,1):n.stencilFunc(n.EQUAL,1,1),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)},postRenderWebGL:function(t){var e=t.gl;t.flush(),e.disable(e.STENCIL_TEST)},preRenderCanvas:function(t,e,i){var n=this.geometryMask;t.currentContext.save(),n.renderCanvas(t,n,0,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){var i=t.sys.game.renderer;if(this.renderer=i,this.bitmapMask=e,this.maskTexture=null,this.mainTexture=null,this.dirty=!0,this.mainFramebuffer=null,this.maskFramebuffer=null,this.invertAlpha=!1,i&&i.gl){var n=i.width,s=i.height,r=0==(n&n-1)&&0==(s&s-1),o=i.gl,a=r?o.REPEAT:o.CLAMP_TO_EDGE,h=o.LINEAR;this.mainTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.maskTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.mainFramebuffer=i.createFramebuffer(n,s,this.mainTexture,!1),this.maskFramebuffer=i.createFramebuffer(n,s,this.maskTexture,!1),i.onContextRestored(function(t){var e=t.width,i=t.height,n=0==(e&e-1)&&0==(i&i-1),s=t.gl,r=n?s.REPEAT:s.CLAMP_TO_EDGE,o=s.LINEAR;this.mainTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.maskTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.mainFramebuffer=t.createFramebuffer(e,i,this.mainTexture,!1),this.maskFramebuffer=t.createFramebuffer(e,i,this.maskTexture,!1)},this)}},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BitmapMaskPipeline.beginMask(this,e,i)},postRenderWebGL:function(t){t.pipelines.BitmapMaskPipeline.endMask(this)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null;var t=this.renderer;t&&t.gl&&(t.deleteTexture(this.mainTexture),t.deleteTexture(this.maskTexture),t.deleteFramebuffer(this.mainFramebuffer),t.deleteFramebuffer(this.maskFramebuffer)),this.mainTexture=null,this.maskTexture=null,this.mainFramebuffer=null,this.maskFramebuffer=null,this.renderer=null}});t.exports=n},function(t,e,i){var n=i(426),s=i(425),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t){return void 0===t&&this.texture&&(t=this),new n(this.scene,t)},createGeometryMask:function(t){return void 0===t&&"Graphics"===this.type&&(t=this),new s(this.scene,t)}};t.exports=r},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x-e,a=t.y-i;return t.x=o*s-a*r+e,t.y=o*r+a*s+i,t}},function(t,e,i){var n=i(6);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(204),s=i(135);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=s(t)/i);for(var o=0;o=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},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},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t,e,i){if(!e.length)return NaN;if(1===e.length)return e[0];var n,s,r=1;if(i){if(te.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=i(23),s={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,s){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=n(t,0,1),this._alphaTR=n(e,0,1),this._alphaBL=n(i,0,1),this._alphaBR=n(s,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=n(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=n(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=n(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=n(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=n(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=s},function(t,e){t.exports=function(t){return Math.PI*t.radius*2}},function(t,e,i){var n=i(436),s=i(207),r=i(100),o=i(20);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0&&n>0;if(o&&a){var h=o[0],u=o[1],l=o[2],c=o[3];a=h!==t||u!==e||l!==i||c!==n}a&&(this.flush(),r.scissor(t,s-e-n,i,n))},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},setPipeline:function(t,e){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(e),this.currentPipeline},rebindPipeline:function(t){var e=this.gl;e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.disable(e.STENCIL_TEST),e.clear(e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),e.viewport(0,0,this.width,this.height),this.setBlendMode(0,!0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.blankTexture.glTexture),this.currentActiveTextureUnit=0,this.currentTextures[0]=this.blankTexture.glTexture,this.currentPipeline=t,this.currentPipeline.bind(),this.currentPipeline.onBind()},clearPipeline:function(){this.flush(),this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.setBlendMode(0,!0)},setBlendMode:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.blendModes[t];return!!(e||t!==o.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t)&&(this.flush(),i.enable(i.BLEND),i.blendEquation(n.equation),n.func.length>2?i.blendFuncSeparate(n.func[0],n.func[1],n.func[2],n.func[3]):i.blendFunc(n.func[0],n.func[1]),this.currentBlendMode=t,!0)},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>17&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setBlankTexture:function(t){void 0===t&&(t=!1),!t&&0===this.currentActiveTextureUnit&&this.currentTextures[0]||this.setTexture2D(this.blankTexture.glTexture,0)},setTexture2D:function(t,e,i){void 0===i&&(i=!0);var n=this.gl;return t!==this.currentTextures[e]&&(i&&this.flush(),this.currentActiveTextureUnit!==e&&(n.activeTexture(n.TEXTURE0+e),this.currentActiveTextureUnit=e),n.bindTexture(n.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.width,s=this.height;return t!==this.currentFramebuffer&&(t&&t.renderTexture?(n=t.renderTexture.width,s=t.renderTexture.height):this.flush(),i.bindFramebuffer(i.FRAMEBUFFER,t),i.viewport(0,0,n,s),e&&(t?(this.drawingBufferHeight=s,this.pushScissor(0,0,n,s)):(this.drawingBufferHeight=this.height,this.popScissor())),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 s=this.gl,r=s.NEAREST,h=s.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,a(e,i)&&(h=s.REPEAT),n===o.ScaleModes.LINEAR&&this.config.antialias&&(r=s.LINEAR),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,r,r,h,h,s.RGBA,t):this.createTexture2D(0,r,r,h,h,s.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,u){u=void 0===u||null===u||u;var l=this.gl,c=l.createTexture();return 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){var e=this.nativeTextures.indexOf(t);return-1!==e&&h(this.nativeTextures,e),this.gl.deleteTexture(t),this.currentTextures[0]!==t||this.game.pendingDestroy||this.setBlankTexture(!0),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=t._cx,i=t._cy,n=t._cw,r=t._ch,o=this.pipelines.TextureTintPipeline,a=t.backgroundColor;if(t.renderToTexture){this.flush(),this.pushScissor(e,i,n,-r),this.setFramebuffer(t.framebuffer);var h=this.gl;h.clearColor(0,0,0,0),h.clear(h.COLOR_BUFFER_BIT),o.projOrtho(e,n+e,i,r+i,-1e3,1e3),a.alphaGL>0&&o.drawFillRect(e,i,n+e,r+i,c.getTintFromFloats(a.redGL,a.greenGL,a.blueGL,1),a.alphaGL),t.emit(s.PRE_RENDER,t)}else this.pushScissor(e,i,n,r),a.alphaGL>0&&o.drawFillRect(e,i,n,r,c.getTintFromFloats(a.redGL,a.greenGL,a.blueGL,1),a.alphaGL)},postRenderCamera:function(t){var e=this.pipelines.TextureTintPipeline;if(t.flashEffect.postRenderWebGL(e,c.getTintFromFloats),t.fadeEffect.postRenderWebGL(e,c.getTintFromFloats),t.dirty=!1,this.popScissor(),t.renderToTexture){e.flush(),this.setFramebuffer(null),t.emit(s.POST_RENDER,t),e.projOrtho(0,e.width,e.height,0,-1e3,1e3);var i=c.getTintAppendFloatAlpha;(t.pipeline?t.pipeline:e).batchTexture(t,t.glTexture,t.width,t.height,t.x,t.y,t.width,t.height,t.zoom,t.zoom,t.rotation,t.flipX,!t.flipY,1,1,0,0,0,0,t.width,t.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),t._isTinted&&t.tintFill,0,0,this.defaultCamera,null),this.setBlankTexture(!0)}},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.pipelines;if(t.bindFramebuffer(t.FRAMEBUFFER,null),this.config.clearBeforeRender){var i=this.config.backgroundColor;t.clearColor(i.redGL,i.greenGL,i.blueGL,i.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}for(var n in t.enable(t.SCISSOR_TEST),e)e[n].onPreRender();this.currentScissor=[0,0,this.width,this.height],this.scissorStack=[this.currentScissor],this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.setPipeline(this.pipelines.TextureTintPipeline)}},render:function(t,e,i,n){if(!this.contextLost){var s=e.list,r=s.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var u=0;u=0?g=-(g+d):g<0&&(g=Math.abs(g)-d)),-1===y&&(v>=0?v=-(v+f):v<0&&(v=Math.abs(v)-f))}a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y,o.multiply(a,h)):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY,o.multiply(a,h)),r.save(),h.setToContext(r),r.scale(m,y),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=s,r.drawImage(e.source.image,l,c,d,f,g,v,d/p,f/p),r.restore()}},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e,i){var n=i(205),s=i(0),r=i(136),o=new s({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.once(r.REMOVE_ANIMATION,this.remove,this),this.isPlaying=!1,this.currentAnim=null,this.currentFrame=null,this.nextAnim=null,this._timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this._delay=0,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this.forward=!0,this._reverse=!1,this.accumulator=0,this.nextTick=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},chain:function(t){return t instanceof n&&(t=t.key),this.nextAnim=t,this.parent},setDelay:function(t){return void 0===t&&(t=0),this._delay=t,this.parent},getDelay:function(){return this._delay},delayedPlay:function(t,e,i){return this.play(e,!0,i),this.nextTick+=t,this.parent},getCurrentKey:function(){if(this.currentAnim)return this.currentAnim.key},load:function(t,e){return void 0===e&&(e=0),this.isPlaying&&this.stop(),this.animationManager.load(this,t,e),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.updateFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.updateFrame(t),this.parent},isPaused:{get:function(){return this._paused}},play:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),t instanceof n&&(t=t.key),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!0,this._reverse=!1,this._startAnimation(t,i))},playReverse:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),t instanceof n&&(t=t.key),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!1,this._reverse=!0,this._startAnimation(t,i))},_startAnimation:function(t,e){this.load(t,e);var i=this.currentAnim,n=this.parent;this.repeatCounter=-1===this._repeat?Number.MAX_VALUE:this._repeat,i.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,i.showOnStart&&(n.visible=!0);var s=this.currentFrame;return i.emit(r.ANIMATION_START,i,s,n),n.emit(r.SPRITE_ANIMATION_KEY_START+t,i,s,n),n.emit(r.SPRITE_ANIMATION_START,i,s,n),n},reverse:function(){return this.isPlaying&&(this._reverse=!this._reverse,this.forward=!this.forward),this.parent},getProgress:function(){var t=this.currentFrame.progress;return this.forward||(t=1-t),t},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},remove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},getRepeat:function(){return this._repeat},setRepeat:function(t){return this._repeat=t,this.repeatCounter=0,this.parent},getRepeatDelay:function(){return this._repeatDelay},setRepeatDelay:function(t){return this._repeatDelay=t,this.parent},restart:function(t){void 0===t&&(t=!1);var e=this.currentAnim;e.getFirstTick(this,t),this.forward=!0,this.isPlaying=!0,this.pendingRepeat=!1,this._paused=!1,this.updateFrame(e.frames[0]);var i=this.parent,n=this.currentFrame;return e.emit(r.ANIMATION_RESTART,e,n,i),i.emit(r.SPRITE_ANIMATION_KEY_RESTART+e.key,e,n,i),i.emit(r.SPRITE_ANIMATION_RESTART,e,n,i),this.parent},stop:function(){this._pendingStop=0,this.isPlaying=!1;var t=this.parent,e=this.currentAnim,i=this.currentFrame;if(e&&(e.emit(r.ANIMATION_COMPLETE,e,i,t),t.emit(r.SPRITE_ANIMATION_KEY_COMPLETE+e.key,e,i,t),t.emit(r.SPRITE_ANIMATION_COMPLETE,e,i,t)),this.nextAnim){var n=this.nextAnim;this.nextAnim=null,this.play(n)}return t},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopOnRepeat:function(){return this._pendingStop=2,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},setTimeScale:function(t){return void 0===t&&(t=1),this._timeScale=t,this.parent},getTimeScale:function(){return this._timeScale},getTotalFrames:function(){return this.currentAnim.frames.length},update:function(t,e){if(this.currentAnim&&this.isPlaying&&!this.currentAnim.paused){if(this.accumulator+=e*this._timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.currentAnim.completeAnimation(this);this.accumulator>=this.nextTick&&this.currentAnim.setFrame(this)}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),e.setSizeToFrame(),t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin(),e},updateFrame:function(t){var e=this.setCurrentFrame(t);if(this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;e.emit(r.SPRITE_ANIMATION_KEY_UPDATE+i.key,i,t,e),e.emit(r.SPRITE_ANIMATION_UPDATE,i,t,e),3===this._pendingStop&&this._pendingStopValue===t&&this.currentAnim.completeAnimation(this)}},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},setYoyo:function(t){return void 0===t&&(t=!1),this._yoyo=t,this.parent},getYoyo:function(){return this._yoyo},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.remove,this),this.animationManager=null,this.parent=null,this.currentAnim=null,this.currentFrame=null}});t.exports=o},function(t,e){t.exports=function(t){return t.split("").reverse().join("")}},function(t,e){t.exports=function(t,e){return t.replace(/%([0-9]+)/g,function(t,i){return e[Number(i)-1]})}},function(t,e,i){t.exports={Format:i(462),Pad:i(193),Reverse:i(461),UppercaseFirst:i(330),UUID:i(299)}},function(t,e,i){var n=i(70);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){t.exports=function(t,e){for(var i=0;i-1&&(e.state=h.REMOVED,s.splice(r,1)):(e.state=h.REMOVED,n.splice(r,1))}for(i.length=0,i=this._add,t=0;t-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&&(t.currentPipeline&&t.currentPipeline.vertexCount>0&&t.flush(),r.vertexBuffer=e.vertexBuffer[a],t.setPipeline(r),t.setTexture2D(s[a].glTexture,0),t.gl.drawArrays(r.topology,0,e.vertexCount[a]));r.vertexBuffer=o,r.viewIdentity(),r.modelIdentity()}},function(t,e,i){var n=i(1),s=i(1);n=i(484),s=i(483),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){t.exports=function(t,e,i,n,s){e.cull(n);var r=e.culledTiles,o=r.length;if(0!==o){var a=t._tempMatrix1,h=t._tempMatrix2,u=t._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(n.matrix);var l=t.currentContext,c=e.gidMap;l.save(),s?(a.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,u),u.copyToContext(l)):(h.e-=n.scrollX*e.scrollFactorX,h.f-=n.scrollY*e.scrollFactorY,h.copyToContext(l));for(var d=n.alpha*e.alpha,f=0;f-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(19);t.exports=function(t){for(var e,i,s,r,o,a=0;a1){if(Array.isArray(u.tiles)){for(var c={},d={},f=0;f>>0;return n}},function(t,e,i){var n=i(497),s=i(2),r=i(84),o=i(230),a=i(61);t.exports=function(t,e){for(var i=[],h=0;h0){var m=new a(l,v.gid,c,f.length,t.tilewidth,t.tileheight);m.rotation=v.rotation,m.flipX=v.flipped,d.push(m)}else{var y=e?null:new a(l,-1,c,f.length,t.tilewidth,t.tileheight);d.push(y)}++c===u.width&&(f.push(d),c=0,d=[])}l.data=f,i.push(l)}}return i}},function(t,e,i){t.exports={Parse:i(233),Parse2DArray:i(145),ParseCSV:i(232),Impact:i(226),Tiled:i(231)}},function(t,e,i){var n=i(54),s=i(53),r=i(3);t.exports=function(t,e,i,o,a,h){return void 0===o&&(o=new r(0,0)),o.x=n(t,i,a,h),o.y=s(e,i,a,h),o}},function(t,e,i){var n=i(21);t.exports=function(t,e,i,s,r,o){if(void 0!==r){var a,h=n(t,e,i,s,null,o),u=0;for(a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e,i){var n=i(62),s=i(37),r=i(91);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;ae)){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(62),s=i(37),r=i(146);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;a=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;r=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);else if(2===r)for(a=x;a>=y;a--)for(o=v;c[a]&&o=y;a--)for(o=m;c[a]&&o>=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);return l.tilesDrawn=i.length,l.tilesTotal=d*f,i}},function(t,e,i){var n=i(108),s=i(107),r=i(21),o=i(236);t.exports=function(t,e,i,a,h,u){void 0===i&&(i={}),Array.isArray(t)||(t=[t]);var l=u.tilemapLayer;void 0===a&&(a=l.scene),void 0===h&&(h=a.cameras.main);var c,d=r(0,0,u.width,u.height,null,u),f=[];for(c=0;c=0&&p=0&&g=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(r.UPDATE,this.step,this),t.events.emit(r.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n),this},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(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)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(r.SHUTDOWN,this.shutdown,this),t.off(r.POST_UPDATE,this.step,this),t.off(r.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});a.register("ScenePlugin",h,"scenePlugin"),t.exports=h},function(t,e,i){var n=i(124),s=i(19),r={Events:i(16),SceneManager:i(332),ScenePlugin:i(534),Settings:i(329),Systems:i(176)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(19),s=i(178),r={Center:i(349),Events:i(334),Orientation:i(348),ScaleManager:i(335),ScaleModes:i(347),Zoom:i(346)};r=n(!1,r=n(!1,r=n(!1,r=n(!1,r,s.CENTER),s.ORIENTATION),s.SCALE_MODE),s.ZOOM),t.exports=r},function(t,e,i){var n=i(237),s=i(0),r=i(16),o=new s({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){}});t.exports=o},function(t,e,i){t.exports={BasePlugin:i(237),DefaultPlugins:i(181),PluginCache:i(17),PluginManager:i(336),ScenePlugin:i(537)}},,,,,,,,,,,function(t,e,i){var n=i(245);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){var n=i(246);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){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,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(551);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.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,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(553);t.exports=function(t,e,i,s,r){var o=0;return t.deltaX()<0&&!t.blocked.left&&e.collideRight&&t.checkCollision.left?e.faceRight&&t.x0&&!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,i){var n=i(554),s=i(552),r=i(242);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,m=0,y=1;if(e.deltaAbsX()>e.deltaAbsY()?m=-1:e.deltaAbsX()=0;a--){var h=e[a],u=o(s,r,h.x,h.y);u=0;a--){var h=e[a],u=o(s,r,h.x,h.y);u>i&&(n=h,i=u)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var o=Math.atan2(i-t.y,e-t.x);return s>0&&(n=r(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(o,n),o},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),void 0===i&&(i=new d),i.setToPolar(s(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new d),i.setToPolar(t,e)},shutdown:function(){if(this.world){var t=this.systems.events;t.off(c.UPDATE,this.world.update,this.world),t.off(c.POST_UPDATE,this.world.postUpdate,this.world),t.off(c.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off(c.START,this.start,this),this.scene=null,this.systems=null}});l.register("ArcadePhysics",p,"arcadePhysics"),t.exports=p},function(t,e,i){var n=i(38),s=i(19),r={ArcadePhysics:i(576),Body:i(249),Collider:i(247),Factory:i(255),Group:i(252),Image:i(254),Sprite:i(111),StaticBody:i(241),StaticGroup:i(251),World:i(250)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(0),s=i(15),r=i(102),o=i(11),a=i(75),h=i(7),u=i(2),l=i(17),c=i(16),d=i(112),f=new n({Extends:o,initialize:function(t){o.call(this);var e=t.sys.game.config,i=t.sys.settings.loader;this.scene=t,this.systems=t.sys,this.cacheManager=t.sys.cache,this.textureManager=t.sys.textures,this.sceneManager=t.sys.game.scene,h.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(u(i,"baseURL",e.loaderBaseURL)),this.setPath(u(i,"path",e.loaderPath)),this.setPrefix(u(i,"prefix",e.loaderPrefix)),this.maxParallelDownloads=u(i,"maxParallelDownloads",e.loaderMaxParallelDownloads),this.xhr=d(u(i,"responseType",e.loaderResponseType),u(i,"async",e.loaderAsync),u(i,"user",e.loaderUser),u(i,"password",e.loaderPassword),u(i,"timeout",e.loaderTimeout)),this.crossOrigin=u(i,"crossOrigin",e.loaderCrossOrigin),this.totalToLoad=0,this.progress=0,this.list=new r,this.inflight=new r,this.queue=new r,this._deleteQueue=new r,this.totalFailed=0,this.totalComplete=0,this.state=s.LOADER_IDLE,t.sys.events.once(c.BOOT,this.boot,this),t.sys.events.on(c.START,this.pluginStart,this)},boot:function(){this.systems.events.once(c.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(c.SHUTDOWN,this.shutdown,this)},setBaseURL:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.baseURL=t,this},setPath:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.path=t,this},setPrefix:function(t){return void 0===t&&(t=""),this.prefix=t,this},setCORS:function(t){return this.crossOrigin=t,this},addFile:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(a.START,this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(c.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(a.PROGRESS,this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=s.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0&&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,i){var n=i(0),s=i(11),r=i(113),o=i(26),a=i(4),h=i(52),u=i(114),l=i(261),c=i(125),d=i(260),f=i(608),p=i(98),g=new n({Extends:s,initialize:function(t){s.call(this),this.game=t.systems.game,this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.manager=t.manager.keyboard,this.enabled=!0,this.keys=[],this.combos=[],t.pluginEvents.once(h.BOOT,this.boot,this),t.pluginEvents.on(h.START,this.start,this)},boot:function(){var t=this.settings.input;this.enabled=a(t,"keyboard",!0);var e=a(t,"keyboard.capture",null);e&&this.addCaptures(e),this.sceneInputPlugin.pluginEvents.once(h.DESTROY,this.destroy,this)},start:function(){this.sceneInputPlugin.manager.useQueue?this.sceneInputPlugin.pluginEvents.on(h.UPDATE,this.update,this):this.sceneInputPlugin.manager.events.on(h.MANAGER_PROCESS,this.update,this),this.sceneInputPlugin.pluginEvents.once(h.SHUTDOWN,this.shutdown,this),this.game.events.on(o.BLUR,this.resetKeys,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},addCapture:function(t){return this.manager.addCapture(t),this},removeCapture:function(t){return this.manager.removeCapture(t),this},getCaptures:function(){return this.manager.captures},enableGlobalCapture:function(){return this.manager.preventDefault=!0,this},disableGlobalCapture:function(){return this.manager.preventDefault=!1,this},clearCaptures:function(){return this.manager.clearCaptures(),this},createCursorKeys:function(){return this.addKeys({up:c.UP,down:c.DOWN,left:c.LEFT,right:c.RIGHT,space:c.SPACE,shift:c.SHIFT})},addKeys:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1);var n={};if("string"==typeof t){t=t.split(",");for(var s=0;s-1?n[s]=t:n[t.keyCode]=t,e&&this.addCapture(t.keyCode),t.setEmitOnRepeat(i),t}return"string"==typeof t&&(t=c[t.toUpperCase()]),n[t]||(n[t]=new l(t),e&&this.addCapture(t),n[t].setEmitOnRepeat(i)),n[t]},removeKey:function(t){var e=this.keys;if(t instanceof l){var i=e.indexOf(t);i>-1&&(this.keys[i]=void 0)}else"string"==typeof t&&(t=c[t.toUpperCase()]);return e[t]&&(e[t]=void 0),this},createCombo:function(t,e){return new d(this,t,e)},checkDown:function(t,e){if(this.enabled&&t.isDown){var i=p(this.time-t.timeDown,e);if(i>t._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n=e}}},function(t,e,i){var n=i(77),s=i(43),r=i(0),o=i(265),a=i(621),h=i(56),u=i(96),l=i(95),c=i(52),d=i(11),f=i(2),p=i(114),g=i(8),v=i(17),m=i(10),y=i(42),x=i(16),T=i(65),w=i(74),_=new r({Extends:d,initialize:function(t){d.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new d,this.enabled=!0,this.displayList,this.cameras,p.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],t.sys.events.once(x.BOOT,this.boot,this),t.sys.events.on(x.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(x.DESTROY,this.destroy,this),this.pluginEvents.emit(c.BOOT)},start:function(){var t=this.systems.events;t.on(x.TRANSITION_START,this.transitionIn,this),t.on(x.TRANSITION_OUT,this.transitionOut,this),t.on(x.TRANSITION_COMPLETE,this.transitionComplete,this),t.on(x.PRE_UPDATE,this.preUpdate,this),this.manager.useQueue&&t.on(x.UPDATE,this.update,this),t.once(x.SHUTDOWN,this.shutdown,this),this.manager.events.on(c.GAME_OUT,this.onGameOut,this),this.manager.events.on(c.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(c.START)},onGameOver:function(t){this.isActive()&&this.emit(c.GAME_OVER,t.timeStamp,t)},onGameOut:function(t){this.isActive()&&this.emit(c.GAME_OUT,t.timeStamp,t)},preUpdate:function(){this.pluginEvents.emit(c.PRE_UPDATE);var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,n=e.length;if(0!==i||0!==n){for(var s=this._list,r=0;r-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._pendingRemoval.length=0,this._list=s.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},update:function(t,e){if(this.isActive()){var i=this.manager;if(this.pluginEvents.emit(c.UPDATE,t,e),!i.globalTopOnly||!i.ignoreEvents){var n=i.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(n=!0,this._pollTimer=this.pollRate)),n)for(var s=this.manager.pointers,r=this.manager.pointersTotal,o=0;o0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}}},clear:function(t){var e=t.input;if(e){this.queueForRemoval(t),e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,this.manager.resetCursor(e),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&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,s}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,s=this._eventContainer;n.cancelled=!1;for(var r=!1,o=0;o0?this.setDragState(t,1):this.getDragState(t)>0&&!t.primaryDown&&t.justUp&&this.setDragState(t,5),1===this.getDragState(t)){var a=[];for(i=0;i1&&(this.sortGameObjects(a),this.topOnly&&a.splice(1)),this._drag[t.id]=a,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?this.setDragState(t,3):this.setDragState(t,2)}if(2===this.getDragState(t)&&(this.dragDistanceThreshold>0&&h(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&this.setDragState(t,3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&this.setDragState(t,3)),3===this.getDragState(t)){for(s=this._drag[t.id],i=0;i0?(n.emit(c.GAMEOBJECT_DRAG_LEAVE,t,r.target),this.emit(c.DRAG_LEAVE,t,n,r.target),r.target=u[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target)):(n.emit(c.GAMEOBJECT_DRAG_LEAVE,t,r.target),this.emit(c.DRAG_LEAVE,t,n,r.target),u[0]?(r.target=u[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target)):r.target=null)}else!r.target&&u[0]&&(r.target=u[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target));var d=t.x-n.input.dragX,f=t.y-n.input.dragY;n.emit(c.GAMEOBJECT_DRAG,t,d,f),this.emit(c.DRAG,t,n,d,f)}return s.length}if(5===this.getDragState(t)){for(s=this._drag[t.id],i=0;i0){for(this.sortGameObjects(s),e=0;e0){for(this.sortGameObjects(r),e=0;e-1&&this._draggable.splice(s,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return a(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,s=!1,r=!1,a=!1;if(g(e)){var h=e;e=f(h,"hitArea",null),i=f(h,"hitAreaCallback",null),n=f(h,"draggable",!1),s=f(h,"dropZone",!1),r=f(h,"cursor",!1),a=f(h,"useHandCursor",!1);var u=f(h,"pixelPerfect",!1),l=f(h,"alphaTolerance",1);u&&(e={},i=this.makePixelPerfect(l)),e&&i||this.setHitAreaFromTexture(t)}else"function"!=typeof e||i||(i=e,e={});for(var c=0;c0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)e.x&&t.ye.y}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},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,i){var n=Math.min(t.x,e),s=Math.max(t.right,e);t.x=n,t.width=s-n;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},function(t,e){t.exports=function(t,e){var i=Math.min(t.x,e.x),n=Math.max(t.right,e.right);t.x=i,t.width=n-i;var s=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=s,t.height=r-s,t}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;on(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,i){var n=i(155);t.exports=function(t,e){var i=n(t);return ii&&(i=h.x),h.xr&&(r=h.y),h.ye.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(74),s=i(115);t.exports=function(t,e){return!!(n(t,e.getPointA())||n(t,e.getPointB())||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},function(t,e,i){var n=i(277),s=i(74);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottomt.right+r||it.bottom+r||st.right||e.rightt.bottom||e.bottom0}},function(t,e,i){var n=i(276);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){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(10),s=i(158);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=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(56);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){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(10);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){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(95);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,i){var n=i(95);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(96);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(96);n.Area=i(734),n.Circumference=i(309),n.CircumferencePoint=i(166),n.Clone=i(733),n.Contains=i(95),n.ContainsPoint=i(732),n.ContainsRect=i(731),n.CopyFrom=i(730),n.Equals=i(729),n.GetBounds=i(728),n.GetPoint=i(311),n.GetPoints=i(310),n.Offset=i(727),n.OffsetPoint=i(726),n.Random=i(199),t.exports=n},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(10);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){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e,i){var n=i(43);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,i){var n=i(43);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(77);t.exports=function(t){return new n(t.x,t.y,t.radius)}},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(77);n.Area=i(744),n.Circumference=i(436),n.CircumferencePoint=i(207),n.Clone=i(743),n.Contains=i(43),n.ContainsPoint=i(742),n.ContainsRect=i(741),n.CopyFrom=i(740),n.Equals=i(739),n.GetBounds=i(738),n.GetPoint=i(438),n.GetPoints=i(437),n.Offset=i(737),n.OffsetPoint=i(736),n.Random=i(206),t.exports=n},function(t,e,i){var n=i(0),s=i(280),r=i(17),o=i(16),a=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once(o.BOOT,this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on(o.SHUTDOWN,this.shutdown,this),t.on(o.DESTROY,this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",a,"lights"),t.exports=a},function(t,e,i){var n=i(30),s=i(14),r=i(12),o=i(159);s.register("quad",function(t,e){void 0===t&&(t={});var i=r(t,"x",0),s=r(t,"y",0),a=r(t,"key",null),h=r(t,"frame",null),u=new o(this.scene,i,s,a,h);return void 0!==e&&(t.add=e),n(this.scene,u,t),u})},function(t,e,i){var n=i(30),s=i(14),r=i(12),o=i(4),a=i(116);s.register("mesh",function(t,e){void 0===t&&(t={});var i=r(t,"key",null),s=r(t,"frame",null),h=o(t,"vertices",[]),u=o(t,"colors",[]),l=o(t,"alphas",[]),c=o(t,"uv",[]),d=new a(this.scene,0,0,h,c,u,l,i,s);return void 0!==e&&(t.add=e),n(this.scene,d,t),d})},function(t,e,i){var n=i(159);i(5).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(116);i(5).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){t.exports=function(){}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=this.pipeline;t.setPipeline(o,e);var a=o._tempMatrix1,h=o._tempMatrix2,u=o._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(s.matrix),r?(a.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,u)):(h.e-=s.scrollX*e.scrollFactorX,h.f-=s.scrollY*e.scrollFactorY,a.multiply(h,u));var l=e.frame.glTexture,c=e.vertices,d=e.uv,f=e.colors,p=e.alphas,g=c.length,v=Math.floor(.5*g);o.vertexCount+v>o.vertexCapacity&&o.flush(),o.setTexture2D(l,0);for(var m=o.vertexViewF32,y=o.vertexViewU32,x=o.vertexCount*o.vertexComponentCount-1,T=0,w=e.tintFill,_=0;_0)for(l=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.fillColor,e.fillAlpha*d),l.TL=c,l.TR=c,l.BL=c,l.BR=c,C=0;C0)for(l=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.altFillColor,e.altFillAlpha*d),l.TL=c,l.TR=c,l.BL=c,l.BR=c,C=0;C0){var R=o.strokeTint,L=n.getTintAppendFloatAlphaAndSwap(e.outlineFillColor,e.outlineFillAlpha*d);for(R.TL=L,R.TR=L,R.BL=L,R.BR=L,S=1;Sr;h--){for(u=0;u2?o[a++]:"",n=o[a++]||"16px",i=o[a++]||"Courier"}return i===this.fontFamily&&n===this.fontSize&&s===this.fontStyle||(this.fontFamily=i,this.fontSize=n,this.fontStyle=s,e&&this.update(!0)),this.parent},setFontFamily:function(t){return this.fontFamily!==t&&(this.fontFamily=t,this.update(!0)),this.parent},setFontStyle:function(t){return this.fontStyle!==t&&(this.fontStyle=t,this.update(!0)),this.parent},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize!==t&&(this.fontSize=t,this.update(!0)),this.parent},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.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)},setResolution:function(t){return this.resolution=t,this.update(!1)},setStroke:function(t,e){return void 0===e&&(e=this.strokeThickness),void 0===t&&0!==this.strokeThickness?(this.strokeThickness=0,this.update(!0)):this.stroke===t&&this.strokeThickness===e||(this.stroke=t,this.strokeThickness=e,this.update(!0)),this.parent},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){t.exports=function(t,e,i,n,s){""!==e.text&&t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){if(""!==e.text){var o=e.frame,a=o.width,h=o.height,u=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,u(e._tintTL,s.alpha*e._alphaTL),u(e._tintTR,s.alpha*e._alphaTR),u(e._tintBL,s.alpha*e._alphaBL),u(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r)}}},function(t,e,i){var n=i(1),s=i(1);n=i(832),s=i(831),t.exports={renderWebGL:n,renderCanvas:s}},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.maxLines1&&(d+=f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(4);t.exports=function(t,e){var i=e.width,s=e.height,r=Math.floor(i/2),o=Math.floor(s/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),u=n(e,"offset.x",0),l=n(e,"offset.y",0),c=n(e,"spacing.x",0),d=n(e,"spacing.y",0),f=n(e,"lineSpacing",0),p=n(e,"charsPerRow",null);null===p&&(p=t.sys.textures.getFrame(h).width/i)>a.length&&(p=a.length);for(var g=u,v=l,m={retroFont:!0,font:h,size:i,lineHeight:s+f,chars:{}},y=0,x=0;x?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(836),s=i(19),r={Parse:i(835)};r=s(!1,r,n),t.exports=r},function(t,e){t.exports=function(t,e,i,n,s){t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=e.frame,a=o.width,h=o.height,u=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a,h,e.scaleX,e.scaleY,e.rotation,e.flipX,!e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,u(e._tintTL,s.alpha*e._alphaTL),u(e._tintTR,s.alpha*e._alphaTR),u(e._tintBL,s.alpha*e._alphaBL),u(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r),t.setBlankTexture(!0)}},function(t,e,i){var n=i(1),s=i(1);n=i(839),s=i(838),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){t.exports={DeathZone:i(304),EdgeZone:i(303),RandomZone:i(301)}},function(t,e){t.exports=function(t,e,i,n,s){var r=e.emitters.list,o=r.length;if(0!==o){var a=t._tempMatrix1.copyFrom(n.matrix),h=t._tempMatrix2,u=t._tempMatrix3,l=t._tempMatrix4.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);a.multiply(l);var c=n.roundPixels,d=t.currentContext;d.save();for(var f=0;f0&&(N=N%_-_):N>_?N=_:N<0&&(N=_+N%_),null===S&&(S=new o(k+Math.cos(Y)*B,I+Math.sin(Y)*B,v),b.push(S),D+=.01);D<1+z;)w=N*D+Y,x=k+Math.cos(w)*B,T=I+Math.sin(w)*B,S.points.push(new r(x,T,v)),D+=.01;w=N+Y,x=k+Math.cos(w)*B,T=I+Math.sin(w)*B,S.points.push(new r(x,T,v));break;case n.FILL_RECT:l.setTexture2D(M),l.batchFillRect(p[++O],p[++O],p[++O],p[++O],f,c);break;case n.FILL_TRIANGLE:l.setTexture2D(M),l.batchFillTriangle(p[++O],p[++O],p[++O],p[++O],p[++O],p[++O],f,c);break;case n.STROKE_TRIANGLE:l.setTexture2D(M),l.batchStrokeTriangle(p[++O],p[++O],p[++O],p[++O],p[++O],p[++O],v,f,c);break;case n.LINE_TO:null!==S?S.points.push(new r(p[++O],p[++O],v)):(S=new o(p[++O],p[++O],v),b.push(S));break;case n.MOVE_TO:S=new o(p[++O],p[++O],v),b.push(S);break;case n.SAVE:a.push(f.copyToArray());break;case n.RESTORE:f.copyFromArray(a.pop());break;case n.TRANSLATE:k=p[++O],I=p[++O],f.translate(k,I);break;case n.SCALE:k=p[++O],I=p[++O],f.scale(k,I);break;case n.ROTATE:f.rotate(p[++O]);break;case n.SET_TEXTURE:var U=p[++O],G=p[++O];l.currentFrame=U,l.setTexture2D(U.glTexture,0),l.tintEffect=G,M=U.glTexture;break;case n.CLEAR_TEXTURE:l.currentFrame=t.blankTexture,l.tintEffect=2,M=t.blankTexture.glTexture}}}},function(t,e,i){var n=i(1),s=i(1);n=i(853),s=i(308),s=i(308),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){},function(t,e){t.exports=function(t,e,i,n,s){var r=t.currentPipeline;t.clearPipeline();var o=t._tempMatrix1,a=t._tempMatrix2,h=t._tempMatrix3;a.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),o.copyFrom(n.matrix),s?(o.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),a.e=e.x,a.f=e.y,o.multiply(a,h)):(a.e-=n.scrollX*e.scrollFactorX,a.f-=n.scrollY*e.scrollFactorY,o.multiply(a,h)),e.render.call(e,t,n,h),t.rebindPipeline(r)}},function(t,e,i){var n=i(1),s=i(1);n=i(856),s=i(855),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(25);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length,h=t.currentContext;if(0!==a&&n(t,h,e,s,r)){var u=e.frame,l=e.displayCallback,c=e.callbackData,d=s.scrollX*e.scrollFactorX,f=s.scrollY*e.scrollFactorY,p=e.fontData.chars,g=e.fontData.lineHeight,v=0,m=0,y=0,x=0,T=null,w=0,_=0,b=0,A=0,E=0,S=0,C=null,M=0,O=e.frame.source.image,P=u.cutX,R=u.cutY,L=0,F=e.fontSize/e.fontData.size;e.cropWidth>0&&e.cropHeight>0&&(h.beginPath(),h.rect(0,0,e.cropWidth,e.cropHeight),h.clip());for(var D=0;D0||e.cropHeight>0;u&&(h.flush(),t.pushScissor(e.x,e.y,e.cropWidth*e.scaleX,e.cropHeight*e.scaleY));var l=h._tempMatrix1,c=h._tempMatrix2,d=h._tempMatrix3,f=h._tempMatrix4;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),l.copyFrom(s.matrix),r?(l.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,l.multiply(c,d)):(c.e-=s.scrollX*e.scrollFactorX,c.f-=s.scrollY*e.scrollFactorY,l.multiply(c,d));var p=e.frame,g=p.glTexture,v=p.cutX,m=p.cutY,y=g.width,x=g.height,T=e._isTinted&&e.tintFill,w=n.getTintAppendFloatAlpha(e._tintTL,s.alpha*e._alphaTL),_=n.getTintAppendFloatAlpha(e._tintTR,s.alpha*e._alphaTR),b=n.getTintAppendFloatAlpha(e._tintBL,s.alpha*e._alphaBL),A=n.getTintAppendFloatAlpha(e._tintBR,s.alpha*e._alphaBR);h.setTexture2D(g,0);var E,S,C=0,M=0,O=0,P=0,R=e.letterSpacing,L=0,F=0,D=0,k=0,I=e.scrollX,B=e.scrollY,Y=e.fontData,N=Y.chars,X=Y.lineHeight,z=e.fontSize/Y.size,U=0,G=e._align,W=0,V=0;e.getTextBounds(!1);var H=e._bounds.lines;1===G?V=(H.longest-H.lengths[0])/2:2===G&&(V=H.longest-H.lengths[0]);for(var j=s.roundPixels,q=e.displayCallback,K=e.callbackData,J=0;Jv&&(r=v),o>m&&(o=m);var P=v+g.xAdvance,R=m+l;aE&&(E=C),CE&&(E=C),C-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;i0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e),s=t.indexOf(i);return-1!==n&&-1===s&&(t[n]=i,!0)}},function(t,e,i){var n=i(97);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return n(t,s)}},function(t,e,i){var n=i(68);t.exports=function(t,e,i,s,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(s)for(var h=0;ht.length-1)throw new Error("Index out of bounds");var r=n(t,e);return i&&i.call(s,r),r}},function(t,e,i){var n=i(372);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var s=[],r=Math.max(n((e-t)/(i||1)),0),o=0;o=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var n=t[i-1],s=t.indexOf(n);t[i]=n,t[s]=e}return t}},function(t,e,i){var n=i(68);t.exports=function(t,e,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=t.length),n(t,s,r))for(var o=s;o0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),s&&s.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var u=e[h];t.splice(i,0,u),s&&s.call(r,u)}return e}},function(t,e){t.exports=function(t,e,i,n,s){if(void 0===s&&(s=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(s,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.pop(),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;ax||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var S=u,C=u,M=0,O=e.sourceIndex,P=0;Pg||c<-g)&&(c=0),c<0&&(c=g+c),-1!==d&&(g=c+(d+1));for(var v=f,m=f,y=0,x=0,T=0;Tr&&(y=w-r),_>o&&(x=_-o),t.add(T,e,i+v,s+m,h-y,u-x),(v+=h+p)+h>r&&(v=f,m+=u+p)}return t}},function(t,e,i){var n=i(70);t.exports=function(t,e,i){if(i.frames){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);var r,o=i.frames;for(var a in o){var h=o[a];r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h),h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted()),r.customData=n(h)}for(var u in i)"frames"!==u&&(Array.isArray(i[u])?t.customData[u]=i[u].slice(0):t.customData[u]=i[u]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},function(t,e,i){var n=i(70);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;a-1){var o=this.context.getImageData(t,e,1,1);o.data[0]=i,o.data[1]=n,o.data[2]=s,o.data[3]=r,this.context.putImageData(o,t,e)}return this},putData:function(t,e,i,n,s,r,o){return void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=t.width),void 0===o&&(o=t.height),this.context.putImageData(t,e,i,n,s,r,o),this},getData:function(t,e,i,n){return t=s(Math.floor(t),0,this.width-1),e=s(Math.floor(e),0,this.height-1),i=s(i,1,this.width-t),n=s(n,1,this.height-e),this.context.getImageData(t,e,i,n)},getPixel:function(t,e,i){i||(i=new r);var n=this.getIndex(t,e);if(n>-1){var s=this.data,o=s[n+0],a=s[n+1],h=s[n+2],u=s[n+3];i.setTo(o,a,h,u)}return i},getPixels:function(t,e,i,n){void 0===n&&(n=i),t=Math.abs(Math.round(t)),e=Math.abs(Math.round(e));for(var o=s(t,0,this.width),a=s(t+i,0,this.width),h=s(e,0,this.height),u=s(e+n,0,this.height),l=new r,c=[],d=h;d>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e){t.exports=function(t,e){void 0===e&&(e="none");return["-webkit-","-khtml-","-moz-","-ms-",""].forEach(function(i){t.style[i+"user-select"]=e}),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},function(t,e,i){t.exports={CanvasInterpolation:i(366),CanvasPool:i(24),Smoothing:i(130),TouchAction:i(1007),UserSelect:i(1006)}},function(t,e){t.exports=function(t){return t.height*t.originY}},function(t,e){t.exports=function(t){return t.width*t.originX}},function(t,e,i){t.exports={CenterOn:i(444),GetBottom:i(51),GetCenterX:i(81),GetCenterY:i(78),GetLeft:i(49),GetOffsetX:i(1010),GetOffsetY:i(1009),GetRight:i(47),GetTop:i(45),SetBottom:i(50),SetCenterX:i(80),SetCenterY:i(79),SetLeft:i(48),SetRight:i(46),SetTop:i(44)}},function(t,e,i){var n=i(47),s=i(45),r=i(50),o=i(46);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(49),s=i(45),r=i(50),o=i(48);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)-a),t}},function(t,e,i){var n=i(81),s=i(45),r=i(50),o=i(80);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(47),s=i(45),r=i(48),o=i(44);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(78),s=i(47),r=i(79),o=i(48);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(51),s=i(47),r=i(50),o=i(48);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(45),r=i(46),o=i(44);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(78),s=i(49),r=i(79),o=i(46);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(51),s=i(49),r=i(50),o=i(46);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(51),s=i(47),r=i(46),o=i(44);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){var n=i(51),s=i(49),r=i(48),o=i(44);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)+a),t}},function(t,e,i){var n=i(51),s=i(81),r=i(80),o=i(44);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){t.exports={BottomCenter:i(1023),BottomLeft:i(1022),BottomRight:i(1021),LeftBottom:i(1020),LeftCenter:i(1019),LeftTop:i(1018),RightBottom:i(1017),RightCenter:i(1016),RightTop:i(1015),TopCenter:i(1014),TopLeft:i(1013),TopRight:i(1012)}},function(t,e,i){t.exports={BottomCenter:i(448),BottomLeft:i(447),BottomRight:i(446),Center:i(445),LeftCenter:i(443),QuickSet:i(449),RightCenter:i(442),TopCenter:i(441),TopLeft:i(440),TopRight:i(439)}},function(t,e,i){var n=i(208),s=i(19),r={In:i(1025),To:i(1024)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Align:i(1026),Bounds:i(1011),Canvas:i(1008),Color:i(354),Masks:i(999)}},function(t,e,i){var n=i(0),s=i(134),r=i(17),o=i(16),a=new n({Extends:s,initialize:function(t){s.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.events=this.systems.events,this.events.once(o.DESTROY,this.destroy,this)},start:function(){this.events.once(o.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.systems.events.off(o.SHUTDOWN,this.shutdown,this)},destroy:function(){s.prototype.destroy.call(this),this.events.off(o.START,this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",a,"data"),t.exports=a},function(t,e,i){t.exports={DataManager:i(134),DataManagerPlugin:i(1028),Events:i(420)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e){this.active=!1,this.p0=new s(t,e)},getPoint:function(t,e){return void 0===e&&(e=new s),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},function(t,e,i){var n=i(0),s=i(359),r=i(358),o=i(5),a=i(357),h=i(1030),u=i(356),l=i(10),c=i(355),d=i(3),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,r,o){var a,h,u,l=this.getEndPoint();return t instanceof d?(a=t,h=e,u=i):(a=new d(i,n),h=new d(r,o),u=new d(t,e)),this.add(new s(l,a,h,u))},quadraticBezierTo:function(t,e,i,n){var s,r,o=this.getEndPoint();return t instanceof d?(s=t,r=e):(s=new d(i,n),r=new d(t,e)),this.add(new u(o,s,r))},draw:function(t,e){for(var i=0;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;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){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},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;o1?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,i){return Math.max(t-e,i)}},function(t,e){t.exports=function(t,e,i){return Math.min(t+e,i)}},function(t,e){t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t,e){return t/e/1e3}},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.floor(t*n)/n}},function(t,e){t.exports=function(t,e){return Math.abs(t-e)}},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.ceil(t*n)/n}},function(t,e){t.exports=function(t){for(var e=0,i=0;i>>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;e0;e--){var i=Math.floor(this.frac()*(e+1)),n=t[i];t[i]=t[e],t[e]=n}return t}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.round(t/e),n?(i+t)/e:i+t)}},function(t,e,i){t.exports={Ceil:i(375),Floor:i(98),To:i(1069)}},function(t,e){t.exports=function(t){return t>0&&0==(t&t-1)}},function(t,e,i){t.exports={GetNext:i(376),IsSize:i(127),IsValue:i(1071)}},function(t,e,i){var n=i(196);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){var n=i(129);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,i){var n=i(185);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return t[0]===t[i]?(e<0&&(r=Math.floor(s=i*(1+e))),n(s-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(n(-s,t[0],t[0],t[1],t[1])-t[0]):e>1?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[i=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e=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,i){var n=i(99),s=i(128),r={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=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){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,u=[],l=!1,c=-1;function d(){l&&h&&(l=!1,h.length?u=h.concat(u):c=-1,u.length&&f())}function f(){if(!l){var t=a(d);l=!0;for(var e=u.length;e;){for(h=u,u=[];++c1)for(var i=1;i0&&(o.preRender(1),t.render(n,e,i,o))}},resetAll:function(){for(var t=0;t=1?1:1/e*(1+(e*t|0))}},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){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:1-Math.cos(t*Math.PI/2)}},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--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return t*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 1- --t*t*t*t}},function(t,e){t.exports=function(t){return t*t*t*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*(2-t)}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return 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 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},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,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),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},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){return--t*t*t+1}},function(t,e){t.exports=function(t){return t*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 Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},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 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){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,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,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e,i){var n=i(23),s=i(0),r=i(188),o=i(40),a=i(3),h=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new a,this.current=new a,this.destination=new a,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,a,h){void 0===i&&(i=1e3),void 0===n&&(n=r.Linear),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene);var u=this.camera;return!s&&this.isRunning?u:(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(u.scrollX,u.scrollY),this.destination.set(t,e),u.getScroll(t,e,this.current),"string"==typeof n&&r.hasOwnProperty(n)?this.ease=r[n]:"function"==typeof n&&(this.ease=n),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.camera.emit(o.PAN_START,this.camera,this,i,t,e),u)},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var s=this.camera;if(this._elapsed0?(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){var n=i(0),s=i(4),r=new n({initialize:function(t){this.camera=s(t,"camera",null),this.left=s(t,"left",null),this.right=s(t,"right",null),this.up=s(t,"up",null),this.down=s(t,"down",null),this.zoomIn=s(t,"zoomIn",null),this.zoomOut=s(t,"zoomOut",null),this.zoomSpeed=s(t,"zoomSpeed",.01),this.speedX=0,this.speedY=0;var e=s(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=s(t,"speed.x",0),this.speedY=s(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoom<.1&&(e.zoom=.1)):this.zoomOut&&this.zoomOut.isDown&&(e.zoom+=this.zoomSpeed)}},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={FixedKeyControl:i(1171),SmoothedKeyControl:i(1170)}},function(t,e,i){t.exports={Controls:i(1172),Scene2D:i(1169)}},function(t,e){t.exports="remove"},function(t,e){t.exports="add"},function(t,e,i){t.exports={BaseCache:i(414),CacheManager:i(412),Events:i(413)}},function(t,e){t.exports="visible"},function(t,e){t.exports="step"},function(t,e){t.exports="resume"},function(t,e){t.exports="ready"},function(t,e){t.exports="prestep"},function(t,e){t.exports="prerender"},function(t,e){t.exports="poststep"},function(t,e){t.exports="postrender"},function(t,e){t.exports="pause"},function(t,e){t.exports="hidden"},function(t,e){t.exports="focus"},function(t,e){t.exports="destroy"},function(t,e){t.exports="boot"},function(t,e){t.exports="blur"},function(t,e,i){t.exports={Animation:i(205),AnimationFrame:i(433),AnimationManager:i(415),Events:i(136)}},function(t,e,i){var n=i(57);t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=0;s1)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?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,_isTinted:!1,tintFill:!1,clearTint:function(){return this.setTint(16777215),this._isTinted=!1,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._isTinted=!0,this.tintFill=!1,this},setTintFill:function(t,e,i,n){return this.setTint(t,e,i,n),this.tintFill=!0,this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t),this._isTinted=!0}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t),this._isTinted=!0}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t),this._isTinted=!0}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t),this._isTinted=!0}},tint:{set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){return this._isTinted}}};t.exports=n},function(t,e){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},function(t,e){var i={texture:null,frame:null,isCropped:!1,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),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,i){var n=i(101),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={_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(10),s=i(428),r=i(3),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,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getTopRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomLeft:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBounds:function(t){var e,i,s,r,o,a,h,u;if(void 0===t&&(t=new n),this.parentContainer){var l=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),l.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),l.transformPoint(t.x,t.y,t),s=t.x,r=t.y,this.getBottomLeft(t),l.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),l.transformPoint(t.x,t.y,t),h=t.x,u=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),s=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),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){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){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},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}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},function(t,e){t.exports="animationupdate"},function(t,e){t.exports="animationstart"},function(t,e){t.exports="animationrestart"},function(t,e){t.exports="animationrepeat"},function(t,e){t.exports="animationupdate-"},function(t,e){t.exports="animationstart-"},function(t,e){t.exports="animationrestart-"},function(t,e){t.exports="animationrepeat-"},function(t,e){t.exports="animationcomplete-"},function(t,e){t.exports="animationcomplete"},function(t,e){t.exports="resumeall"},function(t,e){t.exports="remove"},function(t,e){t.exports="pauseall"},function(t,e){t.exports="start"},function(t,e){t.exports="restart"},function(t,e){t.exports="repeat"},function(t,e){t.exports="complete"},function(t,e){t.exports="add"},function(t,e,i){var n=i(449),s=i(208),r=i(2),o=i(1),a=new(i(137))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1);t.exports=function(t,e){void 0===e&&(e={});var i=r(e,"width",-1),o=r(e,"height",-1),h=r(e,"cellWidth",1),u=r(e,"cellHeight",h),l=r(e,"position",s.TOP_LEFT),c=r(e,"x",0),d=r(e,"y",0),f=0,p=0,g=i*h,v=o*u;a.setPosition(c,d),a.setSize(h,u);for(var m=0;m>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -323,7 +338,7 @@ module.exports = Class; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -366,7 +381,7 @@ module.exports = GetFastValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -393,7 +408,7 @@ module.exports = NOOP; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -856,14 +871,14 @@ var Vector2 = new Class({ }, /** - * [description] + * Calculate the cross product of this Vector and the given Vector. * * @method Phaser.Math.Vector2#cross * @since 3.0.0 * - * @param {Phaser.Math.Vector2} src - [description] + * @param {Phaser.Math.Vector2} src - The Vector2 to cross with this Vector2. * - * @return {number} [description] + * @return {number} The cross product of this Vector and the given Vector. */ cross: function (src) { @@ -960,14 +975,76 @@ var Vector2 = new Class({ /** * A static zero Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. * * @constant * @name Phaser.Math.Vector2.ZERO - * @type {Vector2} + * @type {Phaser.Math.Vector2} * @since 3.1.0 */ Vector2.ZERO = new Vector2(); +/** + * A static right Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.RIGHT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.RIGHT = new Vector2(1, 0); + +/** + * A static left Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.LEFT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.LEFT = new Vector2(-1, 0); + +/** + * A static up Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.UP + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.UP = new Vector2(0, -1); + +/** + * A static down Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.DOWN + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.DOWN = new Vector2(0, 1); + +/** + * A static one Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.ONE + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.ONE = new Vector2(1, 1); + module.exports = Vector2; @@ -977,7 +1054,7 @@ module.exports = Vector2; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1007,7 +1084,7 @@ var GetValue = function (source, key, defaultValue) { return source[key]; } - else if (key.indexOf('.')) + else if (key.indexOf('.') !== -1) { var keys = key.split('.'); var parent = source; @@ -1048,12 +1125,13 @@ module.exports = GetValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -1116,8 +1194,8 @@ var GameObjectFactory = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -1133,7 +1211,7 @@ var GameObjectFactory = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -1147,7 +1225,7 @@ var GameObjectFactory = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1188,7 +1266,7 @@ var GameObjectFactory = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1203,7 +1281,7 @@ var GameObjectFactory = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -1235,7 +1313,7 @@ module.exports = GameObjectFactory; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1316,12 +1394,16 @@ module.exports = Point; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var types = {}; +/** + * @namespace Phaser.Loader.FileTypesManager + */ + var FileTypesManager = { /** @@ -1330,7 +1412,7 @@ var FileTypesManager = { * Loops through the local types object and injects all of them as * properties into the LoaderPlugin instance. * - * @method Phaser.Loader.FileTypesManager.register + * @method Phaser.Loader.FileTypesManager.install * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. @@ -1381,7 +1463,7 @@ module.exports = FileTypesManager; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1433,12 +1515,355 @@ module.exports = IsPlainObject; /***/ }), /* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var has = Object.prototype.hasOwnProperty + , prefix = '~'; + +/** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ +function Events() {} + +// +// We try to not inherit from `Object.prototype`. In some engines creating an +// instance in this way is faster than calling `Object.create(null)` directly. +// If `Object.create(null)` is not supported we prefix the event names with a +// character to make sure that the built-in object properties are not +// overridden or used as an attack vector. +// +if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; +} + +/** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ +function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; +} + +/** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ +function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); + } + + var listener = new EE(fn, context || emitter, once) + , evt = prefix ? prefix + event : event; + + if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; + else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); + else emitter._events[evt] = [emitter._events[evt], listener]; + + return emitter; +} + +/** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ +function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) emitter._events = new Events(); + else delete emitter._events[evt]; +} + +/** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ +function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; +} + +/** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ +EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) return names; + + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; +}; + +/** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ +EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event + , handlers = this._events[evt]; + + if (!handlers) return []; + if (handlers.fn) return [handlers.fn]; + + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } + + return ee; +}; + +/** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ +EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event + , listeners = this._events[evt]; + + if (!listeners) return 0; + if (listeners.fn) return 1; + return listeners.length; +}; + +/** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ +EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; +}; + +/** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); +}; + +/** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); +}; + +/** + * Remove the listeners of a given event. + * + * @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. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return this; + if (!fn) { + clearEvent(this, evt); + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn && + (!once || listeners.once) && + (!context || listeners.context === context) + ) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn || + (once && !listeners[i].once) || + (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else clearEvent(this, evt); + } + + return this; +}; + +/** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) clearEvent(this, evt); + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; +}; + +// +// Alias methods names because people roll like that. +// +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; +EventEmitter.prototype.addListener = EventEmitter.prototype.on; + +// +// Expose the prefix. +// +EventEmitter.prefixed = prefix; + +// +// Allow `EventEmitter` to be imported as module namespace. +// +EventEmitter.EventEmitter = EventEmitter; + +// +// Expose the module. +// +if (true) { + module.exports = EventEmitter; +} + + +/***/ }), +/* 10 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1455,8 +1880,8 @@ module.exports = { * @since 3.0.0 * * @param {number} r - Red component in a range from 0.0 to 1.0 - * @param {number} g - [description] - * @param {number} b - [description] + * @param {number} g - Green component in a range from 0.0 to 1.0 + * @param {number} b - Blue component in a range from 0.0 to 1.0 * @param {number} a - Alpha component in a range from 0.0 to 1.0 * * @return {number} [description] @@ -1567,21 +1992,21 @@ module.exports = { /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(43); -var GetPoint = __webpack_require__(209); -var GetPoints = __webpack_require__(434); -var Line = __webpack_require__(60); -var Random = __webpack_require__(206); +var Contains = __webpack_require__(47); +var GetPoint = __webpack_require__(225); +var GetPoints = __webpack_require__(468); +var Line = __webpack_require__(65); +var Random = __webpack_require__(222); /** * @classdesc @@ -2065,349 +2490,6 @@ var Rectangle = new Class({ module.exports = Rectangle; -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var has = Object.prototype.hasOwnProperty - , prefix = '~'; - -/** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ -function Events() {} - -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} - -/** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ -function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; -} - -/** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ -function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ -EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; -}; - -/** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ -EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); -}; - -/** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); -}; - -/** - * Remove the listeners of a given event. - * - * @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. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if (true) { - module.exports = EventEmitter; -} - - /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { @@ -2970,7 +3052,7 @@ module.exports = Common; }; })(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(213))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(230))) /***/ }), /* 13 */ @@ -2978,51 +3060,52 @@ module.exports = Common; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH = __webpack_require__(18); +var MATH = __webpack_require__(20); var GetValue = __webpack_require__(4); -// Allowed types: - -// Implicit -// { -// x: 4 -// } -// -// From function -// { -// x: function () -// } -// -// Randomly pick one element from the array -// { -// x: [a, b, c, d, e, f] -// } -// -// Random integer between min and max: -// { -// x: { randInt: [min, max] } -// } -// -// Random float between min and max: -// { -// x: { randFloat: [min, max] } -// } - /** - * [description] + * Retrieves a value from an object. Allows for more advanced selection options, including: + * + * Allowed types: + * + * Implicit + * { + * x: 4 + * } + * + * From function + * { + * x: function () + * } + * + * Randomly pick one element from the array + * { + * x: [a, b, c, d, e, f] + * } + * + * Random integer between min and max: + * { + * x: { randInt: [min, max] } + * } + * + * Random float between min and max: + * { + * x: { randFloat: [min, max] } + * } + * * * @function Phaser.Utils.Objects.GetAdvancedValue * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] - * @param {*} defaultValue - [description] + * @param {object} source - The object to retrieve the value from. + * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. + * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. * - * @return {*} [description] + * @return {*} The value of the requested key. */ var GetAdvancedValue = function (source, key, defaultValue) { @@ -3064,12 +3147,54 @@ module.exports = GetAdvancedValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Components + */ + +module.exports = { + + Alpha: __webpack_require__(474), + Animation: __webpack_require__(473), + BlendMode: __webpack_require__(470), + ComputedSize: __webpack_require__(1335), + Crop: __webpack_require__(1334), + Depth: __webpack_require__(469), + Flip: __webpack_require__(1333), + GetBounds: __webpack_require__(1332), + Mask: __webpack_require__(465), + Origin: __webpack_require__(1331), + Pipeline: __webpack_require__(144), + ScaleMode: __webpack_require__(1330), + ScrollFactor: __webpack_require__(462), + Size: __webpack_require__(1329), + Texture: __webpack_require__(1328), + TextureCrop: __webpack_require__(1327), + Tint: __webpack_require__(1326), + ToJSON: __webpack_require__(461), + Transform: __webpack_require__(460), + TransformMatrix: __webpack_require__(46), + Visible: __webpack_require__(459) + +}; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -3133,8 +3258,8 @@ var GameObjectCreator = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -3150,7 +3275,7 @@ var GameObjectCreator = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -3164,7 +3289,7 @@ var GameObjectCreator = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -3177,7 +3302,7 @@ var GameObjectCreator = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -3192,7 +3317,7 @@ var GameObjectCreator = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -3218,12 +3343,50 @@ module.exports = GameObjectCreator; /***/ }), -/* 15 */ +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scenes.Events + */ + +module.exports = { + + BOOT: __webpack_require__(1202), + DESTROY: __webpack_require__(1201), + PAUSE: __webpack_require__(1200), + POST_UPDATE: __webpack_require__(1199), + PRE_UPDATE: __webpack_require__(1198), + READY: __webpack_require__(1197), + RENDER: __webpack_require__(1196), + RESUME: __webpack_require__(1195), + SHUTDOWN: __webpack_require__(1194), + SLEEP: __webpack_require__(1193), + START: __webpack_require__(1192), + TRANSITION_COMPLETE: __webpack_require__(1191), + TRANSITION_INIT: __webpack_require__(1190), + TRANSITION_OUT: __webpack_require__(1189), + TRANSITION_START: __webpack_require__(1188), + TRANSITION_WAKE: __webpack_require__(1187), + UPDATE: __webpack_require__(1186), + WAKE: __webpack_require__(1185) + +}; + + +/***/ }), +/* 17 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -3253,6 +3416,10 @@ var customPlugins = {}; var PluginCache = {}; +/** + * @namespace Phaser.Plugins.PluginCache + */ + /** * Static method called directly by the Core internal Plugins. * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) @@ -3439,60 +3606,20 @@ module.exports = PluginCache; /***/ }), -/* 16 */ +/* 18 */ /***/ (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.GameObjects.Components - */ - -module.exports = { - - Alpha: __webpack_require__(438), - Animation: __webpack_require__(437), - BlendMode: __webpack_require__(436), - ComputedSize: __webpack_require__(1117), - Crop: __webpack_require__(1116), - Depth: __webpack_require__(435), - Flip: __webpack_require__(1115), - GetBounds: __webpack_require__(1114), - Mask: __webpack_require__(431), - Origin: __webpack_require__(1113), - Pipeline: __webpack_require__(133), - ScaleMode: __webpack_require__(1112), - ScrollFactor: __webpack_require__(428), - Size: __webpack_require__(1111), - Texture: __webpack_require__(1110), - TextureCrop: __webpack_require__(1109), - Tint: __webpack_require__(1108), - ToJSON: __webpack_require__(427), - Transform: __webpack_require__(426), - TransformMatrix: __webpack_require__(42), - Visible: __webpack_require__(425) - -}; - - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var ComponentsToJSON = __webpack_require__(427); -var DataManager = __webpack_require__(102); -var EventEmitter = __webpack_require__(11); +var ComponentsToJSON = __webpack_require__(461); +var DataManager = __webpack_require__(109); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(143); /** * @classdesc @@ -3540,6 +3667,22 @@ var GameObject = new Class({ */ this.type = type; + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could move from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.GameObject#state + * @type {(integer|string)} + * @since 3.16.0 + */ + this.state = 0; + /** * The parent Container of this Game Object, if it has one. * @@ -3696,6 +3839,30 @@ var GameObject = new Class({ return this; }, + /** + * Sets the current state of this Game Object. + * + * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @method Phaser.GameObjects.GameObject#setState + * @since 3.16.0 + * + * @param {(integer|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. + */ + setState: function (value) + { + this.state = value; + + return this; + }, + /** * Adds a Data Manager component to this Game Object. * @@ -3748,7 +3915,7 @@ var GameObject = new Class({ * When the value is first set, a `setdata` event is emitted from this Game Object. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. @@ -3939,7 +4106,7 @@ var GameObject = new Class({ */ willRender: function (camera) { - return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id))); + return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); }, /** @@ -4000,8 +4167,9 @@ var GameObject = new Class({ * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. * * @method Phaser.GameObjects.GameObject#destroy + * @fires Phaser.GameObjects.Events#DESTROY * @since 3.0.0 - * + * * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown? */ destroy: function (fromScene) @@ -4019,7 +4187,7 @@ var GameObject = new Class({ this.preDestroy.call(this); } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); var sys = this.scene.sys; @@ -4078,178 +4246,13 @@ GameObject.RENDER_MASK = 15; module.exports = GameObject; -/***/ }), -/* 18 */ -/***/ (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 RND = __webpack_require__(441); - -var MATH_CONST = { - - /** - * The value of PI * 2. - * - * @name Phaser.Math.PI2 - * @type {number} - * @since 3.0.0 - */ - PI2: Math.PI * 2, - - /** - * The value of PI * 0.5. - * - * @name Phaser.Math.TAU - * @type {number} - * @since 3.0.0 - */ - TAU: Math.PI * 0.5, - - /** - * An epsilon value (1.0e-6) - * - * @name Phaser.Math.EPSILON - * @type {number} - * @since 3.0.0 - */ - EPSILON: 1.0e-6, - - /** - * For converting degrees to radians (PI / 180) - * - * @name Phaser.Math.DEG_TO_RAD - * @type {number} - * @since 3.0.0 - */ - DEG_TO_RAD: Math.PI / 180, - - /** - * For converting radians to degrees (180 / PI) - * - * @name Phaser.Math.RAD_TO_DEG - * @type {number} - * @since 3.0.0 - */ - RAD_TO_DEG: 180 / Math.PI, - - /** - * An instance of the Random Number Generator. - * - * @name Phaser.Math.RND - * @type {Phaser.Math.RandomDataGenerator} - * @since 3.0.0 - */ - RND: new RND() - -}; - -module.exports = MATH_CONST; - - /***/ }), /* 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 GetFastValue = __webpack_require__(1); - -/** - * @typedef {object} GetTilesWithinFilteringOptions - * - * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. - * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - */ - -/** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @function Phaser.Tilemaps.Components.GetTilesWithin - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. - */ -var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) -{ - if (tileX === undefined) { tileX = 0; } - if (tileY === undefined) { tileY = 0; } - if (width === undefined) { width = layer.width; } - if (height === undefined) { height = layer.height; } - - var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); - var isColliding = GetFastValue(filteringOptions, 'isColliding', false); - var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - - // Clip x, y to top left of map, while shrinking width/height to match. - if (tileX < 0) - { - width += tileX; - tileX = 0; - } - if (tileY < 0) - { - height += tileY; - tileY = 0; - } - - // Clip width and height to bottom right of map. - if (tileX + width > layer.width) - { - width = Math.max(layer.width - tileX, 0); - } - if (tileY + height > layer.height) - { - height = Math.max(layer.height - tileY, 0); - } - - var results = []; - - for (var ty = tileY; ty < tileY + height; ty++) - { - for (var tx = tileX; tx < tileX + width; tx++) - { - var tile = layer.data[ty][tx]; - if (tile !== null) - { - if (isNotEmpty && tile.index === -1) { continue; } - if (isColliding && !tile.collides) { continue; } - if (hasInterestingFace && !tile.hasInterestingFace) { continue; } - results.push(tile); - } - } - } - - return results; -}; - -module.exports = GetTilesWithin; - - -/***/ }), -/* 20 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4395,13 +4398,85 @@ var FILE_CONST = { module.exports = FILE_CONST; +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var MATH_CONST = { + + /** + * The value of PI * 2. + * + * @name Phaser.Math.PI2 + * @type {number} + * @since 3.0.0 + */ + PI2: Math.PI * 2, + + /** + * The value of PI * 0.5. + * + * @name Phaser.Math.TAU + * @type {number} + * @since 3.0.0 + */ + TAU: Math.PI * 0.5, + + /** + * An epsilon value (1.0e-6) + * + * @name Phaser.Math.EPSILON + * @type {number} + * @since 3.0.0 + */ + EPSILON: 1.0e-6, + + /** + * For converting degrees to radians (PI / 180) + * + * @name Phaser.Math.DEG_TO_RAD + * @type {number} + * @since 3.0.0 + */ + DEG_TO_RAD: Math.PI / 180, + + /** + * For converting radians to degrees (180 / PI) + * + * @name Phaser.Math.RAD_TO_DEG + * @type {number} + * @since 3.0.0 + */ + RAD_TO_DEG: 180 / Math.PI, + + /** + * An instance of the Random Number Generator. + * This is not set until the Game boots. + * + * @name Phaser.Math.RND + * @type {Phaser.Math.RandomDataGenerator} + * @since 3.0.0 + */ + RND: null + +}; + +module.exports = MATH_CONST; + + /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4417,7 +4492,7 @@ var IsPlainObject = __webpack_require__(8); * @function Phaser.Utils.Objects.Extend * @since 3.0.0 * - * @return {object} [description] + * @return {object} The extended object. */ var Extend = function () { @@ -4500,17 +4575,110 @@ module.exports = Extend; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetFastValue = __webpack_require__(1); + +/** + * @typedef {object} GetTilesWithinFilteringOptions + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ + +/** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithin + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) +{ + if (tileX === undefined) { tileX = 0; } + if (tileY === undefined) { tileY = 0; } + if (width === undefined) { width = layer.width; } + if (height === undefined) { height = layer.height; } + + var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); + var isColliding = GetFastValue(filteringOptions, 'isColliding', false); + var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); + + // Clip x, y to top left of map, while shrinking width/height to match. + if (tileX < 0) + { + width += tileX; + tileX = 0; + } + if (tileY < 0) + { + height += tileY; + tileY = 0; + } + + // Clip width and height to bottom right of map. + if (tileX + width > layer.width) + { + width = Math.max(layer.width - tileX, 0); + } + if (tileY + height > layer.height) + { + height = Math.max(layer.height - tileY, 0); + } + + var results = []; + + for (var ty = tileY; ty < tileY + height; ty++) + { + for (var tx = tileX; tx < tileX + width; tx++) + { + var tile = layer.data[ty][tx]; + if (tile !== null) + { + if (isNotEmpty && tile.index === -1) { continue; } + if (isColliding && !tile.collides) { continue; } + if (hasInterestingFace && !tile.hasInterestingFace) { continue; } + results.push(tile); + } + } + } + + return results; +}; + +module.exports = GetTilesWithin; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(20); +var CONST = __webpack_require__(19); +var Events = __webpack_require__(85); var GetFastValue = __webpack_require__(1); -var GetURL = __webpack_require__(157); -var MergeXHRSettings = __webpack_require__(156); -var XHRLoader = __webpack_require__(282); -var XHRSettings = __webpack_require__(115); +var GetURL = __webpack_require__(170); +var MergeXHRSettings = __webpack_require__(169); +var XHRLoader = __webpack_require__(289); +var XHRSettings = __webpack_require__(122); /** * @typedef {object} FileConfig @@ -4815,7 +4983,9 @@ var File = new Class({ */ onLoad: function (xhr, event) { - var success = !(event.target && event.target.status !== 200); + var localFileOk = ((xhr.responseURL && xhr.responseURL.indexOf('file://') === 0 && event.target.status === 0)); + + var success = !(event.target && event.target.status !== 200) || localFileOk; // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) @@ -4834,6 +5004,7 @@ var File = new Class({ * @method Phaser.Loader.File#onError * @since 3.0.0 * + * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error. */ onError: function () @@ -4847,6 +5018,7 @@ var File = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.File#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 * * @param {ProgressEvent} event - The DOM ProgressEvent. @@ -4860,7 +5032,7 @@ var File = new Class({ this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); } }, @@ -4948,65 +5120,13 @@ var File = new Class({ this.pendingDestroy(); }, - /** - * You can listen for this event from the LoaderPlugin. It is dispatched _every time_ - * a file loads and is sent 3 arguments, which allow you to identify the file: - * - * ```javascript - * this.load.on('filecomplete', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#fileCompleteEvent - * @param {string} key - The key of the file that just loaded and finished processing. - * @param {string} type - The type of the file that just loaded and finished processing. - * @param {any} data - The data of the file. - */ - - /** - * You can listen for this event from the LoaderPlugin. It is dispatched only once per - * file and you have to use a special listener handle to pick it up. - * - * The string of the event is based on the file type and the key you gave it, split up - * using hyphens. - * - * For example, if you have loaded an image with a key of `monster`, you can listen for it - * using the following: - * - * ```javascript - * this.load.on('filecomplete-image-monster', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a texture atlas with a key of `Level1`: - * - * ```javascript - * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: - * - * ```javascript - * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#singleFileCompleteEvent - * @param {any} data - The data of the file. - */ - /** * Called once the file has been added to its cache and is now ready for deletion from the Loader. * It will emit a `filecomplete` event from the LoaderPlugin. * * @method Phaser.Loader.File#pendingDestroy - * @fires Phaser.Loader.File#fileCompleteEvent - * @fires Phaser.Loader.File#singleFileCompleteEvent + * @fires Phaser.Loader.Events#FILE_COMPLETE + * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE * @since 3.7.0 */ pendingDestroy: function (data) @@ -5016,8 +5136,8 @@ var File = new Class({ var key = this.key; var type = this.type; - this.loader.emit('filecomplete', key, type, data); - this.loader.emit('filecomplete-' + type + '-' + key, key, type, data); + this.loader.emit(Events.FILE_COMPLETE, key, type, data); + this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data); this.loader.flagForRemoval(this); }, @@ -5092,12 +5212,42 @@ module.exports = File; /***/ }), -/* 23 */ +/* 24 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -5105,12 +5255,12 @@ module.exports = File; * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix * and then performs the following steps: * - * 1) Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2) Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3) Sets the blend mode of the context to be that used by the Game Object. - * 4) Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5) Saves the context state. - * 6) Sets the final matrix values into the context via setTransform. + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. * * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. * @@ -5177,37 +5327,268 @@ module.exports = SetTransform; /***/ }), -/* 24 */ -/***/ (function(module, exports) { +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CONST = __webpack_require__(30); +var Smoothing = __webpack_require__(140); + +// The pool into which the canvas elements are placed. +var pool = []; + +// Automatically apply smoothing(false) to created Canvas elements +var _disableContextSmoothing = false; + /** - * Force a value within the boundaries by clamping it to the range `min`, `max`. + * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. + * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, + * which is useless for some of the Phaser pipelines / renderer. * - * @function Phaser.Math.Clamp + * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. + * Which means all instances of Phaser Games on the same page can share the one single pool. + * + * @namespace Phaser.Display.Canvas.CanvasPool * @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) +var CanvasPool = function () { - return Math.max(min, Math.min(max, value)); + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? + * + * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool + */ + var create = function (parent, width, height, canvasType, selfParent) + { + if (width === undefined) { width = 1; } + if (height === undefined) { height = 1; } + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } + + var canvas; + var container = first(canvasType); + + if (container === null) + { + container = { + parent: parent, + canvas: document.createElement('canvas'), + type: canvasType + }; + + if (canvasType === CONST.CANVAS) + { + pool.push(container); + } + + canvas = container.canvas; + } + else + { + container.parent = parent; + + canvas = container.canvas; + } + + if (selfParent) + { + container.parent = canvas; + } + + canvas.width = width; + canvas.height = height; + + if (_disableContextSmoothing && canvasType === CONST.CANVAS) + { + Smoothing.disable(canvas.getContext('2d')); + } + + return canvas; + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create2D + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created canvas. + */ + var create2D = function (parent, width, height) + { + return create(parent, width, height, CONST.CANVAS); + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.createWebGL + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created WebGL canvas. + */ + var createWebGL = function (parent, width, height) + { + return create(parent, width, height, CONST.WEBGL); + }; + + /** + * Gets the first free canvas index from the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.first + * @since 3.0.0 + * + * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * + * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + */ + var first = function (canvasType) + { + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + + if (canvasType === CONST.WEBGL) + { + return null; + } + + for (var i = 0; i < pool.length; i++) + { + var container = pool[i]; + + if (!container.parent && container.type === canvasType) + { + return container; + } + } + + return null; + }; + + /** + * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. + * The canvas has its width and height set to 1, and its parent attribute nulled. + * + * @function Phaser.Display.Canvas.CanvasPool.remove + * @since 3.0.0 + * + * @param {*} parent - The canvas or the parent of the canvas to free. + */ + var remove = function (parent) + { + // Check to see if the parent is a canvas object + var isCanvas = parent instanceof HTMLCanvasElement; + + pool.forEach(function (container) + { + if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) + { + container.parent = null; + container.canvas.width = 1; + container.canvas.height = 1; + } + }); + }; + + /** + * Gets the total number of used canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.total + * @since 3.0.0 + * + * @return {integer} The number of used canvases. + */ + var total = function () + { + var c = 0; + + pool.forEach(function (container) + { + if (container.parent) + { + c++; + } + }); + + return c; + }; + + /** + * Gets the total number of free canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.free + * @since 3.0.0 + * + * @return {integer} The number of free canvases. + */ + var free = function () + { + return pool.length - total(); + }; + + /** + * Disable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing + * @since 3.0.0 + */ + var disableSmoothing = function () + { + _disableContextSmoothing = true; + }; + + /** + * Enable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing + * @since 3.0.0 + */ + var enableSmoothing = function () + { + _disableContextSmoothing = false; + }; + + return { + create2D: create2D, + create: create, + createWebGL: createWebGL, + disableSmoothing: disableSmoothing, + enableSmoothing: enableSmoothing, + first: first, + free: free, + pool: pool, + remove: remove, + total: total + }; }; -module.exports = Clamp; +// If we export the called function here, it'll only be invoked once (not every time it's required). +module.exports = CanvasPool(); /***/ }), -/* 25 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -5224,12 +5605,12 @@ var Body = {}; module.exports = Body; -var Vertices = __webpack_require__(29); -var Vector = __webpack_require__(34); -var Sleeping = __webpack_require__(89); +var Vertices = __webpack_require__(31); +var Vector = __webpack_require__(36); +var Sleeping = __webpack_require__(95); var Common = __webpack_require__(12); -var Bounds = __webpack_require__(33); -var Axes = __webpack_require__(152); +var Bounds = __webpack_require__(35); +var Axes = __webpack_require__(165); (function() { @@ -6423,273 +6804,46 @@ var Axes = __webpack_require__(152); /***/ }), -/* 26 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(28); -var Smoothing = __webpack_require__(130); - -// The pool into which the canvas elements are placed. -var pool = []; - -// Automatically apply smoothing(false) to created Canvas elements -var _disableContextSmoothing = false; - /** - * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. - * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, - * which is useless for some of the Phaser pipelines / renderer. - * - * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. - * Which means all instances of Phaser Games on the same page can share the one single pool. - * - * @namespace Phaser.Display.Canvas.CanvasPool - * @since 3.0.0 + * @namespace Phaser.Core.Events */ -var CanvasPool = function () -{ - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? - * - * @return {HTMLCanvasElement} [description] - */ - var create = function (parent, width, height, canvasType, selfParent) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = 1; } - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (selfParent === undefined) { selfParent = false; } - var canvas; - var container = first(canvasType); +module.exports = { - if (container === null) - { - container = { - parent: parent, - canvas: document.createElement('canvas'), - type: canvasType - }; + BLUR: __webpack_require__(1277), + BOOT: __webpack_require__(1276), + DESTROY: __webpack_require__(1275), + FOCUS: __webpack_require__(1274), + HIDDEN: __webpack_require__(1273), + PAUSE: __webpack_require__(1272), + POST_RENDER: __webpack_require__(1271), + POST_STEP: __webpack_require__(1270), + PRE_RENDER: __webpack_require__(1269), + PRE_STEP: __webpack_require__(1268), + READY: __webpack_require__(1267), + RESUME: __webpack_require__(1266), + STEP: __webpack_require__(1265), + VISIBLE: __webpack_require__(1264) - if (canvasType === CONST.CANVAS) - { - pool.push(container); - } - - canvas = container.canvas; - } - else - { - container.parent = parent; - - canvas = container.canvas; - } - - if (selfParent) - { - container.parent = canvas; - } - - canvas.width = width; - canvas.height = height; - - if (_disableContextSmoothing && canvasType === CONST.CANVAS) - { - Smoothing.disable(canvas.getContext('2d')); - } - - return canvas; - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create2D - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} [description] - */ - var create2D = function (parent, width, height) - { - return create(parent, width, height, CONST.CANVAS); - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.createWebGL - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} [description] - */ - var createWebGL = function (parent, width, height) - { - return create(parent, width, height, CONST.WEBGL); - }; - - /** - * Gets the first free canvas index from the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.first - * @since 3.0.0 - * - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * - * @return {HTMLCanvasElement} [description] - */ - var first = function (canvasType) - { - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - - if (canvasType === CONST.WEBGL) - { - return null; - } - - for (var i = 0; i < pool.length; i++) - { - var container = pool[i]; - - if (!container.parent && container.type === canvasType) - { - return container; - } - } - - return null; - }; - - /** - * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. - * The canvas has its width and height set to 1, and its parent attribute nulled. - * - * @function Phaser.Display.Canvas.CanvasPool.remove - * @since 3.0.0 - * - * @param {*} parent - [description] - */ - var remove = function (parent) - { - // Check to see if the parent is a canvas object - var isCanvas = parent instanceof HTMLCanvasElement; - - pool.forEach(function (container) - { - if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) - { - container.parent = null; - container.canvas.width = 1; - container.canvas.height = 1; - } - }); - }; - - /** - * Gets the total number of used canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.total - * @since 3.0.0 - * - * @return {integer} [description] - */ - var total = function () - { - var c = 0; - - pool.forEach(function (container) - { - if (container.parent) - { - c++; - } - }); - - return c; - }; - - /** - * Gets the total number of free canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.free - * @since 3.0.0 - * - * @return {integer} [description] - */ - var free = function () - { - return pool.length - total(); - }; - - /** - * Disable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing - * @since 3.0.0 - */ - var disableSmoothing = function () - { - _disableContextSmoothing = true; - }; - - /** - * Enable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing - * @since 3.0.0 - */ - var enableSmoothing = function () - { - _disableContextSmoothing = false; - }; - - return { - create2D: create2D, - create: create, - createWebGL: createWebGL, - disableSmoothing: disableSmoothing, - enableSmoothing: enableSmoothing, - first: first, - free: free, - pool: pool, - remove: remove, - total: total - }; }; -// If we export the called function here, it'll only be invoked once (not every time it's required). -module.exports = CanvasPool(); - /***/ }), -/* 27 */ +/* 29 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -6751,12 +6905,12 @@ module.exports = PropertyValueSet; /***/ }), -/* 28 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -6776,11 +6930,11 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.15.1', + VERSION: '3.16.2', - BlendModes: __webpack_require__(72), + BlendModes: __webpack_require__(66), - ScaleModes: __webpack_require__(104), + ScaleModes: __webpack_require__(111), /** * AUTO Detect Renderer. @@ -6889,7 +7043,7 @@ module.exports = CONST; /***/ }), -/* 29 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -6906,7 +7060,7 @@ var Vertices = {}; module.exports = Vertices; -var Vector = __webpack_require__(34); +var Vector = __webpack_require__(36); var Common = __webpack_require__(12); (function() { @@ -7349,12 +7503,12 @@ var Common = __webpack_require__(12); /***/ }), -/* 30 */ +/* 32 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -7404,19 +7558,19 @@ module.exports = { /***/ }), -/* 31 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var GameObject = __webpack_require__(17); -var Line = __webpack_require__(60); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var Line = __webpack_require__(65); /** * @classdesc @@ -7640,6 +7794,7 @@ var Shape = new Class({ * @method Phaser.GameObjects.Shape#setStrokeStyle * @since 3.13.0 * + * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. * @@ -7705,18 +7860,18 @@ module.exports = Shape; /***/ }), -/* 32 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(72); +var BlendModes = __webpack_require__(66); var GetAdvancedValue = __webpack_require__(13); -var ScaleModes = __webpack_require__(104); +var ScaleModes = __webpack_require__(111); /** * @typedef {object} GameObjectConfig @@ -7858,7 +8013,7 @@ module.exports = BuildGameObject; /***/ }), -/* 33 */ +/* 35 */ /***/ (function(module, exports) { /** @@ -7984,7 +8139,7 @@ module.exports = Bounds; /***/ }), -/* 34 */ +/* 36 */ /***/ (function(module, exports) { /** @@ -8227,384 +8382,25 @@ module.exports = Vector; })(); -/***/ }), -/* 35 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Sets the fillStyle on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#FillStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. - */ -var FillStyleCanvas = function (ctx, src, altColor) -{ - var fillColor = (altColor) ? altColor : src.fillColor; - var fillAlpha = src.fillAlpha; - - var red = ((fillColor & 0xFF0000) >>> 16); - var green = ((fillColor & 0xFF00) >>> 8); - var blue = (fillColor & 0xFF); - - ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; -}; - -module.exports = FillStyleCanvas; - - -/***/ }), -/* 36 */ -/***/ (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 CONST = __webpack_require__(18); - -/** - * Convert the given angle from degrees, to the equivalent angle in radians. - * - * @function Phaser.Math.DegToRad - * @since 3.0.0 - * - * @param {integer} degrees - The angle (in degrees) to convert to radians. - * - * @return {number} The given angle converted to radians. - */ -var DegToRad = function (degrees) -{ - return degrees * CONST.DEG_TO_RAD; -}; - -module.exports = DegToRad; - - /***/ }), /* 37 */ -/***/ (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 an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then adds the given value to it. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` - * - * @function Phaser.Actions.PropertyValueInc - * @since 3.3.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to be added to the property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var PropertyValueInc = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } - - var i; - var t = 0; - var end = items.length; - - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] += value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) - { - items[i][key] += value + (t * step); - t++; - } - } - - return items; -}; - -module.exports = PropertyValueInc; - - -/***/ }), -/* 38 */ /***/ (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 GetTileAt = __webpack_require__(110); -var GetTilesWithin = __webpack_require__(19); - -/** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. - * - * @function Phaser.Tilemaps.Components.CalculateFacesWithin - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var CalculateFacesWithin = function (tileX, tileY, width, height, layer) -{ - var above = null; - var below = null; - var left = null; - var right = null; - - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - - for (var i = 0; i < tiles.length; i++) - { - var tile = tiles[i]; - - if (tile) - { - if (tile.collides) - { - above = GetTileAt(tile.x, tile.y - 1, true, layer); - below = GetTileAt(tile.x, tile.y + 1, true, layer); - left = GetTileAt(tile.x - 1, tile.y, true, layer); - right = GetTileAt(tile.x + 1, tile.y, true, layer); - - tile.faceTop = (above && above.collides) ? false : true; - tile.faceBottom = (below && below.collides) ? false : true; - tile.faceLeft = (left && left.collides) ? false : true; - tile.faceRight = (right && right.collides) ? false : true; - } - else - { - tile.resetFaces(); - } - } - } -}; - -module.exports = CalculateFacesWithin; - - -/***/ }), -/* 39 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Arcade Physics consts. - * - * @ignore - */ - -var CONST = { - - /** - * Dynamic Body. - * - * @name Phaser.Physics.Arcade.DYNAMIC_BODY - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.Group#physicsType - */ - DYNAMIC_BODY: 0, - - /** - * Static Body. - * - * @name Phaser.Physics.Arcade.STATIC_BODY - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.StaticBody#physicsType - */ - STATIC_BODY: 1, - - /** - * [description] - * - * @name Phaser.Physics.Arcade.GROUP - * @readonly - * @type {number} - * @since 3.0.0 - */ - GROUP: 2, - - /** - * [description] - * - * @name Phaser.Physics.Arcade.TILEMAPLAYER - * @readonly - * @type {number} - * @since 3.0.0 - */ - TILEMAPLAYER: 3, - - /** - * Facing no direction (initial value). - * - * @name Phaser.Physics.Arcade.FACING_NONE - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_NONE: 10, - - /** - * Facing up. - * - * @name Phaser.Physics.Arcade.FACING_UP - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_UP: 11, - - /** - * Facing down. - * - * @name Phaser.Physics.Arcade.FACING_DOWN - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_DOWN: 12, - - /** - * Facing left. - * - * @name Phaser.Physics.Arcade.FACING_LEFT - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_LEFT: 13, - - /** - * Facing right. - * - * @name Phaser.Physics.Arcade.FACING_RIGHT - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_RIGHT: 14 - -}; - -module.exports = CONST; - - -/***/ }), -/* 40 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Sets the strokeStyle and lineWidth on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#LineStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. - */ -var LineStyleCanvas = function (ctx, src) -{ - var strokeColor = src.strokeColor; - var strokeAlpha = src.strokeAlpha; - - var red = ((strokeColor & 0xFF0000) >>> 16); - var green = ((strokeColor & 0xFF00) >>> 8); - var blue = (strokeColor & 0xFF); - - ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; - ctx.lineWidth = src.lineWidth; -}; - -module.exports = LineStyleCanvas; - - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(195); -var GetColor32 = __webpack_require__(412); -var HSVToRGB = __webpack_require__(194); -var RGBToHSV = __webpack_require__(411); +var GetColor = __webpack_require__(211); +var GetColor32 = __webpack_require__(447); +var HSVToRGB = __webpack_require__(210); +var RGBToHSV = __webpack_require__(446); + +/** + * @namespace Phaser.Display.Color + */ /** * @classdesc @@ -9450,12 +9246,473 @@ module.exports = Color; /***/ }), -/* 42 */ +/* 38 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Sets the fillStyle on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#FillStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. + */ +var FillStyleCanvas = function (ctx, src, altColor) +{ + var fillColor = (altColor) ? altColor : src.fillColor; + var fillAlpha = src.fillAlpha; + + var red = ((fillColor & 0xFF0000) >>> 16); + var green = ((fillColor & 0xFF00) >>> 8); + var blue = (fillColor & 0xFF); + + ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; +}; + +module.exports = FillStyleCanvas; + + +/***/ }), +/* 39 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Convert the given angle from degrees, to the equivalent angle in radians. + * + * @function Phaser.Math.DegToRad + * @since 3.0.0 + * + * @param {integer} degrees - The angle (in degrees) to convert to radians. + * + * @return {number} The given angle converted to radians. + */ +var DegToRad = function (degrees) +{ + return degrees * CONST.DEG_TO_RAD; +}; + +module.exports = DegToRad; + + +/***/ }), +/* 40 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then adds the given value to it. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueInc + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to be added to the property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var PropertyValueInc = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } + + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] += value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] += value + (t * step); + t++; + } + } + + return items; +}; + +module.exports = PropertyValueInc; + + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetTileAt = __webpack_require__(117); +var GetTilesWithin = __webpack_require__(22); + +/** + * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the + * layer. Interesting faces are used internally for optimizing collisions against tiles. This method + * is mostly used internally. + * + * @function Phaser.Tilemaps.Components.CalculateFacesWithin + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesWithin = function (tileX, tileY, width, height, layer) +{ + var above = null; + var below = null; + var left = null; + var right = null; + + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + + for (var i = 0; i < tiles.length; i++) + { + var tile = tiles[i]; + + if (tile) + { + if (tile.collides) + { + above = GetTileAt(tile.x, tile.y - 1, true, layer); + below = GetTileAt(tile.x, tile.y + 1, true, layer); + left = GetTileAt(tile.x - 1, tile.y, true, layer); + right = GetTileAt(tile.x + 1, tile.y, true, layer); + + tile.faceTop = (above && above.collides) ? false : true; + tile.faceBottom = (below && below.collides) ? false : true; + tile.faceLeft = (left && left.collides) ? false : true; + tile.faceRight = (right && right.collides) ? false : true; + } + else + { + tile.resetFaces(); + } + } + } +}; + +module.exports = CalculateFacesWithin; + + +/***/ }), +/* 42 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Arcade Physics consts. + * + * @ignore + */ + +var CONST = { + + /** + * Dynamic Body. + * + * @name Phaser.Physics.Arcade.DYNAMIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.Group#physicsType + */ + DYNAMIC_BODY: 0, + + /** + * Static Body. + * + * @name Phaser.Physics.Arcade.STATIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.StaticBody#physicsType + */ + STATIC_BODY: 1, + + /** + * Arcade Physics Group containing Dynamic Bodies. + * + * @name Phaser.Physics.Arcade.GROUP + * @readonly + * @type {number} + * @since 3.0.0 + */ + GROUP: 2, + + /** + * A Tilemap Layer. + * + * @name Phaser.Physics.Arcade.TILEMAPLAYER + * @readonly + * @type {number} + * @since 3.0.0 + */ + TILEMAPLAYER: 3, + + /** + * Facing no direction (initial value). + * + * @name Phaser.Physics.Arcade.FACING_NONE + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_NONE: 10, + + /** + * Facing up. + * + * @name Phaser.Physics.Arcade.FACING_UP + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_UP: 11, + + /** + * Facing down. + * + * @name Phaser.Physics.Arcade.FACING_DOWN + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_DOWN: 12, + + /** + * Facing left. + * + * @name Phaser.Physics.Arcade.FACING_LEFT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_LEFT: 13, + + /** + * Facing right. + * + * @name Phaser.Physics.Arcade.FACING_RIGHT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_RIGHT: 14 + +}; + +module.exports = CONST; + + +/***/ }), +/* 43 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Sets the strokeStyle and lineWidth on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#LineStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. + */ +var LineStyleCanvas = function (ctx, src) +{ + var strokeColor = src.strokeColor; + var strokeAlpha = src.strokeAlpha; + + var red = ((strokeColor & 0xFF0000) >>> 16); + var green = ((strokeColor & 0xFF00) >>> 8); + var blue = (strokeColor & 0xFF); + + ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; + ctx.lineWidth = src.lineWidth; +}; + +module.exports = LineStyleCanvas; + + +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: __webpack_require__(1081), + DESTROY: __webpack_require__(1080), + DRAG_END: __webpack_require__(1079), + DRAG_ENTER: __webpack_require__(1078), + DRAG: __webpack_require__(1077), + DRAG_LEAVE: __webpack_require__(1076), + DRAG_OVER: __webpack_require__(1075), + DRAG_START: __webpack_require__(1074), + DROP: __webpack_require__(1073), + GAME_OUT: __webpack_require__(1072), + GAME_OVER: __webpack_require__(1071), + GAMEOBJECT_DOWN: __webpack_require__(1070), + GAMEOBJECT_DRAG_END: __webpack_require__(1069), + GAMEOBJECT_DRAG_ENTER: __webpack_require__(1068), + GAMEOBJECT_DRAG: __webpack_require__(1067), + GAMEOBJECT_DRAG_LEAVE: __webpack_require__(1066), + GAMEOBJECT_DRAG_OVER: __webpack_require__(1065), + GAMEOBJECT_DRAG_START: __webpack_require__(1064), + GAMEOBJECT_DROP: __webpack_require__(1063), + GAMEOBJECT_MOVE: __webpack_require__(1062), + GAMEOBJECT_OUT: __webpack_require__(1061), + GAMEOBJECT_OVER: __webpack_require__(1060), + GAMEOBJECT_POINTER_DOWN: __webpack_require__(1059), + GAMEOBJECT_POINTER_MOVE: __webpack_require__(1058), + GAMEOBJECT_POINTER_OUT: __webpack_require__(1057), + GAMEOBJECT_POINTER_OVER: __webpack_require__(1056), + GAMEOBJECT_POINTER_UP: __webpack_require__(1055), + GAMEOBJECT_UP: __webpack_require__(1054), + MANAGER_BOOT: __webpack_require__(1053), + MANAGER_PROCESS: __webpack_require__(1052), + MANAGER_UPDATE: __webpack_require__(1051), + POINTER_DOWN: __webpack_require__(1050), + POINTER_DOWN_OUTSIDE: __webpack_require__(1049), + POINTER_MOVE: __webpack_require__(1048), + POINTER_OUT: __webpack_require__(1047), + POINTER_OVER: __webpack_require__(1046), + POINTER_UP: __webpack_require__(1045), + POINTER_UP_OUTSIDE: __webpack_require__(1044), + POINTERLOCK_CHANGE: __webpack_require__(1043), + PRE_UPDATE: __webpack_require__(1042), + SHUTDOWN: __webpack_require__(1041), + START: __webpack_require__(1040), + UPDATE: __webpack_require__(1039) + +}; + + +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ + +module.exports = { + + DESTROY: __webpack_require__(1255), + FADE_IN_COMPLETE: __webpack_require__(1254), + FADE_IN_START: __webpack_require__(1253), + FADE_OUT_COMPLETE: __webpack_require__(1252), + FADE_OUT_START: __webpack_require__(1251), + FLASH_COMPLETE: __webpack_require__(1250), + FLASH_START: __webpack_require__(1249), + PAN_COMPLETE: __webpack_require__(1248), + PAN_START: __webpack_require__(1247), + POST_RENDER: __webpack_require__(1246), + PRE_RENDER: __webpack_require__(1245), + SHAKE_COMPLETE: __webpack_require__(1244), + SHAKE_START: __webpack_require__(1243), + ZOOM_COMPLETE: __webpack_require__(1242), + ZOOM_START: __webpack_require__(1241) + +}; + + +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10182,7 +10439,11 @@ var TransformMatrix = new Class({ }, /** - * Decompose this Matrix into its translation, scale and rotation values. + * Decompose this Matrix into its translation, scale and rotation values using QR decomposition. + * + * The result must be applied in the following order to reproduce the current matrix: + * + * translate -> rotate -> scale * * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix * @since 3.0.0 @@ -10205,21 +10466,33 @@ var TransformMatrix = new Class({ var c = matrix[2]; var d = matrix[3]; - var a2 = a * a; - var b2 = b * b; - var c2 = c * c; - var d2 = d * d; - - var sx = Math.sqrt(a2 + c2); - var sy = Math.sqrt(b2 + d2); + var determ = a * d - b * c; decomposedMatrix.translateX = matrix[4]; decomposedMatrix.translateY = matrix[5]; - decomposedMatrix.scaleX = sx; - decomposedMatrix.scaleY = sy; + if (a || b) + { + var r = Math.sqrt(a * a + b * b); - decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); + decomposedMatrix.rotation = (b > 0) ? Math.acos(a / r) : -Math.acos(a / r); + decomposedMatrix.scaleX = r; + decomposedMatrix.scaleY = determ / r; + } + else if (c || d) + { + var s = Math.sqrt(c * c + d * d); + + decomposedMatrix.rotation = Math.PI * 0.5 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); + decomposedMatrix.scaleX = determ / s; + decomposedMatrix.scaleY = s; + } + else + { + decomposedMatrix.rotation = 0; + decomposedMatrix.scaleX = 0; + decomposedMatrix.scaleY = 0; + } return decomposedMatrix; }, @@ -10361,26 +10634,26 @@ module.exports = TransformMatrix; /***/ }), -/* 43 */ +/* 47 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if a given point is inside a Rectangle's bounds. * * @function Phaser.Geom.Rectangle.Contains * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. */ var Contains = function (rect, x, y) { @@ -10396,12 +10669,12 @@ module.exports = Contains; /***/ }), -/* 44 */ +/* 48 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10437,12 +10710,12 @@ module.exports = Contains; /***/ }), -/* 45 */ +/* 49 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10470,12 +10743,12 @@ module.exports = SetTop; /***/ }), -/* 46 */ +/* 50 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10498,12 +10771,12 @@ module.exports = GetTop; /***/ }), -/* 47 */ +/* 51 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10531,12 +10804,12 @@ module.exports = SetRight; /***/ }), -/* 48 */ +/* 52 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10559,12 +10832,12 @@ module.exports = GetRight; /***/ }), -/* 49 */ +/* 53 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10592,12 +10865,12 @@ module.exports = SetLeft; /***/ }), -/* 50 */ +/* 54 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10620,12 +10893,12 @@ module.exports = GetLeft; /***/ }), -/* 51 */ +/* 55 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10653,12 +10926,12 @@ module.exports = SetBottom; /***/ }), -/* 52 */ +/* 56 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10681,12 +10954,12 @@ module.exports = GetBottom; /***/ }), -/* 53 */ +/* 57 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10732,12 +11005,12 @@ module.exports = WorldToTileY; /***/ }), -/* 54 */ +/* 58 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10783,7 +11056,7 @@ module.exports = WorldToTileX; /***/ }), -/* 55 */ +/* 59 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -10801,12 +11074,12 @@ var Bodies = {}; module.exports = Bodies; -var Vertices = __webpack_require__(29); +var Vertices = __webpack_require__(31); var Common = __webpack_require__(12); -var Body = __webpack_require__(25); -var Bounds = __webpack_require__(33); -var Vector = __webpack_require__(34); -var decomp = __webpack_require__(244); +var Body = __webpack_require__(27); +var Bounds = __webpack_require__(35); +var Vector = __webpack_require__(36); +var decomp = __webpack_require__(262); (function() { @@ -11120,18 +11393,18 @@ var decomp = __webpack_require__(244); /***/ }), -/* 56 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var GetValue = __webpack_require__(4); @@ -11360,19 +11633,19 @@ module.exports = JSONFile; /***/ }), -/* 57 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var GameObject = __webpack_require__(17); -var SpriteRender = __webpack_require__(896); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var SpriteRender = __webpack_require__(934); /** * @classdesc @@ -11540,12 +11813,12 @@ module.exports = Sprite; /***/ }), -/* 58 */ +/* 62 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11574,12 +11847,12 @@ module.exports = DistanceBetween; /***/ }), -/* 59 */ +/* 63 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11606,19 +11879,47 @@ module.exports = Wrap; /***/ }), -/* 60 */ +/* 64 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the length of the given line. + * + * @function Phaser.Geom.Line.Length + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the length of. + * + * @return {number} The length of the line. + */ +var Length = function (line) +{ + return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); +}; + +module.exports = Length; + + +/***/ }), +/* 65 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(433); -var GetPoints = __webpack_require__(208); -var Random = __webpack_require__(207); +var GetPoint = __webpack_require__(467); +var GetPoints = __webpack_require__(224); +var Random = __webpack_require__(223); var Vector2 = __webpack_require__(3); /** @@ -11931,18 +12232,273 @@ module.exports = Line; /***/ }), -/* 61 */ +/* 66 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Blend Modes. + * + * @name Phaser.BlendModes + * @enum {integer} + * @memberof Phaser + * @readonly + * @since 3.0.0 + */ + +module.exports = { + + /** + * Skips the Blend Mode check in the renderer. + * + * @name Phaser.BlendModes.SKIP_CHECK + */ + SKIP_CHECK: -1, + + /** + * Normal blend mode. For Canvas and WebGL. + * This is the default setting and draws new shapes on top of the existing canvas content. + * + * @name Phaser.BlendModes.NORMAL + */ + NORMAL: 0, + + /** + * Add blend mode. For Canvas and WebGL. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.ADD + */ + ADD: 1, + + /** + * Multiply blend mode. For Canvas and WebGL. + * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. + * + * @name Phaser.BlendModes.MULTIPLY + */ + MULTIPLY: 2, + + /** + * Screen blend mode. For Canvas and WebGL. + * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) + * + * @name Phaser.BlendModes.SCREEN + */ + SCREEN: 3, + + /** + * Overlay blend mode. For Canvas only. + * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. + * + * @name Phaser.BlendModes.OVERLAY + */ + OVERLAY: 4, + + /** + * Darken blend mode. For Canvas only. + * Retains the darkest pixels of both layers. + * + * @name Phaser.BlendModes.DARKEN + */ + DARKEN: 5, + + /** + * Lighten blend mode. For Canvas only. + * Retains the lightest pixels of both layers. + * + * @name Phaser.BlendModes.LIGHTEN + */ + LIGHTEN: 6, + + /** + * Color Dodge blend mode. For Canvas only. + * Divides the bottom layer by the inverted top layer. + * + * @name Phaser.BlendModes.COLOR_DODGE + */ + COLOR_DODGE: 7, + + /** + * Color Burn blend mode. For Canvas only. + * Divides the inverted bottom layer by the top layer, and then inverts the result. + * + * @name Phaser.BlendModes.COLOR_BURN + */ + COLOR_BURN: 8, + + /** + * Hard Light blend mode. For Canvas only. + * A combination of multiply and screen like overlay, but with top and bottom layer swapped. + * + * @name Phaser.BlendModes.HARD_LIGHT + */ + HARD_LIGHT: 9, + + /** + * Soft Light blend mode. For Canvas only. + * A softer version of hard-light. Pure black or white does not result in pure black or white. + * + * @name Phaser.BlendModes.SOFT_LIGHT + */ + SOFT_LIGHT: 10, + + /** + * Difference blend mode. For Canvas only. + * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. + * + * @name Phaser.BlendModes.DIFFERENCE + */ + DIFFERENCE: 11, + + /** + * Exclusion blend mode. For Canvas only. + * Like difference, but with lower contrast. + * + * @name Phaser.BlendModes.EXCLUSION + */ + EXCLUSION: 12, + + /** + * Hue blend mode. For Canvas only. + * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. + * + * @name Phaser.BlendModes.HUE + */ + HUE: 13, + + /** + * Saturation blend mode. For Canvas only. + * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. + * + * @name Phaser.BlendModes.SATURATION + */ + SATURATION: 14, + + /** + * Color blend mode. For Canvas only. + * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. + * + * @name Phaser.BlendModes.COLOR + */ + COLOR: 15, + + /** + * Luminosity blend mode. For Canvas only. + * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. + * + * @name Phaser.BlendModes.LUMINOSITY + */ + LUMINOSITY: 16, + + /** + * Alpha erase blend mode. For Canvas and WebGL. + * + * @name Phaser.BlendModes.ERASE + */ + ERASE: 17, + + /** + * Source-in blend mode. For Canvas only. + * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.SOURCE_IN + */ + SOURCE_IN: 18, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is drawn where it doesn't overlap the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_OUT + */ + SOURCE_OUT: 19, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is only drawn where it overlaps the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_ATOP + */ + SOURCE_ATOP: 20, + + /** + * Destination-over blend mode. For Canvas only. + * New shapes are drawn behind the existing canvas content. + * + * @name Phaser.BlendModes.DESTINATION_OVER + */ + DESTINATION_OVER: 21, + + /** + * Destination-in blend mode. For Canvas only. + * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.DESTINATION_IN + */ + DESTINATION_IN: 22, + + /** + * Destination-out blend mode. For Canvas only. + * The existing content is kept where it doesn't overlap the new shape. + * + * @name Phaser.BlendModes.DESTINATION_OUT + */ + DESTINATION_OUT: 23, + + /** + * Destination-out blend mode. For Canvas only. + * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. + * + * @name Phaser.BlendModes.DESTINATION_ATOP + */ + DESTINATION_ATOP: 24, + + /** + * Lighten blend mode. For Canvas only. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.LIGHTER + */ + LIGHTER: 25, + + /** + * Copy blend mode. For Canvas only. + * Only the new shape is shown. + * + * @name Phaser.BlendModes.COPY + */ + COPY: 26, + + /** + * xor blend mode. For Canvas only. + * Shapes are made transparent where both overlap and drawn normal everywhere else. + * + * @name Phaser.BlendModes.XOR + */ + XOR: 27 + +}; + + +/***/ }), +/* 67 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var Rectangle = __webpack_require__(293); +var Components = __webpack_require__(14); +var Rectangle = __webpack_require__(300); /** * @classdesc @@ -12646,7 +13202,9 @@ var Tile = new Class({ // bottom left, while the Phaser renderer assumes the origin is the top left. The y // coordinate needs to be adjusted by the difference. this.pixelX = this.x * this.baseWidth; - this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); + this.pixelY = this.y * this.baseHeight; + + // this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); return this; }, @@ -12697,8 +13255,9 @@ var Tile = new Class({ }, /** - * The tileset that contains this Tile. This will only return null if accessed from a LayerData - * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer. + * The tileset that contains this Tile. This is null if accessed from a LayerData instance + * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has + * an index that doesn't correspond to any of the map's tilesets. * * @name Phaser.Tilemaps.Tile#tileset * @type {?Phaser.Tilemaps.Tileset} @@ -12706,11 +13265,24 @@ var Tile = new Class({ * @since 3.0.0 */ tileset: { + get: function () { - var tilemapLayer = this.tilemapLayer; - return tilemapLayer ? tilemapLayer.tileset : null; + var tilemapLayer = this.layer.tilemapLayer; + + if (tilemapLayer) + { + var tileset = tilemapLayer.gidMap[this.index]; + + if (tileset) + { + return tileset; + } + } + + return null; } + }, /** @@ -12753,12 +13325,12 @@ module.exports = Tile; /***/ }), -/* 62 */ +/* 68 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12789,7 +13361,7 @@ module.exports = SetTileCollision; /***/ }), -/* 63 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -12807,10 +13379,10 @@ var Composite = {}; module.exports = Composite; -var Events = __webpack_require__(74); +var Events = __webpack_require__(79); var Common = __webpack_require__(12); -var Bounds = __webpack_require__(33); -var Body = __webpack_require__(25); +var Bounds = __webpack_require__(35); +var Body = __webpack_require__(27); (function() { @@ -13480,12 +14052,12 @@ var Body = __webpack_require__(25); /***/ }), -/* 64 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13674,18 +14246,18 @@ module.exports = MultiFile; /***/ }), -/* 65 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -13970,21 +14542,21 @@ module.exports = ImageFile; /***/ }), -/* 66 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(76); -var GetPoint = __webpack_require__(306); -var GetPoints = __webpack_require__(305); -var Line = __webpack_require__(60); -var Random = __webpack_require__(202); +var Contains = __webpack_require__(81); +var GetPoint = __webpack_require__(313); +var GetPoints = __webpack_require__(312); +var Line = __webpack_require__(65); +var Random = __webpack_require__(218); /** * @classdesc @@ -14405,16 +14977,16 @@ module.exports = Triangle; /***/ }), -/* 67 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders a stroke outline around the given Shape. @@ -14480,12 +15052,12 @@ module.exports = StrokePathWebGL; /***/ }), -/* 68 */ +/* 74 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14529,12 +15101,53 @@ module.exports = SafeRange; /***/ }), -/* 69 */ +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Sound.Events + */ + +module.exports = { + + COMPLETE: __webpack_require__(1019), + DESTROY: __webpack_require__(1018), + DETUNE: __webpack_require__(1017), + GLOBAL_DETUNE: __webpack_require__(1016), + GLOBAL_MUTE: __webpack_require__(1015), + GLOBAL_RATE: __webpack_require__(1014), + GLOBAL_VOLUME: __webpack_require__(1013), + LOOP: __webpack_require__(1012), + LOOPED: __webpack_require__(1011), + MUTE: __webpack_require__(1010), + PAUSE_ALL: __webpack_require__(1009), + PAUSE: __webpack_require__(1008), + PLAY: __webpack_require__(1007), + RATE: __webpack_require__(1006), + RESUME_ALL: __webpack_require__(1005), + RESUME: __webpack_require__(1004), + SEEK: __webpack_require__(1003), + STOP_ALL: __webpack_require__(1002), + STOP: __webpack_require__(1001), + UNLOCKED: __webpack_require__(1000), + VOLUME: __webpack_require__(999) + +}; + + +/***/ }), +/* 76 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14571,47 +15184,40 @@ module.exports = Clone; /***/ }), -/* 70 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// 2.1.1 (Mar 17, 2016) +// Earcut 2.1.4 (December 4th 2018) /* -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. - -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. + * 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. + * + * 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. */ module.exports = earcut; -/* -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. - */ - function earcut(data, holeIndices, dim) { dim = dim || 2; @@ -14621,9 +15227,9 @@ function earcut(data, holeIndices, dim) { outerNode = linkedList(data, 0, outerLen, dim, true), triangles = []; - if (!outerNode) return triangles; + if (!outerNode || outerNode.next === outerNode.prev) return triangles; - var minX, minY, maxX, maxY, x, y, size; + var minX, minY, maxX, maxY, x, y, invSize; if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); @@ -14641,11 +15247,12 @@ function earcut(data, holeIndices, dim) { if (y > maxY) maxY = y; } - // minX, minY and size are later used to transform coords into integers for z-order calculation - size = Math.max(maxX - minX, maxY - minY); + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 1 / invSize : 0; } - earcutLinked(outerNode, triangles, dim, minX, minY, size); + earcutLinked(outerNode, triangles, dim, minX, minY, invSize); return triangles; } @@ -14681,7 +15288,7 @@ function filterPoints(start, end) { 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; + if (p === p.next) break; again = true; } else { @@ -14693,11 +15300,11 @@ function filterPoints(start, end) { } // main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { +function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { if (!ear) return; // interlink polygon nodes in z-order - if (!pass && size) indexCurve(ear, minX, minY, size); + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); var stop = ear, prev, next; @@ -14707,7 +15314,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { prev = ear.prev; next = ear.next; - if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { // cut off the triangle triangles.push(prev.i / dim); triangles.push(ear.i / dim); @@ -14715,7 +15322,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { removeNode(ear); - // skipping the next vertice leads to less sliver triangles + // skipping the next vertex leads to less sliver triangles ear = next.next; stop = next.next; @@ -14728,16 +15335,16 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { if (ear === stop) { // try filtering points and slicing again if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 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); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, size); + splitEarcut(ear, triangles, dim, minX, minY, invSize); } break; @@ -14765,7 +15372,7 @@ function isEar(ear) { return true; } -function isEarHashed(ear, minX, minY, size) { +function isEarHashed(ear, minX, minY, invSize) { var a = ear.prev, b = ear, c = ear.next; @@ -14779,22 +15386,26 @@ function isEarHashed(ear, minX, minY, size) { 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); + var minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - // first look for points inside the triangle in increasing z-order - var p = ear.nextZ; + var p = ear.prevZ, + n = ear.nextZ; - while (p && p.z <= maxZ) { + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.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; + p = p.prevZ; + + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; } - // then look for points in decreasing z-order - p = ear.prevZ; - + // look for remaining points in decreasing z-order 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) && @@ -14802,6 +15413,14 @@ function isEarHashed(ear, minX, minY, size) { p = p.prevZ; } + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + return true; } @@ -14831,7 +15450,7 @@ function cureLocalIntersections(start, triangles, dim) { } // try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, size) { +function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two var a = start; do { @@ -14846,8 +15465,8 @@ function splitEarcut(start, triangles, dim, minX, minY, size) { c = filterPoints(c, c.next); // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, size); - earcutLinked(c, triangles, dim, minX, minY, size); + earcutLinked(a, triangles, dim, minX, minY, invSize); + earcutLinked(c, triangles, dim, minX, minY, invSize); return; } b = b.next; @@ -14953,10 +15572,10 @@ function findHoleBridge(hole, outerNode) { } // interlink polygon nodes in z-order -function indexCurve(start, minX, minY, size) { +function indexCurve(start, minX, minY, invSize) { var p = start; do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); p.prevZ = p.prev; p.nextZ = p.next; p = p.next; @@ -15021,11 +15640,11 @@ function sortLinked(list) { return list; } -// z-order of a point given coords and size of the data bounding box -function zOrder(x, y, minX, minY, size) { +// z-order of a point given coords and inverse of the longer side of data bbox +function zOrder(x, y, minX, minY, invSize) { // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) / size; - y = 32767 * (y - minY) / size; + x = 32767 * (x - minX) * invSize; + y = 32767 * (y - minY) * invSize; x = (x | (x << 8)) & 0x00FF00FF; x = (x | (x << 4)) & 0x0F0F0F0F; @@ -15167,14 +15786,14 @@ function removeNode(p) { } function Node(i, x, y) { - // vertice index in coordinates array + // vertex index in coordinates array this.i = i; // vertex coordinates this.x = x; this.y = y; - // previous and next vertice nodes in a polygon ring + // previous and next vertex nodes in a polygon ring this.prev = null; this.next = null; @@ -15245,187 +15864,9 @@ earcut.flatten = function (data) { return result; }; -/***/ }), -/* 71 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the length of the given line. - * - * @function Phaser.Geom.Line.Length - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the length of. - * - * @return {number} The length of the line. - */ -var Length = function (line) -{ - return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); -}; - -module.exports = Length; - /***/ }), -/* 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} - */ - -/** - * Phaser Blend Modes. - * - * @name Phaser.BlendModes - * @enum {integer} - * @memberof Phaser - * @readonly - * @since 3.0.0 - */ - -module.exports = { - - /** - * Skips the Blend Mode check in the renderer. - * - * @name Phaser.BlendModes.SKIP_CHECK - */ - SKIP_CHECK: -1, - - /** - * Normal blend mode. - * - * @name Phaser.BlendModes.NORMAL - */ - NORMAL: 0, - - /** - * Add blend mode. - * - * @name Phaser.BlendModes.ADD - */ - ADD: 1, - - /** - * Multiply blend mode. - * - * @name Phaser.BlendModes.MULTIPLY - */ - MULTIPLY: 2, - - /** - * Screen blend mode. - * - * @name Phaser.BlendModes.SCREEN - */ - SCREEN: 3, - - /** - * Overlay blend mode. - * - * @name Phaser.BlendModes.OVERLAY - */ - OVERLAY: 4, - - /** - * Darken blend mode. - * - * @name Phaser.BlendModes.DARKEN - */ - DARKEN: 5, - - /** - * Lighten blend mode. - * - * @name Phaser.BlendModes.LIGHTEN - */ - LIGHTEN: 6, - - /** - * Color Dodge blend mode. - * - * @name Phaser.BlendModes.COLOR_DODGE - */ - COLOR_DODGE: 7, - - /** - * Color Burn blend mode. - * - * @name Phaser.BlendModes.COLOR_BURN - */ - COLOR_BURN: 8, - - /** - * Hard Light blend mode. - * - * @name Phaser.BlendModes.HARD_LIGHT - */ - HARD_LIGHT: 9, - - /** - * Soft Light blend mode. - * - * @name Phaser.BlendModes.SOFT_LIGHT - */ - SOFT_LIGHT: 10, - - /** - * Difference blend mode. - * - * @name Phaser.BlendModes.DIFFERENCE - */ - DIFFERENCE: 11, - - /** - * Exclusion blend mode. - * - * @name Phaser.BlendModes.EXCLUSION - */ - EXCLUSION: 12, - - /** - * Hue blend mode. - * - * @name Phaser.BlendModes.HUE - */ - HUE: 13, - - /** - * Saturation blend mode. - * - * @name Phaser.BlendModes.SATURATION - */ - SATURATION: 14, - - /** - * Color blend mode. - * - * @name Phaser.BlendModes.COLOR - */ - COLOR: 15, - - /** - * Luminosity blend mode. - * - * @name Phaser.BlendModes.LUMINOSITY - */ - LUMINOSITY: 16 - -}; - - -/***/ }), -/* 73 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15442,11 +15883,11 @@ var Constraint = {}; module.exports = Constraint; -var Vertices = __webpack_require__(29); -var Vector = __webpack_require__(34); -var Sleeping = __webpack_require__(89); -var Bounds = __webpack_require__(33); -var Axes = __webpack_require__(152); +var Vertices = __webpack_require__(31); +var Vector = __webpack_require__(36); +var Sleeping = __webpack_require__(95); +var Bounds = __webpack_require__(35); +var Axes = __webpack_require__(165); var Common = __webpack_require__(12); (function() { @@ -15884,7 +16325,7 @@ var Common = __webpack_require__(12); /***/ }), -/* 74 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -16002,12 +16443,12 @@ var Common = __webpack_require__(12); /***/ }), -/* 75 */ +/* 80 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16030,28 +16471,28 @@ module.exports = Angle; /***/ }), -/* 76 */ +/* 81 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // http://www.blackpawn.com/texts/pointinpoly/ /** - * [description] + * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. * * @function Phaser.Geom.Triangle.Contains * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. */ var Contains = function (triangle, x, y) { @@ -16083,25 +16524,25 @@ module.exports = Contains; /***/ }), -/* 77 */ +/* 82 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Determine whether the source object has a property with the specified key. * * @function Phaser.Utils.Objects.HasValue * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] + * @param {object} source - The source object to be checked. + * @param {string} key - The property to check for within the object * - * @return {boolean} [description] + * @return {boolean} `true` if the provided `key` exists on the `source` object, otherwise `false`. */ var HasValue = function (source, key) { @@ -16112,19 +16553,19 @@ module.exports = HasValue; /***/ }), -/* 78 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var GameObject = __webpack_require__(17); -var ImageRender = __webpack_require__(893); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var ImageRender = __webpack_require__(931); /** * @classdesc @@ -16215,16 +16656,16 @@ module.exports = Image; /***/ }), -/* 79 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Creates a new Object using all values from obj1 and obj2. @@ -16233,10 +16674,10 @@ var Clone = __webpack_require__(69); * @function Phaser.Utils.Objects.Merge * @since 3.0.0 * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] + * @param {object} obj1 - The first object. + * @param {object} obj2 - The second object. * - * @return {object} [description] + * @return {object} A new object containing the union of obj1's and obj2's properties. */ var Merge = function (obj1, obj2) { @@ -16257,18 +16698,48 @@ module.exports = Merge; /***/ }), -/* 80 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Loader.Events + */ + +module.exports = { + + ADD: __webpack_require__(1032), + COMPLETE: __webpack_require__(1031), + FILE_COMPLETE: __webpack_require__(1030), + FILE_KEY_COMPLETE: __webpack_require__(1029), + FILE_LOAD_ERROR: __webpack_require__(1028), + FILE_LOAD: __webpack_require__(1027), + FILE_PROGRESS: __webpack_require__(1026), + POST_PROCESS: __webpack_require__(1025), + PROGRESS: __webpack_require__(1024), + START: __webpack_require__(1023) + +}; + + +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(191); -var Rectangle = __webpack_require__(10); +var FromPoints = __webpack_require__(198); +var Rectangle = __webpack_require__(11); var Vector2 = __webpack_require__(3); /** @@ -16832,20 +17303,20 @@ module.exports = Curve; /***/ }), -/* 81 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(44); -var GetPoint = __webpack_require__(442); -var GetPoints = __webpack_require__(440); -var Random = __webpack_require__(210); +var Contains = __webpack_require__(48); +var GetPoint = __webpack_require__(477); +var GetPoints = __webpack_require__(476); +var Random = __webpack_require__(227); /** * @classdesc @@ -17195,12 +17666,12 @@ module.exports = Circle; /***/ }), -/* 82 */ +/* 88 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17223,12 +17694,12 @@ module.exports = GetCenterY; /***/ }), -/* 83 */ +/* 89 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17258,12 +17729,12 @@ module.exports = SetCenterY; /***/ }), -/* 84 */ +/* 90 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17293,12 +17764,12 @@ module.exports = SetCenterX; /***/ }), -/* 85 */ +/* 91 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17321,18 +17792,41 @@ module.exports = GetCenterX; /***/ }), -/* 86 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(1); +/** + * @typedef {object} MapDataConfig + * @property {string} [name] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @property {number} [width=0] - The width of the entire tilemap. + * @property {number} [height=0] - The height of the entire tilemap. + * @property {number} [tileWidth=0] - The width of the tiles. + * @property {number} [tileHeight=0] - The height of the tiles. + * @property {number} [widthInPixels] - The width in pixels of the entire tilemap. + * @property {number} [heightInPixels] - The height in pixels of the entire tilemap. + * @property {integer} [format] - The format of the Tilemap, as defined in Tiled. + * @property {string} [orientation] - The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. + * @property {string} [renderOrder] - Determines the draw order of tilemap. Default is right-down. + * @property {number} [version] - The version of Tiled the map uses. + * @property {number} [properties] - Map specific properties (can be specified in Tiled). + * @property {Phaser.Tilemaps.LayerData[]} [layers] - The layers of the tilemap. + * @property {array} [images] - An array with all the layers configured to the MapData. + * @property {object} [objects] - An array of Tiled Image Layers. + * @property {object} [collision] - An object of Tiled Object Layers. + * @property {Phaser.Tilemaps.Tileset[]} [tilesets] - The tilesets the map uses. + * @property {array} [imageCollections] - The collection of images the map uses(specified in Tiled). + * @property {array} [tiles] - [description] + */ + /** * @classdesc * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this @@ -17344,7 +17838,7 @@ var GetFastValue = __webpack_require__(1); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {MapDataConfig} [config] - [description] */ var MapData = new Class({ @@ -17355,7 +17849,7 @@ var MapData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The key in the Phaser cache that corresponds to the loaded tilemap data. * * @name Phaser.Tilemaps.MapData#name * @type {string} @@ -17364,7 +17858,7 @@ var MapData = new Class({ this.name = GetFastValue(config, 'name', 'map'); /** - * [description] + * The width of the entire tilemap. * * @name Phaser.Tilemaps.MapData#width * @type {number} @@ -17373,7 +17867,7 @@ var MapData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height of the entire tilemap. * * @name Phaser.Tilemaps.MapData#height * @type {number} @@ -17382,7 +17876,7 @@ var MapData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The width of the tiles. * * @name Phaser.Tilemaps.MapData#tileWidth * @type {number} @@ -17391,7 +17885,7 @@ var MapData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The height of the tiles. * * @name Phaser.Tilemaps.MapData#tileHeight * @type {number} @@ -17400,7 +17894,7 @@ var MapData = new Class({ this.tileHeight = GetFastValue(config, 'tileHeight', 0); /** - * [description] + * The width in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#widthInPixels * @type {number} @@ -17409,7 +17903,7 @@ var MapData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); /** - * [description] + * The height in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#heightInPixels * @type {number} @@ -17427,7 +17921,7 @@ var MapData = new Class({ this.format = GetFastValue(config, 'format', null); /** - * [description] + * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. * * @name Phaser.Tilemaps.MapData#orientation * @type {string} @@ -17436,7 +17930,12 @@ var MapData = new Class({ this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); /** - * [description] + * Determines the draw order of tilemap. Default is right-down + * + * 0, or 'right-down' + * 1, or 'left-down' + * 2, or 'right-up' + * 3, or 'left-up' * * @name Phaser.Tilemaps.MapData#renderOrder * @type {string} @@ -17445,7 +17944,7 @@ var MapData = new Class({ this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); /** - * [description] + * The version of the map data (as specified in Tiled). * * @name Phaser.Tilemaps.MapData#version * @type {string} @@ -17454,7 +17953,7 @@ var MapData = new Class({ this.version = GetFastValue(config, 'version', '1'); /** - * [description] + * Map specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.MapData#properties * @type {object} @@ -17463,16 +17962,16 @@ var MapData = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * [description] + * An array with all the layers configured to the MapData. * * @name Phaser.Tilemaps.MapData#layers - * @type {array} + * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} * @since 3.0.0 */ this.layers = GetFastValue(config, 'layers', []); /** - * [description] + * An array of Tiled Image Layers. * * @name Phaser.Tilemaps.MapData#images * @type {array} @@ -17481,7 +17980,7 @@ var MapData = new Class({ this.images = GetFastValue(config, 'images', []); /** - * [description] + * An object of Tiled Object Layers. * * @name Phaser.Tilemaps.MapData#objects * @type {object} @@ -17490,7 +17989,7 @@ var MapData = new Class({ this.objects = GetFastValue(config, 'objects', {}); /** - * [description] + * An object of collision data. Must be created as physics object or will return undefined. * * @name Phaser.Tilemaps.MapData#collision * @type {object} @@ -17499,16 +17998,16 @@ var MapData = new Class({ this.collision = GetFastValue(config, 'collision', {}); /** - * [description] + * An array of Tilesets. * * @name Phaser.Tilemaps.MapData#tilesets - * @type {array} + * @type {Phaser.Tilemaps.Tileset[]} * @since 3.0.0 */ this.tilesets = GetFastValue(config, 'tilesets', []); /** - * [description] + * The collection of images the map uses(specified in Tiled) * * @name Phaser.Tilemaps.MapData#imageCollections * @type {array} @@ -17532,12 +18031,12 @@ module.exports = MapData; /***/ }), -/* 87 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17566,7 +18065,7 @@ var LayerData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the layer, if specified in Tiled. * * @name Phaser.Tilemaps.LayerData#name * @type {string} @@ -17575,7 +18074,7 @@ var LayerData = new Class({ this.name = GetFastValue(config, 'name', 'layer'); /** - * [description] + * The x offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#x * @type {number} @@ -17584,7 +18083,7 @@ var LayerData = new Class({ this.x = GetFastValue(config, 'x', 0); /** - * [description] + * The y offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#y * @type {number} @@ -17593,7 +18092,7 @@ var LayerData = new Class({ this.y = GetFastValue(config, 'y', 0); /** - * [description] + * The width in tile of the layer. * * @name Phaser.Tilemaps.LayerData#width * @type {number} @@ -17602,7 +18101,7 @@ var LayerData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height in tiles of the layer. * * @name Phaser.Tilemaps.LayerData#height * @type {number} @@ -17611,7 +18110,7 @@ var LayerData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The pixel width of the tiles. * * @name Phaser.Tilemaps.LayerData#tileWidth * @type {number} @@ -17620,7 +18119,7 @@ var LayerData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The pixel height of the tiles. * * @name Phaser.Tilemaps.LayerData#tileHeight * @type {number} @@ -17647,7 +18146,7 @@ var LayerData = new Class({ this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); /** - * [description] + * The width in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#widthInPixels * @type {number} @@ -17656,7 +18155,7 @@ var LayerData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); /** - * [description] + * The height in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#heightInPixels * @type {number} @@ -17683,7 +18182,7 @@ var LayerData = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * Layer specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.LayerData#properties * @type {object} @@ -17728,10 +18227,10 @@ var LayerData = new Class({ this.bodies = GetFastValue(config, 'bodies', []); /** - * [description] + * An array of the tile indexes * * @name Phaser.Tilemaps.LayerData#data - * @type {array} + * @type {(number[])} * @since 3.0.0 */ this.data = GetFastValue(config, 'data', []); @@ -17752,12 +18251,12 @@ module.exports = LayerData; /***/ }), -/* 88 */ +/* 94 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17783,7 +18282,7 @@ module.exports = IsInLayerBounds; /***/ }), -/* 89 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -17796,7 +18295,7 @@ var Sleeping = {}; module.exports = Sleeping; -var Events = __webpack_require__(74); +var Events = __webpack_require__(79); (function() { @@ -17918,12 +18417,12 @@ var Events = __webpack_require__(74); /***/ }), -/* 90 */ +/* 96 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17976,12 +18475,12 @@ module.exports = { /***/ }), -/* 91 */ +/* 97 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18041,16 +18540,16 @@ module.exports = { /***/ }), -/* 92 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders a filled path for the given Shape. @@ -18105,12 +18604,12 @@ module.exports = FillPathWebGL; /***/ }), -/* 93 */ +/* 99 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18277,12 +18776,12 @@ module.exports = TWEEN_CONST; /***/ }), -/* 94 */ +/* 100 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18318,16 +18817,16 @@ module.exports = GetBoolean; /***/ }), -/* 95 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EaseMap = __webpack_require__(192); +var EaseMap = __webpack_require__(208); /** * [description] @@ -18380,25 +18879,24 @@ module.exports = GetEaseFunction; /***/ }), -/* 96 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * @callback EachSetCallback - * @generic E - [entry] + * @callback EachSetCallback * - * @param {*} entry - [description] - * @param {number} index - [description] + * @param {E} entry - The Set entry. + * @param {number} index - The index of the entry within the Set. * - * @return {?boolean} [description] + * @return {?boolean} The callback result. */ /** @@ -18564,7 +19062,7 @@ var Set = new Class({ * @genericUse {Phaser.Structs.Set.} - [$return] * * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} callbackScope - The scope of the callback. + * @param {*} [callbackScope] - The scope of the callback. * * @return {Phaser.Structs.Set} This Set object. */ @@ -18609,7 +19107,7 @@ var Set = new Class({ * @genericUse {Phaser.Structs.Set.} - [$return] * * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} callbackScope - The scope of the callback. + * @param {*} [callbackScope] - The scope of the callback. * * @return {Phaser.Structs.Set} This Set object. */ @@ -18830,23 +19328,24 @@ module.exports = Set; /***/ }), -/* 97 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Actions = __webpack_require__(454); +var Actions = __webpack_require__(489); var Class = __webpack_require__(0); +var Events = __webpack_require__(143); var GetFastValue = __webpack_require__(1); var GetValue = __webpack_require__(4); var IsPlainObject = __webpack_require__(8); -var Range = __webpack_require__(340); -var Set = __webpack_require__(96); -var Sprite = __webpack_require__(57); +var Range = __webpack_require__(346); +var Set = __webpack_require__(102); +var Sprite = __webpack_require__(61); /** * @callback GroupCallback @@ -18863,7 +19362,7 @@ var Sprite = __webpack_require__(57); /** * @typedef {object} GroupConfig * - * @property {?object} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. + * @property {?GroupClassTypeConstructor} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. * @property {?boolean} [active=true] - Sets {@link Phaser.GameObjects.Group#active}. * @property {?number} [maxSize=-1] - Sets {@link Phaser.GameObjects.Group#maxSize}. * @property {?string} [defaultKey=null] - Sets {@link Phaser.GameObjects.Group#defaultKey}. @@ -18887,7 +19386,7 @@ var Sprite = __webpack_require__(57); * * `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used. * - * @property {?object} [classType] - The class of each new Game Object. + * @property {?GroupClassTypeConstructor} [classType] - The class of each new Game Object. * @property {string} [key] - The texture key of each new Game Object. * @property {?(string|integer)} [frame=null] - The texture frame of each new Game Object. * @property {?boolean} [visible=true] - The visible state of each new Game Object. @@ -18928,6 +19427,18 @@ var Sprite = __webpack_require__(57); * @see Phaser.Utils.Array.Range */ +/** + * A constructor function (class) that can be assigned to `classType`. + * @callback GroupClassTypeConstructor + * @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. + * + * @see Phaser.GameObjects.Group#classType + */ + /** * @classdesc A Group is a way for you to create, manipulate, or recycle similar Game Objects. * @@ -19020,7 +19531,7 @@ var Group = new Class({ * The class to create new group members from. * * @name Phaser.GameObjects.Group#classType - * @type {object} + * @type {GroupClassTypeConstructor} * @since 3.0.0 * @default Phaser.GameObjects.Sprite */ @@ -19395,7 +19906,7 @@ var Group = new Class({ } } - child.on('destroy', this.remove, this); + child.on(Events.DESTROY, this.remove, this); return this; }, @@ -19459,7 +19970,7 @@ var Group = new Class({ this.removeCallback.call(this, child); } - child.off('destroy', this.remove, this); + child.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -19502,7 +20013,7 @@ var Group = new Class({ { var gameObject = children.entries[i]; - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -20034,7 +20545,7 @@ var Group = new Class({ var gameObject = children.entries[i]; // Remove the event hook first or it'll go all recursive hell on us - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); gameObject.destroy(); } @@ -20052,12 +20563,12 @@ module.exports = Group; /***/ }), -/* 98 */ +/* 104 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -20094,20 +20605,20 @@ module.exports = Contains; /***/ }), -/* 99 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(98); -var GetPoint = __webpack_require__(336); -var GetPoints = __webpack_require__(335); -var Random = __webpack_require__(203); +var Contains = __webpack_require__(104); +var GetPoint = __webpack_require__(341); +var GetPoints = __webpack_require__(340); +var Random = __webpack_require__(219); /** * @classdesc @@ -20462,12 +20973,12 @@ module.exports = Ellipse; /***/ }), -/* 100 */ +/* 106 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -20478,10 +20989,10 @@ module.exports = Ellipse; * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 * - * @param {array} array - [description] - * @param {integer} index - [description] + * @param {array} array - The array to splice from. + * @param {integer} index - The index of the item which should be spliced. * - * @return {*} [description] + * @return {*} The item which was spliced (removed). */ var SpliceOne = function (array, index) { @@ -20508,12 +21019,56 @@ module.exports = SpliceOne; /***/ }), -/* 101 */ +/* 107 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using floor. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. + * As will `14` snap to `10`... but `16` will snap to `15`. + * + * @function Phaser.Math.Snap.Floor + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapFloor = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.floor(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapFloor; + + +/***/ }), +/* 108 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -20695,19 +21250,20 @@ function init () module.exports = init(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(979))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1183))) /***/ }), -/* 102 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(458); /** * @callback DataEachCallback @@ -20720,7 +21276,7 @@ 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. + * The Data Manager 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. * @@ -20942,13 +21498,16 @@ var DataManager = new Class({ * When the value is first set, a `setdata` event is emitted. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. * * @method Phaser.Data.DataManager#set + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. @@ -20982,6 +21541,9 @@ var DataManager = new Class({ * Internal value setter, called automatically by the `set` method. * * @method Phaser.Data.DataManager#setValue + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @private * @since 3.10.0 * @@ -21027,8 +21589,8 @@ var DataManager = new Class({ var previousValue = list[key]; list[key] = value; - events.emit('changedata', parent, key, value, previousValue); - events.emit('changedata_' + key, parent, value, previousValue); + events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); + events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); } } @@ -21036,7 +21598,7 @@ var DataManager = new Class({ list[key] = data; - events.emit('setdata', parent, key, data); + events.emit(Events.SET_DATA, parent, key, data); } return this; @@ -21081,6 +21643,9 @@ var DataManager = new Class({ * will emit a `changedata` event. * * @method Phaser.Data.DataManager#merge + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * * @param {Object.} data - The data to merge. @@ -21117,6 +21682,7 @@ var DataManager = new Class({ * ``` * * @method Phaser.Data.DataManager#remove + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.0.0 * * @param {(string|string[])} key - The key to remove, or an array of keys to remove. @@ -21150,6 +21716,7 @@ var DataManager = new Class({ * * @method Phaser.Data.DataManager#removeValue * @private + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.10.0 * * @param {string} key - The key to set the value for. @@ -21165,7 +21732,7 @@ var DataManager = new Class({ delete this.list[key]; delete this.values[key]; - this.events.emit('removedata', this.parent, key, data); + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); } return this; @@ -21175,6 +21742,7 @@ var DataManager = new Class({ * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. * * @method Phaser.Data.DataManager#pop + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.0.0 * * @param {string} key - The key of the value to retrieve and delete. @@ -21192,7 +21760,7 @@ var DataManager = new Class({ delete this.list[key]; delete this.values[key]; - this.events.emit('removedata', this, key, data); + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); } return data; @@ -21265,9 +21833,9 @@ var DataManager = new Class({ { this.reset(); - this.events.off('changedata'); - this.events.off('setdata'); - this.events.off('removedata'); + this.events.off(Events.CHANGE_DATA); + this.events.off(Events.SET_DATA); + this.events.off(Events.REMOVE_DATA); this.parent = null; }, @@ -21326,12 +21894,12 @@ module.exports = DataManager; /***/ }), -/* 103 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -21360,12 +21928,12 @@ module.exports = FromPercent; /***/ }), -/* 104 */ +/* 111 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -21406,26 +21974,26 @@ module.exports = { /***/ }), -/* 105 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(138); +var Defaults = __webpack_require__(150); var GetAdvancedValue = __webpack_require__(13); -var GetBoolean = __webpack_require__(94); -var GetEaseFunction = __webpack_require__(95); -var GetNewValue = __webpack_require__(106); -var GetProps = __webpack_require__(218); -var GetTargets = __webpack_require__(140); +var GetBoolean = __webpack_require__(100); +var GetEaseFunction = __webpack_require__(101); +var GetNewValue = __webpack_require__(113); +var GetProps = __webpack_require__(236); +var GetTargets = __webpack_require__(152); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(139); -var Tween = __webpack_require__(137); -var TweenData = __webpack_require__(136); +var GetValueOp = __webpack_require__(151); +var Tween = __webpack_require__(149); +var TweenData = __webpack_require__(148); /** * [description] @@ -21435,7 +22003,33 @@ var TweenData = __webpack_require__(136); * * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] * @param {object} config - [description] - * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description] + * @param {Phaser.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. +` + * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. + * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. + * @property {number} [duration=1000] - The duration of the tween in milliseconds. + * @property {string} [ease='Power0'] - The easing equation to use for the tween. + * @property {array} [easeParams] - Optional easing parameters. + * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. + * @property {number} [repeat=0] - The number of times to repeat the tween. + * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. + * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. + * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. + * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. +` +{ + targets: null, + delay: 0, + duration: 1000, + ease: 'Power0', + easeParams: null, + hold: 0, + repeat: 0, + repeatDelay: 0, + yoyo: false, + flipX: false, + flipY: false +}; * * @return {Phaser.Tweens.Tween} [description] */ @@ -21537,12 +22131,12 @@ module.exports = TweenBuilder; /***/ }), -/* 106 */ +/* 113 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -21600,12 +22194,12 @@ module.exports = GetNewValue; /***/ }), -/* 107 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22004,12 +22598,12 @@ module.exports = Tileset; /***/ }), -/* 108 */ +/* 115 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22049,12 +22643,12 @@ module.exports = TileToWorldY; /***/ }), -/* 109 */ +/* 116 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22094,16 +22688,16 @@ module.exports = TileToWorldX; /***/ }), -/* 110 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(88); +var IsInLayerBounds = __webpack_require__(94); /** * Gets a tile at the given tile coordinates from the given layer. @@ -22126,7 +22720,7 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) if (IsInLayerBounds(tileX, tileY, layer)) { - var tile = layer.data[tileY][tileX]; + var tile = layer.data[tileY][tileX] || null; if (tile === null) { return null; @@ -22150,12 +22744,12 @@ module.exports = GetTileAt; /***/ }), -/* 111 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22165,54 +22759,54 @@ module.exports = GetTileAt; module.exports = { - CalculateFacesAt: __webpack_require__(145), - CalculateFacesWithin: __webpack_require__(38), - Copy: __webpack_require__(516), - CreateFromTiles: __webpack_require__(515), - CullTiles: __webpack_require__(514), - Fill: __webpack_require__(513), - FilterTiles: __webpack_require__(512), - FindByIndex: __webpack_require__(511), - FindTile: __webpack_require__(510), - ForEachTile: __webpack_require__(509), - GetTileAt: __webpack_require__(110), - GetTileAtWorldXY: __webpack_require__(508), - GetTilesWithin: __webpack_require__(19), - GetTilesWithinShape: __webpack_require__(507), - GetTilesWithinWorldXY: __webpack_require__(506), - HasTileAt: __webpack_require__(232), - HasTileAtWorldXY: __webpack_require__(505), - IsInLayerBounds: __webpack_require__(88), - PutTileAt: __webpack_require__(144), - PutTileAtWorldXY: __webpack_require__(504), - PutTilesAt: __webpack_require__(503), - Randomize: __webpack_require__(502), - RemoveTileAt: __webpack_require__(231), - RemoveTileAtWorldXY: __webpack_require__(501), - RenderDebug: __webpack_require__(500), - ReplaceByIndex: __webpack_require__(233), - SetCollision: __webpack_require__(499), - SetCollisionBetween: __webpack_require__(498), - SetCollisionByExclusion: __webpack_require__(497), - SetCollisionByProperty: __webpack_require__(496), - SetCollisionFromCollisionGroup: __webpack_require__(495), - SetTileIndexCallback: __webpack_require__(494), - SetTileLocationCallback: __webpack_require__(493), - Shuffle: __webpack_require__(492), - SwapByIndex: __webpack_require__(491), - TileToWorldX: __webpack_require__(109), - TileToWorldXY: __webpack_require__(490), - TileToWorldY: __webpack_require__(108), - WeightedRandomize: __webpack_require__(489), - WorldToTileX: __webpack_require__(54), - WorldToTileXY: __webpack_require__(488), - WorldToTileY: __webpack_require__(53) + CalculateFacesAt: __webpack_require__(157), + CalculateFacesWithin: __webpack_require__(41), + Copy: __webpack_require__(557), + CreateFromTiles: __webpack_require__(556), + CullTiles: __webpack_require__(555), + Fill: __webpack_require__(554), + FilterTiles: __webpack_require__(553), + FindByIndex: __webpack_require__(552), + FindTile: __webpack_require__(551), + ForEachTile: __webpack_require__(550), + GetTileAt: __webpack_require__(117), + GetTileAtWorldXY: __webpack_require__(549), + GetTilesWithin: __webpack_require__(22), + GetTilesWithinShape: __webpack_require__(548), + GetTilesWithinWorldXY: __webpack_require__(547), + HasTileAt: __webpack_require__(250), + HasTileAtWorldXY: __webpack_require__(546), + IsInLayerBounds: __webpack_require__(94), + PutTileAt: __webpack_require__(156), + PutTileAtWorldXY: __webpack_require__(545), + PutTilesAt: __webpack_require__(544), + Randomize: __webpack_require__(543), + RemoveTileAt: __webpack_require__(249), + RemoveTileAtWorldXY: __webpack_require__(542), + RenderDebug: __webpack_require__(541), + ReplaceByIndex: __webpack_require__(251), + SetCollision: __webpack_require__(540), + SetCollisionBetween: __webpack_require__(539), + SetCollisionByExclusion: __webpack_require__(538), + SetCollisionByProperty: __webpack_require__(537), + SetCollisionFromCollisionGroup: __webpack_require__(536), + SetTileIndexCallback: __webpack_require__(535), + SetTileLocationCallback: __webpack_require__(534), + Shuffle: __webpack_require__(533), + SwapByIndex: __webpack_require__(532), + TileToWorldX: __webpack_require__(116), + TileToWorldXY: __webpack_require__(531), + TileToWorldY: __webpack_require__(115), + WeightedRandomize: __webpack_require__(530), + WorldToTileX: __webpack_require__(58), + WorldToTileXY: __webpack_require__(529), + WorldToTileY: __webpack_require__(57) }; /***/ }), -/* 112 */ +/* 119 */ /***/ (function(module, exports) { /** @@ -22338,12 +22932,12 @@ module.exports = Pair; /***/ }), -/* 113 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22353,47 +22947,43 @@ module.exports = Pair; module.exports = { - Bounce: __webpack_require__(550), - Collision: __webpack_require__(549), - Force: __webpack_require__(548), - Friction: __webpack_require__(547), - Gravity: __webpack_require__(546), - Mass: __webpack_require__(545), - Static: __webpack_require__(544), - Sensor: __webpack_require__(543), - SetBody: __webpack_require__(542), - Sleep: __webpack_require__(540), - Transform: __webpack_require__(539), - Velocity: __webpack_require__(538) + Bounce: __webpack_require__(604), + Collision: __webpack_require__(603), + Force: __webpack_require__(602), + Friction: __webpack_require__(601), + Gravity: __webpack_require__(600), + Mass: __webpack_require__(599), + Static: __webpack_require__(598), + Sensor: __webpack_require__(597), + SetBody: __webpack_require__(596), + Sleep: __webpack_require__(594), + Transform: __webpack_require__(581), + Velocity: __webpack_require__(580) }; /***/ }), -/* 114 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(264); -var Sprite = __webpack_require__(57); +var Components = __webpack_require__(283); +var Sprite = __webpack_require__(61); /** * @classdesc - * An Arcade Physics Sprite Game Object. + * An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * 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. + * The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image. + * If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites. * * @class Sprite * @extends Phaser.GameObjects.Sprite @@ -22476,12 +23066,12 @@ module.exports = ArcadeSprite; /***/ }), -/* 115 */ +/* 122 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22554,12 +23144,39 @@ module.exports = XHRSettings; /***/ }), -/* 116 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Keyboard.Events + */ + +module.exports = { + + ANY_KEY_DOWN: __webpack_require__(701), + ANY_KEY_UP: __webpack_require__(700), + COMBO_MATCH: __webpack_require__(699), + DOWN: __webpack_require__(698), + KEY_DOWN: __webpack_require__(697), + KEY_UP: __webpack_require__(696), + UP: __webpack_require__(695) + +}; + + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22577,6 +23194,10 @@ var inputPlugins = {}; * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used. */ +/** + * @namespace Phaser.Input.InputPluginCache + */ + var InputPluginCache = {}; /** @@ -22585,7 +23206,9 @@ var InputPluginCache = {}; * Plugin is the object to instantiate to create the plugin * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) * - * @method Phaser.Input.InputPluginCache.register + * @name Phaser.Input.InputPluginCache.register + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - A reference used to get this plugin from the plugin cache. @@ -22602,7 +23225,9 @@ InputPluginCache.register = function (key, plugin, mapping, settingsKey, configK /** * Returns the input plugin object from the cache based on the given key. * - * @method Phaser.Input.InputPluginCache.getCore + * @name Phaser.Input.InputPluginCache.getCore + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to get. @@ -22617,7 +23242,9 @@ InputPluginCache.getPlugin = function (key) /** * Installs all of the registered Input Plugins into the given target. * - * @method Phaser.Input.InputPluginCache.install + * @name Phaser.Input.InputPluginCache.install + * @type {function} + * @static * @since 3.10.0 * * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into. @@ -22645,7 +23272,9 @@ InputPluginCache.install = function (target) /** * Removes an input plugin based on the given key. * - * @method Phaser.Input.InputPluginCache.remove + * @name Phaser.Input.InputPluginCache.remove + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to remove. @@ -22662,12 +23291,12 @@ module.exports = InputPluginCache; /***/ }), -/* 117 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22738,19 +23367,20 @@ module.exports = LineToLine; /***/ }), -/* 118 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var GameObject = __webpack_require__(17); -var MeshRender = __webpack_require__(798); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var MeshRender = __webpack_require__(835); +var NOOP = __webpack_require__(2); /** * @classdesc @@ -22763,13 +23393,10 @@ var MeshRender = __webpack_require__(798); * @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.Mask - * @extends Phaser.GameObjects.Components.Origin * @extends Phaser.GameObjects.Components.Pipeline * @extends Phaser.GameObjects.Components.ScaleMode * @extends Phaser.GameObjects.Components.Size @@ -22793,13 +23420,10 @@ var Mesh = new Class({ Extends: GameObject, Mixins: [ - Components.Alpha, Components.BlendMode, Components.Depth, - Components.Flip, Components.GetBounds, Components.Mask, - Components.Origin, Components.Pipeline, Components.ScaleMode, Components.Size, @@ -22900,9 +23524,17 @@ var Mesh = new Class({ this.setTexture(texture, frame); this.setPosition(x, y); this.setSizeToFrame(); - this.setOrigin(); this.initPipeline(); - } + }, + + /** + * This method is left intentionally empty and does not do anything. + * It is retained to allow a Mesh or Quad to be added to a Container. + * + * @method Phaser.GameObjects.Mesh#setAlpha + * @since 3.17.0 + */ + setAlpha: NOOP }); @@ -22910,21 +23542,21 @@ module.exports = Mesh; /***/ }), -/* 119 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var GameObject = __webpack_require__(17); -var GetBitmapTextSize = __webpack_require__(913); -var ParseFromAtlas = __webpack_require__(912); -var Render = __webpack_require__(911); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var GetBitmapTextSize = __webpack_require__(954); +var ParseFromAtlas = __webpack_require__(953); +var Render = __webpack_require__(952); /** * The font data for an individual character of a Bitmap Font. @@ -22983,12 +23615,12 @@ var Render = __webpack_require__(911); * * To create a BitmapText data files you need a 3rd party app such as: * - * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ - * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner - * Littera (Web-based, free): http://kvazars.com/littera/ + * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/} + * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner} + * Littera (Web-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} * * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of - * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson + * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson} * * @class BitmapText * @extends Phaser.GameObjects.GameObject @@ -23554,33 +24186,76 @@ BitmapText.ALIGN_CENTER = 1; */ BitmapText.ALIGN_RIGHT = 2; +/** + * Parse an XML Bitmap Font from an Atlas. + * + * Adds the parsed Bitmap Font data to the cache with the `fontName` key. + * + * @name Phaser.GameObjects.BitmapText.ParseFromAtlas + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for. + * @param {string} fontName - The key of the font to add to the Bitmap Font cache. + * @param {string} textureKey - The key of the BitmapFont's texture. + * @param {string} frameKey - The key of the BitmapFont texture's frame. + * @param {string} xmlKey - The key of the XML data of the font to parse. + * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. + * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * + * @return {boolean} Whether the parsing was successful or not. + */ BitmapText.ParseFromAtlas = ParseFromAtlas; module.exports = BitmapText; /***/ }), -/* 120 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ //! stable.js 0.1.6, https://github.com/Two-Screen/stable //! © 2017 Angry Bytes and contributors. MIT licensed. +/** + * @namespace Phaser.Utils.Array.StableSortFunctions + */ + (function() { -// A stable array sort, because `Array#sort()` is not guaranteed stable. -// This is an implementation of merge sort, without recursion. - + /** + * A stable array sort, because `Array#sort()` is not guaranteed stable. + * This is an implementation of merge sort, without recursion. + * + * @function Phaser.Utils.Array.StableSort + * @since 3.0.0 + * + * @param {array} arr - The input array to be sorted. + * @param {function} comp - The comparison handler. + * + * @return {array} The sorted result. + */ var stable = function(arr, comp) { return exec(arr.slice(), comp); }; + /** + * Sort the input array and simply copy it back if the result isn't in the original array, which happens on an odd number of passes. + * + * @function Phaser.Utils.Array.StableSortFunctions.inplace + * @memberof Phaser.Utils.Array.StableSortFunctions + * @since 3.0.0 + * + * @param {array} arr - The input array. + * @param {function} comp - The comparison handler. + * + * @return {array} The sorted array. + */ stable.inplace = function(arr, comp) { var result = exec(arr, comp); @@ -23680,28 +24355,31 @@ else {} })(); /***/ }), -/* 121 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. - -var CheckMatrix = __webpack_require__(179); -var TransposeMatrix = __webpack_require__(343); +var CheckMatrix = __webpack_require__(191); +var TransposeMatrix = __webpack_require__(348); /** - * [description] + * Rotates the array matrix based on the given rotation value. + * + * The value can be given in degrees: 90, -90, 270, -270 or 180, + * or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * + * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. * * @function Phaser.Utils.Array.Matrix.RotateMatrix * @since 3.0.0 * * @param {array} matrix - The array to rotate. - * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. The value can be given in degrees: 90, -90, 270, -270 or 180, or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. * * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ @@ -23746,25 +24424,24 @@ module.exports = RotateMatrix; /***/ }), -/* 122 */ +/* 130 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayUtils = __webpack_require__(180); +var ArrayUtils = __webpack_require__(192); var Class = __webpack_require__(0); var NOOP = __webpack_require__(2); -var StableSort = __webpack_require__(120); +var StableSort = __webpack_require__(128); /** - * @callback EachListCallback - * @generic I - [item] + * @callback EachListCallback * - * @param {*} item - The item which is currently being processed. + * @param {I} item - The item which is currently being processed. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ @@ -23935,9 +24612,8 @@ var List = new Class({ }, /** - * Sort the contents of this List so the items are in order based - * on the given property. For example, `sort('alpha')` would sort the List - * contents based on the value of their `alpha` property. + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. * * @method Phaser.Structs.List#sort * @since 3.0.0 @@ -23945,38 +24621,28 @@ var List = new Class({ * @genericUse {T[]} - [children,$return] * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.Structs.List} This List object. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal handler for the {@link #sort} method which compares two items. - * - * @method Phaser.Structs.List#sortHandler - * @private - * @since 3.4.0 - * - * @genericUse {T} - [childA,childB] - * - * @param {*} childA - The first item to compare. - * @param {*} childB - The second item to compare. - * - * @return {integer} The result of the comparison, which will be negative if the first item is smaller then second, positive if the first item is larger than the second, or 0 if they're equal. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + StableSort.inplace(this.list, handler); + + return this; }, /** @@ -24022,7 +24688,6 @@ var List = new Class({ * @method Phaser.Structs.List#getFirst * @since 3.0.0 * - * @genericUse {T} - [value] * @genericUse {T | null} - [$return] * * @param {string} property - The name of the property to test or a falsey value to have no criterion. @@ -24034,7 +24699,7 @@ var List = new Class({ */ getFirst: function (property, value, startIndex, endIndex) { - return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex); + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); }, /** @@ -24184,7 +24849,7 @@ var List = new Class({ * @param {integer} [endIndex] - The position to stop removing at. The item at this position won't be removed. * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. * - * @return {Array.<*>} An array of the items which were removed.[description] + * @return {Array.<*>} An array of the items which were removed. */ removeBetween: function (startIndex, endIndex, skipCallback) { @@ -24461,7 +25126,8 @@ var List = new Class({ * The first item in the List or `null` for an empty List. * * @name Phaser.Structs.List#first - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -24487,7 +25153,8 @@ var List = new Class({ * The last item in the List, or `null` for an empty List. * * @name Phaser.Structs.List#last - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -24515,7 +25182,8 @@ var List = new Class({ * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. * * @name Phaser.Structs.List#next - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -24543,7 +25211,8 @@ var List = new Class({ * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. * * @name Phaser.Structs.List#previous - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -24571,12 +25240,12 @@ module.exports = List; /***/ }), -/* 123 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -25388,18 +26057,19 @@ module.exports = Frame; /***/ }), -/* 124 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(75); var Extend = __webpack_require__(21); var NOOP = __webpack_require__(2); @@ -25858,6 +26528,7 @@ var BaseSound = new Class({ * Destroys this sound and all associated events and marks it for removal from the sound manager. * * @method Phaser.Sound.BaseSound#destroy + * @fires Phaser.Sound.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -25867,7 +26538,7 @@ var BaseSound = new Class({ return; } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); this.pendingRemove = true; this.manager = null; this.key = ''; @@ -25886,19 +26557,21 @@ module.exports = BaseSound; /***/ }), -/* 125 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Clone = __webpack_require__(69); -var EventEmitter = __webpack_require__(11); +var Clone = __webpack_require__(76); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(75); +var GameEvents = __webpack_require__(28); var NOOP = __webpack_require__(2); /** @@ -25913,7 +26586,7 @@ var NOOP = __webpack_require__(2); /** * Audio sprite sound type. * - * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound + * @typedef {object} AudioSpriteSound * * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. */ @@ -26053,7 +26726,7 @@ var BaseSoundManager = new Class({ */ this.unlocked = false; - game.events.on('blur', function () + game.events.on(GameEvents.BLUR, function () { if (this.pauseOnBlur) { @@ -26061,7 +26734,7 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('focus', function () + game.events.on(GameEvents.FOCUS, function () { if (this.pauseOnBlur) { @@ -26069,8 +26742,8 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('prestep', this.update, this); - game.events.once('destroy', this.destroy, this); + game.events.on(GameEvents.PRE_STEP, this.update, this); + game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -26098,7 +26771,7 @@ var BaseSoundManager = new Class({ * @param {string} key - Asset key for the sound. * @param {SoundConfig} [config] - An optional config object containing default sound settings. * - * @return {Phaser.Sound.BaseSound.AudioSpriteSound} The new audio sprite sound instance. + * @return {AudioSpriteSound} The new audio sprite sound instance. */ addAudioSprite: function (key, config) { @@ -26137,6 +26810,7 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#play + * @listens Phaser.Sound.Events#COMPLETE * @since 3.0.0 * * @param {string} key - Asset key for the sound. @@ -26148,7 +26822,7 @@ var BaseSoundManager = new Class({ { var sound = this.add(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); if (extra) { @@ -26174,6 +26848,7 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#playAudioSprite + * @listens Phaser.Sound.Events#COMPLETE * @since 3.0.0 * * @param {string} key - Asset key for the sound. @@ -26186,7 +26861,7 @@ var BaseSoundManager = new Class({ { var sound = this.addAudioSprite(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); return sound.play(spriteName, config); }, @@ -26250,16 +26925,11 @@ var BaseSoundManager = new Class({ return removed; }, - /** - * @event Phaser.Sound.BaseSoundManager#pauseall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Pauses all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#pauseAll - * @fires Phaser.Sound.BaseSoundManager#pauseall + * @fires Phaser.Sound.Events#PAUSE_ALL * @since 3.0.0 */ pauseAll: function () @@ -26269,19 +26939,14 @@ var BaseSoundManager = new Class({ sound.pause(); }); - this.emit('pauseall', this); + this.emit(Events.PAUSE_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#resumeall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Resumes all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#resumeAll - * @fires Phaser.Sound.BaseSoundManager#resumeall + * @fires Phaser.Sound.Events#RESUME_ALL * @since 3.0.0 */ resumeAll: function () @@ -26291,19 +26956,14 @@ var BaseSoundManager = new Class({ sound.resume(); }); - this.emit('resumeall', this); + this.emit(Events.RESUME_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#stopall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Stops all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#stopAll - * @fires Phaser.Sound.BaseSoundManager#stopall + * @fires Phaser.Sound.Events#STOP_ALL * @since 3.0.0 */ stopAll: function () @@ -26313,7 +26973,7 @@ var BaseSoundManager = new Class({ sound.stop(); }); - this.emit('stopall', this); + this.emit(Events.STOP_ALL, this); }, /** @@ -26357,6 +27017,7 @@ var BaseSoundManager = new Class({ * * @method Phaser.Sound.BaseSoundManager#update * @protected + * @fires Phaser.Sound.Events#UNLOCKED * @since 3.0.0 * * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. @@ -26369,11 +27030,7 @@ var BaseSoundManager = new Class({ 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); + this.emit(Events.UNLOCKED, this); } for (var i = this.sounds.length - 1; i >= 0; i--) @@ -26434,12 +27091,6 @@ var BaseSoundManager = new Class({ }); }, - /** - * @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. - */ - /** * Sets the global playback rate at which all the sounds will be played. * @@ -26447,7 +27098,7 @@ var BaseSoundManager = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.BaseSoundManager#setRate - * @fires Phaser.Sound.BaseSoundManager#rate + * @fires Phaser.Sound.Events#GLOBAL_RATE * @since 3.3.0 * * @param {number} value - Global playback rate at which all the sounds will be played. @@ -26487,7 +27138,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('rate', this, value); + this.emit(Events.GLOBAL_RATE, this, value); } }, @@ -26497,7 +27148,7 @@ var BaseSoundManager = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.BaseSoundManager#setDetune - * @fires Phaser.Sound.BaseSoundManager#detune + * @fires Phaser.Sound.Events#GLOBAL_DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -26511,12 +27162,6 @@ var BaseSoundManager = new Class({ return this; }, - /** - * @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. - */ - /** * 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). @@ -26542,7 +27187,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('detune', this, value); + this.emit(Events.GLOBAL_DETUNE, this, value); } } @@ -26553,12 +27198,12 @@ module.exports = BaseSoundManager; /***/ }), -/* 126 */ +/* 134 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -26675,7281 +27320,19 @@ var CONST = { module.exports = CONST; -/***/ }), -/* 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} - */ - -/** - * 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; - - -/***/ }), -/* 128 */ -/***/ (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 OS = __webpack_require__(101); - -/** - * 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. - * - * @typedef {object} Phaser.Device.Browser - * @since 3.0.0 - * - * @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(); - - -/***/ }), -/* 129 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates a linear (interpolation) value over t. - * - * @function Phaser.Math.Linear - * @since 3.0.0 - * - * @param {number} p0 - The first point. - * @param {number} p1 - The second point. - * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1. - * - * @return {number} The step t% of the way between p0 and p1. - */ -var Linear = function (p0, p1, t) -{ - return (p1 - p0) * t + p0; -}; - -module.exports = Linear; - - -/***/ }), -/* 130 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// 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 () -{ - /** - * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. - * - * @function Phaser.Display.Canvas.Smoothing.getPrefix - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {string} [description] - */ - var getPrefix = function (context) - { - var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; - - for (var i = 0; i < vendors.length; i++) - { - var s = vendors[i] + 'mageSmoothingEnabled'; - - if (s in context) - { - return s; - } - } - - return null; - }; - - /** - * 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 - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description] - */ - var enable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = true; - } - - return context; - }; - - /** - * 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 - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description] - */ - var disable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = false; - } - - return context; - }; - - /** - * 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 - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] - * - * @return {?boolean} [description] - */ - var isEnabled = function (context) - { - return (prefix !== null) ? context[prefix] : null; - }; - - return { - disable: disable, - enable: enable, - getPrefix: getPrefix, - isEnabled: isEnabled - }; - -}; - -module.exports = Smoothing(); - - -/***/ }), -/* 131 */ -/***/ (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__(16); -var DegToRad = __webpack_require__(36); -var EventEmitter = __webpack_require__(11); -var Rectangle = __webpack_require__(10); -var TransformMatrix = __webpack_require__(42); -var ValueToColor = __webpack_require__(196); -var Vector2 = __webpack_require__(3); - -/** - * @typedef {object} JSONCameraBounds - * @property {number} x - The horizontal position of camera - * @property {number} y - The vertical position of camera - * @property {number} width - The width size of camera - * @property {number} height - The height size of camera - */ - -/** - * @typedef {object} JSONCamera - * - * @property {string} name - The name of the camera - * @property {number} x - The horizontal position of camera - * @property {number} y - The vertical position of camera - * @property {number} width - The width size of camera - * @property {number} height - The height size of camera - * @property {number} zoom - The zoom of camera - * @property {number} rotation - The rotation of camera - * @property {boolean} roundPixels - The round pixels st status of camera - * @property {number} scrollX - The horizontal scroll of camera - * @property {number} scrollY - The vertical scroll of camera - * @property {string} backgroundColor - The background color of camera - * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera - */ - -/** - * @classdesc - * A Base Camera class. - * - * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, - * and can be positioned, rotated, zoomed and scrolled accordingly. - * - * A Camera consists of two elements: The viewport and the scroll values. - * - * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are - * created the same size as your game, but their position and size can be set to anything. This means if you - * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, - * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). - * - * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this - * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the - * viewport, and changing the viewport has no impact on the scrolling. - * - * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. - * - * The Base Camera is extended by the Camera class, which adds in special effects including Fade, - * Flash and Camera Shake, as well as the ability to follow Game Objects. - * - * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow - * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate - * to when they were added to the Camera class. - * - * @class BaseCamera - * @memberof Phaser.Cameras.Scene2D - * @constructor - * @since 3.12.0 - * - * @extends Phaser.Events.EventEmitter - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.Visible - * - * @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 BaseCamera = new Class({ - - Extends: EventEmitter, - - Mixins: [ - Components.Alpha, - Components.Visible - ], - - initialize: - - function BaseCamera (x, y, width, height) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 0; } - if (height === undefined) { height = 0; } - - EventEmitter.call(this); - - /** - * A reference to the Scene this camera belongs to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene; - - /** - * A reference to the Game Scene Manager. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager - * @type {Phaser.Scenes.SceneManager} - * @since 3.12.0 - */ - this.sceneManager; - - /** - * A reference to the Game Config. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#config - * @type {object} - * @readonly - * @since 3.12.0 - */ - this.config; - - /** - * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. - * This value is a bitmask. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#id - * @type {integer} - * @readonly - * @since 3.11.0 - */ - this.id = 0; - - /** - * The name of the Camera. This is left empty for your own use. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; - - /** - * The resolution of the Game, used in most Camera calculations. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#resolution - * @type {number} - * @readonly - * @since 3.12.0 - */ - this.resolution = 1; - - /** - * Should this camera round its pixel values to integers? - * - * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.roundPixels = false; - - /** - * Is this Camera visible or not? - * - * A visible camera will render and perform input tests. - * An invisible camera will not render anything and will skip input tests. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#visible - * @type {boolean} - * @default true - * @since 3.10.0 - */ - - /** - * Is this Camera using a bounds to restrict scrolling movement? - * - * Set this property along with the bounds via `Camera.setBounds`. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.useBounds = false; - - /** - * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at. - * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. - * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. - * You can use it for culling or intersection checks. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#worldView - * @type {Phaser.Geom.Rectangle} - * @readonly - * @since 3.11.0 - */ - this.worldView = new Rectangle(); - - /** - * Is this Camera dirty? - * - * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. - * - * This flag is cleared during the `postRenderCamera` method of the renderer. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#dirty - * @type {boolean} - * @default true - * @since 3.11.0 - */ - this.dirty = true; - - /** - * The x position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollX` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#x - * @type {number} - * @private - * @since 3.0.0 - */ - this._x = x; - - /** - * The y position of the Camera, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollY` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#y - * @type {number} - * @private - * @since 3.0.0 - */ - this._y = y; - - /** - * Internal Camera X value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cx - * @type {number} - * @private - * @since 3.12.0 - */ - this._cx = 0; - - /** - * Internal Camera Y value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cy - * @type {number} - * @private - * @since 3.12.0 - */ - this._cy = 0; - - /** - * Internal Camera Width value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cw - * @type {number} - * @private - * @since 3.12.0 - */ - this._cw = 0; - - /** - * Internal Camera Height value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_ch - * @type {number} - * @private - * @since 3.12.0 - */ - this._ch = 0; - - /** - * The width of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_width - * @type {number} - * @private - * @since 3.11.0 - */ - this._width = width; - - /** - * The height of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_height - * @type {number} - * @private - * @since 3.11.0 - */ - this._height = height; - - /** - * The bounds the camera is restrained to during scrolling. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds - * @type {Phaser.Geom.Rectangle} - * @private - * @since 3.0.0 - */ - this._bounds = new Rectangle(); - - /** - * The horizontal scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - this._scrollX = 0; - - /** - * The vertical scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - this._scrollY = 0; - - /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. - * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. - * - * Set to 1 to return to the default zoom level. - * - * Be careful to never set this value to zero. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom - * @type {number} - * @private - * @default 1 - * @since 3.11.0 - */ - this._zoom = 1; - - /** - * The rotation of the Camera in radians. - * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. - * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - this._rotation = 0; - - /** - * A local transform matrix used for internal calculations. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#matrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.0.0 - */ - this.matrix = new TransformMatrix(); - - /** - * Does this Camera have a transparent background? - * - * @name Phaser.Cameras.Scene2D.BaseCamera#transparent - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.transparent = true; - - /** - * The background color of this Camera. Only used if `transparent` is `false`. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor - * @type {Phaser.Display.Color} - * @since 3.0.0 - */ - this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); - - /** - * The Camera alpha value. Setting this property impacts every single object that this Camera - * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out, - * or via the chainable `setAlpha` method instead. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#alpha - * @type {number} - * @default 1 - * @since 3.11.0 - */ - - /** - * Should the camera cull Game Objects before checking them for input hit tests? - * In some special cases it may be beneficial to disable this. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.disableCull = false; - - /** - * A temporary array of culled objects. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects - * @type {Phaser.GameObjects.GameObject[]} - * @default [] - * @private - * @since 3.0.0 - */ - this.culledObjects = []; - - /** - * The mid-point of the Camera in 'world' coordinates. - * - * Use it to obtain exactly where in the world the center of the camera is currently looking. - * - * This value is updated in the preRender method, after the scroll values and follower - * have been processed. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.11.0 - */ - this.midPoint = new Vector2(width / 2, height / 2); - - /** - * The horizontal origin of rotation for this Camera. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * See `setOrigin` to set both origins in a single, chainable call. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#originX - * @type {number} - * @default 0.5 - * @since 3.11.0 - */ - this.originX = 0.5; - - /** - * The vertical origin of rotation for this Camera. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * See `setOrigin` to set both origins in a single, chainable call. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#originY - * @type {number} - * @default 0.5 - * @since 3.11.0 - */ - this.originY = 0.5; - - /** - * Does this Camera have a custom viewport? - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport - * @type {boolean} - * @private - * @default false - * @since 3.12.0 - */ - this._customViewport = false; - }, - - /** - * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha - * @since 3.11.0 - * - * @param {number} [value=1] - The Camera alpha value. - * - * @return {this} This Camera instance. - */ - - /** - * Sets the rotation origin of this Camera. - * - * The values are given in the range 0 to 1 and are only used when calculating Camera rotation. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin - * @since 3.11.0 - * - * @param {number} [x=0.5] - The horizontal origin value. - * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. - * - * @return {this} This Camera instance. - */ - setOrigin: function (x, y) - { - if (x === undefined) { x = 0.5; } - if (y === undefined) { y = x; } - - this.originX = x; - this.originY = y; - - return this; - }, - - /** - * Calculates what the Camera.scrollX and scrollY values would need to be in order to move - * the Camera so it is centered on the given x and y coordinates, without actually moving - * the Camera there. The results are clamped based on the Camera bounds, if set. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll - * @since 3.11.0 - * - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * @param {Phaser.Math.Vector2} [out] - A Vec2 to store the values in. If not given a new Vec2 is created. - * - * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` abd `y` properties. - */ - getScroll: function (x, y, out) - { - if (out === undefined) { out = new Vector2(); } - - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - out.x = x - originX; - out.y = y - originY; - - if (this.useBounds) - { - out.x = this.clampX(out.x); - out.y = this.clampY(out.y); - } - - return out; - }, - - /** - * Moves the Camera so that it is centered on the given coordinates, bounds allowing. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn - * @since 3.11.0 - * - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - centerOn: function (x, y) - { - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - this.midPoint.set(x, y); - - this.scrollX = x - originX; - this.scrollY = y - originY; - - if (this.useBounds) - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } - - return this; - }, - - /** - * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds - * @since 3.0.0 - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - centerToBounds: function () - { - if (this.useBounds) - { - var bounds = this._bounds; - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - this.midPoint.set(bounds.centerX, bounds.centerY); - - this.scrollX = bounds.centerX - originX; - this.scrollY = bounds.centerY - originY; - } - - return this; - }, - - /** - * Moves the Camera so that it is re-centered based on its viewport size. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize - * @since 3.0.0 - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - centerToSize: function () - { - this.scrollX = this.width * 0.5; - this.scrollY = this.height * 0.5; - - return this; - }, - - /** - * Takes an array of Game Objects and returns a new array featuring only those objects - * visible by this camera. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#cull - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return] - * - * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull. - * - * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera. - */ - cull: function (renderableObjects) - { - if (this.disableCull) - { - return renderableObjects; - } - - 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 renderableObjects; - } - - 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 culledObjects = this.culledObjects; - var length = renderableObjects.length; - - determinant = 1 / determinant; - - culledObjects.length = 0; - - for (var index = 0; index < length; ++index) - { - var object = renderableObjects[index]; - - if (!object.hasOwnProperty('width') || object.parentContainer) - { - culledObjects.push(object); - continue; - } - - 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); - } - } - - return culledObjects; - }, - - /** - * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform. - * You can optionally provide a Vector2, or similar object, to store the results in. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {number} x - The x position to convert to world space. - * @param {number} y - The y position to convert to world space. - * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties. - */ - getWorldPoint: function (x, y, output) - { - 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]; - - // Invert Matrix - var determinant = (mva * mvd) - (mvb * mvc); - - if (!determinant) - { - output.x = x; - output.y = y; - - return output; - } - - 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 res = this.resolution; - - var scrollX = this.scrollX; - var scrollY = this.scrollY; - - // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks - var sx = x + ((scrollX * c - scrollY * s) * zoom); - var sy = y + ((scrollX * s + scrollY * c) * zoom); - - // Apply transform to point - output.x = (sx * ima + sy * imc) * res + ime; - output.y = (sx * imb + sy * imd) * res + imf; - - return output; - }, - - /** - * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings - * so that they are ignored by this Camera. This means they will not be rendered by this Camera. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#ignore - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group)} entries - The Game Object, or array of Game Objects, to be ignored by this Camera. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - ignore: function (entries) - { - var id = this.id; - - if (!Array.isArray(entries)) - { - entries = [ entries ]; - } - - for (var i = 0; i < entries.length; i++) - { - var entry = entries[i]; - - if (Array.isArray(entry)) - { - this.ignore(entry); - } - else if (entry.isParent) - { - this.ignore(entry.getChildren()); - } - else - { - entry.cameraFilter |= id; - } - } - - return this; - }, - - /** - * Internal preRender step. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#preRender - * @protected - * @since 3.0.0 - * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. - */ - preRender: function (baseScale, resolution) - { - var width = this.width; - var height = this.height; - - var halfWidth = width * 0.5; - var halfHeight = height * 0.5; - - var zoom = this.zoom * baseScale; - var matrix = this.matrix; - - var originX = width * this.originX; - var originY = height * this.originY; - - var sx = this.scrollX; - var sy = this.scrollY; - - if (this.useBounds) - { - sx = this.clampX(sx); - sy = this.clampY(sy); - } - - if (this.roundPixels) - { - originX = Math.round(originX); - originY = Math.round(originY); - } - - // Values are in pixels and not impacted by zooming the Camera - this.scrollX = sx; - this.scrollY = sy; - - var midX = sx + halfWidth; - var midY = sy + halfHeight; - - // The center of the camera, in world space, so taking zoom into account - // Basically the pixel value of what it's looking at in the middle of the cam - this.midPoint.set(midX, midY); - - var displayWidth = width / zoom; - var displayHeight = height / zoom; - - this.worldView.setTo( - midX - (displayWidth / 2), - midY - (displayHeight / 2), - displayWidth, - displayHeight - ); - - 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); - }, - - /** - * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required. - * Do not call this method if you are not using camera bounds. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#clampX - * @since 3.11.0 - * - * @param {number} x - The value to horizontally scroll clamp. - * - * @return {number} The adjusted value to use as scrollX. - */ - clampX: function (x) - { - var bounds = this._bounds; - - var dw = this.displayWidth; - - var bx = bounds.x + ((dw - this.width) / 2); - var bw = Math.max(bx, bx + bounds.width - dw); - - if (x < bx) - { - x = bx; - } - else if (x > bw) - { - x = bw; - } - - return x; - }, - - /** - * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required. - * Do not call this method if you are not using camera bounds. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#clampY - * @since 3.11.0 - * - * @param {number} y - The value to vertically scroll clamp. - * - * @return {number} The adjusted value to use as scrollY. - */ - clampY: function (y) - { - var bounds = this._bounds; - - var dh = this.displayHeight; - - var by = bounds.y + ((dh - this.height) / 2); - var bh = Math.max(by, by + bounds.height - dh); - - if (y < by) - { - y = by; - } - else if (y > bh) - { - y = bh; - } - - return y; - }, - - /* - var gap = this._zoomInversed; - return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap); - */ - - /** - * If this Camera has previously had movement bounds set on it, this will remove them. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds - * @since 3.0.0 - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - removeBounds: function () - { - this.useBounds = false; - - this.dirty = true; - - this._bounds.setEmpty(); - - return this; - }, - - /** - * Set the rotation of this Camera. This causes everything it renders to appear rotated. - * - * Rotating a camera does not rotate the viewport itself, it is applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle - * @since 3.0.0 - * - * @param {number} [value=0] - The cameras angle of rotation, given in degrees. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setAngle: function (value) - { - if (value === undefined) { value = 0; } - - this.rotation = DegToRad(value); - - return this; - }, - - /** - * Sets the background color for this Camera. - * - * By default a Camera has a transparent background but it can be given a solid color, with any level - * of transparency, via this method. - * - * The color value can be specified using CSS color notation, hex or numbers. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor - * @since 3.0.0 - * - * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setBackgroundColor: function (color) - { - if (color === undefined) { color = 'rgba(0,0,0,0)'; } - - this.backgroundColor = ValueToColor(color); - - this.transparent = (this.backgroundColor.alpha === 0); - - return this; - }, - - /** - * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. - * - * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the - * edges and into blank space. It does not limit the placement of Game Objects, or where - * the Camera viewport can be positioned. - * - * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. - * - * Clear the bounds entirely by calling `Camera.removeBounds`. - * - * If you set bounds that are smaller than the viewport it will stop the Camera from being - * able to scroll. The bounds can be positioned where-ever you wish. By default they are from - * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of - * the Camera bounds. However, you can position them anywhere. So if you wanted a game world - * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y - * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find - * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds - * @since 3.0.0 - * - * @param {integer} x - The top-left x coordinate of the bounds. - * @param {integer} y - The top-left y coordinate of the bounds. - * @param {integer} width - The width of the bounds, in pixels. - * @param {integer} height - The height of the bounds, in pixels. - * @param {boolean} [centerOn] - If `true` the Camera will automatically be centered on the new bounds. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setBounds: function (x, y, width, height, centerOn) - { - this._bounds.setTo(x, y, width, height); - - this.dirty = true; - this.useBounds = true; - - if (centerOn) - { - this.centerToBounds(); - } - else - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } - - return this; - }, - - /** - * Sets the name of this Camera. - * This value is for your own use and isn't used internally. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setName - * @since 3.0.0 - * - * @param {string} [value=''] - The name of the Camera. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setName: function (value) - { - if (value === undefined) { value = ''; } - - this.name = value; - - return this; - }, - - /** - * Set the position of the Camera viewport within the game. - * - * This does not change where the camera is 'looking'. See `setScroll` to control that. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition - * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the Camera viewport. - * @param {number} [y=x] - The top-left y coordinate of the Camera viewport. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setPosition: function (x, y) - { - if (y === undefined) { y = x; } - - this.x = x; - this.y = y; - - return this; - }, - - /** - * Set the rotation of this Camera. This causes everything it renders to appear rotated. - * - * Rotating a camera does not rotate the viewport itself, it is applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation - * @since 3.0.0 - * - * @param {number} [value=0] - The rotation of the Camera, in radians. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setRotation: function (value) - { - if (value === undefined) { value = 0; } - - this.rotation = value; - - return this; - }, - - /** - * Should the Camera round pixel values to whole integers when rendering Game Objects? - * - * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels - * @since 3.0.0 - * - * @param {boolean} value - `true` to round Camera pixels, `false` to not. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setRoundPixels: function (value) - { - this.roundPixels = value; - - return this; - }, - - /** - * Sets the Scene the Camera is bound to. - * - * Also populates the `resolution` property and updates the internal size values. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setScene - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene the camera is bound to. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setScene: function (scene) - { - if (this.scene && this._customViewport) - { - this.sceneManager.customViewports--; - } - - this.scene = scene; - - this.config = scene.sys.game.config; - this.sceneManager = scene.sys.game.scene; - - var res = this.config.resolution; - - this.resolution = res; - - this._cx = this._x * res; - this._cy = this._y * res; - this._cw = this._width * res; - this._ch = this._height * res; - - this.updateSystem(); - - return this; - }, - - /** - * Set the position of where the Camera is looking within the game. - * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly. - * Use this method, or the scroll properties, to move your camera around the game world. - * - * This does not change where the camera viewport is placed. See `setPosition` to control that. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll - * @since 3.0.0 - * - * @param {number} x - The x coordinate of the Camera in the game world. - * @param {number} [y=x] - The y coordinate of the Camera in the game world. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setScroll: function (x, y) - { - if (y === undefined) { y = x; } - - this.scrollX = x; - this.scrollY = y; - - return this; - }, - - /** - * Set the size of the Camera viewport. - * - * By default a Camera is the same size as the game, but can be made smaller via this method, - * allowing you to create mini-cam style effects by creating and positioning a smaller Camera - * viewport within your game. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setSize - * @since 3.0.0 - * - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setSize: function (width, height) - { - if (height === undefined) { height = width; } - - this.width = width; - this.height = height; - - return this; - }, - - /** - * This method sets the position and size of the Camera viewport in a single call. - * - * If you're trying to change where the Camera is looking at in your game, then see - * the method `Camera.setScroll` instead. This method is for changing the viewport - * itself, not what the camera can see. - * - * By default a Camera is the same size as the game, but can be made smaller via this method, - * allowing you to create mini-cam style effects by creating and positioning a smaller Camera - * viewport within your game. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport - * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the Camera viewport. - * @param {number} y - The top-left y coordinate of the Camera viewport. - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setViewport: function (x, y, width, height) - { - this.x = x; - this.y = y; - this.width = width; - this.height = height; - - return this; - }, - - /** - * Set the zoom value of the Camera. - * - * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. - * Changing to a larger value, such as 2, will cause the camera to 'zoom in'. - * - * A value of 1 means 'no zoom' and is the default. - * - * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom - * @since 3.0.0 - * - * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001. - * - * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. - */ - setZoom: function (value) - { - if (value === undefined) { value = 1; } - - if (value === 0) - { - value = 0.001; - } - - this.zoom = value; - - return this; - }, - - /** - * Sets the visibility of this Camera. - * - * An invisible Camera will skip rendering and input tests of everything it can see. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible - * @since 3.10.0 - * - * @param {boolean} value - The visible state of the Camera. - * - * @return {this} This Camera instance. - */ - - /** - * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON - * @since 3.0.0 - * - * @return {JSONCamera} A well-formed object suitable for conversion to JSON. - */ - toJSON: function () - { - 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 - }; - } - - return output; - }, - - /** - * Internal method called automatically by the Camera Manager. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#update - * @protected - * @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, in ms, elapsed since the last frame. - */ - update: function () - { - // NOOP - }, - - /** - * Internal method called automatically when the viewport changes. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem - * @private - * @since 3.12.0 - */ - updateSystem: function () - { - if (!this.config) - { - return; - } - - var custom = (this._x !== 0 || this._y !== 0 || this.config.width !== this._width || this.config.height !== this._height); - - var sceneManager = this.sceneManager; - - if (custom && !this._customViewport) - { - // We need a custom viewport for this Camera - sceneManager.customViewports++; - } - else if (!custom && this._customViewport) - { - // We're turning off a custom viewport for this Camera - sceneManager.customViewports--; - } - - this.dirty = true; - this._customViewport = custom; - }, - - /** - * This event is fired when a camera is destroyed by the Camera Manager. - * - * @event CameraDestroyEvent - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. - */ - - /** - * Destroys this Camera instance and its internal properties and references. - * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. - * - * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. - * - * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, - * rather than calling this method directly. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#destroy - * @fires CameraDestroyEvent - * @since 3.0.0 - */ - destroy: function () - { - this.emit('cameradestroy', this); - - this.removeAllListeners(); - - this.matrix.destroy(); - - this.culledObjects = []; - - if (this._customViewport) - { - // We're turning off a custom viewport for this Camera - this.sceneManager.customViewports--; - } - - this._bounds = null; - - this.scene = null; - this.config = null; - this.sceneManager = null; - }, - - /** - * The x position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollX` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#x - * @type {number} - * @since 3.0.0 - */ - x: { - - get: function () - { - return this._x; - }, - - set: function (value) - { - this._x = value; - this._cx = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The y position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollY` value. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#y - * @type {number} - * @since 3.0.0 - */ - y: { - - get: function () - { - return this._y; - }, - - set: function (value) - { - this._y = value; - this._cy = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The width of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#width - * @type {number} - * @since 3.0.0 - */ - width: { - - get: function () - { - return this._width; - }, - - set: function (value) - { - this._width = value; - this._cw = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The height of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#height - * @type {number} - * @since 3.0.0 - */ - height: { - - get: function () - { - return this._height; - }, - - set: function (value) - { - this._height = value; - this._ch = value * this.resolution; - this.updateSystem(); - } - - }, - - /** - * The horizontal scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - scrollX: { - - get: function () - { - return this._scrollX; - }, - - set: function (value) - { - this._scrollX = value; - this.dirty = true; - } - - }, - - /** - * The vertical scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - scrollY: { - - get: function () - { - return this._scrollY; - }, - - set: function (value) - { - this._scrollY = value; - this.dirty = true; - } - - }, - - /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. - * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. - * - * Set to 1 to return to the default zoom level. - * - * Be careful to never set this value to zero. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#zoom - * @type {number} - * @default 1 - * @since 3.0.0 - */ - zoom: { - - get: function () - { - return this._zoom; - }, - - set: function (value) - { - this._zoom = value; - this.dirty = true; - } - - }, - - /** - * The rotation of the Camera in radians. - * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. - * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#rotation - * @type {number} - * @private - * @default 0 - * @since 3.11.0 - */ - rotation: { - - get: function () - { - return this._rotation; - }, - - set: function (value) - { - this._rotation = value; - this.dirty = true; - } - - }, - - /** - * The x position of the center of the Camera's viewport, relative to the top-left of the game canvas. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#centerX - * @type {number} - * @readonly - * @since 3.10.0 - */ - centerX: { - - get: function () - { - return this.x + (0.5 * this.width); - } - - }, - - /** - * The y position of the center of the Camera's viewport, relative to the top-left of the game canvas. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#centerY - * @type {number} - * @readonly - * @since 3.10.0 - */ - centerY: { - - get: function () - { - return this.y + (0.5 * this.height); - } - - }, - - /** - * The displayed width of the camera viewport, factoring in the camera zoom level. - * - * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width - * would be 1600, as it's displaying twice as many pixels as zoom level 1. - * - * Equally, a camera with a width of 800 and zoom of 2 would have a display width - * of 400 pixels. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth - * @type {number} - * @readonly - * @since 3.11.0 - */ - displayWidth: { - - get: function () - { - return this.width / this.zoom; - } - - }, - - /** - * The displayed height of the camera viewport, factoring in the camera zoom level. - * - * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height - * would be 1200, as it's displaying twice as many pixels as zoom level 1. - * - * Equally, a camera with a height of 600 and zoom of 2 would have a display height - * of 300 pixels. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight - * @type {number} - * @readonly - * @since 3.11.0 - */ - displayHeight: { - - get: function () - { - return this.height / this.zoom; - } - - } - -}); - -module.exports = BaseCamera; - - -/***/ }), -/* 132 */ -/***/ (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--) - { - var j = Math.floor(Math.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - - return array; -}; - -module.exports = Shuffle; - - -/***/ }), -/* 133 */ -/***/ (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 WebGL rendering pipeline of a Game Object. - * - * @name Phaser.GameObjects.Components.Pipeline - * @webglOnly - * @since 3.0.0 - */ - -var Pipeline = { - - /** - * The initial WebGL pipeline of this Game Object. - * - * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - defaultPipeline: null, - - /** - * The current WebGL pipeline of this Game Object. - * - * @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 - * @since 3.0.0 - * - * @param {string} [pipelineName=TextureTintPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. - */ - initPipeline: function (pipelineName) - { - if (pipelineName === undefined) { pipelineName = 'TextureTintPipeline'; } - - var renderer = this.scene.sys.game.renderer; - - if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) - { - this.defaultPipeline = renderer.getPipeline(pipelineName); - this.pipeline = this.defaultPipeline; - - return true; - } - - 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 {this} This Game Object instance. - */ - setPipeline: function (pipelineName) - { - var renderer = this.scene.sys.game.renderer; - - if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) - { - this.pipeline = renderer.getPipeline(pipelineName); - } - - return this; - }, - - /** - * 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; - - -/***/ }), -/* 134 */ -/***/ (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.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); -}; - -module.exports = Perimeter; - - /***/ }), /* 135 */ -/***/ (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__(72); -var Circle = __webpack_require__(81); -var CircleContains = __webpack_require__(44); -var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var GameObject = __webpack_require__(17); -var Rectangle = __webpack_require__(10); -var RectangleContains = __webpack_require__(43); - -/** - * @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 - The Scene to which this Game Object belongs. - * @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. - * - * @name Phaser.GameObjects.Zone#blendMode - * @type {integer} - * @since 3.0.0 - */ - this.blendMode = BlendModes.NORMAL; - - this.updateDisplayOrigin(); - }, - - /** - * 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; - }, - - 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.Zone#displayHeight - * @type {number} - * @since 3.0.0 - */ - displayHeight: { - - get: function () - { - return this.scaleY * this.height; - }, - - set: function (value) - { - this.scaleY = value / this.height; - } - - }, - - /** - * Sets the size of this Game Object. - * - * @method Phaser.GameObjects.Zone#setSize - * @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. - * - * @return {Phaser.GameObjects.Zone} This Game Object. - */ - setSize: function (width, height, resizeInput) - { - if (resizeInput === undefined) { resizeInput = true; } - - this.width = width; - this.height = height; - - if (resizeInput && this.input && this.input.hitArea instanceof Rectangle) - { - this.input.hitArea.width = width; - this.input.hitArea.height = height; - } - - return this; - }, - - /** - * Sets the display size of this Game Object. - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Zone#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.Zone} This Game Object. - */ - setDisplaySize: function (width, height) - { - this.displayWidth = width; - this.displayHeight = height; - - return this; - }, - - /** - * Sets this Zone to be a Circular Drop Zone. - * The circle is centered on this Zones `x` and `y` coordinates. - * - * @method Phaser.GameObjects.Zone#setCircleDropZone - * @since 3.0.0 - * - * @param {number} radius - The radius of the Circle that will form the Drop Zone. - * - * @return {Phaser.GameObjects.Zone} This Game Object. - */ - setCircleDropZone: function (radius) - { - return this.setDropZone(new Circle(0, 0, radius), CircleContains); - }, - - /** - * Sets this Zone to be a Rectangle Drop Zone. - * The rectangle is centered on this Zones `x` and `y` coordinates. - * - * @method Phaser.GameObjects.Zone#setRectangleDropZone - * @since 3.0.0 - * - * @param {number} width - The width of the rectangle drop zone. - * @param {number} height - The height of the rectangle drop zone. - * - * @return {Phaser.GameObjects.Zone} This Game Object. - */ - setRectangleDropZone: function (width, height) - { - return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains); - }, - - /** - * Allows you to define your own Geometry shape to be used as a Drop Zone. - * - * @method Phaser.GameObjects.Zone#setDropZone - * @since 3.0.0 - * - * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. - * @param {HitAreaCallback} 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. - */ - setDropZone: function (shape, callback) - { - if (shape === undefined) - { - this.setRectangleDropZone(this.width, this.height); - } - else if (!this.input) - { - this.setInteractive(shape, callback, true); - } - - return this; - }, - - /** - * A NOOP method so you can pass a Zone to a Container. - * Calling this method will do nothing. It is intentionally empty. - * - * @method Phaser.GameObjects.Zone#setAlpha - * @private - * @since 3.11.0 - */ - setAlpha: function () - { - }, - - /** - * A Zone does not render. - * - * @method Phaser.GameObjects.Zone#renderCanvas - * @private - * @since 3.0.0 - */ - renderCanvas: function () - { - }, - - /** - * A Zone does not render. - * - * @method Phaser.GameObjects.Zone#renderWebGL - * @private - * @since 3.0.0 - */ - renderWebGL: function () - { - } - -}); - -module.exports = Zone; - - -/***/ }), -/* 136 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @typedef {object} TweenDataGenConfig - * - * @property {function} delay - [description] - * @property {function} duration - [description] - * @property {function} hold - [description] - * @property {function} repeat - [description] - * @property {function} repeatDelay - [description] - */ - -/** - * @typedef {object} Phaser.Tweens.TweenDataConfig - * - * @property {object} target - The target to tween. - * @property {string} key - The property of the target being tweened. - * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween. - * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween. - * @property {function} ease - The ease function this tween uses. - * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats. - * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) - * @property {number} [delay=0] - Time in ms/frames before tween will start. - * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired. - * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start. - * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats - * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats - * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData. - * @property {number} [elapsed=0] - Delta counter - * @property {integer} [repeatCounter=0] - How many repeats are left to run? - * @property {number} [start=0] - Ease value data. - * @property {number} [current=0] - Ease value data. - * @property {number} [end=0] - Ease value data. - * @property {number} [t1=0] - Time duration 1. - * @property {number} [t2=0] - Time duration 2. - * @property {TweenDataGenConfig} [gen] - LoadValue generation functions. - * @property {integer} [state=0] - TWEEN_CONST.CREATED - */ - -/** - * [description] - * - * @function Phaser.Tweens.TweenData - * @since 3.0.0 - * - * @param {object} target - [description] - * @param {string} key - [description] - * @param {function} getEnd - [description] - * @param {function} getStart - [description] - * @param {function} ease - [description] - * @param {number} delay - [description] - * @param {number} duration - [description] - * @param {boolean} yoyo - [description] - * @param {number} hold - [description] - * @param {number} repeat - [description] - * @param {number} repeatDelay - [description] - * @param {boolean} flipX - [description] - * @param {boolean} flipY - [description] - * - * @return {TweenDataConfig} [description] - */ -var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) -{ - return { - - // The target to tween - target: target, - - // The property of the target to tween - key: key, - - // The returned value sets what the property will be at the END of the Tween. - getEndValue: getEnd, - - // The returned value sets what the property will be at the START of the Tween. - getStartValue: getStart, - - // The ease function this tween uses. - ease: ease, - - // Duration of the tween in ms/frames, excludes time for yoyo or repeats. - duration: 0, - - // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) - totalDuration: 0, - - // Time in ms/frames before tween will start. - delay: 0, - - // Cause the tween to return back to its start value after hold has expired. - yoyo: yoyo, - - // Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - hold: 0, - - // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - repeat: 0, - - // Time in ms/frames before the repeat will start. - repeatDelay: 0, - - // Automatically call toggleFlipX when the TweenData yoyos or repeats - flipX: flipX, - - // Automatically call toggleFlipY when the TweenData yoyos or repeats - flipY: flipY, - - // Between 0 and 1 showing completion of this TweenData. - progress: 0, - - // Delta counter. - elapsed: 0, - - // How many repeats are left to run? - repeatCounter: 0, - - // Ease Value Data: - - start: 0, - current: 0, - end: 0, - - // Time Durations - t1: 0, - t2: 0, - - // LoadValue generation functions - gen: { - delay: delay, - duration: duration, - hold: hold, - repeat: repeat, - repeatDelay: repeatDelay - }, - - // TWEEN_CONST.CREATED - state: 0 - }; -}; - -module.exports = TweenData; - - -/***/ }), -/* 137 */ -/***/ (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 GameObjectCreator = __webpack_require__(14); -var GameObjectFactory = __webpack_require__(5); -var TWEEN_CONST = __webpack_require__(93); - -/** - * @classdesc - * [description] - * - * @class Tween - * @memberof Phaser.Tweens - * @constructor - * @since 3.0.0 - * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] - * @param {Phaser.Tweens.TweenDataConfig[]} data - [description] - * @param {array} targets - [description] - */ -var Tween = new Class({ - - initialize: - - function Tween (parent, data, targets) - { - /** - * [description] - * - * @name Phaser.Tweens.Tween#parent - * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * Is the parent of this Tween a Timeline? - * - * @name Phaser.Tweens.Tween#parentIsTimeline - * @type {boolean} - * @since 3.0.0 - */ - this.parentIsTimeline = parent.hasOwnProperty('isTimeline'); - - /** - * An array of TweenData objects, each containing a unique property and target being tweened. - * - * @name Phaser.Tweens.Tween#data - * @type {Phaser.Tweens.TweenDataConfig[]} - * @since 3.0.0 - */ - this.data = data; - - /** - * data array doesn't change, so we can cache the length - * - * @name Phaser.Tweens.Tween#totalData - * @type {integer} - * @since 3.0.0 - */ - this.totalData = data.length; - - /** - * An array of references to the target/s this Tween is operating on - * - * @name Phaser.Tweens.Tween#targets - * @type {object[]} - * @since 3.0.0 - */ - this.targets = targets; - - /** - * Cached target total (not necessarily the same as the data total) - * - * @name Phaser.Tweens.Tween#totalTargets - * @type {integer} - * @since 3.0.0 - */ - this.totalTargets = targets.length; - - /** - * If true then duration, delay, etc values are all frame totals. - * - * @name Phaser.Tweens.Tween#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.Tween#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.Tween#loop - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loop = 0; - - /** - * Time in ms/frames before the tween loops. - * - * @name Phaser.Tweens.Tween#loopDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopDelay = 0; - - /** - * How many loops are left to run? - * - * @name Phaser.Tweens.Tween#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 = -1 (as it never completes) - * - * @name Phaser.Tweens.Tween#completeDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.completeDelay = 0; - - /** - * Countdown timer (used by timeline offset, loopDelay and completeDelay) - * - * @name Phaser.Tweens.Tween#countdown - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.countdown = 0; - - /** - * Set only if this Tween is part of a Timeline. - * - * @name Phaser.Tweens.Tween#offset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.offset = 0; - - /** - * Set only if this Tween is part of a Timeline. The calculated offset amount. - * - * @name Phaser.Tweens.Tween#calculatedOffset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.calculatedOffset = 0; - - /** - * The current state of the tween - * - * @name Phaser.Tweens.Tween#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.Tween#_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.Tween#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.Tween#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.Tween#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.Tween#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.Tween#progress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.progress = 0; - - /** - * Time in ms/frames for the Tween to complete (including looping) - * - * @name Phaser.Tweens.Tween#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.Tween#totalProgress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalProgress = 0; - - /** - * An object containing the various Tween callback references. - * - * @name Phaser.Tweens.Tween#callbacks - * @type {object} - * @default 0 - * @since 3.0.0 - */ - this.callbacks = { - onComplete: null, - onLoop: null, - onRepeat: null, - onStart: null, - onUpdate: null, - onYoyo: null - }; - - this.callbackScope; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#getValue - * @since 3.0.0 - * - * @return {number} [description] - */ - getValue: function () - { - return this.data[0].current; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#setTimeScale - * @since 3.0.0 - * - * @param {number} value - [description] - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - setTimeScale: function (value) - { - this.timeScale = value; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#getTimeScale - * @since 3.0.0 - * - * @return {number} [description] - */ - getTimeScale: function () - { - return this.timeScale; - }, - - /** - * Checks if the Tween is currently active. - * - * @method Phaser.Tweens.Tween#isPlaying - * @since 3.0.0 - * - * @return {boolean} `true` if the Tween is active, otherwise `false`. - */ - isPlaying: function () - { - return (this.state === TWEEN_CONST.ACTIVE); - }, - - /** - * Checks if the Tween is currently paused. - * - * @method Phaser.Tweens.Tween#isPaused - * @since 3.0.0 - * - * @return {boolean} `true` if the Tween is paused, otherwise `false`. - */ - isPaused: function () - { - return (this.state === TWEEN_CONST.PAUSED); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#hasTarget - * @since 3.0.0 - * - * @param {object} target - [description] - * - * @return {boolean} [description] - */ - hasTarget: function (target) - { - return (this.targets.indexOf(target) !== -1); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#updateTo - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {*} value - [description] - * @param {boolean} startToCurrent - [description] - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - updateTo: function (key, value, startToCurrent) - { - for (var i = 0; i < this.totalData; i++) - { - var tweenData = this.data[i]; - - if (tweenData.key === key) - { - tweenData.end = value; - - if (startToCurrent) - { - tweenData.start = tweenData.current; - } - - break; - } - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#restart - * @since 3.0.0 - */ - restart: function () - { - if (this.state === TWEEN_CONST.REMOVED) - { - this.seek(0); - this.parent.makeActive(this); - } - else - { - this.stop(); - this.play(); - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#calcDuration - * @since 3.0.0 - */ - calcDuration: function () - { - var max = 0; - - var data = this.data; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - - // Set t1 (duration + hold + yoyo) - tweenData.t1 = tweenData.duration + tweenData.hold; - - if (tweenData.yoyo) - { - tweenData.t1 += tweenData.duration; - } - - // Set t2 (repeatDelay + duration + hold + yoyo) - tweenData.t2 = tweenData.t1 + tweenData.repeatDelay; - - // Total Duration - tweenData.totalDuration = tweenData.delay + tweenData.t1; - - if (tweenData.repeat === -1) - { - tweenData.totalDuration += (tweenData.t2 * 999999999999); - } - else if (tweenData.repeat > 0) - { - tweenData.totalDuration += (tweenData.t2 * tweenData.repeat); - } - - if (tweenData.totalDuration > max) - { - // Get the longest TweenData from the Tween, used to calculate the Tween TD - max = tweenData.totalDuration; - } - } - - // Excludes loop values - this.duration = max; - - 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; - } - }, - - /** - * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens. - * Should not be called directly. - * - * @method Phaser.Tweens.Tween#init - * @since 3.0.0 - * - * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager. - */ - init: function () - { - var data = this.data; - var totalTargets = this.totalTargets; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - var target = tweenData.target; - var gen = tweenData.gen; - - tweenData.delay = gen.delay(i, totalTargets, target); - tweenData.duration = gen.duration(i, totalTargets, target); - tweenData.hold = gen.hold(i, totalTargets, target); - tweenData.repeat = gen.repeat(i, totalTargets, target); - tweenData.repeatDelay = gen.repeatDelay(i, totalTargets, target); - } - - this.calcDuration(); - - this.progress = 0; - this.totalProgress = 0; - this.elapsed = 0; - this.totalElapsed = 0; - - // You can't have a paused Tween if it's part of a Timeline - if (this.paused && !this.parentIsTimeline) - { - this.state = TWEEN_CONST.PENDING_ADD; - this._pausedState = TWEEN_CONST.INIT; - - return false; - } - else - { - this.state = TWEEN_CONST.INIT; - - return true; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#nextState - * @since 3.0.0 - */ - nextState: function () - { - if (this.loopCounter > 0) - { - this.elapsed = 0; - this.progress = 0; - this.loopCounter--; - - var onLoop = this.callbacks.onLoop; - - if (onLoop) - { - onLoop.params[1] = this.targets; - - onLoop.func.apply(onLoop.scope, onLoop.params); - } - - this.resetTweenData(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.params[1] = this.targets; - - onComplete.func.apply(onComplete.scope, onComplete.params); - } - - this.state = TWEEN_CONST.PENDING_REMOVE; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#pause - * @since 3.0.0 - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - pause: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } - - this.paused = true; - - this._pausedState = this.state; - - this.state = TWEEN_CONST.PAUSED; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#play - * @since 3.0.0 - * - * @param {boolean} resetFromTimeline - [description] - */ - play: function (resetFromTimeline) - { - if (this.state === TWEEN_CONST.ACTIVE) - { - return; - } - else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED) - { - this.init(); - this.parent.makeActive(this); - resetFromTimeline = true; - } - - var onStart = this.callbacks.onStart; - - if (this.parentIsTimeline) - { - this.resetTweenData(resetFromTimeline); - - if (this.calculatedOffset === 0) - { - if (onStart) - { - onStart.params[1] = this.targets; - - onStart.func.apply(onStart.scope, onStart.params); - } - - this.state = TWEEN_CONST.ACTIVE; - } - else - { - this.countdown = this.calculatedOffset; - - this.state = TWEEN_CONST.OFFSET_DELAY; - } - } - else if (this.paused) - { - this.paused = false; - - this.parent.makeActive(this); - } - else - { - this.resetTweenData(resetFromTimeline); - - this.state = TWEEN_CONST.ACTIVE; - - if (onStart) - { - onStart.params[1] = this.targets; - - onStart.func.apply(onStart.scope, onStart.params); - } - - this.parent.makeActive(this); - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#resetTweenData - * @since 3.0.0 - * - * @param {boolean} resetFromLoop - [description] - */ - resetTweenData: function (resetFromLoop) - { - var data = this.data; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - - tweenData.progress = 0; - tweenData.elapsed = 0; - - tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat; - - if (resetFromLoop) - { - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.end); - - tweenData.current = tweenData.start; - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - else if (tweenData.delay > 0) - { - tweenData.elapsed = tweenData.delay; - tweenData.state = TWEEN_CONST.DELAY; - } - else - { - tweenData.state = TWEEN_CONST.PENDING_RENDER; - } - } - }, - - /** - * Resumes the playback of a previously paused Tween. - * - * @method Phaser.Tweens.Tween#resume - * @since 3.0.0 - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - resume: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - this.paused = false; - - this.state = this._pausedState; - } - else - { - this.play(); - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#seek - * @since 3.0.0 - * - * @param {number} toPosition - A value between 0 and 1. - */ - seek: function (toPosition) - { - var data = this.data; - - for (var i = 0; i < this.totalData; i++) - { - // This won't work with loop > 0 yet - var ms = this.totalDuration * toPosition; - - var tweenData = data[i]; - var progress = 0; - var elapsed = 0; - - if (ms <= tweenData.delay) - { - progress = 0; - elapsed = 0; - } - else if (ms >= tweenData.totalDuration) - { - progress = 1; - elapsed = tweenData.duration; - } - else if (ms > tweenData.delay && ms <= tweenData.t1) - { - // Keep it zero bound - ms = Math.max(0, ms - tweenData.delay); - - // Somewhere in the first playthru range - progress = ms / tweenData.t1; - elapsed = tweenData.duration * progress; - } - else if (ms > tweenData.t1 && ms < tweenData.totalDuration) - { - // Somewhere in repeat land - ms -= tweenData.delay; - ms -= tweenData.t1; - - // var repeats = Math.floor(ms / tweenData.t2); - - // remainder - ms = ((ms / tweenData.t2) % 1) * tweenData.t2; - - if (ms > tweenData.repeatDelay) - { - progress = ms / tweenData.t1; - elapsed = tweenData.duration * progress; - } - } - - tweenData.progress = progress; - tweenData.elapsed = elapsed; - - var v = tweenData.ease(tweenData.progress); - - tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - - // console.log(tweenData.key, 'Seek', tweenData.target[tweenData.key], 'to', tweenData.current, 'pro', tweenData.progress, 'marker', toPosition, progress); - - // if (tweenData.current === 0) - // { - // console.log('zero', tweenData.start, tweenData.end, v, 'progress', progress); - // } - - tweenData.target[tweenData.key] = tweenData.current; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#setCallback - * @since 3.0.0 - * - * @param {string} type - [description] - * @param {function} callback - [description] - * @param {array} [params] - [description] - * @param {object} [scope] - [description] - * - * @return {Phaser.Tweens.Tween} This Tween object. - */ - setCallback: function (type, callback, params, scope) - { - this.callbacks[type] = { func: callback, scope: scope, params: params }; - - 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. - * - * @method Phaser.Tweens.Tween#stop - * @since 3.0.0 - * - * @param {number} [resetTo] - A value between 0 and 1. - */ - stop: function (resetTo) - { - if (this.state === TWEEN_CONST.ACTIVE) - { - if (resetTo !== undefined) - { - this.seek(resetTo); - } - } - - if (this.state !== TWEEN_CONST.REMOVED) - { - if (this.state === TWEEN_CONST.PAUSED || this.state === TWEEN_CONST.PENDING_ADD) - { - this.parent._destroy.push(this); - this.parent._toProcess++; - } - - this.state = TWEEN_CONST.PENDING_REMOVE; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#update - * @since 3.0.0 - * - * @param {number} timestamp - [description] - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - * - * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. - */ - update: function (timestamp, delta) - { - if (this.state === TWEEN_CONST.PAUSED) - { - return false; - } - - if (this.useFrames) - { - delta = 1 * this.parent.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 = false; - - for (var i = 0; i < this.totalData; i++) - { - if (this.updateTweenData(this, this.data[i], delta)) - { - stillRunning = true; - } - } - - // Anything still running? If not, we're done - if (!stillRunning) - { - this.nextState(); - } - - break; - - case TWEEN_CONST.LOOP_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; - } - - break; - - case TWEEN_CONST.OFFSET_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - var onStart = this.callbacks.onStart; - - if (onStart) - { - onStart.params[1] = this.targets; - - onStart.func.apply(onStart.scope, onStart.params); - } - - 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.state = TWEEN_CONST.PENDING_REMOVE; - } - - break; - } - - return (this.state === TWEEN_CONST.PENDING_REMOVE); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Tween#setStateFromEnd - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] - * - * @return {integer} The state of this Tween. - */ - setStateFromEnd: function (tween, tweenData, diff) - { - if (tweenData.yoyo) - { - // We've hit the end of a Playing Forward TweenData and we have a yoyo - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - // Problem: The flip and callback and so on gets called for every TweenData that triggers it at the same time. - // If you're tweening several properties it can fire for all of them, at once. - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - var onYoyo = tween.callbacks.onYoyo; - - if (onYoyo) - { - // Element 1 is reserved for the target of the yoyo (and needs setting here) - onYoyo.params[1] = tweenData.target; - - onYoyo.func.apply(onYoyo.scope, onYoyo.params); - } - - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); - - return TWEEN_CONST.PLAYING_BACKWARD; - } - else if (tweenData.repeatCounter > 0) - { - // We've hit the end of a Playing Forward TweenData and we have a Repeat. - // So we're going to go right back to the start to repeat it again. - - tweenData.repeatCounter--; - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - var onRepeat = tween.callbacks.onRepeat; - - if (onRepeat) - { - // Element 1 is reserved for the target of the repeat (and needs setting here) - onRepeat.params[1] = tweenData.target; - - onRepeat.func.apply(onRepeat.scope, onRepeat.params); - } - - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); - - // Delay? - if (tweenData.repeatDelay > 0) - { - tweenData.elapsed = tweenData.repeatDelay - diff; - - tweenData.current = tweenData.start; - - tweenData.target[tweenData.key] = tweenData.current; - - return TWEEN_CONST.REPEAT_DELAY; - } - else - { - return TWEEN_CONST.PLAYING_FORWARD; - } - } - - return TWEEN_CONST.COMPLETE; - }, - - /** - * Was PLAYING_BACKWARD and has hit the start. - * - * @method Phaser.Tweens.Tween#setStateFromStart - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] - * - * @return {integer} The state of this Tween. - */ - setStateFromStart: function (tween, tweenData, diff) - { - if (tweenData.repeatCounter > 0) - { - tweenData.repeatCounter--; - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - var onRepeat = tween.callbacks.onRepeat; - - if (onRepeat) - { - // Element 1 is reserved for the target of the repeat (and needs setting here) - onRepeat.params[1] = tweenData.target; - - onRepeat.func.apply(onRepeat.scope, onRepeat.params); - } - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); - - // Delay? - if (tweenData.repeatDelay > 0) - { - tweenData.elapsed = tweenData.repeatDelay - diff; - - tweenData.current = tweenData.start; - - tweenData.target[tweenData.key] = tweenData.current; - - return TWEEN_CONST.REPEAT_DELAY; - } - else - { - return TWEEN_CONST.PLAYING_FORWARD; - } - } - - return TWEEN_CONST.COMPLETE; - }, - - // - /** - * [description] - * - * @method Phaser.Tweens.Tween#updateTweenData - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true - * - * @return {boolean} [description] - */ - updateTweenData: function (tween, tweenData, delta) - { - switch (tweenData.state) - { - case TWEEN_CONST.PLAYING_FORWARD: - case TWEEN_CONST.PLAYING_BACKWARD: - - if (!tweenData.target) - { - tweenData.state = TWEEN_CONST.COMPLETE; - break; - } - - var elapsed = tweenData.elapsed; - var duration = tweenData.duration; - var diff = 0; - - elapsed += delta; - - if (elapsed > duration) - { - diff = elapsed - duration; - elapsed = duration; - } - - var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD); - var progress = elapsed / duration; - - var v; - - if (forward) - { - v = tweenData.ease(progress); - } - else - { - v = tweenData.ease(1 - progress); - } - - tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - - tweenData.target[tweenData.key] = tweenData.current; - - tweenData.elapsed = elapsed; - tweenData.progress = progress; - - var onUpdate = tween.callbacks.onUpdate; - - if (onUpdate) - { - onUpdate.params[1] = tweenData.target; - - onUpdate.func.apply(onUpdate.scope, onUpdate.params); - } - - if (progress === 1) - { - if (forward) - { - if (tweenData.hold > 0) - { - tweenData.elapsed = tweenData.hold - diff; - - tweenData.state = TWEEN_CONST.HOLD_DELAY; - } - else - { - tweenData.state = this.setStateFromEnd(tween, tweenData, diff); - } - } - else - { - tweenData.state = this.setStateFromStart(tween, tweenData, diff); - } - } - - break; - - case TWEEN_CONST.DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.elapsed = Math.abs(tweenData.elapsed); - - tweenData.state = TWEEN_CONST.PENDING_RENDER; - } - - break; - - case TWEEN_CONST.REPEAT_DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.elapsed = Math.abs(tweenData.elapsed); - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - - break; - - case TWEEN_CONST.HOLD_DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed)); - } - - break; - - case TWEEN_CONST.PENDING_RENDER: - - if (tweenData.target) - { - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.target[tweenData.key]); - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); - - tweenData.current = tweenData.start; - - tweenData.target[tweenData.key] = tweenData.start; - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - else - { - tweenData.state = TWEEN_CONST.COMPLETE; - } - - break; - } - - // Return TRUE if this TweenData still playing, otherwise return FALSE - return (tweenData.state !== TWEEN_CONST.COMPLETE); - } - -}); - -Tween.TYPES = [ - 'onComplete', - 'onLoop', - 'onRepeat', - 'onStart', - 'onUpdate', - 'onYoyo' -]; - -/** - * Creates a new Tween object. - * - * Note: This method will only be available Tweens have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#tween - * @since 3.0.0 - * - * @param {object} config - The Tween configuration. - * - * @return {Phaser.Tweens.Tween} The Tween that was created. - */ -GameObjectFactory.register('tween', function (config) -{ - return this.scene.sys.tweens.add(config); -}); - -// 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 - -/** - * Creates a new Tween object and returns it. - * - * Note: This method will only be available if Tweens have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#tween - * @since 3.0.0 - * - * @param {object} config - The Tween configuration. - * - * @return {Phaser.Tweens.Tween} The Tween that was created. - */ -GameObjectCreator.register('tween', function (config) -{ - return this.scene.sys.tweens.create(config); -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. - -module.exports = Tween; - - -/***/ }), -/* 138 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @typedef {object} Phaser.Tweens.TweenConfigDefaults - * - * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. - * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. - * @property {number} [duration=1000] - The duration of the tween in milliseconds. - * @property {string} [ease='Power0'] - The easing equation to use for the tween. - * @property {array} [easeParams] - Optional easing parameters. - * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. - * @property {number} [repeat=0] - The number of times to repeat the tween. - * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. - * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. - * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. - * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. - */ - -var TWEEN_DEFAULTS = { - targets: null, - delay: 0, - duration: 1000, - ease: 'Power0', - easeParams: null, - hold: 0, - repeat: 0, - repeatDelay: 0, - yoyo: false, - flipX: false, - flipY: false -}; - -module.exports = TWEEN_DEFAULTS; - - -/***/ }), -/* 139 */ -/***/ (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 hasGetStart (def) -{ - return (!!def.getStart && typeof def.getStart === 'function'); -} - -function hasGetEnd (def) -{ - return (!!def.getEnd && typeof def.getEnd === 'function'); -} - -function hasGetters (def) -{ - return hasGetStart(def) || hasGetEnd(def); -} - -/** - * [description] - * - * @function Phaser.Tweens.Builders.GetValueOp - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {*} propertyValue - [description] - * - * @return {function} [description] - */ -var GetValueOp = function (key, propertyValue) -{ - var callbacks; - - // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween) - var getEnd = function (target, key, value) { return value; }; - - // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween) - var getStart = function (target, key, value) { return value; }; - - var t = typeof(propertyValue); - - if (t === 'number') - { - // props: { - // x: 400, - // y: 300 - // } - - getEnd = function () - { - return propertyValue; - }; - } - else if (t === 'string') - { - // props: { - // x: '+=400', - // y: '-=300', - // z: '*=2', - // w: '/=2' - // } - - var op = propertyValue[0]; - var num = parseFloat(propertyValue.substr(2)); - - switch (op) - { - case '+': - getEnd = function (target, key, value) - { - return value + num; - }; - break; - - case '-': - getEnd = function (target, key, value) - { - return value - num; - }; - break; - - case '*': - getEnd = function (target, key, value) - { - return value * num; - }; - break; - - case '/': - getEnd = function (target, key, value) - { - return value / num; - }; - break; - - default: - getEnd = function () - { - return parseFloat(propertyValue); - }; - } - } - else if (t === 'function') - { - // The same as setting just the getEnd function and no getStart - - // props: { - // x: function (target, key, value) { return value + 50); }, - // } - - getEnd = propertyValue; - } - else if (t === 'object' && hasGetters(propertyValue)) - { - /* - x: { - // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween. - getEnd: function (target, key, value) - { - return value; - }, - - // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween. - getStart: function (target, key, value) - { - return value; - } - } - */ - - if (hasGetEnd(propertyValue)) - { - getEnd = propertyValue.getEnd; - } - - if (hasGetStart(propertyValue)) - { - getStart = propertyValue.getStart; - } - } - else if (propertyValue.hasOwnProperty('value')) - { - // Value may still be a string, function or a number - // props: { - // x: { value: 400, ... }, - // y: { value: 300, ... } - // } - - callbacks = GetValueOp(key, propertyValue.value); - } - - // If callback not set by the else if block above then set it here and return it - if (!callbacks) - { - callbacks = { - getEnd: getEnd, - getStart: getStart - }; - } - - return callbacks; -}; - -module.exports = GetValueOp; - - -/***/ }), -/* 140 */ -/***/ (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.GetTargets - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {array} [description] - */ -var GetTargets = function (config) -{ - var targets = GetValue(config, 'targets', null); - - if (targets === null) - { - return targets; - } - - if (typeof targets === 'function') - { - targets = targets.call(); - } - - if (!Array.isArray(targets)) - { - targets = [ targets ]; - } - - return targets; -}; - -module.exports = GetTargets; - - -/***/ }), -/* 141 */ -/***/ (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 Formats = __webpack_require__(30); -var MapData = __webpack_require__(86); -var Parse = __webpack_require__(230); -var Tilemap = __webpack_require__(222); - -/** - * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When - * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from - * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For - * an empty map, you should specify tileWidth, tileHeight, width & height. - * - * @function Phaser.Tilemaps.ParseToTilemap - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. - * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {integer} [tileWidth=32] - The width of a tile in pixels. - * @param {integer} [tileHeight=32] - The height of a tile in pixels. - * @param {integer} [width=10] - The width of the map in tiles. - * @param {integer} [height=10] - The height of the map in tiles. - * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from - * a 2D array of tile indexes. - * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the - * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.Tilemap} - */ -var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) -{ - if (tileWidth === undefined) { tileWidth = 32; } - if (tileHeight === undefined) { tileHeight = 32; } - if (width === undefined) { width = 10; } - if (height === undefined) { height = 10; } - if (insertNull === undefined) { insertNull = false; } - - var mapData = null; - - if (Array.isArray(data)) - { - var name = key !== undefined ? key : 'map'; - mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull); - } - else if (key !== undefined) - { - var tilemapData = scene.cache.tilemap.get(key); - - if (!tilemapData) - { - console.warn('No map data found for key ' + key); - } - else - { - mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull); - } - } - - if (mapData === null) - { - mapData = new MapData({ - tileWidth: tileWidth, - tileHeight: tileHeight, - width: width, - height: height - }); - } - - return new Tilemap(scene, mapData); -}; - -module.exports = ParseToTilemap; - - -/***/ }), -/* 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 Formats = __webpack_require__(30); -var LayerData = __webpack_require__(87); -var MapData = __webpack_require__(86); -var Tile = __webpack_require__(61); - -/** - * Parses a 2D array of tile indexes into a new MapData object with a single layer. - * - * @function Phaser.Tilemaps.Parsers.Parse2DArray - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object. - * @param {integer} tileWidth - The width of a tile in pixels. - * @param {integer} tileHeight - The height of a tile in pixels. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.MapData} [description] - */ -var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) -{ - var layerData = new LayerData({ - tileWidth: tileWidth, - tileHeight: tileHeight - }); - - var mapData = new MapData({ - name: name, - tileWidth: tileWidth, - tileHeight: tileHeight, - format: Formats.ARRAY_2D, - layers: [ layerData ] - }); - - var tiles = []; - var height = data.length; - var width = 0; - - for (var y = 0; y < data.length; y++) - { - tiles[y] = []; - var row = data[y]; - - for (var x = 0; x < row.length; x++) - { - var tileIndex = parseInt(row[x], 10); - - if (isNaN(tileIndex) || tileIndex === -1) - { - tiles[y][x] = insertNull - ? null - : new Tile(layerData, -1, x, y, tileWidth, tileHeight); - } - else - { - tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight); - } - } - - if (width === 0) - { - width = row.length; - } - } - - mapData.width = layerData.width = width; - mapData.height = layerData.height = height; - mapData.widthInPixels = layerData.widthInPixels = width * tileWidth; - mapData.heightInPixels = layerData.heightInPixels = height * tileHeight; - layerData.data = tiles; - - return mapData; -}; - -module.exports = Parse2DArray; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Internally used method to keep track of the tile indexes that collide within a layer. This - * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`. - * - * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex - * @private - * @since 3.0.0 - * - * @param {integer} tileIndex - The tile index to set the collision boolean for. - * @param {boolean} [collides=true] - Should the tile index collide or not? - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetLayerCollisionIndex = function (tileIndex, collides, layer) -{ - var loc = layer.collideIndexes.indexOf(tileIndex); - - if (collides && loc === -1) - { - layer.collideIndexes.push(tileIndex); - } - else if (!collides && loc !== -1) - { - layer.collideIndexes.splice(loc, 1); - } -}; - -module.exports = SetLayerCollisionIndex; - - -/***/ }), -/* 144 */ -/***/ (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 Tile = __webpack_require__(61); -var IsInLayerBounds = __webpack_require__(88); -var CalculateFacesAt = __webpack_require__(145); -var SetTileCollision = __webpack_require__(62); - -/** - * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index - * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified - * location. If you pass in an index, only the index at the specified location will be changed. - * Collision information will be recalculated at the specified location. - * - * @function Phaser.Tilemaps.Components.PutTileAt - * @private - * @since 3.0.0 - * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. - */ -var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) -{ - if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - var oldTile = layer.data[tileY][tileX]; - var oldTileCollides = oldTile && oldTile.collides; - - if (tile instanceof Tile) - { - if (layer.data[tileY][tileX] === null) - { - layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height); - } - layer.data[tileY][tileX].copy(tile); - } - else - { - var index = tile; - if (layer.data[tileY][tileX] === null) - { - layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight); - } - else - { - layer.data[tileY][tileX].index = index; - } - } - - // Updating colliding flag on the new tile - var newTile = layer.data[tileY][tileX]; - var collides = layer.collideIndexes.indexOf(newTile.index) !== -1; - SetTileCollision(newTile, collides); - - // Recalculate faces only if the colliding flag at (tileX, tileY) has changed - if (recalculateFaces && (oldTileCollides !== newTile.collides)) - { - CalculateFacesAt(tileX, tileY, layer); - } - - return newTile; -}; - -module.exports = PutTileAt; - - - -/***/ }), -/* 145 */ -/***/ (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 GetTileAt = __webpack_require__(110); - -/** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. - * - * @function Phaser.Tilemaps.Components.CalculateFacesAt - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var CalculateFacesAt = function (tileX, tileY, layer) -{ - var tile = GetTileAt(tileX, tileY, true, layer); - var above = GetTileAt(tileX, tileY - 1, true, layer); - var below = GetTileAt(tileX, tileY + 1, true, layer); - var left = GetTileAt(tileX - 1, tileY, true, layer); - var right = GetTileAt(tileX + 1, tileY, true, layer); - var tileCollides = tile && tile.collides; - - // Assume the changed tile has all interesting edges - if (tileCollides) - { - tile.faceTop = true; - tile.faceBottom = true; - tile.faceLeft = true; - tile.faceRight = true; - } - - // Reset edges that are shared between tile and its neighbors - if (above && above.collides) - { - if (tileCollides) { tile.faceTop = false; } - above.faceBottom = !tileCollides; - } - - if (below && below.collides) - { - if (tileCollides) { tile.faceBottom = false; } - below.faceTop = !tileCollides; - } - - if (left && left.collides) - { - if (tileCollides) { tile.faceLeft = false; } - left.faceRight = !tileCollides; - } - - if (right && right.collides) - { - if (tileCollides) { tile.faceRight = false; } - right.faceLeft = !tileCollides; - } - - if (tile && !tile.collides) { tile.resetFaces(); } - - return tile; -}; - -module.exports = CalculateFacesAt; - - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.World` module contains methods for creating and manipulating the world composite. -* A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. -* A `Matter.World` has a few additional properties including `gravity` and `bounds`. -* It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. -* There are also a few methods here that alias those in `Matter.Composite` for easier readability. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class World -* @extends Composite -*/ - -var World = {}; - -module.exports = World; - -var Composite = __webpack_require__(63); -var Constraint = __webpack_require__(73); -var Common = __webpack_require__(12); - -(function() { - - /** - * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @constructor - * @param {} options - * @return {world} A new world - */ - World.create = function(options) { - var composite = Composite.create(); - - var defaults = { - label: 'World', - gravity: { - x: 0, - y: 1, - scale: 0.001 - }, - bounds: { - min: { x: -Infinity, y: -Infinity }, - max: { x: Infinity, y: Infinity } - } - }; - - return Common.extend(composite, defaults, options); - }; - - /* - * - * Properties Documentation - * - */ - - /** - * The gravity to apply on the world. - * - * @property gravity - * @type object - */ - - /** - * The gravity x component. - * - * @property gravity.x - * @type object - * @default 0 - */ - - /** - * The gravity y component. - * - * @property gravity.y - * @type object - * @default 1 - */ - - /** - * The gravity scale factor. - * - * @property gravity.scale - * @type object - * @default 0.001 - */ - - /** - * A `Bounds` object that defines the world bounds for collision detection. - * - * @property bounds - * @type bounds - * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } - */ - - // World is a Composite body - // see src/module/Outro.js for these aliases: - - /** - * An alias for Composite.add - * @method add - * @param {world} world - * @param {} object - * @return {composite} The original world with the objects added - */ - - /** - * An alias for Composite.remove - * @method remove - * @param {world} world - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original world with the objects removed - */ - - /** - * An alias for Composite.clear - * @method clear - * @param {world} world - * @param {boolean} keepStatic - */ - - /** - * An alias for Composite.addComposite - * @method addComposite - * @param {world} world - * @param {composite} composite - * @return {world} The original world with the objects from composite added - */ - - /** - * An alias for Composite.addBody - * @method addBody - * @param {world} world - * @param {body} body - * @return {world} The original world with the body added - */ - - /** - * An alias for Composite.addConstraint - * @method addConstraint - * @param {world} world - * @param {constraint} constraint - * @return {world} The original world with the constraint added - */ - -})(); - - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Plugin` module contains functions for registering and installing plugins on modules. -* -* @class Plugin -*/ - -var Plugin = {}; - -module.exports = Plugin; - -var Common = __webpack_require__(12); - -(function() { - - Plugin._registry = {}; - - /** - * Registers a plugin object so it can be resolved later by name. - * @method register - * @param plugin {} The plugin to register. - * @return {object} The plugin. - */ - Plugin.register = function(plugin) { - if (!Plugin.isPlugin(plugin)) { - Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.'); - } - - if (plugin.name in Plugin._registry) { - var registered = Plugin._registry[plugin.name], - pluginVersion = Plugin.versionParse(plugin.version).number, - registeredVersion = Plugin.versionParse(registered.version).number; - - if (pluginVersion > registeredVersion) { - Common.warn('Plugin.register:', Plugin.toString(registered), 'was upgraded to', Plugin.toString(plugin)); - Plugin._registry[plugin.name] = plugin; - } else if (pluginVersion < registeredVersion) { - Common.warn('Plugin.register:', Plugin.toString(registered), 'can not be downgraded to', Plugin.toString(plugin)); - } else if (plugin !== registered) { - Common.warn('Plugin.register:', Plugin.toString(plugin), 'is already registered to different plugin object'); - } - } else { - Plugin._registry[plugin.name] = plugin; - } - - return plugin; - }; - - /** - * Resolves a dependency to a plugin object from the registry if it exists. - * The `dependency` may contain a version, but only the name matters when resolving. - * @method resolve - * @param dependency {string} The dependency. - * @return {object} The plugin if resolved, otherwise `undefined`. - */ - Plugin.resolve = function(dependency) { - return Plugin._registry[Plugin.dependencyParse(dependency).name]; - }; - - /** - * Returns a pretty printed plugin name and version. - * @method toString - * @param plugin {} The plugin. - * @return {string} Pretty printed plugin name and version. - */ - Plugin.toString = function(plugin) { - return typeof plugin === 'string' ? plugin : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0'); - }; - - /** - * Returns `true` if the object meets the minimum standard to be considered a plugin. - * This means it must define the following properties: - * - `name` - * - `version` - * - `install` - * @method isPlugin - * @param obj {} The obj to test. - * @return {boolean} `true` if the object can be considered a plugin otherwise `false`. - */ - Plugin.isPlugin = function(obj) { - return obj && obj.name && obj.version && obj.install; - }; - - /** - * Returns `true` if a plugin with the given `name` been installed on `module`. - * @method isUsed - * @param module {} The module. - * @param name {string} The plugin name. - * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`. - */ - Plugin.isUsed = function(module, name) { - return module.used.indexOf(name) > -1; - }; - - /** - * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`. - * If `plugin.for` is not specified then it is assumed to be applicable. - * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`. - * @method isFor - * @param plugin {} The plugin. - * @param module {} The module. - * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`. - */ - Plugin.isFor = function(plugin, module) { - var parsed = plugin.for && Plugin.dependencyParse(plugin.for); - return !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range)); - }; - - /** - * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`. - * For installing plugins on `Matter` see the convenience function `Matter.use`. - * Plugins may be specified either by their name or a reference to the plugin object. - * Plugins themselves may specify further dependencies, but each plugin is installed only once. - * Order is important, a topological sort is performed to find the best resulting order of installation. - * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases. - * This function logs the resulting status of each dependency in the console, along with any warnings. - * - A green tick ✅ indicates a dependency was resolved and installed. - * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies. - * - A red cross ❌ indicates a dependency could not be resolved. - * Avoid calling this function multiple times on the same module unless you intend to manually control installation order. - * @method use - * @param module {} The module install plugins on. - * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`). - */ - Plugin.use = function(module, plugins) { - module.uses = (module.uses || []).concat(plugins || []); - - if (module.uses.length === 0) { - Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.'); - return; - } - - var dependencies = Plugin.dependencies(module), - sortedDependencies = Common.topologicalSort(dependencies), - status = []; - - for (var i = 0; i < sortedDependencies.length; i += 1) { - if (sortedDependencies[i] === module.name) { - continue; - } - - var plugin = Plugin.resolve(sortedDependencies[i]); - - if (!plugin) { - status.push('❌ ' + sortedDependencies[i]); - continue; - } - - if (Plugin.isUsed(module, plugin.name)) { - continue; - } - - if (!Plugin.isFor(plugin, module)) { - Common.warn('Plugin.use:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(module) + '.'); - plugin._warned = true; - } - - if (plugin.install) { - plugin.install(module); - } else { - Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.'); - plugin._warned = true; - } - - if (plugin._warned) { - status.push('🔶 ' + Plugin.toString(plugin)); - delete plugin._warned; - } else { - status.push('✅ ' + Plugin.toString(plugin)); - } - - module.used.push(plugin.name); - } - - if (status.length > 0 && !plugin.silent) { - Common.info(status.join(' ')); - } - }; - - /** - * Recursively finds all of a module's dependencies and returns a flat dependency graph. - * @method dependencies - * @param module {} The module. - * @return {object} A dependency graph. - */ - Plugin.dependencies = function(module, tracked) { - var parsedBase = Plugin.dependencyParse(module), - name = parsedBase.name; - - tracked = tracked || {}; - - if (name in tracked) { - return; - } - - module = Plugin.resolve(module) || module; - - tracked[name] = Common.map(module.uses || [], function(dependency) { - if (Plugin.isPlugin(dependency)) { - Plugin.register(dependency); - } - - var parsed = Plugin.dependencyParse(dependency), - resolved = Plugin.resolve(dependency); - - if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) { - Common.warn( - 'Plugin.dependencies:', Plugin.toString(resolved), 'does not satisfy', - Plugin.toString(parsed), 'used by', Plugin.toString(parsedBase) + '.' - ); - - resolved._warned = true; - module._warned = true; - } else if (!resolved) { - Common.warn( - 'Plugin.dependencies:', Plugin.toString(dependency), 'used by', - Plugin.toString(parsedBase), 'could not be resolved.' - ); - - module._warned = true; - } - - return parsed.name; - }); - - for (var i = 0; i < tracked[name].length; i += 1) { - Plugin.dependencies(tracked[name][i], tracked); - } - - return tracked; - }; - - /** - * Parses a dependency string into its components. - * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`. - * See documentation for `Plugin.versionParse` for a description of the format. - * This function can also handle dependencies that are already resolved (e.g. a module object). - * @method dependencyParse - * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`. - * @return {object} The dependency parsed into its components. - */ - Plugin.dependencyParse = function(dependency) { - if (Common.isString(dependency)) { - var pattern = /^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?))?$/; - - if (!pattern.test(dependency)) { - Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.'); - } - - return { - name: dependency.split('@')[0], - range: dependency.split('@')[1] || '*' - }; - } - - return { - name: dependency.name, - range: dependency.range || dependency.version - }; - }; - - /** - * Parses a version string into its components. - * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)). - * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`. - * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax). - * Only the following range types are supported: - * - Tilde ranges e.g. `~1.2.3` - * - Caret ranges e.g. `^1.2.3` - * - Exact version e.g. `1.2.3` - * - Any version `*` - * @method versionParse - * @param range {string} The version string. - * @return {object} The version range parsed into its components. - */ - Plugin.versionParse = function(range) { - var pattern = /^\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?$/; - - if (!pattern.test(range)) { - Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); - } - - var identifiers = range.split('-'); - range = identifiers[0]; - - var isRange = isNaN(Number(range[0])), - version = isRange ? range.substr(1) : range, - parts = Common.map(version.split('.'), function(part) { - return Number(part); - }); - - return { - isRange: isRange, - version: version, - range: range, - operator: isRange ? range[0] : '', - parts: parts, - prerelease: identifiers[1], - number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2] - }; - }; - - /** - * Returns `true` if `version` satisfies the given `range`. - * See documentation for `Plugin.versionParse` for a description of the format. - * If a version or range is not specified, then any version (`*`) is assumed to satisfy. - * @method versionSatisfies - * @param version {string} The version string. - * @param range {string} The range string. - * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`. - */ - Plugin.versionSatisfies = function(version, range) { - range = range || '*'; - - var rangeParsed = Plugin.versionParse(range), - rangeParts = rangeParsed.parts, - versionParsed = Plugin.versionParse(version), - versionParts = versionParsed.parts; - - if (rangeParsed.isRange) { - if (rangeParsed.operator === '*' || version === '*') { - return true; - } - - if (rangeParsed.operator === '~') { - return versionParts[0] === rangeParts[0] && versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; - } - - if (rangeParsed.operator === '^') { - if (rangeParts[0] > 0) { - return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number; - } - - if (rangeParts[1] > 0) { - return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; - } - - return versionParts[2] === rangeParts[2]; - } - } - - return version === range || version === '*'; - }; - -})(); - - -/***/ }), -/* 148 */ -/***/ (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 Matter = __webpack_require__(240); - -Matter.Body = __webpack_require__(25); -Matter.Composite = __webpack_require__(63); -Matter.World = __webpack_require__(146); - -Matter.Detector = __webpack_require__(150); -Matter.Grid = __webpack_require__(239); -Matter.Pairs = __webpack_require__(238); -Matter.Pair = __webpack_require__(112); -Matter.Query = __webpack_require__(536); -Matter.Resolver = __webpack_require__(237); -Matter.SAT = __webpack_require__(149); - -Matter.Constraint = __webpack_require__(73); - -Matter.Common = __webpack_require__(12); -Matter.Engine = __webpack_require__(236); -Matter.Events = __webpack_require__(74); -Matter.Sleeping = __webpack_require__(89); -Matter.Plugin = __webpack_require__(147); - -Matter.Bodies = __webpack_require__(55); -Matter.Composites = __webpack_require__(243); - -Matter.Axes = __webpack_require__(152); -Matter.Bounds = __webpack_require__(33); -Matter.Svg = __webpack_require__(534); -Matter.Vector = __webpack_require__(34); -Matter.Vertices = __webpack_require__(29); - -// aliases - -Matter.World.add = Matter.Composite.add; -Matter.World.remove = Matter.Composite.remove; -Matter.World.addComposite = Matter.Composite.addComposite; -Matter.World.addBody = Matter.Composite.addBody; -Matter.World.addConstraint = Matter.Composite.addConstraint; -Matter.World.clear = Matter.Composite.clear; - -module.exports = Matter; - - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem. -* -* @class SAT -*/ - -// TODO: true circles and curves - -var SAT = {}; - -module.exports = SAT; - -var Vertices = __webpack_require__(29); -var Vector = __webpack_require__(34); - -(function() { - - /** - * Detect collision between two bodies using the Separating Axis Theorem. - * @method collides - * @param {body} bodyA - * @param {body} bodyB - * @param {collision} previousCollision - * @return {collision} collision - */ - SAT.collides = function(bodyA, bodyB, previousCollision) { - var overlapAB, - overlapBA, - minOverlap, - collision, - canReusePrevCol = false; - - if (previousCollision) { - // estimate total motion - var parentA = bodyA.parent, - parentB = bodyB.parent, - motion = parentA.speed * parentA.speed + parentA.angularSpeed * parentA.angularSpeed - + parentB.speed * parentB.speed + parentB.angularSpeed * parentB.angularSpeed; - - // we may be able to (partially) reuse collision result - // but only safe if collision was resting - canReusePrevCol = previousCollision && previousCollision.collided && motion < 0.2; - - // reuse collision object - collision = previousCollision; - } else { - collision = { collided: false, bodyA: bodyA, bodyB: bodyB }; - } - - if (previousCollision && canReusePrevCol) { - // if we can reuse the collision result - // we only need to test the previously found axis - var axisBodyA = collision.axisBody, - axisBodyB = axisBodyA === bodyA ? bodyB : bodyA, - axes = [axisBodyA.axes[previousCollision.axisNumber]]; - - minOverlap = SAT._overlapAxes(axisBodyA.vertices, axisBodyB.vertices, axes); - collision.reused = true; - - if (minOverlap.overlap <= 0) { - collision.collided = false; - return collision; - } - } else { - // if we can't reuse a result, perform a full SAT test - - overlapAB = SAT._overlapAxes(bodyA.vertices, bodyB.vertices, bodyA.axes); - - if (overlapAB.overlap <= 0) { - collision.collided = false; - return collision; - } - - overlapBA = SAT._overlapAxes(bodyB.vertices, bodyA.vertices, bodyB.axes); - - if (overlapBA.overlap <= 0) { - collision.collided = false; - return collision; - } - - if (overlapAB.overlap < overlapBA.overlap) { - minOverlap = overlapAB; - collision.axisBody = bodyA; - } else { - minOverlap = overlapBA; - collision.axisBody = bodyB; - } - - // important for reuse later - collision.axisNumber = minOverlap.axisNumber; - } - - collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB; - collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA; - collision.collided = true; - collision.depth = minOverlap.overlap; - collision.parentA = collision.bodyA.parent; - collision.parentB = collision.bodyB.parent; - - bodyA = collision.bodyA; - bodyB = collision.bodyB; - - // ensure normal is facing away from bodyA - if (Vector.dot(minOverlap.axis, Vector.sub(bodyB.position, bodyA.position)) < 0) { - collision.normal = { - x: minOverlap.axis.x, - y: minOverlap.axis.y - }; - } else { - collision.normal = { - x: -minOverlap.axis.x, - y: -minOverlap.axis.y - }; - } - - collision.tangent = Vector.perp(collision.normal); - - collision.penetration = collision.penetration || {}; - collision.penetration.x = collision.normal.x * collision.depth; - collision.penetration.y = collision.normal.y * collision.depth; - - // find support points, there is always either exactly one or two - var verticesB = SAT._findSupports(bodyA, bodyB, collision.normal), - supports = []; - - // find the supports from bodyB that are inside bodyA - if (Vertices.contains(bodyA.vertices, verticesB[0])) - supports.push(verticesB[0]); - - if (Vertices.contains(bodyA.vertices, verticesB[1])) - supports.push(verticesB[1]); - - // find the supports from bodyA that are inside bodyB - if (supports.length < 2) { - var verticesA = SAT._findSupports(bodyB, bodyA, Vector.neg(collision.normal)); - - if (Vertices.contains(bodyB.vertices, verticesA[0])) - supports.push(verticesA[0]); - - if (supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1])) - supports.push(verticesA[1]); - } - - // account for the edge case of overlapping but no vertex containment - if (supports.length < 1) - supports = [verticesB[0]]; - - collision.supports = supports; - - return collision; - }; - - /** - * Find the overlap between two sets of vertices. - * @method _overlapAxes - * @private - * @param {} verticesA - * @param {} verticesB - * @param {} axes - * @return result - */ - SAT._overlapAxes = function(verticesA, verticesB, axes) { - var projectionA = Vector._temp[0], - projectionB = Vector._temp[1], - result = { overlap: Number.MAX_VALUE }, - overlap, - axis; - - for (var i = 0; i < axes.length; i++) { - axis = axes[i]; - - SAT._projectToAxis(projectionA, verticesA, axis); - SAT._projectToAxis(projectionB, verticesB, axis); - - overlap = Math.min(projectionA.max - projectionB.min, projectionB.max - projectionA.min); - - if (overlap <= 0) { - result.overlap = overlap; - return result; - } - - if (overlap < result.overlap) { - result.overlap = overlap; - result.axis = axis; - result.axisNumber = i; - } - } - - return result; - }; - - /** - * Projects vertices on an axis and returns an interval. - * @method _projectToAxis - * @private - * @param {} projection - * @param {} vertices - * @param {} axis - */ - SAT._projectToAxis = function(projection, vertices, axis) { - var min = Vector.dot(vertices[0], axis), - max = min; - - for (var i = 1; i < vertices.length; i += 1) { - var dot = Vector.dot(vertices[i], axis); - - if (dot > max) { - max = dot; - } else if (dot < min) { - min = dot; - } - } - - projection.min = min; - projection.max = max; - }; - - /** - * Finds supporting vertices given two bodies along a given direction using hill-climbing. - * @method _findSupports - * @private - * @param {} bodyA - * @param {} bodyB - * @param {} normal - * @return [vector] - */ - SAT._findSupports = function(bodyA, bodyB, normal) { - var nearestDistance = Number.MAX_VALUE, - vertexToBody = Vector._temp[0], - vertices = bodyB.vertices, - bodyAPosition = bodyA.position, - distance, - vertex, - vertexA, - vertexB; - - // find closest vertex on bodyB - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - - if (distance < nearestDistance) { - nearestDistance = distance; - vertexA = vertex; - } - } - - // find next closest vertex using the two connected to it - var prevIndex = vertexA.index - 1 >= 0 ? vertexA.index - 1 : vertices.length - 1; - vertex = vertices[prevIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - nearestDistance = -Vector.dot(normal, vertexToBody); - vertexB = vertex; - - var nextIndex = (vertexA.index + 1) % vertices.length; - vertex = vertices[nextIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - if (distance < nearestDistance) { - vertexB = vertex; - } - - return [vertexA, vertexB]; - }; - -})(); - - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. -* -* @class Detector -*/ - -// TODO: speculative contacts - -var Detector = {}; - -module.exports = Detector; - -var SAT = __webpack_require__(149); -var Pair = __webpack_require__(112); -var Bounds = __webpack_require__(33); - -(function() { - - /** - * Finds all collisions given a list of pairs. - * @method collisions - * @param {pair[]} broadphasePairs - * @param {engine} engine - * @return {array} collisions - */ - Detector.collisions = function(broadphasePairs, engine) { - var collisions = [], - pairsTable = engine.pairs.table; - - // @if DEBUG - var metrics = engine.metrics; - // @endif - - for (var i = 0; i < broadphasePairs.length; i++) { - var bodyA = broadphasePairs[i][0], - bodyB = broadphasePairs[i][1]; - - if ((bodyA.isStatic || bodyA.isSleeping) && (bodyB.isStatic || bodyB.isSleeping)) - continue; - - if (!Detector.canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) - continue; - - // @if DEBUG - metrics.midphaseTests += 1; - // @endif - - // mid phase - if (Bounds.overlaps(bodyA.bounds, bodyB.bounds)) { - for (var j = bodyA.parts.length > 1 ? 1 : 0; j < bodyA.parts.length; j++) { - var partA = bodyA.parts[j]; - - for (var k = bodyB.parts.length > 1 ? 1 : 0; k < bodyB.parts.length; k++) { - var partB = bodyB.parts[k]; - - if ((partA === bodyA && partB === bodyB) || Bounds.overlaps(partA.bounds, partB.bounds)) { - // find a previous collision we could reuse - var pairId = Pair.id(partA, partB), - pair = pairsTable[pairId], - previousCollision; - - if (pair && pair.isActive) { - previousCollision = pair.collision; - } else { - previousCollision = null; - } - - // narrow phase - var collision = SAT.collides(partA, partB, previousCollision); - - // @if DEBUG - metrics.narrowphaseTests += 1; - if (collision.reused) - metrics.narrowReuseCount += 1; - // @endif - - if (collision.collided) { - collisions.push(collision); - // @if DEBUG - metrics.narrowDetections += 1; - // @endif - } - } - } - } - } - } - - return collisions; - }; - - /** - * Returns `true` if both supplied collision filters will allow a collision to occur. - * See `body.collisionFilter` for more information. - * @method canCollide - * @param {} filterA - * @param {} filterB - * @return {bool} `true` if collision can occur - */ - Detector.canCollide = function(filterA, filterB) { - if (filterA.group === filterB.group && filterA.group !== 0) - return filterA.group > 0; - - return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0; - }; - -})(); - - -/***/ }), -/* 151 */ -/***/ (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 Bodies = __webpack_require__(55); -var Body = __webpack_require__(25); -var Class = __webpack_require__(0); -var Components = __webpack_require__(113); -var GetFastValue = __webpack_require__(1); -var HasValue = __webpack_require__(77); -var Vertices = __webpack_require__(29); - -/** - * @classdesc - * A wrapper around a Tile that provides access to a corresponding Matter body. A tile can only - * have one Matter body associated with it. You can either pass in an existing Matter body for - * the tile or allow the constructor to create the corresponding body for you. If the Tile has a - * collision group (defined in Tiled), those shapes will be used to create the body. If not, the - * tile's rectangle bounding box will be used. - * - * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody. - * - * Note: not all Tiled collision shapes are supported. See - * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information. - * - * @class TileBody - * @memberof Phaser.Physics.Matter - * @constructor - * @since 3.0.0 - * - * @extends Phaser.Physics.Matter.Components.Bounce - * @extends Phaser.Physics.Matter.Components.Collision - * @extends Phaser.Physics.Matter.Components.Friction - * @extends Phaser.Physics.Matter.Components.Gravity - * @extends Phaser.Physics.Matter.Components.Mass - * @extends Phaser.Physics.Matter.Components.Sensor - * @extends Phaser.Physics.Matter.Components.Sleep - * @extends Phaser.Physics.Matter.Components.Static - * - * @param {Phaser.Physics.Matter.World} world - [description] - * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. - * @param {object} [options] - Options to be used when creating the Matter body. See - * Phaser.Physics.Matter.Matter.Body for a list of what Matter accepts. - * @param {Phaser.Physics.Matter.Matter.Body} [options.body=null] - An existing Matter body to - * be used instead of creating a new one. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. - */ -var MatterTileBody = new Class({ - - Mixins: [ - Components.Bounce, - Components.Collision, - Components.Friction, - Components.Gravity, - Components.Mass, - Components.Sensor, - Components.Sleep, - Components.Static - ], - - initialize: - - function MatterTileBody (world, tile, options) - { - /** - * The tile object the body is associated with. - * - * @name Phaser.Physics.Matter.TileBody#tile - * @type {Phaser.Tilemaps.Tile} - * @since 3.0.0 - */ - this.tile = tile; - - /** - * The Matter world the body exists within. - * - * @name Phaser.Physics.Matter.TileBody#world - * @type {Phaser.Physics.Matter.World} - * @since 3.0.0 - */ - this.world = world; - - // Install a reference to 'this' on the tile and ensure there can only be one matter body - // associated with the tile - if (tile.physics.matterBody) - { - tile.physics.matterBody.destroy(); - } - - tile.physics.matterBody = this; - - // Set the body either from an existing body (if provided), the shapes in the tileset - // collision layer (if it exists) or a rectangle matching the tile. - var body = GetFastValue(options, 'body', null); - - var addToWorld = GetFastValue(options, 'addToWorld', true); - - if (!body) - { - var collisionGroup = tile.getCollisionGroup(); - var collisionObjects = GetFastValue(collisionGroup, 'objects', []); - - if (collisionObjects.length > 0) - { - this.setFromTileCollision(options); - } - else - { - this.setFromTileRectangle(options); - } - } - else - { - this.setBody(body, addToWorld); - } - }, - - /** - * Sets the current body to a rectangle that matches the bounds of the tile. - * - * @method Phaser.Physics.Matter.TileBody#setFromTileRectangle - * @since 3.0.0 - * - * @param {object} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - setFromTileRectangle: function (options) - { - if (options === undefined) { options = {}; } - if (!HasValue(options, 'isStatic')) { options.isStatic = true; } - if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } - - var bounds = this.tile.getBounds(); - var cx = bounds.x + (bounds.width / 2); - var cy = bounds.y + (bounds.height / 2); - var body = Bodies.rectangle(cx, cy, bounds.width, bounds.height, options); - - this.setBody(body, options.addToWorld); - - return this; - }, - - /** - * Sets the current body from the collision group associated with the Tile. This is typically - * set up in Tiled's collision editor. - * - * Note: Matter doesn't support all shapes from Tiled. Rectangles and polygons are directly - * supported. Ellipses are converted into circle bodies. Polylines are treated as if they are - * closed polygons. If a tile has multiple shapes, a multi-part body will be created. Concave - * shapes are supported if poly-decomp library is included. Decomposition is not guaranteed to - * work for complex shapes (e.g. holes), so it's often best to manually decompose a concave - * polygon into multiple convex polygons yourself. - * - * @method Phaser.Physics.Matter.TileBody#setFromTileCollision - * @since 3.0.0 - * - * @param {object} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - setFromTileCollision: function (options) - { - if (options === undefined) { options = {}; } - if (!HasValue(options, 'isStatic')) { options.isStatic = true; } - if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } - - var sx = this.tile.tilemapLayer.scaleX; - var sy = this.tile.tilemapLayer.scaleY; - var tileX = this.tile.getLeft(); - var tileY = this.tile.getTop(); - var collisionGroup = this.tile.getCollisionGroup(); - var collisionObjects = GetFastValue(collisionGroup, 'objects', []); - - var parts = []; - - for (var i = 0; i < collisionObjects.length; i++) - { - var object = collisionObjects[i]; - var ox = tileX + (object.x * sx); - var oy = tileY + (object.y * sy); - var ow = object.width * sx; - var oh = object.height * sy; - var body = null; - - if (object.rectangle) - { - body = Bodies.rectangle(ox + ow / 2, oy + oh / 2, ow, oh, options); - } - else if (object.ellipse) - { - body = Bodies.circle(ox + ow / 2, oy + oh / 2, ow / 2, options); - } - else if (object.polygon || object.polyline) - { - // Polygons and polylines are both treated as closed polygons - var originalPoints = object.polygon ? object.polygon : object.polyline; - - var points = originalPoints.map(function (p) - { - return { x: p.x * sx, y: p.y * sy }; - }); - - var vertices = Vertices.create(points); - - // Points are relative to the object's origin (first point placed in Tiled), but - // matter expects points to be relative to the center of mass. This only applies to - // convex shapes. When a concave shape is decomposed, multiple parts are created and - // the individual parts are positioned relative to (ox, oy). - if (Vertices.isConvex(points)) - { - var center = Vertices.centre(vertices); - ox += center.x; - oy += center.y; - } - - body = Bodies.fromVertices(ox, oy, vertices, options); - } - - if (body) - { - parts.push(body); - } - } - - if (parts.length === 1) - { - this.setBody(parts[0], options.addToWorld); - } - else if (parts.length > 1) - { - options.parts = parts; - this.setBody(Body.create(options), options.addToWorld); - } - - return this; - }, - - /** - * Sets the current body to the given body. This will remove the previous body, if one already - * exists. - * - * @method Phaser.Physics.Matter.TileBody#setBody - * @since 3.0.0 - * - * @param {MatterJS.Body} body - The new Matter body to use. - * @param {boolean} [addToWorld=true] - Whether or not to add the body to the Matter world. - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - setBody: function (body, addToWorld) - { - if (addToWorld === undefined) { addToWorld = true; } - - if (this.body) - { - this.removeBody(); - } - - this.body = body; - this.body.gameObject = this; - - if (addToWorld) - { - this.world.add(this.body); - } - - return this; - }, - - /** - * Removes the current body from the TileBody and from the Matter world - * - * @method Phaser.Physics.Matter.TileBody#removeBody - * @since 3.0.0 - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - removeBody: function () - { - if (this.body) - { - this.world.remove(this.body); - this.body.gameObject = undefined; - this.body = undefined; - } - - return this; - }, - - /** - * Removes the current body from the tile and the world. - * - * @method Phaser.Physics.Matter.TileBody#destroy - * @since 3.0.0 - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - destroy: function () - { - this.removeBody(); - this.tile.physics.matterBody = undefined; - } - -}); - -module.exports = MatterTileBody; - - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Axes` module contains methods for creating and manipulating sets of axes. -* -* @class Axes -*/ - -var Axes = {}; - -module.exports = Axes; - -var Vector = __webpack_require__(34); -var Common = __webpack_require__(12); - -(function() { - - /** - * Creates a new set of axes from the given vertices. - * @method fromVertices - * @param {vertices} vertices - * @return {axes} A new axes from the given vertices - */ - Axes.fromVertices = function(vertices) { - var axes = {}; - - // find the unique axes, using edge normal gradients - for (var i = 0; i < vertices.length; i++) { - var j = (i + 1) % vertices.length, - normal = Vector.normalise({ - x: vertices[j].y - vertices[i].y, - y: vertices[i].x - vertices[j].x - }), - gradient = (normal.y === 0) ? Infinity : (normal.x / normal.y); - - // limit precision - gradient = gradient.toFixed(3).toString(); - axes[gradient] = normal; - } - - return Common.values(axes); - }; - - /** - * Rotates a set of axes by the given angle. - * @method rotate - * @param {axes} axes - * @param {number} angle - */ - Axes.rotate = function(axes, angle) { - if (angle === 0) - return; - - var cos = Math.cos(angle), - sin = Math.sin(angle); - - for (var i = 0; i < axes.length; i++) { - var axis = axes[i], - xx; - xx = axis.x * cos - axis.y * sin; - axis.y = axis.x * sin + axis.y * cos; - axis.x = xx; - } - }; - -})(); - - -/***/ }), -/* 153 */ -/***/ (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.Physics.Impact.Components - */ - -module.exports = { - - Acceleration: __webpack_require__(568), - BodyScale: __webpack_require__(567), - BodyType: __webpack_require__(566), - Bounce: __webpack_require__(565), - CheckAgainst: __webpack_require__(564), - Collides: __webpack_require__(563), - Debug: __webpack_require__(562), - Friction: __webpack_require__(561), - Gravity: __webpack_require__(560), - Offset: __webpack_require__(559), - SetGameObject: __webpack_require__(558), - Velocity: __webpack_require__(557) - -}; - - -/***/ }), -/* 154 */ -/***/ (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 - * A representation of a vector in 3D space. - * - * A three-component vector. - * - * @class Vector3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - */ -var Vector3 = new Class({ - - initialize: - - function Vector3 (x, y, z) - { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector3#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector3#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector3#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - }, - - /** - * Set this Vector to point up. - * - * Sets the y component of the vector to 1, and the others to 0. - * - * @method Phaser.Math.Vector3#up - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - up: function () - { - this.x = 0; - this.y = 1; - this.z = 0; - - return this; - }, - - /** - * Make a clone of this Vector3. - * - * @method Phaser.Math.Vector3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. - */ - clone: function () - { - return new Vector3(this.x, this.y, this.z); - }, - - /** - * Calculate the cross (vector) product of two given Vectors. - * - * @method Phaser.Math.Vector3#crossVectors - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - The first Vector to multiply. - * @param {Phaser.Math.Vector3} b - The second Vector to multiply. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - crossVectors: function (a, b) - { - var ax = a.x; - var ay = a.y; - var az = a.z; - var bx = b.x; - var by = b.y; - var bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict equality check against each Vector's components. - * - * @method Phaser.Math.Vector3#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. - * - * @return {boolean} True if the two vectors strictly match, otherwise false. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector3#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - - return this; - }, - - /** - * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. - * - * @method Phaser.Math.Vector3#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. - * @param {number} [y] - The y value to set for this Vector. - * @param {number} [z] - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - set: function (x, y, z) - { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - - return this; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector3#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector3#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - - return this; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector3#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - scale: function (scale) - { - if (isFinite(scale)) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - } - else - { - this.x = 0; - this.y = 0; - this.z = 0; - } - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - - return this; - }, - - /** - * Negate the `x`, `y` and `z` components of this Vector. - * - * @method Phaser.Math.Vector3#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector3#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return dx * dx + dy * dy + dz * dz; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector3#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return Math.sqrt(x * x + y * y + z * z); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector3#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return x * x + y * y + z * z; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector3#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var len = x * x + y * y + z * z; - - if (len > 0) - { - len = 1 / Math.sqrt(len); - - this.x = x * len; - this.y = y * len; - this.z = z * len; - } - - return this; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. - * - * @return {number} The dot product of this Vector and `v`. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z; - }, - - /** - * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. - * - * @method Phaser.Math.Vector3#cross - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector to cross product with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - cross: function (v) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var bx = v.x; - var by = v.y; - var bz = v.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector3#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = x * m[0] + y * m[3] + z * m[6]; - this.y = x * m[1] + y * m[4] + z * m[7]; - this.z = x * m[2] + y * m[5] + z * m[8]; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Vector3#transformCoordinates - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformCoordinates: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; - - this.x = tx / tw; - this.y = ty / tw; - this.z = tz / tw; - - return this; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector3#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - 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; - - // 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; - - // 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; - }, - - /** - * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, - * e.g. unprojecting a 2D point into 3D space. - * - * @method Phaser.Math.Vector3#project - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - project: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var a00 = m[0]; - var a01 = m[1]; - var a02 = m[2]; - var a03 = m[3]; - var a10 = m[4]; - var a11 = m[5]; - var a12 = m[6]; - var a13 = m[7]; - var a20 = m[8]; - var a21 = m[9]; - var a22 = m[10]; - var a23 = m[11]; - var a30 = m[12]; - var a31 = m[13]; - var a32 = m[14]; - var a33 = m[15]; - - var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); - - this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; - this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; - this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; - - return this; - }, - - /** - * Unproject this point from 2D space to 3D space. - * The point should have its x and y properties set to - * 2D screen space, and the z either at 0 (near plane) - * or 1 (far plane). The provided matrix is assumed to already - * be combined, i.e. projection * view * model. - * - * After this operation, this vector's (x, y, z) components will - * represent the unprojected 3D coordinate. - * - * @method Phaser.Math.Vector3#unproject - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. - * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - unproject: function (viewport, invProjectionView) - { - var viewX = viewport.x; - var viewY = viewport.y; - var viewWidth = viewport.z; - var viewHeight = viewport.w; - - var x = this.x - viewX; - var y = (viewHeight - this.y - 1) - viewY; - var z = this.z; - - this.x = (2 * x) / viewWidth - 1; - this.y = (2 * y) / viewHeight - 1; - this.z = 2 * z - 1; - - return this.project(invProjectionView); - }, - - /** - * Make this Vector the zero vector (0, 0, 0). - * - * @method Phaser.Math.Vector3#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - - return this; - } - -}); - -/* -Vector3.Zero = function () -{ - return new Vector3(0, 0, 0); -}; - -Vector3.Up = function () -{ - return new Vector3(0, 1.0, 0); -}; - -Vector3.Copy = function (source) -{ - return new Vector3(source.x, source.y, source.z); -}; - -Vector3.TransformCoordinates = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]) + transformation.m[12]; - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]) + transformation.m[13]; - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]) + transformation.m[14]; - var w = (vector.x * transformation.m[3]) + (vector.y * transformation.m[7]) + (vector.z * transformation.m[11]) + transformation.m[15]; - - return new Vector3(x / w, y / w, z / w); -}; - -Vector3.TransformNormal = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]); - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]); - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]); - - return new Vector3(x, y, z); -}; - -Vector3.Dot = function (left, right) -{ - return (left.x * right.x + left.y * right.y + left.z * right.z); -}; - -Vector3.Cross = function (left, right) -{ - var x = left.y * right.z - left.z * right.y; - var y = left.z * right.x - left.x * right.z; - var z = left.x * right.y - left.y * right.x; - - return new Vector3(x, y, z); -}; - -Vector3.Normalize = function (vector) -{ - var newVector = Vector3.Copy(vector); - newVector.normalize(); - - return newVector; -}; - -Vector3.Distance = function (value1, value2) -{ - return Math.sqrt(Vector3.DistanceSquared(value1, value2)); -}; - -Vector3.DistanceSquared = function (value1, value2) -{ - var x = value1.x - value2.x; - var y = value1.y - value2.y; - var z = value1.z - value2.z; - - return (x * x) + (y * y) + (z * z); -}; -*/ - -module.exports = Vector3; - - -/***/ }), -/* 155 */ -/***/ (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__(20); -var File = __webpack_require__(22); -var FileTypesManager = __webpack_require__(7); -var GetFastValue = __webpack_require__(1); -var IsPlainObject = __webpack_require__(8); -var ParseXML = __webpack_require__(379); - -/** - * @typedef {object} Phaser.Loader.FileTypes.XMLFileConfig - * - * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. - * @property {string} [url] - The absolute or relative URL to load the file from. - * @property {string} [extension='xml'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ - -/** - * @classdesc - * A single XML File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml. - * - * @class XMLFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var XMLFile = new Class({ - - Extends: File, - - initialize: - - function XMLFile (loader, key, url, xhrSettings) - { - var extension = 'xml'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - - var fileConfig = { - type: 'xml', - cache: loader.cacheManager.xml, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.XMLFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = ParseXML(this.xhrLoader.responseText); - - if (this.data) - { - this.onProcessComplete(); - } - else - { - console.warn('Invalid XMLFile: ' + this.key); - - this.onProcessError(); - } - } - -}); - -/** - * Adds an XML file, or array of XML files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.xml('wavedata', 'files/AlienWaveData.xml'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global XML Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the XML Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the XML Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.xml({ - * key: 'wavedata', - * url: 'files/AlienWaveData.xml' - * }); - * ``` - * - * See the documentation for `Phaser.Loader.FileTypes.XMLFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.xml('wavedata', 'files/AlienWaveData.xml'); - * // and later in your game ... - * var data = this.cache.xml.get('wavedata'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the XML Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#xml - * @fires Phaser.Loader.LoaderPlugin#addFileEvent - * @since 3.0.0 - * - * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig|Phaser.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {Phaser.Loader.LoaderPlugin} The Loader instance. - */ -FileTypesManager.register('xml', 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 XMLFile(this, key[i])); - } - } - else - { - this.addFile(new XMLFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = XMLFile; - - -/***/ }), -/* 156 */ -/***/ (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 Extend = __webpack_require__(21); -var XHRSettings = __webpack_require__(115); - -/** - * Takes two XHRSettings Objects and creates a new XHRSettings object from them. - * - * The new object is seeded by the values given in the global settings, but any setting in - * the local object overrides the global ones. - * - * @function Phaser.Loader.MergeXHRSettings - * @since 3.0.0 - * - * @param {XHRSettingsObject} global - The global XHRSettings object. - * @param {XHRSettingsObject} local - The local XHRSettings object. - * - * @return {XHRSettingsObject} A newly formed XHRSettings object. - */ -var MergeXHRSettings = function (global, local) -{ - var output = (global === undefined) ? XHRSettings() : Extend({}, global); - - if (local) - { - for (var setting in local) - { - if (local[setting] !== undefined) - { - output[setting] = local[setting]; - } - } - } - - return output; -}; - -module.exports = MergeXHRSettings; - - -/***/ }), -/* 157 */ -/***/ (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 a File and a baseURL value this returns the URL the File will use to download from. - * - * @function Phaser.Loader.GetURL - * @since 3.0.0 - * - * @param {Phaser.Loader.File} file - The File object. - * @param {string} baseURL - A default base URL. - * - * @return {string} The URL the File will use. - */ -var GetURL = function (file, baseURL) -{ - if (!file.url) - { - return false; - } - - if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) - { - return file.url; - } - else - { - return baseURL + file.url; - } -}; - -module.exports = GetURL; - - -/***/ }), -/* 158 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using floor. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. - * As will `14` snap to `10`... but `16` will snap to `15`. - * - * @function Phaser.Math.Snap.Floor - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapFloor = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.floor(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapFloor; - - -/***/ }), -/* 159 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Keyboard Codes. - * + * * @name Phaser.Input.Keyboard.KeyCodes * @enum {integer} * @memberof Phaser.Input.Keyboard @@ -34407,37 +27790,6763 @@ var KeyCodes = { /** * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET */ - CLOSED_BRACKET: 221 + CLOSED_BRACKET: 221, + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX + */ + SEMICOLON_FIREFOX: 59, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COLON + */ + COLON: 58, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS + */ + COMMA_FIREFOX_WINDOWS: 60, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX + */ + COMMA_FIREFOX: 62, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX + */ + BRACKET_RIGHT_FIREFOX: 174, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX + */ + BRACKET_LEFT_FIREFOX: 175 }; module.exports = KeyCodes; /***/ }), -/* 160 */ -/***/ (function(module, exports) { +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * @namespace Phaser.Textures.Events + */ + +module.exports = { + + ADD: __webpack_require__(1136), + ERROR: __webpack_require__(1135), + LOAD: __webpack_require__(1134), + READY: __webpack_require__(1133), + REMOVE: __webpack_require__(1132) + +}; + + +/***/ }), +/* 137 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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; + + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(108); + +/** + * 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. + * + * @typedef {object} Phaser.Device.Browser + * @since 3.0.0 + * + * @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(); + + +/***/ }), +/* 139 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates a linear (interpolation) value over t. + * + * @function Phaser.Math.Linear + * @since 3.0.0 + * + * @param {number} p0 - The first point. + * @param {number} p1 - The second point. + * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1. + * + * @return {number} The step t% of the way between p0 and p1. + */ +var Linear = function (p0, p1, t) +{ + return (p1 - p0) * t + p0; +}; + +module.exports = Linear; + + +/***/ }), +/* 140 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// 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 () +{ + /** + * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. + * + * @function Phaser.Display.Canvas.Smoothing.getPrefix + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. + * + * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. + */ + var getPrefix = function (context) + { + var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + + for (var i = 0; i < vendors.length; i++) + { + var s = vendors[i] + 'mageSmoothingEnabled'; + + if (s in context) + { + return s; + } + } + + return null; + }; + + /** + * 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 + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var enable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = true; + } + + return context; + }; + + /** + * 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 + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var disable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = false; + } + + return context; + }; + + /** + * 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 + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. + * + * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. + */ + var isEnabled = function (context) + { + return (prefix !== null) ? context[prefix] : null; + }; + + return { + disable: disable, + enable: enable, + getPrefix: getPrefix, + isEnabled: isEnabled + }; + +}; + +module.exports = Smoothing(); + + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(14); +var DegToRad = __webpack_require__(39); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(45); +var Rectangle = __webpack_require__(11); +var TransformMatrix = __webpack_require__(46); +var ValueToColor = __webpack_require__(212); +var Vector2 = __webpack_require__(3); + +/** + * @typedef {object} JSONCameraBounds + * @property {number} x - The horizontal position of camera + * @property {number} y - The vertical position of camera + * @property {number} width - The width size of camera + * @property {number} height - The height size of camera + */ + +/** + * @typedef {object} JSONCamera + * + * @property {string} name - The name of the camera + * @property {number} x - The horizontal position of camera + * @property {number} y - The vertical position of camera + * @property {number} width - The width size of camera + * @property {number} height - The height size of camera + * @property {number} zoom - The zoom of camera + * @property {number} rotation - The rotation of camera + * @property {boolean} roundPixels - The round pixels st status of camera + * @property {number} scrollX - The horizontal scroll of camera + * @property {number} scrollY - The vertical scroll of camera + * @property {string} backgroundColor - The background color of camera + * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera + */ + +/** + * @classdesc + * A Base Camera class. + * + * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, + * and can be positioned, rotated, zoomed and scrolled accordingly. + * + * A Camera consists of two elements: The viewport and the scroll values. + * + * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are + * created the same size as your game, but their position and size can be set to anything. This means if you + * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, + * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). + * + * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this + * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the + * viewport, and changing the viewport has no impact on the scrolling. + * + * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, + * allowing you to filter Game Objects out on a per-Camera basis. + * + * The Base Camera is extended by the Camera class, which adds in special effects including Fade, + * Flash and Camera Shake, as well as the ability to follow Game Objects. + * + * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow + * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate + * to when they were added to the Camera class. + * + * @class BaseCamera + * @memberof Phaser.Cameras.Scene2D + * @constructor + * @since 3.12.0 + * + * @extends Phaser.Events.EventEmitter + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.Visible + * + * @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 BaseCamera = new Class({ + + Extends: EventEmitter, + + Mixins: [ + Components.Alpha, + Components.Visible + ], + + initialize: + + function BaseCamera (x, y, width, height) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 0; } + if (height === undefined) { height = 0; } + + EventEmitter.call(this); + + /** + * A reference to the Scene this camera belongs to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene; + + /** + * A reference to the Game Scene Manager. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @since 3.12.0 + */ + this.sceneManager; + + /** + * A reference to the Game Scale Manager. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scaleManager; + + /** + * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. + * This value is a bitmask. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#id + * @type {integer} + * @readonly + * @since 3.11.0 + */ + this.id = 0; + + /** + * The name of the Camera. This is left empty for your own use. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; + + /** + * This property is un-used in v3.16. + * + * The resolution of the Game, used in most Camera calculations. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#resolution + * @type {number} + * @readonly + * @deprecated + * @since 3.12.0 + */ + this.resolution = 1; + + /** + * Should this camera round its pixel values to integers? + * + * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.roundPixels = false; + + /** + * Is this Camera visible or not? + * + * A visible camera will render and perform input tests. + * An invisible camera will not render anything and will skip input tests. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#visible + * @type {boolean} + * @default true + * @since 3.10.0 + */ + + /** + * Is this Camera using a bounds to restrict scrolling movement? + * + * Set this property along with the bounds via `Camera.setBounds`. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.useBounds = false; + + /** + * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at. + * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. + * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. + * You can use it for culling or intersection checks. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#worldView + * @type {Phaser.Geom.Rectangle} + * @readonly + * @since 3.11.0 + */ + this.worldView = new Rectangle(); + + /** + * Is this Camera dirty? + * + * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. + * + * This flag is cleared during the `postRenderCamera` method of the renderer. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#dirty + * @type {boolean} + * @default true + * @since 3.11.0 + */ + this.dirty = true; + + /** + * The x position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollX` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#x + * @type {number} + * @private + * @since 3.0.0 + */ + this._x = x; + + /** + * The y position of the Camera, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollY` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#y + * @type {number} + * @private + * @since 3.0.0 + */ + this._y = y; + + /** + * Internal Camera X value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_cx + * @type {number} + * @private + * @since 3.12.0 + */ + this._cx = 0; + + /** + * Internal Camera Y value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_cy + * @type {number} + * @private + * @since 3.12.0 + */ + this._cy = 0; + + /** + * Internal Camera Width value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_cw + * @type {number} + * @private + * @since 3.12.0 + */ + this._cw = 0; + + /** + * Internal Camera Height value multiplied by the resolution. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_ch + * @type {number} + * @private + * @since 3.12.0 + */ + this._ch = 0; + + /** + * The width of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_width + * @type {number} + * @private + * @since 3.11.0 + */ + this._width = width; + + /** + * The height of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_height + * @type {number} + * @private + * @since 3.11.0 + */ + this._height = height; + + /** + * The bounds the camera is restrained to during scrolling. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.0.0 + */ + this._bounds = new Rectangle(); + + /** + * The horizontal scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._scrollX = 0; + + /** + * The vertical scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._scrollY = 0; + + /** + * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom + * @type {number} + * @private + * @default 1 + * @since 3.11.0 + */ + this._zoom = 1; + + /** + * The rotation of the Camera in radians. + * + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._rotation = 0; + + /** + * A local transform matrix used for internal calculations. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#matrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.0.0 + */ + this.matrix = new TransformMatrix(); + + /** + * Does this Camera have a transparent background? + * + * @name Phaser.Cameras.Scene2D.BaseCamera#transparent + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.transparent = true; + + /** + * The background color of this Camera. Only used if `transparent` is `false`. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor + * @type {Phaser.Display.Color} + * @since 3.0.0 + */ + this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); + + /** + * The Camera alpha value. Setting this property impacts every single object that this Camera + * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out, + * or via the chainable `setAlpha` method instead. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#alpha + * @type {number} + * @default 1 + * @since 3.11.0 + */ + + /** + * Should the camera cull Game Objects before checking them for input hit tests? + * In some special cases it may be beneficial to disable this. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.disableCull = false; + + /** + * A temporary array of culled objects. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects + * @type {Phaser.GameObjects.GameObject[]} + * @default [] + * @private + * @since 3.0.0 + */ + this.culledObjects = []; + + /** + * The mid-point of the Camera in 'world' coordinates. + * + * Use it to obtain exactly where in the world the center of the camera is currently looking. + * + * This value is updated in the preRender method, after the scroll values and follower + * have been processed. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.11.0 + */ + this.midPoint = new Vector2(width / 2, height / 2); + + /** + * The horizontal origin of rotation for this Camera. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * See `setOrigin` to set both origins in a single, chainable call. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#originX + * @type {number} + * @default 0.5 + * @since 3.11.0 + */ + this.originX = 0.5; + + /** + * The vertical origin of rotation for this Camera. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * See `setOrigin` to set both origins in a single, chainable call. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#originY + * @type {number} + * @default 0.5 + * @since 3.11.0 + */ + this.originY = 0.5; + + /** + * Does this Camera have a custom viewport? + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport + * @type {boolean} + * @private + * @default false + * @since 3.12.0 + */ + this._customViewport = false; + }, + + /** + * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha + * @since 3.11.0 + * + * @param {number} [value=1] - The Camera alpha value. + * + * @return {this} This Camera instance. + */ + + /** + * Sets the rotation origin of this Camera. + * + * The values are given in the range 0 to 1 and are only used when calculating Camera rotation. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin + * @since 3.11.0 + * + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {this} This Camera instance. + */ + setOrigin: function (x, y) + { + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } + + this.originX = x; + this.originY = y; + + return this; + }, + + /** + * Calculates what the Camera.scrollX and scrollY values would need to be in order to move + * the Camera so it is centered on the given x and y coordinates, without actually moving + * the Camera there. The results are clamped based on the Camera bounds, if set. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll + * @since 3.11.0 + * + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. + * @param {Phaser.Math.Vector2} [out] - A Vec2 to store the values in. If not given a new Vec2 is created. + * + * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` and `y` properties. + */ + getScroll: function (x, y, out) + { + if (out === undefined) { out = new Vector2(); } + + var originX = this.width * 0.5; + var originY = this.height * 0.5; + + out.x = x - originX; + out.y = y - originY; + + if (this.useBounds) + { + out.x = this.clampX(out.x); + out.y = this.clampY(out.y); + } + + return out; + }, + + /** + * Moves the Camera horizontally so that it is centered on the given x coordinate, bounds allowing. + * Calling this does not change the scrollY value. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX + * @since 3.16.0 + * + * @param {number} x - The horizontal coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOnX: function (x) + { + var originX = this.width * 0.5; + + this.midPoint.x = x; + + this.scrollX = x - originX; + + if (this.useBounds) + { + this.scrollX = this.clampX(this.scrollX); + } + + return this; + }, + + /** + * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing. + * Calling this does not change the scrollX value. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY + * @since 3.16.0 + * + * @param {number} y - The vertical coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOnY: function (y) + { + var originY = this.height * 0.5; + + this.midPoint.y = y; + + this.scrollY = y - originY; + + if (this.useBounds) + { + this.scrollY = this.clampY(this.scrollY); + } + + return this; + }, + + /** + * Moves the Camera so that it is centered on the given coordinates, bounds allowing. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn + * @since 3.11.0 + * + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOn: function (x, y) + { + this.centerOnX(x); + this.centerOnY(y); + + return this; + }, + + /** + * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerToBounds: function () + { + if (this.useBounds) + { + var bounds = this._bounds; + var originX = this.width * 0.5; + var originY = this.height * 0.5; + + this.midPoint.set(bounds.centerX, bounds.centerY); + + this.scrollX = bounds.centerX - originX; + this.scrollY = bounds.centerY - originY; + } + + return this; + }, + + /** + * Moves the Camera so that it is re-centered based on its viewport size. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerToSize: function () + { + this.scrollX = this.width * 0.5; + this.scrollY = this.height * 0.5; + + return this; + }, + + /** + * Takes an array of Game Objects and returns a new array featuring only those objects + * visible by this camera. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#cull + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return] + * + * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull. + * + * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera. + */ + cull: function (renderableObjects) + { + if (this.disableCull) + { + return renderableObjects; + } + + 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 renderableObjects; + } + + 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 culledObjects = this.culledObjects; + var length = renderableObjects.length; + + determinant = 1 / determinant; + + culledObjects.length = 0; + + for (var index = 0; index < length; ++index) + { + var object = renderableObjects[index]; + + if (!object.hasOwnProperty('width') || object.parentContainer) + { + culledObjects.push(object); + continue; + } + + 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 cullTop = this.y; + var cullBottom = cullTop + cameraH; + var cullLeft = this.x; + var cullRight = cullLeft + cameraW; + + if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom)) + { + culledObjects.push(object); + } + } + + return culledObjects; + }, + + /** + * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform. + * You can optionally provide a Vector2, or similar object, to store the results in. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [output,$return] + * + * @param {number} x - The x position to convert to world space. + * @param {number} y - The y position to convert to world space. + * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties. + */ + getWorldPoint: function (x, y, output) + { + 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]; + + // Invert Matrix + var determinant = (mva * mvd) - (mvb * mvc); + + if (!determinant) + { + output.x = x; + output.y = y; + + return output; + } + + 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 res = this.resolution; + + var scrollX = this.scrollX; + var scrollY = this.scrollY; + + // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks + var sx = x + ((scrollX * c - scrollY * s) * zoom); + var sy = y + ((scrollX * s + scrollY * c) * zoom); + + // Apply transform to point + output.x = (sx * ima + sy * imc) * res + ime; + output.y = (sx * imb + sy * imd) * res + imf; + + return output; + }, + + /** + * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings + * so that they are ignored by this Camera. This means they will not be rendered by this Camera. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#ignore + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group)} entries - The Game Object, or array of Game Objects, to be ignored by this Camera. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + ignore: function (entries) + { + var id = this.id; + + if (!Array.isArray(entries)) + { + entries = [ entries ]; + } + + for (var i = 0; i < entries.length; i++) + { + var entry = entries[i]; + + if (Array.isArray(entry)) + { + this.ignore(entry); + } + else if (entry.isParent) + { + this.ignore(entry.getChildren()); + } + else + { + entry.cameraFilter |= id; + } + } + + return this; + }, + + /** + * Internal preRender step. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#preRender + * @protected + * @since 3.0.0 + * + * @param {number} resolution - The game resolution, as set in the Scale Manager. + */ + preRender: function (resolution) + { + var width = this.width; + var height = this.height; + + var halfWidth = width * 0.5; + var halfHeight = height * 0.5; + + var zoom = this.zoom * resolution; + var matrix = this.matrix; + + var originX = width * this.originX; + var originY = height * this.originY; + + var sx = this.scrollX; + var sy = this.scrollY; + + if (this.useBounds) + { + sx = this.clampX(sx); + sy = this.clampY(sy); + } + + if (this.roundPixels) + { + originX = Math.round(originX); + originY = Math.round(originY); + } + + // Values are in pixels and not impacted by zooming the Camera + this.scrollX = sx; + this.scrollY = sy; + + var midX = sx + halfWidth; + var midY = sy + halfHeight; + + // The center of the camera, in world space, so taking zoom into account + // Basically the pixel value of what it's looking at in the middle of the cam + this.midPoint.set(midX, midY); + + var displayWidth = width / zoom; + var displayHeight = height / zoom; + + this.worldView.setTo( + midX - (displayWidth / 2), + midY - (displayHeight / 2), + displayWidth, + displayHeight + ); + + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); + matrix.translate(-originX, -originY); + }, + + /** + * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required. + * Do not call this method if you are not using camera bounds. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#clampX + * @since 3.11.0 + * + * @param {number} x - The value to horizontally scroll clamp. + * + * @return {number} The adjusted value to use as scrollX. + */ + clampX: function (x) + { + var bounds = this._bounds; + + var dw = this.displayWidth; + + var bx = bounds.x + ((dw - this.width) / 2); + var bw = Math.max(bx, bx + bounds.width - dw); + + if (x < bx) + { + x = bx; + } + else if (x > bw) + { + x = bw; + } + + return x; + }, + + /** + * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required. + * Do not call this method if you are not using camera bounds. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#clampY + * @since 3.11.0 + * + * @param {number} y - The value to vertically scroll clamp. + * + * @return {number} The adjusted value to use as scrollY. + */ + clampY: function (y) + { + var bounds = this._bounds; + + var dh = this.displayHeight; + + var by = bounds.y + ((dh - this.height) / 2); + var bh = Math.max(by, by + bounds.height - dh); + + if (y < by) + { + y = by; + } + else if (y > bh) + { + y = bh; + } + + return y; + }, + + /* + var gap = this._zoomInversed; + return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap); + */ + + /** + * If this Camera has previously had movement bounds set on it, this will remove them. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + removeBounds: function () + { + this.useBounds = false; + + this.dirty = true; + + this._bounds.setEmpty(); + + return this; + }, + + /** + * Set the rotation of this Camera. This causes everything it renders to appear rotated. + * + * Rotating a camera does not rotate the viewport itself, it is applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle + * @since 3.0.0 + * + * @param {number} [value=0] - The cameras angle of rotation, given in degrees. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setAngle: function (value) + { + if (value === undefined) { value = 0; } + + this.rotation = DegToRad(value); + + return this; + }, + + /** + * Sets the background color for this Camera. + * + * By default a Camera has a transparent background but it can be given a solid color, with any level + * of transparency, via this method. + * + * The color value can be specified using CSS color notation, hex or numbers. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor + * @since 3.0.0 + * + * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setBackgroundColor: function (color) + { + if (color === undefined) { color = 'rgba(0,0,0,0)'; } + + this.backgroundColor = ValueToColor(color); + + this.transparent = (this.backgroundColor.alpha === 0); + + return this; + }, + + /** + * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. + * + * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the + * edges and into blank space. It does not limit the placement of Game Objects, or where + * the Camera viewport can be positioned. + * + * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. + * + * Clear the bounds entirely by calling `Camera.removeBounds`. + * + * If you set bounds that are smaller than the viewport it will stop the Camera from being + * able to scroll. The bounds can be positioned where-ever you wish. By default they are from + * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of + * the Camera bounds. However, you can position them anywhere. So if you wanted a game world + * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y + * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find + * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds + * @since 3.0.0 + * + * @param {integer} x - The top-left x coordinate of the bounds. + * @param {integer} y - The top-left y coordinate of the bounds. + * @param {integer} width - The width of the bounds, in pixels. + * @param {integer} height - The height of the bounds, in pixels. + * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setBounds: function (x, y, width, height, centerOn) + { + if (centerOn === undefined) { centerOn = false; } + + this._bounds.setTo(x, y, width, height); + + this.dirty = true; + this.useBounds = true; + + if (centerOn) + { + this.centerToBounds(); + } + else + { + this.scrollX = this.clampX(this.scrollX); + this.scrollY = this.clampY(this.scrollY); + } + + return this; + }, + + /** + * Returns a rectangle containing the bounds of the Camera. + * + * If the Camera does not have any bounds the rectangle will be empty. + * + * The rectangle is a copy of the bounds, so is safe to modify. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds + * @since 3.16.0 + * + * @param {Phaser.Geom.Rectangle} [out] - An optional Rectangle to store the bounds in. If not given, a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the bounds of this Camera. + */ + getBounds: function (out) + { + if (out === undefined) { out = new Rectangle(); } + + var source = this._bounds; + + out.setTo(source.x, source.y, source.width, source.height); + + return out; + }, + + /** + * Sets the name of this Camera. + * This value is for your own use and isn't used internally. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setName + * @since 3.0.0 + * + * @param {string} [value=''] - The name of the Camera. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setName: function (value) + { + if (value === undefined) { value = ''; } + + this.name = value; + + return this; + }, + + /** + * Set the position of the Camera viewport within the game. + * + * This does not change where the camera is 'looking'. See `setScroll` to control that. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition + * @since 3.0.0 + * + * @param {number} x - The top-left x coordinate of the Camera viewport. + * @param {number} [y=x] - The top-left y coordinate of the Camera viewport. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setPosition: function (x, y) + { + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; + + return this; + }, + + /** + * Set the rotation of this Camera. This causes everything it renders to appear rotated. + * + * Rotating a camera does not rotate the viewport itself, it is applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation + * @since 3.0.0 + * + * @param {number} [value=0] - The rotation of the Camera, in radians. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setRotation: function (value) + { + if (value === undefined) { value = 0; } + + this.rotation = value; + + return this; + }, + + /** + * Should the Camera round pixel values to whole integers when rendering Game Objects? + * + * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels + * @since 3.0.0 + * + * @param {boolean} value - `true` to round Camera pixels, `false` to not. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setRoundPixels: function (value) + { + this.roundPixels = value; + + return this; + }, + + /** + * Sets the Scene the Camera is bound to. + * + * Also populates the `resolution` property and updates the internal size values. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setScene + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene the camera is bound to. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setScene: function (scene) + { + if (this.scene && this._customViewport) + { + this.sceneManager.customViewports--; + } + + this.scene = scene; + + this.sceneManager = scene.sys.game.scene; + this.scaleManager = scene.sys.scale; + + var res = this.scaleManager.resolution; + + this.resolution = res; + + this._cx = this._x * res; + this._cy = this._y * res; + this._cw = this._width * res; + this._ch = this._height * res; + + this.updateSystem(); + + return this; + }, + + /** + * Set the position of where the Camera is looking within the game. + * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly. + * Use this method, or the scroll properties, to move your camera around the game world. + * + * This does not change where the camera viewport is placed. See `setPosition` to control that. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll + * @since 3.0.0 + * + * @param {number} x - The x coordinate of the Camera in the game world. + * @param {number} [y=x] - The y coordinate of the Camera in the game world. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setScroll: function (x, y) + { + if (y === undefined) { y = x; } + + this.scrollX = x; + this.scrollY = y; + + return this; + }, + + /** + * Set the size of the Camera viewport. + * + * By default a Camera is the same size as the game, but can be made smaller via this method, + * allowing you to create mini-cam style effects by creating and positioning a smaller Camera + * viewport within your game. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setSize + * @since 3.0.0 + * + * @param {integer} width - The width of the Camera viewport. + * @param {integer} [height=width] - The height of the Camera viewport. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setSize: function (width, height) + { + if (height === undefined) { height = width; } + + this.width = width; + this.height = height; + + return this; + }, + + /** + * This method sets the position and size of the Camera viewport in a single call. + * + * If you're trying to change where the Camera is looking at in your game, then see + * the method `Camera.setScroll` instead. This method is for changing the viewport + * itself, not what the camera can see. + * + * By default a Camera is the same size as the game, but can be made smaller via this method, + * allowing you to create mini-cam style effects by creating and positioning a smaller Camera + * viewport within your game. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport + * @since 3.0.0 + * + * @param {number} x - The top-left x coordinate of the Camera viewport. + * @param {number} y - The top-left y coordinate of the Camera viewport. + * @param {integer} width - The width of the Camera viewport. + * @param {integer} [height=width] - The height of the Camera viewport. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setViewport: function (x, y, width, height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + return this; + }, + + /** + * Set the zoom value of the Camera. + * + * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. + * Changing to a larger value, such as 2, will cause the camera to 'zoom in'. + * + * A value of 1 means 'no zoom' and is the default. + * + * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom + * @since 3.0.0 + * + * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + setZoom: function (value) + { + if (value === undefined) { value = 1; } + + if (value === 0) + { + value = 0.001; + } + + this.zoom = value; + + return this; + }, + + /** + * Sets the visibility of this Camera. + * + * An invisible Camera will skip rendering and input tests of everything it can see. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible + * @since 3.10.0 + * + * @param {boolean} value - The visible state of the Camera. + * + * @return {this} This Camera instance. + */ + + /** + * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON + * @since 3.0.0 + * + * @return {JSONCamera} A well-formed object suitable for conversion to JSON. + */ + toJSON: function () + { + 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 + }; + } + + return output; + }, + + /** + * Internal method called automatically by the Camera Manager. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#update + * @protected + * @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, in ms, elapsed since the last frame. + */ + update: function () + { + // NOOP + }, + + /** + * Internal method called automatically when the viewport changes. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem + * @private + * @since 3.12.0 + */ + updateSystem: function () + { + if (!this.scaleManager) + { + return; + } + + var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.height !== this._height); + + var sceneManager = this.sceneManager; + + if (custom && !this._customViewport) + { + // We need a custom viewport for this Camera + sceneManager.customViewports++; + } + else if (!custom && this._customViewport) + { + // We're turning off a custom viewport for this Camera + sceneManager.customViewports--; + } + + this.dirty = true; + this._customViewport = custom; + }, + + /** + * Destroys this Camera instance and its internal properties and references. + * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. + * + * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. + * + * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, + * rather than calling this method directly. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#destroy + * @fires Phaser.Cameras.Scene2D.Events#DESTROY + * @since 3.0.0 + */ + destroy: function () + { + this.emit(Events.DESTROY, this); + + this.removeAllListeners(); + + this.matrix.destroy(); + + this.culledObjects = []; + + if (this._customViewport) + { + // We're turning off a custom viewport for this Camera + this.sceneManager.customViewports--; + } + + this._bounds = null; + + this.scene = null; + this.scaleManager = null; + this.sceneManager = null; + }, + + /** + * The x position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollX` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this._x; + }, + + set: function (value) + { + this._x = value; + this._cx = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The y position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollY` value. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this._y; + }, + + set: function (value) + { + this._y = value; + this._cy = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The width of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#width + * @type {number} + * @since 3.0.0 + */ + width: { + + get: function () + { + return this._width; + }, + + set: function (value) + { + this._width = value; + this._cw = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The height of the Camera viewport, in pixels. + * + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#height + * @type {number} + * @since 3.0.0 + */ + height: { + + get: function () + { + return this._height; + }, + + set: function (value) + { + this._height = value; + this._ch = value * this.resolution; + this.updateSystem(); + } + + }, + + /** + * The horizontal scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + scrollX: { + + get: function () + { + return this._scrollX; + }, + + set: function (value) + { + this._scrollX = value; + this.dirty = true; + } + + }, + + /** + * The vertical scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + scrollY: { + + get: function () + { + return this._scrollY; + }, + + set: function (value) + { + this._scrollY = value; + this.dirty = true; + } + + }, + + /** + * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoom + * @type {number} + * @default 1 + * @since 3.0.0 + */ + zoom: { + + get: function () + { + return this._zoom; + }, + + set: function (value) + { + this._zoom = value; + this.dirty = true; + } + + }, + + /** + * The rotation of the Camera in radians. + * + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#rotation + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + rotation: { + + get: function () + { + return this._rotation; + }, + + set: function (value) + { + this._rotation = value; + this.dirty = true; + } + + }, + + /** + * The horizontal position of the center of the Camera's viewport, relative to the left of the game canvas. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#centerX + * @type {number} + * @readonly + * @since 3.10.0 + */ + centerX: { + + get: function () + { + return this.x + (0.5 * this.width); + } + + }, + + /** + * The vertical position of the center of the Camera's viewport, relative to the top of the game canvas. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#centerY + * @type {number} + * @readonly + * @since 3.10.0 + */ + centerY: { + + get: function () + { + return this.y + (0.5 * this.height); + } + + }, + + /** + * The displayed width of the camera viewport, factoring in the camera zoom level. + * + * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width + * would be 1600, as it's displaying twice as many pixels as zoom level 1. + * + * Equally, a camera with a width of 800 and zoom of 2 would have a display width + * of 400 pixels. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth + * @type {number} + * @readonly + * @since 3.11.0 + */ + displayWidth: { + + get: function () + { + return this.width / this.zoom; + } + + }, + + /** + * The displayed height of the camera viewport, factoring in the camera zoom level. + * + * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height + * would be 1200, as it's displaying twice as many pixels as zoom level 1. + * + * Equally, a camera with a height of 600 and zoom of 2 would have a display height + * of 300 pixels. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight + * @type {number} + * @readonly + * @since 3.11.0 + */ + displayHeight: { + + get: function () + { + return this.height / this.zoom; + } + + } + +}); + +module.exports = BaseCamera; + + +/***/ }), +/* 142 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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--) + { + var j = Math.floor(Math.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + + return array; +}; + +module.exports = Shuffle; + + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { DESTROY: __webpack_require__(1321) }; + + +/***/ }), +/* 144 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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 = { + + /** + * The initial WebGL pipeline of this Game Object. + * + * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly + * @since 3.0.0 + */ + defaultPipeline: null, + + /** + * The current WebGL pipeline of this Game Object. + * + * @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 + * @since 3.0.0 + * + * @param {string} [pipelineName=TextureTintPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. + * + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + */ + initPipeline: function (pipelineName) + { + if (pipelineName === undefined) { pipelineName = 'TextureTintPipeline'; } + + var renderer = this.scene.sys.game.renderer; + + if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) + { + this.defaultPipeline = renderer.getPipeline(pipelineName); + this.pipeline = this.defaultPipeline; + + return true; + } + + 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 {this} This Game Object instance. + */ + setPipeline: function (pipelineName) + { + var renderer = this.scene.sys.game.renderer; + + if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) + { + this.pipeline = renderer.getPipeline(pipelineName); + } + + return this; + }, + + /** + * 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; + + +/***/ }), +/* 145 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the perimeter of a Rectangle. + * + * @function Phaser.Geom.Rectangle.Perimeter + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to use. + * + * @return {number} The perimeter of the Rectangle, equal to `(width * 2) + (height * 2)`. + */ +var Perimeter = function (rect) +{ + return 2 * (rect.width + rect.height); +}; + +module.exports = Perimeter; + + +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Animations.Events + */ + +module.exports = { + + ADD_ANIMATION: __webpack_require__(1353), + ANIMATION_COMPLETE: __webpack_require__(1352), + ANIMATION_REPEAT: __webpack_require__(1351), + ANIMATION_RESTART: __webpack_require__(1350), + ANIMATION_START: __webpack_require__(1349), + PAUSE_ALL: __webpack_require__(1348), + REMOVE_ANIMATION: __webpack_require__(1347), + RESUME_ALL: __webpack_require__(1346), + SPRITE_ANIMATION_COMPLETE: __webpack_require__(1345), + SPRITE_ANIMATION_KEY_COMPLETE: __webpack_require__(1344), + SPRITE_ANIMATION_KEY_REPEAT: __webpack_require__(1343), + SPRITE_ANIMATION_KEY_RESTART: __webpack_require__(1342), + SPRITE_ANIMATION_KEY_START: __webpack_require__(1341), + SPRITE_ANIMATION_KEY_UPDATE: __webpack_require__(1340), + SPRITE_ANIMATION_REPEAT: __webpack_require__(1339), + SPRITE_ANIMATION_RESTART: __webpack_require__(1338), + SPRITE_ANIMATION_START: __webpack_require__(1337), + SPRITE_ANIMATION_UPDATE: __webpack_require__(1336) + +}; + + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BlendModes = __webpack_require__(66); +var Circle = __webpack_require__(87); +var CircleContains = __webpack_require__(48); +var Class = __webpack_require__(0); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var Rectangle = __webpack_require__(11); +var RectangleContains = __webpack_require__(47); + +/** + * @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 - The Scene to which this Game Object belongs. + * @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. + * + * @name Phaser.GameObjects.Zone#blendMode + * @type {integer} + * @since 3.0.0 + */ + this.blendMode = BlendModes.NORMAL; + + this.updateDisplayOrigin(); + }, + + /** + * 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; + }, + + 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.Zone#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; + } + + }, + + /** + * Sets the size of this Game Object. + * + * @method Phaser.GameObjects.Zone#setSize + * @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. + * + * @return {Phaser.GameObjects.Zone} This Game Object. + */ + setSize: function (width, height, resizeInput) + { + if (resizeInput === undefined) { resizeInput = true; } + + this.width = width; + this.height = height; + + if (resizeInput && this.input && this.input.hitArea instanceof Rectangle) + { + this.input.hitArea.width = width; + this.input.hitArea.height = height; + } + + return this; + }, + + /** + * Sets the display size of this Game Object. + * Calling this will adjust the scale. + * + * @method Phaser.GameObjects.Zone#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.Zone} This Game Object. + */ + setDisplaySize: function (width, height) + { + this.displayWidth = width; + this.displayHeight = height; + + return this; + }, + + /** + * Sets this Zone to be a Circular Drop Zone. + * The circle is centered on this Zones `x` and `y` coordinates. + * + * @method Phaser.GameObjects.Zone#setCircleDropZone + * @since 3.0.0 + * + * @param {number} radius - The radius of the Circle that will form the Drop Zone. + * + * @return {Phaser.GameObjects.Zone} This Game Object. + */ + setCircleDropZone: function (radius) + { + return this.setDropZone(new Circle(0, 0, radius), CircleContains); + }, + + /** + * Sets this Zone to be a Rectangle Drop Zone. + * The rectangle is centered on this Zones `x` and `y` coordinates. + * + * @method Phaser.GameObjects.Zone#setRectangleDropZone + * @since 3.0.0 + * + * @param {number} width - The width of the rectangle drop zone. + * @param {number} height - The height of the rectangle drop zone. + * + * @return {Phaser.GameObjects.Zone} This Game Object. + */ + setRectangleDropZone: function (width, height) + { + return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains); + }, + + /** + * Allows you to define your own Geometry shape to be used as a Drop Zone. + * + * @method Phaser.GameObjects.Zone#setDropZone + * @since 3.0.0 + * + * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. + * @param {HitAreaCallback} 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. + */ + setDropZone: function (shape, callback) + { + if (shape === undefined) + { + this.setRectangleDropZone(this.width, this.height); + } + else if (!this.input) + { + this.setInteractive(shape, callback, true); + } + + return this; + }, + + /** + * A NOOP method so you can pass a Zone to a Container. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setAlpha + * @private + * @since 3.11.0 + */ + setAlpha: function () + { + }, + + /** + * A NOOP method so you can pass a Zone to a Container in Canvas. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setBlendMode + * @private + * @since 3.16.2 + */ + setBlendMode: function () + { + }, + + /** + * A Zone does not render. + * + * @method Phaser.GameObjects.Zone#renderCanvas + * @private + * @since 3.0.0 + */ + renderCanvas: function () + { + }, + + /** + * A Zone does not render. + * + * @method Phaser.GameObjects.Zone#renderWebGL + * @private + * @since 3.0.0 + */ + renderWebGL: function () + { + } + +}); + +module.exports = Zone; + + +/***/ }), +/* 148 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} TweenDataGenConfig + * + * @property {function} delay - Time in ms/frames before tween will start. + * @property {function} duration - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {function} hold - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {function} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {function} repeatDelay - Time in ms/frames before the repeat will start. + */ + +/** + * @typedef {object} Phaser.Tweens.TweenDataConfig + * + * @property {object} target - The target to tween. + * @property {string} key - The property of the target being tweened. + * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween. + * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween. + * @property {function} ease - The ease function this tween uses. + * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) + * @property {number} [delay=0] - Time in ms/frames before tween will start. + * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired. + * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start. + * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats + * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats + * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData. + * @property {number} [elapsed=0] - Delta counter + * @property {integer} [repeatCounter=0] - How many repeats are left to run? + * @property {number} [start=0] - Ease value data. + * @property {number} [current=0] - Ease value data. + * @property {number} [end=0] - Ease value data. + * @property {number} [t1=0] - Time duration 1. + * @property {number} [t2=0] - Time duration 2. + * @property {TweenDataGenConfig} [gen] - LoadValue generation functions. + * @property {integer} [state=0] - TWEEN_CONST.CREATED + */ + +/** + * Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween. + * + * This is an internal function used by the TweenBuilder and should not be accessed directly, instead, Tweens should be created using the GameObjectFactory or GameObjectCreator. + * + * @function Phaser.Tweens.TweenData + * @since 3.0.0 + * + * @param {object} target - The target to tween. + * @param {string} key - The property of the target to tween. + * @param {function} getEnd - What the property will be at the END of the Tween. + * @param {function} getStart - What the property will be at the START of the Tween. + * @param {function} ease - The ease function this tween uses. + * @param {number} delay - Time in ms/frames before tween will start. + * @param {number} duration - Duration of the tween in ms/frames. + * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. + * @param {number} hold - Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Time in ms/frames before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * + * @return {TweenDataConfig} The config object describing this TweenData. + */ +var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) +{ + return { + + // The target to tween + target: target, + + // The property of the target to tween + key: key, + + // The returned value sets what the property will be at the END of the Tween. + getEndValue: getEnd, + + // The returned value sets what the property will be at the START of the Tween. + getStartValue: getStart, + + // The ease function this tween uses. + ease: ease, + + // Duration of the tween in ms/frames, excludes time for yoyo or repeats. + duration: 0, + + // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) + totalDuration: 0, + + // Time in ms/frames before tween will start. + delay: 0, + + // Cause the tween to return back to its start value after hold has expired. + yoyo: yoyo, + + // Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + hold: 0, + + // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + repeat: 0, + + // Time in ms/frames before the repeat will start. + repeatDelay: 0, + + // Automatically call toggleFlipX when the TweenData yoyos or repeats + flipX: flipX, + + // Automatically call toggleFlipY when the TweenData yoyos or repeats + flipY: flipY, + + // Between 0 and 1 showing completion of this TweenData. + progress: 0, + + // Delta counter. + elapsed: 0, + + // How many repeats are left to run? + repeatCounter: 0, + + // Ease Value Data: + + start: 0, + current: 0, + end: 0, + + // Time Durations + t1: 0, + t2: 0, + + // LoadValue generation functions + gen: { + delay: delay, + duration: duration, + hold: hold, + repeat: repeat, + repeatDelay: repeatDelay + }, + + // TWEEN_CONST.CREATED + state: 0 + }; +}; + +module.exports = TweenData; + + +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var GameObjectCreator = __webpack_require__(15); +var GameObjectFactory = __webpack_require__(5); +var TWEEN_CONST = __webpack_require__(99); + +/** + * @classdesc + * A Tween is able to manipulate the properties of one or more objects to any given value, based + * on a duration and type of ease. They are rarely instantiated directly and instead should be + * created via the TweenManager. + * + * @class Tween + * @memberof Phaser.Tweens + * @constructor + * @since 3.0.0 + * + * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - A reference to the parent of this Tween. Either the Tween Manager or a Tween Timeline instance. + * @param {Phaser.Tweens.TweenDataConfig[]} data - An array of TweenData objects, each containing a unique property to be tweened. + * @param {array} targets - An array of targets to be tweened. + */ +var Tween = new Class({ + + initialize: + + function Tween (parent, data, targets) + { + /** + * A reference to the parent of this Tween. + * Either the Tween Manager or a Tween Timeline instance. + * + * @name Phaser.Tweens.Tween#parent + * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * Is the parent of this Tween a Timeline? + * + * @name Phaser.Tweens.Tween#parentIsTimeline + * @type {boolean} + * @since 3.0.0 + */ + this.parentIsTimeline = parent.hasOwnProperty('isTimeline'); + + /** + * An array of TweenData objects, each containing a unique property and target being tweened. + * + * @name Phaser.Tweens.Tween#data + * @type {Phaser.Tweens.TweenDataConfig[]} + * @since 3.0.0 + */ + this.data = data; + + /** + * The cached length of the data array. + * + * @name Phaser.Tweens.Tween#totalData + * @type {integer} + * @since 3.0.0 + */ + this.totalData = data.length; + + /** + * An array of references to the target/s this Tween is operating on. + * + * @name Phaser.Tweens.Tween#targets + * @type {object[]} + * @since 3.0.0 + */ + this.targets = targets; + + /** + * Cached target total (not necessarily the same as the data total) + * + * @name Phaser.Tweens.Tween#totalTargets + * @type {integer} + * @since 3.0.0 + */ + this.totalTargets = targets.length; + + /** + * If `true` then duration, delay, etc values are all frame totals. + * + * @name Phaser.Tweens.Tween#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.Tween#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 element. + * + * @name Phaser.Tweens.Tween#loop + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.loop = 0; + + /** + * Time in ms/frames before the tween loops. + * + * @name Phaser.Tweens.Tween#loopDelay + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.loopDelay = 0; + + /** + * How many loops are left to run? + * + * @name Phaser.Tweens.Tween#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 = -1 (as it never completes) + * + * @name Phaser.Tweens.Tween#completeDelay + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.completeDelay = 0; + + /** + * Countdown timer (used by timeline offset, loopDelay and completeDelay) + * + * @name Phaser.Tweens.Tween#countdown + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.countdown = 0; + + /** + * Set only if this Tween is part of a Timeline. + * + * @name Phaser.Tweens.Tween#offset + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.offset = 0; + + /** + * Set only if this Tween is part of a Timeline. The calculated offset amount. + * + * @name Phaser.Tweens.Tween#calculatedOffset + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.calculatedOffset = 0; + + /** + * The current state of the tween + * + * @name Phaser.Tweens.Tween#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.Tween#_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.Tween#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.Tween#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.Tween#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.Tween#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.Tween#progress + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.progress = 0; + + /** + * Time in ms/frames for the Tween to complete (including looping) + * + * @name Phaser.Tweens.Tween#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.Tween#totalProgress + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.totalProgress = 0; + + /** + * An object containing the various Tween callback references. + * + * @name Phaser.Tweens.Tween#callbacks + * @type {object} + * @default 0 + * @since 3.0.0 + */ + this.callbacks = { + onComplete: null, + onLoop: null, + onRepeat: null, + onStart: null, + onUpdate: null, + onYoyo: null + }; + + this.callbackScope; + }, + + /** + * Returns the current value of the Tween. + * + * @method Phaser.Tweens.Tween#getValue + * @since 3.0.0 + * + * @return {number} The value of the Tween. + */ + getValue: function () + { + return this.data[0].current; + }, + + /** + * Set the scale 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. + * + * @method Phaser.Tweens.Tween#setTimeScale + * @since 3.0.0 + * + * @param {number} value - The scale factor for timescale. + * + * @return {this} - This Tween instance. + */ + setTimeScale: function (value) + { + this.timeScale = value; + + return this; + }, + + /** + * Returns the scale of the time applied to this Tween. + * + * @method Phaser.Tweens.Tween#getTimeScale + * @since 3.0.0 + * + * @return {number} The timescale of this tween (between 0 and 1) + */ + getTimeScale: function () + { + return this.timeScale; + }, + + /** + * Checks if the Tween is currently active. + * + * @method Phaser.Tweens.Tween#isPlaying + * @since 3.0.0 + * + * @return {boolean} `true` if the Tween is active, otherwise `false`. + */ + isPlaying: function () + { + return (this.state === TWEEN_CONST.ACTIVE); + }, + + /** + * Checks if the Tween is currently paused. + * + * @method Phaser.Tweens.Tween#isPaused + * @since 3.0.0 + * + * @return {boolean} `true` if the Tween is paused, otherwise `false`. + */ + isPaused: function () + { + return (this.state === TWEEN_CONST.PAUSED); + }, + + /** + * See if this Tween is currently acting upon the given target. + * + * @method Phaser.Tweens.Tween#hasTarget + * @since 3.0.0 + * + * @param {object} target - The target to check against this Tween. + * + * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`. + */ + hasTarget: function (target) + { + return (this.targets.indexOf(target) !== -1); + }, + + /** + * Updates the value of a property of this Tween to a new value, without adjusting the + * Tween duration or current progress. + * + * You can optionally tell it to set the 'start' value to be the current value (before the change). + * + * @method Phaser.Tweens.Tween#updateTo + * @since 3.0.0 + * + * @param {string} key - The property to set the new value for. + * @param {*} value - The new value of the property. + * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value? + * + * @return {this} - This Tween instance. + */ + updateTo: function (key, value, startToCurrent) + { + if (startToCurrent === undefined) { startToCurrent = false; } + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = this.data[i]; + + if (tweenData.key === key) + { + tweenData.end = value; + + if (startToCurrent) + { + tweenData.start = tweenData.current; + } + + break; + } + } + + return this; + }, + + /** + * Restarts the tween from the beginning. + * + * @method Phaser.Tweens.Tween#restart + * @since 3.0.0 + * + * @return {this} This Tween instance. + */ + restart: function () + { + if (this.state === TWEEN_CONST.REMOVED) + { + this.seek(0); + this.parent.makeActive(this); + } + else + { + this.stop(); + this.play(); + } + + return this; + }, + + /** + * Internal method that calculates the overall duration of the Tween. + * + * @method Phaser.Tweens.Tween#calcDuration + * @since 3.0.0 + */ + calcDuration: function () + { + var max = 0; + + var data = this.data; + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = data[i]; + + // Set t1 (duration + hold + yoyo) + tweenData.t1 = tweenData.duration + tweenData.hold; + + if (tweenData.yoyo) + { + tweenData.t1 += tweenData.duration; + } + + // Set t2 (repeatDelay + duration + hold + yoyo) + tweenData.t2 = tweenData.t1 + tweenData.repeatDelay; + + // Total Duration + tweenData.totalDuration = tweenData.delay + tweenData.t1; + + if (tweenData.repeat === -1) + { + tweenData.totalDuration += (tweenData.t2 * 999999999999); + } + else if (tweenData.repeat > 0) + { + tweenData.totalDuration += (tweenData.t2 * tweenData.repeat); + } + + if (tweenData.totalDuration > max) + { + // Get the longest TweenData from the Tween, used to calculate the Tween TD + max = tweenData.totalDuration; + } + } + + // Excludes loop values + this.duration = max; + + 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; + } + }, + + /** + * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens. + * Should not be called directly. + * + * @method Phaser.Tweens.Tween#init + * @since 3.0.0 + * + * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager. + */ + init: function () + { + var data = this.data; + var totalTargets = this.totalTargets; + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = data[i]; + var target = tweenData.target; + var gen = tweenData.gen; + + tweenData.delay = gen.delay(i, totalTargets, target); + tweenData.duration = gen.duration(i, totalTargets, target); + tweenData.hold = gen.hold(i, totalTargets, target); + tweenData.repeat = gen.repeat(i, totalTargets, target); + tweenData.repeatDelay = gen.repeatDelay(i, totalTargets, target); + } + + this.calcDuration(); + + this.progress = 0; + this.totalProgress = 0; + this.elapsed = 0; + this.totalElapsed = 0; + + // You can't have a paused Tween if it's part of a Timeline + if (this.paused && !this.parentIsTimeline) + { + this.state = TWEEN_CONST.PENDING_ADD; + this._pausedState = TWEEN_CONST.INIT; + + return false; + } + else + { + this.state = TWEEN_CONST.INIT; + + return true; + } + }, + + /** + * Internal method that advances to the next state of the Tween during playback. + * + * @method Phaser.Tweens.Tween#nextState + * @since 3.0.0 + */ + nextState: function () + { + if (this.loopCounter > 0) + { + this.elapsed = 0; + this.progress = 0; + this.loopCounter--; + + var onLoop = this.callbacks.onLoop; + + if (onLoop) + { + onLoop.params[1] = this.targets; + + onLoop.func.apply(onLoop.scope, onLoop.params); + } + + this.resetTweenData(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.params[1] = this.targets; + + onComplete.func.apply(onComplete.scope, onComplete.params); + } + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + }, + + /** + * Pauses the Tween immediately. Use `resume` to continue playback. + * + * @method Phaser.Tweens.Tween#pause + * @since 3.0.0 + * + * @return {this} - This Tween instance. + */ + pause: function () + { + if (this.state === TWEEN_CONST.PAUSED) + { + return; + } + + this.paused = true; + + this._pausedState = this.state; + + this.state = TWEEN_CONST.PAUSED; + + return this; + }, + + /** + * Starts a Tween playing. + * + * You only need to call this method if you have configured the tween to be paused on creation. + * + * @method Phaser.Tweens.Tween#play + * @since 3.0.0 + * + * @param {boolean} resetFromTimeline - Is this Tween being played as part of a Timeline? + * + * @return {this} This Tween instance. + */ + play: function (resetFromTimeline) + { + if (this.state === TWEEN_CONST.ACTIVE) + { + return this; + } + else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED) + { + this.init(); + this.parent.makeActive(this); + resetFromTimeline = true; + } + + var onStart = this.callbacks.onStart; + + if (this.parentIsTimeline) + { + this.resetTweenData(resetFromTimeline); + + if (this.calculatedOffset === 0) + { + if (onStart) + { + onStart.params[1] = this.targets; + + onStart.func.apply(onStart.scope, onStart.params); + } + + this.state = TWEEN_CONST.ACTIVE; + } + else + { + this.countdown = this.calculatedOffset; + + this.state = TWEEN_CONST.OFFSET_DELAY; + } + } + else if (this.paused) + { + this.paused = false; + + this.parent.makeActive(this); + } + else + { + this.resetTweenData(resetFromTimeline); + + this.state = TWEEN_CONST.ACTIVE; + + if (onStart) + { + onStart.params[1] = this.targets; + + onStart.func.apply(onStart.scope, onStart.params); + } + + this.parent.makeActive(this); + } + + return this; + }, + + /** + * Internal method that resets all of the Tween Data, including the progress and elapsed values. + * + * @method Phaser.Tweens.Tween#resetTweenData + * @since 3.0.0 + * + * @param {boolean} resetFromLoop - Has this method been called as part of a loop? + */ + resetTweenData: function (resetFromLoop) + { + var data = this.data; + + for (var i = 0; i < this.totalData; i++) + { + var tweenData = data[i]; + + tweenData.progress = 0; + tweenData.elapsed = 0; + + tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat; + + if (resetFromLoop) + { + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.end); + + tweenData.current = tweenData.start; + + tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + } + else if (tweenData.delay > 0) + { + tweenData.elapsed = tweenData.delay; + tweenData.state = TWEEN_CONST.DELAY; + } + else + { + tweenData.state = TWEEN_CONST.PENDING_RENDER; + } + } + }, + + /** + * Resumes the playback of a previously paused Tween. + * + * @method Phaser.Tweens.Tween#resume + * @since 3.0.0 + * + * @return {this} - This Tween instance. + */ + resume: function () + { + if (this.state === TWEEN_CONST.PAUSED) + { + this.paused = false; + + this.state = this._pausedState; + } + else + { + this.play(); + } + + return this; + }, + + /** + * Attempts to seek to a specific position in a Tween. + * + * @method Phaser.Tweens.Tween#seek + * @since 3.0.0 + * + * @param {number} toPosition - A value between 0 and 1 which represents the progress point to seek to. + * + * @return {this} This Tween instance. + */ + seek: function (toPosition) + { + var data = this.data; + + for (var i = 0; i < this.totalData; i++) + { + // This won't work with loop > 0 yet + var ms = this.totalDuration * toPosition; + + var tweenData = data[i]; + var progress = 0; + var elapsed = 0; + + if (ms <= tweenData.delay) + { + progress = 0; + elapsed = 0; + } + else if (ms >= tweenData.totalDuration) + { + progress = 1; + elapsed = tweenData.duration; + } + else if (ms > tweenData.delay && ms <= tweenData.t1) + { + // Keep it zero bound + ms = Math.max(0, ms - tweenData.delay); + + // Somewhere in the first playthru range + progress = ms / tweenData.t1; + elapsed = tweenData.duration * progress; + } + else if (ms > tweenData.t1 && ms < tweenData.totalDuration) + { + // Somewhere in repeat land + ms -= tweenData.delay; + ms -= tweenData.t1; + + // var repeats = Math.floor(ms / tweenData.t2); + + // remainder + ms = ((ms / tweenData.t2) % 1) * tweenData.t2; + + if (ms > tweenData.repeatDelay) + { + progress = ms / tweenData.t1; + elapsed = tweenData.duration * progress; + } + } + + tweenData.progress = progress; + tweenData.elapsed = elapsed; + + var v = tweenData.ease(tweenData.progress); + + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + + tweenData.target[tweenData.key] = tweenData.current; + } + + return this; + }, + + /** + * Sets an event based callback to be invoked during playback. + * + * @method Phaser.Tweens.Tween#setCallback + * @since 3.0.0 + * + * @param {string} type - Type of the callback. + * @param {function} callback - Callback function. + * @param {array} [params] - An array of parameters for specified callbacks types. + * @param {object} [scope] - The context the callback will be invoked in. + * + * @return {this} This Tween instance. + */ + setCallback: function (type, callback, params, scope) + { + this.callbacks[type] = { func: callback, scope: scope, params: params }; + + 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. + * + * @return {this} This Tween instance. + */ + 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; + } + + return this; + }, + + /** + * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. + * + * @method Phaser.Tweens.Tween#stop + * @since 3.0.0 + * + * @param {number} [resetTo] - A value between 0 and 1. + * + * @return {this} This Tween instance. + */ + stop: function (resetTo) + { + if (this.state === TWEEN_CONST.ACTIVE) + { + if (resetTo !== undefined) + { + this.seek(resetTo); + } + } + + if (this.state !== TWEEN_CONST.REMOVED) + { + if (this.state === TWEEN_CONST.PAUSED || this.state === TWEEN_CONST.PENDING_ADD) + { + this.parent._destroy.push(this); + this.parent._toProcess++; + } + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + + return this; + }, + + /** + * Internal method that advances the Tween based on the time values. + * + * @method Phaser.Tweens.Tween#update + * @since 3.0.0 + * + * @param {number} timestamp - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * + * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. + */ + update: function (timestamp, delta) + { + if (this.state === TWEEN_CONST.PAUSED) + { + return false; + } + + if (this.useFrames) + { + delta = 1 * this.parent.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 = false; + + for (var i = 0; i < this.totalData; i++) + { + if (this.updateTweenData(this, this.data[i], delta)) + { + stillRunning = true; + } + } + + // Anything still running? If not, we're done + if (!stillRunning) + { + this.nextState(); + } + + break; + + case TWEEN_CONST.LOOP_DELAY: + + this.countdown -= delta; + + if (this.countdown <= 0) + { + this.state = TWEEN_CONST.ACTIVE; + } + + break; + + case TWEEN_CONST.OFFSET_DELAY: + + this.countdown -= delta; + + if (this.countdown <= 0) + { + var onStart = this.callbacks.onStart; + + if (onStart) + { + onStart.params[1] = this.targets; + + onStart.func.apply(onStart.scope, onStart.params); + } + + 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.state = TWEEN_CONST.PENDING_REMOVE; + } + + break; + } + + return (this.state === TWEEN_CONST.PENDING_REMOVE); + }, + + /** + * Internal method used as part of the playback process that sets a tween to play in reverse. + * + * @method Phaser.Tweens.Tween#setStateFromEnd + * @since 3.0.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + * + * @return {integer} The state of this Tween. + */ + setStateFromEnd: function (tween, tweenData, diff) + { + if (tweenData.yoyo) + { + // We've hit the end of a Playing Forward TweenData and we have a yoyo + + // Account for any extra time we got from the previous frame + tweenData.elapsed = diff; + tweenData.progress = diff / tweenData.duration; + + if (tweenData.flipX) + { + tweenData.target.toggleFlipX(); + } + + // Problem: The flip and callback and so on gets called for every TweenData that triggers it at the same time. + // If you're tweening several properties it can fire for all of them, at once. + + if (tweenData.flipY) + { + tweenData.target.toggleFlipY(); + } + + var onYoyo = tween.callbacks.onYoyo; + + if (onYoyo) + { + // Element 1 is reserved for the target of the yoyo (and needs setting here) + onYoyo.params[1] = tweenData.target; + + onYoyo.func.apply(onYoyo.scope, onYoyo.params); + } + + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); + + return TWEEN_CONST.PLAYING_BACKWARD; + } + else if (tweenData.repeatCounter > 0) + { + // We've hit the end of a Playing Forward TweenData and we have a Repeat. + // So we're going to go right back to the start to repeat it again. + + tweenData.repeatCounter--; + + // Account for any extra time we got from the previous frame + tweenData.elapsed = diff; + tweenData.progress = diff / tweenData.duration; + + if (tweenData.flipX) + { + tweenData.target.toggleFlipX(); + } + + if (tweenData.flipY) + { + tweenData.target.toggleFlipY(); + } + + var onRepeat = tween.callbacks.onRepeat; + + if (onRepeat) + { + // Element 1 is reserved for the target of the repeat (and needs setting here) + onRepeat.params[1] = tweenData.target; + + onRepeat.func.apply(onRepeat.scope, onRepeat.params); + } + + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start); + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); + + // Delay? + if (tweenData.repeatDelay > 0) + { + tweenData.elapsed = tweenData.repeatDelay - diff; + + tweenData.current = tweenData.start; + + tweenData.target[tweenData.key] = tweenData.current; + + return TWEEN_CONST.REPEAT_DELAY; + } + else + { + return TWEEN_CONST.PLAYING_FORWARD; + } + } + + return TWEEN_CONST.COMPLETE; + }, + + /** + * Internal method used as part of the playback process that sets a tween to play from the start. + * + * @method Phaser.Tweens.Tween#setStateFromStart + * @since 3.0.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + * + * @return {integer} The state of this Tween. + */ + setStateFromStart: function (tween, tweenData, diff) + { + if (tweenData.repeatCounter > 0) + { + tweenData.repeatCounter--; + + // Account for any extra time we got from the previous frame + tweenData.elapsed = diff; + tweenData.progress = diff / tweenData.duration; + + if (tweenData.flipX) + { + tweenData.target.toggleFlipX(); + } + + if (tweenData.flipY) + { + tweenData.target.toggleFlipY(); + } + + var onRepeat = tween.callbacks.onRepeat; + + if (onRepeat) + { + // Element 1 is reserved for the target of the repeat (and needs setting here) + onRepeat.params[1] = tweenData.target; + + onRepeat.func.apply(onRepeat.scope, onRepeat.params); + } + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); + + // Delay? + if (tweenData.repeatDelay > 0) + { + tweenData.elapsed = tweenData.repeatDelay - diff; + + tweenData.current = tweenData.start; + + tweenData.target[tweenData.key] = tweenData.current; + + return TWEEN_CONST.REPEAT_DELAY; + } + else + { + return TWEEN_CONST.PLAYING_FORWARD; + } + } + + return TWEEN_CONST.COMPLETE; + }, + + /** + * Internal method that advances the TweenData based on the time value given. + * + * @method Phaser.Tweens.Tween#updateTweenData + * @since 3.0.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true + * + * @return {boolean} [description] + */ + updateTweenData: function (tween, tweenData, delta) + { + switch (tweenData.state) + { + case TWEEN_CONST.PLAYING_FORWARD: + case TWEEN_CONST.PLAYING_BACKWARD: + + if (!tweenData.target) + { + tweenData.state = TWEEN_CONST.COMPLETE; + break; + } + + var elapsed = tweenData.elapsed; + var duration = tweenData.duration; + var diff = 0; + + elapsed += delta; + + if (elapsed > duration) + { + diff = elapsed - duration; + elapsed = duration; + } + + var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD); + var progress = elapsed / duration; + + var v; + + if (forward) + { + v = tweenData.ease(progress); + } + else + { + v = tweenData.ease(1 - progress); + } + + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + + tweenData.target[tweenData.key] = tweenData.current; + + tweenData.elapsed = elapsed; + tweenData.progress = progress; + + var onUpdate = tween.callbacks.onUpdate; + + if (onUpdate) + { + onUpdate.params[1] = tweenData.target; + + onUpdate.func.apply(onUpdate.scope, onUpdate.params); + } + + if (progress === 1) + { + if (forward) + { + if (tweenData.hold > 0) + { + tweenData.elapsed = tweenData.hold - diff; + + tweenData.state = TWEEN_CONST.HOLD_DELAY; + } + else + { + tweenData.state = this.setStateFromEnd(tween, tweenData, diff); + } + } + else + { + tweenData.state = this.setStateFromStart(tween, tweenData, diff); + } + } + + break; + + case TWEEN_CONST.DELAY: + + tweenData.elapsed -= delta; + + if (tweenData.elapsed <= 0) + { + tweenData.elapsed = Math.abs(tweenData.elapsed); + + tweenData.state = TWEEN_CONST.PENDING_RENDER; + } + + break; + + case TWEEN_CONST.REPEAT_DELAY: + + tweenData.elapsed -= delta; + + if (tweenData.elapsed <= 0) + { + tweenData.elapsed = Math.abs(tweenData.elapsed); + + tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + } + + break; + + case TWEEN_CONST.HOLD_DELAY: + + tweenData.elapsed -= delta; + + if (tweenData.elapsed <= 0) + { + tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed)); + } + + break; + + case TWEEN_CONST.PENDING_RENDER: + + if (tweenData.target) + { + tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.target[tweenData.key]); + + tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start); + + tweenData.current = tweenData.start; + + tweenData.target[tweenData.key] = tweenData.start; + + tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + } + else + { + tweenData.state = TWEEN_CONST.COMPLETE; + } + + break; + } + + // Return TRUE if this TweenData still playing, otherwise return FALSE + return (tweenData.state !== TWEEN_CONST.COMPLETE); + } + +}); + +Tween.TYPES = [ + 'onComplete', + 'onLoop', + 'onRepeat', + 'onStart', + 'onUpdate', + 'onYoyo' +]; + +/** + * Creates a new Tween object. + * + * Note: This method will only be available Tweens have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#tween + * @since 3.0.0 + * + * @param {object} config - The Tween configuration. + * + * @return {Phaser.Tweens.Tween} The Tween that was created. + */ +GameObjectFactory.register('tween', function (config) +{ + return this.scene.sys.tweens.add(config); +}); + +// 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 + +/** + * Creates a new Tween object and returns it. + * + * Note: This method will only be available if Tweens have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#tween + * @since 3.0.0 + * + * @param {object} config - The Tween configuration. + * + * @return {Phaser.Tweens.Tween} The Tween that was created. + */ +GameObjectCreator.register('tween', function (config) +{ + return this.scene.sys.tweens.create(config); +}); + +// When registering a factory function 'this' refers to the GameObjectCreator context. + +module.exports = Tween; + + +/***/ }), +/* 150 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Tweens.TweenConfigDefaults + * + * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. + * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. + * @property {number} [duration=1000] - The duration of the tween in milliseconds. + * @property {string} [ease='Power0'] - The easing equation to use for the tween. + * @property {array} [easeParams] - Optional easing parameters. + * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. + * @property {number} [repeat=0] - The number of times to repeat the tween. + * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. + * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. + * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. + * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. + */ + +var TWEEN_DEFAULTS = { + targets: null, + delay: 0, + duration: 1000, + ease: 'Power0', + easeParams: null, + hold: 0, + repeat: 0, + repeatDelay: 0, + yoyo: false, + flipX: false, + flipY: false +}; + +module.exports = TWEEN_DEFAULTS; + + +/***/ }), +/* 151 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +function hasGetStart (def) +{ + return (!!def.getStart && typeof def.getStart === 'function'); +} + +function hasGetEnd (def) +{ + return (!!def.getEnd && typeof def.getEnd === 'function'); +} + +function hasGetters (def) +{ + return hasGetStart(def) || hasGetEnd(def); +} + +/** + * Returns `getStart` and `getEnd` functions for a Tween's Data based on a target property and end value. + * + * If the end value is a number, it will be treated as an absolute value and the property will be tweened to it. A string can be provided to specify a relative end value which consists of an operation (`+=` to add to the current value, `-=` to subtract from the current value, `*=` to multiply the current value, or `/=` to divide the current value) followed by its operand. A function can be provided to allow greater control over the end value; it will receive the target object being tweened, the name of the property being tweened, and the current value of the property as its arguments. If both the starting and the ending values need to be controlled, an object with `getStart` and `getEnd` callbacks, which will receive the same arguments, can be provided instead. If an object with a `value` property is provided, the property will be used as the effective value under the same rules described here. + * + * @function Phaser.Tweens.Builders.GetValueOp + * @since 3.0.0 + * + * @param {string} key - The name of the property to modify. + * @param {*} propertyValue - The ending value of the property, as described above. + * + * @return {function} An array of two functions, `getStart` and `getEnd`, which return the starting and the ending value of the property based on the provided value. + */ +var GetValueOp = function (key, propertyValue) +{ + var callbacks; + + // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween) + var getEnd = function (target, key, value) { return value; }; + + // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween) + var getStart = function (target, key, value) { return value; }; + + var t = typeof(propertyValue); + + if (t === 'number') + { + // props: { + // x: 400, + // y: 300 + // } + + getEnd = function () + { + return propertyValue; + }; + } + else if (t === 'string') + { + // props: { + // x: '+=400', + // y: '-=300', + // z: '*=2', + // w: '/=2' + // } + + var op = propertyValue[0]; + var num = parseFloat(propertyValue.substr(2)); + + switch (op) + { + case '+': + getEnd = function (target, key, value) + { + return value + num; + }; + break; + + case '-': + getEnd = function (target, key, value) + { + return value - num; + }; + break; + + case '*': + getEnd = function (target, key, value) + { + return value * num; + }; + break; + + case '/': + getEnd = function (target, key, value) + { + return value / num; + }; + break; + + default: + getEnd = function () + { + return parseFloat(propertyValue); + }; + } + } + else if (t === 'function') + { + // The same as setting just the getEnd function and no getStart + + // props: { + // x: function (target, key, value) { return value + 50); }, + // } + + getEnd = propertyValue; + } + else if (t === 'object' && hasGetters(propertyValue)) + { + /* + x: { + // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween. + getEnd: function (target, key, value) + { + return value; + }, + + // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween. + getStart: function (target, key, value) + { + return value; + } + } + */ + + if (hasGetEnd(propertyValue)) + { + getEnd = propertyValue.getEnd; + } + + if (hasGetStart(propertyValue)) + { + getStart = propertyValue.getStart; + } + } + else if (propertyValue.hasOwnProperty('value')) + { + // Value may still be a string, function or a number + // props: { + // x: { value: 400, ... }, + // y: { value: 300, ... } + // } + + callbacks = GetValueOp(key, propertyValue.value); + } + + // If callback not set by the else if block above then set it here and return it + if (!callbacks) + { + callbacks = { + getEnd: getEnd, + getStart: getStart + }; + } + + return callbacks; +}; + +module.exports = GetValueOp; + + +/***/ }), +/* 152 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetValue = __webpack_require__(4); + +/** + * Extracts an array of targets from a Tween configuration object. + * + * The targets will be looked for in a `targets` property. If it's a function, its return value will be used as the result. + * + * @function Phaser.Tweens.Builders.GetTargets + * @since 3.0.0 + * + * @param {object} config - The configuration object to use. + * + * @return {array} An array of targets (may contain only one element), or `null` if no targets were specified. + */ +var GetTargets = function (config) +{ + var targets = GetValue(config, 'targets', null); + + if (targets === null) + { + return targets; + } + + if (typeof targets === 'function') + { + targets = targets.call(); + } + + if (!Array.isArray(targets)) + { + targets = [ targets ]; + } + + return targets; +}; + +module.exports = GetTargets; + + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Formats = __webpack_require__(32); +var MapData = __webpack_require__(92); +var Parse = __webpack_require__(248); +var Tilemap = __webpack_require__(240); + +/** + * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When + * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from + * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For + * an empty map, you should specify tileWidth, tileHeight, width & height. + * + * @function Phaser.Tilemaps.ParseToTilemap + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. + * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @param {integer} [tileWidth=32] - The width of a tile in pixels. + * @param {integer} [tileHeight=32] - The height of a tile in pixels. + * @param {integer} [width=10] - The width of the map in tiles. + * @param {integer} [height=10] - The height of the map in tiles. + * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from + * a 2D array of tile indexes. + * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the + * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.Tilemap} + */ +var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) +{ + if (tileWidth === undefined) { tileWidth = 32; } + if (tileHeight === undefined) { tileHeight = 32; } + if (width === undefined) { width = 10; } + if (height === undefined) { height = 10; } + if (insertNull === undefined) { insertNull = false; } + + var mapData = null; + + if (Array.isArray(data)) + { + var name = key !== undefined ? key : 'map'; + mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull); + } + else if (key !== undefined) + { + var tilemapData = scene.cache.tilemap.get(key); + + if (!tilemapData) + { + console.warn('No map data found for key ' + key); + } + else + { + mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull); + } + } + + if (mapData === null) + { + mapData = new MapData({ + tileWidth: tileWidth, + tileHeight: tileHeight, + width: width, + height: height + }); + } + + return new Tilemap(scene, mapData); +}; + +module.exports = ParseToTilemap; + + +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Formats = __webpack_require__(32); +var LayerData = __webpack_require__(93); +var MapData = __webpack_require__(92); +var Tile = __webpack_require__(67); + +/** + * Parses a 2D array of tile indexes into a new MapData object with a single layer. + * + * @function Phaser.Tilemaps.Parsers.Parse2DArray + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object. + * @param {integer} tileWidth - The width of a tile in pixels. + * @param {integer} tileHeight - The height of a tile in pixels. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.MapData} [description] + */ +var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) +{ + var layerData = new LayerData({ + tileWidth: tileWidth, + tileHeight: tileHeight + }); + + var mapData = new MapData({ + name: name, + tileWidth: tileWidth, + tileHeight: tileHeight, + format: Formats.ARRAY_2D, + layers: [ layerData ] + }); + + var tiles = []; + var height = data.length; + var width = 0; + + for (var y = 0; y < data.length; y++) + { + tiles[y] = []; + var row = data[y]; + + for (var x = 0; x < row.length; x++) + { + var tileIndex = parseInt(row[x], 10); + + if (isNaN(tileIndex) || tileIndex === -1) + { + tiles[y][x] = insertNull + ? null + : new Tile(layerData, -1, x, y, tileWidth, tileHeight); + } + else + { + tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight); + } + } + + if (width === 0) + { + width = row.length; + } + } + + mapData.width = layerData.width = width; + mapData.height = layerData.height = height; + mapData.widthInPixels = layerData.widthInPixels = width * tileWidth; + mapData.heightInPixels = layerData.heightInPixels = height * tileHeight; + layerData.data = tiles; + + return mapData; +}; + +module.exports = Parse2DArray; + + +/***/ }), +/* 155 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Internally used method to keep track of the tile indexes that collide within a layer. This + * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`. + * + * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex + * @private + * @since 3.0.0 + * + * @param {integer} tileIndex - The tile index to set the collision boolean for. + * @param {boolean} [collides=true] - Should the tile index collide or not? + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var SetLayerCollisionIndex = function (tileIndex, collides, layer) +{ + var loc = layer.collideIndexes.indexOf(tileIndex); + + if (collides && loc === -1) + { + layer.collideIndexes.push(tileIndex); + } + else if (!collides && loc !== -1) + { + layer.collideIndexes.splice(loc, 1); + } +}; + +module.exports = SetLayerCollisionIndex; + + +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Tile = __webpack_require__(67); +var IsInLayerBounds = __webpack_require__(94); +var CalculateFacesAt = __webpack_require__(157); +var SetTileCollision = __webpack_require__(68); + +/** + * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index + * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified + * location. If you pass in an index, only the index at the specified location will be changed. + * Collision information will be recalculated at the specified location. + * + * @function Phaser.Tilemaps.Components.PutTileAt + * @private + * @since 3.0.0 + * + * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {integer} tileX - The x coordinate, in tiles, not pixels. + * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. + */ +var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) +{ + if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + + var oldTile = layer.data[tileY][tileX]; + var oldTileCollides = oldTile && oldTile.collides; + + if (tile instanceof Tile) + { + if (layer.data[tileY][tileX] === null) + { + layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height); + } + layer.data[tileY][tileX].copy(tile); + } + else + { + var index = tile; + if (layer.data[tileY][tileX] === null) + { + layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight); + } + else + { + layer.data[tileY][tileX].index = index; + } + } + + // Updating colliding flag on the new tile + var newTile = layer.data[tileY][tileX]; + var collides = layer.collideIndexes.indexOf(newTile.index) !== -1; + SetTileCollision(newTile, collides); + + // Recalculate faces only if the colliding flag at (tileX, tileY) has changed + if (recalculateFaces && (oldTileCollides !== newTile.collides)) + { + CalculateFacesAt(tileX, tileY, layer); + } + + return newTile; +}; + +module.exports = PutTileAt; + + + +/***/ }), +/* 157 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetTileAt = __webpack_require__(117); + +/** + * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting + * faces are used internally for optimizing collisions against tiles. This method is mostly used + * internally to optimize recalculating faces when only one tile has been changed. + * + * @function Phaser.Tilemaps.Components.CalculateFacesAt + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The x coordinate. + * @param {integer} tileY - The y coordinate. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesAt = function (tileX, tileY, layer) +{ + var tile = GetTileAt(tileX, tileY, true, layer); + var above = GetTileAt(tileX, tileY - 1, true, layer); + var below = GetTileAt(tileX, tileY + 1, true, layer); + var left = GetTileAt(tileX - 1, tileY, true, layer); + var right = GetTileAt(tileX + 1, tileY, true, layer); + var tileCollides = tile && tile.collides; + + // Assume the changed tile has all interesting edges + if (tileCollides) + { + tile.faceTop = true; + tile.faceBottom = true; + tile.faceLeft = true; + tile.faceRight = true; + } + + // Reset edges that are shared between tile and its neighbors + if (above && above.collides) + { + if (tileCollides) { tile.faceTop = false; } + above.faceBottom = !tileCollides; + } + + if (below && below.collides) + { + if (tileCollides) { tile.faceBottom = false; } + below.faceTop = !tileCollides; + } + + if (left && left.collides) + { + if (tileCollides) { tile.faceLeft = false; } + left.faceRight = !tileCollides; + } + + if (right && right.collides) + { + if (tileCollides) { tile.faceRight = false; } + right.faceLeft = !tileCollides; + } + + if (tile && !tile.collides) { tile.resetFaces(); } + + return tile; +}; + +module.exports = CalculateFacesAt; + + +/***/ }), +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { + +/** +* The `Matter.World` module contains methods for creating and manipulating the world composite. +* A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. +* A `Matter.World` has a few additional properties including `gravity` and `bounds`. +* It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. +* There are also a few methods here that alias those in `Matter.Composite` for easier readability. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class World +* @extends Composite +*/ + +var World = {}; + +module.exports = World; + +var Composite = __webpack_require__(69); +var Constraint = __webpack_require__(78); +var Common = __webpack_require__(12); + +(function() { + + /** + * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @constructor + * @param {} options + * @return {world} A new world + */ + World.create = function(options) { + var composite = Composite.create(); + + var defaults = { + label: 'World', + gravity: { + x: 0, + y: 1, + scale: 0.001 + }, + bounds: { + min: { x: -Infinity, y: -Infinity }, + max: { x: Infinity, y: Infinity } + } + }; + + return Common.extend(composite, defaults, options); + }; + + /* + * + * Properties Documentation + * + */ + + /** + * The gravity to apply on the world. + * + * @property gravity + * @type object + */ + + /** + * The gravity x component. + * + * @property gravity.x + * @type object + * @default 0 + */ + + /** + * The gravity y component. + * + * @property gravity.y + * @type object + * @default 1 + */ + + /** + * The gravity scale factor. + * + * @property gravity.scale + * @type object + * @default 0.001 + */ + + /** + * A `Bounds` object that defines the world bounds for collision detection. + * + * @property bounds + * @type bounds + * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } + */ + + // World is a Composite body + // see src/module/Outro.js for these aliases: + + /** + * An alias for Composite.add + * @method add + * @param {world} world + * @param {} object + * @return {composite} The original world with the objects added + */ + + /** + * An alias for Composite.remove + * @method remove + * @param {world} world + * @param {} object + * @param {boolean} [deep=false] + * @return {composite} The original world with the objects removed + */ + + /** + * An alias for Composite.clear + * @method clear + * @param {world} world + * @param {boolean} keepStatic + */ + + /** + * An alias for Composite.addComposite + * @method addComposite + * @param {world} world + * @param {composite} composite + * @return {world} The original world with the objects from composite added + */ + + /** + * An alias for Composite.addBody + * @method addBody + * @param {world} world + * @param {body} body + * @return {world} The original world with the body added + */ + + /** + * An alias for Composite.addConstraint + * @method addConstraint + * @param {world} world + * @param {constraint} constraint + * @return {world} The original world with the constraint added + */ + +})(); + + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { + +/** +* The `Matter.Plugin` module contains functions for registering and installing plugins on modules. +* +* @class Plugin +*/ + +var Plugin = {}; + +module.exports = Plugin; + +var Common = __webpack_require__(12); + +(function() { + + Plugin._registry = {}; + + /** + * Registers a plugin object so it can be resolved later by name. + * @method register + * @param plugin {} The plugin to register. + * @return {object} The plugin. + */ + Plugin.register = function(plugin) { + if (!Plugin.isPlugin(plugin)) { + Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.'); + } + + if (plugin.name in Plugin._registry) { + var registered = Plugin._registry[plugin.name], + pluginVersion = Plugin.versionParse(plugin.version).number, + registeredVersion = Plugin.versionParse(registered.version).number; + + if (pluginVersion > registeredVersion) { + Common.warn('Plugin.register:', Plugin.toString(registered), 'was upgraded to', Plugin.toString(plugin)); + Plugin._registry[plugin.name] = plugin; + } else if (pluginVersion < registeredVersion) { + Common.warn('Plugin.register:', Plugin.toString(registered), 'can not be downgraded to', Plugin.toString(plugin)); + } else if (plugin !== registered) { + Common.warn('Plugin.register:', Plugin.toString(plugin), 'is already registered to different plugin object'); + } + } else { + Plugin._registry[plugin.name] = plugin; + } + + return plugin; + }; + + /** + * Resolves a dependency to a plugin object from the registry if it exists. + * The `dependency` may contain a version, but only the name matters when resolving. + * @method resolve + * @param dependency {string} The dependency. + * @return {object} The plugin if resolved, otherwise `undefined`. + */ + Plugin.resolve = function(dependency) { + return Plugin._registry[Plugin.dependencyParse(dependency).name]; + }; + + /** + * Returns a pretty printed plugin name and version. + * @method toString + * @param plugin {} The plugin. + * @return {string} Pretty printed plugin name and version. + */ + Plugin.toString = function(plugin) { + return typeof plugin === 'string' ? plugin : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0'); + }; + + /** + * Returns `true` if the object meets the minimum standard to be considered a plugin. + * This means it must define the following properties: + * - `name` + * - `version` + * - `install` + * @method isPlugin + * @param obj {} The obj to test. + * @return {boolean} `true` if the object can be considered a plugin otherwise `false`. + */ + Plugin.isPlugin = function(obj) { + return obj && obj.name && obj.version && obj.install; + }; + + /** + * Returns `true` if a plugin with the given `name` been installed on `module`. + * @method isUsed + * @param module {} The module. + * @param name {string} The plugin name. + * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`. + */ + Plugin.isUsed = function(module, name) { + return module.used.indexOf(name) > -1; + }; + + /** + * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`. + * If `plugin.for` is not specified then it is assumed to be applicable. + * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`. + * @method isFor + * @param plugin {} The plugin. + * @param module {} The module. + * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`. + */ + Plugin.isFor = function(plugin, module) { + var parsed = plugin.for && Plugin.dependencyParse(plugin.for); + return !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range)); + }; + + /** + * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`. + * For installing plugins on `Matter` see the convenience function `Matter.use`. + * Plugins may be specified either by their name or a reference to the plugin object. + * Plugins themselves may specify further dependencies, but each plugin is installed only once. + * Order is important, a topological sort is performed to find the best resulting order of installation. + * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases. + * This function logs the resulting status of each dependency in the console, along with any warnings. + * - A green tick ✅ indicates a dependency was resolved and installed. + * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies. + * - A red cross ❌ indicates a dependency could not be resolved. + * Avoid calling this function multiple times on the same module unless you intend to manually control installation order. + * @method use + * @param module {} The module install plugins on. + * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`). + */ + Plugin.use = function(module, plugins) { + module.uses = (module.uses || []).concat(plugins || []); + + if (module.uses.length === 0) { + Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.'); + return; + } + + var dependencies = Plugin.dependencies(module), + sortedDependencies = Common.topologicalSort(dependencies), + status = []; + + for (var i = 0; i < sortedDependencies.length; i += 1) { + if (sortedDependencies[i] === module.name) { + continue; + } + + var plugin = Plugin.resolve(sortedDependencies[i]); + + if (!plugin) { + status.push('❌ ' + sortedDependencies[i]); + continue; + } + + if (Plugin.isUsed(module, plugin.name)) { + continue; + } + + if (!Plugin.isFor(plugin, module)) { + Common.warn('Plugin.use:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(module) + '.'); + plugin._warned = true; + } + + if (plugin.install) { + plugin.install(module); + } else { + Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.'); + plugin._warned = true; + } + + if (plugin._warned) { + status.push('🔶 ' + Plugin.toString(plugin)); + delete plugin._warned; + } else { + status.push('✅ ' + Plugin.toString(plugin)); + } + + module.used.push(plugin.name); + } + + if (status.length > 0 && !plugin.silent) { + Common.info(status.join(' ')); + } + }; + + /** + * Recursively finds all of a module's dependencies and returns a flat dependency graph. + * @method dependencies + * @param module {} The module. + * @return {object} A dependency graph. + */ + Plugin.dependencies = function(module, tracked) { + var parsedBase = Plugin.dependencyParse(module), + name = parsedBase.name; + + tracked = tracked || {}; + + if (name in tracked) { + return; + } + + module = Plugin.resolve(module) || module; + + tracked[name] = Common.map(module.uses || [], function(dependency) { + if (Plugin.isPlugin(dependency)) { + Plugin.register(dependency); + } + + var parsed = Plugin.dependencyParse(dependency), + resolved = Plugin.resolve(dependency); + + if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) { + Common.warn( + 'Plugin.dependencies:', Plugin.toString(resolved), 'does not satisfy', + Plugin.toString(parsed), 'used by', Plugin.toString(parsedBase) + '.' + ); + + resolved._warned = true; + module._warned = true; + } else if (!resolved) { + Common.warn( + 'Plugin.dependencies:', Plugin.toString(dependency), 'used by', + Plugin.toString(parsedBase), 'could not be resolved.' + ); + + module._warned = true; + } + + return parsed.name; + }); + + for (var i = 0; i < tracked[name].length; i += 1) { + Plugin.dependencies(tracked[name][i], tracked); + } + + return tracked; + }; + + /** + * Parses a dependency string into its components. + * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`. + * See documentation for `Plugin.versionParse` for a description of the format. + * This function can also handle dependencies that are already resolved (e.g. a module object). + * @method dependencyParse + * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`. + * @return {object} The dependency parsed into its components. + */ + Plugin.dependencyParse = function(dependency) { + if (Common.isString(dependency)) { + var pattern = /^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?))?$/; + + if (!pattern.test(dependency)) { + Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.'); + } + + return { + name: dependency.split('@')[0], + range: dependency.split('@')[1] || '*' + }; + } + + return { + name: dependency.name, + range: dependency.range || dependency.version + }; + }; + + /** + * Parses a version string into its components. + * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)). + * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`. + * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax). + * Only the following range types are supported: + * - Tilde ranges e.g. `~1.2.3` + * - Caret ranges e.g. `^1.2.3` + * - Exact version e.g. `1.2.3` + * - Any version `*` + * @method versionParse + * @param range {string} The version string. + * @return {object} The version range parsed into its components. + */ + Plugin.versionParse = function(range) { + var pattern = /^\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?$/; + + if (!pattern.test(range)) { + Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); + } + + var identifiers = range.split('-'); + range = identifiers[0]; + + var isRange = isNaN(Number(range[0])), + version = isRange ? range.substr(1) : range, + parts = Common.map(version.split('.'), function(part) { + return Number(part); + }); + + return { + isRange: isRange, + version: version, + range: range, + operator: isRange ? range[0] : '', + parts: parts, + prerelease: identifiers[1], + number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2] + }; + }; + + /** + * Returns `true` if `version` satisfies the given `range`. + * See documentation for `Plugin.versionParse` for a description of the format. + * If a version or range is not specified, then any version (`*`) is assumed to satisfy. + * @method versionSatisfies + * @param version {string} The version string. + * @param range {string} The range string. + * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`. + */ + Plugin.versionSatisfies = function(version, range) { + range = range || '*'; + + var rangeParsed = Plugin.versionParse(range), + rangeParts = rangeParsed.parts, + versionParsed = Plugin.versionParse(version), + versionParts = versionParsed.parts; + + if (rangeParsed.isRange) { + if (rangeParsed.operator === '*' || version === '*') { + return true; + } + + if (rangeParsed.operator === '~') { + return versionParts[0] === rangeParts[0] && versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; + } + + if (rangeParsed.operator === '^') { + if (rangeParts[0] > 0) { + return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number; + } + + if (rangeParts[1] > 0) { + return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; + } + + return versionParts[2] === rangeParts[2]; + } + } + + return version === range || version === '*'; + }; + +})(); + + +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Matter = __webpack_require__(258); + +Matter.Body = __webpack_require__(27); +Matter.Composite = __webpack_require__(69); +Matter.World = __webpack_require__(158); + +Matter.Detector = __webpack_require__(162); +Matter.Grid = __webpack_require__(257); +Matter.Pairs = __webpack_require__(256); +Matter.Pair = __webpack_require__(119); +Matter.Query = __webpack_require__(578); +Matter.Resolver = __webpack_require__(255); +Matter.SAT = __webpack_require__(161); + +Matter.Constraint = __webpack_require__(78); + +Matter.Common = __webpack_require__(12); +Matter.Engine = __webpack_require__(254); +Matter.Events = __webpack_require__(79); +Matter.Sleeping = __webpack_require__(95); +Matter.Plugin = __webpack_require__(159); + +Matter.Bodies = __webpack_require__(59); +Matter.Composites = __webpack_require__(261); + +Matter.Axes = __webpack_require__(165); +Matter.Bounds = __webpack_require__(35); +Matter.Svg = __webpack_require__(576); +Matter.Vector = __webpack_require__(36); +Matter.Vertices = __webpack_require__(31); + +// aliases + +Matter.World.add = Matter.Composite.add; +Matter.World.remove = Matter.Composite.remove; +Matter.World.addComposite = Matter.Composite.addComposite; +Matter.World.addBody = Matter.Composite.addBody; +Matter.World.addConstraint = Matter.Composite.addConstraint; +Matter.World.clear = Matter.Composite.clear; + +module.exports = Matter; + + +/***/ }), +/* 161 */ +/***/ (function(module, exports, __webpack_require__) { + +/** +* The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem. +* +* @class SAT +*/ + +// TODO: true circles and curves + +var SAT = {}; + +module.exports = SAT; + +var Vertices = __webpack_require__(31); +var Vector = __webpack_require__(36); + +(function() { + + /** + * Detect collision between two bodies using the Separating Axis Theorem. + * @method collides + * @param {body} bodyA + * @param {body} bodyB + * @param {collision} previousCollision + * @return {collision} collision + */ + SAT.collides = function(bodyA, bodyB, previousCollision) { + var overlapAB, + overlapBA, + minOverlap, + collision, + canReusePrevCol = false; + + if (previousCollision) { + // estimate total motion + var parentA = bodyA.parent, + parentB = bodyB.parent, + motion = parentA.speed * parentA.speed + parentA.angularSpeed * parentA.angularSpeed + + parentB.speed * parentB.speed + parentB.angularSpeed * parentB.angularSpeed; + + // we may be able to (partially) reuse collision result + // but only safe if collision was resting + canReusePrevCol = previousCollision && previousCollision.collided && motion < 0.2; + + // reuse collision object + collision = previousCollision; + } else { + collision = { collided: false, bodyA: bodyA, bodyB: bodyB }; + } + + if (previousCollision && canReusePrevCol) { + // if we can reuse the collision result + // we only need to test the previously found axis + var axisBodyA = collision.axisBody, + axisBodyB = axisBodyA === bodyA ? bodyB : bodyA, + axes = [axisBodyA.axes[previousCollision.axisNumber]]; + + minOverlap = SAT._overlapAxes(axisBodyA.vertices, axisBodyB.vertices, axes); + collision.reused = true; + + if (minOverlap.overlap <= 0) { + collision.collided = false; + return collision; + } + } else { + // if we can't reuse a result, perform a full SAT test + + overlapAB = SAT._overlapAxes(bodyA.vertices, bodyB.vertices, bodyA.axes); + + if (overlapAB.overlap <= 0) { + collision.collided = false; + return collision; + } + + overlapBA = SAT._overlapAxes(bodyB.vertices, bodyA.vertices, bodyB.axes); + + if (overlapBA.overlap <= 0) { + collision.collided = false; + return collision; + } + + if (overlapAB.overlap < overlapBA.overlap) { + minOverlap = overlapAB; + collision.axisBody = bodyA; + } else { + minOverlap = overlapBA; + collision.axisBody = bodyB; + } + + // important for reuse later + collision.axisNumber = minOverlap.axisNumber; + } + + collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB; + collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA; + collision.collided = true; + collision.depth = minOverlap.overlap; + collision.parentA = collision.bodyA.parent; + collision.parentB = collision.bodyB.parent; + + bodyA = collision.bodyA; + bodyB = collision.bodyB; + + // ensure normal is facing away from bodyA + if (Vector.dot(minOverlap.axis, Vector.sub(bodyB.position, bodyA.position)) < 0) { + collision.normal = { + x: minOverlap.axis.x, + y: minOverlap.axis.y + }; + } else { + collision.normal = { + x: -minOverlap.axis.x, + y: -minOverlap.axis.y + }; + } + + collision.tangent = Vector.perp(collision.normal); + + collision.penetration = collision.penetration || {}; + collision.penetration.x = collision.normal.x * collision.depth; + collision.penetration.y = collision.normal.y * collision.depth; + + // find support points, there is always either exactly one or two + var verticesB = SAT._findSupports(bodyA, bodyB, collision.normal), + supports = []; + + // find the supports from bodyB that are inside bodyA + if (Vertices.contains(bodyA.vertices, verticesB[0])) + supports.push(verticesB[0]); + + if (Vertices.contains(bodyA.vertices, verticesB[1])) + supports.push(verticesB[1]); + + // find the supports from bodyA that are inside bodyB + if (supports.length < 2) { + var verticesA = SAT._findSupports(bodyB, bodyA, Vector.neg(collision.normal)); + + if (Vertices.contains(bodyB.vertices, verticesA[0])) + supports.push(verticesA[0]); + + if (supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1])) + supports.push(verticesA[1]); + } + + // account for the edge case of overlapping but no vertex containment + if (supports.length < 1) + supports = [verticesB[0]]; + + collision.supports = supports; + + return collision; + }; + + /** + * Find the overlap between two sets of vertices. + * @method _overlapAxes + * @private + * @param {} verticesA + * @param {} verticesB + * @param {} axes + * @return result + */ + SAT._overlapAxes = function(verticesA, verticesB, axes) { + var projectionA = Vector._temp[0], + projectionB = Vector._temp[1], + result = { overlap: Number.MAX_VALUE }, + overlap, + axis; + + for (var i = 0; i < axes.length; i++) { + axis = axes[i]; + + SAT._projectToAxis(projectionA, verticesA, axis); + SAT._projectToAxis(projectionB, verticesB, axis); + + overlap = Math.min(projectionA.max - projectionB.min, projectionB.max - projectionA.min); + + if (overlap <= 0) { + result.overlap = overlap; + return result; + } + + if (overlap < result.overlap) { + result.overlap = overlap; + result.axis = axis; + result.axisNumber = i; + } + } + + return result; + }; + + /** + * Projects vertices on an axis and returns an interval. + * @method _projectToAxis + * @private + * @param {} projection + * @param {} vertices + * @param {} axis + */ + SAT._projectToAxis = function(projection, vertices, axis) { + var min = Vector.dot(vertices[0], axis), + max = min; + + for (var i = 1; i < vertices.length; i += 1) { + var dot = Vector.dot(vertices[i], axis); + + if (dot > max) { + max = dot; + } else if (dot < min) { + min = dot; + } + } + + projection.min = min; + projection.max = max; + }; + + /** + * Finds supporting vertices given two bodies along a given direction using hill-climbing. + * @method _findSupports + * @private + * @param {} bodyA + * @param {} bodyB + * @param {} normal + * @return [vector] + */ + SAT._findSupports = function(bodyA, bodyB, normal) { + var nearestDistance = Number.MAX_VALUE, + vertexToBody = Vector._temp[0], + vertices = bodyB.vertices, + bodyAPosition = bodyA.position, + distance, + vertex, + vertexA, + vertexB; + + // find closest vertex on bodyB + for (var i = 0; i < vertices.length; i++) { + vertex = vertices[i]; + vertexToBody.x = vertex.x - bodyAPosition.x; + vertexToBody.y = vertex.y - bodyAPosition.y; + distance = -Vector.dot(normal, vertexToBody); + + if (distance < nearestDistance) { + nearestDistance = distance; + vertexA = vertex; + } + } + + // find next closest vertex using the two connected to it + var prevIndex = vertexA.index - 1 >= 0 ? vertexA.index - 1 : vertices.length - 1; + vertex = vertices[prevIndex]; + vertexToBody.x = vertex.x - bodyAPosition.x; + vertexToBody.y = vertex.y - bodyAPosition.y; + nearestDistance = -Vector.dot(normal, vertexToBody); + vertexB = vertex; + + var nextIndex = (vertexA.index + 1) % vertices.length; + vertex = vertices[nextIndex]; + vertexToBody.x = vertex.x - bodyAPosition.x; + vertexToBody.y = vertex.y - bodyAPosition.y; + distance = -Vector.dot(normal, vertexToBody); + if (distance < nearestDistance) { + vertexB = vertex; + } + + return [vertexA, vertexB]; + }; + +})(); + + +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { + +/** +* The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. +* +* @class Detector +*/ + +// TODO: speculative contacts + +var Detector = {}; + +module.exports = Detector; + +var SAT = __webpack_require__(161); +var Pair = __webpack_require__(119); +var Bounds = __webpack_require__(35); + +(function() { + + /** + * Finds all collisions given a list of pairs. + * @method collisions + * @param {pair[]} broadphasePairs + * @param {engine} engine + * @return {array} collisions + */ + Detector.collisions = function(broadphasePairs, engine) { + var collisions = [], + pairsTable = engine.pairs.table; + + // @if DEBUG + var metrics = engine.metrics; + // @endif + + for (var i = 0; i < broadphasePairs.length; i++) { + var bodyA = broadphasePairs[i][0], + bodyB = broadphasePairs[i][1]; + + if ((bodyA.isStatic || bodyA.isSleeping) && (bodyB.isStatic || bodyB.isSleeping)) + continue; + + if (!Detector.canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) + continue; + + // @if DEBUG + metrics.midphaseTests += 1; + // @endif + + // mid phase + if (Bounds.overlaps(bodyA.bounds, bodyB.bounds)) { + for (var j = bodyA.parts.length > 1 ? 1 : 0; j < bodyA.parts.length; j++) { + var partA = bodyA.parts[j]; + + for (var k = bodyB.parts.length > 1 ? 1 : 0; k < bodyB.parts.length; k++) { + var partB = bodyB.parts[k]; + + if ((partA === bodyA && partB === bodyB) || Bounds.overlaps(partA.bounds, partB.bounds)) { + // find a previous collision we could reuse + var pairId = Pair.id(partA, partB), + pair = pairsTable[pairId], + previousCollision; + + if (pair && pair.isActive) { + previousCollision = pair.collision; + } else { + previousCollision = null; + } + + // narrow phase + var collision = SAT.collides(partA, partB, previousCollision); + + // @if DEBUG + metrics.narrowphaseTests += 1; + if (collision.reused) + metrics.narrowReuseCount += 1; + // @endif + + if (collision.collided) { + collisions.push(collision); + // @if DEBUG + metrics.narrowDetections += 1; + // @endif + } + } + } + } + } + } + + return collisions; + }; + + /** + * Returns `true` if both supplied collision filters will allow a collision to occur. + * See `body.collisionFilter` for more information. + * @method canCollide + * @param {} filterA + * @param {} filterB + * @return {bool} `true` if collision can occur + */ + Detector.canCollide = function(filterA, filterB) { + if (filterA.group === filterB.group && filterA.group !== 0) + return filterA.group > 0; + + return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0; + }; + +})(); + + +/***/ }), +/* 163 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Bodies = __webpack_require__(59); +var Body = __webpack_require__(27); +var Class = __webpack_require__(0); +var Components = __webpack_require__(120); +var GetFastValue = __webpack_require__(1); +var HasValue = __webpack_require__(82); +var Vertices = __webpack_require__(31); + +/** + * @typedef {object} MatterTileOptions + * + * @property {MatterJS.Body} [body=null] - An existing Matter body to be used instead of creating a new one. + * @property {boolean} [isStatic=true] - Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved. + * @property {boolean} [addToWorld=true] - Whether or not to add the newly created body (or existing body if options.body is used) to the Matter world. + */ + +/** + * @classdesc + * A wrapper around a Tile that provides access to a corresponding Matter body. A tile can only + * have one Matter body associated with it. You can either pass in an existing Matter body for + * the tile or allow the constructor to create the corresponding body for you. If the Tile has a + * collision group (defined in Tiled), those shapes will be used to create the body. If not, the + * tile's rectangle bounding box will be used. + * + * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody. + * + * Note: not all Tiled collision shapes are supported. See + * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information. + * + * @class TileBody + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @extends Phaser.Physics.Matter.Components.Bounce + * @extends Phaser.Physics.Matter.Components.Collision + * @extends Phaser.Physics.Matter.Components.Friction + * @extends Phaser.Physics.Matter.Components.Gravity + * @extends Phaser.Physics.Matter.Components.Mass + * @extends Phaser.Physics.Matter.Components.Sensor + * @extends Phaser.Physics.Matter.Components.Sleep + * @extends Phaser.Physics.Matter.Components.Static + * + * @param {Phaser.Physics.Matter.World} world - [description] + * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. + * @param {MatterTileOptions} [options] - Options to be used when creating the Matter body. + */ +var MatterTileBody = new Class({ + + Mixins: [ + Components.Bounce, + Components.Collision, + Components.Friction, + Components.Gravity, + Components.Mass, + Components.Sensor, + Components.Sleep, + Components.Static + ], + + initialize: + + function MatterTileBody (world, tile, options) + { + /** + * The tile object the body is associated with. + * + * @name Phaser.Physics.Matter.TileBody#tile + * @type {Phaser.Tilemaps.Tile} + * @since 3.0.0 + */ + this.tile = tile; + + /** + * The Matter world the body exists within. + * + * @name Phaser.Physics.Matter.TileBody#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world = world; + + // Install a reference to 'this' on the tile and ensure there can only be one matter body + // associated with the tile + if (tile.physics.matterBody) + { + tile.physics.matterBody.destroy(); + } + + tile.physics.matterBody = this; + + // Set the body either from an existing body (if provided), the shapes in the tileset + // collision layer (if it exists) or a rectangle matching the tile. + var body = GetFastValue(options, 'body', null); + + var addToWorld = GetFastValue(options, 'addToWorld', true); + + if (!body) + { + var collisionGroup = tile.getCollisionGroup(); + var collisionObjects = GetFastValue(collisionGroup, 'objects', []); + + if (collisionObjects.length > 0) + { + this.setFromTileCollision(options); + } + else + { + this.setFromTileRectangle(options); + } + } + else + { + this.setBody(body, addToWorld); + } + }, + + /** + * @typedef {object} MatterBodyTileOptions + * + * @property {boolean} [isStatic=true] - Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved. + * @property {boolean} [addToWorld=true] - Whether or not to add the newly created body (or existing body if options.body is used) to the Matter world. + */ + + /** + * Sets the current body to a rectangle that matches the bounds of the tile. + * + * @method Phaser.Physics.Matter.TileBody#setFromTileRectangle + * @since 3.0.0 + * + * @param {MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + setFromTileRectangle: function (options) + { + if (options === undefined) { options = {}; } + if (!HasValue(options, 'isStatic')) { options.isStatic = true; } + if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } + + var bounds = this.tile.getBounds(); + var cx = bounds.x + (bounds.width / 2); + var cy = bounds.y + (bounds.height / 2); + var body = Bodies.rectangle(cx, cy, bounds.width, bounds.height, options); + + this.setBody(body, options.addToWorld); + + return this; + }, + + /** + * Sets the current body from the collision group associated with the Tile. This is typically + * set up in Tiled's collision editor. + * + * Note: Matter doesn't support all shapes from Tiled. Rectangles and polygons are directly + * supported. Ellipses are converted into circle bodies. Polylines are treated as if they are + * closed polygons. If a tile has multiple shapes, a multi-part body will be created. Concave + * shapes are supported if poly-decomp library is included. Decomposition is not guaranteed to + * work for complex shapes (e.g. holes), so it's often best to manually decompose a concave + * polygon into multiple convex polygons yourself. + * + * @method Phaser.Physics.Matter.TileBody#setFromTileCollision + * @since 3.0.0 + * + * @param {MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + setFromTileCollision: function (options) + { + if (options === undefined) { options = {}; } + if (!HasValue(options, 'isStatic')) { options.isStatic = true; } + if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } + + var sx = this.tile.tilemapLayer.scaleX; + var sy = this.tile.tilemapLayer.scaleY; + var tileX = this.tile.getLeft(); + var tileY = this.tile.getTop(); + var collisionGroup = this.tile.getCollisionGroup(); + var collisionObjects = GetFastValue(collisionGroup, 'objects', []); + + var parts = []; + + for (var i = 0; i < collisionObjects.length; i++) + { + var object = collisionObjects[i]; + var ox = tileX + (object.x * sx); + var oy = tileY + (object.y * sy); + var ow = object.width * sx; + var oh = object.height * sy; + var body = null; + + if (object.rectangle) + { + body = Bodies.rectangle(ox + ow / 2, oy + oh / 2, ow, oh, options); + } + else if (object.ellipse) + { + body = Bodies.circle(ox + ow / 2, oy + oh / 2, ow / 2, options); + } + else if (object.polygon || object.polyline) + { + // Polygons and polylines are both treated as closed polygons + var originalPoints = object.polygon ? object.polygon : object.polyline; + + var points = originalPoints.map(function (p) + { + return { x: p.x * sx, y: p.y * sy }; + }); + + var vertices = Vertices.create(points); + + // Points are relative to the object's origin (first point placed in Tiled), but + // matter expects points to be relative to the center of mass. This only applies to + // convex shapes. When a concave shape is decomposed, multiple parts are created and + // the individual parts are positioned relative to (ox, oy). + // + // Update: 8th January 2019 - the latest version of Matter needs the Vertices adjusted, + // regardless if convex or concave. + + var center = Vertices.centre(vertices); + + ox += center.x; + oy += center.y; + + body = Bodies.fromVertices(ox, oy, vertices, options); + } + + if (body) + { + parts.push(body); + } + } + + if (parts.length === 1) + { + this.setBody(parts[0], options.addToWorld); + } + else if (parts.length > 1) + { + options.parts = parts; + this.setBody(Body.create(options), options.addToWorld); + } + + return this; + }, + + /** + * Sets the current body to the given body. This will remove the previous body, if one already + * exists. + * + * @method Phaser.Physics.Matter.TileBody#setBody + * @since 3.0.0 + * + * @param {MatterJS.Body} body - The new Matter body to use. + * @param {boolean} [addToWorld=true] - Whether or not to add the body to the Matter world. + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + setBody: function (body, addToWorld) + { + if (addToWorld === undefined) { addToWorld = true; } + + if (this.body) + { + this.removeBody(); + } + + this.body = body; + this.body.gameObject = this; + + if (addToWorld) + { + this.world.add(this.body); + } + + return this; + }, + + /** + * Removes the current body from the TileBody and from the Matter world + * + * @method Phaser.Physics.Matter.TileBody#removeBody + * @since 3.0.0 + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + removeBody: function () + { + if (this.body) + { + this.world.remove(this.body); + this.body.gameObject = undefined; + this.body = undefined; + } + + return this; + }, + + /** + * Removes the current body from the tile and the world. + * + * @method Phaser.Physics.Matter.TileBody#destroy + * @since 3.0.0 + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + destroy: function () + { + this.removeBody(); + this.tile.physics.matterBody = undefined; + } + +}); + +module.exports = MatterTileBody; + + +/***/ }), +/* 164 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Events + */ + +module.exports = { + + AFTER_UPDATE: __webpack_require__(593), + BEFORE_UPDATE: __webpack_require__(592), + COLLISION_ACTIVE: __webpack_require__(591), + COLLISION_END: __webpack_require__(590), + COLLISION_START: __webpack_require__(589), + DRAG_END: __webpack_require__(588), + DRAG: __webpack_require__(587), + DRAG_START: __webpack_require__(586), + PAUSE: __webpack_require__(585), + RESUME: __webpack_require__(584), + SLEEP_END: __webpack_require__(583), + SLEEP_START: __webpack_require__(582) + +}; + + +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { + +/** +* The `Matter.Axes` module contains methods for creating and manipulating sets of axes. +* +* @class Axes +*/ + +var Axes = {}; + +module.exports = Axes; + +var Vector = __webpack_require__(36); +var Common = __webpack_require__(12); + +(function() { + + /** + * Creates a new set of axes from the given vertices. + * @method fromVertices + * @param {vertices} vertices + * @return {axes} A new axes from the given vertices + */ + Axes.fromVertices = function(vertices) { + var axes = {}; + + // find the unique axes, using edge normal gradients + for (var i = 0; i < vertices.length; i++) { + var j = (i + 1) % vertices.length, + normal = Vector.normalise({ + x: vertices[j].y - vertices[i].y, + y: vertices[i].x - vertices[j].x + }), + gradient = (normal.y === 0) ? Infinity : (normal.x / normal.y); + + // limit precision + gradient = gradient.toFixed(3).toString(); + axes[gradient] = normal; + } + + return Common.values(axes); + }; + + /** + * Rotates a set of axes by the given angle. + * @method rotate + * @param {axes} axes + * @param {number} angle + */ + Axes.rotate = function(axes, angle) { + if (angle === 0) + return; + + var cos = Math.cos(angle), + sin = Math.sin(angle); + + for (var i = 0; i < axes.length; i++) { + var axis = axes[i], + xx; + xx = axis.x * cos - axis.y * sin; + axis.y = axis.x * sin + axis.y * cos; + axis.x = xx; + } + }; + +})(); + + +/***/ }), +/* 166 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Impact.Components + */ + +module.exports = { + + Acceleration: __webpack_require__(622), + BodyScale: __webpack_require__(621), + BodyType: __webpack_require__(620), + Bounce: __webpack_require__(619), + CheckAgainst: __webpack_require__(618), + Collides: __webpack_require__(617), + Debug: __webpack_require__(616), + Friction: __webpack_require__(615), + Gravity: __webpack_require__(614), + Offset: __webpack_require__(613), + SetGameObject: __webpack_require__(612), + Velocity: __webpack_require__(611) + +}; + + +/***/ }), +/* 167 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Impact.Events + */ + +module.exports = { + + COLLIDE: __webpack_require__(626), + PAUSE: __webpack_require__(625), + RESUME: __webpack_require__(624) + +}; + + +/***/ }), +/* 168 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(19); +var File = __webpack_require__(23); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(1); +var IsPlainObject = __webpack_require__(8); +var ParseXML = __webpack_require__(375); + +/** + * @typedef {object} Phaser.Loader.FileTypes.XMLFileConfig + * + * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. + * @property {string} [url] - The absolute or relative URL to load the file from. + * @property {string} [extension='xml'] - The default file extension to use if no url is provided. + * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ + +/** + * @classdesc + * A single XML File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml. + * + * @class XMLFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var XMLFile = new Class({ + + Extends: File, + + initialize: + + function XMLFile (loader, key, url, xhrSettings) + { + var extension = 'xml'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'xml', + cache: loader.cacheManager.xml, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.XMLFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = ParseXML(this.xhrLoader.responseText); + + if (this.data) + { + this.onProcessComplete(); + } + else + { + console.warn('Invalid XMLFile: ' + this.key); + + this.onProcessError(); + } + } + +}); + +/** + * Adds an XML file, or array of XML files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.xml('wavedata', 'files/AlienWaveData.xml'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global XML Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the XML Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the XML Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.xml({ + * key: 'wavedata', + * url: 'files/AlienWaveData.xml' + * }); + * ``` + * + * See the documentation for `Phaser.Loader.FileTypes.XMLFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.xml('wavedata', 'files/AlienWaveData.xml'); + * // and later in your game ... + * var data = this.cache.xml.get('wavedata'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the XML Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#xml + * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @since 3.0.0 + * + * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig|Phaser.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {Phaser.Loader.LoaderPlugin} The Loader instance. + */ +FileTypesManager.register('xml', 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 XMLFile(this, key[i])); + } + } + else + { + this.addFile(new XMLFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = XMLFile; + + +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Extend = __webpack_require__(21); +var XHRSettings = __webpack_require__(122); + +/** + * Takes two XHRSettings Objects and creates a new XHRSettings object from them. + * + * The new object is seeded by the values given in the global settings, but any setting in + * the local object overrides the global ones. + * + * @function Phaser.Loader.MergeXHRSettings + * @since 3.0.0 + * + * @param {XHRSettingsObject} global - The global XHRSettings object. + * @param {XHRSettingsObject} local - The local XHRSettings object. + * + * @return {XHRSettingsObject} A newly formed XHRSettings object. + */ +var MergeXHRSettings = function (global, local) +{ + var output = (global === undefined) ? XHRSettings() : Extend({}, global); + + if (local) + { + for (var setting in local) + { + if (local[setting] !== undefined) + { + output[setting] = local[setting]; + } + } + } + + return output; +}; + +module.exports = MergeXHRSettings; + + +/***/ }), +/* 170 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Given a File and a baseURL value this returns the URL the File will use to download from. + * + * @function Phaser.Loader.GetURL + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - The File object. + * @param {string} baseURL - A default base URL. + * + * @return {string} The URL the File will use. + */ +var GetURL = function (file, baseURL) +{ + if (!file.url) + { + return false; + } + + if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) + { + return file.url; + } + else + { + return baseURL + file.url; + } +}; + +module.exports = GetURL; + + +/***/ }), +/* 171 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Gamepad.Events + */ + +module.exports = { + + BUTTON_DOWN: __webpack_require__(715), + BUTTON_UP: __webpack_require__(714), + CONNECTED: __webpack_require__(713), + DISCONNECTED: __webpack_require__(712), + GAMEPAD_BUTTON_DOWN: __webpack_require__(711), + GAMEPAD_BUTTON_UP: __webpack_require__(710) + +}; + + +/***/ }), +/* 172 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Rotates an entire Triangle at a given angle about a specific point. * * @function Phaser.Geom.Triangle.RotateAroundXY * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} x - The X coordinate of the point to rotate the Triangle about. + * @param {number} y - The Y coordinate of the point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var RotateAroundXY = function (triangle, x, y, angle) { @@ -34469,24 +34578,24 @@ module.exports = RotateAroundXY; /***/ }), -/* 161 */ +/* 173 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the width/height ratio of a rectangle. * * @function Phaser.Geom.Rectangle.GetAspectRatio * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle. * - * @return {number} [description] + * @return {number} The width/height ratio of the rectangle. */ var GetAspectRatio = function (rect) { @@ -34497,12 +34606,12 @@ module.exports = GetAspectRatio; /***/ }), -/* 162 */ +/* 174 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -34545,12 +34654,12 @@ module.exports = RotateAroundXY; /***/ }), -/* 163 */ +/* 175 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -34632,25 +34741,27 @@ module.exports = ContainsArray; /***/ }), -/* 164 */ +/* 176 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if two Rectangles intersect. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle. * * @function Phaser.Geom.Intersects.RectangleToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. */ var RectangleToRectangle = function (rectA, rectB) { @@ -34666,17 +34777,17 @@ module.exports = RectangleToRectangle; /***/ }), -/* 165 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Mesh = __webpack_require__(118); +var Mesh = __webpack_require__(126); /** * @classdesc @@ -35327,12 +35438,12 @@ module.exports = Quad; /***/ }), -/* 166 */ +/* 178 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -35376,29 +35487,41 @@ module.exports = Contains; /***/ }), -/* 167 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(166); -var GetPoints = __webpack_require__(312); +var Contains = __webpack_require__(178); +var GetPoints = __webpack_require__(319); /** * @classdesc - * [description] + * A Polygon object + * + + * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. + * Several formats are supported to define the list of points, check the setTo method for details. + * This is a geometry object allowing you to define and inspect the shape. + * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. + * To render a Polygon you should look at the capabilities of the Graphics class. * * @class Polygon * @memberof Phaser.Geom * @constructor * @since 3.0.0 * - * @param {Phaser.Geom.Point[]} [points] - [description] + * @param {Phaser.Geom.Point[]} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: + * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` + * - An array of objects with public x y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` */ var Polygon = new Class({ @@ -35463,7 +35586,7 @@ var Polygon = new Class({ * @method Phaser.Geom.Polygon#setTo * @since 3.0.0 * - * @param {array} points - [description] + * @param {array} points - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. * * @return {Phaser.Geom.Polygon} This Polygon object. */ @@ -35585,23 +35708,23 @@ module.exports = Polygon; /***/ }), -/* 168 */ +/* 180 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(26); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var CONST = __webpack_require__(28); -var GameObject = __webpack_require__(17); -var GetPowerOfTwo = __webpack_require__(322); -var Smoothing = __webpack_require__(130); -var TileSpriteRender = __webpack_require__(872); +var Components = __webpack_require__(14); +var CONST = __webpack_require__(30); +var GameObject = __webpack_require__(18); +var GetPowerOfTwo = __webpack_require__(414); +var Smoothing = __webpack_require__(140); +var TileSpriteRender = __webpack_require__(910); var Vector2 = __webpack_require__(3); // bitmask flag for GameObject.renderMask @@ -35614,8 +35737,8 @@ var _FLAG = 8; // 1000 * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and * are designed so that you can create game backdrops using seamless textures as a source. * - * You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background - * that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition` + * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background + * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. @@ -35966,22 +36089,18 @@ var TileSprite = new Class({ * @method Phaser.GameObjects.TileSprite#setTileScale * @since 3.12.0 * - * @param {number} [x] - The horizontal scale of the tiling texture. - * @param {number} [y] - The vertical scale of the tiling texture. + * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value. + * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value. * * @return {this} This Tile Sprite instance. */ setTileScale: function (x, y) { - if (x !== undefined) - { - this.tileScaleX = x; - } + if (x === undefined) { x = this.tileScaleX; } + if (y === undefined) { y = x; } - if (y !== undefined) - { - this.tileScaleY = y; - } + this.tileScaleX = x; + this.tileScaleY = y; return this; }, @@ -35995,7 +36114,7 @@ var TileSprite = new Class({ */ updateTileTexture: function () { - if (!this.dirty) + if (!this.dirty || !this.renderer) { return; } @@ -36060,6 +36179,9 @@ var TileSprite = new Class({ canvas.height = this.height; this.frame.setSize(this.width, this.height); + this.updateDisplayOrigin(); + + this.dirty = true; } if (!this.dirty || this.renderer && this.renderer.gl) @@ -36225,26 +36347,26 @@ module.exports = TileSprite; /***/ }), -/* 169 */ +/* 181 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(187); +var AddToDOM = __webpack_require__(197); var CanvasPool = __webpack_require__(26); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var CONST = __webpack_require__(28); -var GameObject = __webpack_require__(17); -var GetTextSize = __webpack_require__(878); +var Components = __webpack_require__(14); +var CONST = __webpack_require__(30); +var GameObject = __webpack_require__(18); +var GetTextSize = __webpack_require__(916); var GetValue = __webpack_require__(4); -var RemoveFromDOM = __webpack_require__(378); -var TextRender = __webpack_require__(877); -var TextStyle = __webpack_require__(874); +var RemoveFromDOM = __webpack_require__(374); +var TextRender = __webpack_require__(915); +var TextStyle = __webpack_require__(912); /** * @classdesc @@ -36257,6 +36379,21 @@ var TextStyle = __webpack_require__(874); * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes, either + * when creating the Text object, or when setting the font via `setFont` or `setFontFamily`. I.e.: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: '"Roboto Condensed"' }); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: 'Verdana, "Times New Roman", Tahoma, serif' }); + * ``` * * You can only display fonts that are currently loaded and available to the browser: therefore fonts must * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, @@ -36368,7 +36505,7 @@ var Text = new Class({ * Manages the style of this Text object. * * @name Phaser.GameObjects.Text#style - * @type {Phaser.GameObjects.Text.TextStyle} + * @type {Phaser.GameObjects.TextStyle} * @since 3.0.0 */ this.style = new TextStyle(this, style); @@ -36859,6 +36996,20 @@ var Text = new Class({ * * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFont * @since 3.0.0 @@ -36874,6 +37025,20 @@ var Text = new Class({ /** * Set the font family. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFontFamily * @since 3.0.0 @@ -36951,18 +37116,23 @@ var Text = new Class({ }, /** - * Set the text fill color. + * Set the fill style to be used by the Text object. + * + * This can be any valid CanvasRenderingContext2D fillStyle value, such as + * a color (in hex, rgb, rgba, hsl or named values), a gradient or a pattern. + * + * See the [MDN fillStyle docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) for more details. * * @method Phaser.GameObjects.Text#setFill * @since 3.0.0 * - * @param {string} color - The text fill color. + * @param {(string|any)} color - The text fill style. Can be any valid CanvasRenderingContext `fillStyle` value. * * @return {Phaser.GameObjects.Text} This Text object. */ - setFill: function (color) + setFill: function (fillStyle) { - return this.style.setFill(color); + return this.style.setFill(fillStyle); }, /** @@ -37506,24 +37676,26 @@ module.exports = Text; /***/ }), -/* 170 */ +/* 182 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(131); +var BlendModes = __webpack_require__(66); +var Camera = __webpack_require__(141); var CanvasPool = __webpack_require__(26); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var CONST = __webpack_require__(28); -var Frame = __webpack_require__(123); -var GameObject = __webpack_require__(17); -var Render = __webpack_require__(884); -var UUID = __webpack_require__(323); +var Components = __webpack_require__(14); +var CONST = __webpack_require__(30); +var Frame = __webpack_require__(131); +var GameObject = __webpack_require__(18); +var Render = __webpack_require__(922); +var Utils = __webpack_require__(10); +var UUID = __webpack_require__(329); /** * @classdesc @@ -37532,6 +37704,11 @@ var UUID = __webpack_require__(323); * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads. + * + * Note that under WebGL a FrameBuffer, which is what the Render Texture uses internally, cannot be anti-aliased. This means + * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this + * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that + * to the Render Texture. * * @class RenderTexture * @extends Phaser.GameObjects.GameObject @@ -37633,8 +37810,7 @@ var RenderTexture = new Class({ this.globalAlpha = 1; /** - * The HTML Canvas Element that the Render Texture is drawing to. - * This is only populated if Phaser is running with the Canvas Renderer. + * The HTML Canvas Element that the Render Texture is drawing to when using the Canvas Renderer. * * @name Phaser.GameObjects.RenderTexture#canvas * @type {HTMLCanvasElement} @@ -37699,6 +37875,16 @@ var RenderTexture = new Class({ */ this._saved = false; + /** + * Internal erase mode flag. + * + * @name Phaser.GameObjects.RenderTexture#_eraseMode + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._eraseMode = false; + /** * An internal Camera that can be used to move around the Render Texture. * Control it just like you would any Scene Camera. The difference is that it only impacts the placement of what @@ -37755,7 +37941,7 @@ var RenderTexture = new Class({ /** * Sets the size of this Game Object. * - * @method Phaser.GameObjects.Components.Size#setSize + * @method Phaser.GameObjects.RenderTexture#setSize * @since 3.0.0 * * @param {number} width - The width of this Game Object. @@ -37910,25 +38096,31 @@ var RenderTexture = new Class({ { if (alpha === undefined) { alpha = 1; } - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; + var r = ((rgb >> 16) | 0) & 0xff; + var g = ((rgb >> 8) | 0) & 0xff; + var b = (rgb | 0) & 0xff; - if (this.gl) + var gl = this.gl; + + if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var renderer = this.renderer; - var gl = this.gl; - - gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, alpha); - - gl.clear(gl.COLOR_BUFFER_BIT); - - this.renderer.setFramebuffer(null); + var bounds = this.getBounds(); + + renderer.setFramebuffer(this.framebuffer, true); + + this.pipeline.drawFillRect( + bounds.x, bounds.y, bounds.right, bounds.bottom, + Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1), + alpha + ); + + renderer.setFramebuffer(null, true); } else { - this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')'; + this.context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'; this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); } @@ -37947,17 +38139,18 @@ var RenderTexture = new Class({ { if (this.dirty) { - if (this.gl) - { - this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + + if (gl) + { + var renderer = this.renderer; + + renderer.setFramebuffer(this.framebuffer, true); - var gl = this.gl; - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - this.renderer.setFramebuffer(null); + + renderer.setFramebuffer(null, true); } else { @@ -37975,6 +38168,70 @@ var RenderTexture = new Class({ return this; }, + /** + * Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE. + * This has the effect of erasing any filled pixels in the objects from this Render Texture. + * + * It can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Dynamic and Static Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. + * * Another Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up a texture from the Texture Manager. + * + * Note: You cannot erase a Render Texture from itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * @method Phaser.GameObjects.RenderTexture#erase + * @since 3.16.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. + * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object. + * + * @return {this} This Render Texture instance. + */ + erase: function (entries, x, y) + { + this._eraseMode = true; + + var blendMode = this.renderer.currentBlendMode; + + this.renderer.setBlendMode(BlendModes.ERASE); + + this.draw(entries, x, y, 1, 16777215); + + this.renderer.setBlendMode(blendMode); + + this._eraseMode = false; + + return this; + }, + /** * Draws the given object, or an array of objects, to this Render Texture. * @@ -38047,11 +38304,18 @@ var RenderTexture = new Class({ var gl = this.gl; - this.camera.preRender(1, 1, 1); + this.camera.preRender(1, 1); if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var cx = this.camera._cx; + var cy = this.camera._cy; + var cw = this.camera._cw; + var ch = this.camera._ch; + + this.renderer.setFramebuffer(this.framebuffer, false); + + this.renderer.pushScissor(cx, cy, cw, ch, ch); var pipeline = this.pipeline; @@ -38061,7 +38325,9 @@ var RenderTexture = new Class({ pipeline.flush(); - this.renderer.setFramebuffer(null); + this.renderer.setFramebuffer(null, false); + + this.renderer.popScissor(); pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); } @@ -38129,11 +38395,18 @@ var RenderTexture = new Class({ if (textureFrame) { - this.camera.preRender(1, 1, 1); + this.camera.preRender(1, 1); if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var cx = this.camera._cx; + var cy = this.camera._cy; + var cw = this.camera._cw; + var ch = this.camera._ch; + + this.renderer.setFramebuffer(this.framebuffer, false); + + this.renderer.pushScissor(cx, cy, cw, ch, ch); var pipeline = this.pipeline; @@ -38143,8 +38416,10 @@ var RenderTexture = new Class({ pipeline.flush(); - this.renderer.setFramebuffer(null); - + this.renderer.setFramebuffer(null, false); + + this.renderer.popScissor(); + pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); } else @@ -38259,7 +38534,10 @@ var RenderTexture = new Class({ var prevX = gameObject.x; var prevY = gameObject.y; - this.renderer.setBlendMode(gameObject.blendMode); + if (!this._eraseMode) + { + this.renderer.setBlendMode(gameObject.blendMode); + } gameObject.setPosition(x, y); @@ -38287,11 +38565,23 @@ var RenderTexture = new Class({ var prevX = gameObject.x; var prevY = gameObject.y; + if (this._eraseMode) + { + var blendMode = gameObject.blendMode; + + gameObject.blendMode = BlendModes.ERASE; + } + gameObject.setPosition(x, y); gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null); gameObject.setPosition(prevX, prevY); + + if (this._eraseMode) + { + gameObject.blendMode = blendMode; + } }, /** @@ -38376,6 +38666,12 @@ var RenderTexture = new Class({ } this.texture.destroy(); + this.camera.destroy(); + + this.canvas = null; + this.context = null; + this.framebuffer = null; + this.texture = null; } } @@ -38385,22 +38681,22 @@ module.exports = RenderTexture; /***/ }), -/* 171 */ +/* 183 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var GameObject = __webpack_require__(17); -var GravityWell = __webpack_require__(332); -var List = __webpack_require__(122); -var ParticleEmitter = __webpack_require__(330); -var Render = __webpack_require__(888); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var GravityWell = __webpack_require__(337); +var List = __webpack_require__(130); +var ParticleEmitter = __webpack_require__(335); +var Render = __webpack_require__(926); /** * @classdesc @@ -38857,12 +39153,12 @@ module.exports = ParticleEmitterManager; /***/ }), -/* 172 */ +/* 184 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -38899,19 +39195,15 @@ module.exports = CircumferencePoint; /***/ }), -/* 173 */ +/* 185 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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, @@ -38942,33 +39234,33 @@ module.exports = { /***/ }), -/* 174 */ +/* 186 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(131); +var BaseCamera = __webpack_require__(141); var Class = __webpack_require__(0); -var Commands = __webpack_require__(173); -var ComponentsAlpha = __webpack_require__(438); -var ComponentsBlendMode = __webpack_require__(436); -var ComponentsDepth = __webpack_require__(435); -var ComponentsMask = __webpack_require__(431); -var ComponentsPipeline = __webpack_require__(133); -var ComponentsTransform = __webpack_require__(426); -var ComponentsVisible = __webpack_require__(425); -var ComponentsScrollFactor = __webpack_require__(428); +var Commands = __webpack_require__(185); +var ComponentsAlpha = __webpack_require__(474); +var ComponentsBlendMode = __webpack_require__(470); +var ComponentsDepth = __webpack_require__(469); +var ComponentsMask = __webpack_require__(465); +var ComponentsPipeline = __webpack_require__(144); +var ComponentsTransform = __webpack_require__(460); +var ComponentsVisible = __webpack_require__(459); +var ComponentsScrollFactor = __webpack_require__(462); -var Ellipse = __webpack_require__(99); -var GameObject = __webpack_require__(17); +var Ellipse = __webpack_require__(105); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(1); var GetValue = __webpack_require__(4); -var MATH_CONST = __webpack_require__(18); -var Render = __webpack_require__(898); +var MATH_CONST = __webpack_require__(20); +var Render = __webpack_require__(936); /** * Graphics line style (or stroke style) settings. @@ -39453,6 +39745,26 @@ var Graphics = new Class({ return this; }, + /** + * Fill the current path. + * + * This is an alias for `Graphics.fillPath` and does the same thing. + * It was added to match the CanvasRenderingContext 2D API. + * + * @method Phaser.GameObjects.Graphics#fill + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Graphics} This Game Object. + */ + fill: function () + { + this.commandBuffer.push( + Commands.FILL_PATH + ); + + return this; + }, + /** * Stroke the current path. * @@ -39470,6 +39782,26 @@ var Graphics = new Class({ return this; }, + /** + * Stroke the current path. + * + * This is an alias for `Graphics.strokePath` and does the same thing. + * It was added to match the CanvasRenderingContext 2D API. + * + * @method Phaser.GameObjects.Graphics#stroke + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Graphics} This Game Object. + */ + stroke: function () + { + this.commandBuffer.push( + Commands.STROKE_PATH + ); + + return this; + }, + /** * Fill the given circle. * @@ -39637,6 +39969,15 @@ var Graphics = new Class({ return this; }, + /** + * @typedef {object} RoundedRectRadius + * + * @property {number} [tl=20] - Top left + * @property {number} [tr=20] - Top right + * @property {number} [br=20] - Bottom right + * @property {number} [bl=20] - Bottom left + */ + /** * Fill a rounded rectangle with the given position, size and radius. * @@ -39647,11 +39988,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -39697,11 +40034,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -39952,15 +40285,15 @@ var Graphics = new Class({ }, /** - * [description] + * Draw a line from the current drawing position to the given position with a specific width and color. * * @method Phaser.GameObjects.Graphics#lineFxTo * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} rgb - [description] + * @param {number} x - The x coordinate to draw the line to. + * @param {number} y - The y coordinate to draw the line to. + * @param {number} width - The width of the stroke. + * @param {number} rgb - The color of the stroke. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -39975,15 +40308,15 @@ var Graphics = new Class({ }, /** - * [description] + * Move the current drawing position to the given position and change the pen width and color. * * @method Phaser.GameObjects.Graphics#moveFxTo * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} rgb - [description] + * @param {number} x - The x coordinate to move to. + * @param {number} y - The y coordinate to move to. + * @param {number} width - The new stroke width. + * @param {number} rgb - The new stroke color. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -40393,8 +40726,8 @@ var Graphics = new Class({ var sys = this.scene.sys; var renderer = sys.game.renderer; - if (width === undefined) { width = sys.game.config.width; } - if (height === undefined) { height = sys.game.config.height; } + if (width === undefined) { width = sys.scale.width; } + if (height === undefined) { height = sys.scale.height; } Graphics.TargetCamera.setScene(this.scene); Graphics.TargetCamera.setViewport(0, 0, width, height); @@ -40476,23 +40809,24 @@ module.exports = Graphics; /***/ }), -/* 175 */ +/* 187 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(119); +var BitmapText = __webpack_require__(127); var Class = __webpack_require__(0); -var Render = __webpack_require__(901); +var Render = __webpack_require__(942); /** * @typedef {object} DisplayCallbackConfig * - * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. + * @property {Phaser.GameObjects.DynamicBitmapText} parent - The Dynamic Bitmap Text object that owns this character being rendered. + * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. Always zero in Canvas. * @property {number} index - The index of the character being rendered. * @property {number} charCode - The character code of the character being rendered. * @property {number} x - The x position of the character being rendered. @@ -40630,6 +40964,7 @@ var DynamicBitmapText = new Class({ * @since 3.11.0 */ this.callbackData = { + parent: this, color: 0, tint: { topLeft: 0, @@ -40729,24 +41064,25 @@ module.exports = DynamicBitmapText; /***/ }), -/* 176 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayUtils = __webpack_require__(180); -var BlendModes = __webpack_require__(72); +var ArrayUtils = __webpack_require__(192); +var BlendModes = __webpack_require__(66); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var GameObject = __webpack_require__(17); -var Rectangle = __webpack_require__(10); -var Render = __webpack_require__(904); -var Union = __webpack_require__(337); +var Components = __webpack_require__(14); +var Events = __webpack_require__(143); +var GameObject = __webpack_require__(18); +var Rectangle = __webpack_require__(11); +var Render = __webpack_require__(945); +var Union = __webpack_require__(343); var Vector2 = __webpack_require__(3); /** @@ -41097,7 +41433,7 @@ var Container = new Class({ */ addHandler: function (gameObject) { - gameObject.once('destroy', this.remove, this); + gameObject.once(Events.DESTROY, this.remove, this); if (this.exclusive) { @@ -41123,7 +41459,7 @@ var Container = new Class({ */ removeHandler: function (gameObject) { - gameObject.off('destroy', this.remove); + gameObject.off(Events.DESTROY, this.remove); if (this.exclusive) { @@ -41258,36 +41594,28 @@ var Container = new Class({ * @since 3.4.0 * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.GameObjects.Container} This Container instance. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - ArrayUtils.StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal sort handler method. - * - * @method Phaser.GameObjects.Container#sortHandler - * @private - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} childA - The first child to sort. - * @param {Phaser.GameObjects.GameObject} childB - The second child to sort. - * - * @return {integer} The sort results. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + ArrayUtils.StableSort.inplace(this.list, handler); + + return this; }, /** @@ -41335,8 +41663,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getFirst * @since 3.4.0 * - * @param {string} [property] - The property to test on each Game Object in the Container. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {string} property - The property to test on each Game Object in the Container. + * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. * @param {integer} [startIndex=0] - An optional start index to search from. * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) * @@ -41344,7 +41672,7 @@ var Container = new Class({ */ getFirst: function (property, value, startIndex, endIndex) { - return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex); + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); }, /** @@ -41966,27 +42294,27 @@ module.exports = Container; /***/ }), -/* 177 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlitterRender = __webpack_require__(908); -var Bob = __webpack_require__(905); +var BlitterRender = __webpack_require__(949); +var Bob = __webpack_require__(946); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var Frame = __webpack_require__(123); -var GameObject = __webpack_require__(17); -var List = __webpack_require__(122); +var Components = __webpack_require__(14); +var Frame = __webpack_require__(131); +var GameObject = __webpack_require__(18); +var List = __webpack_require__(130); /** - * @callback Phaser.GameObjects.Blitter.CreateCallback + * @callback CreateCallback * - * @param {Phaser.GameObjects.Blitter.Bob} bob - The Bob that was created by the Blitter. + * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. * @param {integer} index - The position of the Bob within the Blitter display list. */ @@ -42064,7 +42392,7 @@ var Blitter = new Class({ * This List contains all of the Bob objects created by the Blitter. * * @name Phaser.GameObjects.Blitter#children - * @type {Phaser.Structs.List.} + * @type {Phaser.Structs.List.} * @since 3.0.0 */ this.children = new List(); @@ -42074,7 +42402,7 @@ var Blitter = new Class({ * The array is re-populated whenever the dirty flag is set. * * @name Phaser.GameObjects.Blitter#renderList - * @type {Phaser.GameObjects.Blitter.Bob[]} + * @type {Phaser.GameObjects.Bob[]} * @default [] * @private * @since 3.0.0 @@ -42107,7 +42435,7 @@ var Blitter = new Class({ * @param {boolean} [visible=true] - Should the created Bob render or not? * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. * - * @return {Phaser.GameObjects.Blitter.Bob} The newly created Bob object. + * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ create: function (x, y, frame, visible, index) { @@ -42138,12 +42466,12 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#createFromCallback * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. + * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. * @param {integer} quantity - The quantity of Bob objects to create. * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createFromCallback: function (callback, quantity, frame, visible) { @@ -42174,7 +42502,7 @@ var Blitter = new Class({ * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createMultiple: function (quantity, frame, visible) { @@ -42206,7 +42534,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#childCanRender * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.Bob} child - The Bob to check for rendering. + * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering. * * @return {boolean} Returns `true` if the given child can render, otherwise `false`. */ @@ -42222,7 +42550,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#getRenderList * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that will be rendered this frame. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame. */ getRenderList: function () { @@ -42267,12 +42595,12 @@ module.exports = Blitter; /***/ }), -/* 178 */ +/* 190 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42302,37 +42630,37 @@ module.exports = GetRandom; /***/ }), -/* 179 */ +/* 191 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** -* A Matrix is simply an array of arrays, where each sub-array (the rows) have the same length: -* -* let matrix2 = [ -* [ 1, 1, 1, 1, 1, 1 ], -* [ 2, 0, 0, 0, 0, 4 ], -* [ 2, 0, 1, 2, 0, 4 ], -* [ 2, 0, 3, 4, 0, 4 ], -* [ 2, 0, 0, 0, 0, 4 ], -* [ 3, 3, 3, 3, 3, 3 ] -*]; -*/ - -/** - * [description] + * Checks if an array can be used as a matrix. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` * * @function Phaser.Utils.Array.Matrix.CheckMatrix * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the given `matrix` array is a valid matrix. */ var CheckMatrix = function (matrix) { @@ -42360,12 +42688,12 @@ module.exports = CheckMatrix; /***/ }), -/* 180 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42375,56 +42703,56 @@ module.exports = CheckMatrix; module.exports = { - Matrix: __webpack_require__(941), + Matrix: __webpack_require__(982), - Add: __webpack_require__(934), - AddAt: __webpack_require__(933), - BringToTop: __webpack_require__(932), - CountAllMatching: __webpack_require__(931), - Each: __webpack_require__(930), - EachInRange: __webpack_require__(929), - FindClosestInSorted: __webpack_require__(419), - GetAll: __webpack_require__(928), - GetFirst: __webpack_require__(927), - GetRandom: __webpack_require__(178), - MoveDown: __webpack_require__(926), - MoveTo: __webpack_require__(925), - MoveUp: __webpack_require__(924), - NumberArray: __webpack_require__(923), - NumberArrayStep: __webpack_require__(922), - QuickSelect: __webpack_require__(341), - Range: __webpack_require__(340), - Remove: __webpack_require__(359), - RemoveAt: __webpack_require__(921), - RemoveBetween: __webpack_require__(920), - RemoveRandomElement: __webpack_require__(919), - Replace: __webpack_require__(918), - RotateLeft: __webpack_require__(423), - RotateRight: __webpack_require__(422), - SafeRange: __webpack_require__(68), - SendToBack: __webpack_require__(917), - SetAll: __webpack_require__(916), - Shuffle: __webpack_require__(132), - SpliceOne: __webpack_require__(100), - StableSort: __webpack_require__(120), - Swap: __webpack_require__(915) + Add: __webpack_require__(975), + AddAt: __webpack_require__(974), + BringToTop: __webpack_require__(973), + CountAllMatching: __webpack_require__(972), + Each: __webpack_require__(971), + EachInRange: __webpack_require__(970), + FindClosestInSorted: __webpack_require__(472), + GetAll: __webpack_require__(969), + GetFirst: __webpack_require__(968), + GetRandom: __webpack_require__(190), + MoveDown: __webpack_require__(967), + MoveTo: __webpack_require__(966), + MoveUp: __webpack_require__(965), + NumberArray: __webpack_require__(964), + NumberArrayStep: __webpack_require__(963), + QuickSelect: __webpack_require__(347), + Range: __webpack_require__(346), + Remove: __webpack_require__(195), + RemoveAt: __webpack_require__(962), + RemoveBetween: __webpack_require__(961), + RemoveRandomElement: __webpack_require__(960), + Replace: __webpack_require__(959), + RotateLeft: __webpack_require__(456), + RotateRight: __webpack_require__(455), + SafeRange: __webpack_require__(74), + SendToBack: __webpack_require__(958), + SetAll: __webpack_require__(957), + Shuffle: __webpack_require__(142), + SpliceOne: __webpack_require__(106), + StableSort: __webpack_require__(128), + Swap: __webpack_require__(956) }; /***/ }), -/* 181 */ +/* 193 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(123); -var TextureSource = __webpack_require__(346); +var Frame = __webpack_require__(131); +var TextureSource = __webpack_require__(351); var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; @@ -42447,7 +42775,7 @@ var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; * * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. * @param {string} key - The unique string-based key of this Texture. - * @param {(HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. * @param {number} [width] - The width of the Texture. This is optional and automatically derived from the source images. * @param {number} [height] - The height of the Texture. This is optional and automatically derived from the source images. */ @@ -42803,7 +43131,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#setDataSource * @since 3.0.0 * - * @param {(HTMLImageElement|HTMLCanvasElement)} data - The source image. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} data - The source image. */ setDataSource: function (data) { @@ -42888,22 +43216,23 @@ module.exports = Texture; /***/ }), -/* 182 */ +/* 194 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(126); -var DefaultPlugins = __webpack_require__(185); -var GetPhysicsPlugins = __webpack_require__(962); -var GetScenePlugins = __webpack_require__(961); +var CONST = __webpack_require__(134); +var DefaultPlugins = __webpack_require__(201); +var Events = __webpack_require__(16); +var GetPhysicsPlugins = __webpack_require__(1022); +var GetScenePlugins = __webpack_require__(1021); var NOOP = __webpack_require__(2); -var Settings = __webpack_require__(355); +var Settings = __webpack_require__(360); /** * @classdesc @@ -42951,7 +43280,7 @@ var Systems = new Class({ * The Facebook Instant Games Plugin. * * @name Phaser.Scenes.Systems#facebook - * @type {any} + * @type {Phaser.FacebookInstantGamesPlugin} * @since 3.12.0 */ this.facebook; @@ -43041,6 +43370,17 @@ var Systems = new Class({ */ this.registry; + /** + * A reference to the global Scale Manager. + * + * In the default set-up you can access this from within a Scene via the `this.scale` property. + * + * @name Phaser.Scenes.Systems#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.15.0 + */ + this.scale; + /** * A reference to the global Sound Manager. * @@ -43183,6 +43523,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#init * @protected + * @fires Phaser.Scenes.Events#BOOT * @since 3.0.0 * * @param {Phaser.Game} game - A reference to the Phaser Game instance. @@ -43205,7 +43546,7 @@ var Systems = new Class({ pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]); - this.events.emit('boot', this); + this.events.emit(Events.BOOT, this); this.settings.isBooted = true; }, @@ -43234,6 +43575,9 @@ var Systems = new Class({ * Frame or Set Timeout call to the main Game instance. * * @method Phaser.Scenes.Systems#step + * @fires Phaser.Scenes.Events#PRE_UPDATE + * @fires Phaser.Scenes.Events#_UPDATE + * @fires Phaser.Scenes.Events#POST_UPDATE * @since 3.0.0 * * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). @@ -43241,13 +43585,13 @@ var Systems = new Class({ */ step: function (time, delta) { - this.events.emit('preupdate', time, delta); + this.events.emit(Events.PRE_UPDATE, time, delta); - this.events.emit('update', time, delta); + this.events.emit(Events.UPDATE, time, delta); this.sceneUpdate.call(this.scene, time, delta); - this.events.emit('postupdate', time, delta); + this.events.emit(Events.POST_UPDATE, time, delta); }, /** @@ -43255,6 +43599,7 @@ var Systems = new Class({ * Instructs the Scene to render itself via its Camera Manager to the renderer given. * * @method Phaser.Scenes.Systems#render + * @fires Phaser.Scenes.Events#RENDER * @since 3.0.0 * * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call. @@ -43267,7 +43612,7 @@ var Systems = new Class({ this.cameras.render(renderer, displayList); - this.events.emit('render', renderer); + this.events.emit(Events.RENDER, renderer); }, /** @@ -43297,6 +43642,7 @@ var Systems = new Class({ * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. * * @method Phaser.Scenes.Systems#pause + * @fires Phaser.Scenes.Events#PAUSE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'pause' event. @@ -43311,7 +43657,7 @@ var Systems = new Class({ this.settings.active = false; - this.events.emit('pause', this, data); + this.events.emit(Events.PAUSE, this, data); } return this; @@ -43321,6 +43667,7 @@ var Systems = new Class({ * Resume this Scene from a paused state. * * @method Phaser.Scenes.Systems#resume + * @fires Phaser.Scenes.Events#RESUME * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'resume' event. @@ -43335,7 +43682,7 @@ var Systems = new Class({ this.settings.active = true; - this.events.emit('resume', this, data); + this.events.emit(Events.RESUME, this, data); } return this; @@ -43350,6 +43697,7 @@ var Systems = new Class({ * from other Scenes may still invoke changes within it, so be careful what is left active. * * @method Phaser.Scenes.Systems#sleep + * @fires Phaser.Scenes.Events#SLEEP * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'sleep' event. @@ -43363,7 +43711,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('sleep', this, data); + this.events.emit(Events.SLEEP, this, data); return this; }, @@ -43372,6 +43720,7 @@ var Systems = new Class({ * Wake-up this Scene if it was previously asleep. * * @method Phaser.Scenes.Systems#wake + * @fires Phaser.Scenes.Events#WAKE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'wake' event. @@ -43387,11 +43736,11 @@ var Systems = new Class({ settings.active = true; settings.visible = true; - this.events.emit('wake', this, data); + this.events.emit(Events.WAKE, this, data); if (settings.isTransition) { - this.events.emit('transitionwake', settings.transitionFrom, settings.transitionDuration); + this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); } return this; @@ -43536,6 +43885,8 @@ var Systems = new Class({ * Called automatically by the SceneManager. * * @method Phaser.Scenes.Systems#start + * @fires Phaser.Scenes.Events#START + * @fires Phaser.Scenes.Events#READY * @since 3.0.0 * * @param {object} data - Optional data object that may have been passed to this Scene from another. @@ -43553,25 +43904,10 @@ var Systems = new Class({ this.settings.visible = true; // For plugins to listen out for - this.events.emit('start', this); + this.events.emit(Events.START, this); // For user-land code to listen out for - this.events.emit('ready', this, data); - }, - - /** - * 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); + this.events.emit(Events.READY, this, data); }, /** @@ -43582,23 +43918,24 @@ var Systems = new Class({ * to free-up resources. * * @method Phaser.Scenes.Systems#shutdown + * @fires Phaser.Scenes.Events#SHUTDOWN * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'shutdown' event. */ shutdown: function (data) { - this.events.off('transitioninit'); - this.events.off('transitionstart'); - this.events.off('transitioncomplete'); - this.events.off('transitionout'); + this.events.off(Events.TRANSITION_INIT); + this.events.off(Events.TRANSITION_START); + this.events.off(Events.TRANSITION_COMPLETE); + this.events.off(Events.TRANSITION_OUT); this.settings.status = CONST.SHUTDOWN; this.settings.active = false; this.settings.visible = false; - this.events.emit('shutdown', this, data); + this.events.emit(Events.SHUTDOWN, this, data); }, /** @@ -43608,6 +43945,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#destroy * @private + * @fires Phaser.Scenes.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -43617,7 +43955,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('destroy', this); + this.events.emit(Events.DESTROY, this); this.events.removeAllListeners(); @@ -43635,25 +43973,281 @@ module.exports = Systems; /***/ }), -/* 183 */ +/* 195 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SpliceOne = __webpack_require__(106); + +/** + * Removes the given item, or array of items, from the array. + * + * The array is modified in-place. + * + * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * + * @function Phaser.Utils.Array.Remove + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. + * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + */ +var Remove = function (array, item, callback, context) +{ + if (context === undefined) { context = array; } + + var index; + + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) + { + index = array.indexOf(item); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, item); + } + + return item; + } + else + { + return null; + } + } + + // If we got this far, we have an array of items to remove + + var itemLength = item.length - 1; + + while (itemLength >= 0) + { + var entry = item[itemLength]; + + index = array.indexOf(entry); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, entry); + } + } + else + { + // Item wasn't found in the array, so remove it from our return results + item.pop(); + } + + itemLength--; + } + + return item; +}; + +module.exports = Remove; + + +/***/ }), +/* 196 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = { + + CENTER: __webpack_require__(380), + ORIENTATION: __webpack_require__(379), + SCALE_MODE: __webpack_require__(378), + ZOOM: __webpack_require__(377) + +}; + +module.exports = CONST; + + +/***/ }), +/* 197 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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 it falls back to using `document.body`. + * + * @function Phaser.DOM.AddToDOM + * @since 3.0.0 + * + * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. + * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. + * + * @return {HTMLElement} The element that was added to the DOM. + */ +var AddToDOM = function (element, parent) +{ + var target; + + 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; + } + } + else if (element.parentElement) + { + return element; + } + + // Fallback, covers an invalid ID and a non HTMLElement object + if (!target) + { + target = document.body; + } + + target.appendChild(element); + + return element; +}; + +module.exports = AddToDOM; + + +/***/ }), +/* 198 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Rectangle = __webpack_require__(11); + +// 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 } +// ] + +/** + * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. + * + * @function Phaser.Geom.Rectangle.FromPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. + * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. + */ +var FromPoints = function (points, out) +{ + if (out === undefined) { out = new Rectangle(); } + + if (points.length === 0) + { + return out; + } + + var minX = Number.MAX_VALUE; + var minY = Number.MAX_VALUE; + + var maxX = Number.MIN_SAFE_INTEGER; + var maxY = Number.MIN_SAFE_INTEGER; + + var p; + var px; + var py; + + for (var i = 0; i < points.length; i++) + { + p = points[i]; + + if (Array.isArray(p)) + { + px = p[0]; + py = p[1]; + } + else + { + px = p.x; + py = p.y; + } + + minX = Math.min(minX, px); + minY = Math.min(minY, py); + + maxX = Math.max(maxX, px); + maxY = Math.max(maxY, py); + } + + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; + + return out; +}; + +module.exports = FromPoints; + + +/***/ }), +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(70); +var Earcut = __webpack_require__(77); var GetFastValue = __webpack_require__(1); -var ModelViewProjection = __webpack_require__(966); -var ShaderSourceFS = __webpack_require__(965); -var ShaderSourceVS = __webpack_require__(964); -var TransformMatrix = __webpack_require__(42); -var Utils = __webpack_require__(9); -var WebGLPipeline = __webpack_require__(184); +var ModelViewProjection = __webpack_require__(1128); +var ShaderSourceFS = __webpack_require__(1127); +var ShaderSourceVS = __webpack_require__(1126); +var TransformMatrix = __webpack_require__(46); +var Utils = __webpack_require__(10); +var WebGLPipeline = __webpack_require__(200); /** * @classdesc @@ -43675,7 +44269,7 @@ var WebGLPipeline = __webpack_require__(184); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration options for this Texture Tint Pipeline, as described above. */ var TextureTintPipeline = new Class({ @@ -43918,11 +44512,6 @@ var TextureTintPipeline = new Class({ this.mvpUpdate(); - if (this.batches.length === 0) - { - this.pushBatch(); - } - return this; }, @@ -43948,58 +44537,56 @@ var TextureTintPipeline = new Class({ }, /** - * Assigns a texture to the current batch. If a texture is already set it creates - * a new batch object. + * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. * * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#setTexture2D * @since 3.1.0 * - * @param {WebGLTexture} texture - WebGLTexture that will be assigned to the current batch. - * @param {integer} textureUnit - Texture unit to which the texture needs to be bound. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline} This pipeline instance. */ setTexture2D: function (texture, unit) { - if (!texture) + if (texture === undefined) { texture = this.renderer.blankTexture.glTexture; } + if (unit === undefined) { unit = 0; } + + if (this.requireTextureBatch(texture, unit)) { - texture = this.renderer.blankTexture.glTexture; - unit = 0; - } - - var batches = this.batches; - - if (batches.length === 0) - { - this.pushBatch(); - } - - var batch = batches[batches.length - 1]; - - if (unit > 0) - { - if (batch.textures[unit - 1] && - batch.textures[unit - 1] !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].textures[unit - 1] = texture; - } - else - { - if (batch.texture !== null && - batch.texture !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].texture = texture; + this.pushBatch(texture, unit); } return this; }, + /** + * Checks if the current batch has the same texture and texture unit, or if we need to create a new batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#requireTextureBatch + * @since 3.16.0 + * + * @param {WebGLTexture} texture - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {integer} unit - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if the pipeline needs to create a new batch, otherwise `false`. + */ + requireTextureBatch: function (texture, unit) + { + var batches = this.batches; + var batchLength = batches.length; + + if (batchLength > 0) + { + // If Texture Unit specified, we get the texture from the textures array, otherwise we use the texture property + var currentTexture = (unit > 0) ? batches[batchLength - 1].textures[unit - 1] : batches[batchLength - 1].texture; + + return !(currentTexture === texture); + } + + return true; + }, + /** * Creates a new batch object and pushes it to a batch array. * The batch object contains information relevant to the current @@ -44008,16 +44595,32 @@ var TextureTintPipeline = new Class({ * * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#pushBatch * @since 3.1.0 + * + * @param {WebGLTexture} texture - Optional WebGLTexture that will be assigned to the created batch. + * @param {integer} unit - Texture unit to which the texture needs to be bound. */ - pushBatch: function () + pushBatch: function (texture, unit) { - var batch = { - first: this.vertexCount, - texture: null, - textures: [] - }; + if (unit === 0) + { + this.batches.push({ + first: this.vertexCount, + texture: texture, + textures: [] + }); + } + else + { + var textures = []; - this.batches.push(batch); + textures[unit - 1] = texture; + + this.batches.push({ + first: this.vertexCount, + texture: null, + textures: textures + }); + } }, /** @@ -44060,11 +44663,14 @@ var TextureTintPipeline = new Class({ gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - for (var index = 0; index < batches.length - 1; index++) + // Process the TEXTURE BATCHES + + for (var index = 0; index < batchCount - 1; index++) { batch = batches[index]; batchNext = batches[index + 1]; + // Multi-texture check (for non-zero texture units) if (batch.textures.length > 0) { for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) @@ -44073,7 +44679,7 @@ var TextureTintPipeline = new Class({ if (nTexture) { - renderer.setTexture2D(nTexture, 1 + textureIndex); + renderer.setTexture2D(nTexture, 1 + textureIndex, false); } } @@ -44082,18 +44688,21 @@ var TextureTintPipeline = new Class({ batchVertexCount = batchNext.first - batch.first; + // Bail out if texture property is null (i.e. if a texture unit > 0) if (batch.texture === null || batchVertexCount <= 0) { continue; } - renderer.setTexture2D(batch.texture, 0); + renderer.setTexture2D(batch.texture, 0, false); gl.drawArrays(topology, batch.first, batchVertexCount); } // Left over data - batch = batches[batches.length - 1]; + batch = batches[batchCount - 1]; + + // Multi-texture check (for non-zero texture units) if (batch.textures.length > 0) { @@ -44103,7 +44712,7 @@ var TextureTintPipeline = new Class({ if (nTexture) { - renderer.setTexture2D(nTexture, 1 + textureIndex); + renderer.setTexture2D(nTexture, 1 + textureIndex, false); } } @@ -44114,7 +44723,7 @@ var TextureTintPipeline = new Class({ if (batch.texture && batchVertexCount > 0) { - renderer.setTexture2D(batch.texture, 0); + renderer.setTexture2D(batch.texture, 0, false); gl.drawArrays(topology, batch.first, batchVertexCount); } @@ -44123,8 +44732,6 @@ var TextureTintPipeline = new Class({ batches.length = 0; - this.pushBatch(); - this.flushLocked = false; return this; @@ -44142,6 +44749,7 @@ var TextureTintPipeline = new Class({ */ batchSprite: function (sprite, camera, parentTransformMatrix) { + // Will cause a flush if there are batchSize entries already this.renderer.setPipeline(this); var camMatrix = this._tempMatrix1; @@ -44246,24 +44854,24 @@ var TextureTintPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); var tintEffect = (sprite._isTinted && sprite.tintFill); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -44303,10 +44911,12 @@ var TextureTintPipeline = new Class({ * @param {number} tintBL - The bottom-left tint color value. * @param {number} tintBR - The bottom-right tint color value. * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect) + batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) { var hasFlushed = false; @@ -44315,6 +44925,8 @@ var TextureTintPipeline = new Class({ this.flush(); hasFlushed = true; + + this.setTexture2D(texture, unit); } var vertexViewF32 = this.vertexViewF32; @@ -44401,10 +45013,12 @@ var TextureTintPipeline = new Class({ * @param {number} tintTR - The top-right tint color value. * @param {number} tintBL - The bottom-left tint color value. * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect) + batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) { var hasFlushed = false; @@ -44412,6 +45026,8 @@ var TextureTintPipeline = new Class({ { this.flush(); + this.setTexture2D(texture, unit); + hasFlushed = true; } @@ -44611,22 +45227,22 @@ var TextureTintPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -44684,7 +45300,7 @@ var TextureTintPipeline = new Class({ tint = Utils.getTintAppendFloatAlpha(tint, alpha); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, 0); }, /** @@ -44707,6 +45323,8 @@ var TextureTintPipeline = new Class({ var xw = x + width; var yh = y + height; + this.setTexture2D(); + var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); this.batchQuad(x, y, x, yh, xw, yh, xw, y, 0, 0, 1, 1, tint, tint, tint, tint, 2); @@ -45103,18 +45721,18 @@ module.exports = TextureTintPipeline; /***/ }), -/* 184 */ +/* 200 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(9); +var Utils = __webpack_require__(10); /** * @classdesc @@ -45153,7 +45771,7 @@ var Utils = __webpack_require__(9); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for this WebGL Pipeline, as described above. */ var WebGLPipeline = new Class({ @@ -45171,7 +45789,7 @@ var WebGLPipeline = new Class({ this.name = 'WebGLPipeline'; /** - * [description] + * The Game which owns this WebGL Pipeline. * * @name Phaser.Renderer.WebGL.WebGLPipeline#game * @type {Phaser.Game} @@ -45180,7 +45798,7 @@ var WebGLPipeline = new Class({ this.game = config.game; /** - * [description] + * The canvas which this WebGL Pipeline renders to. * * @name Phaser.Renderer.WebGL.WebGLPipeline#view * @type {HTMLCanvasElement} @@ -45195,7 +45813,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.resolution = config.game.config.resolution; + this.resolution = 1; /** * Width of the current viewport @@ -45204,7 +45822,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.width = config.game.config.width * this.resolution; + this.width = 0; /** * Height of the current viewport @@ -45213,10 +45831,10 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.height = config.game.config.height * this.resolution; + this.height = 0; /** - * [description] + * The WebGL context this WebGL Pipeline uses. * * @name Phaser.Renderer.WebGL.WebGLPipeline#gl * @type {WebGLRenderingContext} @@ -45244,7 +45862,7 @@ var WebGLPipeline = new Class({ this.vertexCapacity = config.vertexCapacity; /** - * [description] + * The WebGL Renderer which owns this WebGL Pipeline. * * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer * @type {Phaser.Renderer.WebGL.WebGLRenderer} @@ -45392,7 +46010,7 @@ var WebGLPipeline = new Class({ * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush * @since 3.0.0 * - * @return {boolean} [description] + * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. */ shouldFlush: function () { @@ -45405,9 +46023,9 @@ var WebGLPipeline = new Class({ * @method Phaser.Renderer.WebGL.WebGLPipeline#resize * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * @param {number} resolution - The resolution this WebGL Pipeline should be resized to. * * @return {this} This WebGLPipeline instance. */ @@ -45415,6 +46033,7 @@ var WebGLPipeline = new Class({ { this.width = width * resolution; this.height = height * resolution; + this.resolution = resolution; return this; }, @@ -45459,7 +46078,9 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Set whenever this WebGL Pipeline is bound to a WebGL Renderer. + * + * This method is called every time the WebGL Pipeline is attempted to be bound, even if it already is the current pipeline. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind * @since 3.0.0 @@ -45473,7 +46094,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called before each frame is rendered, but after the canvas has been cleared. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender * @since 3.0.0 @@ -45487,13 +46108,13 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called before a Scene's Camera is rendered. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. */ @@ -45504,7 +46125,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called after each frame has been completely rendered and snapshots have been taken. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender * @since 3.0.0 @@ -45553,7 +46174,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Removes all object references in this WebGL Pipeline and removes its program from the WebGL context. * * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy * @since 3.0.0 @@ -45581,7 +46202,7 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] + * @param {number} x - The new value of the `float` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45599,8 +46220,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45618,9 +46239,9 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} z - [description] + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45731,7 +46352,7 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] + * @param {integer} x - The new value of the `int` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45749,8 +46370,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] + * @param {integer} x - The new X component of the `ivec2` uniform. + * @param {integer} y - The new Y component of the `ivec2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45768,9 +46389,9 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] + * @param {integer} x - The new X component of the `ivec3` uniform. + * @param {integer} y - The new Y component of the `ivec3` uniform. + * @param {integer} z - The new Z component of the `ivec3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45809,8 +46430,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45828,8 +46449,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45865,12 +46486,12 @@ module.exports = WebGLPipeline; /***/ }), -/* 185 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -45968,17 +46589,957 @@ module.exports = DefaultPlugins; /***/ }), -/* 186 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(101); -var Browser = __webpack_require__(128); +// 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 + * A representation of a vector in 3D space. + * + * A three-component vector. + * + * @class Vector3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Vector3 = new Class({ + + initialize: + + function Vector3 (x, y, z) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector3#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector3#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector3#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + }, + + /** + * Set this Vector to point up. + * + * Sets the y component of the vector to 1, and the others to 0. + * + * @method Phaser.Math.Vector3#up + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + up: function () + { + this.x = 0; + this.y = 1; + this.z = 0; + + return this; + }, + + /** + * Make a clone of this Vector3. + * + * @method Phaser.Math.Vector3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. + */ + clone: function () + { + return new Vector3(this.x, this.y, this.z); + }, + + /** + * Calculate the cross (vector) product of two given Vectors. + * + * @method Phaser.Math.Vector3#crossVectors + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to multiply. + * @param {Phaser.Math.Vector3} b - The second Vector to multiply. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + crossVectors: function (a, b) + { + var ax = a.x; + var ay = a.y; + var az = a.z; + var bx = b.x; + var by = b.y; + var bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict equality check against each Vector's components. + * + * @method Phaser.Math.Vector3#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. + * + * @return {boolean} True if the two vectors strictly match, otherwise false. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector3#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + + return this; + }, + + /** + * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. + * + * @method Phaser.Math.Vector3#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. + * @param {number} [y] - The y value to set for this Vector. + * @param {number} [z] - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + set: function (x, y, z) + { + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + + return this; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector3#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + + return this; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector3#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + scale: function (scale) + { + if (isFinite(scale)) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + } + else + { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + + return this; + }, + + /** + * Negate the `x`, `y` and `z` components of this Vector. + * + * @method Phaser.Math.Vector3#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + distance: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector3#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + distanceSq: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return dx * dx + dy * dy + dz * dz; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector3#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return Math.sqrt(x * x + y * y + z * z); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector3#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return x * x + y * y + z * z; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector3#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + normalize: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var len = x * x + y * y + z * z; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + } + + return this; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. + * + * @return {number} The dot product of this Vector and `v`. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + /** + * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. + * + * @method Phaser.Math.Vector3#cross + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector to cross product with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + cross: function (v) + { + var ax = this.x; + var ay = this.y; + var az = this.z; + var bx = v.x; + var by = v.y; + var bz = v.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector3#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + lerp: function (v, t) + { + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat3: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = x * m[0] + y * m[3] + z * m[6]; + this.y = x * m[1] + y * m[4] + z * m[7]; + this.z = x * m[2] + y * m[5] + z * m[8]; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; + + return this; + }, + + /** + * Transforms the coordinates of this Vector3 with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformCoordinates + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformCoordinates: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.x = tx / tw; + this.y = ty / tw; + this.z = tz / tw; + + return this; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector3#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + 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; + + // 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; + + // 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; + }, + + /** + * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, + * e.g. unprojecting a 2D point into 3D space. + * + * @method Phaser.Math.Vector3#project + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + project: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var a00 = m[0]; + var a01 = m[1]; + var a02 = m[2]; + var a03 = m[3]; + var a10 = m[4]; + var a11 = m[5]; + var a12 = m[6]; + var a13 = m[7]; + var a20 = m[8]; + var a21 = m[9]; + var a22 = m[10]; + var a23 = m[11]; + var a30 = m[12]; + var a31 = m[13]; + var a32 = m[14]; + var a33 = m[15]; + + var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + + this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; + this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; + this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + + return this; + }, + + /** + * Unproject this point from 2D space to 3D space. + * The point should have its x and y properties set to + * 2D screen space, and the z either at 0 (near plane) + * or 1 (far plane). The provided matrix is assumed to already + * be combined, i.e. projection * view * model. + * + * After this operation, this vector's (x, y, z) components will + * represent the unprojected 3D coordinate. + * + * @method Phaser.Math.Vector3#unproject + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. + * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unproject: function (viewport, invProjectionView) + { + var viewX = viewport.x; + var viewY = viewport.y; + var viewWidth = viewport.z; + var viewHeight = viewport.w; + + var x = this.x - viewX; + var y = (viewHeight - this.y - 1) - viewY; + var z = this.z; + + this.x = (2 * x) / viewWidth - 1; + this.y = (2 * y) / viewHeight - 1; + this.z = 2 * z - 1; + + return this.project(invProjectionView); + }, + + /** + * Make this Vector the zero vector (0, 0, 0). + * + * @method Phaser.Math.Vector3#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + + return this; + } + +}); + +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); + +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); + +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); + +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); + +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); + +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); + +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); + +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); + +module.exports = Vector3; + + +/***/ }), +/* 203 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Convert the given angle in radians, to the equivalent angle in degrees. + * + * @function Phaser.Math.RadToDeg + * @since 3.0.0 + * + * @param {number} radians - The angle in radians to convert ot degrees. + * + * @return {integer} The given angle converted to degrees. + */ +var RadToDeg = function (radians) +{ + return radians * CONST.RAD_TO_DEG; +}; + +module.exports = RadToDeg; + + +/***/ }), +/* 204 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random integer between the `min` and `max` values, inclusive. + * + * @function Phaser.Math.Between + * @since 3.0.0 + * + * @param {integer} min - The minimum value. + * @param {integer} max - The maximum value. + * + * @return {integer} The random integer. + */ +var Between = function (min, max) +{ + return Math.floor(Math.random() * (max - min + 1) + min); +}; + +module.exports = Between; + + +/***/ }), +/* 205 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates a Catmull-Rom value. + * + * @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} The Catmull-Rom value. + */ +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; + + return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; +}; + +module.exports = CatmullRom; + + +/***/ }), +/* 206 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether the given values are fuzzily equal. + * + * Two numbers are fuzzily equal if their difference is less than `epsilon`. + * + * @function Phaser.Math.Fuzzy.Equal + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. + */ +var Equal = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.abs(a - b) < epsilon; +}; + +module.exports = Equal; + + +/***/ }), +/* 207 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(108); +var Browser = __webpack_require__(138); var CanvasPool = __webpack_require__(26); /** @@ -46165,274 +47726,27 @@ module.exports = init(); /***/ }), -/* 187 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * 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 it falls back to using `document.body`. - * - * @function Phaser.DOM.AddToDOM - * @since 3.0.0 - * - * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. - * @param {(string|HTMLElement)} [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] - Whether or not to hide overflowing content inside the parent. - * - * @return {HTMLElement} The element that was added to the DOM. - */ -var AddToDOM = function (element, parent, overflowHidden) -{ - if (overflowHidden === undefined) { overflowHidden = true; } - - var target; - - 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; - } - } - else if (element.parentElement) - { - return element; - } - - // Fallback, covers an invalid ID and a non HTMLElement object - if (!target) - { - target = document.body; - } - - if (overflowHidden && target.style) - { - target.style.overflow = 'hidden'; - } - - target.appendChild(element); - - return element; -}; - -module.exports = AddToDOM; - - -/***/ }), -/* 188 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random integer between the `min` and `max` values, inclusive. - * - * @function Phaser.Math.Between - * @since 3.0.0 - * - * @param {integer} min - The minimum value. - * @param {integer} max - The maximum value. - * - * @return {integer} The random integer. - */ -var Between = function (min, max) -{ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -module.exports = Between; - - -/***/ }), -/* 189 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates a Catmull-Rom value. - * - * @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} The Catmull-Rom value. - */ -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; - - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -}; - -module.exports = CatmullRom; - - -/***/ }), -/* 190 */ +/* 208 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(18); - -/** - * Convert the given angle in radians, to the equivalent angle in degrees. - * - * @function Phaser.Math.RadToDeg - * @since 3.0.0 - * - * @param {number} radians - The angle in radians to convert ot degrees. - * - * @return {integer} The given angle converted to degrees. - */ -var RadToDeg = function (radians) -{ - return radians * CONST.RAD_TO_DEG; -}; - -module.exports = RadToDeg; - - -/***/ }), -/* 191 */ -/***/ (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__(10); - -// 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 } -// ] - -/** - * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. - * - * @function Phaser.Geom.Rectangle.FromPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. - * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. - * - * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. - */ -var FromPoints = function (points, out) -{ - if (out === undefined) { out = new Rectangle(); } - - if (points.length === 0) - { - return out; - } - - var minX = Number.MAX_VALUE; - var minY = Number.MAX_VALUE; - - var maxX = Number.MIN_SAFE_INTEGER; - var maxY = Number.MIN_SAFE_INTEGER; - - var p; - var px; - var py; - - for (var i = 0; i < points.length; i++) - { - p = points[i]; - - if (Array.isArray(p)) - { - px = p[0]; - py = p[1]; - } - else - { - px = p.x; - py = p.y; - } - - minX = Math.min(minX, px); - minY = Math.min(minY, py); - - maxX = Math.max(maxX, px); - maxY = Math.max(maxY, py); - } - - out.x = minX; - out.y = minY; - out.width = maxX - minX; - out.height = maxY - minY; - - return out; -}; - -module.exports = FromPoints; - - -/***/ }), -/* 192 */ -/***/ (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 Back = __webpack_require__(405); -var Bounce = __webpack_require__(404); -var Circular = __webpack_require__(403); -var Cubic = __webpack_require__(402); -var Elastic = __webpack_require__(401); -var Expo = __webpack_require__(400); -var Linear = __webpack_require__(399); -var Quadratic = __webpack_require__(398); -var Quartic = __webpack_require__(397); -var Quintic = __webpack_require__(396); -var Sine = __webpack_require__(395); -var Stepped = __webpack_require__(394); +var Back = __webpack_require__(440); +var Bounce = __webpack_require__(439); +var Circular = __webpack_require__(438); +var Cubic = __webpack_require__(437); +var Elastic = __webpack_require__(436); +var Expo = __webpack_require__(435); +var Linear = __webpack_require__(434); +var Quadratic = __webpack_require__(433); +var Quartic = __webpack_require__(432); +var Quintic = __webpack_require__(431); +var Sine = __webpack_require__(430); +var Stepped = __webpack_require__(429); // EaseMap module.exports = { @@ -46493,12 +47807,12 @@ module.exports = { /***/ }), -/* 193 */ +/* 209 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -46530,16 +47844,16 @@ module.exports = CenterOn; /***/ }), -/* 194 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetColor = __webpack_require__(195); +var GetColor = __webpack_require__(211); /** * Converts an HSV (hue, saturation and value) color value to RGB. @@ -46631,12 +47945,12 @@ module.exports = HSVToRGB; /***/ }), -/* 195 */ +/* 211 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -46661,19 +47975,19 @@ module.exports = GetColor; /***/ }), -/* 196 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HexStringToColor = __webpack_require__(413); -var IntegerToColor = __webpack_require__(410); -var ObjectToColor = __webpack_require__(408); -var RGBStringToColor = __webpack_require__(407); +var HexStringToColor = __webpack_require__(448); +var IntegerToColor = __webpack_require__(445); +var ObjectToColor = __webpack_require__(443); +var RGBStringToColor = __webpack_require__(442); /** * Converts the given source color value into an instance of a Color class. @@ -46717,12 +48031,12 @@ module.exports = ValueToColor; /***/ }), -/* 197 */ +/* 213 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -46793,25 +48107,24 @@ module.exports = Pad; /***/ }), -/* 198 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * @callback EachMapCallback - * @generic E - [entry] + * @callback EachMapCallback * - * @param {string} key - [description] - * @param {*} entry - [description] + * @param {string} key - The key of the Map entry. + * @param {E} entry - The value of the Map entry. * - * @return {?boolean} [description] + * @return {?boolean} The callback result. */ /** @@ -46876,6 +48189,7 @@ var Map = new Class({ /** * Adds an element with a specified `key` and `value` to this Map. + * If the `key` already exists, the value will be replaced. * * @method Phaser.Structs.Map#set * @since 3.0.0 @@ -46893,10 +48207,11 @@ var Map = new Class({ { if (!this.has(key)) { - this.entries[key] = value; this.size++; } + this.entries[key] = value; + return this; }, @@ -47165,12 +48480,12 @@ module.exports = Map; /***/ }), -/* 199 */ +/* 215 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47212,12 +48527,12 @@ module.exports = SmoothStep; /***/ }), -/* 200 */ +/* 216 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47251,17 +48566,17 @@ module.exports = SmootherStep; /***/ }), -/* 201 */ +/* 217 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rotate a `point` around `x` and `y` by the given `angle` and `distance`. * * @function Phaser.Math.RotateAroundDistance * @since 3.0.0 @@ -47270,7 +48585,7 @@ module.exports = SmootherStep; * @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] + * @param {number} distance - The distance from (x, y) to place the point at. * * @return {Phaser.Geom.Point} The given point. */ @@ -47288,12 +48603,12 @@ module.exports = RotateAroundDistance; /***/ }), -/* 202 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47344,12 +48659,12 @@ module.exports = Random; /***/ }), -/* 203 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47385,16 +48700,16 @@ module.exports = Random; /***/ }), -/* 204 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(63); /** * Wrap an angle in degrees. @@ -47417,16 +48732,16 @@ module.exports = WrapDegrees; /***/ }), -/* 205 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathWrap = __webpack_require__(59); +var MathWrap = __webpack_require__(63); /** * Wrap an angle. @@ -47449,12 +48764,12 @@ module.exports = Wrap; /***/ }), -/* 206 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47487,12 +48802,12 @@ module.exports = Random; /***/ }), -/* 207 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47527,16 +48842,16 @@ module.exports = Random; /***/ }), -/* 208 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(71); +var Length = __webpack_require__(64); var Point = __webpack_require__(6); /** @@ -47592,16 +48907,16 @@ module.exports = GetPoints; /***/ }), -/* 209 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(134); +var Perimeter = __webpack_require__(145); var Point = __webpack_require__(6); /** @@ -47669,12 +48984,953 @@ module.exports = GetPoint; /***/ }), -/* 210 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Clamp = __webpack_require__(24); +var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(146); +var FindClosestInSorted = __webpack_require__(472); +var Frame = __webpack_require__(471); +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. + * + * @class Animation + * @memberof Phaser.Animations + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationManager} manager - A reference to the global Animation Manager + * @param {string} key - The unique identifying string for this animation. + * @param {Phaser.Animations.Types.Animation} config - The Animation configuration. + */ +var Animation = new Class({ + + Extends: EventEmitter, + + initialize: + + function Animation (manager, key, config) + { + EventEmitter.call(this); + + /** + * A reference to the global Animation Manager. + * + * @name Phaser.Animations.Animation#manager + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.manager = manager; + + /** + * The unique identifying string for this animation. + * + * @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 {Phaser.Animations.AnimationFrame[]} + * @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, in milliseconds. + * If the `frameRate` property has been set then it overrides this value, + * otherwise the `frameRate` is derived from `duration`. + * + * @name Phaser.Animations.Animation#duration + * @type {integer} + * @since 3.0.0 + */ + 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) * 1000; + } + 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 = 4000 ms + // So frameRate is 12 / (4000 / 1000) = 3 fps + this.frameRate = this.frames.length / (this.duration / 1000); + } + 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 * 1000 (half a second, or 500ms) + this.duration = (this.frames.length / this.frameRate) * 1000; + } + + /** + * How many ms per frame, not including frame specific modifiers. + * + * @name Phaser.Animations.Animation#msPerFrame + * @type {integer} + * @since 3.0.0 + */ + this.msPerFrame = 1000 / this.frameRate; + + /** + * 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); + + /** + * The delay in ms before the playback will begin. + * + * @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. Set to -1 to repeat forever. + * + * @name Phaser.Animations.Animation#repeat + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeat = GetValue(config, 'repeat', 0); + + /** + * The delay in ms before the a repeat play starts. + * + * @name Phaser.Animations.Animation#repeatDelay + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeatDelay = GetValue(config, 'repeatDelay', 0); + + /** + * 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); + + /** + * Should the GameObject's `visible` property be set to `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); + + /** + * Should the GameObject's `visible` property be set to `false` when the animation finishes? + * + * @name Phaser.Animations.Animation#hideOnComplete + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.hideOnComplete = GetValue(config, 'hideOnComplete', false); + + /** + * Global pause. All Game Objects using this Animation instance are impacted by this property. + * + * @name Phaser.Animations.Animation#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + this.manager.on(Events.PAUSE_ALL, this.pause, this); + this.manager.on(Events.RESUME_ALL, this.resume, this); + }, + + /** + * Add frames to the end of the animation. + * + * @method Phaser.Animations.Animation#addFrame + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} config - [description] + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + addFrame: function (config) + { + return this.addFrameAt(this.frames.length, config); + }, + + /** + * Add frame/s into the animation. + * + * @method Phaser.Animations.Animation#addFrameAt + * @since 3.0.0 + * + * @param {integer} index - The index to insert the frame at within the animation. + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} 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); + } + + this.updateFrameSequence(); + } + + return this; + }, + + /** + * Check if the given frame index is valid. + * + * @method Phaser.Animations.Animation#checkFrame + * @since 3.0.0 + * + * @param {integer} index - The index to be checked. + * + * @return {boolean} `true` if the index is valid, otherwise `false`. + */ + checkFrame: function (index) + { + return (index >= 0 && index < this.frames.length); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#completeAnimation + * @protected + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + completeAnimation: function (component) + { + if (this.hideOnComplete) + { + component.parent.visible = false; + } + + component.stop(); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFirstTick + * @protected + * @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) + { + component.nextTick += component._delay; + } + }, + + /** + * Returns the AnimationFrame at the provided index + * + * @method Phaser.Animations.Animation#getFrameAt + * @protected + * @since 3.0.0 + * + * @param {integer} index - The index in the AnimationFrame array + * + * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence + */ + getFrameAt: function (index) + { + return this.frames[index]; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFrames + * @since 3.0.0 + * + * @param {Phaser.Textures.TextureManager} textureManager - [description] + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} frames - [description] + * @param {string} [defaultTextureKey] - [description] + * + * @return {Phaser.Animations.AnimationFrame[]} [description] + */ + getFrames: function (textureManager, frames, defaultTextureKey) + { + 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.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.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 + + // When is the next update due? + component.accumulator -= component.nextTick; + + component.nextTick = component.msPerFrame + component.currentFrame.duration; + }, + + /** + * Loads the Animation values into the Animation Component. + * + * @method Phaser.Animations.Animation#load + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to load values into. + * @param {integer} startFrame - The start frame of the animation to load. + */ + load: function (component, startFrame) + { + if (startFrame >= this.frames.length) + { + startFrame = 0; + } + + if (component.currentAnim !== this) + { + component.currentAnim = this; + + 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; + } + + var frame = this.frames[startFrame]; + + if (startFrame === 0 && !component.forward) + { + frame = this.getLastFrame(); + } + + component.updateFrame(frame); + }, + + /** + * Returns the frame closest to the given progress value between 0 and 1. + * + * @method Phaser.Animations.Animation#getFrameByProgress + * @since 3.4.0 + * + * @param {number} value - A value between 0 and 1. + * + * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. + */ + getFrameByProgress: function (value) + { + value = Clamp(value, 0, 1); + + return FindClosestInSorted(value, this.frames, 'progress'); + }, + + /** + * Advance the animation frame. + * + * @method Phaser.Animations.Animation#nextFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + */ + nextFrame: function (component) + { + var frame = component.currentFrame; + + // TODO: Add frame skip support + + if (frame.isLast) + { + // We're at the end of the animation + + // Yoyo? (happens before repeat) + if (component._yoyo) + { + this.handleYoyoFrame(component, false); + } + else if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + + if (component._reverse && component.forward) + { + component.forward = false; + } + else + { + this.repeatAnimation(component); + } + } + else + { + this.completeAnimation(component); + } + } + else + { + this.updateAndGetNextTick(component, frame.nextFrame); + } + }, + + /** + * Handle the yoyo functionality in nextFrame and previousFrame methods. + * + * @method Phaser.Animations.Animation#handleYoyoFrame + * @private + * @since 3.12.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) + */ + handleYoyoFrame: function (component, isReverse) + { + if (!isReverse) { isReverse = false; } + + if (component._reverse === !isReverse && component.repeatCounter > 0) + { + component.forward = isReverse; + + this.repeatAnimation(component); + + return; + } + + if (component._reverse !== isReverse && component.repeatCounter === 0) + { + this.completeAnimation(component); + + return; + } + + component.forward = isReverse; + + var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; + + this.updateAndGetNextTick(component, frame); + }, + + /** + * Returns the animation last frame. + * + * @method Phaser.Animations.Animation#getLastFrame + * @since 3.12.0 + * + * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. + */ + getLastFrame: function () + { + return this.frames[this.frames.length - 1]; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#previousFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + previousFrame: function (component) + { + var frame = component.currentFrame; + + // TODO: Add frame skip support + + if (frame.isFirst) + { + // We're at the start of the animation + + if (component._yoyo) + { + this.handleYoyoFrame(component, true); + } + else if (component.repeatCounter > 0) + { + if (component._reverse && !component.forward) + { + component.currentFrame = this.getLastFrame(); + this.repeatAnimation(component); + } + else + { + // Repeat (happens before complete) + component.forward = true; + this.repeatAnimation(component); + } + } + else + { + this.completeAnimation(component); + } + } + else + { + this.updateAndGetNextTick(component, frame.prevFrame); + } + }, + + /** + * Update Frame and Wait next tick. + * + * @method Phaser.Animations.Animation#updateAndGetNextTick + * @private + * @since 3.12.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. + */ + updateAndGetNextTick: function (component, frame) + { + component.updateFrame(frame); + + this.getNextTick(component); + }, + + /** + * [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); + } + + return this; + }, + + /** + * Removes a frame from the AnimationFrame array at the provided index + * and updates the animation accordingly. + * + * @method Phaser.Animations.Animation#removeFrameAt + * @since 3.0.0 + * + * @param {integer} index - The index in the AnimationFrame array + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + removeFrameAt: function (index) + { + this.frames.splice(index, 1); + + this.updateFrameSequence(); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#repeatAnimation + * @fires Phaser.Animations.Events#ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + repeatAnimation: function (component) + { + if (component._pendingStop === 2) + { + return this.completeAnimation(component); + } + + if (component._repeatDelay > 0 && component.pendingRepeat === false) + { + component.pendingRepeat = true; + component.accumulator -= component.nextTick; + component.nextTick += component._repeatDelay; + } + else + { + component.repeatCounter--; + + component.updateFrame(component.currentFrame[(component.forward) ? 'nextFrame' : 'prevFrame']); + + if (component.isPlaying) + { + this.getNextTick(component); + + component.pendingRepeat = false; + + var frame = component.currentFrame; + var parent = component.parent; + + this.emit(Events.ANIMATION_REPEAT, this, frame); + + parent.emit(Events.SPRITE_ANIMATION_KEY_REPEAT + this.key, this, frame, component.repeatCounter, parent); + + parent.emit(Events.SPRITE_ANIMATION_REPEAT, this, frame, component.repeatCounter, parent); + } + } + }, + + /** + * Sets the texture frame the animation uses for rendering. + * + * @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); + } + }, + + /** + * Converts the animation data to JSON. + * + * @method Phaser.Animations.Animation#toJSON + * @since 3.0.0 + * + * @return {Phaser.Animations.Types.JSONAnimation} [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; + }, + + /** + * [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); + + 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; + }, + + /** + * [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 () + { + this.removeAllListeners(); + + this.manager.off(Events.PAUSE_ALL, this.pause, this); + this.manager.off(Events.RESUME_ALL, this.resume, this); + + this.manager.remove(this.key); + + for (var i = 0; i < this.frames.length; i++) + { + this.frames[i].destroy(); + } + + this.frames = []; + + this.manager = null; + } + +}); + +module.exports = Animation; + + +/***/ }), +/* 227 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47713,12 +49969,12 @@ module.exports = Random; /***/ }), -/* 211 */ +/* 228 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47752,12 +50008,12 @@ module.exports = CircumferencePoint; /***/ }), -/* 212 */ +/* 229 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47886,7 +50142,7 @@ module.exports = ALIGN_CONST; /***/ }), -/* 213 */ +/* 230 */ /***/ (function(module, exports) { var g; @@ -47912,23 +50168,52 @@ module.exports = g; /***/ }), -/* 214 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tweens.Events + */ + +module.exports = { + + TIMELINE_COMPLETE: __webpack_require__(504), + TIMELINE_LOOP: __webpack_require__(503), + TIMELINE_PAUSE: __webpack_require__(502), + TIMELINE_RESUME: __webpack_require__(501), + TIMELINE_START: __webpack_require__(500), + TIMELINE_UPDATE: __webpack_require__(499) + +}; + + +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(11); -var TweenBuilder = __webpack_require__(105); -var TWEEN_CONST = __webpack_require__(93); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(231); +var TweenBuilder = __webpack_require__(112); +var TWEEN_CONST = __webpack_require__(99); /** * @classdesc - * [description] + * A Timeline combines multiple Tweens into one. Its overall behavior is otherwise similar to a single Tween. + * + * The Timeline updates all of its Tweens simultaneously. Its methods allow you to easily build a sequence of Tweens (each one starting after the previous one) or run multiple Tweens at once during given parts of the Timeline. * * @class Timeline * @memberof Phaser.Tweens @@ -47936,7 +50221,7 @@ var TWEEN_CONST = __webpack_require__(93); * @constructor * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] + * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager which owns this Timeline. */ var Timeline = new Class({ @@ -47949,7 +50234,7 @@ var Timeline = new Class({ EventEmitter.call(this); /** - * [description] + * The Tween Manager which owns this Timeline. * * @name Phaser.Tweens.Timeline#manager * @type {Phaser.Tweens.TweenManager} @@ -47958,7 +50243,7 @@ var Timeline = new Class({ this.manager = manager; /** - * [description] + * A constant value which allows this Timeline to be easily identified as one. * * @name Phaser.Tweens.Timeline#isTimeline * @type {boolean} @@ -48259,14 +50544,14 @@ var Timeline = new Class({ }, /** - * [description] + * Checks whether the offset value is a number or a directive that is relative to previous tweens. * * @method Phaser.Tweens.Timeline#isOffsetAbsolute * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The offset value to be evaluated * - * @return {boolean} [description] + * @return {boolean} True if the result is a number, false if it is a directive like " -= 1000" */ isOffsetAbsolute: function (value) { @@ -48274,14 +50559,14 @@ var Timeline = new Class({ }, /** - * [description] + * Checks if the offset is a relative value rather than an absolute one. If the value is just a number, this returns false. * * @method Phaser.Tweens.Timeline#isOffsetRelative * @since 3.0.0 * - * @param {string} value - [description] + * @param {string} value - The offset value to be evaluated * - * @return {boolean} [description] + * @return {boolean} Returns true if the value is relative, i.e " -= 1000". If false, the offset is absolute. */ isOffsetRelative: function (value) { @@ -48301,15 +50586,15 @@ var Timeline = new Class({ }, /** - * [description] + * Parses the relative offset value, returning a positive or negative number. * * @method Phaser.Tweens.Timeline#getRelativeOffset * @since 3.0.0 * - * @param {string} value - [description] - * @param {number} base - [description] + * @param {string} value - The relative offset, in the format of '-=500', for example. The first character determines whether it will be a positive or negative number. Spacing matters here. + * @param {number} base - The value to use as the offset. * - * @return {number} [description] + * @return {number} The returned number value. */ getRelativeOffset: function (value, base) { @@ -48333,7 +50618,7 @@ var Timeline = new Class({ }, /** - * [description] + * Calculates the total duration of the timeline. Computes all tween's durations and returns the full duration of the timeline. The resulting number is stored in the timeline, not as a return value. * * @method Phaser.Tweens.Timeline#calcDuration * @since 3.0.0 @@ -48396,12 +50681,12 @@ var Timeline = new Class({ }, /** - * [description] + * Initializes the timeline, which means all Tweens get their init() called, and the total duration will be computed. Returns a boolean indicating whether the timeline is auto-started or not. * * @method Phaser.Tweens.Timeline#init * @since 3.0.0 * - * @return {boolean} [description] + * @return {boolean} Returns true if the timeline is started. False if it is paused. */ init: function () { @@ -48423,12 +50708,12 @@ var Timeline = new Class({ }, /** - * [description] + * Resets all of the timeline's tweens back to their initial states. The boolean parameter indicates whether tweens that are looping should reset as well, or not. * * @method Phaser.Tweens.Timeline#resetTweens * @since 3.0.0 * - * @param {boolean} resetFromLoop - [description] + * @param {boolean} resetFromLoop - If true, resets all looping tweens to their initial values. */ resetTweens: function (resetFromLoop) { @@ -48441,15 +50726,15 @@ var Timeline = new Class({ }, /** - * Sets a callback for the Tween Manager. + * Sets a callback for the Timeline. * * @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] + * @param {string} type - The internal type of callback to set. + * @param {function} callback - Timeline allows multiple tweens to be linked together to create a streaming sequence. + * @param {array} [params] - The parameters to pass to the callback. + * @param {object} [scope] - The context scope of the callback. * * @return {Phaser.Tweens.Timeline} This Timeline object. */ @@ -48479,9 +50764,10 @@ var Timeline = new Class({ }, /** - * [description] + * Starts playing the timeline. * * @method Phaser.Tweens.Timeline#play + * @fires Phaser.Tweens.Events#TIMELINE_START * @since 3.0.0 */ play: function () @@ -48513,13 +50799,15 @@ var Timeline = new Class({ onStart.func.apply(onStart.scope, onStart.params); } - this.emit('start', this); + this.emit(Events.TIMELINE_START, this); }, /** * [description] * * @method Phaser.Tweens.Timeline#nextState + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_LOOP * @since 3.0.0 */ nextState: function () @@ -48542,7 +50830,7 @@ var Timeline = new Class({ onLoop.func.apply(onLoop.scope, onLoop.params); } - this.emit('loop', this, this.loopCounter); + this.emit(Events.TIMELINE_LOOP, this, this.loopCounter); this.resetTweens(true); @@ -48563,6 +50851,8 @@ var Timeline = new Class({ } else { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -48570,9 +50860,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } }, @@ -48581,6 +50869,8 @@ var Timeline = new Class({ * Otherwise, returns false. * * @method Phaser.Tweens.Timeline#update + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_UPDATE * @since 3.0.0 * * @param {number} timestamp - [description] @@ -48633,7 +50923,7 @@ var Timeline = new Class({ onUpdate.func.apply(onUpdate.scope, onUpdate.params); } - this.emit('update', this); + this.emit(Events.TIMELINE_UPDATE, this); // Anything still running? If not, we're done if (stillRunning === 0) @@ -48660,6 +50950,8 @@ var Timeline = new Class({ if (this.countdown <= 0) { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -48667,9 +50959,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } break; @@ -48690,9 +50980,10 @@ var Timeline = new Class({ }, /** - * [description] + * Pauses the timeline, retaining its internal state. * * @method Phaser.Tweens.Timeline#pause + * @fires Phaser.Tweens.Events#TIMELINE_PAUSE * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -48710,15 +51001,16 @@ var Timeline = new Class({ this.state = TWEEN_CONST.PAUSED; - this.emit('pause', this); + this.emit(Events.TIMELINE_PAUSE, this); return this; }, /** - * [description] + * Resumes the timeline from where it was when it was paused. * * @method Phaser.Tweens.Timeline#resume + * @fires Phaser.Tweens.Events#TIMELINE_RESUME * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -48732,20 +51024,20 @@ var Timeline = new Class({ this.state = this._pausedState; } - this.emit('resume', this); + this.emit(Events.TIMELINE_RESUME, this); return this; }, /** - * [description] + * Checks if any of the tweens has the target as the object they are operating on. Retuns false if no tweens operate on the target object. * * @method Phaser.Tweens.Timeline#hasTarget * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - The target to check all tweens against. * - * @return {boolean} [description] + * @return {boolean} True if there at least a single tween that operates on the target object. False otherwise. */ hasTarget: function (target) { @@ -48782,37 +51074,66 @@ module.exports = Timeline; /***/ }), -/* 215 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(69); -var Defaults = __webpack_require__(138); +var Clone = __webpack_require__(76); +var Defaults = __webpack_require__(150); var GetAdvancedValue = __webpack_require__(13); -var GetBoolean = __webpack_require__(94); -var GetEaseFunction = __webpack_require__(95); -var GetNewValue = __webpack_require__(106); -var GetTargets = __webpack_require__(140); -var GetTweens = __webpack_require__(217); +var GetBoolean = __webpack_require__(100); +var GetEaseFunction = __webpack_require__(101); +var GetNewValue = __webpack_require__(113); +var GetTargets = __webpack_require__(152); +var GetTweens = __webpack_require__(235); var GetValue = __webpack_require__(4); -var Timeline = __webpack_require__(214); -var TweenBuilder = __webpack_require__(105); +var Timeline = __webpack_require__(232); +var TweenBuilder = __webpack_require__(112); /** - * [description] + * Builds a Timeline of Tweens based on a configuration object. + * + * The configuration object (`config`) can have the following properties: + * + * `tweens` - an array of tween configuration objects to create and add into the new Timeline, as described by `TweenBuilder`. If this doesn't exist or is empty, the Timeline will start off paused and none of the other configuration settings will be read. If it's a function, it will be called and its return value will be used as the array. + * `targets` - an array (or function which returns one) of default targets to which to apply the Timeline. Each individual Tween configuration can override this value. + * `totalDuration` - if specified, each Tween in the Timeline will get an equal portion of this duration, usually in milliseconds, by default. Each individual Tween configuration can override the Tween's duration. + * `duration` - if `totalDuration` is not specified, the default duration, usually in milliseconds, of each Tween which will be created. Each individual Tween configuration can override the Tween's duration. + * `delay`, `easeParams`, `ease`, `hold`, `repeat`, `repeatDelay`, `yoyo`, `flipX`, `flipY` - the default settings for each Tween which will be created, as specified by `TweenBuilder`. Each individual Tween configuration can override any of these values. + * `completeDelay` - if specified, the time to wait, usually in milliseconds, before the Timeline completes. + * `loop` - how many times the Timeline should loop, or -1 to loop indefinitely. + * `loopDelay` - the time, usually in milliseconds, between each loop + * `paused` - if `true`, the Timeline will start paused + * `useFrames` - if `true`, all duration in the Timeline will be in frames instead of milliseconds + * `callbackScope` - the default scope (`this` value) to use for each callback registered by the Timeline Builder. If not specified, the Timeline itself will be used. + * `onStart` - if specified, the `onStart` callback for the Timeline, called every time it starts playing + * `onStartScope` - the scope (`this` value) to use for the `onStart` callback. If not specified, the `callbackScope` will be used. + * `onStartParams` - additional arguments to pass to the `onStart` callback. The Timeline will always be the first argument. + * `onUpdate` - if specified, the `onUpdate` callback for the Timeline, called every frame it's active, regardless of its Tweens + * `onUpdateScope` - the scope (`this` value) to use for the `onUpdate` callback. If not specified, the `callbackScope` will be used. + * `onUpdateParams` - additional arguments to pass to the `onUpdate` callback. The Timeline will always be the first argument. + * `onLoop` - if specified, the `onLoop` callback for the Timeline, called every time it loops + * `onLoopScope` - the scope (`this` value) to use for the `onLoop` callback. If not specified, the `callbackScope` will be used. + * `onLoopParams` - additional arguments to pass to the `onLoop` callback. The Timeline will always be the first argument. + * `onYoyo` - if specified, the `onYoyo` callback for the Timeline, called every time it yoyos + * `onYoyoScope` - the scope (`this` value) to use for the `onYoyo` callback. If not specified, the `callbackScope` will be used. + * `onYoyoParams` - additional arguments to pass to the `onYoyo` callback. The first argument will always be `null`, while the Timeline will always be the second argument. + * `onComplete` - if specified, the `onComplete` callback for the Timeline, called after it completes + * `onCompleteScope` - the scope (`this` value) to use for the `onComplete` callback. If not specified, the `callbackScope` will be used. + * `onCompleteParams` - additional arguments to pass to the `onComplete` callback. The Timeline will always be the first argument. * * @function Phaser.Tweens.Builders.TimelineBuilder * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] - * @param {object} config - [description] + * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager to which the Timeline will belong. + * @param {object} config - The configuration object for the Timeline, as described above. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline. */ var TimelineBuilder = function (manager, config) { @@ -48934,24 +51255,24 @@ module.exports = TimelineBuilder; /***/ }), -/* 216 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(138); +var Defaults = __webpack_require__(150); var GetAdvancedValue = __webpack_require__(13); -var GetBoolean = __webpack_require__(94); -var GetEaseFunction = __webpack_require__(95); -var GetNewValue = __webpack_require__(106); +var GetBoolean = __webpack_require__(100); +var GetEaseFunction = __webpack_require__(101); +var GetNewValue = __webpack_require__(113); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(139); -var Tween = __webpack_require__(137); -var TweenData = __webpack_require__(136); +var GetValueOp = __webpack_require__(151); +var Tween = __webpack_require__(149); +var TweenData = __webpack_require__(148); /** * [description] @@ -49062,19 +51383,19 @@ module.exports = NumberTweenBuilder; /***/ }), -/* 217 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); /** - * [description] + * Returns an array of all tweens in the given config * * @function Phaser.Tweens.Builders.GetTweens * @since 3.0.0 @@ -49108,16 +51429,16 @@ module.exports = GetTweens; /***/ }), -/* 218 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RESERVED = __webpack_require__(464); +var RESERVED = __webpack_require__(505); /** * [description] @@ -49166,12 +51487,12 @@ module.exports = GetProps; /***/ }), -/* 219 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -49181,27 +51502,29 @@ var GetFastValue = __webpack_require__(1); /** * @typedef {object} TimerEventConfig * - * @property {number} [delay=0] - [description] - * @property {number} [repeat=0] - [description] - * @property {boolean} [loop=false] - [description] - * @property {function} [callback] - [description] - * @property {*} [callbackScope] - [description] - * @property {Array.<*>} [args] - [description] - * @property {number} [timeScale=1] - [description] - * @property {number} [startAt=1] - [description] - * @property {boolean} [paused=false] - [description] + * @property {number} [delay=0] - The delay after which the Timer Event should fire, in milliseconds. + * @property {number} [repeat=0] - The total number of times the Timer Event will repeat before finishing. + * @property {boolean} [loop=false] - `true` if the Timer Event should repeat indefinitely. + * @property {function} [callback] - The callback which will be called when the Timer Event fires. + * @property {*} [callbackScope] - The scope (`this` object) with which to invoke the `callback`. + * @property {Array.<*>} [args] - Additional arguments to be passed to the `callback`. + * @property {number} [timeScale=1] - The scale of the elapsed time. + * @property {number} [startAt=1] - The initial elapsed time in milliseconds. Useful if you want a long duration with repeat, but for the first loop to fire quickly. + * @property {boolean} [paused=false] - `true` if the Timer Event should be paused. */ /** * @classdesc - * [description] + * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. + * + * Because it's managed by a Clock, a Timer Event is based on game time, will be affected by its Clock's time scale, and will pause if its Clock pauses. * * @class TimerEvent * @memberof Phaser.Time * @constructor * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. */ var TimerEvent = new Class({ @@ -49300,7 +51623,9 @@ var TimerEvent = new Class({ this.startAt = 0; /** - * [description] + * The time in milliseconds which has elapsed since the Timer Event's creation. + * + * This value is local for the Timer Event and is relative to its Clock. As such, it's influenced by the Clock's time scale and paused state, the Timer Event's initial {@link #startAt} property, and the Timer Event's {@link #timeScale} and {@link #paused} state. * * @name Phaser.Time.TimerEvent#elapsed * @type {number} @@ -49310,7 +51635,7 @@ var TimerEvent = new Class({ this.elapsed = 0; /** - * [description] + * Whether or not this timer is paused. * * @name Phaser.Time.TimerEvent#paused * @type {boolean} @@ -49320,7 +51645,9 @@ var TimerEvent = new Class({ this.paused = false; /** - * [description] + * Whether the Timer Event's function has been called. + * + * When the Timer Event fires, this property will be set to `true` before the callback function is invoked and will be reset immediately afterward if the Timer Event should repeat. The value of this property does not directly influence whether the Timer Event will be removed from its Clock, but can prevent it from firing. * * @name Phaser.Time.TimerEvent#hasDispatched * @type {boolean} @@ -49333,12 +51660,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Completely reinitializes the Timer Event, regardless of its current state, according to a configuration object. * * @method Phaser.Time.TimerEvent#reset * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The new state for the Timer Event. * * @return {Phaser.Time.TimerEvent} This TimerEvent object. */ @@ -49376,7 +51703,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#getProgress * @since 3.0.0 * - * @return {number} [description] + * @return {number} A number between 0 and 1 representing the current progress. */ getProgress: function () { @@ -49389,7 +51716,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#getOverallProgress * @since 3.0.0 * - * @return {number} [description] + * @return {number} The overall progress of the Timer Event, between 0 and 1. */ getOverallProgress: function () { @@ -49407,12 +51734,14 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the number of times this Timer Event will repeat before finishing. + * + * This should not be confused with the number of times the Timer Event will fire before finishing. A return value of 0 doesn't indicate that the Timer Event has finished running - it indicates that it will not repeat after the next time it fires. * * @method Phaser.Time.TimerEvent#getRepeatCount * @since 3.0.0 * - * @return {number} [description] + * @return {number} How many times the Timer Event will repeat. */ getRepeatCount: function () { @@ -49420,12 +51749,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the local elapsed time for the current iteration of the Timer Event. * * @method Phaser.Time.TimerEvent#getElapsed * @since 3.0.0 * - * @return {number} [description] + * @return {number} The local elapsed time in milliseconds. */ getElapsed: function () { @@ -49433,12 +51762,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the local elapsed time for the current iteration of the Timer Event in seconds. * * @method Phaser.Time.TimerEvent#getElapsedSeconds * @since 3.0.0 * - * @return {number} [description] + * @return {number} The local elapsed time in seconds. */ getElapsedSeconds: function () { @@ -49446,12 +51775,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. * * @method Phaser.Time.TimerEvent#remove * @since 3.0.0 * - * @param {function} dispatchCallback - [description] + * @param {boolean} [dispatchCallback] - If `true` (by default `false`), the function of the Timer Event will be called before its removal from its Clock. */ remove: function (dispatchCallback) { @@ -49465,7 +51794,9 @@ var TimerEvent = new Class({ }, /** - * [description] + * Destroys all object references in the Timer Event, i.e. its callback, scope, and arguments. + * + * Normally, this method is only called by the Clock when it shuts down. As such, it doesn't stop the Timer Event. If called manually, the Timer Event will still be updated by the Clock, but it won't do anything when it fires. * * @method Phaser.Time.TimerEvent#destroy * @since 3.0.0 @@ -49483,23 +51814,23 @@ module.exports = TimerEvent; /***/ }), -/* 220 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var CONST = __webpack_require__(28); -var GameObject = __webpack_require__(17); -var StaticTilemapLayerRender = __webpack_require__(473); -var TilemapComponents = __webpack_require__(111); -var TransformMatrix = __webpack_require__(42); -var Utils = __webpack_require__(9); +var Components = __webpack_require__(14); +var CONST = __webpack_require__(30); +var GameObject = __webpack_require__(18); +var StaticTilemapLayerRender = __webpack_require__(514); +var TilemapComponents = __webpack_require__(118); +var TransformMatrix = __webpack_require__(46); +var Utils = __webpack_require__(10); /** * @classdesc @@ -49703,9 +52034,9 @@ var StaticTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -49843,7 +52174,7 @@ var StaticTilemapLayer = new Class({ this.setAlpha(this.layer.alpha); this.setPosition(x, y); this.setOrigin(); - this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); this.updateVBOData(); @@ -50084,8 +52415,8 @@ var StaticTilemapLayer = new Class({ * @param {integer} vOffset - The vertex offset. * @param {any} tile - The tile being rendered. * @param {any} tileset - The tileset being used for rendering. - * @param {integer} width - The width of the layer. - * @param {integer} height - The height of the layer. + * @param {integer} width - The width of the tileset image in pixels. + * @param {integer} height - The height of the tileset image in pixels. * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the layer is being rendered with. * @param {integer} tilesetIndex - The tileset index. * @@ -50100,32 +52431,32 @@ var StaticTilemapLayer = new Class({ return vOffset; } - var u0 = texCoords.x / width; - var v0 = texCoords.y / height; - var u1 = (texCoords.x + tile.width) / width; - var v1 = (texCoords.y + tile.height) / height; - - var matrix = this._tempMatrix; - - var tileWidth = tile.width; - var tileHeight = tile.height; + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; var halfTileWidth = tileWidth / 2; var halfTileHeight = tileHeight / 2; + var u0 = texCoords.x / width; + var v0 = texCoords.y / height; + var u1 = (texCoords.x + tileWidth) / width; + var v1 = (texCoords.y + tileHeight) / height; + + var matrix = this._tempMatrix; + var x = -halfTileWidth; var y = -halfTileHeight; if (tile.flipX) { tileWidth *= -1; - x += tile.width; + x += tileset.tileWidth; } if (tile.flipY) { tileHeight *= -1; - y += tile.height; + y += tileset.tileHeight; } var xw = x + tileWidth; @@ -50149,17 +52480,17 @@ var StaticTilemapLayer = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } var vertexViewF32 = this.vertexViewF32[tilesetIndex]; @@ -50287,10 +52618,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesWithin * @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 {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -50427,17 +52758,11 @@ var StaticTilemapLayer = new Class({ * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -50458,17 +52783,11 @@ var StaticTilemapLayer = new Class({ * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -50487,17 +52806,11 @@ var StaticTilemapLayer = new Class({ * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -50536,7 +52849,7 @@ var StaticTilemapLayer = new Class({ * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile * object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates * were invalid. @@ -50552,17 +52865,11 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithin * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -50577,18 +52884,12 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinWorldXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {number} worldX - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} worldY - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles high from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -50605,14 +52906,8 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -50628,8 +52923,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAt * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] + * @param {integer} tileX - X position to get the tile from in tile coordinates. + * @param {integer} tileY - Y position to get the tile from in tile coordinates. * * @return {boolean} */ @@ -50645,9 +52940,9 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAtWorldXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {number} worldX - The X coordinate of the world position. + * @param {number} worldY - The Y coordinate of the world position. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {boolean} */ @@ -50666,13 +52961,7 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -50836,10 +53125,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] + * @param {integer} tileX - The leftmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The topmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. * @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. * @@ -50859,8 +53148,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {integer} tileX - The X coordinate, in tile coordinates. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {number} */ @@ -50876,8 +53165,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY * @since 3.0.0 * - * @param {integer} tileY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {integer} tileY - The Y coordinate, in tile coordinates. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {number} */ @@ -50894,10 +53183,10 @@ var StaticTilemapLayer = new Class({ * @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] + * @param {integer} tileX - The X coordinate, in tile coordinates. + * @param {integer} tileY - The Y coordinate, in tile coordinates. + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {Phaser.Math.Vector2} */ @@ -50913,10 +53202,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX * @since 3.0.0 * - * @param {number} worldX - [description] + * @param {number} worldX - The X coordinate, in world pixels. * @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] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.] * * @return {number} */ @@ -50932,10 +53221,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileY * @since 3.0.0 * - * @param {number} worldY - [description] + * @param {number} worldY - The Y coordinate, in world pixels. * @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] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {number} */ @@ -50952,12 +53241,12 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] + * @param {number} worldX - The X coordinate, in world pixels. + * @param {number} worldY - The Y coordinate, in world pixels. * @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] + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Math.Vector2} */ @@ -51007,20 +53296,20 @@ module.exports = StaticTilemapLayer; /***/ }), -/* 221 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(16); -var DynamicTilemapLayerRender = __webpack_require__(476); -var GameObject = __webpack_require__(17); -var TilemapComponents = __webpack_require__(111); +var Components = __webpack_require__(14); +var DynamicTilemapLayerRender = __webpack_require__(517); +var GameObject = __webpack_require__(18); +var TilemapComponents = __webpack_require__(118); /** * @classdesc @@ -51211,9 +53500,9 @@ var DynamicTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -51259,7 +53548,7 @@ var DynamicTilemapLayer = new Class({ this.setAlpha(this.layer.alpha); this.setPosition(x, y); this.setOrigin(); - this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); this.initPipeline('TextureTintPipeline'); }, @@ -51525,10 +53814,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -51573,10 +53859,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -51598,10 +53881,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -51658,10 +53938,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -51678,10 +53955,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -51701,10 +53975,7 @@ var DynamicTilemapLayer = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -51890,13 +54161,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -51988,10 +54253,8 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -52013,10 +54276,8 @@ var DynamicTilemapLayer = new Class({ * * @param {integer} start - The first index of the tile to be set for collision. * @param {integer} stop - The last index of the tile to be set 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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -52039,12 +54300,9 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -52064,10 +54322,8 @@ var DynamicTilemapLayer = new Class({ * @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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -52087,10 +54343,8 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -52110,8 +54364,7 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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 {(integer|integer[])} 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. * @@ -52136,7 +54389,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @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.DynamicTilemapLayer} This Tilemap Layer object. @@ -52347,26 +54600,26 @@ module.exports = DynamicTilemapLayer; /***/ }), -/* 222 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var DynamicTilemapLayer = __webpack_require__(221); +var DegToRad = __webpack_require__(39); +var DynamicTilemapLayer = __webpack_require__(239); var Extend = __webpack_require__(21); -var Formats = __webpack_require__(30); -var LayerData = __webpack_require__(87); -var Rotate = __webpack_require__(270); -var StaticTilemapLayer = __webpack_require__(220); -var Tile = __webpack_require__(61); -var TilemapComponents = __webpack_require__(111); -var Tileset = __webpack_require__(107); +var Formats = __webpack_require__(32); +var LayerData = __webpack_require__(93); +var Rotate = __webpack_require__(411); +var StaticTilemapLayer = __webpack_require__(238); +var Tile = __webpack_require__(67); +var TilemapComponents = __webpack_require__(118); +var Tileset = __webpack_require__(114); /** * @callback TilemapFilterCallback @@ -52476,14 +54729,14 @@ var Tilemap = new Class({ /** * The render (draw) order of the map data (as specified in Tiled), usually 'right-down'. - * + * * The draw orders are: - * + * * right-down * left-down * right-up * left-up - * + * * This can be changed via the `setRenderOrder` method. * * @name Phaser.Tilemaps.Tilemap#renderOrder @@ -52593,22 +54846,22 @@ var Tilemap = new Class({ /** * Sets the rendering (draw) order of the tiles in this map. - * + * * The default is 'right-down', meaning it will order the tiles starting from the top-left, * drawing to the right and then moving down to the next row. - * + * * The draw orders are: - * + * * 0 = right-down * 1 = left-down * 2 = right-up * 3 = left-up - * + * * Setting the render order does not change the tiles or how they are stored in the layer, * it purely impacts the order in which they are rendered. - * + * * You can provide either an integer (0 to 3), or the string version of the order. - * + * * Calling this method _after_ creating Static or Dynamic Tilemap Layers will **not** automatically * update them to use the new render order. If you call this method after creating layers, use their * own `setRenderOrder` methods to change them as needed. @@ -52760,12 +55013,12 @@ var Tilemap = new Class({ * Copies the tiles in the source rectangular area to a new destination (all specified in tile * coordinates) within the layer. This copies all tile properties & recalculates collision * information in the destination region. - * + * * If no layer specified, the map's current layer is used. This cannot be applied to StaticTilemapLayers. * * @method Phaser.Tilemaps.Tilemap#copy * @since 3.0.0 - * + * * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. * @param {integer} width - The width of the area to copy, in tiles, not pixels. @@ -52773,7 +55026,7 @@ var Tilemap = new Class({ * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -52810,7 +55063,7 @@ var Tilemap = new Class({ * @param {integer} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. * @param {integer} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. * @param {integer} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. - * + * * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer was created, or null if it failed. */ createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) @@ -53040,7 +55293,7 @@ var Tilemap = new Class({ * @param {SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -53069,8 +55322,8 @@ var Tilemap = new Class({ * * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} x - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} y - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer was created, or null if it failed. */ @@ -53140,7 +55393,7 @@ var Tilemap = new Class({ * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -53190,6 +55443,14 @@ var Tilemap = new Class({ return objectLayer.objects.filter(callback, context); }, + /** + * @typedef {object} FilteringOptions + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ + /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns @@ -53207,11 +55468,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to apply the filter on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -53238,7 +55496,7 @@ var Tilemap = new Class({ * @param {integer} index - The tile index value to search for. * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -53298,11 +55556,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -53330,11 +55585,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -53491,7 +55743,7 @@ var Tilemap = new Class({ * @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 tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -53515,7 +55767,7 @@ var Tilemap = new Class({ * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -53544,11 +55796,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -53570,12 +55819,9 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -53599,12 +55845,9 @@ var Tilemap = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -53661,7 +55904,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -53686,7 +55929,7 @@ var Tilemap = new Class({ * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -53736,7 +55979,7 @@ var Tilemap = new Class({ * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. */ @@ -53768,7 +56011,7 @@ var Tilemap = new Class({ * @param {number} worldY - The y coordinate, in pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -53800,7 +56043,7 @@ var Tilemap = new Class({ * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -53836,7 +56079,7 @@ var Tilemap = new Class({ * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -53866,7 +56109,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -53895,7 +56138,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -53950,7 +56193,7 @@ var Tilemap = new Class({ * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -53980,7 +56223,7 @@ var Tilemap = new Class({ * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -53995,6 +56238,14 @@ var Tilemap = new Class({ return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, layer); }, + /** + * @typedef {object} StyleConfig + * + * @property {?number} [tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. + * @property {?number} [collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. + * @property {?number} [faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. + */ + /** * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles @@ -54007,11 +56258,8 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54043,7 +56291,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54074,7 +56322,7 @@ var Tilemap = new Class({ * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54104,7 +56352,7 @@ var Tilemap = new Class({ * @param {integer} stop - The last index of the tile to be set 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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54136,7 +56384,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54164,7 +56412,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54192,7 +56440,7 @@ var Tilemap = new Class({ * * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54221,7 +56469,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54252,7 +56500,7 @@ var Tilemap = new Class({ * @param {integer} height - How many tiles tall from the `tileY` index the area will be. * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54320,9 +56568,9 @@ var Tilemap = new Class({ var mapWidth = this.layers[i].width; var mapHeight = this.layers[i].height; - for (var row = 0; row < mapHeight; ++row) + for (var row = 0; row < mapHeight; row++) { - for (var col = 0; col < mapWidth; ++col) + for (var col = 0; col < mapWidth; col++) { var tile = mapData[row][col]; @@ -54366,13 +56614,16 @@ var Tilemap = new Class({ var mapWidth = layer.width; var mapHeight = layer.height; - for (var row = 0; row < mapHeight; ++row) + for (var row = 0; row < mapHeight; row++) { - for (var col = 0; col < mapWidth; ++col) + for (var col = 0; col < mapWidth; col++) { var tile = mapData[row][col]; - if (tile !== null) { tile.setSize(tileWidth, tileHeight); } + if (tile !== null) + { + tile.setSize(tileWidth, tileHeight); + } } } @@ -54395,7 +56646,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54430,7 +56681,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54459,7 +56710,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -54483,7 +56734,8 @@ var Tilemap = new Class({ * * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer + * to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -54510,7 +56762,7 @@ var Tilemap = new Class({ * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. */ @@ -54551,7 +56803,7 @@ var Tilemap = new Class({ * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during * randomization. They should be in the form: { index: 0, weight: 4 } or * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -54581,7 +56833,8 @@ var Tilemap = new Class({ * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @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] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer + * to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -54606,7 +56859,7 @@ var Tilemap = new Class({ * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. * @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] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -54634,7 +56887,7 @@ var Tilemap = new Class({ * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. */ @@ -54675,19 +56928,19 @@ module.exports = Tilemap; /***/ }), -/* 223 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(30); -var MapData = __webpack_require__(86); -var ParseTileLayers = __webpack_require__(478); -var ParseTilesets = __webpack_require__(477); +var Formats = __webpack_require__(32); +var MapData = __webpack_require__(92); +var ParseTileLayers = __webpack_require__(519); +var ParseTilesets = __webpack_require__(518); /** * @namespace Phaser.Tilemaps.Parsers.Impact @@ -54746,12 +56999,12 @@ module.exports = ParseWeltmeister; /***/ }), -/* 224 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -54772,7 +57025,7 @@ var GetFastValue = __webpack_require__(1); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {object} [config] - The data for the layer from the Tiled JSON object. */ var ObjectLayer = new Class({ @@ -54783,7 +57036,7 @@ var ObjectLayer = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the Object Layer. * * @name Phaser.Tilemaps.ObjectLayer#name * @type {string} @@ -54792,7 +57045,7 @@ var ObjectLayer = new Class({ this.name = GetFastValue(config, 'name', 'object layer'); /** - * [description] + * The opacity of the layer, between 0 and 1. * * @name Phaser.Tilemaps.ObjectLayer#opacity * @type {number} @@ -54801,7 +57054,7 @@ var ObjectLayer = new Class({ this.opacity = GetFastValue(config, 'opacity', 1); /** - * [description] + * The custom properties defined on the Object Layer, keyed by their name. * * @name Phaser.Tilemaps.ObjectLayer#properties * @type {object} @@ -54810,7 +57063,7 @@ var ObjectLayer = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * [description] + * The type of each custom property defined on the Object Layer, keyed by its name. * * @name Phaser.Tilemaps.ObjectLayer#propertyTypes * @type {object} @@ -54819,7 +57072,7 @@ var ObjectLayer = new Class({ this.propertyTypes = GetFastValue(config, 'propertytypes', {}); /** - * [description] + * The type of the layer, which should be `objectgroup`. * * @name Phaser.Tilemaps.ObjectLayer#type * @type {string} @@ -54828,7 +57081,7 @@ var ObjectLayer = new Class({ this.type = GetFastValue(config, 'type', 'objectgroup'); /** - * [description] + * Whether the layer is shown (`true`) or hidden (`false`). * * @name Phaser.Tilemaps.ObjectLayer#visible * @type {boolean} @@ -54837,7 +57090,15 @@ var ObjectLayer = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * An array of all objects on this Object Layer. + * + * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique), `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees), `properties` (if any), `visible` state (`true` if visible, `false` otherwise), `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels). + * + * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property, a `flippedVertical` property, and `flippedAntiDiagonal` property. The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains information on flipping and rotation. + * + * Polylines have a `polyline` property, which is an array of objects corresponding to points, where each point has an `x` property and a `y` property. Polygons have an identically structured array in their `polygon` property. Text objects have a `text` property with the text's properties. + * + * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`. * * @name Phaser.Tilemaps.ObjectLayer#objects * @type {Phaser.GameObjects.GameObject[]} @@ -54852,33 +57113,33 @@ module.exports = ObjectLayer; /***/ }), -/* 225 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pick = __webpack_require__(482); -var ParseGID = __webpack_require__(227); +var Pick = __webpack_require__(523); +var ParseGID = __webpack_require__(245); var copyPoints = function (p) { return { x: p.x, y: p.y }; }; var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; /** - * [description] + * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) * * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject * @since 3.0.0 * - * @param {object} tiledObject - [description] - * @param {number} [offsetX=0] - [description] - * @param {number} [offsetY=0] - [description] + * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. + * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. + * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. * - * @return {object} [description] + * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. */ var ParseObject = function (tiledObject, offsetX, offsetY) { @@ -54934,12 +57195,12 @@ module.exports = ParseObject; /***/ }), -/* 226 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -55106,12 +57367,12 @@ module.exports = ImageCollection; /***/ }), -/* 227 */ +/* 245 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -55196,23 +57457,23 @@ module.exports = ParseGID; /***/ }), -/* 228 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(30); -var MapData = __webpack_require__(86); -var ParseTileLayers = __webpack_require__(486); -var ParseImageLayers = __webpack_require__(484); -var ParseTilesets = __webpack_require__(483); -var ParseObjectLayers = __webpack_require__(481); -var BuildTilesetIndex = __webpack_require__(480); -var AssignTileProperties = __webpack_require__(479); +var Formats = __webpack_require__(32); +var MapData = __webpack_require__(92); +var ParseTileLayers = __webpack_require__(527); +var ParseImageLayers = __webpack_require__(525); +var ParseTilesets = __webpack_require__(524); +var ParseObjectLayers = __webpack_require__(522); +var BuildTilesetIndex = __webpack_require__(521); +var AssignTileProperties = __webpack_require__(520); /** * @namespace Phaser.Tilemaps.Parsers.Tiled @@ -55277,17 +57538,17 @@ module.exports = ParseJSONTiled; /***/ }), -/* 229 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(30); -var Parse2DArray = __webpack_require__(142); +var Formats = __webpack_require__(32); +var Parse2DArray = __webpack_require__(154); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -55325,20 +57586,20 @@ module.exports = ParseCSV; /***/ }), -/* 230 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(30); -var Parse2DArray = __webpack_require__(142); -var ParseCSV = __webpack_require__(229); -var ParseJSONTiled = __webpack_require__(228); -var ParseWeltmeister = __webpack_require__(223); +var Formats = __webpack_require__(32); +var Parse2DArray = __webpack_require__(154); +var ParseCSV = __webpack_require__(247); +var ParseJSONTiled = __webpack_require__(246); +var ParseWeltmeister = __webpack_require__(241); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -55395,18 +57656,18 @@ module.exports = Parse; /***/ }), -/* 231 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tile = __webpack_require__(61); -var IsInLayerBounds = __webpack_require__(88); -var CalculateFacesAt = __webpack_require__(145); +var Tile = __webpack_require__(67); +var IsInLayerBounds = __webpack_require__(94); +var CalculateFacesAt = __webpack_require__(157); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -55430,7 +57691,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la if (recalculateFaces === undefined) { recalculateFaces = true; } if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } - var tile = layer.data[tileY][tileX]; + var tile = layer.data[tileY][tileX] || null; if (tile === null) { return null; @@ -55455,16 +57716,16 @@ module.exports = RemoveTileAt; /***/ }), -/* 232 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(88); +var IsInLayerBounds = __webpack_require__(94); /** * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns @@ -55498,16 +57759,16 @@ module.exports = HasTileAt; /***/ }), -/* 233 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -55543,12 +57804,12 @@ module.exports = ReplaceByIndex; /***/ }), -/* 234 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ @@ -55724,28 +57985,29 @@ module.exports = BasePlugin; /***/ }), -/* 235 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(55); +var Bodies = __webpack_require__(59); var Class = __webpack_require__(0); var Common = __webpack_require__(12); -var Composite = __webpack_require__(63); -var Engine = __webpack_require__(236); -var EventEmitter = __webpack_require__(11); +var Composite = __webpack_require__(69); +var Engine = __webpack_require__(254); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(164); var GetFastValue = __webpack_require__(1); var GetValue = __webpack_require__(4); -var MatterBody = __webpack_require__(25); -var MatterEvents = __webpack_require__(74); -var MatterTileBody = __webpack_require__(151); -var MatterWorld = __webpack_require__(146); -var Vector = __webpack_require__(34); +var MatterBody = __webpack_require__(27); +var MatterEvents = __webpack_require__(79); +var MatterTileBody = __webpack_require__(163); +var MatterWorld = __webpack_require__(158); +var Vector = __webpack_require__(36); /** * @classdesc @@ -55825,8 +58087,8 @@ var World = new Class({ { var x = GetFastValue(boundsConfig, 'x', 0); var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); var thickness = GetFastValue(boundsConfig, 'thickness', 64); var left = GetFastValue(boundsConfig, 'left', true); var right = GetFastValue(boundsConfig, 'right', true); @@ -55967,12 +58229,12 @@ var World = new Class({ MatterEvents.on(engine, 'beforeUpdate', function (event) { - _this.emit('beforeupdate', event); + _this.emit(Events.BEFORE_UPDATE, event); }); MatterEvents.on(engine, 'afterUpdate', function (event) { - _this.emit('afterupdate', event); + _this.emit(Events.AFTER_UPDATE, event); }); MatterEvents.on(engine, 'collisionStart', function (event) @@ -55987,7 +58249,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionstart', event, bodyA, bodyB); + _this.emit(Events.COLLISION_START, event, bodyA, bodyB); }); MatterEvents.on(engine, 'collisionActive', function (event) @@ -56002,7 +58264,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionactive', event, bodyA, bodyB); + _this.emit(Events.COLLISION_ACTIVE, event, bodyA, bodyB); }); MatterEvents.on(engine, 'collisionEnd', function (event) @@ -56017,7 +58279,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionend', event, bodyA, bodyB); + _this.emit(Events.COLLISION_END, event, bodyA, bodyB); }); }, @@ -56048,16 +58310,16 @@ var World = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (thickness === undefined) { thickness = 128; } if (left === undefined) { left = true; } if (right === undefined) { right = true; } if (top === undefined) { top = true; } if (bottom === undefined) { bottom = true; } - this.updateWall(left, 'left', x - thickness, y, thickness, height); - this.updateWall(right, 'right', x + width, y, thickness, height); + this.updateWall(left, 'left', x - thickness, y - thickness, thickness, height + (thickness * 2)); + this.updateWall(right, 'right', x + width, y - thickness, thickness, height + (thickness * 2)); this.updateWall(top, 'top', x, y - thickness, width, thickness); this.updateWall(bottom, 'bottom', x, y + height, width, thickness); @@ -56128,7 +58390,7 @@ var World = new Class({ }, /** - * [description] + * Sets the world's gravity and gravity scale to 0. * * @method Phaser.Physics.Matter.World#disableGravity * @since 3.0.0 @@ -56145,13 +58407,13 @@ var World = new Class({ }, /** - * [description] + * Sets the world's gravity * * @method Phaser.Physics.Matter.World#setGravity * @since 3.0.0 * - * @param {number} [x=0] - [description] - * @param {number} [y=1] - [description] + * @param {number} [x=0] - The world gravity x component. + * @param {number} [y=1] - The world gravity y component. * @param {number} [scale] - [description] * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -56196,7 +58458,7 @@ var World = new Class({ }, /** - * [description] + * Adds an object to the world. * * @method Phaser.Physics.Matter.World#add * @since 3.0.0 @@ -56227,7 +58489,7 @@ var World = new Class({ { var body = (object.body) ? object.body : object; - Composite.removeBody(this.localWorld, body, deep); + Composite.remove(this.localWorld, body, deep); return this; }, @@ -56266,7 +58528,7 @@ var World = new Class({ convertTilemapLayer: function (tilemapLayer, options) { var layerData = tilemapLayer.layer; - var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, {isColliding: true}); + var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, { isColliding: true }); this.convertTiles(tiles, options); @@ -56321,7 +58583,7 @@ var World = new Class({ * @method Phaser.Physics.Matter.World#nextCategory * @since 3.0.0 * - * @return {number} [description] + * @return {number} Returns the next unique category bitfield. */ nextCategory: function () { @@ -56332,6 +58594,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Matter.World#pause + * @fires Phaser.Physics.Matter.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -56340,7 +58603,7 @@ var World = new Class({ { this.enabled = false; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -56349,6 +58612,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Matter.World#resume + * @fires Phaser.Physics.Matter.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -56357,7 +58621,7 @@ var World = new Class({ { this.enabled = true; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -56803,7 +59067,8 @@ var World = new Class({ }, /** - * [description] + * Will remove all Matter physics event listeners and clear the matter physics world, + * engine and any debug graphics, if any. * * @method Phaser.Physics.Matter.World#shutdown * @since 3.0.0 @@ -56825,7 +59090,10 @@ var World = new Class({ }, /** - * [description] + * Will remove all Matter physics event listeners and clear the matter physics world, + * engine and any debug graphics, if any. + * + * After destroying the world it cannot be re-used again. * * @method Phaser.Physics.Matter.World#destroy * @since 3.0.0 @@ -56841,7 +59109,7 @@ module.exports = World; /***/ }), -/* 236 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56858,17 +59126,17 @@ var Engine = {}; module.exports = Engine; -var World = __webpack_require__(146); -var Sleeping = __webpack_require__(89); -var Resolver = __webpack_require__(237); -var Pairs = __webpack_require__(238); -var Metrics = __webpack_require__(535); -var Grid = __webpack_require__(239); -var Events = __webpack_require__(74); -var Composite = __webpack_require__(63); -var Constraint = __webpack_require__(73); +var World = __webpack_require__(158); +var Sleeping = __webpack_require__(95); +var Resolver = __webpack_require__(255); +var Pairs = __webpack_require__(256); +var Metrics = __webpack_require__(577); +var Grid = __webpack_require__(257); +var Events = __webpack_require__(79); +var Composite = __webpack_require__(69); +var Constraint = __webpack_require__(78); var Common = __webpack_require__(12); -var Body = __webpack_require__(25); +var Body = __webpack_require__(27); (function() { @@ -57354,7 +59622,7 @@ var Body = __webpack_require__(25); /***/ }), -/* 237 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57367,10 +59635,10 @@ var Resolver = {}; module.exports = Resolver; -var Vertices = __webpack_require__(29); -var Vector = __webpack_require__(34); +var Vertices = __webpack_require__(31); +var Vector = __webpack_require__(36); var Common = __webpack_require__(12); -var Bounds = __webpack_require__(33); +var Bounds = __webpack_require__(35); (function() { @@ -57710,7 +59978,7 @@ var Bounds = __webpack_require__(33); /***/ }), -/* 238 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57723,7 +59991,7 @@ var Pairs = {}; module.exports = Pairs; -var Pair = __webpack_require__(112); +var Pair = __webpack_require__(119); var Common = __webpack_require__(12); (function() { @@ -57875,7 +60143,7 @@ var Common = __webpack_require__(12); /***/ }), -/* 239 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57888,8 +60156,8 @@ var Grid = {}; module.exports = Grid; -var Pair = __webpack_require__(112); -var Detector = __webpack_require__(150); +var Pair = __webpack_require__(119); +var Detector = __webpack_require__(162); var Common = __webpack_require__(12); (function() { @@ -58202,7 +60470,7 @@ var Common = __webpack_require__(12); /***/ }), -/* 240 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58215,7 +60483,7 @@ var Matter = {}; module.exports = Matter; -var Plugin = __webpack_require__(147); +var Plugin = __webpack_require__(159); var Common = __webpack_require__(12); (function() { @@ -58294,22 +60562,22 @@ var Common = __webpack_require__(12); /***/ }), -/* 241 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AnimationComponent = __webpack_require__(437); +var AnimationComponent = __webpack_require__(473); var Class = __webpack_require__(0); -var Components = __webpack_require__(113); -var GameObject = __webpack_require__(17); +var Components = __webpack_require__(120); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(1); -var Pipeline = __webpack_require__(133); -var Sprite = __webpack_require__(57); +var Pipeline = __webpack_require__(144); +var Sprite = __webpack_require__(61); var Vector2 = __webpack_require__(3); /** @@ -58388,7 +60656,7 @@ var MatterSprite = new Class({ function MatterSprite (world, x, y, texture, frame, options) { - GameObject.call(this, world.scene, 'Image'); + GameObject.call(this, world.scene, 'Sprite'); this.anims = new AnimationComponent(this); @@ -58437,21 +60705,21 @@ module.exports = MatterSprite; /***/ }), -/* 242 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(113); -var GameObject = __webpack_require__(17); +var Components = __webpack_require__(120); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(1); -var Image = __webpack_require__(78); -var Pipeline = __webpack_require__(133); +var Image = __webpack_require__(83); +var Pipeline = __webpack_require__(144); var Vector2 = __webpack_require__(3); /** @@ -58574,7 +60842,7 @@ module.exports = MatterImage; /***/ }), -/* 243 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58590,11 +60858,11 @@ var Composites = {}; module.exports = Composites; -var Composite = __webpack_require__(63); -var Constraint = __webpack_require__(73); +var Composite = __webpack_require__(69); +var Constraint = __webpack_require__(78); var Common = __webpack_require__(12); -var Body = __webpack_require__(25); -var Bodies = __webpack_require__(55); +var Body = __webpack_require__(27); +var Bodies = __webpack_require__(59); (function() { @@ -58907,7 +61175,7 @@ var Bodies = __webpack_require__(55); /***/ }), -/* 244 */ +/* 262 */ /***/ (function(module, exports) { /** @@ -59577,35 +61845,35 @@ function points_eq(a,b,precision){ /***/ }), -/* 245 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(55); +var Bodies = __webpack_require__(59); var Class = __webpack_require__(0); -var Composites = __webpack_require__(243); -var Constraint = __webpack_require__(73); -var MatterGameObject = __webpack_require__(551); -var MatterImage = __webpack_require__(242); -var MatterSprite = __webpack_require__(241); -var MatterTileBody = __webpack_require__(151); -var PointerConstraint = __webpack_require__(537); +var Composites = __webpack_require__(261); +var Constraint = __webpack_require__(78); +var MatterGameObject = __webpack_require__(605); +var MatterImage = __webpack_require__(260); +var MatterSprite = __webpack_require__(259); +var MatterTileBody = __webpack_require__(163); +var PointerConstraint = __webpack_require__(579); /** * @classdesc - * [description] + * The Matter Factory can create different types of bodies and them to a physics world. * * @class Factory * @memberof Phaser.Physics.Matter * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Matter.World} world - [description] + * @param {Phaser.Physics.Matter.World} world - The Matter World which this Factory adds to. */ var Factory = new Class({ @@ -59614,7 +61882,7 @@ var Factory = new Class({ function Factory (world) { /** - * [description] + * The Matter World which this Factory adds to. * * @name Phaser.Physics.Matter.Factory#world * @type {Phaser.Physics.Matter.World} @@ -59623,7 +61891,7 @@ var Factory = new Class({ this.world = world; /** - * [description] + * The Scene which this Factory's Matter World belongs to. * * @name Phaser.Physics.Matter.Factory#scene * @type {Phaser.Scene} @@ -59642,16 +61910,16 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid rectangular Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#rectangle * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {object} options - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} width - The width of the Body. + * @param {number} height - The height of the Body. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -59665,17 +61933,17 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid trapezoidal Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#trapezoid * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} slope - [description] - * @param {object} options - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} width - The width of the trapezoid of the Body. + * @param {number} height - The height of the trapezoid of the Body. + * @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -59689,16 +61957,16 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid circular Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#circle * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} radius - [description] - * @param {object} options - [description] - * @param {number} maxSides - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} radius - The radius of the circle. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. + * @param {number} maxSides - The maximum amount of sides to use for the polygon which will approximate this circle. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -59712,16 +61980,16 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid polygonal Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#polygon * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} sides - [description] - * @param {number} radius - [description] - * @param {object} options - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} sides - The number of sides the polygon will have. + * @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -59735,18 +62003,19 @@ var Factory = new Class({ }, /** - * [description] + * Creates a body using the supplied vertices (or an array containing multiple sets of vertices) and adds it to the World. + * If the vertices are convex, they will pass through as supplied. Otherwise, if the vertices are concave, they will be decomposed. Note that this process is not guaranteed to support complex sets of vertices, e.g. ones with holes. * * @method Phaser.Physics.Matter.Factory#fromVertices * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. * @param {array} vertexSets - [description] * @param {object} options - [description] - * @param {boolean} flagInternal - [description] - * @param {boolean} removeCollinear - [description] - * @param {number} minimumArea - [description] + * @param {boolean} flagInternal - Flag internal edges (coincident part edges) + * @param {boolean} removeCollinear - Whether Matter.js will discard collinear edges (to improve performance). + * @param {number} minimumArea - During decomposition discard parts that have an area less than this * * @return {MatterJS.Body} A Matter JS Body. */ @@ -59842,7 +62111,7 @@ var Factory = new Class({ * @param {number} rows - The number of rows in the pyramid. * @param {number} columnGap - The distance between each column. * @param {number} rowGap - The distance between each row. - * @param {function} callback - [description] + * @param {function} callback - The callback function to be invoked. * * @return {MatterJS.Composite} A Matter JS Composite pyramid. */ @@ -59953,7 +62222,7 @@ var Factory = new Class({ * @param {number} columnGap - The distance between each column. * @param {number} rowGap - The distance between each row. * @param {boolean} crossBrace - [description] - * @param {number} particleRadius - [description] + * @param {number} particleRadius - The radius of this circlular composite. * @param {object} particleOptions - [description] * @param {object} constraintOptions - [description] * @@ -59993,10 +62262,10 @@ var Factory = new Class({ * @method Phaser.Physics.Matter.Factory#spring * @since 3.0.0 * - * @param {MatterJS.Body} bodyA - [description] - * @param {MatterJS.Body} bodyB - [description] - * @param {number} length - [description] - * @param {number} [stiffness=1] - [description] + * @param {MatterJS.Body} bodyA - The first possible `Body` that this constraint is attached to. + * @param {MatterJS.Body} bodyB - The second possible `Body` that this constraint is attached to. + * @param {number} length - 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` + * @param {number} [stiffness=1] - 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 as a soft spring. * @param {object} [options={}] - [description] * * @return {MatterJS.Constraint} A Matter JS Constraint. @@ -60207,26 +62476,27 @@ module.exports = Factory; /***/ }), -/* 246 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(252); +var Body = __webpack_require__(270); var Class = __webpack_require__(0); -var COLLIDES = __webpack_require__(91); -var CollisionMap = __webpack_require__(251); -var EventEmitter = __webpack_require__(11); +var COLLIDES = __webpack_require__(97); +var CollisionMap = __webpack_require__(269); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(167); var GetFastValue = __webpack_require__(1); -var HasValue = __webpack_require__(77); -var Set = __webpack_require__(96); -var Solver = __webpack_require__(555); -var TILEMAP_FORMATS = __webpack_require__(30); -var TYPE = __webpack_require__(90); +var HasValue = __webpack_require__(82); +var Set = __webpack_require__(102); +var Solver = __webpack_require__(609); +var TILEMAP_FORMATS = __webpack_require__(32); +var TYPE = __webpack_require__(96); /** * @typedef {object} Phaser.Physics.Impact.WorldConfig @@ -60293,7 +62563,7 @@ var TYPE = __webpack_require__(90); * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene to which this Impact World instance belongs. * @param {Phaser.Physics.Impact.WorldConfig} config - [description] */ var World = new Class({ @@ -60464,8 +62734,8 @@ var World = new Class({ { var x = GetFastValue(boundsConfig, 'x', 0); var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); var thickness = GetFastValue(boundsConfig, 'thickness', 64); var left = GetFastValue(boundsConfig, 'left', true); var right = GetFastValue(boundsConfig, 'right', true); @@ -60536,6 +62806,20 @@ var World = new Class({ return this.collisionMap; }, + /** + * @typedef {object} CollisionOptions + * + * @property {string} [slopeTileProperty=null] - Slope IDs can be stored on tiles directly + * using Impacts tileset editor. If a tile has a property with the given slopeTileProperty string + * name, the value of that property for the tile will be used for its slope mapping. E.g. a 45 + * degree slope upward could be given a "slope" property with a value of 2. + * @property {object} [slopeMap=null] - A tile index to slope definition map. + * @property {integer} [defaultCollidingSlope=null] - If specified, the default slope ID to + * assign to a colliding tile. If not specified, the tile's index is used. + * @property {integer} [defaultNonCollidingSlope=0] - The default slope ID to assign to a + * non-colliding tile. + */ + /** * Sets the collision map for the world from a tilemap layer. Only tiles that are marked as * colliding will be used. You can specify the mapping from tiles to slope IDs in a couple of @@ -60546,16 +62830,7 @@ var World = new Class({ * @since 3.0.0 * * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemap layer to use. - * @param {object} [options] - Options for controlling the mapping from tiles to slope IDs. - * @param {string} [options.slopeTileProperty=null] - Slope IDs can be stored on tiles directly - * using Tiled's tileset editor. If a tile has a property with the given slopeTileProperty string - * name, the value of that property for the tile will be used for its slope mapping. E.g. a 45 - * degree slope upward could be given a "slope" property with a value of 2. - * @param {object} [options.slopeMap=null] - A tile index to slope definition map. - * @param {integer} [options.defaultCollidingSlope=null] - If specified, the default slope ID to - * assign to a colliding tile. If not specified, the tile's index is used. - * @param {integer} [options.defaultNonCollidingSlope=0] - The default slope ID to assign to a - * non-colliding tile. + * @param {CollisionOptions} [options] - Options for controlling the mapping from tiles to slope IDs. * * @return {Phaser.Physics.Impact.CollisionMap} The newly created CollisionMap. */ @@ -60637,8 +62912,8 @@ var World = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (thickness === undefined) { thickness = 64; } if (left === undefined) { left = true; } if (right === undefined) { right = true; } @@ -60768,6 +63043,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Impact.World#pause + * @fires Phaser.Physics.Impact.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Impact.World} This World object. @@ -60776,7 +63052,7 @@ var World = new Class({ { this.enabled = false; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -60785,6 +63061,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Impact.World#resume + * @fires Phaser.Physics.Impact.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Impact.World} This World object. @@ -60793,7 +63070,7 @@ var World = new Class({ { this.enabled = true; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -61253,18 +63530,18 @@ module.exports = World; /***/ }), -/* 247 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(153); -var Sprite = __webpack_require__(57); +var Components = __webpack_require__(166); +var Sprite = __webpack_require__(61); /** * @classdesc @@ -61415,18 +63692,18 @@ module.exports = ImpactSprite; /***/ }), -/* 248 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(153); -var Image = __webpack_require__(78); +var Components = __webpack_require__(166); +var Image = __webpack_require__(83); /** * @classdesc @@ -61470,7 +63747,7 @@ var Image = __webpack_require__(78); * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * - * @param {Phaser.Physics.Impact.World} world - [description] + * @param {Phaser.Physics.Impact.World} world - The physics world of the Impact physics system. * @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. @@ -61502,7 +63779,7 @@ var ImpactImage = new Class({ Image.call(this, world.scene, x, y, texture, frame); /** - * [description] + * The Physics Body linked to an ImpactImage. * * @name Phaser.Physics.Impact.ImpactImage#body * @type {Phaser.Physics.Impact.Body} @@ -61514,7 +63791,7 @@ var ImpactImage = new Class({ this.body.gameObject = this; /** - * [description] + * The size of the physics Body. * * @name Phaser.Physics.Impact.ImpactImage#size * @type {{x: number, y: number}} @@ -61523,7 +63800,7 @@ var ImpactImage = new Class({ this.size = this.body.size; /** - * [description] + * The X and Y offset of the Body from the left and top of the Image. * * @name Phaser.Physics.Impact.ImpactImage#offset * @type {{x: number, y: number}} @@ -61532,7 +63809,7 @@ var ImpactImage = new Class({ this.offset = this.body.offset; /** - * [description] + * The velocity, or rate of change the Body's position. Measured in pixels per second. * * @name Phaser.Physics.Impact.ImpactImage#vel * @type {{x: number, y: number}} @@ -61541,7 +63818,7 @@ var ImpactImage = new Class({ this.vel = this.body.vel; /** - * [description] + * The acceleration is the rate of change of the velocity. Measured in pixels per second squared. * * @name Phaser.Physics.Impact.ImpactImage#accel * @type {{x: number, y: number}} @@ -61550,7 +63827,7 @@ var ImpactImage = new Class({ this.accel = this.body.accel; /** - * [description] + * Friction between colliding bodies. * * @name Phaser.Physics.Impact.ImpactImage#friction * @type {{x: number, y: number}} @@ -61559,7 +63836,7 @@ var ImpactImage = new Class({ this.friction = this.body.friction; /** - * [description] + * The maximum velocity of the body. * * @name Phaser.Physics.Impact.ImpactImage#maxVel * @type {{x: number, y: number}} @@ -61574,17 +63851,17 @@ module.exports = ImpactImage; /***/ }), -/* 249 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(153); +var Components = __webpack_require__(166); /** * @classdesc @@ -61609,9 +63886,9 @@ var Components = __webpack_require__(153); * @extends Phaser.Physics.Impact.Components.Velocity * * @param {Phaser.Physics.Impact.World} world - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] + * @param {number} x - x - The horizontal position of this physics body in the world. + * @param {number} y - y - The vertical position of this physics body in the world. + * @param {number} width - The width of the physics body in the world. * @param {number} height - [description] */ var ImpactBody = new Class({ @@ -61707,19 +63984,19 @@ module.exports = ImpactBody; /***/ }), -/* 250 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var ImpactBody = __webpack_require__(249); -var ImpactImage = __webpack_require__(248); -var ImpactSprite = __webpack_require__(247); +var ImpactBody = __webpack_require__(267); +var ImpactImage = __webpack_require__(266); +var ImpactSprite = __webpack_require__(265); /** * @classdesc @@ -61864,17 +64141,17 @@ module.exports = Factory; /***/ }), -/* 251 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DefaultDefs = __webpack_require__(569); +var DefaultDefs = __webpack_require__(623); /** * @classdesc @@ -62228,20 +64505,20 @@ module.exports = CollisionMap; /***/ }), -/* 252 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var COLLIDES = __webpack_require__(91); -var GetVelocity = __webpack_require__(571); -var TYPE = __webpack_require__(90); -var UpdateMotion = __webpack_require__(570); +var COLLIDES = __webpack_require__(97); +var GetVelocity = __webpack_require__(628); +var TYPE = __webpack_require__(96); +var UpdateMotion = __webpack_require__(627); /** * @callback BodyUpdateCallback @@ -62255,11 +64532,11 @@ var UpdateMotion = __webpack_require__(570); * * @property {string} name - [description] * @property {object} size - [description] - * @property {object} pos - [description] - * @property {object} vel - [description] - * @property {object} accel - [description] - * @property {object} friction - [description] - * @property {object} maxVel - [description] + * @property {object} pos - The entity's position in the game world. + * @property {object} vel - Current velocity in pixels per second. + * @property {object} accel - Current acceleration to be added to the entity's velocity per second. E.g. an entity with a `vel.x` of 0 and `accel.x` of 10 will have a `vel.x` of 100 ten seconds later. + * @property {object} friction - Deceleration to be subtracted from the entity's velocity per second. Only applies if `accel` is 0. + * @property {object} maxVel - The maximum velocity a body can move. * @property {number} gravityFactor - [description] * @property {number} bounciness - [description] * @property {number} minBounceVelocity - [description] @@ -62694,7 +64971,7 @@ var Body = new Class({ }, /** - * [description] + * Determines whether the body collides with the `other` one or not. * * @method Phaser.Physics.Impact.Body#touches * @since 3.0.0 @@ -62737,12 +65014,12 @@ var Body = new Class({ }, /** - * [description] + * Export this body object to JSON. * * @method Phaser.Physics.Impact.Body#toJSON * @since 3.0.0 * - * @return {JSONImpactBody} [description] + * @return {JSONImpactBody} JSON representation of this body object. */ toJSON: function () { @@ -62847,19 +65124,19 @@ module.exports = Body; /***/ }), -/* 253 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircleContains = __webpack_require__(44); +var CircleContains = __webpack_require__(48); var Class = __webpack_require__(0); -var CONST = __webpack_require__(39); -var RectangleContains = __webpack_require__(43); +var CONST = __webpack_require__(42); +var RectangleContains = __webpack_require__(47); var Vector2 = __webpack_require__(3); /** @@ -62878,8 +65155,8 @@ var Vector2 = __webpack_require__(3); * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - [description] - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Static Body belongs to. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object this Static Body belongs to. */ var StaticBody = new Class({ @@ -62891,7 +65168,7 @@ var StaticBody = new Class({ var height = (gameObject.height) ? gameObject.height : 64; /** - * [description] + * The Arcade Physics simulation this Static Body belongs to. * * @name Phaser.Physics.Arcade.StaticBody#world * @type {Phaser.Physics.Arcade.World} @@ -62900,7 +65177,7 @@ var StaticBody = new Class({ this.world = world; /** - * [description] + * The Game Object this Static Body belongs to. * * @name Phaser.Physics.Arcade.StaticBody#gameObject * @type {Phaser.GameObjects.GameObject} @@ -62909,7 +65186,7 @@ var StaticBody = new Class({ this.gameObject = gameObject; /** - * [description] + * Whether the Static Body's boundary is drawn to the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugShowBody * @type {boolean} @@ -62918,7 +65195,7 @@ var StaticBody = new Class({ this.debugShowBody = world.defaults.debugShowStaticBody; /** - * [description] + * The color of this Static Body on the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor * @type {integer} @@ -62927,7 +65204,7 @@ var StaticBody = new Class({ this.debugBodyColor = world.defaults.staticBodyDebugColor; /** - * [description] + * Whether this Static Body is updated by the physics simulation. * * @name Phaser.Physics.Arcade.StaticBody#enable * @type {boolean} @@ -62937,7 +65214,7 @@ var StaticBody = new Class({ this.enable = true; /** - * [description] + * Whether this Static Body's boundary is circular (`true`) or rectangular (`false`). * * @name Phaser.Physics.Arcade.StaticBody#isCircle * @type {boolean} @@ -62947,7 +65224,8 @@ var StaticBody = new Class({ this.isCircle = false; /** - * [description] + * If this Static Body is circular, this is the unscaled radius of the Static Body's boundary, as set by {@link #setCircle}, in source pixels. + * The true radius is equal to `halfWidth`. * * @name Phaser.Physics.Arcade.StaticBody#radius * @type {number} @@ -62957,7 +65235,9 @@ var StaticBody = new Class({ this.radius = 0; /** - * [description] + * The offset of this Static Body's actual position from any updated position. + * + * Unlike a dynamic Body, a Static Body does not follow its Game Object. As such, this offset is only applied when resizing the Static Body. * * @name Phaser.Physics.Arcade.StaticBody#offset * @type {Phaser.Math.Vector2} @@ -62966,7 +65246,7 @@ var StaticBody = new Class({ this.offset = new Vector2(); /** - * [description] + * The position of this Static Body within the simulation. * * @name Phaser.Physics.Arcade.StaticBody#position * @type {Phaser.Math.Vector2} @@ -62975,7 +65255,8 @@ var StaticBody = new Class({ this.position = new Vector2(gameObject.x - gameObject.displayOriginX, gameObject.y - gameObject.displayOriginY); /** - * [description] + * The width of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. * * @name Phaser.Physics.Arcade.StaticBody#width * @type {number} @@ -62984,7 +65265,8 @@ var StaticBody = new Class({ this.width = width; /** - * [description] + * The height of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. * * @name Phaser.Physics.Arcade.StaticBody#height * @type {number} @@ -62993,7 +65275,8 @@ var StaticBody = new Class({ this.height = height; /** - * [description] + * Half the Static Body's width, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. * * @name Phaser.Physics.Arcade.StaticBody#halfWidth * @type {number} @@ -63002,7 +65285,8 @@ var StaticBody = new Class({ this.halfWidth = Math.abs(this.width / 2); /** - * [description] + * Half the Static Body's height, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. * * @name Phaser.Physics.Arcade.StaticBody#halfHeight * @type {number} @@ -63011,7 +65295,8 @@ var StaticBody = new Class({ this.halfHeight = Math.abs(this.height / 2); /** - * [description] + * The center of the Static Body's boundary. + * This is the midpoint of its `position` (top-left corner) and its bottom-right corner. * * @name Phaser.Physics.Arcade.StaticBody#center * @type {Phaser.Math.Vector2} @@ -63020,7 +65305,7 @@ var StaticBody = new Class({ this.center = new Vector2(gameObject.x + this.halfWidth, gameObject.y + this.halfHeight); /** - * [description] + * A constant zero velocity used by the Arcade Physics simulation for calculations. * * @name Phaser.Physics.Arcade.StaticBody#velocity * @type {Phaser.Math.Vector2} @@ -63030,7 +65315,7 @@ var StaticBody = new Class({ this.velocity = Vector2.ZERO; /** - * [description] + * A constant `false` value expected by the Arcade Physics simulation. * * @name Phaser.Physics.Arcade.StaticBody#allowGravity * @type {boolean} @@ -63063,10 +65348,12 @@ var StaticBody = new Class({ // If true this Body will dispatch events /** - * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary (and `collideWorldBounds` is also true). + * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary and never trigger a `worldbounds` event.) * * @name Phaser.Physics.Arcade.StaticBody#onWorldBounds * @type {boolean} + * @readonly * @default false * @since 3.0.0 */ @@ -63113,7 +65400,7 @@ var StaticBody = new Class({ this.immovable = true; /** - * A flag disabling the default horizontal separation of colliding bodies. Pass your own `processHandler` to the collider. + * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. * * @name Phaser.Physics.Arcade.StaticBody#customSeparateX * @type {boolean} @@ -63123,7 +65410,7 @@ var StaticBody = new Class({ this.customSeparateX = false; /** - * A flag disabling the default vertical separation of colliding bodies. Pass your own `processHandler` to the collider. + * A flag disabling the default vertical separation of colliding bodies. Pass your own `collideHandler` to the collider. * * @name Phaser.Physics.Arcade.StaticBody#customSeparateY * @type {boolean} @@ -63163,7 +65450,7 @@ var StaticBody = new Class({ this.overlapR = 0; /** - * Whether this StaticBody is overlapped with another and both have zero velocity. + * Whether this StaticBody has ever overlapped with another while both were not moving. * * @name Phaser.Physics.Arcade.StaticBody#embedded * @type {boolean} @@ -63174,9 +65461,11 @@ var StaticBody = new Class({ /** * Whether this StaticBody interacts with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary.) * * @name Phaser.Physics.Arcade.StaticBody#collideWorldBounds * @type {boolean} + * @readonly * @default false * @since 3.0.0 */ @@ -63192,7 +65481,7 @@ var StaticBody = new Class({ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; /** - * Whether this StaticBody is colliding with another and in which direction. + * Whether this StaticBody has ever collided with another body and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#touching * @type {ArcadeBodyCollision} @@ -63201,7 +65490,7 @@ var StaticBody = new Class({ this.touching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody was colliding with another during the last step, and in which direction. + * Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#wasTouching * @type {ArcadeBodyCollision} @@ -63210,7 +65499,7 @@ var StaticBody = new Class({ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody is colliding with a tile or the world boundary. + * Whether this StaticBody has ever collided with a tile or the world boundary. * * @name Phaser.Physics.Arcade.StaticBody#blocked * @type {ArcadeBodyCollision} @@ -63223,6 +65512,7 @@ var StaticBody = new Class({ * * @name Phaser.Physics.Arcade.StaticBody#physicsType * @type {integer} + * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ this.physicsType = CONST.STATIC_BODY; @@ -63458,14 +65748,14 @@ var StaticBody = new Class({ }, /** - * Updates this Static Body's position based on the current Game Object it is bound to. + * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. * Similar to `updateFromGameObject`, but doesn't modify the Body's dimensions. * * @method Phaser.Physics.Arcade.StaticBody#reset * @since 3.0.0 * - * @param {number} x - The x coordinate to reset the body to. - * @param {number} y - The y coordinate to reset the body to. + * @param {number} [x] - The x coordinate to reset the body to. If not given will use the parent Game Object's coordinate. + * @param {number} [y] - The y coordinate to reset the body to. If not given will use the parent Game Object's coordinate. */ reset: function (x, y) { @@ -63476,6 +65766,8 @@ var StaticBody = new Class({ this.world.staticTree.remove(this); + gameObject.setPosition(x, y); + gameObject.getTopLeft(this.position); this.updateCenter(); @@ -63574,7 +65866,7 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#deltaX * @since 3.0.0 * - * @return {number} Always zero for a Static Body. + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. */ deltaX: function () { @@ -63587,7 +65879,7 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#deltaY * @since 3.0.0 * - * @return {number} 0 + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. */ deltaY: function () { @@ -63595,12 +65887,12 @@ var StaticBody = new Class({ }, /** - * [description] + * The change in this StaticBody's rotation from the previous step. Always zero. * * @method Phaser.Physics.Arcade.StaticBody#deltaZ * @since 3.0.0 * - * @return {number} 0 + * @return {number} The change in this StaticBody's rotation from the previous step. Always zero. */ deltaZ: function () { @@ -63632,10 +65924,22 @@ var StaticBody = new Class({ { var pos = this.position; + var x = pos.x + this.halfWidth; + var y = pos.y + this.halfHeight; + if (this.debugShowBody) { graphic.lineStyle(1, this.debugBodyColor, 1); - graphic.strokeRect(pos.x, pos.y, this.width, this.height); + + if (this.isCircle) + { + graphic.strokeCircle(x, y, this.width / 2); + } + else + { + graphic.strokeRect(pos.x, pos.y, this.width, this.height); + } + } }, @@ -63799,30 +66103,29 @@ module.exports = StaticBody; /***/ }), -/* 254 */ +/* 272 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body. * * @function Phaser.Physics.Arcade.Tilemap.TileIntersectsBody * @since 3.0.0 * - * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - [description] - * @param {Phaser.Physics.Arcade.Body} body - [description] + * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - A rectangle object that defines the tile placement in the world. + * @param {Phaser.Physics.Arcade.Body} body - The body to check for intersection against. * - * @return {boolean} [description] + * @return {boolean} Returns `true` of the tile intersects with the body, otherwise `false`. */ var TileIntersectsBody = function (tileWorldRect, body) { - // Currently, all bodies are treated as rectangles when colliding with a Tile. Eventually, this - // should support circle bodies when those are less buggy in v3. + // Currently, all bodies are treated as rectangles when colliding with a Tile. return !( body.right <= tileWorldRect.left || @@ -63836,16 +66139,16 @@ module.exports = TileIntersectsBody; /***/ }), -/* 255 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var quickselect = __webpack_require__(341); +var quickselect = __webpack_require__(347); /** * @classdesc @@ -64444,12 +66747,12 @@ function multiSelect (arr, left, right, n, compare) module.exports = rbush; /***/ }), -/* 256 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -64457,7 +66760,16 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * A Process Queue maintains three internal lists. + * + * The `pending` list is a selection of items which are due to be made 'active' in the next update. + * The `active` list is a selection of items which are considered active and should be updated. + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. + * + * When new items are added to a Process Queue they are put in a pending data, rather than being added + * immediately the active list. Equally, items that are removed are put into the destroy list, rather than + * being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed + * time, rather than at the time of the request from the API. * * @class ProcessQueue * @memberof Phaser.Structs @@ -64473,7 +66785,7 @@ var ProcessQueue = new Class({ function ProcessQueue () { /** - * [description] + * The `pending` list is a selection of items which are due to be made 'active' in the next update. * * @genericUse {T[]} - [$type] * @@ -64486,7 +66798,7 @@ var ProcessQueue = new Class({ this._pending = []; /** - * [description] + * The `active` list is a selection of items which are considered active and should be updated. * * @genericUse {T[]} - [$type] * @@ -64499,7 +66811,7 @@ var ProcessQueue = new Class({ this._active = []; /** - * [description] + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. * * @genericUse {T[]} - [$type] * @@ -64512,7 +66824,7 @@ var ProcessQueue = new Class({ this._destroy = []; /** - * [description] + * The total number of items awaiting processing. * * @name Phaser.Structs.ProcessQueue#_toProcess * @type {integer} @@ -64524,7 +66836,8 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Adds a new item to the Process Queue. + * The item is added to the pending list and made active in the next update. * * @method Phaser.Structs.ProcessQueue#add * @since 3.0.0 @@ -64532,7 +66845,7 @@ var ProcessQueue = new Class({ * @genericUse {T} - [item] * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] * - * @param {*} item - [description] + * @param {*} item - The item to add to the queue. * * @return {Phaser.Structs.ProcessQueue} This Process Queue object. */ @@ -64546,7 +66859,8 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Removes an item from the Process Queue. + * The item is added to the pending destroy and fully removed in the next update. * * @method Phaser.Structs.ProcessQueue#remove * @since 3.0.0 @@ -64554,7 +66868,7 @@ var ProcessQueue = new Class({ * @genericUse {T} - [item] * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] * - * @param {*} item - [description] + * @param {*} item - The item to be removed from the queue. * * @return {Phaser.Structs.ProcessQueue} This Process Queue object. */ @@ -64568,14 +66882,17 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Update this queue. First it will process any items awaiting destruction, and remove them. + * + * Then it will check to see if there are any items pending insertion, and move them to an + * active state. Finally, it will return a list of active items for further processing. * * @method Phaser.Structs.ProcessQueue#update * @since 3.0.0 * * @genericUse {T[]} - [$return] * - * @return {Array.<*>} [description] + * @return {Array.<*>} A list of active items. */ update: function () { @@ -64627,14 +66944,14 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Returns the current list of active items. * * @method Phaser.Structs.ProcessQueue#getActive * @since 3.0.0 * * @genericUse {T[]} - [$return] * - * @return {Array.<*>} [description] + * @return {Array.<*>} A list of active items. */ getActive: function () { @@ -64642,13 +66959,15 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Immediately destroys this process queue, clearing all of its internal arrays and resetting the process totals. * * @method Phaser.Structs.ProcessQueue#destroy * @since 3.0.0 */ destroy: function () { + this._toProcess = 0; + this._pending = []; this._active = []; this._destroy = []; @@ -64660,29 +66979,30 @@ module.exports = ProcessQueue; /***/ }), -/* 257 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(39); +var CONST = __webpack_require__(42); /** - * [description] + * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'. * * @function Phaser.Physics.Arcade.GetOverlapY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). * - * @return {number} [description] + * @return {number} The amount of overlap. */ var GetOverlapY = function (body1, body2, overlapOnly, bias) { @@ -64767,29 +67087,30 @@ module.exports = GetOverlapY; /***/ }), -/* 258 */ +/* 276 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(39); +var CONST = __webpack_require__(42); /** - * [description] + * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'. * * @function Phaser.Physics.Arcade.GetOverlapX * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). * - * @return {number} [description] + * @return {number} The amount of overlap. */ var GetOverlapX = function (body1, body2, overlapOnly, bias) { @@ -64874,12 +67195,12 @@ module.exports = GetOverlapX; /***/ }), -/* 259 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -64887,15 +67208,16 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects + * every step. If a collision, or overlap, occurs it will invoke the given callbacks. * * @class Collider * @memberof Phaser.Physics.Arcade * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - [description] - * @param {boolean} overlapOnly - [description] + * @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions. + * @param {boolean} overlapOnly - Whether to check for collisions or overlap. * @param {ArcadeColliderType} object1 - The first object to check for collision. * @param {ArcadeColliderType} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. @@ -64909,7 +67231,7 @@ var Collider = new Class({ function Collider (world, overlapOnly, object1, object2, collideCallback, processCallback, callbackContext) { /** - * [description] + * The world in which the bodies will collide. * * @name Phaser.Physics.Arcade.Collider#world * @type {Phaser.Physics.Arcade.World} @@ -64918,7 +67240,7 @@ var Collider = new Class({ this.world = world; /** - * [description] + * The name of the collider (unused by Phaser). * * @name Phaser.Physics.Arcade.Collider#name * @type {string} @@ -64927,7 +67249,7 @@ var Collider = new Class({ this.name = ''; /** - * [description] + * Whether the collider is active. * * @name Phaser.Physics.Arcade.Collider#active * @type {boolean} @@ -64937,7 +67259,7 @@ var Collider = new Class({ this.active = true; /** - * [description] + * Whether to check for collisions or overlaps. * * @name Phaser.Physics.Arcade.Collider#overlapOnly * @type {boolean} @@ -64946,7 +67268,7 @@ var Collider = new Class({ this.overlapOnly = overlapOnly; /** - * [description] + * The first object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object1 * @type {ArcadeColliderType} @@ -64955,7 +67277,7 @@ var Collider = new Class({ this.object1 = object1; /** - * [description] + * The second object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object2 * @type {ArcadeColliderType} @@ -64964,7 +67286,7 @@ var Collider = new Class({ this.object2 = object2; /** - * [description] + * The callback to invoke when the two objects collide. * * @name Phaser.Physics.Arcade.Collider#collideCallback * @type {ArcadePhysicsCallback} @@ -64973,7 +67295,7 @@ var Collider = new Class({ this.collideCallback = collideCallback; /** - * [description] + * If a processCallback exists it must return true or collision checking will be skipped. * * @name Phaser.Physics.Arcade.Collider#processCallback * @type {ArcadePhysicsCallback} @@ -64982,7 +67304,7 @@ var Collider = new Class({ this.processCallback = processCallback; /** - * [description] + * The context the collideCallback and processCallback will run in. * * @name Phaser.Physics.Arcade.Collider#callbackContext * @type {object} @@ -64992,14 +67314,16 @@ var Collider = new Class({ }, /** - * [description] + * A name for the Collider. + * + * Phaser does not use this value, it's for your own reference. * * @method Phaser.Physics.Arcade.Collider#setName * @since 3.1.0 * - * @param {string} name - [description] + * @param {string} name - The name to assign to the Collider. * - * @return {Phaser.Physics.Arcade.Collider} [description] + * @return {Phaser.Physics.Arcade.Collider} This Collider instance. */ setName: function (name) { @@ -65009,7 +67333,7 @@ var Collider = new Class({ }, /** - * [description] + * Called by World as part of its step processing, initial operation of collision checking. * * @method Phaser.Physics.Arcade.Collider#update * @since 3.0.0 @@ -65027,7 +67351,7 @@ var Collider = new Class({ }, /** - * [description] + * Removes Collider from World and disposes of its resources. * * @method Phaser.Physics.Arcade.Collider#destroy * @since 3.0.0 @@ -65054,21 +67378,49 @@ module.exports = Collider; /***/ }), -/* 260 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircleContains = __webpack_require__(44); +/** + * @namespace Phaser.Physics.Arcade.Events + */ + +module.exports = { + + COLLIDE: __webpack_require__(644), + OVERLAP: __webpack_require__(643), + PAUSE: __webpack_require__(642), + RESUME: __webpack_require__(641), + TILE_COLLIDE: __webpack_require__(640), + TILE_OVERLAP: __webpack_require__(639), + WORLD_BOUNDS: __webpack_require__(638) + +}; + + +/***/ }), +/* 279 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CircleContains = __webpack_require__(48); var Class = __webpack_require__(0); -var CONST = __webpack_require__(39); -var RadToDeg = __webpack_require__(190); -var Rectangle = __webpack_require__(10); -var RectangleContains = __webpack_require__(43); +var CONST = __webpack_require__(42); +var Events = __webpack_require__(278); +var RadToDeg = __webpack_require__(203); +var Rectangle = __webpack_require__(11); +var RectangleContains = __webpack_require__(47); var Vector2 = __webpack_require__(3); /** @@ -65460,7 +67812,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:worldbounds + * @see Phaser.Physics.Arcade.World#worldboundsEvent */ this.onWorldBounds = false; @@ -65471,7 +67823,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:collide + * @see Phaser.Physics.Arcade.World#collideEvent */ this.onCollide = false; @@ -65482,7 +67834,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:overlap + * @see Phaser.Physics.Arcade.World#overlapEvent */ this.onOverlap = false; @@ -65496,6 +67848,19 @@ var Body = new Class({ */ this.maxVelocity = new Vector2(10000, 10000); + /** + * The maximum speed this Body is allowed to reach. + * + * If not negative it limits the scalar value of speed. + * + * Any negative value means no maximum is being applied. + * + * @name Phaser.Physics.Arcade.Body#maxSpeed + * @type {number} + * @since 3.16.0 + */ + this.maxSpeed = -1; + /** * If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1. * The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all. @@ -65682,7 +68047,7 @@ var Body = new Class({ this.overlapR = 0; /** - * Whether this Body is overlapped with another and both have zero velocity. + * Whether this Body is overlapped with another and both are not moving. * * @name Phaser.Physics.Arcade.Body#embedded * @type {boolean} @@ -65703,7 +68068,7 @@ var Body = new Class({ /** * Whether this Body is checked for collisions and for which directions. - * You can set `checkCollision.none = false` to disable collision checks. + * You can set `checkCollision.none = true` to disable collision checks. * * @name Phaser.Physics.Arcade.Body#checkCollision * @type {ArcadeBodyCollision} @@ -65777,6 +68142,7 @@ var Body = new Class({ * @name Phaser.Physics.Arcade.Body#physicsType * @type {integer} * @readonly + * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ this.physicsType = CONST.DYNAMIC_BODY; @@ -65846,7 +68212,8 @@ var Body = new Class({ }, /** - * Updates this Body's transform, dimensions, and position from its Game Object. + * Updates the Body's `transform`, `width`, `height`, and `center` from its Game Object. + * The Body's `position` isn't changed. * * @method Phaser.Physics.Arcade.Body#updateBounds * @since 3.0.0 @@ -65933,7 +68300,7 @@ var Body = new Class({ * @fires Phaser.Physics.Arcade.World#worldbounds * @since 3.0.0 * - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} delta - The delta time, in seconds, elapsed since the last frame. */ update: function (delta) { @@ -66003,7 +68370,7 @@ var Body = new Class({ if (this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds) { - this.world.emit('worldbounds', this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); + this.world.emit(Events.WORLD_BOUNDS, this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); } } @@ -66454,7 +68821,10 @@ var Body = new Class({ { this.enable = false; - this.world.pendingDestroy.set(this); + if (this.world) + { + this.world.pendingDestroy.set(this); + } }, /** @@ -66474,7 +68844,7 @@ var Body = new Class({ if (this.debugShowBody) { - graphic.lineStyle(1, this.debugBodyColor); + graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor); if (this.isCircle) { @@ -66488,7 +68858,7 @@ var Body = new Class({ if (this.debugShowVelocity) { - graphic.lineStyle(1, this.world.defaults.velocityDebugColor, 1); + graphic.lineStyle(graphic.defaultStrokeWidth, this.world.defaults.velocityDebugColor, 1); graphic.lineBetween(x, y, x + this.velocity.x / 2, y + this.velocity.y / 2); } }, @@ -66607,6 +68977,23 @@ var Body = new Class({ return this; }, + /** + * Sets the maximum speed the Body can move. + * + * @method Phaser.Physics.Arcade.Body#setMaxSpeed + * @since 3.16.0 + * + * @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxSpeed: function (value) + { + this.maxSpeed = value; + + return this; + }, + /** * Sets the Body's bounce. * @@ -67149,74 +69536,42 @@ module.exports = Body; /***/ }), -/* 261 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(260); +var Body = __webpack_require__(279); var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); -var Collider = __webpack_require__(259); -var CONST = __webpack_require__(39); -var DistanceBetween = __webpack_require__(58); -var EventEmitter = __webpack_require__(11); -var FuzzyEqual = __webpack_require__(276); -var FuzzyGreaterThan = __webpack_require__(275); -var FuzzyLessThan = __webpack_require__(274); -var GetOverlapX = __webpack_require__(258); -var GetOverlapY = __webpack_require__(257); +var Collider = __webpack_require__(277); +var CONST = __webpack_require__(42); +var DistanceBetween = __webpack_require__(62); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(278); +var FuzzyEqual = __webpack_require__(206); +var FuzzyGreaterThan = __webpack_require__(421); +var FuzzyLessThan = __webpack_require__(420); +var GetOverlapX = __webpack_require__(276); +var GetOverlapY = __webpack_require__(275); var GetValue = __webpack_require__(4); -var ProcessQueue = __webpack_require__(256); -var ProcessTileCallbacks = __webpack_require__(580); -var Rectangle = __webpack_require__(10); -var RTree = __webpack_require__(255); -var SeparateTile = __webpack_require__(579); -var SeparateX = __webpack_require__(574); -var SeparateY = __webpack_require__(573); -var Set = __webpack_require__(96); -var StaticBody = __webpack_require__(253); -var TileIntersectsBody = __webpack_require__(254); -var TransformMatrix = __webpack_require__(42); +var ProcessQueue = __webpack_require__(274); +var ProcessTileCallbacks = __webpack_require__(637); +var Rectangle = __webpack_require__(11); +var RTree = __webpack_require__(273); +var SeparateTile = __webpack_require__(636); +var SeparateX = __webpack_require__(631); +var SeparateY = __webpack_require__(630); +var Set = __webpack_require__(102); +var StaticBody = __webpack_require__(271); +var TileIntersectsBody = __webpack_require__(272); +var TransformMatrix = __webpack_require__(46); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(59); - -/** - * @event Phaser.Physics.Arcade.World#pause - */ - -/** - * @event Phaser.Physics.Arcade.World#resume - */ - -/** - * @event Phaser.Physics.Arcade.World#collide - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - */ - -/** - * @event Phaser.Physics.Arcade.World#overlap - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - */ - -/** - * @event Phaser.Physics.Arcade.World#worldbounds - * @param {Phaser.Physics.Arcade.Body} body - * @param {boolean} up - * @param {boolean} down - * @param {boolean} left - * @param {boolean} right - */ +var Wrap = __webpack_require__(63); /** * @typedef {object} ArcadeWorldConfig @@ -67253,30 +69608,30 @@ var Wrap = __webpack_require__(59); /** * @typedef {object} CheckCollisionObject * - * @property {boolean} up - [description] - * @property {boolean} down - [description] - * @property {boolean} left - [description] - * @property {boolean} right - [description] + * @property {boolean} up - Will bodies collide with the top side of the world bounds? + * @property {boolean} down - Will bodies collide with the bottom side of the world bounds? + * @property {boolean} left - Will bodies collide with the left side of the world bounds? + * @property {boolean} right - Will bodies collide with the right side of the world bounds? */ /** * @typedef {object} ArcadeWorldDefaults * - * @property {boolean} debugShowBody - [description] - * @property {boolean} debugShowStaticBody - [description] - * @property {boolean} debugShowVelocity - [description] - * @property {number} bodyDebugColor - [description] - * @property {number} staticBodyDebugColor - [description] - * @property {number} velocityDebugColor - [description] + * @property {boolean} debugShowBody - Set to `true` to render dynamic body outlines to the debug display. + * @property {boolean} debugShowStaticBody - Set to `true` to render static body outlines to the debug display. + * @property {boolean} debugShowVelocity - Set to `true` to render body velocity markers to the debug display. + * @property {number} bodyDebugColor - The color of dynamic body outlines when rendered to the debug display. + * @property {number} staticBodyDebugColor - The color of static body outlines when rendered to the debug display. + * @property {number} velocityDebugColor - The color of the velocity markers when rendered to the debug display. */ /** * @typedef {object} ArcadeWorldTreeMinMax * - * @property {number} minX - [description] - * @property {number} minY - [description] - * @property {number} maxX - [description] - * @property {number} maxY - [description] + * @property {number} minX - The minimum x value used in RTree searches. + * @property {number} minY - The minimum y value used in RTree searches. + * @property {number} maxX - The maximum x value used in RTree searches. + * @property {number} maxY - The maximum y value used in RTree searches. */ /** @@ -67364,6 +69719,28 @@ var World = new Class({ */ this.pendingDestroy = new Set(); + /** + * Dynamic Bodies that need a second `update` call to resynchronize their Game Objects. + * This set is filled only when the `_late` flag is on, and is processed and cleared during `postUpdate`. + * + * @name Phaser.Physics.Arcade.World#late + * @type {Phaser.Structs.Set.} + * @private + * @since 3.16.0 + */ + this.late = new Set(); + + /** + * A flag allowing the `late` set to be filled, as appropriate. + * This is on (true) only between `update` and `postUpdate` and false at other times. + * + * @name Phaser.Physics.Arcade.World#_late + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._late = false; + /** * This simulation's collision processors. * @@ -67392,8 +69769,8 @@ var World = new Class({ this.bounds = new Rectangle( GetValue(config, 'x', 0), GetValue(config, 'y', 0), - GetValue(config, 'width', scene.sys.game.config.width), - GetValue(config, 'height', scene.sys.game.config.height) + GetValue(config, 'width', scene.sys.scale.width), + GetValue(config, 'height', scene.sys.scale.height) ); /** @@ -67898,6 +70275,7 @@ var World = new Class({ { this.tree.remove(body); this.bodies.delete(body); + this.late.delete(body); } else if (body.physicsType === CONST.STATIC_BODY) { @@ -68007,7 +70385,7 @@ var World = new Class({ * checks. * * @method Phaser.Physics.Arcade.World#pause - * @fires Phaser.Physics.Arcade.World#pause + * @fires Phaser.Physics.Arcade.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -68016,7 +70394,7 @@ var World = new Class({ { this.isPaused = true; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -68025,7 +70403,7 @@ var World = new Class({ * Resumes the simulation, if paused. * * @method Phaser.Physics.Arcade.World#resume - * @fires Phaser.Physics.Arcade.World#resume + * @fires Phaser.Physics.Arcade.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -68034,7 +70412,7 @@ var World = new Class({ { this.isPaused = false; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -68186,6 +70564,7 @@ var World = new Class({ var msPerFrame = this._frameTimeMS * this.timeScale; this._elapsed += delta; + this._late = false; while (this._elapsed >= msPerFrame) { @@ -68197,15 +70576,16 @@ var World = new Class({ } this.stepsLastFrame = stepsThisFrame; + this._late = true; }, /** - * Advances the simulation by one step. + * Advances the simulation by a time increment. * * @method Phaser.Physics.Arcade.World#step * @since 3.10.0 * - * @param {number} delta - The delta time amount, in ms, by which to advance the simulation. + * @param {number} delta - The delta time amount, in seconds, by which to advance the simulation. */ step: function (delta) { @@ -68267,14 +70647,37 @@ var World = new Class({ postUpdate: function () { var i; + var bodies; var body; + var len; var dynamic = this.bodies; var staticBodies = this.staticBodies; var pending = this.pendingDestroy; + var late = this.late; - var bodies = dynamic.entries; - var len = bodies.length; + if (late.size > 0) + { + bodies = late.entries; + len = bodies.length; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.postUpdate(); + } + } + + late.clear(); + } + + this._late = false; + + bodies = dynamic.entries; + len = bodies.length; if (this.drawDebug) { @@ -68322,6 +70725,7 @@ var World = new Class({ { dynamicTree.remove(body); dynamic.delete(body); + late.delete(body); } else if (body.physicsType === CONST.STATIC_BODY) { @@ -68344,7 +70748,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to be updated. - * @param {number} delta - The delta value to be used in the motion calculations. + * @param {number} delta - The delta value to be used in the motion calculations, in seconds. */ updateMotion: function (body, delta) { @@ -68363,7 +70767,7 @@ var World = new Class({ * @since 3.10.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation. + * @param {number} delta - The delta value to be used in the calculation, in seconds. */ computeAngularVelocity: function (body, delta) { @@ -68409,7 +70813,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation. + * @param {number} delta - The delta value to be used in the calculation, in seconds. */ computeVelocity: function (body, delta) { @@ -68424,6 +70828,7 @@ var World = new Class({ var maxY = body.maxVelocity.y; var speed = body.speed; + var maxSpeed = body.maxSpeed; var allowDrag = body.allowDrag; var useDamping = body.useDamping; @@ -68509,14 +70914,19 @@ var World = new Class({ velocityY = Clamp(velocityY, -maxY, maxY); body.velocity.set(velocityX, velocityY); + + if (maxSpeed > -1 && body.velocity.length() > maxSpeed) + { + body.velocity.normalize().scale(maxSpeed); + } }, /** * Separates two Bodies. * * @method Phaser.Physics.Arcade.World#separate - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. @@ -68607,18 +71017,24 @@ var World = new Class({ if (result) { - if (overlapOnly && (body1.onOverlap || body2.onOverlap)) + if (overlapOnly) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + if (body1.onOverlap || body2.onOverlap) + { + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); + } } else { - body1.postUpdate(); - body2.postUpdate(); + if (this._late) + { + this.late.set(body1); + this.late.set(body2); + } if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } } } @@ -68630,14 +71046,14 @@ var World = new Class({ * Separates two Bodies, when both are circular. * * @method Phaser.Physics.Arcade.World#separateCircle - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. * @param {boolean} [overlapOnly] - If this a collide or overlap check? - * @param {number} bias - A small value added to the calculations. + * @param {number} [bias] - A small value added to the calculations. * * @return {boolean} True if separation occurred, otherwise false. */ @@ -68704,7 +71120,7 @@ var World = new Class({ { if (overlap !== 0 && (body1.onOverlap || body2.onOverlap)) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); } // return true if there was some overlap, otherwise false @@ -68816,7 +71232,7 @@ var World = new Class({ if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } // sync changes back to the bodies @@ -68944,9 +71360,9 @@ var World = new Class({ * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {*} [callbackContext] - The context in which to run the callbacks. + * @param {any} [callbackContext] - The context in which to run the callbacks. * - * @return {boolean} True if any overlapping Game Objects were separated, otherwise false. + * @return {boolean} `true` if any overlapping Game Objects were separated, otherwise `false`. */ collide: function (object1, object2, collideCallback, processCallback, callbackContext) { @@ -68958,16 +71374,17 @@ var World = new Class({ }, /** - * Helper for Phaser.Physics.Arcade.World#collide. + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideObjects + * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - [description] - * @param {ArcadeColliderType} [object2] - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {ArcadeColliderType} object1 - The first object to check for collision. + * @param {ArcadeColliderType} object2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -69028,16 +71445,17 @@ var World = new Class({ }, /** - * Helper for Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap. + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap instead. * * @method Phaser.Physics.Arcade.World#collideHandler + * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - [description] - * @param {ArcadeColliderType} [object2] - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. + * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -69106,19 +71524,21 @@ var World = new Class({ }, /** - * Handler for Sprite vs. Sprite collisions. + * Internal handler for Sprite vs. Sprite collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsSprite + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite1 - [description] - * @param {Phaser.GameObjects.GameObject} sprite2 - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.GameObject} sprite1 - The first object to check for collision. + * @param {Phaser.GameObjects.GameObject} sprite2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -69141,19 +71561,21 @@ var World = new Class({ }, /** - * Handler for Sprite vs. Group collisions. + * Internal handler for Sprite vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsGroup + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite - [description] - * @param {Phaser.GameObjects.Group} group - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} `true` if the Sprite collided with the given Group, otherwise `false`. */ collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -69234,19 +71656,21 @@ var World = new Class({ }, /** - * Helper for Group vs. Tilemap collisions. + * Internal handler for Group vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.Group} group - [description] - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.Group} group - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -69274,21 +71698,22 @@ var World = new Class({ }, /** - * Helper for Sprite vs. Tilemap collisions. + * Internal handler for Sprite vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite - [description] - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -69364,11 +71789,11 @@ var World = new Class({ if (overlapOnly && body.onOverlap) { - sprite.emit('overlap', body.gameObject, tile, body, null); + this.emit(Events.TILE_OVERLAP, body.gameObject, tile, body); } else if (body.onCollide) { - sprite.emit('collide', body.gameObject, tile, body, null); + this.emit(Events.TILE_COLLIDE, body.gameObject, tile, body); } // sync changes back to the body @@ -69378,19 +71803,21 @@ var World = new Class({ }, /** - * Helper for Group vs. Group collisions. + * Internal helper for Group vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideGroupVsGroup + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.Group} group1 - [description] - * @param {Phaser.GameObjects.Group} group2 - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.Group} group1 - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -69485,6 +71912,7 @@ var World = new Class({ this.staticTree.clear(); this.bodies.clear(); this.staticBodies.clear(); + this.late.clear(); this.colliders.destroy(); this.removeAllListeners(); @@ -69509,19 +71937,19 @@ module.exports = World; /***/ }), -/* 262 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeSprite = __webpack_require__(114); +var ArcadeSprite = __webpack_require__(121); var Class = __webpack_require__(0); -var CONST = __webpack_require__(39); -var Group = __webpack_require__(97); +var CONST = __webpack_require__(42); +var Group = __webpack_require__(103); var IsPlainObject = __webpack_require__(8); /** @@ -69600,7 +72028,7 @@ var StaticPhysicsGroup = new Class({ * * @name Phaser.Physics.Arcade.StaticGroup#physicsType * @type {integer} - * @default STATIC_BODY + * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ this.physicsType = CONST.STATIC_BODY; @@ -69688,20 +72116,20 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 263 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeSprite = __webpack_require__(114); +var ArcadeSprite = __webpack_require__(121); var Class = __webpack_require__(0); -var CONST = __webpack_require__(39); +var CONST = __webpack_require__(42); var GetFastValue = __webpack_require__(1); -var Group = __webpack_require__(97); +var Group = __webpack_require__(103); var IsPlainObject = __webpack_require__(8); /** @@ -69814,6 +72242,14 @@ var PhysicsGroup = new Class({ singleConfig.removeCallback = this.removeCallbackHandler; }); } + else + { + // config is not defined and children is not a plain object nor an array of plain objects + config = { + createCallback: this.createCallbackHandler, + removeCallback: this.removeCallbackHandler + }; + } /** * The physics simulation. @@ -69825,11 +72261,12 @@ var PhysicsGroup = new Class({ this.world = world; /** - * The class to create new group members from. - * This should be ArcadeImage, ArcadeSprite, or a class extending one of those. + * The class to create new Group members from. + * + * This should be either `Phaser.Physics.Arcade.Image`, `Phaser.Physics.Arcade.Sprite`, or a class extending one of those. * * @name Phaser.Physics.Arcade.Group#classType - * @type {(Phaser.Physics.Arcade.Image|Phaser.Physics.Arcade.Sprite)} + * @type {GroupClassTypeConstructor} * @default ArcadeSprite */ config.classType = GetFastValue(config, 'classType', ArcadeSprite); @@ -69839,7 +72276,7 @@ var PhysicsGroup = new Class({ * * @name Phaser.Physics.Arcade.Group#physicsType * @type {integer} - * @default DYNAMIC_BODY + * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ this.physicsType = CONST.DYNAMIC_BODY; @@ -70000,12 +72437,12 @@ module.exports = PhysicsGroup; /***/ }), -/* 264 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -70015,44 +72452,42 @@ module.exports = PhysicsGroup; module.exports = { - Acceleration: __webpack_require__(592), - Angular: __webpack_require__(591), - Bounce: __webpack_require__(590), - Debug: __webpack_require__(589), - Drag: __webpack_require__(588), - Enable: __webpack_require__(587), - Friction: __webpack_require__(586), - Gravity: __webpack_require__(585), - Immovable: __webpack_require__(584), - Mass: __webpack_require__(583), - Size: __webpack_require__(582), - Velocity: __webpack_require__(581) + Acceleration: __webpack_require__(656), + Angular: __webpack_require__(655), + Bounce: __webpack_require__(654), + Debug: __webpack_require__(653), + Drag: __webpack_require__(652), + Enable: __webpack_require__(651), + Friction: __webpack_require__(650), + Gravity: __webpack_require__(649), + Immovable: __webpack_require__(648), + Mass: __webpack_require__(647), + Size: __webpack_require__(646), + Velocity: __webpack_require__(645) }; /***/ }), -/* 265 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(264); -var Image = __webpack_require__(78); +var Components = __webpack_require__(283); +var Image = __webpack_require__(83); /** * @classdesc - * An Arcade Physics Image Game Object. + * An Arcade Physics Image is an Image with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * 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. + * The main difference between an Arcade Image and an Arcade Sprite is that you cannot animate an Arcade Image. * * @class Image * @extends Phaser.GameObjects.Image @@ -70135,21 +72570,21 @@ module.exports = ArcadeImage; /***/ }), -/* 266 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeImage = __webpack_require__(265); -var ArcadeSprite = __webpack_require__(114); +var ArcadeImage = __webpack_require__(284); +var ArcadeSprite = __webpack_require__(121); var Class = __webpack_require__(0); -var CONST = __webpack_require__(39); -var PhysicsGroup = __webpack_require__(263); -var StaticPhysicsGroup = __webpack_require__(262); +var CONST = __webpack_require__(42); +var PhysicsGroup = __webpack_require__(282); +var StaticPhysicsGroup = __webpack_require__(281); /** * @classdesc @@ -70198,7 +72633,7 @@ var Factory = new Class({ }, /** - * Create a new Arcade Physics Collider object. + * Creates a new Arcade Physics Collider object. * * @method Phaser.Physics.Arcade.Factory#collider * @since 3.0.0 @@ -70217,7 +72652,7 @@ var Factory = new Class({ }, /** - * Create a new Arcade Physics Collider Overlap object. + * Creates a new Arcade Physics Collider Overlap object. * * @method Phaser.Physics.Arcade.Factory#overlap * @since 3.0.0 @@ -70406,3110 +72841,18 @@ module.exports = Factory; /***/ }), -/* 267 */ +/* 286 */ /***/ (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__(154); -var Matrix3 = __webpack_require__(269); - -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 - * A quaternion. - * - * @class Quaternion - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. - */ -var Quaternion = new Class({ - - initialize: - - function Quaternion (x, y, z, w) - { - /** - * The x component of this Quaternion. - * - * @name Phaser.Math.Quaternion#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The y component of this Quaternion. - * - * @name Phaser.Math.Quaternion#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The z component of this Quaternion. - * - * @name Phaser.Math.Quaternion#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The w component of this Quaternion. - * - * @name Phaser.Math.Quaternion#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; - } - }, - - /** - * Copy the components of a given Quaternion or Vector into this Quaternion. - * - * @method Phaser.Math.Quaternion#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; - }, - - /** - * Set the components of this Quaternion. - * - * @method Phaser.Math.Quaternion#set - * @since 3.0.0 - * - * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. - * @param {number} [y=0] - The y component. - * @param {number} [z=0] - The z component. - * @param {number} [w=0] - The w component. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - set: function (x, y, z, w) - { - 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; - }, - - /** - * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. - * - * @method Phaser.Math.Quaternion#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - }, - - /** - * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. - * - * @method Phaser.Math.Quaternion#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - }, - - /** - * Scale this Quaternion by the given value. - * - * @method Phaser.Math.Quaternion#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - - return this; - }, - - /** - * Calculate the length of this Quaternion. - * - * @method Phaser.Math.Quaternion#length - * @since 3.0.0 - * - * @return {number} The length of this Quaternion. - */ - length: function () - { - 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); - }, - - /** - * Calculate the length of this Quaternion squared. - * - * @method Phaser.Math.Quaternion#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Quaternion, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return x * x + y * y + z * z + w * w; - }, - - /** - * Normalize this Quaternion. - * - * @method Phaser.Math.Quaternion#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - - 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; - }, - - /** - * Calculate the dot product of this Quaternion and the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#dot - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. - * - * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, - - /** - * Linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#lerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. - * @param {number} [t=0] - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - lerp: function (v, t) - { - 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; - }, - - /** - * [description] - * - * @method Phaser.Math.Quaternion#rotationTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - [description] - * @param {Phaser.Math.Vector3} b - [description] - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotationTo: function (a, b) - { - 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(); - - 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(); - } - }, - - /** - * Set the axes of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxes - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} view - The view axis. - * @param {Phaser.Math.Vector3} right - The right axis. - * @param {Phaser.Math.Vector3} up - The upwards axis. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxes: function (view, right, up) - { - var m = tmpMat3.val; - - 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(); - }, - - /** - * Reset this Matrix to an identity (default) Quaternion. - * - * @method Phaser.Math.Quaternion#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - identity: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; - }, - - /** - * Set the axis angle of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxisAngle - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} axis - The axis. - * @param {number} rad - The angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxisAngle: function (axis, rad) - { - 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; - }, - - /** - * Multiply this Quaternion by the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - multiply: function (b) - { - 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; - - 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; - }, - - /** - * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#slerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. - * @param {number} t - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - slerp: function (b, t) - { - // 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) - { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; - } - - // "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) - { - // 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; - }, - - /** - * Invert this Quaternion. - * - * @method Phaser.Math.Quaternion#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - invert: 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 - - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; - - return this; - }, - - /** - * Convert this Quaternion into its conjugate. - * - * Sets the x, y and z components. - * - * @method Phaser.Math.Quaternion#conjugate - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - conjugate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Rotate this Quaternion on the X axis. - * - * @method Phaser.Math.Quaternion#rotateX - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateX: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this Quaternion on the Y axis. - * - * @method Phaser.Math.Quaternion#rotateY - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - }, - - /** - * Rotate this Quaternion on the Z axis. - * - * @method Phaser.Math.Quaternion#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateZ: function (rad) - { - 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); - - 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; - }, - - /** - * Create a unit (or rotation) Quaternion from its x, y, and z components. - * - * Sets the w component. - * - * @method Phaser.Math.Quaternion#calculateW - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - calculateW: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); - - return this; - }, - - /** - * Convert the given Matrix into this Quaternion. - * - * @method Phaser.Math.Quaternion#fromMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - - -/***/ }), -/* 268 */ -/***/ (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 EPSILON = 0.000001; - -/** - * @classdesc - * A four-dimensional matrix. - * - * @class Matrix4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. - */ -var Matrix4 = new Class({ - - initialize: - - function Matrix4 (m) - { - /** - * The matrix values. - * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} - * @since 3.0.0 - */ - this.val = new Float32Array(16); - - if (m) - { - // Assume Matrix4 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, - - /** - * Make a clone of this Matrix4. - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} A clone of this Matrix4. - */ - clone: function () - { - return new Matrix4(this); - }, - - // TODO - Should work with basic values - - /** - * This method is an alias for `Matrix4.copy`. - * - * @method Phaser.Math.Matrix4#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - copy: function (src) - { - 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]; - 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; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix4#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromArray: function (a) - { - 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; - }, - - /** - * Reset this Matrix. - * - * Sets all values to `0`. - * - * @method Phaser.Math.Matrix4#zero - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - zero: function () - { - 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; - - return this; - }, - - /** - * Set the `x`, `y` and `z` values of this Matrix. - * - * @method Phaser.Math.Matrix4#xyz - * @since 3.0.0 - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - xyz: function (x, y, z) - { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; - - return this; - }, - - /** - * Set the scaling values of this Matrix. - * - * @method Phaser.Math.Matrix4#scaling - * @since 3.0.0 - * - * @param {number} x - The x scaling value. - * @param {number} y - The y scaling value. - * @param {number} z - The z scaling value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaling: function (x, y, z) - { - this.zero(); - - var out = this.val; - - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; - - return this; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix4#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - identity: function () - { - 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; - - return this; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix4#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - transpose: function () - { - 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; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix4#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - invert: 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 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; - - return this; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix4#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - adjoint: 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)); - - return this; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix4#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: 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 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; - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix4#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiply: function (src) - { - 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; - - 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.Math.Matrix4#multiplyLocal - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - [description] - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiplyLocal: function (src) - { - 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); - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix4#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translate: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - 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; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix4#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scale: 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; - - return this; - }, - - /** - * Derive a rotation matrix around the given axis. - * - * @method Phaser.Math.Matrix4#makeRotationAxis - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. - * @param {number} angle - The rotation angle in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - makeRotationAxis: function (axis, angle) - { - // 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.fromArray([ - 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; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotate: function (rad, axis) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its X axis. - * - * @method Phaser.Math.Matrix4#rotateX - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateX: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its Y axis. - * - * @method Phaser.Math.Matrix4#rotateY - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateY: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its Z axis. - * - * @method Phaser.Math.Matrix4#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateZ: function (rad) - { - 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]; - - // 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; - }, - - /** - * Set the values of this Matrix from the given rotation Quaternion and translation Vector. - * - * @method Phaser.Math.Matrix4#fromRotationTranslation - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. - * @param {Phaser.Math.Vector3} v - The Vector to set translation from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromRotationTranslation: function (q, v) - { - // 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; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = v.x; - out[13] = v.y; - out[14] = v.z; - out[15] = 1; - - return this; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix4#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromQuat: function (q) - { - 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; - - 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[15] = 1; - - return this; - }, - - /** - * Generate a frustum matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#frustum - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - frustum: function (left, right, bottom, top, near, far) - { - 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; - - 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; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspective - * @since 3.0.0 - * - * @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. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspective: function (fovy, aspect, near, far) - { - 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; - - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspectiveLH - * @since 3.0.0 - * - * @param {number} width - The width of the frustum. - * @param {number} height - The height of the frustum. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspectiveLH: function (width, height, near, far) - { - 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; - - out[12] = 0; - out[13] = 0; - out[14] = (near * far) / (near - far); - out[15] = 0; - - return this; - }, - - /** - * Generate an orthogonal projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#ortho - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - ortho: function (left, right, bottom, top, near, far) - { - 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; - - 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; - }, - - /** - * Generate a look-at matrix with the given eye position, focal point, and up axis. - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer - * @param {Phaser.Math.Vector3} center - Point the viewer is looking at - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - lookAt: function (eye, center, up) - { - var out = this.val; - - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; - - var upx = up.x; - var upy = up.y; - var upz = up.z; - - 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(); - } - - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; - - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - - z0 *= len; - z1 *= len; - z2 *= len; - - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; - - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - - if (!len) - { - x0 = 0; - x1 = 0; - x2 = 0; - } - else - { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - - if (!len) - { - y0 = 0; - y1 = 0; - y2 = 0; - } - else - { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - 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; - }, - - /** - * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {number} yaw - [description] - * @param {number} pitch - [description] - * @param {number} roll - [description] - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - yawPitchRoll: function (yaw, pitch, roll) - { - 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; - }, - - /** - * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. - * @param {Phaser.Math.Vector3} position - The position of the world matrix. - * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. - * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. - * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) - { - 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) - { - this.multiplyLocal(viewMatrix); - } - - if (projectionMatrix !== undefined) - { - this.multiplyLocal(projectionMatrix); - } - - return this; - } - -}); - -var _tempMat1 = new Matrix4(); -var _tempMat2 = new Matrix4(); - -module.exports = Matrix4; - - -/***/ }), -/* 269 */ -/***/ (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 - * A three-dimensional matrix. - * - * Defaults to the identity matrix when instantiated. - * - * @class Matrix3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. - */ -var Matrix3 = new Class({ - - initialize: - - function Matrix3 (m) - { - /** - * The matrix values. - * - * @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(); - } - }, - - /** - * Make a clone of this Matrix3. - * - * @method Phaser.Math.Matrix3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} A clone of this Matrix3. - */ - clone: function () - { - return new Matrix3(this); - }, - - /** - * This method is an alias for `Matrix3.copy`. - * - * @method Phaser.Math.Matrix3#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix3#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - copy: function (src) - { - 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; - }, - - /** - * Copy the values of a given Matrix4 into this Matrix3. - * - * @method Phaser.Math.Matrix3#fromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromMat4: function (m) - { - 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; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix3#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromArray: function (a) - { - 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; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix3#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - 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; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix3#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - transpose: function () - { - 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; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix3#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - invert: 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 a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; - - 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; - - if (!det) - { - 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; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix3#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - adjoint: 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 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; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix3#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: 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 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); - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix3#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - multiply: function (src) - { - 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]; - - 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; - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix3#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - translate: function (v) - { - var a = this.val; - var x = v.x; - var y = v.y; - - 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; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix3#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - rotate: function (rad) - { - 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; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x` and `y` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix3#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - scale: function (v) - { - 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; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix3#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromQuat: function (q) - { - 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; - - out[2] = xz + wy; - out[5] = yz - wx; - out[8] = 1 - (xx + yy); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Matrix3#normalFromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - [description] - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - normalFromMat4: function (m) - { - 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; - - 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; - - 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; - - -/***/ }), -/* 270 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. - * - * @function Phaser.Math.Rotate - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. - * @param {number} angle - The angle to be rotated by in an anticlockwise direction. - * - * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. - */ -var Rotate = function (point, angle) -{ - var x = point.x; - var y = point.y; - - point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); - point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); - - return point; -}; - -module.exports = Rotate; - - -/***/ }), -/* 271 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using ceil. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. - * As will `14` snap to `15`... but `16` will snap to `20`. - * - * @function Phaser.Math.Snap.Ceil - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapCeil = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.ceil(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapCeil; - - -/***/ }), -/* 272 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates the factorial of a given number for integer values greater than 0. - * - * @function Phaser.Math.Factorial - * @since 3.0.0 - * - * @param {number} value - A positive integer to calculate the factorial of. - * - * @return {number} The factorial of the given number. - */ -var Factorial = function (value) -{ - if (value === 0) - { - return 1; - } - - var res = value; - - while (--value) - { - res *= value; - } - - return res; -}; - -module.exports = Factorial; - - -/***/ }), -/* 273 */ -/***/ (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 Factorial = __webpack_require__(272); - -/** - * [description] - * - * @function Phaser.Math.Bernstein - * @since 3.0.0 - * - * @param {number} n - [description] - * @param {number} i - [description] - * - * @return {number} [description] - */ -var Bernstein = function (n, i) -{ - return Factorial(n) / Factorial(i) / Factorial(n - i); -}; - -module.exports = Bernstein; - - -/***/ }), -/* 274 */ -/***/ (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 whether `a` is fuzzily less than `b`. - * - * `a` is fuzzily less than `b` if it is less than `b + epsilon`. - * - * @function Phaser.Math.Fuzzy.LessThan - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. - */ -var LessThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a < b + epsilon; -}; - -module.exports = LessThan; - - -/***/ }), -/* 275 */ -/***/ (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 whether `a` is fuzzily greater than `b`. - * - * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. - * - * @function Phaser.Math.Fuzzy.GreaterThan - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. - */ -var GreaterThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a > b - epsilon; -}; - -module.exports = GreaterThan; - - -/***/ }), -/* 276 */ -/***/ (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 whether the given values are fuzzily equal. - * - * Two numbers are fuzzily equal if their difference is less than `epsilon`. - * - * @function Phaser.Math.Fuzzy.Equal - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. - */ -var Equal = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.abs(a - b) < epsilon; -}; - -module.exports = Equal; - - -/***/ }), -/* 277 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points), squared. - * - * @function Phaser.Math.Distance.Squared - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point, squared. - */ -var DistanceSquared = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; - - return dx * dx + dy * dy; -}; - -module.exports = DistanceSquared; - - -/***/ }), -/* 278 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Normalize an angle to the [0, 2pi] range. - * - * @function Phaser.Math.Angle.Normalize - * @since 3.0.0 - * - * @param {number} angle - The angle to normalize, in radians. - * - * @return {number} The normalized angle, in radians. - */ -var Normalize = function (angle) -{ - angle = angle % (2 * Math.PI); - - if (angle >= 0) - { - return angle; - } - else - { - return angle + 2 * Math.PI; - } -}; - -module.exports = Normalize; - - -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -73682,19 +73025,20 @@ module.exports = TextFile; /***/ }), -/* 280 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var File = __webpack_require__(22); +var Events = __webpack_require__(85); +var File = __webpack_require__(23); var GetFastValue = __webpack_require__(1); -var GetURL = __webpack_require__(157); +var GetURL = __webpack_require__(170); var IsPlainObject = __webpack_require__(8); /** @@ -73791,6 +73135,7 @@ var HTML5AudioFile = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.FileTypes.HTML5AudioFile#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 */ onProgress: function (event) @@ -73804,7 +73149,7 @@ var HTML5AudioFile = new Class({ this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); if (this.filesLoaded === this.filesTotal) { @@ -73878,21 +73223,21 @@ module.exports = HTML5AudioFile; /***/ }), -/* 281 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(28); -var File = __webpack_require__(22); +var CONST = __webpack_require__(30); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var HTML5AudioFile = __webpack_require__(280); +var HTML5AudioFile = __webpack_require__(287); var IsPlainObject = __webpack_require__(8); /** @@ -74158,16 +73503,16 @@ module.exports = AudioFile; /***/ }), -/* 282 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MergeXHRSettings = __webpack_require__(156); +var MergeXHRSettings = __webpack_require__(169); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -74211,7 +73556,7 @@ var XHRLoader = function (file, globalXHRSettings) // After a successful request, the xhr.response property will contain the requested data as a DOMString, ArrayBuffer, Blob, or Document (depending on what was set for responseType.) xhr.onload = file.onLoad.bind(file, xhr); - xhr.onerror = file.onError.bind(file); + xhr.onerror = file.onError.bind(file, xhr); xhr.onprogress = file.onProgress.bind(file); // This is the only standard method, the ones above are browser additions (maybe not universal?) @@ -74226,19 +73571,20 @@ module.exports = XHRLoader; /***/ }), -/* 283 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(123); var GetFastValue = __webpack_require__(1); -var ProcessKeyCombo = __webpack_require__(672); -var ResetKeyCombo = __webpack_require__(670); +var ProcessKeyCombo = __webpack_require__(693); +var ResetKeyCombo = __webpack_require__(691); /** * @callback KeyboardKeydownCallback @@ -74286,6 +73632,7 @@ var ResetKeyCombo = __webpack_require__(670); * @class KeyCombo * @memberof Phaser.Input.Keyboard * @constructor + * @listens Phaser.Input.Keyboard.Events#ANY_KEY_DOWN * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. @@ -74466,7 +73813,7 @@ var KeyCombo = new Class({ if (matched) { - _this.manager.emit('keycombomatch', _this, event); + _this.manager.emit(Events.COMBO_MATCH, _this, event); if (_this.resetOnMatch) { @@ -74485,11 +73832,12 @@ var KeyCombo = new Class({ * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown * @private * @type {KeyboardKeydownCallback} + * @fires Phaser.Input.Keyboard.Events#COMBO_MATCH * @since 3.0.0 */ this.onKeyDown = onKeyDownHandler; - this.manager.on('keydown', onKeyDownHandler); + this.manager.on(Events.ANY_KEY_DOWN, this.onKeyDown); }, /** @@ -74520,7 +73868,7 @@ var KeyCombo = new Class({ this.enabled = false; this.keyCodes = []; - this.manager.off('keydown', this.onKeyDown); + this.manager.off(Events.ANY_KEY_DOWN, this.onKeyDown); this.manager = null; } @@ -74531,16 +73879,18 @@ module.exports = KeyCombo; /***/ }), -/* 284 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(9); +var Events = __webpack_require__(123); /** * @classdesc @@ -74548,6 +73898,7 @@ var Class = __webpack_require__(0); * keycode must be an integer * * @class Key + * @extends Phaser.Events.EventEmitter * @memberof Phaser.Input.Keyboard * @constructor * @since 3.0.0 @@ -74556,10 +73907,14 @@ var Class = __webpack_require__(0); */ var Key = new Class({ + Extends: EventEmitter, + initialize: function Key (keyCode) { + EventEmitter.call(this); + /** * The keycode of this key. * @@ -74578,16 +73933,6 @@ var Key = new Class({ */ this.originalEvent = undefined; - /** - * Should this Key prevent event propagation? - * - * @name Phaser.Input.Keyboard.Key#preventDefault - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.preventDefault = true; - /** * Can this Key be processed? * @@ -74648,6 +73993,17 @@ var Key = new Class({ */ this.shiftKey = false; + /** + * The down state of the Meta key, if pressed at the same time as this key. + * On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key. + * + * @name Phaser.Input.Keyboard.Key#metaKey + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.metaKey = false; + /** * The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad. * @@ -74688,6 +74044,19 @@ var Key = new Class({ */ this.timeUp = 0; + /** + * When a key is held down should it continuously fire the `down` event each time it repeats? + * + * By default it will emit the `down` event just once, but if you wish to receive the event + * for each repeat as well, enable this property. + * + * @name Phaser.Input.Keyboard.Key#emitOnRepeat + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.emitOnRepeat = false; + /** * If a key is held down this holds down the number of times the key has 'repeated'. * @@ -74731,10 +74100,104 @@ var Key = new Class({ this._tick = -1; }, + /** + * Controls if this Key will continuously emit a `down` event while being held down (true), + * or emit the event just once, on first press, and then skip future events (false). + * + * @method Phaser.Input.Keyboard.Key#setEmitOnRepeat + * @since 3.16.0 + * + * @param {boolean} value - Emit `down` events on repeated key down actions, or just once? + * + * @return {Phaser.Input.Keyboard.Key} This Key instance. + */ + setEmitOnRepeat: function (value) + { + this.emitOnRepeat = value; + + return this; + }, + + /** + * Processes the Key Down action for this Key. + * Called automatically by the Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.Key#onDown + * @fires Phaser.Input.Keyboard.Events#DOWN + * @since 3.16.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard event. + */ + onDown: function (event) + { + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.altKey = event.altKey; + this.ctrlKey = event.ctrlKey; + this.shiftKey = event.shiftKey; + this.metaKey = event.metaKey; + this.location = event.location; + + this.repeats++; + + if (!this.isDown) + { + this.isDown = true; + this.isUp = false; + this.timeDown = event.timeStamp; + this.duration = 0; + this._justDown = true; + this._justUp = false; + + this.emit(Events.DOWN, this, event); + } + else if (this.emitOnRepeat) + { + this.emit(Events.DOWN, this, event); + } + }, + + /** + * Processes the Key Up action for this Key. + * Called automatically by the Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.Key#onUp + * @fires Phaser.Input.Keyboard.Events#UP + * @since 3.16.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard event. + */ + onUp: function (event) + { + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.isDown = false; + this.isUp = true; + this.timeUp = event.timeStamp; + this.duration = this.timeUp - this.timeDown; + this.repeats = 0; + + this._justDown = false; + this._justUp = true; + this._tick = -1; + + this.emit(Events.UP, this, event); + }, + /** * Resets this Key object back to its default un-pressed state. * - * @method Phaser.Input.Keyboard.Key.reset + * @method Phaser.Input.Keyboard.Key#reset * @since 3.6.0 * * @return {Phaser.Input.Keyboard.Key} This Key instance. @@ -74748,6 +74211,7 @@ var Key = new Class({ this.altKey = false; this.ctrlKey = false; this.shiftKey = false; + this.metaKey = false; this.timeDown = 0; this.duration = 0; this.timeUp = 0; @@ -74757,6 +74221,19 @@ var Key = new Class({ this._tick = -1; return this; + }, + + /** + * Removes any bound event handlers and removes local references. + * + * @method Phaser.Input.Keyboard.Key#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.originalEvent = null; } }); @@ -74765,19 +74242,19 @@ module.exports = Key; /***/ }), -/* 285 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Axis = __webpack_require__(287); -var Button = __webpack_require__(286); +var Axis = __webpack_require__(294); +var Button = __webpack_require__(293); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(11); +var EventEmitter = __webpack_require__(9); var Vector2 = __webpack_require__(3); /** @@ -75523,16 +75000,17 @@ module.exports = Gamepad; /***/ }), -/* 286 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(171); /** * @classdesc @@ -75617,10 +75095,14 @@ var Button = new Class({ * Called automatically by the Gamepad as part of its update. * * @method Phaser.Input.Gamepad.Button#update + * @fires Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#BUTTON_UP + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP * @private * @since 3.0.0 * - * @param {number} value - The GamepadButton value. + * @param {number} value - The value of the button. Between 0 and 1. */ update: function (value) { @@ -75634,15 +75116,15 @@ var Button = new Class({ if (!this.pressed) { this.pressed = true; - this.events.emit('down', pad, this, value); - this.pad.emit('down', index, value, this); + this.events.emit(Events.BUTTON_DOWN, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_DOWN, index, value, this); } } else if (this.pressed) { this.pressed = false; - this.events.emit('up', pad, this, value); - this.pad.emit('up', index, value, this); + this.events.emit(Events.BUTTON_UP, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_UP, index, value, this); } }, @@ -75664,12 +75146,12 @@ module.exports = Button; /***/ }), -/* 287 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75789,12 +75271,12 @@ module.exports = Axis; /***/ }), -/* 288 */ +/* 295 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75885,12 +75367,12 @@ module.exports = CreateInteractiveObject; /***/ }), -/* 289 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75909,17 +75391,17 @@ function getLength (x1, y1, x2, y2) } /** - * [description] + * Calculates the position of the incenter of a Triangle object. This is the point where its three angle bisectors meet and it's also the center of the incircle, which is the circle inscribed in the triangle. * * @function Phaser.Geom.Triangle.InCenter * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to find the incenter of. + * @param {Phaser.Geom.Point} [out] - An optional Point in which to store the coordinates. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} Point (x, y) of the center pixel of the triangle. */ var InCenter = function (triangle, out) { @@ -75950,28 +75432,28 @@ module.exports = InCenter; /***/ }), -/* 290 */ +/* 297 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Moves each point (vertex) of a Triangle by a given offset, thus moving the entire Triangle by that offset. * * @function Phaser.Geom.Triangle.Offset * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to move. + * @param {number} x - The horizontal offset (distance) by which to move each point. Can be positive or negative. + * @param {number} y - The vertical offset (distance) by which to move each point. Can be positive or negative. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The modified Triangle. */ var Offset = function (triangle, x, y) { @@ -75991,12 +75473,12 @@ module.exports = Offset; /***/ }), -/* 291 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -76007,17 +75489,19 @@ var Point = __webpack_require__(6); // The centroid divides each median in a ratio of 2:1 /** - * [description] + * Calculates the position of a Triangle's centroid, which is also its center of mass (center of gravity). + * + * The centroid is the point in a Triangle at which its three medians (the lines drawn from the vertices to the bisectors of the opposite sides) meet. It divides each one in a 2:1 ratio. * * @function Phaser.Geom.Triangle.Centroid * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the coordinates in. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} The `out` object with modified `x` and `y` properties, or a new Point if none was provided. */ var Centroid = function (triangle, out) { @@ -76033,27 +75517,25 @@ module.exports = Centroid; /***/ }), -/* 292 */ +/* 299 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Checks if rectB is fully contained within rectA - /** - * [description] + * Tests if one rectangle fully contains another. * * @function Phaser.Geom.Rectangle.ContainsRect * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first rectangle. + * @param {Phaser.Geom.Rectangle} rectB - The second rectangle. * - * @return {boolean} [description] + * @return {boolean} True only if rectA fully contains rectB. */ var ContainsRect = function (rectA, rectB) { @@ -76075,77 +75557,77 @@ module.exports = ContainsRect; /***/ }), -/* 293 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Rectangle = __webpack_require__(11); -Rectangle.Area = __webpack_require__(723); -Rectangle.Ceil = __webpack_require__(722); -Rectangle.CeilAll = __webpack_require__(721); -Rectangle.CenterOn = __webpack_require__(193); -Rectangle.Clone = __webpack_require__(720); -Rectangle.Contains = __webpack_require__(43); -Rectangle.ContainsPoint = __webpack_require__(719); -Rectangle.ContainsRect = __webpack_require__(292); -Rectangle.CopyFrom = __webpack_require__(718); -Rectangle.Decompose = __webpack_require__(298); -Rectangle.Equals = __webpack_require__(717); -Rectangle.FitInside = __webpack_require__(716); -Rectangle.FitOutside = __webpack_require__(715); -Rectangle.Floor = __webpack_require__(714); -Rectangle.FloorAll = __webpack_require__(713); -Rectangle.FromPoints = __webpack_require__(191); -Rectangle.GetAspectRatio = __webpack_require__(161); -Rectangle.GetCenter = __webpack_require__(712); -Rectangle.GetPoint = __webpack_require__(209); -Rectangle.GetPoints = __webpack_require__(434); -Rectangle.GetSize = __webpack_require__(711); -Rectangle.Inflate = __webpack_require__(710); -Rectangle.Intersection = __webpack_require__(709); -Rectangle.MarchingAnts = __webpack_require__(424); -Rectangle.MergePoints = __webpack_require__(708); -Rectangle.MergeRect = __webpack_require__(707); -Rectangle.MergeXY = __webpack_require__(706); -Rectangle.Offset = __webpack_require__(705); -Rectangle.OffsetPoint = __webpack_require__(704); -Rectangle.Overlaps = __webpack_require__(703); -Rectangle.Perimeter = __webpack_require__(134); -Rectangle.PerimeterPoint = __webpack_require__(702); -Rectangle.Random = __webpack_require__(206); -Rectangle.RandomOutside = __webpack_require__(701); -Rectangle.SameDimensions = __webpack_require__(700); -Rectangle.Scale = __webpack_require__(699); -Rectangle.Union = __webpack_require__(337); +Rectangle.Area = __webpack_require__(757); +Rectangle.Ceil = __webpack_require__(756); +Rectangle.CeilAll = __webpack_require__(755); +Rectangle.CenterOn = __webpack_require__(209); +Rectangle.Clone = __webpack_require__(754); +Rectangle.Contains = __webpack_require__(47); +Rectangle.ContainsPoint = __webpack_require__(753); +Rectangle.ContainsRect = __webpack_require__(299); +Rectangle.CopyFrom = __webpack_require__(752); +Rectangle.Decompose = __webpack_require__(305); +Rectangle.Equals = __webpack_require__(751); +Rectangle.FitInside = __webpack_require__(750); +Rectangle.FitOutside = __webpack_require__(749); +Rectangle.Floor = __webpack_require__(748); +Rectangle.FloorAll = __webpack_require__(747); +Rectangle.FromPoints = __webpack_require__(198); +Rectangle.GetAspectRatio = __webpack_require__(173); +Rectangle.GetCenter = __webpack_require__(746); +Rectangle.GetPoint = __webpack_require__(225); +Rectangle.GetPoints = __webpack_require__(468); +Rectangle.GetSize = __webpack_require__(745); +Rectangle.Inflate = __webpack_require__(744); +Rectangle.Intersection = __webpack_require__(743); +Rectangle.MarchingAnts = __webpack_require__(457); +Rectangle.MergePoints = __webpack_require__(742); +Rectangle.MergeRect = __webpack_require__(741); +Rectangle.MergeXY = __webpack_require__(740); +Rectangle.Offset = __webpack_require__(739); +Rectangle.OffsetPoint = __webpack_require__(738); +Rectangle.Overlaps = __webpack_require__(737); +Rectangle.Perimeter = __webpack_require__(145); +Rectangle.PerimeterPoint = __webpack_require__(736); +Rectangle.Random = __webpack_require__(222); +Rectangle.RandomOutside = __webpack_require__(735); +Rectangle.SameDimensions = __webpack_require__(734); +Rectangle.Scale = __webpack_require__(733); +Rectangle.Union = __webpack_require__(343); module.exports = Rectangle; /***/ }), -/* 294 */ +/* 301 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the square of magnitude of given point.(Can be used for fast magnitude calculation of point) * * @function Phaser.Geom.Point.GetMagnitudeSq * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Point} point - Returns square of the magnitude/length of given point. * - * @return {number} [description] + * @return {number} Returns square of the magnitude of given point. */ var GetMagnitudeSq = function (point) { @@ -76156,24 +75638,24 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 295 */ +/* 302 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculate the magnitude of the point, which equivalent to the length of the line from the origin to this point. * * @function Phaser.Geom.Point.GetMagnitude * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Point} point - The point to calculate the magnitude for * - * @return {number} [description] + * @return {number} The resulting magnitude */ var GetMagnitude = function (point) { @@ -76184,18 +75666,18 @@ module.exports = GetMagnitude; /***/ }), -/* 296 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(18); -var Wrap = __webpack_require__(59); -var Angle = __webpack_require__(75); +var MATH_CONST = __webpack_require__(20); +var Wrap = __webpack_require__(63); +var Angle = __webpack_require__(80); /** * Get the angle of the normal of the given line in radians. @@ -76218,25 +75700,25 @@ module.exports = NormalAngle; /***/ }), -/* 297 */ +/* 304 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Decomposes a Triangle into an array of its points. * * @function Phaser.Geom.Triangle.Decompose * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {array} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to decompose. + * @param {array} [out] - An array to store the points into. * - * @return {array} [description] + * @return {array} The provided `out` array, or a new array if none was provided, with three objects with `x` and `y` properties representing each point of the Triangle appended to it. */ var Decompose = function (triangle, out) { @@ -76253,12 +75735,12 @@ module.exports = Decompose; /***/ }), -/* 298 */ +/* 305 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -76290,63 +75772,103 @@ module.exports = Decompose; /***/ }), -/* 299 */ +/* 306 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if the a Point falls between the two end-points of a Line, based on the given line thickness. + * + * Assumes that the line end points are circular, not square. * * @function Phaser.Geom.Intersects.PointToLine * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Line} line - [description] + * @param {(Phaser.Geom.Point|any)} point - The point, or point-like object to check. + * @param {Phaser.Geom.Line} line - The line segment to test for intersection on. + * @param {number} [lineThickness=1] - The line thickness. Assumes that the line end points are circular. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point falls on the Line, otherwise `false`. */ -var PointToLine = function (point, line) +var PointToLine = function (point, line, lineThickness) { - return ((point.x - line.x1) * (line.y2 - line.y1) === (line.x2 - line.x1) * (point.y - line.y1)); + if (lineThickness === undefined) { lineThickness = 1; } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var px = point.x; + var py = point.y; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return false; + } + + var r = (((px - x1) * (x2 - x1)) + ((py - y1) * (y2 - y1))) / L2; + + // Assume line thickness is circular + if (r < 0) + { + // Outside line1 + return (Math.sqrt(((x1 - px) * (x1 - px)) + ((y1 - py) * (y1 - py))) <= lineThickness); + } + else if ((r >= 0) && (r <= 1)) + { + // On the line segment + var s = (((y1 - py) * (x2 - x1)) - ((x1 - px) * (y2 - y1))) / L2; + + return (Math.abs(s) * Math.sqrt(L2) <= lineThickness); + } + else + { + // Outside line2 + return (Math.sqrt(((x2 - px) * (x2 - px)) + ((y2 - py) * (y2 - py))) <= lineThickness); + } }; module.exports = PointToLine; /***/ }), -/* 300 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on code by Matt DesLauriers -// https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md - -var Contains = __webpack_require__(44); +var Contains = __webpack_require__(48); var Point = __webpack_require__(6); var tmp = new Point(); /** - * [description] + * Checks for intersection between the line segment and circle. + * + * Based on code by [Matt DesLauriers](https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md). * * @function Phaser.Geom.Intersects.LineToCircle * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] - * @param {Phaser.Geom.Circle} circle - [description] - * @param {Phaser.Geom.Point} [nearest] - [description] + * @param {Phaser.Geom.Line} line - The line segment to check. + * @param {Phaser.Geom.Circle} circle - The circle to check against the line. + * @param {(Phaser.Geom.Point|any)} [nearest] - An optional Point-like object. If given the closest point on the Line where the circle intersects will be stored in this object. * - * @return {boolean} [description] + * @return {boolean} `true` if the two objects intersect, otherwise `false`. */ var LineToCircle = function (line, circle, nearest) { @@ -76404,12 +75926,12 @@ module.exports = LineToCircle; /***/ }), -/* 301 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -76419,31 +75941,31 @@ module.exports = LineToCircle; module.exports = { - CircleToCircle: __webpack_require__(770), - CircleToRectangle: __webpack_require__(769), - GetRectangleIntersection: __webpack_require__(768), - LineToCircle: __webpack_require__(300), - LineToLine: __webpack_require__(117), - LineToRectangle: __webpack_require__(767), - PointToLine: __webpack_require__(299), - PointToLineSegment: __webpack_require__(766), - RectangleToRectangle: __webpack_require__(164), - RectangleToTriangle: __webpack_require__(765), - RectangleToValues: __webpack_require__(764), - TriangleToCircle: __webpack_require__(763), - TriangleToLine: __webpack_require__(762), - TriangleToTriangle: __webpack_require__(761) + CircleToCircle: __webpack_require__(807), + CircleToRectangle: __webpack_require__(806), + GetRectangleIntersection: __webpack_require__(805), + LineToCircle: __webpack_require__(307), + LineToLine: __webpack_require__(125), + LineToRectangle: __webpack_require__(804), + PointToLine: __webpack_require__(306), + PointToLineSegment: __webpack_require__(803), + RectangleToRectangle: __webpack_require__(176), + RectangleToTriangle: __webpack_require__(802), + RectangleToValues: __webpack_require__(801), + TriangleToCircle: __webpack_require__(800), + TriangleToLine: __webpack_require__(799), + TriangleToTriangle: __webpack_require__(798) }; /***/ }), -/* 302 */ +/* 309 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -76453,31 +75975,31 @@ module.exports = { module.exports = { - Circle: __webpack_require__(790), - Ellipse: __webpack_require__(780), - Intersects: __webpack_require__(301), - Line: __webpack_require__(760), - Point: __webpack_require__(742), - Polygon: __webpack_require__(728), - Rectangle: __webpack_require__(293), - Triangle: __webpack_require__(698) + Circle: __webpack_require__(827), + Ellipse: __webpack_require__(817), + Intersects: __webpack_require__(308), + Line: __webpack_require__(797), + Point: __webpack_require__(776), + Polygon: __webpack_require__(762), + Rectangle: __webpack_require__(300), + Triangle: __webpack_require__(732) }; /***/ }), -/* 303 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Light = __webpack_require__(304); -var Utils = __webpack_require__(9); +var Light = __webpack_require__(311); +var Utils = __webpack_require__(10); /** * @callback LightForEach @@ -76829,17 +76351,17 @@ module.exports = LightsManager; /***/ }), -/* 304 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(9); +var Utils = __webpack_require__(10); /** * @classdesc @@ -77092,16 +76614,16 @@ module.exports = Light; /***/ }), -/* 305 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(71); +var Length = __webpack_require__(64); var Point = __webpack_require__(6); /** @@ -77185,32 +76707,31 @@ module.exports = GetPoints; /***/ }), -/* 306 */ +/* 313 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var Length = __webpack_require__(71); +var Length = __webpack_require__(64); -// Position is a value between 0 and 1 /** - * [description] + * Returns a Point from around the perimeter of a Triangle. * * @function Phaser.Geom.Triangle.GetPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} position - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the point on its perimeter from. + * @param {number} position - The position along the perimeter of the triangle. A value between 0 and 1. + * @param {(Phaser.Geom.Point|object)} [out] - An option Point, or Point-like object to store the value in. If not given a new Point will be created. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} A Point object containing the given position from the perimeter of the triangle. */ var GetPoint = function (triangle, position, out) { @@ -77273,19 +76794,19 @@ module.exports = GetPoint; /***/ }), -/* 307 */ +/* 314 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(31); -var GeomTriangle = __webpack_require__(66); -var TriangleRender = __webpack_require__(839); +var Shape = __webpack_require__(33); +var GeomTriangle = __webpack_require__(72); +var TriangleRender = __webpack_require__(877); /** * @classdesc @@ -77416,19 +76937,19 @@ module.exports = Triangle; /***/ }), -/* 308 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StarRender = __webpack_require__(842); +var StarRender = __webpack_require__(880); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(70); -var Shape = __webpack_require__(31); +var Earcut = __webpack_require__(77); +var Shape = __webpack_require__(33); /** * @classdesc @@ -77704,19 +77225,19 @@ module.exports = Star; /***/ }), -/* 309 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GeomRectangle = __webpack_require__(10); -var Shape = __webpack_require__(31); -var RectangleRender = __webpack_require__(845); +var GeomRectangle = __webpack_require__(11); +var Shape = __webpack_require__(33); +var RectangleRender = __webpack_require__(883); /** * @classdesc @@ -77816,13 +77337,13 @@ module.exports = Rectangle; /***/ }), -/* 310 */ +/* 317 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Igor Ognichenko - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -77889,17 +77410,17 @@ module.exports = Smooth; /***/ }), -/* 311 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(71); -var Line = __webpack_require__(60); +var Length = __webpack_require__(64); +var Line = __webpack_require__(65); /** * Returns the perimeter of the given Polygon. @@ -77937,18 +77458,18 @@ module.exports = Perimeter; /***/ }), -/* 312 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(71); -var Line = __webpack_require__(60); -var Perimeter = __webpack_require__(311); +var Length = __webpack_require__(64); +var Line = __webpack_require__(65); +var Perimeter = __webpack_require__(318); /** * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, @@ -78014,29 +77535,29 @@ module.exports = GetPoints; /***/ }), -/* 313 */ +/* 320 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Rectangle = __webpack_require__(11); /** - * [description] + * Calculates the bounding AABB rectangle of a polygon. * * @function Phaser.Geom.Polygon.GetAABB * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [out,$return] * - * @param {Phaser.Geom.Polygon} polygon - [description] - * @param {(Phaser.Geom.Rectangle|object)} [out] - [description] + * @param {Phaser.Geom.Polygon} polygon - The polygon that should be calculated. + * @param {(Phaser.Geom.Rectangle|object)} [out] - The rectangle or object that has x, y, width, and height properties to store the result. Optional. * - * @return {(Phaser.Geom.Rectangle|object)} [description] + * @return {(Phaser.Geom.Rectangle|object)} The resulting rectangle or object that is passed in with position and dimensions of the polygon's AABB. */ var GetAABB = function (polygon, out) { @@ -78070,22 +77591,22 @@ module.exports = GetAABB; /***/ }), -/* 314 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PolygonRender = __webpack_require__(848); +var PolygonRender = __webpack_require__(886); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(70); -var GetAABB = __webpack_require__(313); -var GeomPolygon = __webpack_require__(167); -var Shape = __webpack_require__(31); -var Smooth = __webpack_require__(310); +var Earcut = __webpack_require__(77); +var GetAABB = __webpack_require__(320); +var GeomPolygon = __webpack_require__(179); +var Shape = __webpack_require__(33); +var Smooth = __webpack_require__(317); /** * @classdesc @@ -78209,19 +77730,19 @@ module.exports = Polygon; /***/ }), -/* 315 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(31); -var GeomLine = __webpack_require__(60); -var LineRender = __webpack_require__(851); +var Shape = __webpack_require__(33); +var GeomLine = __webpack_require__(65); +var LineRender = __webpack_require__(889); /** * @classdesc @@ -78373,18 +77894,18 @@ module.exports = Line; /***/ }), -/* 316 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var IsoTriangleRender = __webpack_require__(854); -var Shape = __webpack_require__(31); +var IsoTriangleRender = __webpack_require__(892); +var Shape = __webpack_require__(33); /** * @classdesc @@ -78619,18 +78140,18 @@ module.exports = IsoTriangle; /***/ }), -/* 317 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsoBoxRender = __webpack_require__(857); +var IsoBoxRender = __webpack_require__(895); var Class = __webpack_require__(0); -var Shape = __webpack_require__(31); +var Shape = __webpack_require__(33); /** * @classdesc @@ -78834,18 +78355,18 @@ module.exports = IsoBox; /***/ }), -/* 318 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(31); -var GridRender = __webpack_require__(860); +var Shape = __webpack_require__(33); +var GridRender = __webpack_require__(898); /** * @classdesc @@ -79116,20 +78637,20 @@ module.exports = Grid; /***/ }), -/* 319 */ +/* 326 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(70); -var EllipseRender = __webpack_require__(863); -var GeomEllipse = __webpack_require__(99); -var Shape = __webpack_require__(31); +var Earcut = __webpack_require__(77); +var EllipseRender = __webpack_require__(901); +var GeomEllipse = __webpack_require__(105); +var Shape = __webpack_require__(33); /** * @classdesc @@ -79303,20 +78824,20 @@ module.exports = Ellipse; /***/ }), -/* 320 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var CurveRender = __webpack_require__(866); -var Earcut = __webpack_require__(70); -var Rectangle = __webpack_require__(10); -var Shape = __webpack_require__(31); +var CurveRender = __webpack_require__(904); +var Earcut = __webpack_require__(77); +var Rectangle = __webpack_require__(11); +var Shape = __webpack_require__(33); /** * @classdesc @@ -79485,22 +79006,22 @@ module.exports = Curve; /***/ }), -/* 321 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcRender = __webpack_require__(869); +var ArcRender = __webpack_require__(907); var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var Earcut = __webpack_require__(70); -var GeomCircle = __webpack_require__(81); -var MATH_CONST = __webpack_require__(18); -var Shape = __webpack_require__(31); +var DegToRad = __webpack_require__(39); +var Earcut = __webpack_require__(77); +var GeomCircle = __webpack_require__(87); +var MATH_CONST = __webpack_require__(20); +var Shape = __webpack_require__(33); /** * @classdesc @@ -79889,42 +79410,12 @@ module.exports = Arc; /***/ }), -/* 322 */ +/* 329 */ /***/ (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 nearest power of 2 to the given `value`. - * - * @function Phaser.Math.Pow2.GetPowerOfTwo - * @since 3.0.0 - * - * @param {number} value - The value. - * - * @return {integer} The nearest power of 2 to `value`. - */ -var GetPowerOfTwo = function (value) -{ - var index = Math.log(value) / 0.6931471805599453; - - return (1 << Math.ceil(index)); -}; - -module.exports = GetPowerOfTwo; - - -/***/ }), -/* 323 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -79954,21 +79445,21 @@ module.exports = UUID; /***/ }), -/* 324 */ +/* 330 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var GetBoolean = __webpack_require__(94); +var DegToRad = __webpack_require__(39); +var GetBoolean = __webpack_require__(100); var GetValue = __webpack_require__(4); -var Sprite = __webpack_require__(57); -var TWEEN_CONST = __webpack_require__(93); +var Sprite = __webpack_require__(61); +var TWEEN_CONST = __webpack_require__(99); var Vector2 = __webpack_require__(3); /** @@ -79982,7 +79473,7 @@ var Vector2 = __webpack_require__(3); * @property {boolean} [positionOnPath=false] - Whether to position the PathFollower on the Path using its path offset. * @property {boolean} [rotateToPath=false] - Should the PathFollower automatically rotate to point in the direction of the Path? * @property {number} [rotationOffset=0] - If the PathFollower is rotating to match the Path, this value is added to the rotation value. This allows you to rotate objects to a path but control the angle of the rotation as well. - * @property {boolean} [verticalAdjust=false] - [description] + * @property {number} [startAt=0] - Current start position of the path follow, between 0 and 1. */ /** @@ -80040,16 +79531,6 @@ var PathFollower = new Class({ */ this.rotateToPath = false; - /** - * [description] - * - * @name Phaser.GameObjects.PathFollower#pathRotationVerticalAdjust - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.pathRotationVerticalAdjust = false; - /** * If the PathFollower is rotating to match the Path (@see Phaser.GameObjects.PathFollower#rotateToPath) * this value is added to the rotation value. This allows you to rotate objects to a path but control @@ -80073,7 +79554,7 @@ var PathFollower = new Class({ this.pathOffset = new Vector2(x, y); /** - * [description] + * A Vector2 that stores the current point of the path the follower is on. * * @name Phaser.GameObjects.PathFollower#pathVector * @type {Phaser.Math.Vector2} @@ -80153,19 +79634,16 @@ var PathFollower = new Class({ * * @param {boolean} value - Whether the PathFollower should automatically rotate to point in the direction of the Path. * @param {number} [offset=0] - Rotation offset in degrees. - * @param {boolean} [verticalAdjust=false] - [description] * * @return {Phaser.GameObjects.PathFollower} This Game Object. */ - setRotateToPath: function (value, offset, verticalAdjust) + setRotateToPath: function (value, offset) { if (offset === undefined) { offset = 0; } - if (verticalAdjust === undefined) { verticalAdjust = false; } this.rotateToPath = value; this.pathRotationOffset = offset; - this.pathRotationVerticalAdjust = verticalAdjust; return this; }, @@ -80225,7 +79703,22 @@ var PathFollower = new Class({ this.rotateToPath = GetBoolean(config, 'rotateToPath', false); this.pathRotationOffset = GetValue(config, 'rotationOffset', 0); - this.pathRotationVerticalAdjust = GetBoolean(config, 'verticalAdjust', false); + + // This works, but it's not an ideal way of doing it as the follower jumps position + var seek = GetValue(config, 'startAt', startAt); + + if (seek) + { + config.onStart = function (tween) + { + var tweenData = tween.data[0]; + tweenData.progress = seek; + tweenData.elapsed = tweenData.duration * seek; + var v = tweenData.ease(tweenData.progress); + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + tweenData.target[tweenData.key] = tweenData.current; + }; + } this.pathTween = this.scene.sys.tweens.addCounter(config); @@ -80380,11 +79873,6 @@ var PathFollower = new Class({ if (this.rotateToPath) { this.rotation = Math.atan2(speedY, speedX) + DegToRad(this.pathRotationOffset); - - if (this.pathRotationVerticalAdjust) - { - this.flipY = (this.rotation !== 0 && tweenData.state === TWEEN_CONST.PLAYING_BACKWARD); - } } } } @@ -80395,12 +79883,12 @@ module.exports = PathFollower; /***/ }), -/* 325 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -80487,12 +79975,12 @@ module.exports = RandomZone; /***/ }), -/* 326 */ +/* 332 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -80524,41 +80012,12 @@ module.exports = HasAny; /***/ }), -/* 327 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. - * - * @function Phaser.Math.FloatBetween - * @since 3.0.0 - * - * @param {number} min - The lower bound for the float, inclusive. - * @param {number} max - The upper bound for the float exclusive. - * - * @return {number} A random float within the given range. - */ -var FloatBetween = function (min, max) -{ - return Math.random() * (max - min) + min; -}; - -module.exports = FloatBetween; - - -/***/ }), -/* 328 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -80821,12 +80280,12 @@ module.exports = EdgeZone; /***/ }), -/* 329 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -80920,31 +80379,31 @@ module.exports = DeathZone; /***/ }), -/* 330 */ +/* 335 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(72); +var BlendModes = __webpack_require__(66); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var DeathZone = __webpack_require__(329); -var EdgeZone = __webpack_require__(328); -var EmitterOp = __webpack_require__(889); +var Components = __webpack_require__(14); +var DeathZone = __webpack_require__(334); +var EdgeZone = __webpack_require__(333); +var EmitterOp = __webpack_require__(927); var GetFastValue = __webpack_require__(1); -var GetRandom = __webpack_require__(178); -var HasAny = __webpack_require__(326); -var HasValue = __webpack_require__(77); -var Particle = __webpack_require__(331); -var RandomZone = __webpack_require__(325); -var Rectangle = __webpack_require__(10); -var StableSort = __webpack_require__(120); +var GetRandom = __webpack_require__(190); +var HasAny = __webpack_require__(332); +var HasValue = __webpack_require__(82); +var Particle = __webpack_require__(336); +var RandomZone = __webpack_require__(331); +var Rectangle = __webpack_require__(11); +var StableSort = __webpack_require__(128); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(63); /** * @callback ParticleEmitterCallback @@ -81010,7 +80469,7 @@ var Wrap = __webpack_require__(59); * @typedef {object} ParticleEmitterConfig * * @property {boolean} [active] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#active}. - * @property {integer} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. + * @property {(Phaser.BlendModes|string)} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. * @property {*} [callbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope} and {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. * @property {boolean} [collideBottom] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideBottom}. * @property {boolean} [collideLeft] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideLeft}. @@ -81060,7 +80519,7 @@ var Wrap = __webpack_require__(59); * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. * @property {number} [followOffset.x] - x-coordinate of the offset. * @property {number} [followOffset.y] - y-coordinate of the offset. - * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frames] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frame] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. */ /** @@ -82937,13 +82396,9 @@ var ParticleEmitter = new Class({ for (var i = 0; i < count; i++) { - var particle; + var particle = dead.pop(); - if (dead.length > 0) - { - particle = dead.pop(); - } - else + if (!particle) { particle = new this.particleClass(this); } @@ -82998,47 +82453,49 @@ var ParticleEmitter = new Class({ var processors = this.manager.getProcessors(); var particles = this.alive; + var dead = this.dead; + + var i = 0; + var rip = []; var length = particles.length; - for (var index = 0; index < length; index++) + for (i = 0; i < length; i++) { - var particle = particles[index]; + var particle = particles[i]; - // update returns `true` if the particle is now dead (lifeStep < 0) + // update returns `true` if the particle is now dead (lifeCurrent <= 0) if (particle.update(delta, step, processors)) { - // Moves the dead particle to the end of the particles array (ready for splicing out later) - var last = particles[length - 1]; - - particles[length - 1] = particle; - particles[index] = last; - - index -= 1; - length -= 1; + rip.push({ index: i, particle: particle }); } } // Move dead particles to the dead array - var deadLength = particles.length - length; + length = rip.length; - if (deadLength > 0) + if (length > 0) { - var rip = particles.splice(particles.length - deadLength, deadLength); - var deathCallback = this.deathCallback; var deathCallbackScope = this.deathCallbackScope; - if (deathCallback) + for (i = length - 1; i >= 0; i--) { - for (var i = 0; i < rip.length; i++) + var entry = rip[i]; + + // Remove from particles array + particles.splice(entry.index, 1); + + // Add to dead array + dead.push(entry.particle); + + // Callback + if (deathCallback) { - deathCallback.call(deathCallbackScope, rip[i]); + deathCallback.call(deathCallbackScope, entry.particle); } + + entry.particle.resetPosition(); } - - this.dead.concat(rip); - - StableSort.inplace(particles, this.indexSortCallback); } if (!this.on) @@ -83078,22 +82535,6 @@ var ParticleEmitter = new Class({ depthSortCallback: function (a, b) { return a.y - b.y; - }, - - /** - * Calculates the difference of two particles, for sorting them by index. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#indexSortCallback - * @since 3.0.0 - * - * @param {object} a - The first particle. - * @param {object} b - The second particle. - * - * @return {integer} The difference of a and b's `index` properties. - */ - indexSortCallback: function (a, b) - { - return a.index - b.index; } }); @@ -83102,18 +82543,18 @@ module.exports = ParticleEmitter; /***/ }), -/* 331 */ +/* 336 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var DistanceBetween = __webpack_require__(58); +var DegToRad = __webpack_require__(39); +var DistanceBetween = __webpack_require__(62); /** * @classdesc @@ -83154,16 +82595,6 @@ var Particle = new Class({ */ this.frame = null; - /** - * The position of this Particle within its Emitter's particle pool. - * - * @name Phaser.GameObjects.Particles.Particle#index - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.index = 0; - /** * The x coordinate of this Particle. * @@ -83383,6 +82814,18 @@ var Particle = new Class({ return (this.lifeCurrent > 0); }, + /** + * Resets the position of this particle back to zero. + * + * @method Phaser.GameObjects.Particles.Particle#resetPosition + * @since 3.16.0 + */ + resetPosition: function () + { + this.x = 0; + this.y = 0; + }, + /** * Starts this Particle from the given coordinates. * @@ -83489,8 +82932,6 @@ var Particle = new Class({ this.alpha = emitter.alpha.onEmit(this, 'alpha'); this.tint = emitter.tint.onEmit(this, 'tint'); - - this.index = emitter.alive.length; }, /** @@ -83671,12 +83112,12 @@ module.exports = Particle; /***/ }), -/* 332 */ +/* 337 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -83688,14 +83129,18 @@ var GetFastValue = __webpack_require__(1); * * @property {number} [x=0] - The x coordinate of the Gravity Well, in world space. * @property {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @property {number} [power=0] - The power of the Gravity Well. - * @property {number} [epsilon=100] - [description] + * @property {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @property {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. * @property {number} [gravity=50] - The gravitational force of this Gravity Well. */ /** * @classdesc - * [description] + * The GravityWell action applies a force on the particle to draw it towards, or repel it from, a single point. + * + * The force applied is inversely proportional to the square of the distance from the particle to the point, in accordance with Newton's law of gravity. + * + * This simulates the effect of gravity over large distances (as between planets, for example). * * @class GravityWell * @memberof Phaser.GameObjects.Particles @@ -83704,8 +83149,8 @@ var GetFastValue = __webpack_require__(1); * * @param {(number|GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. * @param {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @param {number} [power=0] - The power of the Gravity Well. - * @param {number} [epsilon=100] - [description] + * @param {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @param {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. * @param {number} [gravity=50] - The gravitational force of this Gravity Well. */ var GravityWell = new Class({ @@ -83794,7 +83239,7 @@ var GravityWell = new Class({ this._epsilon = 0; /** - * The power of the Gravity Well. + * The strength of the gravity force - larger numbers produce a stronger force. * * @name Phaser.GameObjects.Particles.GravityWell#power * @type {number} @@ -83803,7 +83248,7 @@ var GravityWell = new Class({ this.power = power; /** - * [description] + * The minimum distance for which the gravity force is calculated. * * @name Phaser.GameObjects.Particles.GravityWell#epsilon * @type {number} @@ -83896,17 +83341,17 @@ module.exports = GravityWell; /***/ }), -/* 333 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Commands = __webpack_require__(173); -var SetTransform = __webpack_require__(23); +var Commands = __webpack_require__(185); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -83946,8 +83391,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c var green = 0; var blue = 0; - ctx.save(); - // Reset any currently active paths ctx.beginPath(); @@ -84140,6 +83583,7 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c } } + // Restore the context saved in SetTransform ctx.restore(); }; @@ -84147,12 +83591,12 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 334 */ +/* 339 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84179,19 +83623,19 @@ module.exports = Circumference; /***/ }), -/* 335 */ +/* 340 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(334); -var CircumferencePoint = __webpack_require__(172); -var FromPercent = __webpack_require__(103); -var MATH_CONST = __webpack_require__(18); +var Circumference = __webpack_require__(339); +var CircumferencePoint = __webpack_require__(184); +var FromPercent = __webpack_require__(110); +var MATH_CONST = __webpack_require__(20); /** * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, @@ -84233,18 +83677,18 @@ module.exports = GetPoints; /***/ }), -/* 336 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircumferencePoint = __webpack_require__(172); -var FromPercent = __webpack_require__(103); -var MATH_CONST = __webpack_require__(18); +var CircumferencePoint = __webpack_require__(184); +var FromPercent = __webpack_require__(110); +var MATH_CONST = __webpack_require__(20); var Point = __webpack_require__(6); /** @@ -84276,16 +83720,114 @@ module.exports = GetPoint; /***/ }), -/* 337 */ +/* 342 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Class = __webpack_require__(0); +var Components = __webpack_require__(14); +var GameObject = __webpack_require__(18); +var ExternRender = __webpack_require__(939); + +/** + * @classdesc + * An Extern Game Object is a special type of Game Object that allows you to pass + * rendering off to a 3rd party. + * + * When you create an Extern and place it in the display list of a Scene, the renderer will + * process the list as usual. When it finds an Extern it will flush the current batch, + * clear down the pipeline and prepare a transform matrix which your render function can + * take advantage of, if required. + * + * The WebGL context is then left is a 'clean' state, ready for you to bind your own shaders, + * or draw to it, whatever you wish to do. Once you've finished, you should free-up any + * of your resources. The Extern will then rebind the Phaser pipeline and carry on + * rendering the display list. + * + * Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of + * them are used during rendering unless you take advantage of them in your own render code. + * + * @class Extern + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.16.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.Origin + * @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. + */ +var Extern = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.Origin, + Components.ScaleMode, + Components.ScrollFactor, + Components.Size, + Components.Texture, + Components.Tint, + Components.Transform, + Components.Visible, + ExternRender + ], + + initialize: + + function Extern (scene) + { + GameObject.call(this, scene, 'Extern'); + }, + + preUpdate: function () + { + // override this! + // Arguments: time, delta + }, + + render: function () + { + // override this! + // Arguments: renderer, camera, calcMatrix + } + +}); + +module.exports = Extern; + + +/***/ }), +/* 343 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Rectangle = __webpack_require__(11); /** * Creates a new Rectangle or repositions and/or resizes an existing Rectangle so that it encompasses the two given Rectangles, i.e. calculates their union. @@ -84318,12 +83860,12 @@ module.exports = Union; /***/ }), -/* 338 */ +/* 344 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84459,12 +84001,12 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 339 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -84548,17 +84090,17 @@ module.exports = BuildGameObjectAnimation; /***/ }), -/* 340 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); -var Shuffle = __webpack_require__(132); +var Shuffle = __webpack_require__(142); var BuildChunk = function (a, b, qty) { @@ -84578,47 +84120,45 @@ var BuildChunk = function (a, b, qty) return out; }; -// options = repeat, random, randomB, yoyo, max, qty - -// Range ([a,b,c], [1,2,3]) = -// a1, a2, a3, b1, b2, b3, c1, c2, c3 - -// Range ([a,b], [1,2,3], qty = 3) = -// a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 - -// Range ([a,b,c], [1,2,3], repeat x1) = -// a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 - -// Range ([a,b], [1,2], repeat -1 = endless, max = 14) = -// Maybe if max is set then repeat goes to -1 automatically? -// a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) - -// Range ([a], [1,2,3,4,5], random = true) = -// a4, a1, a5, a2, a3 - -// Range ([a, b], [1,2,3], random = true) = -// b3, a2, a1, b1, a3, b2 - -// Range ([a, b, c], [1,2,3], randomB = true) = -// a3, a1, a2, b2, b3, b1, c1, c3, c2 - -// Range ([a], [1,2,3,4,5], yoyo = true) = -// a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 - -// Range ([a, b], [1,2,3], yoyo = true) = -// a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 - /** - * [description] + * Creates an array populated with a range of values, based on the given arguments and configuration object. + * + * Range ([a,b,c], [1,2,3]) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2,3], qty = 3) = + * a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 + * + * Range ([a,b,c], [1,2,3], repeat x1) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2], repeat -1 = endless, max = 14) = + * Maybe if max is set then repeat goes to -1 automatically? + * a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) + * + * Range ([a], [1,2,3,4,5], random = true) = + * a4, a1, a5, a2, a3 + * + * Range ([a, b], [1,2,3], random = true) = + * b3, a2, a1, b1, a3, b2 + * + * Range ([a, b, c], [1,2,3], randomB = true) = + * a3, a1, a2, b2, b3, b1, c1, c3, c2 + * + * Range ([a], [1,2,3,4,5], yoyo = true) = + * a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 + * + * Range ([a, b], [1,2,3], yoyo = true) = + * a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 * * @function Phaser.Utils.Array.Range * @since 3.0.0 * - * @param {array} a - [description] - * @param {array} b - [description] - * @param {object} options - [description] + * @param {array} a - The first array of range elements. + * @param {array} b - The second array of range elements. + * @param {object} [options] - A range configuration object. Can contain: repeat, random, randomB, yoyo, max, qty. * - * @return {array} [description] + * @return {array} An array of arranged elements. */ var Range = function (a, b, options) { @@ -84688,41 +84228,51 @@ module.exports = Range; /***/ }), -/* 341 */ +/* 347 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// This is from the quickselect npm package: https://www.npmjs.com/package/quickselect -// Coded by https://www.npmjs.com/~mourner (Vladimir Agafonkin) +function swap (arr, i, j) +{ + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} -// https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm - -// Floyd-Rivest selection algorithm: -// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; -// The k-th element will have the (k - left + 1)th smallest value in [left, right] +function defaultCompare (a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} /** - * [description] + * A [Floyd-Rivest](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm) quick selection algorithm. + * + * Rearranges the array items so that all items in the [left, k] range are smaller than all items in [k, right]; + * The k-th element will have the (k - left + 1)th smallest value in [left, right]. + * + * The array is modified in-place. + * + * Based on code by [Vladimir Agafonkin](https://www.npmjs.com/~mourner) * * @function Phaser.Utils.Array.QuickSelect * @since 3.0.0 * - * @param {array} arr - [description] - * @param {number} k - [description] - * @param {number} left - [description] - * @param {number} right - [description] - * @param {function} compare - [description] + * @param {array} arr - The array to sort. + * @param {integer} k - The k-th element index. + * @param {integer} [left=0] - The index of the left part of the range. + * @param {integer} [right] - The index of the right part of the range. + * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. */ var QuickSelect = function (arr, k, left, right, compare) { - left = left || 0; - right = right || (arr.length - 1); - compare = compare || defaultCompare; + if (left === undefined) { left = 0; } + if (right === undefined) { right = arr.length - 1; } + if (compare === undefined) { compare = defaultCompare; } while (right > left) { @@ -84790,65 +84340,23 @@ var QuickSelect = function (arr, k, left, right, compare) } }; -function swap (arr, i, j) -{ - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultCompare (a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} - module.exports = QuickSelect; /***/ }), -/* 342 */ +/* 348 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * Transposes the elements of the given matrix (array of arrays). * - * @function Phaser.Math.RoundAwayFromZero - * @since 3.0.0 - * - * @param {number} value - The number to round. - * - * @return {number} The rounded number, rounded away from zero. - */ -var RoundAwayFromZero = function (value) -{ - // "Opposite" of truncate. - return (value > 0) ? Math.ceil(value) : Math.floor(value); -}; - -module.exports = RoundAwayFromZero; - - -/***/ }), -/* 343 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// Transposes the elements of the given matrix (array of arrays). -// The transpose of a matrix is a new matrix whose rows are the columns of the original. - -/** - * [description] + * The transpose of a matrix is a new matrix whose rows are the columns of the original. * * @function Phaser.Utils.Array.Matrix.TransposeMatrix * @since 3.0.0 @@ -84881,7 +84389,7 @@ module.exports = TransposeMatrix; /***/ }), -/* 344 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { /* eslint no-console: 0 */ @@ -84892,13 +84400,13 @@ module.exports = TransposeMatrix; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AdInstance = __webpack_require__(948); +var AdInstance = __webpack_require__(989); var Class = __webpack_require__(0); -var DataManager = __webpack_require__(102); -var EventEmitter = __webpack_require__(11); -var Leaderboard = __webpack_require__(947); -var Product = __webpack_require__(945); -var Purchase = __webpack_require__(944); +var DataManager = __webpack_require__(109); +var EventEmitter = __webpack_require__(9); +var Leaderboard = __webpack_require__(988); +var Product = __webpack_require__(986); +var Purchase = __webpack_require__(985); /** * @classdesc @@ -85573,7 +85081,7 @@ var FacebookInstantGamesPlugin = new Class({ scene.load.image(key, this.playerPhotoURL); - scene.load.once('filecomplete_image_' + key, function () + scene.load.once('filecomplete-image-' + key, function () { this.emit('photocomplete', key); @@ -86208,7 +85716,7 @@ var FacebookInstantGamesPlugin = new Class({ */ chooseContext: function (options) { - if (!this.checkAPI('contextChoseAsync')) + if (!this.checkAPI('contextChooseAsync')) { return this; } @@ -86510,7 +86018,7 @@ var FacebookInstantGamesPlugin = new Class({ * @param {string} cta - The call to action text. * @param {object} text - The text object. * @param {string} key - The key of the texture to use as the share image. - * @param {(string|integer)} [frame] - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. + * @param {?(string|integer)} frame - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. * @param {string} template - The update template key. * @param {object} updateData - The update data object payload. * @@ -86548,7 +86056,7 @@ var FacebookInstantGamesPlugin = new Class({ * @param {string} cta - The call to action text. * @param {object} text - The text object. * @param {string} key - The key of the texture to use as the share image. - * @param {(string|integer)} [frame] - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. + * @param {?(string|integer)} frame - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. * @param {string} template - The update template key. * @param {object} updateData - The update data object payload. * @@ -86570,7 +86078,7 @@ var FacebookInstantGamesPlugin = new Class({ * @param {string} cta - The call to action text. * @param {object} text - The text object. * @param {string} key - The key of the texture to use as the share image. - * @param {(string|integer)} [frame] - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. + * @param {?(string|integer)} frame - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. * @param {string} template - The update template key. * @param {object} updateData - The update data object payload. * @@ -86756,6 +86264,10 @@ var FacebookInstantGamesPlugin = new Class({ * Attempt to create an instance of an interstitial ad. * * If the instance is created successfully then the ad is preloaded ready for display in-game via the method `showAd()`. + * + * If the ad loads it will emit the `adloaded` event, passing the AdInstance as the only parameter. + * + * If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event. * * @method Phaser.FacebookInstantGamesPlugin#preloadAds * @since 3.13.0 @@ -86798,18 +86310,36 @@ var FacebookInstantGamesPlugin = new Class({ for (i = 0; i < placementID.length; i++) { var id = placementID[i]; + var data; - FBInstant.getInterstitialAdAsync(id).then(function (data) + FBInstant.getInterstitialAdAsync(id).then(function (interstitial) { - var ad = AdInstance(data, true); - + data = interstitial; + + return interstitial.loadAsync(); + + }).then(function () + { + var ad = AdInstance(id, data, false); + _this.ads.push(ad); - - return ad.loadAsync(); - + + _this.emit('adloaded', ad); + }).catch(function (e) { - console.warn(e); + if (e.code === 'ADS_NO_FILL') + { + _this.emit('adsnofill', id); + } + else if (e.code === 'ADS_FREQUENT_LOAD') + { + _this.emit('adsfrequentload', id); + } + else + { + console.warn(e); + } }); } @@ -86817,9 +86347,13 @@ var FacebookInstantGamesPlugin = new Class({ }, /** - * Attempt to create an instance of an interstitial video ad. + * Attempt to create an instance of an rewarded video ad. * * If the instance is created successfully then the ad is preloaded ready for display in-game via the method `showVideo()`. + * + * If the ad loads it will emit the `adloaded` event, passing the AdInstance as the only parameter. + * + * If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event. * * @method Phaser.FacebookInstantGamesPlugin#preloadVideoAds * @since 3.13.0 @@ -86862,18 +86396,36 @@ var FacebookInstantGamesPlugin = new Class({ for (i = 0; i < placementID.length; i++) { var id = placementID[i]; + var data; - FBInstant.getRewardedVideoAsync(id).then(function (data) + FBInstant.getRewardedVideoAsync(id).then(function (reward) { - var ad = AdInstance(data, true); - + data = reward; + + return reward.loadAsync(); + + }).then(function () + { + var ad = AdInstance(id, data, true); + _this.ads.push(ad); - - return ad.loadAsync(); - + + _this.emit('adloaded', ad); + }).catch(function (e) { - console.warn(e); + if (e.code === 'ADS_NO_FILL') + { + _this.emit('adsnofill', id); + } + else if (e.code === 'ADS_FREQUENT_LOAD') + { + _this.emit('adsfrequentload', id); + } + else + { + console.warn(e); + } }); } @@ -86883,9 +86435,9 @@ var FacebookInstantGamesPlugin = new Class({ /** * Displays a previously loaded interstitial ad. * - * If the ad is successfully displayed this plugin will emit the `showad` event, with the AdInstance object as its parameter. + * If the ad is successfully displayed this plugin will emit the `adfinished` event, with the AdInstance object as its parameter. * - * If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event. + * If the ad cannot be displayed, it will emit the `adsnotloaded` event. * * @method Phaser.FacebookInstantGamesPlugin#showAd * @since 3.13.0 @@ -86908,18 +86460,20 @@ var FacebookInstantGamesPlugin = new Class({ { ad.shown = true; - _this.emit('showad', ad); + _this.emit('adfinished', ad); }).catch(function (e) { - if (e.code === 'ADS_NO_FILL') + if (e.code === 'ADS_NOT_LOADED') { - _this.emit('adsnofill'); + _this.emit('adsnotloaded', ad); } - else + else if (e.code === 'RATE_LIMITED') { - console.warn(e); + _this.emit('adratelimited', ad); } + + _this.emit('adshowerror', e, ad); }); } } @@ -86930,9 +86484,9 @@ var FacebookInstantGamesPlugin = new Class({ /** * Displays a previously loaded interstitial video ad. * - * If the ad is successfully displayed this plugin will emit the `showad` event, with the AdInstance object as its parameter. + * If the ad is successfully displayed this plugin will emit the `adfinished` event, with the AdInstance object as its parameter. * - * If the ad cannot be displayed because there was no inventory to fill it, it will emit the `adsnofill` event. + * If the ad cannot be displayed, it will emit the `adsnotloaded` event. * * @method Phaser.FacebookInstantGamesPlugin#showVideo * @since 3.13.0 @@ -86955,18 +86509,20 @@ var FacebookInstantGamesPlugin = new Class({ { ad.shown = true; - _this.emit('showad', ad); + _this.emit('adfinished', ad); }).catch(function (e) { - if (e.code === 'ADS_NO_FILL') + if (e.code === 'ADS_NOT_LOADED') { - _this.emit('adsnofill'); + _this.emit('adsnotloaded', ad); } - else + else if (e.code === 'RATE_LIMITED') { - console.warn(e); + _this.emit('adratelimited', ad); } + + _this.emit('adshowerror', e, ad); }); } } @@ -87082,12 +86638,12 @@ module.exports = FacebookInstantGamesPlugin; /***/ }), -/* 345 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87097,32 +86653,32 @@ module.exports = FacebookInstantGamesPlugin; module.exports = { - AtlasXML: __webpack_require__(958), - Canvas: __webpack_require__(957), - Image: __webpack_require__(956), - JSONArray: __webpack_require__(955), - JSONHash: __webpack_require__(954), - SpriteSheet: __webpack_require__(953), - SpriteSheetFromAtlas: __webpack_require__(952), - UnityYAML: __webpack_require__(951) + AtlasXML: __webpack_require__(997), + Canvas: __webpack_require__(996), + Image: __webpack_require__(995), + JSONArray: __webpack_require__(994), + JSONHash: __webpack_require__(993), + SpriteSheet: __webpack_require__(992), + SpriteSheetFromAtlas: __webpack_require__(991), + UnityYAML: __webpack_require__(990) }; /***/ }), -/* 346 */ +/* 351 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(26); var Class = __webpack_require__(0); -var IsSizePowerOfTwo = __webpack_require__(127); -var ScaleModes = __webpack_require__(104); +var IsSizePowerOfTwo = __webpack_require__(137); +var ScaleModes = __webpack_require__(111); /** * @classdesc @@ -87397,25 +86953,27 @@ module.exports = TextureSource; /***/ }), -/* 347 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(26); -var CanvasTexture = __webpack_require__(959); +var CanvasTexture = __webpack_require__(998); var Class = __webpack_require__(0); -var Color = __webpack_require__(41); -var CONST = __webpack_require__(28); -var EventEmitter = __webpack_require__(11); -var GenerateTexture = __webpack_require__(393); +var Color = __webpack_require__(37); +var CONST = __webpack_require__(30); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(136); +var GameEvents = __webpack_require__(28); +var GenerateTexture = __webpack_require__(392); var GetValue = __webpack_require__(4); -var Parser = __webpack_require__(345); -var Texture = __webpack_require__(181); +var Parser = __webpack_require__(350); +var Texture = __webpack_require__(193); /** * @callback EachTextureCallback @@ -87511,7 +87069,7 @@ var TextureManager = new Class({ */ this._pending = 0; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -87525,13 +87083,13 @@ var TextureManager = new Class({ { this._pending = 2; - this.on('onload', this.updatePending, this); - this.on('onerror', this.updatePending, this); + this.on(Events.LOAD, this.updatePending, this); + this.on(Events.ERROR, this.updatePending, this); this.addBase64('__DEFAULT', this.game.config.defaultImage); this.addBase64('__MISSING', this.game.config.missingImage); - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -87547,10 +87105,10 @@ var TextureManager = new Class({ if (this._pending === 0) { - this.off('onload'); - this.off('onerror'); + this.off(Events.LOAD); + this.off(Events.ERROR); - this.game.events.emit('texturesready'); + this.emit(Events.READY); } }, @@ -87588,6 +87146,7 @@ var TextureManager = new Class({ * step when clearing down to avoid this. * * @method Phaser.Textures.TextureManager#remove + * @fires Phaser.Textures.Events#REMOVE * @since 3.7.0 * * @param {(string|Phaser.Textures.Texture)} key - The key of the Texture to remove, or a reference to it. @@ -87616,7 +87175,7 @@ var TextureManager = new Class({ key.destroy(); - this.emit('removetexture', key.key); + this.emit(Events.REMOVE, key.key); } return this; @@ -87626,6 +87185,9 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * * @method Phaser.Textures.TextureManager#addBase64 + * @fires Phaser.Textures.Events#ADD + * @fires Phaser.Textures.Events#ERROR + * @fires Phaser.Textures.Events#LOAD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -87643,7 +87205,7 @@ var TextureManager = new Class({ image.onerror = function () { - _this.emit('onerror', key); + _this.emit(Events.ERROR, key); }; image.onload = function () @@ -87652,9 +87214,9 @@ var TextureManager = new Class({ Parser.Image(texture, 0); - _this.emit('addtexture', key, texture); + _this.emit(Events.ADD, key, texture); - _this.emit('onload', key, texture); + _this.emit(Events.LOAD, key, texture); }; image.src = data; @@ -87718,11 +87280,12 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Image element. * * @method Phaser.Textures.TextureManager#addImage + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -87741,7 +87304,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -87752,6 +87315,7 @@ var TextureManager = new Class({ * This allows you to then use the Render Texture as a normal texture for texture based Game Objects like Sprites. * * @method Phaser.Textures.TextureManager#addRenderTexture + * @fires Phaser.Textures.Events#ADD * @since 3.12.0 * * @param {string} key - The unique string-based key of the Texture. @@ -87769,7 +87333,7 @@ var TextureManager = new Class({ texture.add('__BASE', 0, 0, 0, renderTexture.width, renderTexture.height); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -87816,7 +87380,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {integer} [width=256]- The width of the Canvas element. + * @param {integer} [width=256] - The width of the Canvas element. * @param {integer} [height=256] - The height of the Canvas element. * * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. @@ -87841,6 +87405,7 @@ var TextureManager = new Class({ * and adds it to this Texture Manager, unless `skipCache` is true. * * @method Phaser.Textures.TextureManager#addCanvas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -87865,7 +87430,7 @@ var TextureManager = new Class({ this.list[key] = texture; - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -87881,7 +87446,7 @@ var TextureManager = new Class({ * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -87904,12 +87469,13 @@ var TextureManager = new Class({ * This is known as a JSON Array in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONArray + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {(HTMLImageElement|HTMLImageElement[])} source - The source Image element/s. * @param {(object|object[])} data - The Texture Atlas data/s. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -87944,7 +87510,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -87956,12 +87522,13 @@ var TextureManager = new Class({ * This is known as a JSON Hash in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONHash + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -87990,7 +87557,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -88001,12 +87568,13 @@ var TextureManager = new Class({ * in the XML format. * * @method Phaser.Textures.TextureManager#addAtlasXML + * @fires Phaser.Textures.Events#ADD * @since 3.7.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas XML data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -88025,7 +87593,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -88036,12 +87604,13 @@ var TextureManager = new Class({ * The data must be in the form of a Unity YAML file. * * @method Phaser.Textures.TextureManager#addUnityAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -88060,7 +87629,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -88084,6 +87653,7 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheet + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -88105,7 +87675,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, 0, 0, width, height, config); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -88131,6 +87701,7 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -88170,7 +87741,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, sheet.cutX, sheet.cutY, sheet.cutWidth, sheet.cutHeight, config); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); return texture; } @@ -88317,7 +87888,7 @@ var TextureManager = new Class({ * @param {integer} x - The x coordinate of the pixel within the Texture. * @param {integer} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, * or `null` if the coordinates were out of bounds. @@ -88364,7 +87935,7 @@ var TextureManager = new Class({ * @param {integer} x - The x coordinate of the pixel within the Texture. * @param {integer} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {integer} A value between 0 and 255, or `null` if the coordinates were out of bounds. */ @@ -88408,7 +87979,7 @@ var TextureManager = new Class({ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. */ @@ -88510,18 +88081,19 @@ module.exports = TextureManager; /***/ }), -/* 348 */ +/* 353 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(124); +var BaseSound = __webpack_require__(132); var Class = __webpack_require__(0); +var Events = __webpack_require__(75); /** * @classdesc @@ -88690,11 +88262,6 @@ var WebAudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.WebAudioSound#playEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Play this sound, or a marked section of it. * @@ -88702,7 +88269,7 @@ var WebAudioSound = new Class({ * you can set 'seek' setting of the config object, provided to this call, to that value. * * @method Phaser.Sound.WebAudioSound#play - * @fires Phaser.Sound.WebAudioSound#playEvent + * @fires Phaser.Sound.Events#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. @@ -88721,21 +88288,16 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); this.createAndStartBufferSource(); - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#pauseEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.WebAudioSound#pause - * @fires Phaser.Sound.WebAudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -88756,21 +88318,16 @@ var WebAudioSound = new Class({ this.currentConfig.seek = this.getCurrentTime(); // Equivalent to setting paused time this.stopAndRemoveBufferSource(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#resumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.WebAudioSound#resume - * @fires Phaser.Sound.WebAudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -88790,21 +88347,16 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = true, isPaused = false \/\/\/ this.createAndStartBufferSource(); - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#stopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.WebAudioSound#stop - * @fires Phaser.Sound.WebAudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -88819,7 +88371,7 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndRemoveBufferSource(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -88968,22 +88520,12 @@ var WebAudioSound = new Class({ BaseSound.prototype.applyConfig.call(this); }, - /** - * @event Phaser.Sound.WebAudioSound#endedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.WebAudioSound#loopedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.WebAudioSound#update - * @fires Phaser.Sound.WebAudioSound#endedEvent - * @fires Phaser.Sound.WebAudioSound#loopedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -89001,7 +88543,7 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); } else if (this.hasLooped) { @@ -89018,7 +88560,7 @@ var WebAudioSound = new Class({ this.createAndStartLoopBufferSource(); - this.emit('looped', this); + this.emit(Events.LOOPED, this); } }, @@ -89128,12 +88670,6 @@ var WebAudioSound = new Class({ return this.playTime + lastRateUpdate.time + (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate; }, - /** - * @event Phaser.Sound.WebAudioSound#rateEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -89142,6 +88678,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -89157,7 +88694,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } }, @@ -89169,7 +88706,7 @@ var WebAudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.WebAudioSound#setRate - * @fires Phaser.Sound.WebAudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -89183,12 +88720,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#detuneEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -89196,6 +88727,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -89211,7 +88743,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } }, @@ -89221,7 +88753,7 @@ var WebAudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.WebAudioSound#setDetune - * @fires Phaser.Sound.WebAudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -89235,12 +88767,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#muteEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -89248,6 +88774,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -89262,7 +88789,7 @@ var WebAudioSound = new Class({ this.currentConfig.mute = value; this.muteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.MUTE, this, value); } }, @@ -89271,7 +88798,7 @@ var WebAudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.WebAudioSound#setMute - * @fires Phaser.Sound.WebAudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -89285,18 +88812,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#volumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.WebAudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -89311,7 +88833,7 @@ var WebAudioSound = new Class({ this.currentConfig.volume = value; this.volumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.VOLUME, this, value); } }, @@ -89319,7 +88841,7 @@ var WebAudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.WebAudioSound#setVolume - * @fires Phaser.Sound.WebAudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -89333,12 +88855,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#seekEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -89347,6 +88863,7 @@ var WebAudioSound = new Class({ * * @name Phaser.Sound.WebAudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -89391,7 +88908,7 @@ var WebAudioSound = new Class({ this.createAndStartBufferSource(); } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -89400,7 +88917,7 @@ var WebAudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.WebAudioSound#setSeek - * @fires Phaser.Sound.WebAudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -89414,18 +88931,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#loopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.WebAudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -89449,7 +88961,7 @@ var WebAudioSound = new Class({ } } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -89457,7 +88969,7 @@ var WebAudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.WebAudioSound#setLoop - * @fires Phaser.Sound.WebAudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. @@ -89477,19 +88989,20 @@ module.exports = WebAudioSound; /***/ }), -/* 349 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(125); +var BaseSoundManager = __webpack_require__(133); var Class = __webpack_require__(0); -var WebAudioSound = __webpack_require__(348); +var Events = __webpack_require__(75); +var WebAudioSound = __webpack_require__(353); /** * @classdesc @@ -89626,23 +89139,26 @@ var WebAudioSoundManager = new Class({ { var _this = this; - var unlock = function () + var unlockHandler = function unlockHandler () { - _this.context.resume().then(function () + if (_this.context) { - document.body.removeEventListener('touchstart', unlock); - document.body.removeEventListener('touchend', unlock); - document.body.removeEventListener('click', unlock); - - _this.unlocked = true; - }); + _this.context.resume().then(function () + { + document.body.removeEventListener('touchstart', unlockHandler); + document.body.removeEventListener('touchend', unlockHandler); + document.body.removeEventListener('click', unlockHandler); + + _this.unlocked = true; + }); + } }; if (document.body) { - document.body.addEventListener('touchstart', unlock, false); - document.body.addEventListener('touchend', unlock, false); - document.body.addEventListener('click', unlock, false); + document.body.addEventListener('touchstart', unlockHandler, false); + document.body.addEventListener('touchend', unlockHandler, false); + document.body.addEventListener('click', unlockHandler, false); } }, @@ -89656,7 +89172,10 @@ var WebAudioSoundManager = new Class({ */ onBlur: function () { - this.context.suspend(); + if (!this.locked) + { + this.context.suspend(); + } }, /** @@ -89669,7 +89188,10 @@ var WebAudioSoundManager = new Class({ */ onFocus: function () { - this.context.resume(); + if (!this.locked) + { + this.context.resume(); + } }, /** @@ -89706,17 +89228,11 @@ var WebAudioSoundManager = new Class({ BaseSoundManager.prototype.destroy.call(this); }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setMute - * @fires Phaser.Sound.WebAudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -89733,7 +89249,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.WebAudioSoundManager#MuteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -89747,22 +89263,16 @@ var WebAudioSoundManager = new Class({ { this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, 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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setVolume - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -89779,7 +89289,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -89793,7 +89303,7 @@ var WebAudioSoundManager = new Class({ { this.masterVolumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } @@ -89804,19 +89314,19 @@ module.exports = WebAudioSoundManager; /***/ }), -/* 350 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(124); +var BaseSound = __webpack_require__(132); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(11); +var EventEmitter = __webpack_require__(9); var Extend = __webpack_require__(21); /** @@ -89931,20 +89441,20 @@ module.exports = NoAudioSound; /***/ }), -/* 351 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(125); +var BaseSoundManager = __webpack_require__(133); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(11); -var NoAudioSound = __webpack_require__(350); +var EventEmitter = __webpack_require__(9); +var NoAudioSound = __webpack_require__(355); var NOOP = __webpack_require__(2); /** @@ -90049,18 +89559,19 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 352 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(124); +var BaseSound = __webpack_require__(132); var Class = __webpack_require__(0); +var Events = __webpack_require__(75); /** * @classdesc @@ -90148,18 +89659,13 @@ var HTML5AudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.HTML5AudioSound#playEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * 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.HTML5AudioSound#play - * @fires Phaser.Sound.HTML5AudioSound#playEvent + * @fires Phaser.Sound.Events#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. @@ -90185,21 +89691,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#pauseEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.HTML5AudioSound#pause - * @fires Phaser.Sound.HTML5AudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -90226,21 +89727,16 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#resumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.HTML5AudioSound#resume - * @fires Phaser.Sound.HTML5AudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -90268,21 +89764,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#stopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.HTML5AudioSound#stop - * @fires Phaser.Sound.HTML5AudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -90302,7 +89793,7 @@ var HTML5AudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndReleaseAudioTag(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -90511,22 +90002,12 @@ var HTML5AudioSound = new Class({ this.pickAndPlayAudioTag(); }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.HTML5AudioSound#endedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.HTML5AudioSound#update - * @fires Phaser.Sound.HTML5AudioSound#loopedEvent - * @fires Phaser.Sound.HTML5AudioSound#endedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -90575,7 +90056,7 @@ var HTML5AudioSound = new Class({ if (currentTime < this.previousTime) { - this.emit('looped', this); + this.emit(Events.LOOPED, this); } } else if (currentTime >= endTime) @@ -90584,7 +90065,7 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); return; } @@ -90658,12 +90139,6 @@ var HTML5AudioSound = new Class({ } }, - /** - * @event Phaser.Sound.HTML5AudioSound#muteEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -90671,6 +90146,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -90689,7 +90165,9 @@ var HTML5AudioSound = new Class({ return; } - this.emit('mute', this, value); + this.updateMute(); + + this.emit(Events.MUTE, this, value); } }, @@ -90697,7 +90175,7 @@ var HTML5AudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setMute - * @fires Phaser.Sound.HTML5AudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -90711,18 +90189,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#volumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.HTML5AudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -90741,7 +90214,9 @@ var HTML5AudioSound = new Class({ return; } - this.emit('volume', this, value); + this.updateVolume(); + + this.emit(Events.VOLUME, this, value); } }, @@ -90749,7 +90224,7 @@ var HTML5AudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setVolume - * @fires Phaser.Sound.HTML5AudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -90763,12 +90238,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#rateEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -90777,6 +90246,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -90790,7 +90260,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.rate = value; - if (this.manager.isLocked(this, 'rate', value)) + if (this.manager.isLocked(this, Events.RATE, value)) { return; } @@ -90798,7 +90268,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } } @@ -90811,7 +90281,7 @@ var HTML5AudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.HTML5AudioSound#setRate - * @fires Phaser.Sound.HTML5AudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -90825,12 +90295,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#detuneEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -90838,6 +90302,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -90851,7 +90316,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.detune = value; - if (this.manager.isLocked(this, 'detune', value)) + if (this.manager.isLocked(this, Events.DETUNE, value)) { return; } @@ -90859,7 +90324,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } } @@ -90870,7 +90335,7 @@ var HTML5AudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.HTML5AudioSound#setDetune - * @fires Phaser.Sound.HTML5AudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -90884,12 +90349,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#seekEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -90898,6 +90357,7 @@ var HTML5AudioSound = new Class({ * * @name Phaser.Sound.HTML5AudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -90944,7 +90404,7 @@ var HTML5AudioSound = new Class({ this.currentConfig.seek = value; } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -90953,7 +90413,7 @@ var HTML5AudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.HTML5AudioSound#setSeek - * @fires Phaser.Sound.HTML5AudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -90967,18 +90427,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.HTML5AudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -91002,7 +90457,7 @@ var HTML5AudioSound = new Class({ this.audio.loop = value; } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -91011,7 +90466,7 @@ var HTML5AudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setLoop - * @fires Phaser.Sound.HTML5AudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. @@ -91031,19 +90486,20 @@ module.exports = HTML5AudioSound; /***/ }), -/* 353 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(125); +var BaseSoundManager = __webpack_require__(133); var Class = __webpack_require__(0); -var HTML5AudioSound = __webpack_require__(352); +var Events = __webpack_require__(75); +var HTML5AudioSound = __webpack_require__(357); /** * HTML5 Audio implementation of the Sound Manager. @@ -91274,7 +90730,7 @@ var HTML5AudioSoundManager = new Class({ }); }; - this.once('unlocked', function () + this.once(Events.UNLOCKED, function () { this.forEachActiveSound(function (sound) { @@ -91390,17 +90846,11 @@ var HTML5AudioSoundManager = new Class({ return false; }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setMute - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -91417,7 +90867,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -91436,22 +90886,16 @@ var HTML5AudioSoundManager = new Class({ sound.updateMute(); }); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, this, value); } }, - /** - * @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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setVolume - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -91468,7 +90912,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -91487,7 +90931,7 @@ var HTML5AudioSoundManager = new Class({ sound.updateVolume(); }); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } @@ -91498,19 +90942,19 @@ module.exports = HTML5AudioSoundManager; /***/ }), -/* 354 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(353); -var NoAudioSoundManager = __webpack_require__(351); -var WebAudioSoundManager = __webpack_require__(349); +var HTML5AudioSoundManager = __webpack_require__(358); +var NoAudioSoundManager = __webpack_require__(356); +var WebAudioSoundManager = __webpack_require__(354); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -91548,19 +90992,19 @@ module.exports = SoundManagerCreator; /***/ }), -/* 355 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(126); +var CONST = __webpack_require__(134); var GetValue = __webpack_require__(4); -var Merge = __webpack_require__(79); -var InjectionMap = __webpack_require__(960); +var Merge = __webpack_require__(84); +var InjectionMap = __webpack_require__(1020); /** * @namespace Phaser.Scenes.Settings @@ -91569,50 +91013,50 @@ var InjectionMap = __webpack_require__(960); /** * @typedef {object} Phaser.Scenes.Settings.Config * - * @property {string} [key] - [description] - * @property {boolean} [active=false] - [description] - * @property {boolean} [visible=true] - [description] - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - [description] - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - [description] + * @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance. + * @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step. + * @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object. * @property {Object.} [map] - Overwrites the default injection map for a scene. * @property {Object.} [mapAdd] - Extends the injection map for a scene. - * @property {object} [physics={}] - [description] - * @property {object} [loader={}] - [description] - * @property {(false|*)} [plugins=false] - [description] + * @property {object} [physics={}] - The physics configuration object for the Scene. + * @property {object} [loader={}] - The loader configuration object for the Scene. + * @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene. */ /** * @typedef {object} Phaser.Scenes.Settings.Object * - * @property {number} status - [description] - * @property {string} key - [description] - * @property {boolean} active - [description] - * @property {boolean} visible - [description] - * @property {boolean} isBooted - [description] - * @property {boolean} isTransition - [description] - * @property {?Phaser.Scene} transitionFrom - [description] - * @property {integer} transitionDuration - [description] - * @property {boolean} transitionAllowInput - [description] - * @property {object} data - [description] - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - [description] - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - [description] - * @property {Object.} map - [description] - * @property {object} physics - [description] - * @property {object} loader - [description] - * @property {(false|*)} plugins - [description] + * @property {number} status - The current status of the Scene. Maps to the Scene constants. + * @property {string} key - The unique key of this Scene. Unique within the entire Game instance. + * @property {boolean} active - The active state of this Scene. An active Scene updates each step. + * @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step. + * @property {boolean} isBooted - Has the Scene finished booting? + * @property {boolean} isTransition - Is the Scene in a state of transition? + * @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set. + * @property {integer} transitionDuration - The duration of the transition, if set. + * @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions? + * @property {object} data - a data bundle passed to this Scene from the Scene Manager. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - The Camera configuration object. + * @property {Object.} map - The Scene's Injection Map. + * @property {object} physics - The physics configuration object for the Scene. + * @property {object} loader - The loader configuration object for the Scene. + * @property {(false|*)} plugins - The plugin configuration object for the Scene. */ var Settings = { /** - * Takes a Scene configuration object and returns a fully formed Systems object. + * Takes a Scene configuration object and returns a fully formed System Settings object. * * @function Phaser.Scenes.Settings.create * @since 3.0.0 * - * @param {(string|Phaser.Scenes.Settings.Config)} config - [description] + * @param {(string|Phaser.Scenes.Settings.Config)} config - The Scene configuration object used to create this Scene Settings. * - * @return {Phaser.Scenes.Settings.Object} [description] + * @return {Phaser.Scenes.Settings.Object} The Scene Settings object created as a result of the config and default settings. */ create: function (config) { @@ -91680,12 +91124,12 @@ module.exports = Settings; /***/ }), -/* 356 */ +/* 361 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -91717,21 +91161,21 @@ module.exports = UppercaseFirst; /***/ }), -/* 357 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Systems = __webpack_require__(182); +var Systems = __webpack_require__(194); /** * @classdesc - * [description] + * A base Phaser.Scene class which you could extend for your own use. * * @class Scene * @memberof Phaser @@ -91964,6 +91408,29 @@ var Scene = new Class({ * @since 3.0.0 */ this.matter; + + if (true) + { + /** + * A scene level Facebook Instant Games Plugin. + * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured. + * + * @name Phaser.Scene#facebook + * @type {Phaser.FacebookInstantGamesPlugin} + * @since 3.12.0 + */ + this.facebook; + } + + /** + * A reference to the global Scale Manager. + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.2 + */ + this.scale; }, /** @@ -91986,21 +91453,24 @@ module.exports = Scene; /***/ }), -/* 358 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(126); +var CONST = __webpack_require__(134); +var Events = __webpack_require__(16); +var GameEvents = __webpack_require__(28); var GetValue = __webpack_require__(4); +var LoaderEvents = __webpack_require__(85); var NOOP = __webpack_require__(2); -var Scene = __webpack_require__(357); -var Systems = __webpack_require__(182); +var Scene = __webpack_require__(362); +var Systems = __webpack_require__(194); /** * @classdesc @@ -92143,7 +91613,7 @@ var SceneManager = new Class({ } } - game.events.once('ready', this.bootQueue, this); + game.events.once(GameEvents.READY, this.bootQueue, this); }, /** @@ -92430,6 +91900,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#bootScene * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to boot. @@ -92447,7 +91918,7 @@ var SceneManager = new Class({ if (settings.isTransition) { - sys.events.emit('transitioninit', settings.transitionFrom, settings.transitionDuration); + sys.events.emit(Events.TRANSITION_INIT, settings.transitionFrom, settings.transitionDuration); } } @@ -92474,7 +91945,7 @@ var SceneManager = new Class({ settings.status = CONST.LOADING; // Start the loader going as we have something in the queue - loader.once('complete', this.loadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.loadComplete, this); loader.start(); } @@ -92551,26 +92022,6 @@ var SceneManager = new Class({ } }, - /** - * Informs the Scenes of the Game being resized. - * - * @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); - } - }, - /** * Renders the Scenes. * @@ -92600,6 +92051,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#create * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to create. @@ -92614,11 +92066,11 @@ var SceneManager = new Class({ settings.status = CONST.CREATING; scene.create.call(scene, settings.data); + } - if (settings.isTransition) - { - sys.events.emit('transitionstart', settings.transitionFrom, settings.transitionDuration); - } + if (settings.isTransition) + { + sys.events.emit(Events.TRANSITION_START, settings.transitionFrom, settings.transitionDuration); } // If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP @@ -92823,6 +92275,41 @@ var SceneManager = new Class({ } }, + /** + * Returns an array of all the current Scenes being managed by this Scene Manager. + * + * You can filter the output by the active state of the Scene and choose to have + * the array returned in normal or reversed order. + * + * @method Phaser.Scenes.SceneManager#getScenes + * @since 3.16.0 + * + * @param {boolean} [isActive=true] - Only include Scene's that are currently active? + * @param {boolean} [inReverse=false] - Return the array of Scenes in reverse? + * + * @return {Phaser.Scene[]} An array containing all of the Scenes in the Scene Manager. + */ + getScenes: function (isActive, inReverse) + { + if (isActive === undefined) { isActive = true; } + if (inReverse === undefined) { inReverse = false; } + + var out = []; + var scenes = this.scenes; + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene && (!isActive || (isActive && scene.sys.isActive()))) + { + out.push(scene); + } + } + + return (inReverse) ? out.reverse() : out; + }, + /** * Retrieves a Scene. * @@ -93121,7 +92608,7 @@ var SceneManager = new Class({ { scene.sys.settings.status = CONST.LOADING; - loader.once('complete', this.payloadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); loader.start(); @@ -93569,114 +93056,2420 @@ module.exports = SceneManager; /***/ }), -/* 359 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(100); +var Clamp = __webpack_require__(24); +var Class = __webpack_require__(0); +var SnapFloor = __webpack_require__(107); +var Vector2 = __webpack_require__(3); /** - * Removes the given item, or array of items, from the array. + * @classdesc + * The Size component allows you to set `width` and `height` properties and define the relationship between them. * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * The component can automatically maintain the aspect ratios between the two values, and clamp them + * to a defined min-max range. You can also control the dominant axis. When dimensions are given to the Size component + * that would cause it to exceed its min-max range, the dimensions are adjusted based on the dominant axis. * - * @function Phaser.Utils.Array.Remove - * @since 3.4.0 + * @class Size + * @memberof Phaser.Structs + * @constructor + * @since 3.16.0 * - * @param {array} array - The array to be modified. - * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. - * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + * @param {number} [width=0] - The width of the Size component. + * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. + * @param {integer} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ -var Remove = function (array, item, callback, context) -{ - if (context === undefined) { context = array; } +var Size = new Class({ - var index; + initialize: - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) + function Size (width, height, aspectMode, parent) { - index = array.indexOf(item); + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (aspectMode === undefined) { aspectMode = 0; } + if (parent === undefined) { parent = null; } - if (index !== -1) - { - SpliceOne(array, index); + /** + * Internal width value. + * + * @name Phaser.Structs.Size#_width + * @type {number} + * @private + * @since 3.16.0 + */ + this._width = width; - if (callback) - { - callback.call(context, item); - } + /** + * Internal height value. + * + * @name Phaser.Structs.Size#_height + * @type {number} + * @private + * @since 3.16.0 + */ + this._height = height; - return item; - } - else - { - return null; - } - } + /** + * Internal parent reference. + * + * @name Phaser.Structs.Size#_parent + * @type {any} + * @private + * @since 3.16.0 + */ + this._parent = parent; - // If we got this far, we have an array of items to remove + /** + * The aspect mode this Size component will use when calculating its dimensions. + * This property is read-only. To change it use the `setAspectMode` method. + * + * @name Phaser.Structs.Size#aspectMode + * @type {integer} + * @readonly + * @since 3.16.0 + */ + this.aspectMode = aspectMode; - var itemLength = item.length - 1; + /** + * The proportional relationship between the width and height. + * + * This property is read-only and is updated automatically when either the `width` or `height` properties are changed, + * depending on the aspect mode. + * + * @name Phaser.Structs.Size#aspectRatio + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.aspectRatio = (height === 0) ? 1 : width / height; - while (itemLength >= 0) + /** + * The minimum allowed width. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minWidth = 0; + + /** + * The minimum allowed height. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minHeight = 0; + + /** + * The maximum allowed width. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxWidth = Number.MAX_VALUE; + + /** + * The maximum allowed height. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxHeight = Number.MAX_VALUE; + + /** + * A Vector2 containing the horizontal and vertical snap values, which the width and height are snapped to during resizing. + * + * By default this is disabled. + * + * This property is read-only. To change it see the `setSnap` method. + * + * @name Phaser.Structs.Size#snapTo + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.snapTo = new Vector2(); + }, + + /** + * Sets the aspect mode of this Size component. + * + * The aspect mode controls what happens when you modify the `width` or `height` properties, or call `setSize`. + * + * It can be a number from 0 to 4, or a Size constant: + * + * 0. NONE = Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * 1. WIDTH_CONTROLS_HEIGHT = The height is automatically adjusted based on the width. + * 2. HEIGHT_CONTROLS_WIDTH = The width is automatically adjusted based on the height. + * 3. FIT = The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * 4. ENVELOP = The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setAspectMode + * @since 3.16.0 + * + * @param {integer} [value=0] - The aspect mode value. + * + * @return {this} This Size component instance. + */ + setAspectMode: function (value) { - var entry = item[itemLength]; + if (value === undefined) { value = 0; } - index = array.indexOf(entry); + this.aspectMode = value; - if (index !== -1) + return this.setSize(this._width, this._height); + }, + + /** + * By setting a Snap To value when this Size component is modified its dimensions will automatically + * by snapped to the nearest grid slice, using floor. For example, if you have snap value of 16, + * and the width changes to 68, then it will snap down to 64 (the closest multiple of 16 when floored) + * + * Note that snapping takes place before adjustments by the parent, or the min / max settings. If these + * values are not multiples of the given snap values, then this can result in un-snapped dimensions. + * + * Call this method with no arguments to reset the snap values. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setSnap + * @since 3.16.0 + * + * @param {number} [snapWidth=0] - The amount to snap the width to. If you don't want to snap the width, pass a value of zero. + * @param {number} [snapHeight=snapWidth] - The amount to snap the height to. If not provided it will use the `snapWidth` value. If you don't want to snap the height, pass a value of zero. + * + * @return {this} This Size component instance. + */ + setSnap: function (snapWidth, snapHeight) + { + if (snapWidth === undefined) { snapWidth = 0; } + if (snapHeight === undefined) { snapHeight = snapWidth; } + + this.snapTo.set(snapWidth, snapHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets, or clears, the parent of this Size component. + * + * To clear the parent call this method with no arguments. + * + * The parent influences the maximum extents to which this Size compoent can expand, + * based on the aspect mode: + * + * NONE - The parent clamps both the width and height. + * WIDTH_CONTROLS_HEIGHT - The parent clamps just the width. + * HEIGHT_CONTROLS_WIDTH - The parent clamps just the height. + * FIT - The parent clamps whichever axis is required to ensure the size fits within it. + * ENVELOP - The parent is used to ensure the size fully envelops the parent. + * + * Calling this method automatically calls `setSize`. + * + * @method Phaser.Structs.Size#setParent + * @since 3.16.0 + * + * @param {any} [parent] - Sets the parent of this Size component. Don't provide a value to clear an existing parent. + * + * @return {this} This Size component instance. + */ + setParent: function (parent) + { + this._parent = parent; + + return this.setSize(this._width, this._height); + }, + + /** + * Set the minimum width and height values this Size component will allow. + * + * The minimum values can never be below zero, or greater than the maximum values. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the minimums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMin + * @since 3.16.0 + * + * @param {number} [width=0] - The minimum allowed width of the Size component. + * @param {number} [height=width] - The minimum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMin: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + + this.minWidth = Clamp(width, 0, this.maxWidth); + this.minHeight = Clamp(height, 0, this.maxHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Set the maximum width and height values this Size component will allow. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the maximums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMax + * @since 3.16.0 + * + * @param {number} [width=Number.MAX_VALUE] - The maximum allowed width of the Size component. + * @param {number} [height=width] - The maximum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMax: function (width, height) + { + if (width === undefined) { width = Number.MAX_VALUE; } + if (height === undefined) { height = width; } + + this.maxWidth = Clamp(width, this.minWidth, Number.MAX_VALUE); + this.maxHeight = Clamp(height, this.minHeight, Number.MAX_VALUE); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets the width and height of this Size component based on the aspect mode. + * + * If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current + * aspect ratio is honored across all other modes. + * + * If snapTo values have been set then the given width and height are snapped first, prior to any further + * adjustment via min/max values, or a parent. + * + * If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into + * that range prior to adjustment, but may still exceed them depending on the aspect mode. + * + * If this Size component has a parent set, and the aspect mode is `fit` or `envelop`, then the given sizes will + * be clamped to the range specified by the parent. + * + * @method Phaser.Structs.Size#setSize + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setSize: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + + switch (this.aspectMode) { - SpliceOne(array, index); + case Size.NONE: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + break; - if (callback) + case Size.WIDTH_CONTROLS_HEIGHT: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(this._width * (1 / this.aspectRatio), false); + break; + + case Size.HEIGHT_CONTROLS_WIDTH: + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this._width = this.getNewWidth(this._height * this.aspectRatio, false); + break; + + case Size.FIT: + this.constrain(width, height, true); + break; + + case Size.ENVELOP: + this.constrain(width, height, false); + break; + } + + return this; + }, + + /** + * Sets a new aspect ratio, overriding what was there previously. + * + * It then calls `setSize` immediately using the current dimensions. + * + * @method Phaser.Structs.Size#setAspectRatio + * @since 3.16.0 + * + * @param {number} ratio - The new aspect ratio. + * + * @return {this} This Size component instance. + */ + setAspectRatio: function (ratio) + { + this.aspectRatio = ratio; + + return this.setSize(this._width, this._height); + }, + + /** + * Sets a new width and height for this Size component and updates the aspect ratio based on them. + * + * It _doesn't_ change the `aspectMode` and still factors in size limits such as the min max and parent bounds. + * + * @method Phaser.Structs.Size#resize + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + resize: function (width, height) + { + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + + return this; + }, + + /** + * Takes a new width and passes it through the min/max clamp and then checks it doesn't exceed the parent width. + * + * @method Phaser.Structs.Size#getNewWidth + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified width value. + */ + getNewWidth: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minWidth, this.maxWidth); + + if (checkParent && this._parent && value > this._parent.width) + { + value = Math.max(this.minWidth, this._parent.width); + } + + return value; + }, + + /** + * Takes a new height and passes it through the min/max clamp and then checks it doesn't exceed the parent height. + * + * @method Phaser.Structs.Size#getNewHeight + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified height value. + */ + getNewHeight: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minHeight, this.maxHeight); + + if (checkParent && this._parent && value > this._parent.height) + { + value = Math.max(this.minHeight, this._parent.height); + } + + return value; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * If `fit` is true there may be some space inside the target area which is not covered if its aspect ratio differs. + * If `fit` is false the size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#constrain + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * @param {boolean} [fit=true] - Perform a `fit` (true) constraint, or an `envelop` (false) constraint. + * + * @return {this} This Size component instance. + */ + constrain: function (width, height, fit) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (fit === undefined) { fit = true; } + + width = this.getNewWidth(width); + height = this.getNewHeight(height); + + var snap = this.snapTo; + var newRatio = (height === 0) ? 1 : width / height; + + if ((fit && this.aspectRatio > newRatio) || (!fit && this.aspectRatio < newRatio)) + { + // We need to change the height to fit the width + // height = width / this.aspectRatio; + + width = SnapFloor(width, snap.x); + + height = width / this.aspectRatio; + + if (snap.y > 0) { - callback.call(context, entry); + height = SnapFloor(height, snap.y); + + // Reduce the width accordingly + width = height * this.aspectRatio; } } - else + else if ((fit && this.aspectRatio < newRatio) || (!fit && this.aspectRatio > newRatio)) { - // Item wasn't found in the array, so remove it from our return results - item.pop(); + // We need to change the width to fit the height + // width = height * this.aspectRatio; + + height = SnapFloor(height, snap.y); + + width = height * this.aspectRatio; + + if (snap.x > 0) + { + width = SnapFloor(width, snap.x); + + // Reduce the height accordingly + height = width * (1 / this.aspectRatio); + } + } + + this._width = width; + this._height = height; + + return this; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * There may be some space inside the target area which is not covered if its aspect ratio differs. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#fitTo + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + fitTo: function (width, height) + { + return this.constrain(width, height, true); + }, + + /** + * The current `width` and `height` are adjusted so that they fully envlop the given dimensions, while keeping the aspect ratio. + * + * The size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the values are clamped so that it never exceeds the parent + * on the longest axis. + * + * @method Phaser.Structs.Size#envelop + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + envelop: function (width, height) + { + return this.constrain(width, height, false); + }, + + /** + * Sets the width of this Size component. + * + * Depending on the aspect mode, changing the width may also update the height and aspect ratio. + * + * @method Phaser.Structs.Size#setWidth + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * + * @return {this} This Size component instance. + */ + setWidth: function (value) + { + return this.setSize(value, this._height); + }, + + /** + * Sets the height of this Size component. + * + * Depending on the aspect mode, changing the height may also update the width and aspect ratio. + * + * @method Phaser.Structs.Size#setHeight + * @since 3.16.0 + * + * @param {number} height - The new height of the Size component. + * + * @return {this} This Size component instance. + */ + setHeight: function (value) + { + return this.setSize(this._width, value); + }, + + /** + * Returns a string representation of this Size component. + * + * @method Phaser.Structs.Size#toString + * @since 3.16.0 + * + * @return {string} A string representation of this Size component. + */ + toString: function () + { + return '[{ Size (width=' + this._width + ' height=' + this._height + ' aspectRatio=' + this.aspectRatio + ' aspectMode=' + this.aspectMode + ') }]'; + }, + + /** + * Copies the aspect mode, aspect ratio, width and height from this Size component + * to the given Size component. Note that the parent, if set, is not copied across. + * + * @method Phaser.Structs.Size#copy + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} destination - The Size component to copy the values to. + * + * @return {Phaser.Structs.Size} The updated destination Size component. + */ + copy: function (destination) + { + destination.setAspectMode(this.aspectMode); + + destination.aspectRatio = this.aspectRatio; + + return destination.setSize(this.width, this.height); + }, + + /** + * Destroys this Size component. + * + * This clears the local properties and any parent object, if set. + * + * A destroyed Size component cannot be re-used. + * + * @method Phaser.Structs.Size#destroy + * @since 3.16.0 + */ + destroy: function () + { + this._parent = null; + this.snapTo = null; + }, + + /** + * The width of this Size component. + * + * This value is clamped to the range specified by `minWidth` and `maxWidth`, if enabled. + * + * A width can never be less than zero. + * + * Changing this value will automatically update the `height` if the aspect ratio lock is enabled. + * You can also use the `setWidth` and `getWidth` methods. + * + * @name Phaser.Structs.Size#width + * @type {number} + * @since 3.16.0 + */ + width: { + + get: function () + { + return this._width; + }, + + set: function (value) + { + this.setSize(value, this._height); + } + + }, + + /** + * The height of this Size component. + * + * This value is clamped to the range specified by `minHeight` and `maxHeight`, if enabled. + * + * A height can never be less than zero. + * + * Changing this value will automatically update the `width` if the aspect ratio lock is enabled. + * You can also use the `setHeight` and `getHeight` methods. + * + * @name Phaser.Structs.Size#height + * @type {number} + * @since 3.16.0 + */ + height: { + + get: function () + { + return this._height; + }, + + set: function (value) + { + this.setSize(this._width, value); } - itemLength--; } - return item; -}; +}); -module.exports = Remove; +/** + * Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * + * @name Phaser.Structs.Size.NONE + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.NONE = 0; + +/** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.WIDTH_CONTROLS_HEIGHT = 1; + +/** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.HEIGHT_CONTROLS_WIDTH = 2; + +/** + * The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * + * @name Phaser.Structs.Size.FIT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.FIT = 3; + +/** + * The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Structs.Size.ENVELOP + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.ENVELOP = 4; + +module.exports = Size; /***/ }), -/* 360 */ +/* 365 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scale.Events + */ + +module.exports = { + + ENTER_FULLSCREEN: __webpack_require__(1038), + FULLSCREEN_UNSUPPORTED: __webpack_require__(1037), + LEAVE_FULLSCREEN: __webpack_require__(1036), + ORIENTATION_CHANGE: __webpack_require__(1035), + RESIZE: __webpack_require__(1034) + +}; + + +/***/ }), +/* 366 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(196); +var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(365); +var GameEvents = __webpack_require__(28); +var GetInnerHeight = __webpack_require__(1033); +var GetTarget = __webpack_require__(376); +var GetScreenOrientation = __webpack_require__(381); +var NOOP = __webpack_require__(2); +var Rectangle = __webpack_require__(11); +var Size = __webpack_require__(364); +var SnapFloor = __webpack_require__(107); +var Vector2 = __webpack_require__(3); + +/** + * @classdesc + * The Scale Manager handles the scaling, resizing and alignment of the game canvas. + * + * The way scaling is handled is by setting the game canvas to a fixed size, which is defined in the + * game configuration. You also define the parent container in the game config. If no parent is given, + * it will default to using the document body. The Scale Manager will then look at the available space + * within the _parent_ and scale the canvas accordingly. Scaling is handled by setting the canvas CSS + * width and height properties, leaving the width and height of the canvas element itself untouched. + * Scaling is therefore achieved by keeping the core canvas the same size and 'stretching' + * it via its CSS properties. This gives the same result and speed as using the `transform-scale` CSS + * property, without the need for browser prefix handling. + * + * The calculations for the scale are heavily influenced by the bounding parent size, which is the computed + * dimensions of the canvas's parent. The CSS rules of the parent element play an important role in the + * operation of the Scale Manager. For example, if the parent has no defined width or height, then actions + * like auto-centering will fail to achieve the required result. The Scale Manager works in tandem with the + * CSS you set-up on the page hosting your game, rather than taking control of it. + * + * #### Parent and Display canvas containment guidelines: + * + * - Style the Parent element (of the game canvas) to control the Parent size and thus the games size and layout. + * + * - The Parent element's CSS styles should _effectively_ apply maximum (and minimum) bounding behavior. + * + * - The Parent element should _not_ apply a padding as this is not accounted for. + * If a padding is required apply it to the Parent's parent or apply a margin to the Parent. + * If you need to add a border, margin or any other CSS around your game container, then use a parent element and + * apply the CSS to this instead, otherwise you'll be constantly resizing the shape of the game container. + * + * - The Display canvas layout CSS styles (i.e. margins, size) should not be altered / specified as + * they may be updated by the Scale Manager. + * + * #### Scale Modes + * + * The way the scaling is handled is determined by the `scaleMode` property. The default is `NO_SCALE`, + * which prevents Phaser from scaling or touching the canvas, or its parent, at all. In this mode, you are + * responsible for all scaling. The other scaling modes afford you automatic scaling. + * + * If you wish to scale your game so that it always fits into the available space within the parent, you + * should use the scale mode `FIT`. Look at the documentation for other scale modes to see what options are + * available. Here is a basic config showing how to set this scale mode: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * mode: Phaser.Scale.FIT, + * width: 800, + * height: 600 + * } + * ``` + * + * Place the `scale` config object within your game config. + * + * If you wish for the canvas to be resized directly, so that the canvas itself fills the available space + * (i.e. it isn't scaled, it's resized) then use the `RESIZE` scale mode. This will give you a 1:1 mapping + * of canvas pixels to game size. In this mode CSS isn't used to scale the canvas, it's literally adjusted + * to fill all available space within the parent. You should be extremely careful about the size of the + * canvas you're creating when doing this, as the larger the area, the more work the GPU has to do and it's + * very easy to hit fill-rate limits quickly. + * + * For complex, custom-scaling requirements, you should probably consider using the `RESIZE` scale mode, + * with your own limitations in place re: canvas dimensions and managing the scaling with the game scenes + * yourself. For the vast majority of games, however, the `FIT` mode is likely to be the most used. + * + * Please appreciate that the Scale Manager cannot perform miracles. All it does is scale your game canvas + * as best it can, based on what it can infer from its surrounding area. There are all kinds of environments + * where it's up to you to guide and help the canvas position itself, especially when built into rendering + * frameworks like React and Vue. If your page requires meta tags to prevent user scaling gestures, or such + * like, then it's up to you to ensure they are present in the html. + * + * #### Centering + * + * You can also have the game canvas automatically centered. Again, this relies heavily on the parent being + * properly configured and styled, as the centering offsets are based entirely on the available space + * within the parent element. Centering is disabled by default, or can be applied horizontally, vertically, + * or both. Here's an example: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * autoCenter: Phaser.Scale.CENTER_BOTH, + * width: 800, + * height: 600 + * } + * ``` + * + * #### Fullscreen API + * + * If the browser supports it, you can send your game into fullscreen mode. In this mode, the game will fill + * the entire display, removing all browser UI and anything else present on the screen. It will remain in this + * mode until your game either disables it, or until the user tabs out or presses ESCape if on desktop. It's a + * great way to achieve a desktop-game like experience from the browser, but it does require a modern browser + * to handle it. Some mobile browsers also support this. + * + * @class ScaleManager + * @memberof Phaser.Scale + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance. + */ +var ScaleManager = new Class({ + + Extends: EventEmitter, + + initialize: + + function ScaleManager (game) + { + EventEmitter.call(this); + + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Scale.ScaleManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.15.0 + */ + this.game = game; + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * + * @name Phaser.Scale.ScaleManager#canvas + * @type {HTMLCanvasElement} + * @since 3.16.0 + */ + this.canvas; + + /** + * The DOM bounds of the canvas element. + * + * @name Phaser.Scale.ScaleManager#canvasBounds + * @type {Phaser.Geom.Rectangle} + * @since 3.16.0 + */ + this.canvasBounds = new Rectangle(); + + /** + * The parent object of the Canvas. Often a div, or the browser window, or nothing in non-browser environments. + * + * This is set in the Game Config as the `parent` property. If undefined (or just not present), it will default + * to use the document body. If specifically set to `null` Phaser will ignore all parent operations. + * + * @name Phaser.Scale.ScaleManager#parent + * @type {?any} + * @since 3.16.0 + */ + this.parent = null; + + /** + * Is the parent element the browser window? + * + * @name Phaser.Scale.ScaleManager#parentIsWindow + * @type {boolean} + * @since 3.16.0 + */ + this.parentIsWindow = false; + + /** + * The Parent Size component. + * + * @name Phaser.Scale.ScaleManager#parentSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.parentSize = new Size(); + + /** + * The Game Size component. + * + * The un-modified game size, as requested in the game config (the raw width / height), + * as used for world bounds, cameras, etc + * + * @name Phaser.Scale.ScaleManager#gameSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.gameSize = new Size(); + + /** + * The Base Size component. + * + * The modified game size, which is the gameSize * resolution, used to set the canvas width and height + * (but not the CSS style) + * + * @name Phaser.Scale.ScaleManager#baseSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.baseSize = new Size(); + + /** + * The Display Size component. + * + * The size used for the canvas style, factoring in the scale mode, parent and other values. + * + * @name Phaser.Scale.ScaleManager#displaySize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.displaySize = new Size(); + + /** + * The game scale mode. + * + * @name Phaser.Scale.ScaleManager#scaleMode + * @type {Phaser.Scale.ScaleModeType} + * @since 3.16.0 + */ + this.scaleMode = CONST.SCALE_MODE.NONE; + + /** + * The canvas resolution. + * + * This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date. + * + * @name Phaser.Scale.ScaleManager#resolution + * @type {number} + * @since 3.16.0 + */ + this.resolution = 1; + + /** + * The game zoom factor. + * + * This value allows you to multiply your games base size by the given zoom factor. + * This is then used when calculating the display size, even in `NO_SCALE` situations. + * If you don't want Phaser to touch the canvas style at all, this value should be 1. + * + * Can also be set to `MAX_ZOOM` in which case the zoom value will be derived based + * on the game size and available space within the parent. + * + * @name Phaser.Scale.ScaleManager#zoom + * @type {number} + * @since 3.16.0 + */ + this.zoom = 1; + + /** + * The scale factor between the baseSize and the canvasBounds. + * + * @name Phaser.Scale.ScaleManager#displayScale + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ + this.displayScale = new Vector2(1, 1); + + /** + * If set, the canvas sizes will be automatically passed through Math.floor. + * This results in rounded pixel display values, which is important for performance on legacy + * and low powered devices, but at the cost of not achieving a 'perfect' fit in some browser windows. + * + * @name Phaser.Scale.ScaleManager#autoRound + * @type {boolean} + * @since 3.16.0 + */ + this.autoRound = false; + + /** + * Automatically center the canvas within the parent? The different centering modes are: + * + * 1. No centering. + * 2. Center both horizontally and vertically. + * 3. Center horizontally. + * 4. Center vertically. + * + * Please be aware that in order to center the game canvas, you must have specified a parent + * that has a size set, or the canvas parent is the document.body. + * + * @name Phaser.Scale.ScaleManager#autoCenter + * @type {Phaser.Scale.CenterType} + * @since 3.16.0 + */ + this.autoCenter = CONST.CENTER.NO_CENTER; + + /** + * The current device orientation. + * + * Orientation events are dispatched via the Device Orientation API, typically only on mobile browsers. + * + * @name Phaser.Scale.ScaleManager#orientation + * @type {Phaser.Scale.OrientationType} + * @since 3.16.0 + */ + this.orientation = CONST.ORIENTATION.LANDSCAPE; + + /** + * A reference to the Device.Fullscreen object. + * + * @name Phaser.Scale.ScaleManager#fullscreen + * @type {Phaser.Device.Fullscreen} + * @since 3.16.0 + */ + this.fullscreen; + + /** + * The DOM Element which is sent into fullscreen mode. + * + * @name Phaser.Scale.ScaleManager#fullscreenTarget + * @type {?any} + * @since 3.16.0 + */ + this.fullscreenTarget = null; + + /** + * Did Phaser create the fullscreen target div, or was it provided in the game config? + * + * @name Phaser.Scale.ScaleManager#_createdFullscreenTarget + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._createdFullscreenTarget = false; + + /** + * Internal var that keeps track of the user, or the browser, requesting fullscreen changes. + * + * @name Phaser.Scale.ScaleManager#_requestedFullscreenChange + * @type {boolean} + * @private + * @since 3.16.2 + */ + this._requestedFullscreenChange = false; + + /** + * The dirty state of the Scale Manager. + * Set if there is a change between the parent size and the current size. + * + * @name Phaser.Scale.ScaleManager#dirty + * @type {boolean} + * @since 3.16.0 + */ + this.dirty = false; + + /** + * How many milliseconds should elapse before checking if the browser size has changed? + * + * Most modern browsers dispatch a 'resize' event, which the Scale Manager will listen for. + * However, older browsers fail to do this, or do it consistently, so we fall back to a + * more traditional 'size check' based on a time interval. You can control how often it is + * checked here. + * + * @name Phaser.Scale.ScaleManager#resizeInterval + * @type {integer} + * @since 3.16.0 + */ + this.resizeInterval = 500; + + /** + * Internal size interval tracker. + * + * @name Phaser.Scale.ScaleManager#_lastCheck + * @type {integer} + * @private + * @since 3.16.0 + */ + this._lastCheck = 0; + + /** + * Internal flag to check orientation state. + * + * @name Phaser.Scale.ScaleManager#_checkOrientation + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._checkOrientation = false; + + /** + * Internal object containing our defined event listeners. + * + * @name Phaser.Scale.ScaleManager#listeners + * @type {object} + * @private + * @since 3.16.0 + */ + this.listeners = { + + orientationChange: NOOP, + windowResize: NOOP, + fullScreenChange: NOOP, + fullScreenError: NOOP + + }; + }, + + /** + * Called _before_ the canvas object is created and added to the DOM. + * + * @method Phaser.Scale.ScaleManager#preBoot + * @protected + * @listens Phaser.Core.Events#BOOT + * @since 3.16.0 + */ + preBoot: function () + { + // Parse the config to get the scaling values we need + this.parseConfig(this.game.config); + + this.game.events.once('boot', this.boot, this); + }, + + /** + * The Boot handler is called by Phaser.Game when it first starts up. + * The renderer is available by now and the canvas has been added to the DOM. + * + * @method Phaser.Scale.ScaleManager#boot + * @protected + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + */ + boot: function () + { + var game = this.game; + + this.canvas = game.canvas; + + this.fullscreen = game.device.fullscreen; + + if (this.scaleMode !== CONST.SCALE_MODE.RESIZE) + { + this.displaySize.setAspectMode(this.scaleMode); + } + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + this.resize(this.width, this.height); + } + else + { + this.getParentBounds(); + + // Only set the parent bounds if the parent has an actual size + if (this.parentSize.width > 0 && this.parentSize.height > 0) + { + this.displaySize.setParent(this.parentSize); + } + + this.refresh(); + } + + game.events.on(GameEvents.PRE_STEP, this.step, this); + + this.startListeners(); + }, + + /** + * Parses the game configuration to set-up the scale defaults. + * + * @method Phaser.Scale.ScaleManager#parseConfig + * @protected + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + parseConfig: function (config) + { + // Get the parent element, if any + this.getParent(config); + + // Get the size of the parent element + // This can often set a height of zero (especially for un-styled divs) + this.getParentBounds(); + + var width = config.width; + var height = config.height; + var scaleMode = config.scaleMode; + var resolution = config.resolution; + var zoom = config.zoom; + var autoRound = config.autoRound; + + // If width = '100%', or similar value + if (typeof width === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentWidth = this.parentSize.width; + + if (parentWidth === 0) + { + parentWidth = window.innerWidth; + } + + var parentScaleX = parseInt(width, 10) / 100; + + width = Math.floor(parentWidth * parentScaleX); + } + + // If height = '100%', or similar value + if (typeof height === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentHeight = this.parentSize.height; + + if (parentHeight === 0) + { + parentHeight = window.innerHeight; + } + + var parentScaleY = parseInt(height, 10) / 100; + + height = Math.floor(parentHeight * parentScaleY); + } + + // This is fixed at 1 on purpose. + // Changing it will break all user input. + // Wait for another release to solve this issue. + this.resolution = 1; + + this.scaleMode = scaleMode; + + this.autoRound = autoRound; + + this.autoCenter = config.autoCenter; + + this.resizeInterval = config.resizeInterval; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.setSize(width, height); + + if (zoom === CONST.ZOOM.MAX_ZOOM) + { + zoom = this.getMaxZoom(); + } + + this.zoom = zoom; + + // The modified game size, which is the w/h * resolution + this.baseSize.setSize(width * resolution, height * resolution); + + if (autoRound) + { + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } + + if (config.minWidth > 0) + { + this.displaySize.setMin(config.minWidth * zoom, config.minHeight * zoom); + } + + if (config.maxWidth > 0) + { + this.displaySize.setMax(config.maxWidth * zoom, config.maxHeight * zoom); + } + + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) + this.displaySize.setSize(width, height); + + this.orientation = GetScreenOrientation(width, height); + }, + + /** + * Determines the parent element of the game canvas, if any, based on the game configuration. + * + * @method Phaser.Scale.ScaleManager#getParent + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + getParent: function (config) + { + var parent = config.parent; + + if (parent === null) + { + // User is responsible for managing the parent + return; + } + + this.parent = GetTarget(parent); + this.parentIsWindow = (this.parent === document.body); + + if (config.expandParent && config.scaleMode !== CONST.SCALE_MODE.NONE) + { + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow || DOMRect.height === 0) + { + document.documentElement.style.height = '100%'; + document.body.style.height = '100%'; + + DOMRect = this.parent.getBoundingClientRect(); + + // The parent STILL has no height, clearly no CSS + // has been set on it even though we fixed the body :( + if (!this.parentIsWindow && DOMRect.height === 0) + { + this.parent.style.overflow = 'hidden'; + this.parent.style.width = '100%'; + this.parent.style.height = '100%'; + } + } + } + + // And now get the fullscreenTarget + if (config.fullscreenTarget && !this.fullscreenTarget) + { + this.fullscreenTarget = GetTarget(config.fullscreenTarget); + } + }, + + /** + * Calculates the size of the parent bounds and updates the `parentSize` component, if the canvas has a dom parent. + * + * @method Phaser.Scale.ScaleManager#getParentBounds + * @since 3.16.0 + * + * @return {boolean} `true` if the parent bounds have changed size, otherwise `false`. + */ + getParentBounds: function () + { + if (!this.parent) + { + return false; + } + + var parentSize = this.parentSize; + + // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect + + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow && this.game.device.os.iOS) + { + DOMRect.height = GetInnerHeight(true); + } + + var resolution = this.resolution; + var newWidth = DOMRect.width * resolution; + var newHeight = DOMRect.height * resolution; + + if (parentSize.width !== newWidth || parentSize.height !== newHeight) + { + parentSize.setSize(newWidth, newHeight); + + return true; + } + else + { + return false; + } + }, + + /** + * Attempts to lock the orientation of the web browser using the Screen Orientation API. + * + * This API is only available on modern mobile browsers. + * See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details. + * + * @method Phaser.Scale.ScaleManager#lockOrientation + * @since 3.16.0 + * + * @param {string} orientation - The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc. + * + * @return {boolean} `true` if the orientation was successfully locked, otherwise `false`. + */ + lockOrientation: function (orientation) + { + var lock = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation; + + if (lock) + { + return lock(orientation); + } + + return false; + }, + + /** + * This method will set the size of the Parent Size component, which is used in scaling + * and centering calculations. You only need to call this method if you have explicitly + * disabled the use of a parent in your game config, but still wish to take advantage of + * other Scale Manager features. + * + * @method Phaser.Scale.ScaleManager#setParentSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the parent. + * @param {number} height - The new height of the parent. + * + * @return {this} The Scale Manager instance. + */ + setParentSize: function (width, height) + { + this.parentSize.setSize(width, height); + + return this.refresh(); + }, + + /** + * This method will set a new size for your game. + * + * @method Phaser.Scale.ScaleManager#setGameSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + setGameSize: function (width, height) + { + var autoRound = this.autoRound; + var resolution = this.resolution; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + this.baseSize.resize(width * resolution, height * resolution); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this.refresh(); + }, + + /** + * Call this to modify the size of the Phaser canvas element directly. + * You should only use this if you are using the `NO_SCALE` scale mode, + * it will update all internal components completely. + * + * If all you want to do is change the size of the parent, see the `setParentSize` method. + * + * If all you want is to change the base size of the game, but still have the Scale Manager + * manage all the scaling, then see the `setGameSize` method. + * + * This method will set the `gameSize`, `baseSize` and `displaySize` components to the given + * dimensions. It will then resize the canvas width and height to the values given, by + * directly setting the properties. Finally, if you have set the Scale Manager zoom value + * to anything other than 1 (the default), it will set the canvas CSS width and height to + * be the given size multiplied by the zoom factor (the canvas pixel size remains untouched). + * + * If you have enabled `autoCenter`, it is then passed to the `updateCenter` method and + * the margins are set, allowing the canvas to be centered based on its parent element + * alone. Finally, the `displayScale` is adjusted and the RESIZE event dispatched. + * + * @method Phaser.Scale.ScaleManager#resize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + resize: function (width, height) + { + var zoom = this.zoom; + var resolution = this.resolution; + var autoRound = this.autoRound; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + + this.baseSize.resize(width * resolution, height * resolution); + + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + this.canvas.width = this.baseSize.width; + this.canvas.height = this.baseSize.height; + + var style = this.canvas.style; + + var styleWidth = width * zoom; + var styleHeight = height * zoom; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (styleWidth !== width || styleHeight !== height) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + this.getParentBounds(); + + this.updateCenter(); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this; + }, + + /** + * Sets the zoom value of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#setZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {integer} value - The new zoom value of the game. + * + * @return {this} The Scale Manager instance. + */ + setZoom: function (value) + { + this.zoom = value; + + return this.refresh(); + }, + + /** + * Sets the zoom to be the maximum possible based on the _current_ parent size. + * + * @method Phaser.Scale.ScaleManager#setMaxZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + setMaxZoom: function () + { + this.zoom = this.getMaxZoom(); + + return this.refresh(); + }, + + /** + * Refreshes the internal scale values, bounds sizes and orientation checks. + * + * Once finished, dispatches the resize event. + * + * This is called automatically by the Scale Manager when the browser window size changes, + * as long as it is using a Scale Mode other than 'NONE'. + * + * @method Phaser.Scale.ScaleManager#refresh + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + refresh: function () + { + this.updateScale(); + this.updateBounds(); + this.updateOrientation(); + + this.displayScale.set(this.baseSize.width / this.canvasBounds.width, this.baseSize.height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + return this; + }, + + /** + * Internal method that checks the current screen orientation, only if the internal check flag is set. + * + * If the orientation has changed it updates the orientation property and then dispatches the orientation change event. + * + * @method Phaser.Scale.ScaleManager#updateOrientation + * @fires Phaser.Scale.Events#ORIENTATION_CHANGE + * @since 3.16.0 + */ + updateOrientation: function () + { + if (this._checkOrientation) + { + this._checkOrientation = false; + + var newOrientation = GetScreenOrientation(this.width, this.height); + + if (newOrientation !== this.orientation) + { + this.orientation = newOrientation; + + this.emit(Events.ORIENTATION_CHANGE, newOrientation); + } + } + }, + + /** + * Internal method that manages updating the size components based on the scale mode. + * + * @method Phaser.Scale.ScaleManager#updateScale + * @since 3.16.0 + */ + updateScale: function () + { + var style = this.canvas.style; + + var width = this.gameSize.width; + var height = this.gameSize.height; + + var styleWidth; + var styleHeight; + + var zoom = this.zoom; + var autoRound = this.autoRound; + var resolution = 1; + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + // No scale + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (zoom > 1) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + } + else if (this.scaleMode === CONST.SCALE_MODE.RESIZE) + { + // Resize to match parent + + // This will constrain using min/max + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + this.gameSize.setSize(this.displaySize.width, this.displaySize.height); + + this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + this.canvas.width = styleWidth; + this.canvas.height = styleHeight; + } + else + { + // All other scale modes + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + // Update the parentSize incase the canvas / style change modified it + this.getParentBounds(); + + // Finally, update the centering + this.updateCenter(); + }, + + /** + * Calculates and returns the largest possible zoom factor, based on the current + * parent and game sizes. If the parent has no dimensions (i.e. an unstyled div), + * or is smaller than the un-zoomed game, then this will return a value of 1 (no zoom) + * + * @method Phaser.Scale.ScaleManager#getMaxZoom + * @since 3.16.0 + * + * @return {integer} The maximum possible zoom factor. At a minimum this value is always at least 1. + */ + getMaxZoom: function () + { + var zoomH = SnapFloor(this.parentSize.width, this.gameSize.width, 0, true); + var zoomV = SnapFloor(this.parentSize.height, this.gameSize.height, 0, true); + + return Math.max(Math.min(zoomH, zoomV), 1); + }, + + /** + * Calculates and updates the canvas CSS style in order to center it within the + * bounds of its parent. If you have explicitly set parent to be `null` in your + * game config then this method will likely give incorrect results unless you have called the + * `setParentSize` method first. + * + * It works by modifying the canvas CSS `marginLeft` and `marginTop` properties. + * + * If they have already been set by your own style sheet, or code, this will overwrite them. + * + * To prevent the Scale Manager from centering the canvas, either do not set the + * `autoCenter` property in your game config, or make sure it is set to `NO_CENTER`. + * + * @method Phaser.Scale.ScaleManager#updateCenter + * @since 3.16.0 + */ + updateCenter: function () + { + var autoCenter = this.autoCenter; + + if (autoCenter === CONST.CENTER.NO_CENTER) + { + return; + } + + var canvas = this.canvas; + + var style = canvas.style; + + var bounds = canvas.getBoundingClientRect(); + + // var width = parseInt(canvas.style.width, 10) || canvas.width; + // var height = parseInt(canvas.style.height, 10) || canvas.height; + + var width = bounds.width; + var height = bounds.height; + + var offsetX = Math.floor((this.parentSize.width - width) / 2); + var offsetY = Math.floor((this.parentSize.height - height) / 2); + + if (autoCenter === CONST.CENTER.CENTER_HORIZONTALLY) + { + offsetY = 0; + } + else if (autoCenter === CONST.CENTER.CENTER_VERTICALLY) + { + offsetX = 0; + } + + style.marginLeft = offsetX + 'px'; + style.marginTop = offsetY + 'px'; + }, + + /** + * Updates the `canvasBounds` rectangle to match the bounding client rectangle of the + * canvas element being used to track input events. + * + * @method Phaser.Scale.ScaleManager#updateBounds + * @since 3.16.0 + */ + updateBounds: function () + { + var bounds = this.canvasBounds; + var clientRect = this.canvas.getBoundingClientRect(); + + bounds.x = clientRect.left + (window.pageXOffset || 0) - (document.documentElement.clientLeft || 0); + bounds.y = clientRect.top + (window.pageYOffset || 0) - (document.documentElement.clientTop || 0); + bounds.width = clientRect.width; + bounds.height = clientRect.height; + }, + + /** + * Transforms the pageX value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformX + * @since 3.16.0 + * + * @param {number} pageX - The DOM pageX value. + * + * @return {number} The translated value. + */ + transformX: function (pageX) + { + return (pageX - this.canvasBounds.left) * this.displayScale.x; + }, + + /** + * Transforms the pageY value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformY + * @since 3.16.0 + * + * @param {number} pageY - The DOM pageY value. + * + * @return {number} The translated value. + */ + transformY: function (pageY) + { + return (pageY - this.canvasBounds.top) * this.displayScale.y; + }, + + /** + * Sends a request to the browser to ask it to go in to full screen mode, using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Fullscreen API}. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * Performing an action that navigates to another page, or opens another tab, will automatically cancel + * fullscreen mode, as will the user pressing the ESC key. To cancel fullscreen mode from your game, i.e. + * from clicking an icon, call the `stopFullscreen` method. + * + * A browser can only send one DOM element into fullscreen. You can control which element this is by + * setting the `fullscreenTarget` property in your game config, or changing the property in the Scale Manager. + * Note that the game canvas _must_ be a child of the target. If you do not give a target, Phaser will + * automatically create a blank `
` element and move the canvas into it, before going fullscreen. + * When it leaves fullscreen, the div will be removed. + * + * @method Phaser.Scale.ScaleManager#startFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + startFullscreen: function (fullscreenOptions) + { + if (fullscreenOptions === undefined) { fullscreenOptions = { navigationUI: 'hide' }; } + + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return; + } + + if (!fullscreen.active) + { + var fsTarget = this.getFullscreenTarget(); + + this._requestedFullscreenChange = true; + + if (fullscreen.keyboard) + { + fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); + } + else + { + fsTarget[fullscreen.request](fullscreenOptions); + } + + this.getParentBounds(); + + this.refresh(); + + this.emit(Events.ENTER_FULLSCREEN); + } + }, + + /** + * An internal method that gets the target element that is used when entering fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#getFullscreenTarget + * @since 3.16.0 + * + * @return {object} The fullscreen target element. + */ + getFullscreenTarget: function () + { + if (!this.fullscreenTarget) + { + var fsTarget = document.createElement('div'); + + fsTarget.style.margin = '0'; + fsTarget.style.padding = '0'; + fsTarget.style.width = '100%'; + fsTarget.style.height = '100%'; + + this.fullscreenTarget = fsTarget; + + this._createdFullscreenTarget = true; + } + + if (this._createdFullscreenTarget) + { + var canvasParent = this.canvas.parentNode; + + canvasParent.insertBefore(this.fullscreenTarget, this.canvas); + + this.fullscreenTarget.appendChild(this.canvas); + } + + return this.fullscreenTarget; + }, + + /** + * Calling this method will cancel fullscreen mode, if the browser has entered it. + * + * @method Phaser.Scale.ScaleManager#stopFullscreen + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.16.0 + */ + stopFullscreen: function () + { + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return false; + } + + if (fullscreen.active) + { + this._requestedFullscreenChange = true; + + document[fullscreen.cancel](); + } + + if (this._createdFullscreenTarget) + { + var fsTarget = this.fullscreenTarget; + + if (fsTarget && fsTarget.parentNode) + { + var parent = fsTarget.parentNode; + + parent.insertBefore(this.canvas, fsTarget); + + parent.removeChild(fsTarget); + } + } + + this.emit(Events.LEAVE_FULLSCREEN); + + this.refresh(); + }, + + /** + * Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. + * If not in fullscreen, this will request the browser to enter fullscreen mode. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * @method Phaser.Scale.ScaleManager#toggleFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + toggleFullscreen: function (fullscreenOptions) + { + if (this.fullscreen.active) + { + this.stopFullscreen(); + } + else + { + this.startFullscreen(fullscreenOptions); + } + }, + + /** + * An internal method that starts the different DOM event listeners running. + * + * @method Phaser.Scale.ScaleManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + var listeners = this.listeners; + + listeners.orientationChange = function () + { + _this._checkOrientation = true; + _this.dirty = true; + }; + + listeners.windowResize = function () + { + _this.dirty = true; + }; + + // Only dispatched on mobile devices + window.addEventListener('orientationchange', listeners.orientationChange, false); + + window.addEventListener('resize', listeners.windowResize, false); + + if (this.fullscreen.available) + { + listeners.fullScreenChange = function (event) + { + return _this.onFullScreenChange(event); + }; + + listeners.fullScreenError = function (event) + { + return _this.onFullScreenError(event); + }; + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); + } + }, + + /** + * Triggered when a fullscreenchange event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenChange + * @since 3.16.0 + */ + onFullScreenChange: function () + { + // They pressed ESC while in fullscreen mode + if (!this._requestedFullscreenChange) + { + this.stopFullscreen(); + } + + this._requestedFullscreenChange = false; + }, + + /** + * Triggered when a fullscreenerror event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenError + * @since 3.16.0 + */ + onFullScreenError: function () + { + }, + + /** + * Internal method, called automatically by the game step. + * Monitors the elapsed time and resize interval to see if a parent bounds check needs to take place. + * + * @method Phaser.Scale.ScaleManager#step + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + step: function (time, delta) + { + if (!this.parent) + { + return; + } + + this._lastCheck += delta; + + if (this.dirty || this._lastCheck > this.resizeInterval) + { + // Returns true if the parent bounds have changed size + if (this.getParentBounds()) + { + this.refresh(); + } + + this.dirty = false; + this._lastCheck = 0; + } + }, + + /** + * Stops all DOM event listeners. + * + * @method Phaser.Scale.ScaleManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var listeners = this.listeners; + + window.removeEventListener('orientationchange', listeners.orientationChange, false); + window.removeEventListener('resize', listeners.windowResize, false); + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); + }, + + /** + * Destroys this Scale Manager, releasing all references to external resources. + * Once destroyed, the Scale Manager cannot be used again. + * + * @method Phaser.Scale.ScaleManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.stopListeners(); + + this.game = null; + this.canvas = null; + this.canvasBounds = null; + this.parent = null; + this.parentSize.destroy(); + this.gameSize.destroy(); + this.baseSize.destroy(); + this.displaySize.destroy(); + this.fullscreenTarget = null; + }, + + /** + * Is the browser currently in fullscreen mode or not? + * + * @name Phaser.Scale.ScaleManager#isFullscreen + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isFullscreen: { + + get: function () + { + return this.fullscreen.active; + } + + }, + + /** + * The game width. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#width + * @type {number} + * @readonly + * @since 3.16.0 + */ + width: { + + get: function () + { + return this.gameSize.width; + } + + }, + + /** + * The game height. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#height + * @type {number} + * @readonly + * @since 3.16.0 + */ + height: { + + get: function () + { + return this.gameSize.height; + } + + }, + + /** + * Is the device in a portrait orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isPortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isPortrait: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.PORTRAIT); + } + + }, + + /** + * Is the device in a landscape orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isLandscape: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.LANDSCAPE); + } + + }, + + /** + * Are the game dimensions portrait? (i.e. taller than they are wide) + * + * This is different to the device itself being in a portrait orientation. + * + * @name Phaser.Scale.ScaleManager#isGamePortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGamePortrait: { + + get: function () + { + return (this.height > this.width); + } + + }, + + /** + * Are the game dimensions landscape? (i.e. wider than they are tall) + * + * This is different to the device itself being in a landscape orientation. + * + * @name Phaser.Scale.ScaleManager#isGameLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGameLandscape: { + + get: function () + { + return (this.width > this.height); + } + + } + +}); + +module.exports = ScaleManager; + + +/***/ }), +/* 367 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(11); +var GameEvents = __webpack_require__(28); +var EventEmitter = __webpack_require__(9); var FileTypesManager = __webpack_require__(7); -var GameObjectCreator = __webpack_require__(14); +var GameObjectCreator = __webpack_require__(15); var GameObjectFactory = __webpack_require__(5); var GetFastValue = __webpack_require__(1); -var PluginCache = __webpack_require__(15); -var Remove = __webpack_require__(359); +var PluginCache = __webpack_require__(17); +var Remove = __webpack_require__(195); /** * @typedef {object} GlobalPlugin @@ -93698,8 +95491,8 @@ var Remove = __webpack_require__(359); * * There are two types of plugin: * - * 1) A Global Plugin - * 2) A Scene Plugin + * 1. A Global Plugin + * 2. A Scene Plugin * * A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get * access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in @@ -93713,9 +95506,9 @@ var Remove = __webpack_require__(359); * * You can add a plugin to Phaser in three different ways: * - * 1) Preload it - * 2) Include it in your source code and install it via the Game Config - * 3) Include it in your source code and install it within a Scene + * 1. Preload it + * 2. Include it in your source code and install it via the Game Config + * 3. Include it in your source code and install it within a Scene * * For examples of all of these approaches please see the Phaser 3 Examples Repo `plugins` folder. * @@ -93792,7 +95585,7 @@ var PluginManager = new Class({ } else { - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); } }, @@ -93863,7 +95656,7 @@ var PluginManager = new Class({ this._pendingGlobal = []; this._pendingScene = []; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -94071,6 +95864,8 @@ var PluginManager = new Class({ * @param {boolean} [start=false] - Automatically start the plugin running? This is always `true` if you provide a mapping value. * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. * @param {any} [data] - A value passed to the plugin's `init` method. + * + * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if `start` was false, or game isn't yet booted. */ install: function (key, plugin, start, mapping, data) { @@ -94081,13 +95876,13 @@ var PluginManager = new Class({ if (typeof plugin !== 'function') { console.warn('Invalid Plugin: ' + key); - return; + return null; } if (PluginCache.hasCustom(key)) { console.warn('Plugin key in use: ' + key); - return; + return null; } if (mapping !== null) @@ -94109,6 +95904,8 @@ var PluginManager = new Class({ return this.start(key); } } + + return null; }, /** @@ -94515,71 +96312,17 @@ module.exports = PluginManager; /***/ }), -/* 361 */ +/* 368 */ /***/ (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 Vector2 = __webpack_require__(3); - -/** - * Takes the `x` and `y` coordinates and transforms them into the same space as - * defined by the position, rotation and scale values. - * - * @function Phaser.Math.TransformXY - * @since 3.0.0 - * - * @param {number} x - The x coordinate to be transformed. - * @param {number} y - The y coordinate to be transformed. - * @param {number} positionX - Horizontal position of the transform point. - * @param {number} positionY - Vertical position of the transform point. - * @param {number} rotation - Rotation of the transform point, in radians. - * @param {number} scaleX - Horizontal scale of the transform point. - * @param {number} scaleY - Vertical scale of the transform point. - * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. - * - * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. - */ -var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) -{ - if (output === undefined) { output = new Vector2(); } - - var radianSin = Math.sin(rotation); - var radianCos = Math.cos(rotation); - - // Rotate and Scale - var a = radianCos * scaleX; - var b = radianSin * scaleX; - var c = -radianSin * scaleY; - var d = radianCos * scaleY; - - // Invert - var id = 1 / ((a * d) + (c * -b)); - - output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); - output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); - - return output; -}; - -module.exports = TransformXY; - - -/***/ }), -/* 362 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var InputEvents = __webpack_require__(44); var NOOP = __webpack_require__(2); // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events @@ -94687,7 +96430,27 @@ var TouchManager = new Class({ */ this.onTouchCancel = NOOP; - inputManager.events.once('boot', this.boot, this); + /** + * The Touch Over event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchOver + * @type {function} + * @since 3.16.0 + */ + this.onTouchOver = NOOP; + + /** + * The Touch Out event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchOut + * @type {function} + * @since 3.16.0 + */ + this.onTouchOut = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -94729,9 +96492,16 @@ var TouchManager = new Class({ startListeners: function () { var _this = this; + var canvas = this.manager.canvas; + var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); this.onTouchStart = function (event) { + if (autoFocus) + { + window.focus(); + } + if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled @@ -94740,7 +96510,7 @@ var TouchManager = new Class({ _this.manager.queueTouchStart(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } @@ -94772,7 +96542,7 @@ var TouchManager = new Class({ _this.manager.queueTouchEnd(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } @@ -94794,6 +96564,28 @@ var TouchManager = new Class({ } }; + this.onTouchOver = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOver(event); + }; + + this.onTouchOut = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOut(event); + }; + var target = this.target; if (!target) @@ -94804,18 +96596,17 @@ var TouchManager = new Class({ var passive = { passive: true }; var nonPassive = { passive: false }; - if (this.capture) + target.addEventListener('touchstart', this.onTouchStart, (this.capture) ? nonPassive : passive); + target.addEventListener('touchmove', this.onTouchMove, (this.capture) ? nonPassive : passive); + target.addEventListener('touchend', this.onTouchEnd, (this.capture) ? nonPassive : passive); + target.addEventListener('touchcancel', this.onTouchCancel, (this.capture) ? nonPassive : passive); + target.addEventListener('touchover', this.onTouchOver, (this.capture) ? nonPassive : passive); + target.addEventListener('touchout', this.onTouchOut, (this.capture) ? nonPassive : passive); + + if (window) { - target.addEventListener('touchstart', this.onTouchStart, nonPassive); - target.addEventListener('touchmove', this.onTouchMove, nonPassive); - target.addEventListener('touchend', this.onTouchEnd, nonPassive); - target.addEventListener('touchcancel', this.onTouchCancel, nonPassive); - } - else - { - target.addEventListener('touchstart', this.onTouchStart, passive); - target.addEventListener('touchmove', this.onTouchMove, passive); - target.addEventListener('touchend', this.onTouchEnd, passive); + window.addEventListener('touchstart', this.onTouchStart, nonPassive); + window.addEventListener('touchend', this.onTouchEnd, nonPassive); } this.enabled = true; @@ -94836,6 +96627,14 @@ var TouchManager = new Class({ target.removeEventListener('touchmove', this.onTouchMove); target.removeEventListener('touchend', this.onTouchEnd); target.removeEventListener('touchcancel', this.onTouchCancel); + target.removeEventListener('touchover', this.onTouchOver); + target.removeEventListener('touchout', this.onTouchOut); + + if (window) + { + window.removeEventListener('touchstart', this.onTouchStart); + window.removeEventListener('touchend', this.onTouchEnd); + } }, /** @@ -94859,51 +96658,20 @@ module.exports = TouchManager; /***/ }), -/* 363 */ +/* 369 */ /***/ (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 SmoothStep = __webpack_require__(199); - -/** - * A Smooth Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmoothStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmoothStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmoothStep(t, 0, 1); -}; - -module.exports = SmoothStepInterpolation; - - -/***/ }), -/* 364 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Angle = __webpack_require__(424); var Class = __webpack_require__(0); -var Distance = __webpack_require__(58); -var SmoothStepInterpolation = __webpack_require__(363); +var Distance = __webpack_require__(62); +var FuzzyEqual = __webpack_require__(206); +var SmoothStepInterpolation = __webpack_require__(415); var Vector2 = __webpack_require__(3); /** @@ -94963,6 +96731,26 @@ var Pointer = new Class({ */ this.event; + /** + * The DOM element the Pointer was pressed down on, taken from the DOM event. + * + * @name Phaser.Input.Pointer#downElement + * @type {any} + * @readonly + * @since 3.16.0 + */ + this.downElement; + + /** + * The DOM element the Pointer was released on, taken from the DOM event. + * + * @name Phaser.Input.Pointer#upElement + * @type {any} + * @readonly + * @since 3.16.0 + */ + this.upElement; + /** * The camera the Pointer interacted with during its last update. * @@ -94999,6 +96787,7 @@ var Pointer = new Class({ * * @name Phaser.Input.Pointer#position * @type {Phaser.Math.Vector2} + * @readonly * @since 3.0.0 */ this.position = new Vector2(); @@ -95008,15 +96797,109 @@ var Pointer = new Class({ * * The old x and y values are stored in here during the InputManager.transformPointer call. * - * You can use it to track how fast the pointer is moving, or to smoothly interpolate between the old and current position. - * See the `Pointer.getInterpolatedPosition` method to assist in this. + * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition. * * @name Phaser.Input.Pointer#prevPosition * @type {Phaser.Math.Vector2} + * @readonly * @since 3.11.0 */ this.prevPosition = new Vector2(); + /** + * An internal vector used for calculations of the pointer speed and angle. + * + * @name Phaser.Input.Pointer#midPoint + * @type {Phaser.Math.Vector2} + * @private + * @since 3.16.0 + */ + this.midPoint = new Vector2(-1, -1); + + /** + * The current velocity of the Pointer, based on its current and previous positions. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#velocity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.velocity = new Vector2(); + + /** + * The current angle the Pointer is moving, in radians, based on its previous and current position. + * + * The angle is based on the old position facing to the current position. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#angle + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.angle = 0; + + /** + * The distance the Pointer has moved, based on its previous and current position. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * If you need the total distance travelled since the primary buttons was pressed down, + * then use the `Pointer.getDistance` method. + * + * @name Phaser.Input.Pointer#distance + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.distance = 0; + + /** + * The smoothing factor to apply to the Pointer position. + * + * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions + * then you can set this value to apply an automatic smoothing to the positions as they are recorded. + * + * The default value of zero means 'no smoothing'. + * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this + * value directly, or by setting the `input.smoothFactor` property in the Game Config. + * + * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position + * is always precise, and not smoothed. + * + * @name Phaser.Input.Pointer#smoothFactor + * @type {number} + * @default 0 + * @since 3.16.0 + */ + this.smoothFactor = 0; + + /** + * The factor applied to the motion smoothing each frame. + * + * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, + * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current + * position of the Pointer. 0.2 provides a good average but can be increased if you need a + * quicker update and are working in a high performance environment. Never set this value to + * zero. + * + * @name Phaser.Input.Pointer#motionFactor + * @type {number} + * @default 0.2 + * @since 3.16.0 + */ + this.motionFactor = 0.2; + /** * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. * @@ -95037,6 +96920,16 @@ var Pointer = new Class({ */ this.worldY = 0; + /** + * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any) + * + * @name Phaser.Input.Pointer#moveTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.moveTime = 0; + /** * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. * @@ -95107,20 +97000,6 @@ var Pointer = new Class({ */ this.primaryDown = false; - /** - * The Drag State of the Pointer: - * - * 0 = Not dragging anything - * 1 = Being checked if dragging - * 2 = Dragging something - * - * @name Phaser.Input.Pointer#dragState - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.dragState = 0; - /** * Is _any_ button on this pointer considered as being down? * @@ -95241,6 +97120,15 @@ var Pointer = new Class({ * @since 3.10.0 */ this.active = (id === 0) ? true : false; + + /** + * Time when this Pointer was most recently updated by the Game step. + * + * @name Phaser.Input.Pointer#time + * @type {number} + * @since 3.16.0 + */ + this.time = 0; }, /** @@ -95262,13 +97150,13 @@ var Pointer = new Class({ /** * Resets the temporal properties of this Pointer. - * Called automatically by the Input Plugin each update. + * This method is called automatically each frame by the Input Manager. * * @method Phaser.Input.Pointer#reset * @private * @since 3.0.0 */ - reset: function () + reset: function (time) { this.dirty = false; @@ -95276,10 +97164,60 @@ var Pointer = new Class({ this.justUp = false; this.justMoved = false; + this.time = time; + this.movementX = 0; this.movementY = 0; }, + /** + * Calculates the motion of this Pointer, including its velocity and angle of movement. + * This method is called automatically each frame by the Input Manager. + * + * @method Phaser.Input.Pointer#updateMotion + * @private + * @since 3.16.0 + */ + updateMotion: function () + { + var cx = this.position.x; + var cy = this.position.y; + + var mx = this.midPoint.x; + var my = this.midPoint.y; + + if (cx === mx && cy === my) + { + // Nothing to do here + return; + } + + // Moving towards our goal ... + var vx = SmoothStepInterpolation(this.motionFactor, mx, cx); + var vy = SmoothStepInterpolation(this.motionFactor, my, cy); + + if (FuzzyEqual(vx, cx, 0.1)) + { + vx = cx; + } + + if (FuzzyEqual(vy, cy, 0.1)) + { + vy = cy; + } + + this.midPoint.set(vx, vy); + + var dx = cx - vx; + var dy = cy - vy; + + this.velocity.set(dx, dy); + + this.angle = Angle(vx, vy, cx, cy); + + this.distance = Math.sqrt(dx * dx + dy * dy); + }, + /** * Internal method to handle a Mouse Up Event. * @@ -95292,15 +97230,17 @@ var Pointer = new Class({ */ up: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } this.event = event; + this.upElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); // 0: Main button pressed, usually the left button or the un-initialized state if (event.button === 0) @@ -95331,15 +97271,17 @@ var Pointer = new Class({ */ down: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } this.event = event; + this.downElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); // 0: Main button pressed, usually the left button or the un-initialized state if (event.button === 0) @@ -95368,9 +97310,9 @@ var Pointer = new Class({ * @param {MouseEvent} event - The Mouse Event to process. * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. */ - move: function (event) + move: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } @@ -95378,7 +97320,7 @@ var Pointer = new Class({ this.event = event; // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, true); if (this.manager.mouse.locked) { @@ -95389,6 +97331,8 @@ var Pointer = new Class({ this.justMoved = true; + this.moveTime = time; + this.dirty = true; this.wasTouch = false; @@ -95419,8 +97363,10 @@ var Pointer = new Class({ this.event = event; + this.downElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); this.primaryDown = true; this.downX = this.x; @@ -95446,15 +97392,17 @@ var Pointer = new Class({ * @param {TouchEvent} event - The Touch Event to process. * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. */ - touchmove: function (event) + touchmove: function (event, time) { this.event = event; // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, true); this.justMoved = true; + this.moveTime = time; + this.dirty = true; this.wasTouch = true; @@ -95476,8 +97424,10 @@ var Pointer = new Class({ this.event = event; + this.upElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); this.primaryDown = false; this.upX = this.x; @@ -95546,7 +97496,7 @@ var Pointer = new Class({ */ leftButtonDown: function () { - return (this.buttons & 1); + return (this.buttons & 1) ? true : false; }, /** @@ -95559,7 +97509,7 @@ var Pointer = new Class({ */ rightButtonDown: function () { - return (this.buttons & 2); + return (this.buttons & 2) ? true : false; }, /** @@ -95572,7 +97522,7 @@ var Pointer = new Class({ */ middleButtonDown: function () { - return (this.buttons & 4); + return (this.buttons & 4) ? true : false; }, /** @@ -95585,7 +97535,7 @@ var Pointer = new Class({ */ backButtonDown: function () { - return (this.buttons & 8); + return (this.buttons & 8) ? true : false; }, /** @@ -95598,21 +97548,135 @@ var Pointer = new Class({ */ forwardButtonDown: function () { - return (this.buttons & 16); + return (this.buttons & 16) ? true : false; }, /** - * Returns the distance between the Pointer's current position and where it was - * first pressed down (the `downX` and `downY` properties) + * If the Pointer has a button pressed down at the time this method is called, it will return the + * distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded distance, based on where + * the Pointer was when the button was released. + * + * If you wish to get the distance being travelled currently, based on the velocity of the Pointer, + * then see the `Pointer.distance` property. * * @method Phaser.Input.Pointer#getDistance * @since 3.13.0 * - * @return {number} The distance the Pointer has moved since being pressed down. + * @return {number} The distance the Pointer moved. */ getDistance: function () { - return Distance(this.downX, this.downY, this.x, this.y); + if (this.isDown) + { + return Distance(this.downX, this.downY, this.x, this.y); + } + else + { + return Distance(this.downX, this.downY, this.upX, this.upY); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * horizontal distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded horizontal distance, based on where + * the Pointer was when the button was released. + * + * @method Phaser.Input.Pointer#getDistanceX + * @since 3.16.0 + * + * @return {number} The horizontal distance the Pointer moved. + */ + getDistanceX: function () + { + if (this.isDown) + { + return Math.abs(this.downX - this.x); + } + else + { + return Math.abs(this.downX - this.upX); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * vertical distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded vertical distance, based on where + * the Pointer was when the button was released. + * + * @method Phaser.Input.Pointer#getDistanceY + * @since 3.16.0 + * + * @return {number} The vertical distance the Pointer moved. + */ + getDistanceY: function () + { + if (this.isDown) + { + return Math.abs(this.downY - this.y); + } + else + { + return Math.abs(this.downY - this.upY); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * duration since the Pointer's was pressed down. + * + * If no button is held down, it will return the last recorded duration, based on the time + * the Pointer button was released. + * + * @method Phaser.Input.Pointer#getDuration + * @since 3.16.0 + * + * @return {number} The duration the Pointer was held down for in milliseconds. + */ + getDuration: function () + { + if (this.isDown) + { + return (this.time - this.downTime); + } + else + { + return (this.upTime - this.downTime); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * angle between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded angle, based on where + * the Pointer was when the button was released. + * + * The angle is based on the old position facing to the current position. + * + * If you wish to get the current angle, based on the velocity of the Pointer, then + * see the `Pointer.angle` property. + * + * @method Phaser.Input.Pointer#getAngle + * @since 3.16.0 + * + * @return {number} The angle between the Pointer's coordinates in radians. + */ + getAngle: function () + { + if (this.isDown) + { + return Angle(this.downX, this.downY, this.x, this.y); + } + else + { + return Angle(this.downX, this.downY, this.upX, this.upY); + } }, /** @@ -95731,17 +97795,19 @@ module.exports = Pointer; /***/ }), -/* 365 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Features = __webpack_require__(186); +var Features = __webpack_require__(207); +var InputEvents = __webpack_require__(44); +var NOOP = __webpack_require__(0); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md @@ -95817,7 +97883,73 @@ var MouseManager = new Class({ */ this.locked = false; - inputManager.events.once('boot', this.boot, this); + /** + * The Mouse Move Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseMove + * @type {function} + * @since 3.10.0 + */ + this.onMouseMove = NOOP; + + /** + * The Mouse Down Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseDown + * @type {function} + * @since 3.10.0 + */ + this.onMouseDown = NOOP; + + /** + * The Mouse Up Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseUp + * @type {function} + * @since 3.10.0 + */ + this.onMouseUp = NOOP; + + /** + * The Mouse Over Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOver + * @type {function} + * @since 3.16.0 + */ + this.onMouseOver = NOOP; + + /** + * The Mouse Out Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOut + * @type {function} + * @since 3.16.0 + */ + this.onMouseOut = NOOP; + + /** + * Internal pointerLockChange handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#pointerLockChange + * @type {function} + * @since 3.0.0 + */ + this.pointerLockChange = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -95845,7 +97977,7 @@ var MouseManager = new Class({ this.disableContextMenu(); } - if (this.enabled) + if (this.enabled && this.target) { this.startListeners(); } @@ -95895,31 +98027,13 @@ var MouseManager = new Class({ if (Features.pointerLock) { var element = this.target; + element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; + element.requestPointerLock(); } }, - /** - * Internal pointerLockChange handler. - * - * @method Phaser.Input.Mouse.MouseManager#pointerLockChange - * @since 3.0.0 - * - * @param {MouseEvent} event - The native event from the browser. - */ - - /* - pointerLockChange: function (event) - { - var element = this.target; - - this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; - - this.manager.queue.push(event); - }, - */ - /** * If the browser supports pointer lock, this will request that the pointer lock is released. If * the browser successfully enters a locked state, a 'POINTER_LOCK_CHANGE_EVENT' will be @@ -95937,87 +98051,6 @@ var MouseManager = new Class({ } }, - /** - * The Mouse Move Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseMove - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Move Event. - */ - - /* - onMouseMove: function (event) - { - if (event.defaultPrevented || !this.enabled || !this.manager) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseMove(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - - /** - * The Mouse Down Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseDown - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Down Event. - */ - - /* - onMouseDown: function (event) - { - if (event.defaultPrevented || !this.enabled) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseDown(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - - /** - * The Mouse Up Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseUp - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Up Event. - */ - - /* - onMouseUp: function (event) - { - if (event.defaultPrevented || !this.enabled) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseUp(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - /** * Starts the Mouse Event listeners running. * This is called automatically and does not need to be manually invoked. @@ -96028,15 +98061,17 @@ var MouseManager = new Class({ startListeners: function () { var _this = this; + var canvas = this.manager.canvas; + var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); - var onMouseMove = function (event) + this.onMouseMove = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled return; } - + _this.manager.queueMouseMove(event); if (_this.capture) @@ -96045,8 +98080,13 @@ var MouseManager = new Class({ } }; - var onMouseDown = function (event) + this.onMouseDown = function (event) { + if (autoFocus) + { + window.focus(); + } + if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled @@ -96055,13 +98095,13 @@ var MouseManager = new Class({ _this.manager.queueMouseDown(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } }; - var onMouseUp = function (event) + this.onMouseUp = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) { @@ -96071,27 +98111,59 @@ var MouseManager = new Class({ _this.manager.queueMouseUp(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } }; - this.onMouseMove = onMouseMove; - this.onMouseDown = onMouseDown; - this.onMouseUp = onMouseUp; + this.onMouseOver = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOver(event); + }; + + this.onMouseOut = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOut(event); + }; var target = this.target; + + if (!target) + { + return; + } + var passive = { passive: true }; var nonPassive = { passive: false }; - target.addEventListener('mousemove', onMouseMove, (this.capture) ? nonPassive : passive); - target.addEventListener('mousedown', onMouseDown, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseup', onMouseUp, (this.capture) ? nonPassive : passive); + target.addEventListener('mousemove', this.onMouseMove, (this.capture) ? nonPassive : passive); + target.addEventListener('mousedown', this.onMouseDown, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseup', this.onMouseUp, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseover', this.onMouseOver, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseout', this.onMouseOut, (this.capture) ? nonPassive : passive); + + if (window) + { + window.addEventListener('mousedown', this.onMouseDown, nonPassive); + window.addEventListener('mouseup', this.onMouseUp, nonPassive); + } if (Features.pointerLock) { - var onPointerLockChange = function (event) + this.pointerLockChange = function (event) { var element = _this.target; @@ -96100,12 +98172,12 @@ var MouseManager = new Class({ _this.manager.queue.push(event); }; - this.pointerLockChange = onPointerLockChange; - - document.addEventListener('pointerlockchange', onPointerLockChange, true); - document.addEventListener('mozpointerlockchange', onPointerLockChange, true); - document.addEventListener('webkitpointerlockchange', onPointerLockChange, true); + document.addEventListener('pointerlockchange', this.pointerLockChange, true); + document.addEventListener('mozpointerlockchange', this.pointerLockChange, true); + document.addEventListener('webkitpointerlockchange', this.pointerLockChange, true); } + + this.enabled = true; }, /** @@ -96122,6 +98194,14 @@ var MouseManager = new Class({ target.removeEventListener('mousemove', this.onMouseMove); target.removeEventListener('mousedown', this.onMouseDown); target.removeEventListener('mouseup', this.onMouseUp); + target.removeEventListener('mouseover', this.onMouseOver); + target.removeEventListener('mouseout', this.onMouseOut); + + if (window) + { + window.removeEventListener('mousedown', this.onMouseDown); + window.removeEventListener('mouseup', this.onMouseUp); + } if (Features.pointerLock) { @@ -96142,6 +98222,7 @@ var MouseManager = new Class({ this.stopListeners(); this.target = null; + this.enabled = false; this.manager = null; } @@ -96151,12 +98232,462 @@ module.exports = MouseManager; /***/ }), -/* 366 */ +/* 371 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ArrayRemove = __webpack_require__(195); +var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(28); +var InputEvents = __webpack_require__(44); +var KeyCodes = __webpack_require__(135); +var NOOP = __webpack_require__(0); + +/** + * @classdesc + * The Keyboard Manager is a helper class that belongs to the global Input Manager. + * + * Its role is to listen for native DOM Keyboard Events and then store them for further processing by the Keyboard Plugin. + * + * You do not need to create this class directly, the Input Manager will create an instance of it automatically if keyboard + * input has been enabled in the Game Config. + * + * @class KeyboardManager + * @memberof Phaser.Input.Keyboard + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. + */ +var KeyboardManager = new Class({ + + initialize: + + function KeyboardManager (inputManager) + { + /** + * A reference to the Input Manager. + * + * @name Phaser.Input.Keyboard.KeyboardManager#manager + * @type {Phaser.Input.InputManager} + * @since 3.16.0 + */ + this.manager = inputManager; + + /** + * An internal event queue. + * + * @name Phaser.Input.Keyboard.KeyboardManager#queue + * @type {KeyboardEvent[]} + * @private + * @since 3.16.0 + */ + this.queue = []; + + /** + * A flag that controls if the non-modified keys, matching those stored in the `captures` array, + * have `preventDefault` called on them or not. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle this property at run-time. + * + * @name Phaser.Input.Keyboard.KeyboardManager#preventDefault + * @type {boolean} + * @since 3.16.0 + */ + this.preventDefault = true; + + /** + * An array of Key Code values that will automatically have `preventDefault` called on them, + * as long as the `KeyboardManager.preventDefault` boolean is set to `true`. + * + * By default the array is empty. + * + * The key must be non-modified when pressed in order to be captured. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle the `KeyboardManager.preventDefault` boolean at run-time. + * + * If you need more specific control, you can create Key objects and set the flag on each of those instead. + * + * This array can be populated via the Game Config by setting the `input.keyboard.capture` array, or you + * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. + * + * @name Phaser.Input.Keyboard.KeyboardManager#captures + * @type {integer[]} + * @since 3.16.0 + */ + this.captures = []; + + /** + * A boolean that controls if the Keyboard Manager is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Keyboard.KeyboardManager#enabled + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.enabled = false; + + /** + * The Keyboard Event target, as defined in the Game Config. + * Typically the window in which the game is rendering, but can be any interactive DOM element. + * + * @name Phaser.Input.Keyboard.KeyboardManager#target + * @type {any} + * @since 3.16.0 + */ + this.target; + + /** + * The Key Down Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyDown + * @type {function} + * @since 3.16.00 + */ + this.onKeyDown = NOOP; + + /** + * The Key Up Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyUp + * @type {function} + * @since 3.16.00 + */ + this.onKeyUp = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); + }, + + /** + * The Keyboard Manager boot process. + * + * @method Phaser.Input.Keyboard.KeyboardManager#boot + * @private + * @since 3.16.0 + */ + boot: function () + { + var config = this.manager.config; + + this.enabled = config.inputKeyboard; + this.target = config.inputKeyboardEventTarget; + + this.addCapture(config.inputKeyboardCapture); + + if (!this.target && window) + { + this.target = window; + } + + if (this.enabled && this.target) + { + this.startListeners(); + } + + this.manager.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); + }, + + /** + * Starts the Keyboard Event listeners running. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Keyboard.KeyboardManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + + this.onKeyDown = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } + + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); + + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; + + this.onKeyUp = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } + + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); + + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; + + var target = this.target; + + if (target) + { + target.addEventListener('keydown', this.onKeyDown, false); + target.addEventListener('keyup', this.onKeyUp, false); + + this.enabled = true; + } + }, + + /** + * Stops the Key Event listeners. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Keyboard.KeyboardManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var target = this.target; + + target.removeEventListener('keydown', this.onKeyDown, false); + target.removeEventListener('keyup', this.onKeyUp, false); + + this.enabled = false; + }, + + /** + * Clears the event queue. + * Called automatically by the Input Manager. + * + * @method Phaser.Input.Keyboard.KeyboardManager#postUpdate + * @private + * @since 3.16.0 + */ + postUpdate: function () + { + this.queue = []; + }, + + /** + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. + * + * This `addCapture` method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browser + * and cause the default browser behavior. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass in a single key code value, or an array of key codes, or a string: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are active captures after calling this method, the `preventDefault` property is set to `true`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#addCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. + */ + addCapture: function (keycode) + { + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } + + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } + + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.trim().toUpperCase()]; + } + + if (captures.indexOf(code) === -1) + { + captures.push(code); + } + } + + this.preventDefault = captures.length > 0; + }, + + /** + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass in a single key code value, or an array of key codes, or a string: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are no captures left after calling this method, the `preventDefault` property is set to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. + */ + removeCapture: function (keycode) + { + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } + + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } + + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.toUpperCase()]; + } + + ArrayRemove(captures, code); + } + + this.preventDefault = captures.length > 0; + }, + + /** + * Removes all keyboard captures and sets the `preventDefault` property to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#clearCaptures + * @since 3.16.0 + */ + clearCaptures: function () + { + this.captures = []; + + this.preventDefault = false; + }, + + /** + * Destroys this Keyboard Manager instance. + * + * @method Phaser.Input.Keyboard.KeyboardManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.stopListeners(); + + this.clearCaptures(); + + this.queue = []; + + this.manager.game.events.off(GameEvents.POST_RENDER, this.postUpdate, this); + + this.target = null; + this.enabled = false; + this.manager = null; + } + +}); + +module.exports = KeyboardManager; + + +/***/ }), +/* 372 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -96240,24 +98771,26 @@ module.exports = INPUT_CONST; /***/ }), -/* 367 */ +/* 373 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(366); -var EventEmitter = __webpack_require__(11); -var Mouse = __webpack_require__(365); -var Pointer = __webpack_require__(364); -var Rectangle = __webpack_require__(10); -var Touch = __webpack_require__(362); -var TransformMatrix = __webpack_require__(42); -var TransformXY = __webpack_require__(361); +var CONST = __webpack_require__(372); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(44); +var GameEvents = __webpack_require__(28); +var Keyboard = __webpack_require__(371); +var Mouse = __webpack_require__(370); +var Pointer = __webpack_require__(369); +var Touch = __webpack_require__(368); +var TransformMatrix = __webpack_require__(46); +var TransformXY = __webpack_require__(409); /** * @classdesc @@ -96298,6 +98831,16 @@ var InputManager = new Class({ */ this.game = game; + /** + * A reference to the global Game Scale Manager. + * Used for all bounds checks and pointer scaling. + * + * @name Phaser.Input.InputManager#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scaleManager; + /** * The Canvas that is used for all DOM event input listeners. * @@ -96308,10 +98851,10 @@ var InputManager = new Class({ this.canvas; /** - * The Input Configuration object, as set in the Game Config. + * The Game Configuration object, as set during the game boot. * * @name Phaser.Input.InputManager#config - * @type {object} + * @type {Phaser.Core.Config} * @since 3.0.0 */ this.config = config; @@ -96341,6 +98884,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#queue * @type {array} * @default [] + * @deprecated * @since 3.0.0 */ this.queue = []; @@ -96351,16 +98895,29 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#domCallbacks * @private * @type {object} + * @deprecated * @since 3.10.0 */ this.domCallbacks = { up: [], down: [], move: [], upOnce: [], downOnce: [], moveOnce: [] }; + /** + * Are any mouse or touch pointers currently over the game canvas? + * This is updated automatically by the canvas over and out handlers. + * + * @name Phaser.Input.InputManager#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + this.isOver = true; + /** * Are there any up callbacks defined? * * @name Phaser.Input.InputManager#_hasUpCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasUpCallback = false; @@ -96371,6 +98928,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasDownCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasDownCallback = false; @@ -96381,6 +98939,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasMoveCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasMoveCallback = false; @@ -96420,6 +98979,15 @@ var InputManager = new Class({ */ this.defaultCursor = ''; + /** + * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property. + * + * @name Phaser.Input.InputManager#keyboard + * @type {?Phaser.Input.Keyboard.KeyboardManager} + * @since 3.16.0 + */ + this.keyboard = (config.inputKeyboard) ? new Keyboard(this) : null; + /** * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property. * @@ -96471,7 +99039,11 @@ var InputManager = new Class({ for (var i = 0; i <= this.pointersTotal; i++) { - this.pointers.push(new Pointer(this, i)); + var pointer = new Pointer(this, i); + + pointer.smoothFactor = config.inputSmoothFactor; + + this.pointers.push(pointer); } /** @@ -96508,15 +99080,6 @@ var InputManager = new Class({ */ this.dirty = false; - /** - * The Scale factor being applied to input coordinates. - * - * @name Phaser.Input.InputManager#scale - * @type { { x:number, y:number } } - * @since 3.0.0 - */ - this.scale = { x: 1, y: 1 }; - /** * If the top-most Scene in the Scene List receives an input it will stop input from * propagating any lower down the scene list, i.e. if you have a UI Scene at the top @@ -96542,19 +99105,49 @@ var InputManager = new Class({ this.ignoreEvents = false; /** - * The bounds of the Input Manager, used for pointer hit test calculations. + * Use the internal event queue or not? + * + * Set this via the Game Config with the `inputQueue` property. + * + * Phaser 3.15.1 and earlier used a event queue by default. + * + * This was changed in version 3.16 to use an immediate-mode system. + * The previous queue based version remains and is left under this flag for backwards + * compatibility. This flag, along with the legacy system, will be removed in a future version. * - * @name Phaser.Input.InputManager#bounds - * @type {Phaser.Geom.Rectangle} - * @since 3.0.0 + * @name Phaser.Input.InputManager#useQueue + * @type {boolean} + * @default false + * @since 3.16.0 */ - this.bounds = new Rectangle(); + this.useQueue = config.inputQueue; + + /** + * The time this Input Manager was last updated. + * This value is populated by the Game Step each frame. + * + * @name Phaser.Input.InputManager#time + * @type {number} + * @readonly + * @since 3.16.2 + */ + this.time = 0; + + /** + * Internal property that tracks frame event state. + * + * @name Phaser.Input.InputManager#_updatedThisFrame + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._updatedThisFrame = false; /** * A re-cycled point-like object to store hit test values in. * * @name Phaser.Input.InputManager#_tempPoint - * @type {{x:number,y:number}} + * @type {{x:number, y:number}} * @private * @since 3.0.0 */ @@ -96591,7 +99184,7 @@ var InputManager = new Class({ */ this._tempMatrix2 = new TransformMatrix(); - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -96600,79 +99193,131 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#boot * @protected + * @fires Phaser.Input.Events#MANAGER_BOOT * @since 3.0.0 */ boot: function () { this.canvas = this.game.canvas; - this.updateBounds(); + this.scaleManager = this.game.scale; - this.events.emit('boot'); + this.events.emit(Events.MANAGER_BOOT); - this.game.events.on('prestep', this.update, this); - this.game.events.on('poststep', this.postUpdate, this); - this.game.events.once('destroy', this.destroy, this); + if (this.useQueue) + { + this.game.events.on(GameEvents.PRE_STEP, this.legacyUpdate, this); + } + else + { + this.game.events.on(GameEvents.PRE_STEP, this.preStep, this); + } + + this.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); + + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * Updates the Input Manager bounds rectangle to match the bounding client rectangle of the - * canvas element being used to track input events. + * Internal canvas state change, called automatically by the Mouse Manager. * - * @method Phaser.Input.InputManager#updateBounds - * @since 3.0.0 - */ - updateBounds: function () - { - var bounds = this.bounds; - - 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; - }, - - /** - * Resizes the Input Manager internal values, including the bounds and scale factor. + * @method Phaser.Input.InputManager#setCanvasOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.0 * - * @method Phaser.Input.InputManager#resize - * @since 3.2.0 + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ - resize: function () + setCanvasOver: function (event) { - this.updateBounds(); + this.isOver = true; - // 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; + this.events.emit(Events.GAME_OVER, event); }, /** - * Internal update loop, called automatically by the Game Step. + * Internal canvas state change, called automatically by the Mouse Manager. + * + * @method Phaser.Input.InputManager#setCanvasOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.0 + * + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. + */ + setCanvasOut: function (event) + { + this.isOver = false; + + this.events.emit(Events.GAME_OUT, event); + }, + + /** + * Internal update method, called automatically when a DOM input event is received. * * @method Phaser.Input.InputManager#update * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE * @since 3.0.0 * * @param {number} time - The time stamp value of this game step. */ update: function (time) { + if (!this._updatedThisFrame) + { + this._setCursor = 0; + + this._updatedThisFrame = true; + } + + this.events.emit(Events.MANAGER_UPDATE); + + this.ignoreEvents = false; + + this.dirty = true; + + var pointers = this.pointers; + + for (var i = 0; i < this.pointersTotal; i++) + { + pointers[i].reset(time); + } + }, + + /** + * Internal update, called automatically by the Game Step. + * + * @method Phaser.Input.InputManager#preStep + * @private + * @since 3.16.2 + * + * @param {number} time - The time stamp value of this game step. + */ + preStep: function (time) + { + this.time = time; + }, + + /** + * Internal update loop, called automatically by the Game Step when using the legacy event queue. + * + * @method Phaser.Input.InputManager#legacyUpdate + * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE + * @since 3.16.0 + * + * @param {number} time - The time stamp value of this game step. + */ + legacyUpdate: function (time) + { + this.time = time; + var i; this._setCursor = 0; - this.events.emit('update'); + this.events.emit(Events.MANAGER_UPDATE); this.ignoreEvents = false; @@ -96684,21 +99329,21 @@ var InputManager = new Class({ for (i = 0; i < this.pointersTotal; i++) { - pointers[i].reset(); + pointers[i].reset(time); } if (!this.enabled || len === 0) { + for (i = 0; i < this.pointersTotal; i++) + { + pointers[i].updateMotion(); + } + return; } this.dirty = true; - this.updateBounds(); - - this.scale.x = this.game.config.width / this.bounds.width; - this.scale.y = this.game.config.height / this.bounds.height; - // Clears the queue array, and also means we don't work on array data that could potentially // be modified during the processing phase var queue = this.queue.splice(0, len); @@ -96741,10 +99386,15 @@ var InputManager = new Class({ break; case CONST.POINTER_LOCK_CHANGE: - this.events.emit('pointerlockchange', event, this.mouse.locked); + this.events.emit(Events.POINTERLOCK_CHANGE, event, this.mouse.locked); break; } } + + for (i = 0; i < this.pointersTotal; i++) + { + pointers[i].updateMotion(); + } }, /** @@ -96764,6 +99414,10 @@ var InputManager = new Class({ { this.canvas.style.cursor = this.defaultCursor; } + + this.dirty = false; + + this._updatedThisFrame = false; }, /** @@ -96855,10 +99509,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ startPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -96871,11 +99528,17 @@ var InputManager = new Class({ if (!pointer.active) { pointer.touchstart(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -96887,10 +99550,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ updatePointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -96903,11 +99569,17 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchmove(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, // For touch end its a list of the touch points that have been removed from the surface @@ -96923,10 +99595,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ stopPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -96939,10 +99614,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -96954,10 +99634,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ cancelPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -96970,10 +99653,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -97011,6 +99699,8 @@ var InputManager = new Class({ var pointer = new Pointer(this, id); + pointer.smoothFactor = this.config.inputSmoothFactor; + this.pointers.push(pointer); this.pointersTotal++; @@ -97026,6 +99716,7 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#processDomCallbacks * @private + * @deprecated * @since 3.10.0 * * @param {array} once - The isOnce callbacks to invoke. @@ -97048,11 +99739,35 @@ var InputManager = new Class({ every[i](event); } - once = []; - return (every.length > 0); }, + /** + * Internal method that gets a list of all the active Input Plugins in the game + * and updates each of them in turn, in reverse order (top to bottom), to allow + * for DOM top-level event handling simulation. + * + * @method Phaser.Input.InputManager#updateInputPlugins + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + updateInputPlugins: function (time, delta) + { + var scenes = this.game.scene.getScenes(true, true); + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene.sys.input) + { + scene.sys.input.update(time, delta); + } + } + }, + /** * Queues a touch start event, as passed in by the TouchManager. * Also dispatches any DOM callbacks for this event. @@ -97065,13 +99780,31 @@ var InputManager = new Class({ */ queueTouchStart: function (event) { - this.queue.push(CONST.TOUCH_START, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_START, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.startPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -97087,13 +99820,31 @@ var InputManager = new Class({ */ queueTouchMove: function (event) { - this.queue.push(CONST.TOUCH_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.updatePointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -97109,13 +99860,31 @@ var InputManager = new Class({ */ queueTouchEnd: function (event) { - this.queue.push(CONST.TOUCH_END, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_END, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.stopPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -97131,7 +99900,23 @@ var InputManager = new Class({ */ queueTouchCancel: function (event) { - this.queue.push(CONST.TOUCH_CANCEL, event); + if (this.useQueue) + { + this.queue.push(CONST.TOUCH_CANCEL, event); + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.cancelPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); + } }, /** @@ -97146,13 +99931,28 @@ var InputManager = new Class({ */ queueMouseDown: function (event) { - this.queue.push(CONST.MOUSE_DOWN, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_DOWN, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.down(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -97168,13 +99968,28 @@ var InputManager = new Class({ */ queueMouseMove: function (event) { - this.queue.push(CONST.MOUSE_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.move(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -97190,17 +100005,36 @@ var InputManager = new Class({ */ queueMouseUp: function (event) { - this.queue.push(CONST.MOUSE_UP, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_UP, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.up(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -97223,6 +100057,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -97249,6 +100084,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -97271,6 +100110,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -97297,6 +100137,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -97319,6 +100163,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -97553,97 +100398,35 @@ var InputManager = new Class({ * @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for. * @param {number} pageX - The Page X value. * @param {number} pageY - The Page Y value. + * @param {boolean} wasMove - Are we transforming the Pointer from a move event, or an up / down event? */ - transformPointer: function (pointer, pageX, pageY) + transformPointer: function (pointer, pageX, pageY, wasMove) { - // Store the previous position - pointer.prevPosition.x = pointer.x; - pointer.prevPosition.y = pointer.y; + var p0 = pointer.position; + var p1 = pointer.prevPosition; - pointer.x = (pageX - this.bounds.left) * this.scale.x; - pointer.y = (pageY - this.bounds.top) * this.scale.y; - }, + // Store previous position + p1.x = p0.x; + p1.y = p0.y; - /** - * Transforms the pageX value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformX - * @since 3.0.0 - * - * @param {number} pageX - The DOM pageX value. - * - * @return {number} The translated value. - */ - transformX: function (pageX) - { - return (pageX - this.bounds.left) * this.scale.x; - }, + // Translate coordinates + var x = this.scaleManager.transformX(pageX); + var y = this.scaleManager.transformY(pageY); - /** - * Transforms the pageY value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformY - * @since 3.0.0 - * - * @param {number} pageY - The DOM pageY value. - * - * @return {number} The translated value. - */ - transformY: function (pageY) - { - return (pageY - this.bounds.top) * this.scale.y; - }, + var a = pointer.smoothFactor; - /** - * Returns the left offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetX - * @since 3.0.0 - * - * @return {number} The left bounds value. - */ - getOffsetX: function () - { - return this.bounds.left; - }, - - /** - * Returns the top offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetY - * @since 3.0.0 - * - * @return {number} The top bounds value. - */ - getOffsetY: function () - { - return this.bounds.top; - }, - - /** - * Returns the horizontal Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleX - * @since 3.0.0 - * - * @return {number} The horizontal scale factor of the input. - */ - getScaleX: function () - { - return this.game.config.width / this.bounds.width; - }, - - /** - * Returns the vertical Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleY - * @since 3.0.0 - * - * @return {number} The vertical scale factor of the input. - */ - getScaleY: function () - { - return this.game.config.height / this.bounds.height; + if (!wasMove || a === 0) + { + // Set immediately + p0.x = x; + p0.y = y; + } + else + { + // Apply smoothing + p0.x = x * a + p1.x * (1 - a); + p0.y = y * a + p1.y * (1 - a); + } }, /** @@ -97658,6 +100441,11 @@ var InputManager = new Class({ { this.events.removeAllListeners(); + if (this.keyboard) + { + this.keyboard.destroy(); + } + if (this.mouse) { this.mouse.destroy(); @@ -97687,4162 +100475,13 @@ var InputManager = new Class({ module.exports = InputManager; -/***/ }), -/* 368 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @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__(967); -var TextureTintPipeline = __webpack_require__(183); - -var LIGHT_COUNT = 10; - -/** - * @classdesc - * ForwardDiffuseLightPipeline implements a forward rendering approach for 2D lights. - * This pipeline extends TextureTintPipeline so it implements all it's rendering functions - * and batching system. - * - * @class ForwardDiffuseLightPipeline - * @extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.0.0 - * - * @param {object} config - [description] - */ -var ForwardDiffuseLightPipeline = new Class({ - - Extends: TextureTintPipeline, - - initialize: - - function ForwardDiffuseLightPipeline (config) - { - LIGHT_COUNT = config.maxLights; - - config.fragShader = ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()); - - TextureTintPipeline.call(this, config); - - /** - * Default normal map texture to use. - * - * @name Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#defaultNormalMap - * @type {Phaser.Texture.Frame} - * @private - * @since 3.11.0 - */ - this.defaultNormalMap; - }, - - /** - * Called when the Game has fully booted and the Renderer has finished setting up. - * - * By this stage all Game level systems are now in place and you can perform any final - * tasks that the pipeline may need that relied on game systems such as the Texture Manager. - * - * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#boot - * @override - * @since 3.11.0 - */ - boot: function () - { - this.defaultNormalMap = this.game.textures.getFrame('__DEFAULT'); - }, - - /** - * This function binds its base class resources and this lights 2D resources. - * - * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#onBind - * @override - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - * - * @return {this} This WebGLPipeline instance. - */ - onBind: function (gameObject) - { - 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); - - if (gameObject) - { - this.setNormalMap(gameObject); - } - - return this; - }, - - /** - * This function sets all the needed resources for each camera pass. - * - * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#onRender - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {this} This WebGLPipeline instance. - */ - onRender: function (scene, camera) - { - this.active = false; - - var lightManager = scene.sys.lights; - - if (!lightManager || lightManager.lights.length <= 0 || !lightManager.active) - { - // Passthru - return this; - } - - var lights = lightManager.cull(camera); - var lightCount = Math.min(lights.length, LIGHT_COUNT); - - if (lightCount === 0) - { - return this; - } - - this.active = true; - - var renderer = this.renderer; - var program = this.program; - var cameraMatrix = camera.matrix; - var point = {x: 0, y: 0}; - var height = renderer.height; - var index; - - for (index = 0; index < LIGHT_COUNT; ++index) - { - // Reset lights - renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); - } - - 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); - - 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; - }, - - /** - * Generic function for batching a textured quad - * - * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#batchTexture - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject - * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad - * @param {integer} textureWidth - Real texture width - * @param {integer} textureHeight - Real texture height - * @param {number} srcX - X coordinate of the quad - * @param {number} srcY - Y coordinate of the quad - * @param {number} srcWidth - Width of the quad - * @param {number} srcHeight - Height of the quad - * @param {number} scaleX - X component of scale - * @param {number} scaleY - Y component of scale - * @param {number} rotation - Rotation of the quad - * @param {boolean} flipX - Indicates if the quad is horizontally flipped - * @param {boolean} flipY - Indicates if the quad is vertically flipped - * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll - * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll - * @param {number} displayOriginX - Horizontal origin in pixels - * @param {number} displayOriginY - Vertical origin in pixels - * @param {number} frameX - X coordinate of the texture frame - * @param {number} frameY - Y coordinate of the texture frame - * @param {number} frameWidth - Width of the texture frame - * @param {number} frameHeight - Height of the texture frame - * @param {integer} tintTL - Tint for top left - * @param {integer} tintTR - Tint for top right - * @param {integer} tintBL - Tint for bottom left - * @param {integer} tintBR - Tint for bottom right - * @param {number} tintEffect - The tint effect (0 for additive, 1 for replacement) - * @param {number} uOffset - Horizontal offset on texture coordinate - * @param {number} vOffset - Vertical offset on texture coordinate - * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container - */ - 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, tintEffect, - uOffset, vOffset, - camera, - parentTransformMatrix) - { - if (!this.active) - { - return; - } - - this.renderer.setPipeline(this); - - var normalTexture; - - if (gameObject.displayTexture) - { - normalTexture = gameObject.displayTexture.dataSource[gameObject.displayFrame.sourceIndex]; - } - else if (gameObject.texture) - { - normalTexture = gameObject.texture.dataSource[gameObject.frame.sourceIndex]; - } - else if (gameObject.tileset) - { - normalTexture = gameObject.tileset.image.dataSource[0]; - } - - if (!normalTexture) - { - console.warn('Normal map missing or invalid'); - return; - } - - this.setTexture2D(normalTexture.glTexture, 1); - - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; - - var u0 = (frameX / textureWidth) + uOffset; - var v0 = (frameY / textureHeight) + vOffset; - var u1 = (frameX + frameWidth) / textureWidth + uOffset; - var v1 = (frameY + frameHeight) / textureHeight + vOffset; - - var width = srcWidth; - var height = srcHeight; - - // var x = -displayOriginX + frameX; - // var y = -displayOriginY + frameY; - - var x = -displayOriginX; - var y = -displayOriginY; - - if (gameObject.isCropped) - { - var crop = gameObject._crop; - - width = crop.width; - height = crop.height; - - srcWidth = crop.width; - srcHeight = crop.height; - - frameX = crop.x; - frameY = crop.y; - - var ox = frameX; - var oy = frameY; - - if (flipX) - { - ox = (frameWidth - crop.x - crop.width); - } - - if (flipY && !texture.isRenderTexture) - { - oy = (frameHeight - crop.y - crop.height); - } - - u0 = (ox / textureWidth) + uOffset; - v0 = (oy / textureHeight) + vOffset; - u1 = (ox + crop.width) / textureWidth + uOffset; - v1 = (oy + crop.height) / textureHeight + vOffset; - - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } - - // Invert the flipY if this is a RenderTexture - flipY = flipY ^ (texture.isRenderTexture ? 1 : 0); - - if (flipX) - { - width *= -1; - x += srcWidth; - } - - if (flipY) - { - height *= -1; - y += srcHeight; - } - - // Do we need this? (doubt it) - // if (camera.roundPixels) - // { - // x |= 0; - // y |= 0; - // } - - var xw = x + width; - var yh = y + height; - - spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = srcX; - spriteMatrix.f = srcY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * scrollFactorX; - spriteMatrix.f -= camera.scrollY * scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - if (camera.roundPixels) - { - tx0 |= 0; - ty0 |= 0; - - tx1 |= 0; - ty1 |= 0; - - tx2 |= 0; - ty2 |= 0; - - tx3 |= 0; - ty3 |= 0; - } - - this.setTexture2D(texture, 0); - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - }, - - /** - * Sets the Game Objects normal map as the active texture. - * - * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMap - * @since 3.11.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] - */ - setNormalMap: function (gameObject) - { - if (!this.active || !gameObject) - { - return; - } - - var normalTexture; - - if (gameObject.texture) - { - normalTexture = gameObject.texture.dataSource[gameObject.frame.sourceIndex]; - } - - if (!normalTexture) - { - normalTexture = this.defaultNormalMap; - } - - this.setTexture2D(normalTexture.glTexture, 1); - - this.renderer.setPipeline(gameObject.defaultPipeline); - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - [description] - * - */ - batchSprite: function (sprite, camera, parentTransformMatrix) - { - if (!this.active) - { - return; - } - - var normalTexture = sprite.texture.dataSource[sprite.frame.sourceIndex]; - - if (normalTexture) - { - this.renderer.setPipeline(this); - - this.setTexture2D(normalTexture.glTexture, 1); - - TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera, parentTransformMatrix); - } - } - -}); - -ForwardDiffuseLightPipeline.LIGHT_COUNT = LIGHT_COUNT; - -module.exports = ForwardDiffuseLightPipeline; - - -/***/ }), -/* 369 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @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__(969); -var ShaderSourceVS = __webpack_require__(968); -var WebGLPipeline = __webpack_require__(184); - -/** - * @classdesc - * BitmapMaskPipeline handles all bitmap masking rendering in WebGL. It works by using - * sampling two texture on the fragment shader and using the fragment's alpha to clip the region. - * The config properties are: - * - game: Current game instance. - * - renderer: Current WebGL renderer. - * - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES. - * Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants). - * - vertShader: Source for vertex shader as a string. - * - fragShader: Source for fragment shader as a string. - * - vertexCapacity: The amount of vertices that shall be allocated - * - vertexSize: The size of a single vertex in bytes. - * - * @class BitmapMaskPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.0.0 - * - * @param {object} config - Used for overriding shader an pipeline properties if extending this pipeline. - */ -var BitmapMaskPipeline = new Class({ - - 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), - - vertexSize: (config.vertexSize ? config.vertexSize : - Float32Array.BYTES_PER_ELEMENT * 2), - - vertices: new Float32Array([ - -1, +1, -1, -7, +7, +1 - ]).buffer, - - attributes: [ - { - name: 'inPosition', - size: 2, - type: config.renderer.gl.FLOAT, - normalized: false, - offset: 0 - } - ] - }); - - /** - * Float32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); - - /** - * Size of the batch. - * - * @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#maxQuads - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.maxQuads = 1; - - /** - * Dirty flag to check if resolution properties need to be updated on the - * masking shader. - * - * @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resolutionDirty - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.resolutionDirty = true; - }, - - /** - * Called every time the pipeline needs to be used. - * It binds all necessary resources. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#onBind - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - 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; - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {this} This WebGLPipeline instance. - */ - resize: function (width, height, resolution) - { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.resolutionDirty = true; - return this; - }, - - /** - * Binds necessary resources and renders the mask to a separated framebuffer. - * The framebuffer for the masked object is also bound for further use. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#beginMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - GameObject used as mask. - * @param {Phaser.GameObjects.GameObject} maskedObject - GameObject masked by the mask GameObject. - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - beginMask: function (mask, maskedObject, camera) - { - var renderer = this.renderer; - var gl = this.gl; - - // The renderable Game Object that is being used for the bitmap mask - var bitmapMask = mask.bitmapMask; - - if (bitmapMask && gl) - { - renderer.flush(); - - // First we clear the mask framebuffer - renderer.setFramebuffer(mask.maskFramebuffer); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - // We render our mask source - bitmapMask.renderWebGL(renderer, bitmapMask, 0, camera); - 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); - } - }, - - /** - * The masked game object's framebuffer is unbound and it's texture - * is bound together with the mask texture and the mask shader and - * a draw call with a single quad is processed. Here is where the - * masking effect is applied. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#endMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - GameObject used as a mask. - */ - endMask: function (mask) - { - var renderer = this.renderer; - var gl = this.gl; - - // The renderable Game Object that is being used for the bitmap mask - var bitmapMask = mask.bitmapMask; - - if (bitmapMask && gl) - { - // 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); - } - } - -}); - -module.exports = BitmapMaskPipeline; - - -/***/ }), -/* 370 */ -/***/ (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 a snapshot of the current frame displayed by a WebGL canvas. - * - * @function Phaser.Renderer.Snapshot.WebGL - * @since 3.0.0 - * - * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. - * @param {string} [type='image/png'] - The format of the returned image. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - * - * @return {HTMLImageElement} A new image which contains a snapshot of the canvas's contents. - */ -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(); - - image.src = src; - - return image; -}; - -module.exports = WebGLSnapshot; - - -/***/ }), -/* 371 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var BaseCamera = __webpack_require__(131); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(28); -var IsSizePowerOfTwo = __webpack_require__(127); -var SpliceOne = __webpack_require__(100); -var TransformMatrix = __webpack_require__(42); -var Utils = __webpack_require__(9); -var WebGLSnapshot = __webpack_require__(370); - -// Default Pipelines -var BitmapMaskPipeline = __webpack_require__(369); -var ForwardDiffuseLightPipeline = __webpack_require__(368); -var TextureTintPipeline = __webpack_require__(183); - -/** - * @callback WebGLContextCallback - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. - */ - -/** - * @typedef {object} SnapshotState - * - * @property {SnapshotCallback} callback - The function to call after the snapshot is taken. - * @property {string} type - The type of the image to create. - * @property {number} encoder - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - */ - -/** - * @classdesc - * WebGLRenderer is a class that contains the needed functionality to keep the - * WebGLRenderingContext state clean. The main idea of the WebGLRenderer is to keep track of - * any context change that happens for WebGL rendering inside of Phaser. This means - * if raw webgl functions are called outside the WebGLRenderer of the Phaser WebGL - * rendering ecosystem they might pollute the current WebGLRenderingContext state producing - * unexpected behavior. It's recommended that WebGL interaction is done through - * WebGLRenderer and/or WebGLPipeline. - * - * @class WebGLRenderer - * @memberof Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Game instance which owns this WebGL Renderer. - */ -var WebGLRenderer = new Class({ - - initialize: - - function WebGLRenderer (game) - { - // eslint-disable-next-line consistent-this - var renderer = this; - - var gameConfig = game.config; - - var contextCreationConfig = { - alpha: gameConfig.transparent, - depth: false, // enable when 3D is added in the future - antialias: gameConfig.antialias, - premultipliedAlpha: gameConfig.premultipliedAlpha, - stencil: true, - preserveDrawingBuffer: gameConfig.preserveDrawingBuffer, - failIfMajorPerformanceCaveat: gameConfig.failIfMajorPerformanceCaveat, - powerPreference: gameConfig.powerPreference - }; - - /** - * The local configuration settings of this WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {RendererConfig} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: gameConfig.clearBeforeRender, - antialias: gameConfig.antialias, - backgroundColor: gameConfig.backgroundColor, - contextCreation: contextCreationConfig, - resolution: gameConfig.resolution, - autoResize: gameConfig.autoResize, - roundPixels: gameConfig.roundPixels, - maxTextures: gameConfig.maxTextures, - maxTextureSize: gameConfig.maxTextureSize, - batchSize: gameConfig.batchSize, - maxLights: gameConfig.maxLights - }; - - /** - * The Game instance which owns this WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * A constant which allows the renderer to be easily identified as a WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#type - * @type {integer} - * @since 3.0.0 - */ - this.type = CONST.WEBGL; - - /** - * The width of the canvas being rendered to. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#width - * @type {integer} - * @since 3.0.0 - */ - this.width = game.config.width; - - /** - * The height of the canvas being rendered to. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#height - * @type {integer} - * @since 3.0.0 - */ - this.height = game.config.height; - - /** - * The canvas which this WebGL Renderer draws to. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = game.canvas; - - /** - * An array of functions to invoke if the WebGL context is lost. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks - * @type {WebGLContextCallback[]} - * @since 3.0.0 - */ - this.lostContextCallbacks = []; - - /** - * An array of functions to invoke if the WebGL context is restored. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks - * @type {WebGLContextCallback[]} - * @since 3.0.0 - */ - this.restoredContextCallbacks = []; - - /** - * An array of blend modes supported by the WebGL Renderer. - * - * This array includes the default blend modes as well as any custom blend modes added through {@link #addBlendMode}. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.blendModes = []; - - /** - * Keeps track of any WebGLTexture created with the current WebGLRenderingContext - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.nativeTextures = []; - - /** - * Set to `true` if the WebGL context of the renderer is lost. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.contextLost = false; - - /** - * This object will store all pipelines created through addPipeline - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines - * @type {object} - * @default null - * @since 3.0.0 - */ - this.pipelines = null; - - /** - * Details about the currently scheduled snapshot. - * - * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState - * @type {SnapshotState} - * @since 3.0.0 - */ - this.snapshotState = { - callback: null, - type: null, - encoder: null - }; - - // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) - - /** - * Cached value for the last texture unit that was used - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTextureUnit - * @type {integer} - * @since 3.1.0 - */ - this.currentActiveTextureUnit = 0; - - /** - * An array of the last texture handles that were bound to the WebGLRenderingContext - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentTextures - * @type {array} - * @since 3.0.0 - */ - this.currentTextures = new Array(16); - - /** - * Current framebuffer in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer - * @type {WebGLFramebuffer} - * @default null - * @since 3.0.0 - */ - this.currentFramebuffer = null; - - /** - * Current WebGLPipeline in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @since 3.0.0 - */ - this.currentPipeline = null; - - /** - * Current WebGLProgram in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram - * @type {WebGLProgram} - * @default null - * @since 3.0.0 - */ - this.currentProgram = null; - - /** - * Current WebGLBuffer (Vertex buffer) in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentVertexBuffer - * @type {WebGLBuffer} - * @default null - * @since 3.0.0 - */ - this.currentVertexBuffer = null; - - /** - * Current WebGLBuffer (Index buffer) in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentIndexBuffer - * @type {WebGLBuffer} - * @default null - * @since 3.0.0 - */ - this.currentIndexBuffer = null; - - /** - * Current blend mode in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode - * @type {integer} - * @since 3.0.0 - */ - this.currentBlendMode = Infinity; - - /** - * Indicates if the the scissor state is enabled in WebGLRenderingContext - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.currentScissorEnabled = false; - - /** - * Stores the current scissor data - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor - * @type {Uint32Array} - * @since 3.0.0 - */ - // this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]); - this.currentScissor = null; - - /** - * Stack of scissor data - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack - * @type {Uint32Array} - * @since 3.0.0 - */ - this.scissorStack = []; - - // Setup context lost and restore event listeners - - 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); - - 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); - - // These are initialized post context creation - - /** - * The underlying WebGL context of the renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#gl - * @type {WebGLRenderingContext} - * @default null - * @since 3.0.0 - */ - this.gl = null; - - /** - * Array of strings that indicate which WebGL extensions are supported by the browser - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions - * @type {object} - * @default null - * @since 3.0.0 - */ - this.supportedExtensions = null; - - /** - * Extensions loaded into the current context - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions - * @type {object} - * @default {} - * @since 3.0.0 - */ - this.extensions = {}; - - /** - * Stores the current WebGL component formats for further use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats - * @type {array} - * @default [] - * @since 3.2.0 - */ - this.glFormats = []; - - /** - * Stores the supported WebGL texture compression formats. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#compression - * @type {array} - * @since 3.8.0 - */ - this.compression = { - ETC1: false, - PVRTC: false, - S3TC: false - }; - - /** - * Cached drawing buffer height to reduce gl calls. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#drawingBufferHeight - * @type {number} - * @readonly - * @since 3.11.0 - */ - this.drawingBufferHeight = 0; - - /** - * A blank 32x32 transparent texture, as used by the Graphics system where needed. - * This is set in the `boot` method. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#blankTexture - * @type {WebGLTexture} - * @readonly - * @since 3.12.0 - */ - this.blankTexture = null; - - this.defaultCamera = new BaseCamera(0, 0, 0, 0); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix3 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix4 = new TransformMatrix(); - - this.init(this.config); - }, - - /** - * Creates a new WebGLRenderingContext and initializes all internal - * state. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#init - * @since 3.0.0 - * - * @param {object} config - The configuration object for the renderer. - * - * @return {this} This WebGLRenderer instance. - */ - init: function (config) - { - var gl; - var canvas = this.canvas; - var clearColor = config.backgroundColor; - - // Did they provide their own context? - if (this.game.config.context) - { - gl = this.game.config.context; - } - else - { - gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); - } - - if (!gl || gl.isContextLost()) - { - this.contextLost = true; - - throw new Error('WebGL unsupported'); - } - - this.gl = gl; - - // Set it back into the Game, so developers can access it from there too - this.game.context = gl; - - 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 ]; - - 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 - var exts = gl.getSupportedExtensions(); - - if (!config.maxTextures) - { - config.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - } - - if (!config.maxTextureSize) - { - config.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); - } - - var extString = 'WEBGL_compressed_texture_'; - var wkExtString = 'WEBKIT_' + extString; - - this.compression.ETC1 = gl.getExtension(extString + 'etc1') || gl.getExtension(wkExtString + 'etc1'); - this.compression.PVRTC = gl.getExtension(extString + 'pvrtc') || gl.getExtension(wkExtString + 'pvrtc'); - this.compression.S3TC = gl.getExtension(extString + 's3tc') || gl.getExtension(wkExtString + 's3tc'); - - this.supportedExtensions = exts; - - // 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; - } - - // Clear previous pipelines and reload default ones - this.pipelines = {}; - - this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ 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, maxLights: config.maxLights })); - - this.setBlendMode(CONST.BlendModes.NORMAL); - - this.resize(this.width, this.height); - - this.game.events.once('texturesready', this.boot, this); - - return this; - }, - - /** - * Internal boot handler. Calls 'boot' on each pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#boot - * @private - * @since 3.11.0 - */ - boot: function () - { - for (var pipelineName in this.pipelines) - { - this.pipelines[pipelineName].boot(); - } - - var blank = this.game.textures.getFrame('__DEFAULT'); - - this.pipelines.TextureTintPipeline.currentFrame = blank; - - this.blankTexture = blank; - }, - - /** - * Resizes the drawing buffer. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resize - * @since 3.0.0 - * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. - * - * @return {this} This WebGLRenderer instance. - */ - resize: function (width, height) - { - var gl = this.gl; - var pipelines = this.pipelines; - var resolution = this.config.resolution; - - this.width = Math.floor(width * resolution); - this.height = Math.floor(height * resolution); - - this.canvas.width = this.width; - this.canvas.height = this.height; - - if (this.config.autoResize) - { - this.canvas.style.width = (this.width / resolution) + 'px'; - this.canvas.style.height = (this.height / resolution) + 'px'; - } - - gl.viewport(0, 0, this.width, this.height); - - // Update all registered pipelines - for (var pipelineName in pipelines) - { - pipelines[pipelineName].resize(width, height, resolution); - } - - this.drawingBufferHeight = gl.drawingBufferHeight; - - this.defaultCamera.setSize(width, height); - - gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); - - return this; - }, - - /** - * Adds a callback to be invoked when the WebGL context has been restored by the browser. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored - * @since 3.0.0 - * - * @param {WebGLContextCallback} callback - The callback to be invoked on context restoration. - * @param {object} target - The context of the callback. - * - * @return {this} This WebGLRenderer instance. - */ - onContextRestored: function (callback, target) - { - this.restoredContextCallbacks.push([ callback, target ]); - - return this; - }, - - /** - * Adds a callback to be invoked when the WebGL context has been lost by the browser. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost - * @since 3.0.0 - * - * @param {WebGLContextCallback} callback - The callback to be invoked on context loss. - * @param {object} target - The context of the callback. - * - * @return {this} This WebGLRenderer instance. - */ - onContextLost: function (callback, target) - { - this.lostContextCallbacks.push([ callback, target ]); - - return this; - }, - - /** - * Checks if a WebGL extension is supported - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension - * @since 3.0.0 - * - * @param {string} extensionName - Name of the WebGL extension - * - * @return {boolean} `true` if the extension is supported, otherwise `false`. - */ - hasExtension: function (extensionName) - { - return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; - }, - - /** - * Loads a WebGL extension - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension - * @since 3.0.0 - * - * @param {string} extensionName - The name of the extension to load. - * - * @return {object} WebGL extension if the extension is supported - */ - getExtension: function (extensionName) - { - if (!this.hasExtension(extensionName)) { return null; } - - if (!(extensionName in this.extensions)) - { - this.extensions[extensionName] = this.gl.getExtension(extensionName); - } - - return this.extensions[extensionName]; - }, - - /** - * Flushes the current pipeline if the pipeline is bound - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#flush - * @since 3.0.0 - */ - flush: function () - { - if (this.currentPipeline) - { - this.currentPipeline.flush(); - } - }, - - /** - * Checks if a pipeline is present in the current WebGLRenderer - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - The name of the pipeline. - * - * @return {boolean} `true` if the given pipeline is loaded, otherwise `false`. - */ - hasPipeline: function (pipelineName) - { - return (pipelineName in this.pipelines); - }, - - /** - * Returns the pipeline by name if the pipeline exists - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - The name of the pipeline. - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance, or `null` if not found. - */ - getPipeline: function (pipelineName) - { - return (this.hasPipeline(pipelineName)) ? this.pipelines[pipelineName] : null; - }, - - /** - * Removes a pipeline by name. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#removePipeline - * @since 3.0.0 - * - * @param {string} pipelineName - The name of the pipeline to be removed. - * - * @return {this} This WebGLRenderer instance. - */ - removePipeline: function (pipelineName) - { - delete this.pipelines[pipelineName]; - - return this; - }, - - /** - * Adds a pipeline instance into the collection of pipelines - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#addPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - A unique string-based key for the pipeline. - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - A pipeline instance which must extend WebGLPipeline. - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipline instance that was passed. - */ - addPipeline: function (pipelineName, pipelineInstance) - { - if (!this.hasPipeline(pipelineName)) - { - this.pipelines[pipelineName] = pipelineInstance; - } - else - { - console.warn('Pipeline exists: ' + pipelineName); - } - - pipelineInstance.name = pipelineName; - - this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution); - - return pipelineInstance; - }, - - /** - * Pushes a new scissor state. This is used to set nested scissor states. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor - * @since 3.0.0 - * - * @param {integer} x - The x position of the scissor. - * @param {integer} y - The y position of the scissor. - * @param {integer} width - The width of the scissor. - * @param {integer} height - The height of the scissor. - * - * @return {integer[]} An array containing the scissor values. - */ - pushScissor: function (x, y, width, height) - { - var scissorStack = this.scissorStack; - - var scissor = [ x, y, width, height ]; - - scissorStack.push(scissor); - - this.setScissor(x, y, width, height); - - this.currentScissor = scissor; - - return scissor; - }, - - /** - * Sets the current scissor state. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor - * @since 3.0.0 - * - * @param {integer} x - The x position of the scissor. - * @param {integer} y - The y position of the scissor. - * @param {integer} width - The width of the scissor. - * @param {integer} height - The height of the scissor. - */ - setScissor: function (x, y, width, height) - { - var gl = this.gl; - - var current = this.currentScissor; - - var cx = current[0]; - var cy = current[1]; - var cw = current[2]; - var ch = current[3]; - - if (cx !== x || cy !== y || cw !== width || ch !== height) - { - this.flush(); - - // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor - - if (width > 0 && height > 0) - { - gl.scissor(x, (this.drawingBufferHeight - y - height), width, height); - - } - } - }, - - /** - * Pops the last scissor state and sets it. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor - * @since 3.0.0 - */ - popScissor: function () - { - var scissorStack = this.scissorStack; - - // Remove the current scissor - scissorStack.pop(); - - // Reset the previous scissor - var scissor = scissorStack[scissorStack.length - 1]; - - if (scissor) - { - this.setScissor(scissor[0], scissor[1], scissor[2], scissor[3]); - } - - this.currentScissor = scissor; - }, - - /** - * Binds a WebGLPipeline and sets it as the current pipeline to be used. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setPipeline - * @since 3.0.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - The pipeline instance to be activated. - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was activated. - */ - setPipeline: function (pipelineInstance, gameObject) - { - 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(gameObject); - - return this.currentPipeline; - }, - - /** - * Sets the blend mode to the value given. - * - * If the current blend mode is different from the one given, the pipeline is flushed and the new - * blend mode is enabled. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode - * @since 3.0.0 - * - * @param {integer} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. - * - * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. - */ - setBlendMode: function (blendModeId) - { - var gl = this.gl; - var blendMode = this.blendModes[blendModeId]; - - if (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId) - { - this.flush(); - - 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]); - } - - this.currentBlendMode = blendModeId; - - return true; - } - - return false; - }, - - /** - * Creates a new custom blend mode for the renderer. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#addBlendMode - * @since 3.0.0 - * - * @param {function} func - An array containing the WebGL functions to use for the source and the destination blending factors, respectively. See the possible constants for {@link WebGLRenderingContext#blendFunc()}. - * @param {function} equation - The equation to use for combining the RGB and alpha components of a new pixel with a rendered one. See the possible constants for {@link WebGLRenderingContext#blendEquation()}. - * - * @return {integer} The index of the new blend mode, used for referencing it in the future. - */ - addBlendMode: function (func, equation) - { - var index = this.blendModes.push({ func: func, equation: equation }); - - return index - 1; - }, - - /** - * Updates the function bound to a given custom blend mode. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#updateBlendMode - * @since 3.0.0 - * - * @param {integer} index - The index of the custom blend mode. - * @param {function} func - The function to use for the blend mode. - * @param {function} equation - The equation to use for the blend mode. - * - * @return {this} This WebGLRenderer instance. - */ - updateBlendMode: function (index, func, equation) - { - if (this.blendModes[index]) - { - this.blendModes[index].func = func; - - if (equation) - { - this.blendModes[index].equation = equation; - } - } - - return this; - }, - - /** - * Removes a custom blend mode from the renderer. - * Any Game Objects still using this blend mode will error, so be sure to clear them first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#removeBlendMode - * @since 3.0.0 - * - * @param {integer} index - The index of the custom blend mode to be removed. - * - * @return {this} This WebGLRenderer instance. - */ - removeBlendMode: function (index) - { - if (index > 16 && this.blendModes[index]) - { - this.blendModes.splice(index, 1); - } - - return this; - }, - - /** - * Sets the current active texture for texture unit zero to be a blank texture. - * This only happens if there isn't a texture already in use by texture unit zero. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlankTexture - * @private - * @since 3.12.0 - * - * @param {boolean} [force=false] - Force a blank texture set, regardless of what's already bound? - */ - setBlankTexture: function (force) - { - if (force === undefined) { force = false; } - - if (force || this.currentActiveTextureUnit !== 0 || !this.currentTextures[0]) - { - this.setTexture2D(this.blankTexture.glTexture, 0); - } - }, - - /** - * Binds a texture at a texture unit. If a texture is already - * bound to that unit it will force a flush on the current pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D - * @since 3.0.0 - * - * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. - * @param {integer} textureUnit - The texture unit to which the texture will be bound. - * - * @return {this} This WebGLRenderer instance. - */ - setTexture2D: function (texture, textureUnit) - { - var gl = this.gl; - - if (texture !== this.currentTextures[textureUnit]) - { - this.flush(); - - if (this.currentActiveTextureUnit !== textureUnit) - { - gl.activeTexture(gl.TEXTURE0 + textureUnit); - - this.currentActiveTextureUnit = textureUnit; - } - - gl.bindTexture(gl.TEXTURE_2D, texture); - - this.currentTextures[textureUnit] = texture; - } - - return this; - }, - - /** - * Binds a framebuffer. If there was another framebuffer already bound it will force a pipeline flush. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. - * - * @return {this} This WebGLRenderer instance. - */ - setFramebuffer: function (framebuffer) - { - var gl = this.gl; - - var width = this.width; - var height = this.height; - - if (framebuffer !== this.currentFramebuffer) - { - if (framebuffer && framebuffer.renderTexture) - { - width = framebuffer.renderTexture.width; - height = framebuffer.renderTexture.height; - } - else - { - this.flush(); - } - - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - - gl.viewport(0, 0, width, height); - - this.currentFramebuffer = framebuffer; - } - - return this; - }, - - /** - * Binds a program. If there was another program already bound it will force a pipeline flush. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram - * @since 3.0.0 - * - * @param {WebGLProgram} program - The program that needs to be bound. - * - * @return {this} This WebGLRenderer instance. - */ - setProgram: function (program) - { - var gl = this.gl; - - if (program !== this.currentProgram) - { - this.flush(); - - gl.useProgram(program); - - this.currentProgram = program; - } - - return this; - }, - - /** - * Bounds a vertex buffer. If there is a vertex buffer already bound it'll force a pipeline flush. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} vertexBuffer - The buffer that needs to be bound. - * - * @return {this} This WebGLRenderer instance. - */ - setVertexBuffer: function (vertexBuffer) - { - var gl = this.gl; - - if (vertexBuffer !== this.currentVertexBuffer) - { - this.flush(); - - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - - this.currentVertexBuffer = vertexBuffer; - } - - return this; - }, - - /** - * Bounds a index buffer. If there is a index buffer already bound it'll force a pipeline flush. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} indexBuffer - The buffer the needs to be bound. - * - * @return {this} This WebGLRenderer instance. - */ - setIndexBuffer: function (indexBuffer) - { - var gl = this.gl; - - if (indexBuffer !== this.currentIndexBuffer) - { - this.flush(); - - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - - this.currentIndexBuffer = indexBuffer; - } - - return this; - }, - - /** - * Creates a texture from an image source. If the source is not valid it creates an empty texture. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource - * @since 3.0.0 - * - * @param {object} source - The source of the texture. - * @param {integer} width - The width of the texture. - * @param {integer} height - The height of the texture. - * @param {integer} scaleMode - The scale mode to be used by the texture. - * - * @return {?WebGLTexture} The WebGL Texture that was created, or `null` if it couldn't be created. - */ - createTextureFromSource: function (source, width, height, scaleMode) - { - 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)) - { - wrap = gl.REPEAT; - } - - if (scaleMode === CONST.ScaleModes.LINEAR && this.config.antialias) - { - filter = gl.LINEAR; - } - - 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; - }, - - /** - * A wrapper for creating a WebGLTexture. If no pixel data is passed it will create an empty texture. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D - * @since 3.0.0 - * - * @param {integer} mipLevel - Mip level of the texture. - * @param {integer} minFilter - Filtering of the texture. - * @param {integer} magFilter - Filtering of the texture. - * @param {integer} wrapT - Wrapping mode of the texture. - * @param {integer} wrapS - Wrapping mode of the texture. - * @param {integer} format - Which format does the texture use. - * @param {object} pixels - pixel data. - * @param {integer} width - Width of the texture in pixels. - * @param {integer} height - Height of the texture in pixels. - * @param {boolean} pma - Does the texture have premultiplied alpha? - * - * @return {WebGLTexture} The WebGLTexture that was created. - */ - createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma) - { - pma = (pma === undefined || pma === null) ? true : pma; - - var gl = this.gl; - var texture = gl.createTexture(); - - 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; - }, - - /** - * Wrapper for creating WebGLFramebuffer. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer - * @since 3.0.0 - * - * @param {integer} width - Width in pixels of the framebuffer - * @param {integer} height - Height in pixels of the framebuffer - * @param {WebGLTexture} renderTexture - The color texture to where the color pixels are written - * @param {boolean} addDepthStencilBuffer - Indicates if the current framebuffer support depth and stencil buffers - * - * @return {WebGLFramebuffer} Raw WebGLFramebuffer - */ - createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) - { - var gl = this.gl; - var framebuffer = gl.createFramebuffer(); - var complete = 0; - - this.setFramebuffer(framebuffer); - - 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; - - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); - - 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]); - } - - framebuffer.renderTexture = renderTexture; - - this.setFramebuffer(null); - - return framebuffer; - }, - - /** - * Wrapper for creating a WebGLProgram - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram - * @since 3.0.0 - * - * @param {string} vertexShader - Source to the vertex shader - * @param {string} fragmentShader - Source to the fragment shader - * - * @return {WebGLProgram} Raw WebGLProgram - */ - 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); - - gl.shaderSource(vs, vertexShader); - gl.shaderSource(fs, fragmentShader); - gl.compileShader(vs); - gl.compileShader(fs); - - 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); - - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) - { - throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); - } - - return program; - }, - - /** - * Wrapper for creating a vertex buffer. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer - * @since 3.0.0 - * - * @param {ArrayBuffer} initialDataOrSize - It's either ArrayBuffer or an integer indicating the size of the vbo - * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW - * - * @return {WebGLBuffer} Raw vertex buffer - */ - createVertexBuffer: function (initialDataOrSize, bufferUsage) - { - var gl = this.gl; - var vertexBuffer = gl.createBuffer(); - - this.setVertexBuffer(vertexBuffer); - - gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); - - this.setVertexBuffer(null); - - return vertexBuffer; - }, - - /** - * Wrapper for creating a vertex buffer. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer - * @since 3.0.0 - * - * @param {ArrayBuffer} initialDataOrSize - Either ArrayBuffer or an integer indicating the size of the vbo. - * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. - * - * @return {WebGLBuffer} Raw index buffer - */ - 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; - }, - - /** - * Removes the given texture from the nativeTextures array and then deletes it from the GPU. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture - * @since 3.0.0 - * - * @param {WebGLTexture} texture - The WebGL Texture to be deleted. - * - * @return {this} This WebGLRenderer instance. - */ - deleteTexture: function (texture) - { - var index = this.nativeTextures.indexOf(texture); - - if (index !== -1) - { - SpliceOne(this.nativeTextures, index); - } - - this.gl.deleteTexture(texture); - - if (this.currentTextures[0] === texture) - { - // texture we just deleted is in use, so bind a blank texture - this.setBlankTexture(true); - } - - return this; - }, - - /** - * Deletes a WebGLFramebuffer from the GL instance. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - The Framebuffer to be deleted. - * - * @return {this} This WebGLRenderer instance. - */ - deleteFramebuffer: function (framebuffer) - { - this.gl.deleteFramebuffer(framebuffer); - - return this; - }, - - /** - * Deletes a WebGLProgram from the GL instance. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram - * @since 3.0.0 - * - * @param {WebGLProgram} program - The shader program to be deleted. - * - * @return {this} This WebGLRenderer instance. - */ - deleteProgram: function (program) - { - this.gl.deleteProgram(program); - - return this; - }, - - /** - * Deletes a WebGLBuffer from the GL instance. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} vertexBuffer - The WebGLBuffer to be deleted. - * - * @return {this} This WebGLRenderer instance. - */ - deleteBuffer: function (buffer) - { - this.gl.deleteBuffer(buffer); - - return this; - }, - - /** - * Controls the pre-render operations for the given camera. - * Handles any clipping needed by the camera and renders the background color if a color is visible. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to pre-render. - */ - preRenderCamera: function (camera) - { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; - - var TextureTintPipeline = this.pipelines.TextureTintPipeline; - - var color = camera.backgroundColor; - - if (camera.renderToTexture) - { - this.flush(); - - this.pushScissor(cx, cy, cw, -ch); - - this.setFramebuffer(camera.framebuffer); - - var gl = this.gl; - - gl.clearColor(0, 0, 0, 0); - - gl.clear(gl.COLOR_BUFFER_BIT); - - TextureTintPipeline.projOrtho(cx, cw + cx, cy, ch + cy, -1000, 1000); - - if (color.alphaGL > 0) - { - TextureTintPipeline.drawFillRect( - cx, cy, cw + cx, ch + cy, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), - color.alphaGL - ); - } - - camera.emit('prerender', camera); - } - else - { - this.pushScissor(cx, cy, cw, ch); - - if (color.alphaGL > 0) - { - TextureTintPipeline.drawFillRect( - cx, cy, cw , ch, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), - color.alphaGL - ); - } - } - }, - - /** - * Controls the post-render operations for the given camera. - * Renders the foreground camera effects like flash and fading. It resets the current scissor state. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to post-render. - */ - postRenderCamera: function (camera) - { - var TextureTintPipeline = this.pipelines.TextureTintPipeline; - - camera.flashEffect.postRenderWebGL(TextureTintPipeline, Utils.getTintFromFloats); - camera.fadeEffect.postRenderWebGL(TextureTintPipeline, Utils.getTintFromFloats); - - camera.dirty = false; - - this.popScissor(); - - if (camera.renderToTexture) - { - TextureTintPipeline.flush(); - - this.setFramebuffer(null); - - camera.emit('postrender', camera); - - TextureTintPipeline.projOrtho(0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0); - - var getTint = Utils.getTintAppendFloatAlpha; - - var pipeline = (camera.pipeline) ? camera.pipeline : TextureTintPipeline; - - pipeline.batchTexture( - camera, - camera.glTexture, - camera.width, camera.height, - camera.x, camera.y, - camera.width, camera.height, - camera.zoom, camera.zoom, - camera.rotation, - camera.flipX, !camera.flipY, - 1, 1, - 0, 0, - 0, 0, camera.width, camera.height, - getTint(camera._tintTL, camera._alphaTL), - getTint(camera._tintTR, camera._alphaTR), - getTint(camera._tintBL, camera._alphaBL), - getTint(camera._tintBR, camera._alphaBR), - (camera._isTinted && camera.tintFill), - 0, 0, - this.defaultCamera, - null - ); - - // Force clear the current texture so that items next in the batch (like Graphics) don't try and use it - this.setBlankTexture(true); - } - }, - - /** - * Clears the current vertex buffer and updates pipelines. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender - * @since 3.0.0 - */ - preRender: function () - { - if (this.contextLost) { return; } - - var gl = this.gl; - var color = this.config.backgroundColor; - var pipelines = this.pipelines; - - if (this.config.clearBeforeRender) - { - gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); - } - - gl.enable(gl.SCISSOR_TEST); - - for (var key in pipelines) - { - pipelines[key].onPreRender(); - } - - // TODO - Find a way to stop needing to create these arrays every frame - // and equally not need a huge array buffer created to hold them - - this.currentScissor = [ 0, 0, this.width, this.height ]; - this.scissorStack = [ this.currentScissor ]; - - if (this.game.scene.customViewports) - { - gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); - } - - this.setPipeline(this.pipelines.TextureTintPipeline); - }, - - /** - * The core render step for a Scene. - * Iterates through the given Game Object's array and renders them with the given Camera. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#render - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.GameObject} children - The Game Object's within the Scene to be rendered. - * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently un-used. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. - */ - 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) - { - pipelines[key].onRender(scene, camera); - } - - // Apply scissor for cam region + render background color, if not transparent - this.preRenderCamera(camera); - - for (var i = 0; i < childCount; i++) - { - var child = list[i]; - - if (!child.willRender(camera)) - { - continue; - } - - if (child.blendMode !== this.currentBlendMode) - { - this.setBlendMode(child.blendMode); - } - - var mask = child.mask; - - if (mask) - { - mask.preRenderWebGL(this, child, camera); - - child.renderWebGL(this, child, interpolationPercentage, camera); - - mask.postRenderWebGL(this, child); - } - else - { - child.renderWebGL(this, child, interpolationPercentage, camera); - } - } - - this.setBlendMode(CONST.BlendModes.NORMAL); - - // Applies camera effects and pops the scissor, if set - this.postRenderCamera(camera); - }, - - /** - * The post-render step happens after all Cameras in all Scenes have been rendered. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender - * @since 3.0.0 - */ - postRender: function () - { - if (this.contextLost) { return; } - - this.flush(); - - // Unbind custom framebuffer here - - if (this.snapshotState.callback) - { - this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); - this.snapshotState.callback = null; - } - - var pipelines = this.pipelines; - - for (var key in pipelines) - { - pipelines[key].onPostRender(); - } - }, - - /** - * Schedules a snapshot to be taken after the current frame is rendered. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot - * @since 3.0.0 - * - * @param {SnapshotCallback} callback - Function to invoke after the snapshot is created. - * @param {string} type - The format of the image to create, usually `image/png`. - * @param {number} encoderOptions - The image quality, between 0 and 1, to use for image formats with lossy compression (such as `image/jpeg`). - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} This WebGL Renderer. - */ - snapshot: function (callback, type, encoderOptions) - { - this.snapshotState.callback = callback; - this.snapshotState.type = type; - this.snapshotState.encoder = encoderOptions; - - return this; - }, - - /** - * Creates a WebGL Texture based on the given canvas element. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture - * @since 3.0.0 - * - * @param {HTMLCanvasElement} srcCanvas - The Canvas element that will be used to populate the texture. - * @param {WebGLTexture} [dstTexture] - Is this going to replace an existing texture? If so, pass it here. - * @param {boolean} [noRepeat=false] - Should this canvas never be allowed to set REPEAT? (such as for Text objects) - * - * @return {WebGLTexture} The newly created WebGL Texture. - */ - canvasToTexture: function (srcCanvas, dstTexture, noRepeat) - { - if (noRepeat === undefined) { noRepeat = false; } - - var gl = this.gl; - - if (!dstTexture) - { - var wrapping = gl.CLAMP_TO_EDGE; - - if (!noRepeat && 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); - - 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 minification and magnification filter for a texture. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter - * @since 3.0.0 - * - * @param {integer} texture - The texture to set the filter for. - * @param {integer} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. - * - * @return {this} This WebGL Renderer instance. - */ - setTextureFilter: function (texture, filter) - { - var gl = this.gl; - var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; - - 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; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * - * @return {this} This WebGL Renderer instance. - */ - setFloat1: function (program, name, x) - { - this.setProgram(program); - - this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {this} This WebGL Renderer instance. - */ - 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 - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} z - [description] - * - * @return {this} This WebGL Renderer instance. - */ - setFloat3: function (program, name, x, y, z) - { - this.setProgram(program); - - this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); - - return this; - }, - - /** - * Sets uniform of a WebGLProgram - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - X component - * @param {number} y - Y component - * @param {number} z - Z component - * @param {number} w - W component - * - * @return {this} This WebGL Renderer instance. - */ - 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 value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat1v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform1fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat2v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform2fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat3v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform3fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - - setFloat4v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform4fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * - * @return {this} This WebGL Renderer instance. - */ - setInt1: function (program, name, x) - { - this.setProgram(program); - - this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); - - return this; - }, - - /** - * Sets the value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * - * @return {this} This WebGL Renderer instance. - */ - setInt2: function (program, name, x, y) - { - this.setProgram(program); - - this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); - - return this; - }, - - /** - * Sets the value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] - * - * @return {this} This WebGL Renderer instance. - */ - 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 value of a uniform variable in the given WebGLProgram. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - X component - * @param {integer} y - Y component - * @param {integer} z - Z component - * @param {integer} w - W component - * - * @return {this} This WebGL Renderer instance. - */ - setInt4: function (program, name, x, y, z, w) - { - this.setProgram(program); - - this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix2: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix3: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Sets uniform of a WebGLProgram - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Is the matrix transposed - * @param {Float32Array} matrix - Matrix data - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix4: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Returns the maximum number of texture units that can be used in a fragment shader. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextures - * @since 3.8.0 - * - * @return {integer} The maximum number of textures WebGL supports. - */ - getMaxTextures: function () - { - return this.config.maxTextures; - }, - - /** - * Returns the largest texture size (either width or height) that can be created. - * Note that VRAM may not allow a texture of any given size, it just expresses - * hardware / driver support for a given size. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextureSize - * @since 3.8.0 - * - * @return {integer} The maximum supported texture size. - */ - getMaxTextureSize: function () - { - return this.config.maxTextureSize; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy - * @since 3.0.0 - */ - destroy: function () - { - // 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]; - } - - delete this.gl; - delete this.game; - - this.contextLost = true; - this.extensions = {}; - this.nativeTextures.length = 0; - } - -}); - -module.exports = WebGLRenderer; - - -/***/ }), -/* 372 */ -/***/ (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__(72); -var CanvasFeatures = __webpack_require__(375); - -/** - * [description] - * - * @function Phaser.Renderer.Canvas.GetBlendModes - * @since 3.0.0 - * - * @return {array} [description] - */ -var GetBlendModes = function () -{ - var output = []; - var useNew = CanvasFeatures.supportNewBlendModes; - var so = 'source-over'; - - output[modes.NORMAL] = so; - output[modes.ADD] = 'lighter'; - output[modes.MULTIPLY] = (useNew) ? 'multiply' : so; - output[modes.SCREEN] = (useNew) ? 'screen' : so; - output[modes.OVERLAY] = (useNew) ? 'overlay' : so; - output[modes.DARKEN] = (useNew) ? 'darken' : so; - output[modes.LIGHTEN] = (useNew) ? 'lighten' : so; - output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : so; - output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : so; - output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : so; - output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : so; - output[modes.DIFFERENCE] = (useNew) ? 'difference' : so; - output[modes.EXCLUSION] = (useNew) ? 'exclusion' : so; - output[modes.HUE] = (useNew) ? 'hue' : so; - output[modes.SATURATION] = (useNew) ? 'saturation' : so; - output[modes.COLOR] = (useNew) ? 'color' : so; - output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : so; - - return output; -}; - -module.exports = GetBlendModes; - - -/***/ }), -/* 373 */ -/***/ (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 {number} [encoderOptions=0.92] - [description] - * - * @return {HTMLImageElement} [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; -}; - -module.exports = CanvasSnapshot; - - /***/ }), /* 374 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var CanvasSnapshot = __webpack_require__(373); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(28); -var GetBlendModes = __webpack_require__(372); -var ScaleModes = __webpack_require__(104); -var Smoothing = __webpack_require__(130); -var TransformMatrix = __webpack_require__(42); - -/** - * @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({ - - 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 {RendererConfig} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: game.config.clearBeforeRender, - backgroundColor: game.config.backgroundColor, - resolution: game.config.resolution, - autoResize: game.config.autoResize, - antialias: game.config.antialias, - roundPixels: game.config.roundPixels - }; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode - * @type {integer} - * @since 3.0.0 - */ - this.scaleMode = (game.config.antialias) ? ScaleModes.LINEAR : ScaleModes.NEAREST; - - /** - * [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.game.config.context) ? this.game.config.context : this.gameCanvas.getContext('2d'); - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.currentContext = this.gameContext; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes - * @type {array} - * @since 3.0.0 - */ - this.blendModes = GetBlendModes(); - - // image-rendering: optimizeSpeed; - // image-rendering: pixelated; - - /** - * [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 {?SnapshotCallback} - * @default null - * @since 3.0.0 - */ - this.snapshotCallback = null; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType - * @type {?string} - * @default null - * @since 3.0.0 - */ - this.snapshotType = null; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder - * @type {?number} - * @default null - * @since 3.0.0 - */ - this.snapshotEncoder = null; - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix3 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix4 = new TransformMatrix(); - - this.init(); - }, - - /** - * [description] - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#init - * @since 3.0.0 - */ - init: function () - { - this.resize(this.width, this.height); - }, - - /** - * Resize the main game canvas. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resize - * @since 3.0.0 - * - * @param {integer} width - [description] - * @param {integer} height - [description] - */ - resize: function (width, height) - { - var resolution = this.config.resolution; - - this.width = width * resolution; - this.height = height * resolution; - - this.gameCanvas.width = this.width; - this.gameCanvas.height = this.height; - - if (this.config.autoResize) - { - this.gameCanvas.style.width = (this.width / resolution) + 'px'; - this.gameCanvas.style.height = (this.height / resolution) + 'px'; - } - - // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) - if (this.scaleMode === ScaleModes.NEAREST) - { - 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 {number} blendMode - [description] - * - * @return {this} [description] - */ - setBlendMode: function (blendMode) - { - this.currentContext.globalCompositeOperation = blendMode; - - return this; - }, - - /** - * Changes the Canvas Rendering Context that all draw operations are performed against. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setContext - * @since 3.12.0 - * - * @param {?CanvasRenderingContext2D} [ctx] - The new Canvas Rendering Context to draw everything to. Leave empty to reset to the Game Canvas. - * - * @return {this} The Canvas Renderer instance. - */ - setContext: function (ctx) - { - this.currentContext = (ctx) ? ctx : this.gameContext; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha - * @since 3.0.0 - * - * @param {number} alpha - [description] - * - * @return {this} [description] - */ - setAlpha: function (alpha) - { - this.currentContext.globalAlpha = alpha; - - return this; - }, - - /** - * Called at the start of the render loop. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender - * @since 3.0.0 - */ - preRender: function () - { - var ctx = this.gameContext; - var config = this.config; - - var width = this.width; - var height = this.height; - - if (config.clearBeforeRender) - { - ctx.clearRect(0, 0, width, height); - } - - if (!config.transparent) - { - ctx.fillStyle = config.backgroundColor.rgba; - ctx.fillRect(0, 0, width, height); - } - - this.drawCount = 0; - }, - - /** - * 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 {number} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - render: function (scene, children, interpolationPercentage, camera) - { - var list = children.list; - var childCount = list.length; - - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; - - var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; - - var scissor = (cx !== 0 || cy !== 0 || cw !== ctx.canvas.width || ch !== ctx.canvas.height); - - 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 (!camera.transparent) - { - ctx.fillStyle = camera.backgroundColor.rgba; - ctx.fillRect(cx, cy, cw, ch); - } - - ctx.globalAlpha = camera.alpha; - - ctx.globalCompositeOperation = 'source-over'; - - this.drawCount += list.length; - - if (scissor) - { - ctx.save(); - ctx.beginPath(); - ctx.rect(cx, cy, cw, ch); - ctx.clip(); - } - - if (camera.renderToTexture) - { - camera.emit('prerender', camera); - } - - camera.matrix.copyToContext(ctx); - - for (var i = 0; i < childCount; i++) - { - var child = list[i]; - - if (!child.willRender(camera)) - { - continue; - } - - 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); - ctx.globalCompositeOperation = 'source-over'; - ctx.globalAlpha = 1; - - camera.flashEffect.postRenderCanvas(ctx); - camera.fadeEffect.postRenderCanvas(ctx); - - camera.dirty = false; - - // Reset the camera scissor - if (scissor) - { - ctx.restore(); - } - - if (camera.renderToTexture) - { - camera.emit('postrender', camera); - - scene.sys.context.drawImage(camera.canvas, cx, cy); - } - }, - - /** - * [description] - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender - * @since 3.0.0 - */ - postRender: function () - { - var ctx = this.gameContext; - - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = 'source-over'; - - if (this.snapshotCallback) - { - this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); - this.snapshotCallback = null; - } - }, - - /** - * [description] - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot - * @since 3.0.0 - * - * @param {SnapshotCallback} callback - [description] - * @param {string} type - [description] - * @param {number} encoderOptions - [description] - */ - snapshot: function (callback, type, encoderOptions) - { - this.snapshotCallback = callback; - this.snapshotType = type; - this.snapshotEncoder = encoderOptions; - }, - - /** - * Takes a Sprite Game Object, or any object that extends it, and draws it to the current context. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#batchSprite - * @since 3.12.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The texture based Game Object to draw. - * @param {Phaser.Textures.Frame} frame - The frame to draw, doesn't have to be that owned by the Game Object. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. - */ - batchSprite: function (sprite, frame, camera, parentTransformMatrix) - { - var alpha = camera.alpha * sprite.alpha; - - if (alpha === 0) - { - // Nothing to see, so abort early - return; - } - - var ctx = this.currentContext; - - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; - - var cd = frame.canvasData; - - var frameX = cd.x; - var frameY = cd.y; - var frameWidth = frame.cutWidth; - var frameHeight = frame.cutHeight; - var res = frame.source.resolution; - - var x = -sprite.displayOriginX + frame.x; - var y = -sprite.displayOriginY + frame.y; - - var fx = (sprite.flipX) ? -1 : 1; - var fy = (sprite.flipY) ? -1 : 1; - - if (sprite.isCropped) - { - var crop = sprite._crop; - - if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY) - { - frame.updateCropUVs(crop, sprite.flipX, sprite.flipY); - } - - frameWidth = crop.cw; - frameHeight = crop.ch; - - frameX = crop.cx; - frameY = crop.cy; - - x = -sprite.displayOriginX + crop.x; - y = -sprite.displayOriginY + crop.y; - - if (fx === -1) - { - if (x >= 0) - { - x = -(x + frameWidth); - } - else if (x < 0) - { - x = (Math.abs(x) - frameWidth); - } - } - - if (fy === -1) - { - if (y >= 0) - { - y = -(y + frameHeight); - } - else if (y < 0) - { - y = (Math.abs(y) - frameHeight); - } - } - } - - spriteMatrix.applyITRS(sprite.x, sprite.y, sprite.rotation, sprite.scaleX, sprite.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = sprite.x; - spriteMatrix.f = sprite.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; - spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - ctx.save(); - - calcMatrix.setToContext(ctx); - - ctx.scale(fx, fy); - - ctx.globalCompositeOperation = this.blendModes[sprite.blendMode]; - - ctx.globalAlpha = alpha; - - ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); - - ctx.restore(); - }, - - /** - * [description] - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.gameCanvas = null; - this.gameContext = null; - - this.game = null; - } - -}); - -module.exports = CanvasRenderer; - - -/***/ }), -/* 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 CanvasPool = __webpack_require__(26); - -/** - * 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. - * - * @typedef {object} Phaser.Device.CanvasFeatures - * @since 3.0.0 - * - * @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 = { - - supportInverseAlpha: false, - supportNewBlendModes: false - -}; - -function checkBlendMode () -{ - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - - var magenta = new Image(); - - magenta.onload = function () - { - var yellow = new Image(); - - yellow.onload = function () - { - var canvas = CanvasPool.create(yellow, 6, 1); - var context = canvas.getContext('2d'); - - context.globalCompositeOperation = 'multiply'; - - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); - - if (!context.getImageData(2, 0, 1, 1)) - { - return false; - } - - var data = context.getImageData(2, 0, 1, 1).data; - - CanvasPool.remove(yellow); - - CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); - }; - - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - }; - - magenta.src = pngHead + 'AP804Oa6' + pngEnd; - - return false; -} - -function checkInverseAlpha () -{ - var canvas = CanvasPool.create(this, 2, 1); - var context = canvas.getContext('2d'); - - context.fillStyle = 'rgba(10, 20, 30, 0.5)'; - - // Draw a single pixel - context.fillRect(0, 0, 1, 1); - - // Get the color values - var s1 = context.getImageData(0, 0, 1, 1); - - if (s1 === null) - { - return false; - } - - // Plot them to x2 - context.putImageData(s1, 1, 0); - - // 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) - { - CanvasFeatures.supportNewBlendModes = checkBlendMode(); - CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); - } - - return CanvasFeatures; -} - -module.exports = init(); - - -/***/ }), -/* 376 */ -/***/ (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 singleton is instantiated as soon as Phaser loads, -// before a Phaser.Game instance has even been created. -// Which means all instances of Phaser Games can share it, -// without having to re-poll the device all over again - -/** - * @namespace Phaser.Device - * @since 3.0.0 - */ - -/** - * @typedef {object} Phaser.DeviceConf - * - * @property {Phaser.Device.OS} os - The OS Device functions. - * @property {Phaser.Device.Browser} browser - The Browser Device functions. - * @property {Phaser.Device.Features} features - The Features Device functions. - * @property {Phaser.Device.Input} input - The Input Device functions. - * @property {Phaser.Device.Audio} audio - The Audio Device functions. - * @property {Phaser.Device.Video} video - The Video Device functions. - * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. - * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. - */ - -module.exports = { - - os: __webpack_require__(101), - browser: __webpack_require__(128), - features: __webpack_require__(186), - input: __webpack_require__(974), - audio: __webpack_require__(973), - video: __webpack_require__(972), - fullscreen: __webpack_require__(971), - canvasFeatures: __webpack_require__(375) - -}; - - -/***/ }), -/* 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} - */ - -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(2); - -/** - * @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. - * - * @name Phaser.DOM.RequestAnimationFrame#isRunning - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isRunning = false; - - /** - * The callback to be invoked each step. - * - * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {FrameRequestCallback} - * @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 {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 {FrameRequestCallback} - * @since 3.0.0 - */ - this.step = function step (timestamp) - { - // DOMHighResTimeStamp - _this.lastTime = _this.tick; - - _this.tick = timestamp; - - _this.timeOutID = window.requestAnimationFrame(step); - - _this.callback(timestamp); - }; - - /** - * 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.timeOutID = window.setTimeout(stepTimeout, delay); - - _this.callback(d); - }; - }, - - /** - * Starts the requestAnimationFrame or setTimeout process running. - * - * @method Phaser.DOM.RequestAnimationFrame#start - * @since 3.0.0 - * - * @param {FrameRequestCallback} callback - The callback to invoke each step. - * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? - */ - start: function (callback, forceSetTimeOut) - { - if (this.isRunning) - { - return; - } - - this.callback = callback; - - this.isSetTimeOut = forceSetTimeOut; - - this.isRunning = true; - - this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); - }, - - /** - * 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 - { - window.cancelAnimationFrame(this.timeOutID); - } - }, - - /** - * Stops the step from running and clears the callback reference. - * - * @method Phaser.DOM.RequestAnimationFrame#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); - - this.callback = NOOP; - } - -}); - -module.exports = RequestAnimationFrame; - - -/***/ }), -/* 378 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101866,12 +100505,12 @@ module.exports = RemoveFromDOM; /***/ }), -/* 379 */ +/* 375 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101922,17 +100561,402 @@ var ParseXML = function (data) module.exports = ParseXML; +/***/ }), +/* 376 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Attempts to get the target DOM element based on the given value, which can be either + * a string, in which case it will be looked-up by ID, or an element node. If nothing + * can be found it will return a reference to the document.body. + * + * @function Phaser.DOM.GetTarget + * @since 3.16.0 + * + * @param {HTMLElement} element - The DOM element to look-up. + */ +var GetTarget = function (element) +{ + var target; + + if (element !== '') + { + if (typeof element === 'string') + { + // Hopefully an element ID + target = document.getElementById(element); + } + else if (element && element.nodeType === 1) + { + // Quick test for a HTMLElement + target = element; + } + } + + // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. + if (!target) + { + // Use the full window + target = document.body; + } + + return target; +}; + +module.exports = GetTarget; + + +/***/ }), +/* 377 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * @namespace Phaser.Scale.Zoom + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}. + * + * @typedef {(Phaser.Scale.Zoom.NO_ZOOM|Phaser.Scale.Zoom.ZOOM_2X|Phaser.Scale.Zoom.ZOOM_4X|Phaser.Scale.Zoom.MAX_ZOOM)} Phaser.Scale.ZoomType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas will not be zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.NO_ZOOM + * @since 3.16.0 + */ + NO_ZOOM: 1, + + /** + * The game canvas will be 2x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_2X + * @since 3.16.0 + */ + ZOOM_2X: 2, + + /** + * The game canvas will be 4x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_4X + * @since 3.16.0 + */ + ZOOM_4X: 4, + + /** + * Calculate the zoom value based on the maximum multiplied game size that will + * fit into the parent, or browser window if no parent is set. + * + * @name Phaser.Scale.Zoom.MAX_ZOOM + * @since 3.16.0 + */ + MAX_ZOOM: -1 + +}; + + +/***/ }), +/* 378 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * @namespace Phaser.Scale.ScaleModes + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}. + * + * @typedef {(Phaser.Scale.ScaleModes.NONE|Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT|Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH|Phaser.Scale.ScaleModes.FIT|Phaser.Scale.ScaleModes.ENVELOP|Phaser.Scale.ScaleModes.RESIZE)} Phaser.Scale.ScaleModeType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it + * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need + * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. + * + * @name Phaser.Scale.ScaleModes.NONE + * @since 3.16.0 + */ + NONE: 0, + + /** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT + * @since 3.16.0 + */ + WIDTH_CONTROLS_HEIGHT: 1, + + /** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH + * @since 3.16.0 + */ + HEIGHT_CONTROLS_WIDTH: 2, + + /** + * The width and height are automatically adjusted to fit inside the given target area, + * while keeping the aspect ratio. Depending on the aspect ratio there may be some space + * inside the area which is not covered. + * + * @name Phaser.Scale.ScaleModes.FIT + * @since 3.16.0 + */ + FIT: 3, + + /** + * The width and height are automatically adjusted to make the size cover the entire target + * area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Scale.ScaleModes.ENVELOP + * @since 3.16.0 + */ + ENVELOP: 4, + + /** + * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. + * + * @name Phaser.Scale.ScaleModes.RESIZE + * @since 3.16.0 + */ + RESIZE: 5 + +}; + + +/***/ }), +/* 379 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * @namespace Phaser.Scale.Orientation + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}. + * + * @typedef {(Phaser.Scale.Orientation.LANDSCAPE|Phaser.Scale.Orientation.PORTRAIT)} Phaser.Scale.OrientationType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * A landscape orientation. + * + * @name Phaser.Scale.Orientation.LANDSCAPE + * @since 3.16.0 + */ + LANDSCAPE: 'landscape-primary', + + /** + * A portrait orientation. + * + * @name Phaser.Scale.Orientation.PORTRAIT + * @since 3.16.0 + */ + PORTRAIT: 'portrait-primary' + +}; + + /***/ }), /* 380 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * @namespace Phaser.Scale.Center + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}. + * + * @typedef {(Phaser.Scale.Center.NO_CENTER|Phaser.Scale.Center.CENTER_BOTH|Phaser.Scale.Center.CENTER_HORIZONTALLY|Phaser.Scale.Center.CENTER_VERTICALLY)} Phaser.Scale.CenterType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas is not centered within the parent by Phaser. + * You can still center it yourself via CSS. + * + * @name Phaser.Scale.Center.NO_CENTER + * @since 3.16.0 + */ + NO_CENTER: 0, + + /** + * The game canvas is centered both horizontally and vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_BOTH + * @since 3.16.0 + */ + CENTER_BOTH: 1, + + /** + * The game canvas is centered horizontally within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_HORIZONTALLY + * @since 3.16.0 + */ + CENTER_HORIZONTALLY: 2, + + /** + * The game canvas is centered both vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_VERTICALLY + * @since 3.16.0 + */ + CENTER_VERTICALLY: 3 + +}; + + +/***/ }), +/* 381 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(101); +var CONST = __webpack_require__(196); + +var GetScreenOrientation = function (width, height) +{ + var screen = window.screen; + var orientation = (screen) ? screen.orientation || screen.mozOrientation || screen.msOrientation : false; + + if (orientation && typeof orientation.type === 'string') + { + // Screen Orientation API specification + return orientation.type; + } + else if (typeof orientation === 'string') + { + // moz / ms-orientation are strings + return orientation; + } + + if (screen) + { + return (screen.height > screen.width) ? CONST.PORTRAIT : CONST.LANDSCAPE; + } + else if (typeof window.orientation === 'number') + { + // This may change by device based on "natural" orientation. + return (window.orientation === 0 || window.orientation === 180) ? CONST.PORTRAIT : CONST.LANDSCAPE; + } + else if (window.matchMedia) + { + if (window.matchMedia('(orientation: portrait)').matches) + { + return CONST.PORTRAIT; + } + else if (window.matchMedia('(orientation: landscape)').matches) + { + return CONST.LANDSCAPE; + } + } + + return (height > width) ? CONST.PORTRAIT : CONST.LANDSCAPE; +}; + +module.exports = GetScreenOrientation; + + +/***/ }), +/* 382 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(108); /** * @callback ContentLoadedCallback @@ -101986,12 +101010,12 @@ module.exports = DOMContentLoaded; /***/ }), -/* 381 */ +/* 383 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -102042,12 +101066,12 @@ module.exports = HueToComponent; /***/ }), -/* 382 */ +/* 384 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -102072,12 +101096,12 @@ module.exports = ComponentToHex; /***/ }), -/* 383 */ +/* 385 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -102091,115 +101115,53 @@ module.exports = ComponentToHex; */ /** - * @typedef {Object} ColorObject + * @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. */ -var Color = __webpack_require__(41); +var Color = __webpack_require__(37); -Color.ColorToRGBA = __webpack_require__(987); -Color.ComponentToHex = __webpack_require__(382); -Color.GetColor = __webpack_require__(195); -Color.GetColor32 = __webpack_require__(412); -Color.HexStringToColor = __webpack_require__(413); -Color.HSLToColor = __webpack_require__(986); -Color.HSVColorWheel = __webpack_require__(985); -Color.HSVToRGB = __webpack_require__(194); -Color.HueToComponent = __webpack_require__(381); -Color.IntegerToColor = __webpack_require__(410); -Color.IntegerToRGB = __webpack_require__(409); -Color.Interpolate = __webpack_require__(984); -Color.ObjectToColor = __webpack_require__(408); -Color.RandomRGB = __webpack_require__(983); -Color.RGBStringToColor = __webpack_require__(407); -Color.RGBToHSV = __webpack_require__(411); -Color.RGBToString = __webpack_require__(982); -Color.ValueToColor = __webpack_require__(196); +Color.ColorToRGBA = __webpack_require__(1092); +Color.ComponentToHex = __webpack_require__(384); +Color.GetColor = __webpack_require__(211); +Color.GetColor32 = __webpack_require__(447); +Color.HexStringToColor = __webpack_require__(448); +Color.HSLToColor = __webpack_require__(1091); +Color.HSVColorWheel = __webpack_require__(1090); +Color.HSVToRGB = __webpack_require__(210); +Color.HueToComponent = __webpack_require__(383); +Color.IntegerToColor = __webpack_require__(445); +Color.IntegerToRGB = __webpack_require__(444); +Color.Interpolate = __webpack_require__(1089); +Color.ObjectToColor = __webpack_require__(443); +Color.RandomRGB = __webpack_require__(1088); +Color.RGBStringToColor = __webpack_require__(442); +Color.RGBToHSV = __webpack_require__(446); +Color.RGBToString = __webpack_require__(1087); +Color.ValueToColor = __webpack_require__(212); module.exports = Color; /***/ }), -/* 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} - */ - -/** - * @namespace Phaser.Display.Canvas.CanvasInterpolation - * @since 3.0.0 - */ -var CanvasInterpolation = { - - /** - * 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' ]; - - types.forEach(function (type) - { - canvas.style['image-rendering'] = type; - }); - - canvas.style.msInterpolationMode = 'nearest-neighbor'; - - return canvas; - }, - - /** - * 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'; - - return canvas; - } - -}; - -module.exports = CanvasInterpolation; - - -/***/ }), -/* 385 */ +/* 386 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 CatmullRom = __webpack_require__(189); +var CatmullRom = __webpack_require__(205); var Class = __webpack_require__(0); -var Curve = __webpack_require__(80); +var Curve = __webpack_require__(86); var Vector2 = __webpack_require__(3); /** @@ -102410,73 +101372,19 @@ SplineCurve.fromJSON = function (data) module.exports = SplineCurve; -/***/ }), -/* 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} - */ - -function P0 (t, p) -{ - var k = 1 - t; - - return k * k * p; -} - -function P1 (t, p) -{ - return 2 * (1 - t) * t * p; -} - -function P2 (t, p) -{ - return t * t * p; -} - -// p0 = start point -// p1 = control point 1 -// p2 = end point - -// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js - -/** - * A quadratic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.QuadraticBezier - * @since 3.2.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The control point. - * @param {number} p2 - The end point. - * - * @return {number} The interpolated value. - */ -var QuadraticBezierInterpolation = function (t, p0, p1, p2) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2); -}; - -module.exports = QuadraticBezierInterpolation; - - /***/ }), /* 387 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Curve = __webpack_require__(80); -var QuadraticBezierInterpolation = __webpack_require__(386); +var Curve = __webpack_require__(86); +var QuadraticBezierInterpolation = __webpack_require__(416); var Vector2 = __webpack_require__(3); /** @@ -102684,23 +101592,23 @@ module.exports = QuadraticBezier; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(80); -var FromPoints = __webpack_require__(191); -var Rectangle = __webpack_require__(10); +var Curve = __webpack_require__(86); +var FromPoints = __webpack_require__(198); +var Rectangle = __webpack_require__(11); var Vector2 = __webpack_require__(3); var tmpVec2 = new Vector2(); /** * @classdesc - * [description] + * A LineCurve is a "curve" comprising exactly two points (a line segment). * * @class Line * @extends Phaser.Curves.Curve @@ -102708,8 +101616,8 @@ var tmpVec2 = new Vector2(); * @constructor * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|number[])} p0 - [description] - * @param {Phaser.Math.Vector2} [p1] - [description] + * @param {(Phaser.Math.Vector2|number[])} p0 - The first endpoint. + * @param {Phaser.Math.Vector2} [p1] - The second endpoint. */ var LineCurve = new Class({ @@ -102729,7 +101637,7 @@ var LineCurve = new Class({ } /** - * [description] + * The first endpoint. * * @name Phaser.Curves.Line#p0 * @type {Phaser.Math.Vector2} @@ -102738,7 +101646,7 @@ var LineCurve = new Class({ this.p0 = p0; /** - * [description] + * The second endpoint. * * @name Phaser.Curves.Line#p1 * @type {Phaser.Math.Vector2} @@ -102786,14 +101694,14 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets the resolution of the line. * * @method Phaser.Curves.Line#getResolution * @since 3.0.0 * - * @param {number} [divisions=1] - [description] + * @param {number} [divisions=1] - The number of divisions to consider. * - * @return {number} [description] + * @return {number} The resolution. Equal to the number of divisions. */ getResolution: function (divisions) { @@ -102832,7 +101740,7 @@ var LineCurve = new Class({ // Line curve is linear, so we can overwrite default getPointAt /** - * [description] + * Gets a point at a given position on the line. * * @method Phaser.Curves.Line#getPointAt * @since 3.0.0 @@ -102850,14 +101758,14 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets the slope of the line as a unit vector. * * @method Phaser.Curves.Line#getTangent * @since 3.0.0 * * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} The tangent vector. */ getTangent: function () { @@ -102892,7 +101800,7 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets a JSON representation of the line. * * @method Phaser.Curves.Line#toJSON * @since 3.0.0 @@ -102913,14 +101821,14 @@ var LineCurve = new Class({ }); /** - * [description] + * Configures this line from a JSON representation. * * @function Phaser.Curves.Line.fromJSON * @since 3.0.0 * * @param {JSONCurve} data - The JSON object containing this curve data. * - * @return {Phaser.Curves.Line} [description] + * @return {Phaser.Curves.Line} A new LineCurve object. */ LineCurve.fromJSON = function (data) { @@ -102941,17 +101849,17 @@ module.exports = LineCurve; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(80); -var DegToRad = __webpack_require__(36); +var Curve = __webpack_require__(86); +var DegToRad = __webpack_require__(39); var GetValue = __webpack_require__(4); -var RadToDeg = __webpack_require__(190); +var RadToDeg = __webpack_require__(203); var Vector2 = __webpack_require__(3); /** @@ -103588,82 +102496,19 @@ module.exports = EllipseCurve; /***/ }), /* 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} - */ - -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 - -/** - * A cubic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.CubicBezier - * @since 3.0.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The first control point. - * @param {number} p2 - The second control point. - * @param {number} p3 - The end point. - * - * @return {number} The interpolated value. - */ -var CubicBezierInterpolation = function (t, p0, p1, p2, p3) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); -}; - -module.exports = CubicBezierInterpolation; - - -/***/ }), -/* 391 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(390); -var Curve = __webpack_require__(80); +var CubicBezier = __webpack_require__(417); +var Curve = __webpack_require__(86); var Vector2 = __webpack_require__(3); /** @@ -103877,12 +102722,12 @@ module.exports = CubicBezierCurve; /***/ }), -/* 392 */ +/* 391 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103915,16 +102760,16 @@ module.exports = { /***/ }), -/* 393 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arne16 = __webpack_require__(392); +var Arne16 = __webpack_require__(391); var CanvasPool = __webpack_require__(26); var GetValue = __webpack_require__(4); @@ -104029,21 +102874,295 @@ var GenerateTexture = function (config) module.exports = GenerateTexture; +/***/ }), +/* 393 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Events = __webpack_require__(28); + +/** + * The Visibility Handler is responsible for listening out for document level visibility change events. + * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses + * the provided Event Emitter and fires the related events. + * + * @function Phaser.Core.VisibilityHandler + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. + */ +var VisibilityHandler = function (game) +{ + var hiddenVar; + var eventEmitter = game.events; + + if (document.hidden !== undefined) + { + hiddenVar = 'visibilitychange'; + } + else + { + var vendors = [ 'webkit', 'moz', 'ms' ]; + + vendors.forEach(function (prefix) + { + if (document[prefix + 'Hidden'] !== undefined) + { + document.hidden = function () + { + return document[prefix + 'Hidden']; + }; + + hiddenVar = prefix + 'visibilitychange'; + } + + }); + } + + var onChange = function (event) + { + if (document.hidden || event.type === 'pause') + { + eventEmitter.emit(Events.HIDDEN); + } + else + { + eventEmitter.emit(Events.VISIBLE); + } + }; + + if (hiddenVar) + { + document.addEventListener(hiddenVar, onChange, false); + } + + window.onblur = function () + { + eventEmitter.emit(Events.BLUR); + }; + + window.onfocus = function () + { + eventEmitter.emit(Events.FOCUS); + }; + + // Automatically give the window focus unless config says otherwise + if (window.focus && game.config.autoFocus) + { + window.focus(); + } +}; + +module.exports = VisibilityHandler; + + /***/ }), /* 394 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @namespace Phaser.Math.Easing.Stepped - */ +var Class = __webpack_require__(0); +var NOOP = __webpack_require__(2); -module.exports = __webpack_require__(1024); +/** + * @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. + * + * @name Phaser.DOM.RequestAnimationFrame#isRunning + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isRunning = false; + + /** + * The callback to be invoked each step. + * + * @name Phaser.DOM.RequestAnimationFrame#callback + * @type {FrameRequestCallback} + * @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 {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 {FrameRequestCallback} + * @since 3.0.0 + */ + this.step = function step () + { + // Because we cannot trust the time passed to this callback from the browser and need it kept in sync with event times + var timestamp = window.performance.now(); + + // 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); + }; + }, + + /** + * Starts the requestAnimationFrame or setTimeout process running. + * + * @method Phaser.DOM.RequestAnimationFrame#start + * @since 3.0.0 + * + * @param {FrameRequestCallback} callback - The callback to invoke each step. + * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? + */ + start: function (callback, forceSetTimeOut) + { + if (this.isRunning) + { + return; + } + + this.callback = callback; + + this.isSetTimeOut = forceSetTimeOut; + + this.isRunning = true; + + this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + }, + + /** + * 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 + { + window.cancelAnimationFrame(this.timeOutID); + } + }, + + /** + * Stops the step from running and clears the callback reference. + * + * @method Phaser.DOM.RequestAnimationFrame#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.stop(); + + this.callback = NOOP; + } + +}); + +module.exports = RequestAnimationFrame; /***/ }), @@ -104052,7 +103171,9737 @@ module.exports = __webpack_require__(1024); /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 NOOP = __webpack_require__(2); +var RequestAnimationFrame = __webpack_require__(394); + +// Frame Rate config +// fps: { +// min: 10, +// target: 60, +// forceSetTimeOut: false, +// deltaHistory: 10, +// panicMax: 120 +// } + +// http://www.testufo.com/#test=animation-time-graph + +/** + * @callback TimeStepCallback + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} average - The Delta Average. + * @param {number} interpolation - Interpolation - how far between what is expected and where we are? + */ + +/** + * @classdesc + * [description] + * + * @class TimeStep + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. + * @param {FPSConfig} config + */ +var TimeStep = new Class({ + + initialize: + + function TimeStep (game, config) + { + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Core.TimeStep#game + * @type {Phaser.Game} + * @readonly + * @since 3.0.0 + */ + this.game = game; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#raf + * @type {Phaser.DOM.RequestAnimationFrame} + * @readonly + * @since 3.0.0 + */ + this.raf = new RequestAnimationFrame(); + + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * + * @name Phaser.Core.TimeStep#started + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.started = false; + + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * The difference between this value and `started` is that `running` is toggled when + * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if + * the TimeStep is actually stopped, not just paused. + * + * @name Phaser.Core.TimeStep#running + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.running = false; + + /** + * The minimum fps rate you want the Time Step to run at. + * + * @name Phaser.Core.TimeStep#minFps + * @type {integer} + * @default 5 + * @since 3.0.0 + */ + this.minFps = GetValue(config, 'min', 5); + + /** + * The target fps rate for the Time Step to run at. + * + * Setting this value will not actually change the speed at which the browser runs, that is beyond + * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step + * is spiraling out of control. + * + * @name Phaser.Core.TimeStep#targetFps + * @type {integer} + * @default 60 + * @since 3.0.0 + */ + this.targetFps = GetValue(config, 'target', 60); + + /** + * The minFps value in ms. + * Defaults to 200ms between frames (i.e. super slow!) + * + * @name Phaser.Core.TimeStep#_min + * @type {number} + * @private + * @since 3.0.0 + */ + this._min = 1000 / this.minFps; + + /** + * The targetFps value in ms. + * Defaults to 16.66ms between frames (i.e. normal) + * + * @name Phaser.Core.TimeStep#_target + * @type {number} + * @private + * @since 3.0.0 + */ + this._target = 1000 / this.targetFps; + + /** + * An exponential moving average of the frames per second. + * + * @name Phaser.Core.TimeStep#actualFps + * @type {integer} + * @readonly + * @default 60 + * @since 3.0.0 + */ + this.actualFps = this.targetFps; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#nextFpsUpdate + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.nextFpsUpdate = 0; + + /** + * The number of frames processed this second. + * + * @name Phaser.Core.TimeStep#framesThisSecond + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.framesThisSecond = 0; + + /** + * A callback to be invoked each time the Time Step steps. + * + * @name Phaser.Core.TimeStep#callback + * @type {TimeStepCallback} + * @default NOOP + * @since 3.0.0 + */ + this.callback = NOOP; + + /** + * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting + * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. + * + * @name Phaser.Core.TimeStep#forceSetTimeOut + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); + + /** + * [description] + * + * @name Phaser.Core.TimeStep#time + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.time = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#startTime + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.startTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#lastTime + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.lastTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#frame + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.frame = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#inFocus + * @type {boolean} + * @readonly + * @default true + * @since 3.0.0 + */ + this.inFocus = true; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#_pauseTime + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._pauseTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#_coolDown + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._coolDown = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#delta + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.delta = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaIndex + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.deltaIndex = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaHistory + * @type {integer[]} + * @since 3.0.0 + */ + this.deltaHistory = []; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaSmoothingMax + * @type {integer} + * @default 10 + * @since 3.0.0 + */ + this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); + + /** + * [description] + * + * @name Phaser.Core.TimeStep#panicMax + * @type {integer} + * @default 120 + * @since 3.0.0 + */ + this.panicMax = GetValue(config, 'panicMax', 120); + + /** + * The actual elapsed time in ms between one update and the next. + * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. + * So please be careful when using this value in calculations. + * + * @name Phaser.Core.TimeStep#rawDelta + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.rawDelta = 0; + }, + + /** + * Called when the DOM window.onBlur event triggers. + * + * @method Phaser.Core.TimeStep#blur + * @since 3.0.0 + */ + blur: function () + { + this.inFocus = false; + }, + + /** + * Called when the DOM window.onFocus event triggers. + * + * @method Phaser.Core.TimeStep#focus + * @since 3.0.0 + */ + focus: function () + { + this.inFocus = true; + + this.resetDelta(); + }, + + /** + * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) + * + * @method Phaser.Core.TimeStep#pause + * @since 3.0.0 + */ + pause: function () + { + this._pauseTime = window.performance.now(); + }, + + /** + * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) + * + * @method Phaser.Core.TimeStep#resume + * @since 3.0.0 + */ + resume: function () + { + this.resetDelta(); + + this.startTime += this.time - this._pauseTime; + }, + + /** + * [description] + * + * @method Phaser.Core.TimeStep#resetDelta + * @since 3.0.0 + */ + resetDelta: function () + { + var now = window.performance.now(); + + this.time = now; + this.lastTime = now; + this.nextFpsUpdate = now + 1000; + this.framesThisSecond = 0; + this.frame = 0; + + // Pre-populate smoothing array + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); + } + + this.delta = 0; + this.deltaIndex = 0; + + this._coolDown = this.panicMax; + }, + + /** + * Starts the Time Step running, if it is not already doing so. + * Called automatically by the Game Boot process. + * + * @method Phaser.Core.TimeStep#start + * @since 3.0.0 + * + * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. + */ + start: function (callback) + { + if (this.started) + { + return this; + } + + this.started = true; + this.running = true; + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = this._target; + } + + this.resetDelta(); + + this.startTime = window.performance.now(); + + this.callback = callback; + + this.raf.start(this.step.bind(this), this.forceSetTimeOut); + }, + + /** + * The main step method. This is called each time the browser updates, either by Request Animation Frame, + * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. + * You generally should never call this method directly. + * + * @method Phaser.Core.TimeStep#step + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + */ + step: function (time) + { + var before = time - this.lastTime; + + if (before < 0) + { + // Because, Chrome. + before = 0; + } + + this.rawDelta = before; + + var idx = this.deltaIndex; + var history = this.deltaHistory; + var max = this.deltaSmoothingMax; + + // delta time (time is in ms) + var dt = before; + + // When a browser switches tab, then comes back again, it takes around 10 frames before + // the delta time settles down so we employ a 'cooling down' period before we start + // trusting the delta values again, to avoid spikes flooding through our delta average + + if (this._coolDown > 0 || !this.inFocus) + { + this._coolDown--; + + dt = Math.min(dt, this._target); + } + + if (dt > this._min) + { + // Probably super bad start time or browser tab context loss, + // so use the last 'sane' dt value + + dt = history[idx]; + + // Clamp delta to min (in case history has become corrupted somehow) + dt = Math.min(dt, this._min); + } + + // Smooth out the delta over the previous X frames + + // add the delta to the smoothing array + history[idx] = dt; + + // adjusts the delta history array index based on the smoothing count + // this stops the array growing beyond the size of deltaSmoothingMax + this.deltaIndex++; + + if (this.deltaIndex > max) + { + this.deltaIndex = 0; + } + + // Delta Average + var avg = 0; + + // Loop the history array, adding the delta values together + + for (var i = 0; i < max; i++) + { + avg += history[i]; + } + + // Then divide by the array length to get the average delta + avg /= max; + + // Set as the world delta value + this.delta = avg; + + // Real-world timer advance + this.time += this.rawDelta; + + // Update the estimate of the frame rate, `fps`. Every second, the number + // of frames that occurred in that second are included in an exponential + // moving average of all frames per second, with an alpha of 0.25. This + // means that more recent seconds affect the estimated frame rate more than + // older seconds. + // + // When a browser window is NOT minimized, but is covered up (i.e. you're using + // another app which has spawned a window over the top of the browser), then it + // will start to throttle the raf callback time. It waits for a while, and then + // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. + // So if the game was running at 60fps, and the player opens a new window, then + // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. + // + // When they make the game visible again, the frame rate is increased at a rate of + // approx. 8fps, back up to 60fps (or the max it can obtain) + // + // There is no easy way to determine if this drop in frame rate is because the + // browser is throttling raf, or because the game is struggling with performance + // because you're asking it to do too much on the device. + + if (time > this.nextFpsUpdate) + { + // Compute the new exponential moving average with an alpha of 0.25. + this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; + this.nextFpsUpdate = time + 1000; + this.framesThisSecond = 0; + } + + this.framesThisSecond++; + + // Interpolation - how far between what is expected and where we are? + var interpolation = avg / this._target; + + this.callback(time, avg, interpolation); + + // Shift time value over + this.lastTime = time; + + this.frame++; + }, + + /** + * Manually calls TimeStep.step, passing in the performance.now value to it. + * + * @method Phaser.Core.TimeStep#tick + * @since 3.0.0 + */ + tick: function () + { + this.step(window.performance.now()); + }, + + /** + * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. + * + * @method Phaser.Core.TimeStep#sleep + * @since 3.0.0 + */ + sleep: function () + { + if (this.running) + { + this.raf.stop(); + + this.running = false; + } + }, + + /** + * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. + * The `seamless` argument controls if the wake-up should adjust the start time or not. + * + * @method Phaser.Core.TimeStep#wake + * @since 3.0.0 + * + * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. + */ + wake: function (seamless) + { + if (this.running) + { + this.sleep(); + } + else if (seamless) + { + this.startTime += -this.lastTime + (this.lastTime + window.performance.now()); + } + + this.raf.start(this.step.bind(this), this.useRAF); + + this.running = true; + + this.step(window.performance.now()); + }, + + /** + * Stops the TimeStep running. + * + * @method Phaser.Core.TimeStep#stop + * @since 3.0.0 + * + * @return {Phaser.Core.TimeStep} The TimeStep object. + */ + stop: function () + { + this.running = false; + this.started = false; + + this.raf.stop(); + + return this; + }, + + /** + * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null + * any objects. + * + * @method Phaser.Core.TimeStep#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.stop(); + + this.callback = NOOP; + + this.raf = null; + this.game = null; + } + +}); + +module.exports = TimeStep; + + +/***/ }), +/* 396 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(30); + +/** + * Called automatically by Phaser.Game and responsible for creating the console.log debug header. + * + * You can customize or disable the header via the Game Config object. + * + * @function Phaser.Core.DebugHeader + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. + */ +var DebugHeader = function (game) +{ + var config = game.config; + + if (config.hideBanner) + { + return; + } + + 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; + + var audioType; + + if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + { + audioType = 'Web Audio'; + } + else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + audioType = 'No Audio'; + } + else + { + audioType = 'HTML5 Audio'; + } + + if (!game.device.browser.ie) + { + var c = ''; + var args = [ c ]; + + if (Array.isArray(config.bannerBackgroundColor)) + { + var lastColor; + + config.bannerBackgroundColor.forEach(function (color) + { + c = c.concat('%c '); + + args.push('background: ' + color); + + lastColor = color; + + }); + + // inject the text color + args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + } + else + { + c = c.concat('%c '); + + args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + } + + // URL link background color (always white) + args.push('background: #fff'); + + if (config.gameTitle) + { + c = c.concat(config.gameTitle); + + if (config.gameVersion) + { + c = c.concat(' v' + config.gameVersion); + } + + if (!config.hidePhaser) + { + c = c.concat(' / '); + } + } + + var fb = ( true) ? '-FB' : undefined; + + if (!config.hidePhaser) + { + c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); + } + + c = c.concat(' %c ' + config.gameURL); + + // Inject the new string back into the args array + args[0] = c; + + console.log.apply(console, args); + } + else if (window['console']) + { + console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); + } +}; + +module.exports = DebugHeader; + + +/***/ }), +/* 397 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2019 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__(1129); +var TextureTintPipeline = __webpack_require__(199); + +var LIGHT_COUNT = 10; + +/** + * @classdesc + * ForwardDiffuseLightPipeline implements a forward rendering approach for 2D lights. + * This pipeline extends TextureTintPipeline so it implements all it's rendering functions + * and batching system. + * + * @class ForwardDiffuseLightPipeline + * @extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.0.0 + * + * @param {object} config - The configuration of the pipeline, same as the {@link Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline}. The fragment shader will be replaced with the lighting shader. + */ +var ForwardDiffuseLightPipeline = new Class({ + + Extends: TextureTintPipeline, + + initialize: + + function ForwardDiffuseLightPipeline (config) + { + LIGHT_COUNT = config.maxLights; + + config.fragShader = ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()); + + TextureTintPipeline.call(this, config); + + /** + * Default normal map texture to use. + * + * @name Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#defaultNormalMap + * @type {Phaser.Texture.Frame} + * @private + * @since 3.11.0 + */ + this.defaultNormalMap; + + /** + * Inverse rotation matrix for normal map rotations. + * + * @name Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#inverseRotationMatrix + * @type {Float32Array} + * @private + * @since 3.16.0 + */ + this.inverseRotationMatrix = new Float32Array([ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + ]); + }, + + /** + * Called when the Game has fully booted and the Renderer has finished setting up. + * + * By this stage all Game level systems are now in place and you can perform any final + * tasks that the pipeline may need that relied on game systems such as the Texture Manager. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#boot + * @override + * @since 3.11.0 + */ + boot: function () + { + this.defaultNormalMap = this.game.textures.getFrame('__DEFAULT'); + }, + + /** + * This function binds its base class resources and this lights 2D resources. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#onBind + * @override + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. + */ + onBind: function (gameObject) + { + 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); + + if (gameObject) + { + this.setNormalMap(gameObject); + } + + return this; + }, + + /** + * This function sets all the needed resources for each camera pass. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#onRender + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. + * + * @return {this} This WebGLPipeline instance. + */ + onRender: function (scene, camera) + { + this.active = false; + + var lightManager = scene.sys.lights; + + if (!lightManager || lightManager.lights.length <= 0 || !lightManager.active) + { + // Passthru + return this; + } + + var lights = lightManager.cull(camera); + var lightCount = Math.min(lights.length, LIGHT_COUNT); + + if (lightCount === 0) + { + return this; + } + + this.active = true; + + var renderer = this.renderer; + var program = this.program; + var cameraMatrix = camera.matrix; + var point = {x: 0, y: 0}; + var height = renderer.height; + var index; + + for (index = 0; index < LIGHT_COUNT; ++index) + { + // Reset lights + renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); + } + + 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); + + 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; + }, + + /** + * Generic function for batching a textured quad + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchTexture + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject + * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad + * @param {integer} textureWidth - Real texture width + * @param {integer} textureHeight - Real texture height + * @param {number} srcX - X coordinate of the quad + * @param {number} srcY - Y coordinate of the quad + * @param {number} srcWidth - Width of the quad + * @param {number} srcHeight - Height of the quad + * @param {number} scaleX - X component of scale + * @param {number} scaleY - Y component of scale + * @param {number} rotation - Rotation of the quad + * @param {boolean} flipX - Indicates if the quad is horizontally flipped + * @param {boolean} flipY - Indicates if the quad is vertically flipped + * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll + * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll + * @param {number} displayOriginX - Horizontal origin in pixels + * @param {number} displayOriginY - Vertical origin in pixels + * @param {number} frameX - X coordinate of the texture frame + * @param {number} frameY - Y coordinate of the texture frame + * @param {number} frameWidth - Width of the texture frame + * @param {number} frameHeight - Height of the texture frame + * @param {integer} tintTL - Tint for top left + * @param {integer} tintTR - Tint for top right + * @param {integer} tintBL - Tint for bottom left + * @param {integer} tintBR - Tint for bottom right + * @param {number} tintEffect - The tint effect (0 for additive, 1 for replacement) + * @param {number} uOffset - Horizontal offset on texture coordinate + * @param {number} vOffset - Vertical offset on texture coordinate + * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container + */ + 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, tintEffect, + uOffset, vOffset, + camera, + parentTransformMatrix) + { + if (!this.active) + { + return; + } + + this.renderer.setPipeline(this); + + var normalTexture; + + if (gameObject.displayTexture) + { + normalTexture = gameObject.displayTexture.dataSource[gameObject.displayFrame.sourceIndex]; + } + else if (gameObject.texture) + { + normalTexture = gameObject.texture.dataSource[gameObject.frame.sourceIndex]; + } + else if (gameObject.tileset) + { + normalTexture = gameObject.tileset.image.dataSource[0]; + } + + if (!normalTexture) + { + console.warn('Normal map missing or invalid'); + return; + } + + this.setTexture2D(normalTexture.glTexture, 1); + this.setNormalMapRotation(rotation); + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var u0 = (frameX / textureWidth) + uOffset; + var v0 = (frameY / textureHeight) + vOffset; + var u1 = (frameX + frameWidth) / textureWidth + uOffset; + var v1 = (frameY + frameHeight) / textureHeight + vOffset; + + var width = srcWidth; + var height = srcHeight; + + // var x = -displayOriginX + frameX; + // var y = -displayOriginY + frameY; + + var x = -displayOriginX; + var y = -displayOriginY; + + if (gameObject.isCropped) + { + var crop = gameObject._crop; + + width = crop.width; + height = crop.height; + + srcWidth = crop.width; + srcHeight = crop.height; + + frameX = crop.x; + frameY = crop.y; + + var ox = frameX; + var oy = frameY; + + if (flipX) + { + ox = (frameWidth - crop.x - crop.width); + } + + if (flipY && !texture.isRenderTexture) + { + oy = (frameHeight - crop.y - crop.height); + } + + u0 = (ox / textureWidth) + uOffset; + v0 = (oy / textureHeight) + vOffset; + u1 = (ox + crop.width) / textureWidth + uOffset; + v1 = (oy + crop.height) / textureHeight + vOffset; + + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; + } + + // Invert the flipY if this is a RenderTexture + flipY = flipY ^ (texture.isRenderTexture ? 1 : 0); + + if (flipX) + { + width *= -1; + x += srcWidth; + } + + if (flipY) + { + height *= -1; + y += srcHeight; + } + + // Do we need this? (doubt it) + // if (camera.roundPixels) + // { + // x |= 0; + // y |= 0; + // } + + var xw = x + width; + var yh = y + height; + + spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = srcX; + spriteMatrix.f = srcY; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + else + { + spriteMatrix.e -= camera.scrollX * scrollFactorX; + spriteMatrix.f -= camera.scrollY * scrollFactorY; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + + var tx0 = calcMatrix.getX(x, y); + var ty0 = calcMatrix.getY(x, y); + + var tx1 = calcMatrix.getX(x, yh); + var ty1 = calcMatrix.getY(x, yh); + + var tx2 = calcMatrix.getX(xw, yh); + var ty2 = calcMatrix.getY(xw, yh); + + var tx3 = calcMatrix.getX(xw, y); + var ty3 = calcMatrix.getY(xw, y); + + if (camera.roundPixels) + { + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); + + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); + + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); + + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); + } + + this.setTexture2D(texture, 0); + + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); + }, + + /** + * Sets the Game Objects normal map as the active texture. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMap + * @since 3.11.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to update. + */ + setNormalMap: function (gameObject) + { + if (!this.active || !gameObject) + { + return; + } + + var normalTexture; + + if (gameObject.texture) + { + normalTexture = gameObject.texture.dataSource[gameObject.frame.sourceIndex]; + } + + if (!normalTexture) + { + normalTexture = this.defaultNormalMap; + } + + this.setTexture2D(normalTexture.glTexture, 1); + + this.renderer.setPipeline(gameObject.defaultPipeline); + }, + + /** + * Rotates the normal map vectors inversely by the given angle. + * Only works in 2D space. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMapRotation + * @since 3.16.0 + * + * @param {number} rotation - The angle of rotation in radians. + */ + setNormalMapRotation: function (rotation) + { + var inverseRotationMatrix = this.inverseRotationMatrix; + + if (rotation) + { + var rot = -rotation; + var c = Math.cos(rot); + var s = Math.sin(rot); + + inverseRotationMatrix[1] = s; + inverseRotationMatrix[3] = -s; + inverseRotationMatrix[0] = inverseRotationMatrix[4] = c; + } + else + { + inverseRotationMatrix[0] = inverseRotationMatrix[4] = 1; + inverseRotationMatrix[1] = inverseRotationMatrix[3] = 0; + } + + this.renderer.setMatrix3(this.program, 'uInverseRotationMatrix', false, inverseRotationMatrix); + }, + + /** + * Takes a Sprite Game Object, or any object that extends it, which has a normal texture and adds it to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - The texture-based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - The transform matrix of the parent container, if set. + */ + batchSprite: function (sprite, camera, parentTransformMatrix) + { + if (!this.active) + { + return; + } + + var normalTexture = sprite.texture.dataSource[sprite.frame.sourceIndex]; + + if (normalTexture) + { + this.renderer.setPipeline(this); + + this.setTexture2D(normalTexture.glTexture, 1); + this.setNormalMapRotation(sprite.rotation); + + TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera, parentTransformMatrix); + } + } + +}); + +ForwardDiffuseLightPipeline.LIGHT_COUNT = LIGHT_COUNT; + +module.exports = ForwardDiffuseLightPipeline; + + +/***/ }), +/* 398 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2019 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__(1131); +var ShaderSourceVS = __webpack_require__(1130); +var WebGLPipeline = __webpack_require__(200); + +/** + * @classdesc + * BitmapMaskPipeline handles all bitmap masking rendering in WebGL. It works by using + * sampling two texture on the fragment shader and using the fragment's alpha to clip the region. + * The config properties are: + * - game: Current game instance. + * - renderer: Current WebGL renderer. + * - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES. + * Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants). + * - vertShader: Source for vertex shader as a string. + * - fragShader: Source for fragment shader as a string. + * - vertexCapacity: The amount of vertices that shall be allocated + * - vertexSize: The size of a single vertex in bytes. + * + * @class BitmapMaskPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.0.0 + * + * @param {object} config - Used for overriding shader an pipeline properties if extending this pipeline. + */ +var BitmapMaskPipeline = new Class({ + + 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), + + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2), + + vertices: new Float32Array([ + -1, +1, -1, -7, +7, +1 + ]).buffer, + + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + } + ] + }); + + /** + * Float32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); + + /** + * Size of the batch. + * + * @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#maxQuads + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.maxQuads = 1; + + /** + * Dirty flag to check if resolution properties need to be updated on the + * masking shader. + * + * @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resolutionDirty + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.resolutionDirty = true; + }, + + /** + * Called every time the pipeline needs to be used. + * It binds all necessary resources. + * + * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#onBind + * @since 3.0.0 + * + * @return {this} This WebGLPipeline instance. + */ + 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; + } + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {this} This WebGLPipeline instance. + */ + resize: function (width, height, resolution) + { + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.resolutionDirty = true; + return this; + }, + + /** + * Binds necessary resources and renders the mask to a separated framebuffer. + * The framebuffer for the masked object is also bound for further use. + * + * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#beginMask + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} mask - GameObject used as mask. + * @param {Phaser.GameObjects.GameObject} maskedObject - GameObject masked by the mask GameObject. + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + beginMask: function (mask, maskedObject, camera) + { + var renderer = this.renderer; + var gl = this.gl; + + // The renderable Game Object that is being used for the bitmap mask + var bitmapMask = mask.bitmapMask; + + if (bitmapMask && gl) + { + renderer.flush(); + + // First we clear the mask framebuffer + renderer.setFramebuffer(mask.maskFramebuffer); + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + + // We render our mask source + bitmapMask.renderWebGL(renderer, bitmapMask, 0, camera); + 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); + } + }, + + /** + * The masked game object's framebuffer is unbound and it's texture + * is bound together with the mask texture and the mask shader and + * a draw call with a single quad is processed. Here is where the + * masking effect is applied. + * + * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#endMask + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} mask - GameObject used as a mask. + */ + endMask: function (mask) + { + var renderer = this.renderer; + var gl = this.gl; + + // The renderable Game Object that is being used for the bitmap mask + var bitmapMask = mask.bitmapMask; + + if (bitmapMask && gl) + { + // 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); + } + } + +}); + +module.exports = BitmapMaskPipeline; + + +/***/ }), +/* 399 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(26); +var Color = __webpack_require__(37); +var GetFastValue = __webpack_require__(1); + +/** + * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. + * + * @function Phaser.Renderer.Snapshot.WebGL + * @since 3.0.0 + * + * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {SnapshotState} config - The snapshot configuration object. + */ +var WebGLSnapshot = function (sourceCanvas, config) +{ + var gl = sourceCanvas.getContext('experimental-webgl'); + + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = GetFastValue(config, 'x', 0); + var y = GetFastValue(config, 'y', 0); + var width = GetFastValue(config, 'width', gl.drawingBufferWidth); + var height = GetFastValue(config, 'height', gl.drawingBufferHeight); + var getPixel = GetFastValue(config, 'getPixel', false); + + if (getPixel) + { + var pixel = new Uint8Array(4); + + gl.readPixels(x, gl.drawingBufferHeight - y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel); + + callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3] / 255)); + } + else + { + var pixels = new Uint8Array(width * height * 4); + + gl.readPixels(x, gl.drawingBufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + + var canvas = CanvasPool.createWebGL(this, width, height); + var ctx = canvas.getContext('2d'); + + var imageData = ctx.getImageData(0, 0, width, height); + + var data = imageData.data; + + for (var py = 0; py < height; py++) + { + for (var px = 0; px < width; px++) + { + var sourceIndex = ((height - py) * width + px) * 4; + var destIndex = (py * width + px) * 4; + + data[destIndex + 0] = pixels[sourceIndex + 0]; + data[destIndex + 1] = pixels[sourceIndex + 1]; + data[destIndex + 2] = pixels[sourceIndex + 2]; + data[destIndex + 3] = pixels[sourceIndex + 3]; + } + } + + ctx.putImageData(imageData, 0, 0); + + var image = new Image(); + + image.onerror = function () + { + callback.call(null); + + CanvasPool.remove(canvas); + }; + + image.onload = function () + { + callback.call(null, image); + + CanvasPool.remove(canvas); + }; + + image.src = canvas.toDataURL(type, encoderOptions); + } +}; + +module.exports = WebGLSnapshot; + + +/***/ }), +/* 400 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BaseCamera = __webpack_require__(141); +var CameraEvents = __webpack_require__(45); +var Class = __webpack_require__(0); +var CONST = __webpack_require__(30); +var IsSizePowerOfTwo = __webpack_require__(137); +var SpliceOne = __webpack_require__(106); +var TextureEvents = __webpack_require__(136); +var TransformMatrix = __webpack_require__(46); +var Utils = __webpack_require__(10); +var WebGLSnapshot = __webpack_require__(399); + +// Default Pipelines +var BitmapMaskPipeline = __webpack_require__(398); +var ForwardDiffuseLightPipeline = __webpack_require__(397); +var TextureTintPipeline = __webpack_require__(199); + +/** + * @callback WebGLContextCallback + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. + */ + +/** + * @classdesc + * WebGLRenderer is a class that contains the needed functionality to keep the + * WebGLRenderingContext state clean. The main idea of the WebGLRenderer is to keep track of + * any context change that happens for WebGL rendering inside of Phaser. This means + * if raw webgl functions are called outside the WebGLRenderer of the Phaser WebGL + * rendering ecosystem they might pollute the current WebGLRenderingContext state producing + * unexpected behavior. It's recommended that WebGL interaction is done through + * WebGLRenderer and/or WebGLPipeline. + * + * @class WebGLRenderer + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Game instance which owns this WebGL Renderer. + */ +var WebGLRenderer = new Class({ + + initialize: + + function WebGLRenderer (game) + { + // eslint-disable-next-line consistent-this + var renderer = this; + + var gameConfig = game.config; + + var contextCreationConfig = { + alpha: gameConfig.transparent, + depth: false, + antialias: gameConfig.antialias, + premultipliedAlpha: gameConfig.premultipliedAlpha, + stencil: true, + failIfMajorPerformanceCaveat: gameConfig.failIfMajorPerformanceCaveat, + powerPreference: gameConfig.powerPreference + }; + + /** + * The local configuration settings of this WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#config + * @type {object} + * @since 3.0.0 + */ + this.config = { + clearBeforeRender: gameConfig.clearBeforeRender, + antialias: gameConfig.antialias, + backgroundColor: gameConfig.backgroundColor, + contextCreation: contextCreationConfig, + resolution: gameConfig.resolution, + roundPixels: gameConfig.roundPixels, + maxTextures: gameConfig.maxTextures, + maxTextureSize: gameConfig.maxTextureSize, + batchSize: gameConfig.batchSize, + maxLights: gameConfig.maxLights + }; + + /** + * The Game instance which owns this WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; + + /** + * A constant which allows the renderer to be easily identified as a WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#type + * @type {integer} + * @since 3.0.0 + */ + this.type = CONST.WEBGL; + + /** + * The width of the canvas being rendered to. + * This is populated in the onResize event handler. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#width + * @type {integer} + * @since 3.0.0 + */ + this.width = 0; + + /** + * The height of the canvas being rendered to. + * This is populated in the onResize event handler. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#height + * @type {integer} + * @since 3.0.0 + */ + this.height = 0; + + /** + * The canvas which this WebGL Renderer draws to. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = game.canvas; + + /** + * An array of functions to invoke if the WebGL context is lost. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks + * @type {WebGLContextCallback[]} + * @since 3.0.0 + */ + this.lostContextCallbacks = []; + + /** + * An array of functions to invoke if the WebGL context is restored. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks + * @type {WebGLContextCallback[]} + * @since 3.0.0 + */ + this.restoredContextCallbacks = []; + + /** + * An array of blend modes supported by the WebGL Renderer. + * + * This array includes the default blend modes as well as any custom blend modes added through {@link #addBlendMode}. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.blendModes = []; + + /** + * Keeps track of any WebGLTexture created with the current WebGLRenderingContext + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.nativeTextures = []; + + /** + * Set to `true` if the WebGL context of the renderer is lost. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.contextLost = false; + + /** + * This object will store all pipelines created through addPipeline + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines + * @type {object} + * @default null + * @since 3.0.0 + */ + this.pipelines = null; + + /** + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState + * @type {SnapshotState} + * @since 3.0.0 + */ + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92 + }; + + // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) + + /** + * Cached value for the last texture unit that was used + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTextureUnit + * @type {integer} + * @since 3.1.0 + */ + this.currentActiveTextureUnit = 0; + + /** + * An array of the last texture handles that were bound to the WebGLRenderingContext + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentTextures + * @type {array} + * @since 3.0.0 + */ + this.currentTextures = new Array(16); + + /** + * Current framebuffer in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer + * @type {WebGLFramebuffer} + * @default null + * @since 3.0.0 + */ + this.currentFramebuffer = null; + + /** + * Current WebGLPipeline in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @since 3.0.0 + */ + this.currentPipeline = null; + + /** + * Current WebGLProgram in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram + * @type {WebGLProgram} + * @default null + * @since 3.0.0 + */ + this.currentProgram = null; + + /** + * Current WebGLBuffer (Vertex buffer) in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentVertexBuffer + * @type {WebGLBuffer} + * @default null + * @since 3.0.0 + */ + this.currentVertexBuffer = null; + + /** + * Current WebGLBuffer (Index buffer) in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentIndexBuffer + * @type {WebGLBuffer} + * @default null + * @since 3.0.0 + */ + this.currentIndexBuffer = null; + + /** + * Current blend mode in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode + * @type {integer} + * @since 3.0.0 + */ + this.currentBlendMode = Infinity; + + /** + * Indicates if the the scissor state is enabled in WebGLRenderingContext + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.currentScissorEnabled = false; + + /** + * Stores the current scissor data + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor + * @type {Uint32Array} + * @since 3.0.0 + */ + // this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]); + this.currentScissor = null; + + /** + * Stack of scissor data + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack + * @type {Uint32Array} + * @since 3.0.0 + */ + this.scissorStack = []; + + // Setup context lost and restore event listeners + + 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); + + 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); + + // These are initialized post context creation + + /** + * The underlying WebGL context of the renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#gl + * @type {WebGLRenderingContext} + * @default null + * @since 3.0.0 + */ + this.gl = null; + + /** + * Array of strings that indicate which WebGL extensions are supported by the browser + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions + * @type {object} + * @default null + * @since 3.0.0 + */ + this.supportedExtensions = null; + + /** + * Extensions loaded into the current context + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.extensions = {}; + + /** + * Stores the current WebGL component formats for further use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats + * @type {array} + * @default [] + * @since 3.2.0 + */ + this.glFormats = []; + + /** + * Stores the supported WebGL texture compression formats. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#compression + * @type {array} + * @since 3.8.0 + */ + this.compression = { + ETC1: false, + PVRTC: false, + S3TC: false + }; + + /** + * Cached drawing buffer height to reduce gl calls. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#drawingBufferHeight + * @type {number} + * @readonly + * @since 3.11.0 + */ + this.drawingBufferHeight = 0; + + /** + * A blank 32x32 transparent texture, as used by the Graphics system where needed. + * This is set in the `boot` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#blankTexture + * @type {WebGLTexture} + * @readonly + * @since 3.12.0 + */ + this.blankTexture = null; + + /** + * A default Camera used in calls when no other camera has been provided. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultCamera + * @type {Phaser.Cameras.Scene2D.BaseCamera} + * @since 3.12.0 + */ + this.defaultCamera = new BaseCamera(0, 0, 0, 0); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix1 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix1 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix2 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix2 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix3 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix3 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix4 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix4 = new TransformMatrix(); + + this.init(this.config); + }, + + /** + * Creates a new WebGLRenderingContext and initializes all internal state. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#init + * @since 3.0.0 + * + * @param {object} config - The configuration object for the renderer. + * + * @return {this} This WebGLRenderer instance. + */ + init: function (config) + { + var gl; + var game = this.game; + var canvas = this.canvas; + var clearColor = config.backgroundColor; + + // Did they provide their own context? + if (game.config.context) + { + gl = game.config.context; + } + else + { + gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); + } + + if (!gl || gl.isContextLost()) + { + this.contextLost = true; + + throw new Error('WebGL unsupported'); + } + + this.gl = gl; + + // Set it back into the Game, so developers can access it from there too + game.context = gl; + + for (var i = 0; i <= 27; i++) + { + this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); + } + + // ADD + this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; + + // MULTIPLY + this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; + + // SCREEN + this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; + + // ERASE + this.blendModes[17] = { func: [ gl.ZERO, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_REVERSE_SUBTRACT }; + + 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 + var exts = gl.getSupportedExtensions(); + + if (!config.maxTextures) + { + config.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + } + + if (!config.maxTextureSize) + { + config.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); + } + + var extString = 'WEBGL_compressed_texture_'; + var wkExtString = 'WEBKIT_' + extString; + + this.compression.ETC1 = gl.getExtension(extString + 'etc1') || gl.getExtension(wkExtString + 'etc1'); + this.compression.PVRTC = gl.getExtension(extString + 'pvrtc') || gl.getExtension(wkExtString + 'pvrtc'); + this.compression.S3TC = gl.getExtension(extString + 's3tc') || gl.getExtension(wkExtString + 's3tc'); + + this.supportedExtensions = exts; + + // Setup initial WebGL state + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + + gl.enable(gl.BLEND); + + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); + + // Initialize all textures to null + for (var index = 0; index < this.currentTextures.length; ++index) + { + this.currentTextures[index] = null; + } + + // Clear previous pipelines and reload default ones + this.pipelines = {}; + + this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: game, renderer: this })); + this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: game, renderer: this })); + this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: game, renderer: this, maxLights: config.maxLights })); + + this.setBlendMode(CONST.BlendModes.NORMAL); + + game.textures.once(TextureEvents.READY, this.boot, this); + + return this; + }, + + /** + * Internal boot handler. Calls 'boot' on each pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#boot + * @private + * @since 3.11.0 + */ + boot: function () + { + for (var pipelineName in this.pipelines) + { + this.pipelines[pipelineName].boot(); + } + + var blank = this.game.textures.getFrame('__DEFAULT'); + + this.pipelines.TextureTintPipeline.currentFrame = blank; + + this.blankTexture = blank; + + var gl = this.gl; + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + gl.enable(gl.SCISSOR_TEST); + + this.setPipeline(this.pipelines.TextureTintPipeline); + + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height, this.game.scale.resolution); + }, + + /** + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize, displaySize, resolution) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height || resolution !== this.resolution) + { + this.resize(baseSize.width, baseSize.height, resolution); + } + }, + + /** + * Resizes the drawing buffer to match that required by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resize + * @since 3.0.0 + * + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. + * @param {number} [resolution] - The new resolution of the renderer. + * + * @return {this} This WebGLRenderer instance. + */ + resize: function (width, height, resolution) + { + var gl = this.gl; + var pipelines = this.pipelines; + + this.width = width; + this.height = height; + this.resolution = resolution; + + gl.viewport(0, 0, width, height); + + // Update all registered pipelines + for (var pipelineName in pipelines) + { + pipelines[pipelineName].resize(width, height, resolution); + } + + this.drawingBufferHeight = gl.drawingBufferHeight; + + gl.scissor(0, (gl.drawingBufferHeight - height), width, height); + + this.defaultCamera.setSize(width, height); + + return this; + }, + + /** + * Adds a callback to be invoked when the WebGL context has been restored by the browser. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored + * @since 3.0.0 + * + * @param {WebGLContextCallback} callback - The callback to be invoked on context restoration. + * @param {object} target - The context of the callback. + * + * @return {this} This WebGLRenderer instance. + */ + onContextRestored: function (callback, target) + { + this.restoredContextCallbacks.push([ callback, target ]); + + return this; + }, + + /** + * Adds a callback to be invoked when the WebGL context has been lost by the browser. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost + * @since 3.0.0 + * + * @param {WebGLContextCallback} callback - The callback to be invoked on context loss. + * @param {object} target - The context of the callback. + * + * @return {this} This WebGLRenderer instance. + */ + onContextLost: function (callback, target) + { + this.lostContextCallbacks.push([ callback, target ]); + + return this; + }, + + /** + * Checks if a WebGL extension is supported + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension + * @since 3.0.0 + * + * @param {string} extensionName - Name of the WebGL extension + * + * @return {boolean} `true` if the extension is supported, otherwise `false`. + */ + hasExtension: function (extensionName) + { + return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; + }, + + /** + * Loads a WebGL extension + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension + * @since 3.0.0 + * + * @param {string} extensionName - The name of the extension to load. + * + * @return {object} WebGL extension if the extension is supported + */ + getExtension: function (extensionName) + { + if (!this.hasExtension(extensionName)) { return null; } + + if (!(extensionName in this.extensions)) + { + this.extensions[extensionName] = this.gl.getExtension(extensionName); + } + + return this.extensions[extensionName]; + }, + + /** + * Flushes the current pipeline if the pipeline is bound + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#flush + * @since 3.0.0 + */ + flush: function () + { + if (this.currentPipeline) + { + this.currentPipeline.flush(); + } + }, + + /** + * Checks if a pipeline is present in the current WebGLRenderer + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasPipeline + * @since 3.0.0 + * + * @param {string} pipelineName - The name of the pipeline. + * + * @return {boolean} `true` if the given pipeline is loaded, otherwise `false`. + */ + hasPipeline: function (pipelineName) + { + return (pipelineName in this.pipelines); + }, + + /** + * Returns the pipeline by name if the pipeline exists + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getPipeline + * @since 3.0.0 + * + * @param {string} pipelineName - The name of the pipeline. + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance, or `null` if not found. + */ + getPipeline: function (pipelineName) + { + return (this.hasPipeline(pipelineName)) ? this.pipelines[pipelineName] : null; + }, + + /** + * Removes a pipeline by name. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#removePipeline + * @since 3.0.0 + * + * @param {string} pipelineName - The name of the pipeline to be removed. + * + * @return {this} This WebGLRenderer instance. + */ + removePipeline: function (pipelineName) + { + delete this.pipelines[pipelineName]; + + return this; + }, + + /** + * Adds a pipeline instance into the collection of pipelines + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#addPipeline + * @since 3.0.0 + * + * @param {string} pipelineName - A unique string-based key for the pipeline. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - A pipeline instance which must extend WebGLPipeline. + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance that was passed. + */ + addPipeline: function (pipelineName, pipelineInstance) + { + if (!this.hasPipeline(pipelineName)) + { + this.pipelines[pipelineName] = pipelineInstance; + } + else + { + console.warn('Pipeline exists: ' + pipelineName); + } + + pipelineInstance.name = pipelineName; + + this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution); + + return pipelineInstance; + }, + + /** + * Pushes a new scissor state. This is used to set nested scissor states. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor + * @since 3.0.0 + * + * @param {integer} x - The x position of the scissor. + * @param {integer} y - The y position of the scissor. + * @param {integer} width - The width of the scissor. + * @param {integer} height - The height of the scissor. + * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * + * @return {integer[]} An array containing the scissor values. + */ + pushScissor: function (x, y, width, height, drawingBufferHeight) + { + if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } + + var scissorStack = this.scissorStack; + + var scissor = [ x, y, width, height ]; + + scissorStack.push(scissor); + + this.setScissor(x, y, width, height, drawingBufferHeight); + + this.currentScissor = scissor; + + return scissor; + }, + + /** + * Sets the current scissor state. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor + * @since 3.0.0 + * + * @param {integer} x - The x position of the scissor. + * @param {integer} y - The y position of the scissor. + * @param {integer} width - The width of the scissor. + * @param {integer} height - The height of the scissor. + * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. + */ + setScissor: function (x, y, width, height, drawingBufferHeight) + { + var gl = this.gl; + + var current = this.currentScissor; + + var setScissor = (width > 0 && height > 0); + + if (current && setScissor) + { + var cx = current[0]; + var cy = current[1]; + var cw = current[2]; + var ch = current[3]; + + setScissor = (cx !== x || cy !== y || cw !== width || ch !== height); + } + + if (setScissor) + { + this.flush(); + + // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor + gl.scissor(x, (drawingBufferHeight - y - height), width, height); + } + }, + + /** + * Pops the last scissor state and sets it. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor + * @since 3.0.0 + */ + popScissor: function () + { + var scissorStack = this.scissorStack; + + // Remove the current scissor + scissorStack.pop(); + + // Reset the previous scissor + var scissor = scissorStack[scissorStack.length - 1]; + + if (scissor) + { + this.setScissor(scissor[0], scissor[1], scissor[2], scissor[3]); + } + + this.currentScissor = scissor; + }, + + /** + * Binds a WebGLPipeline and sets it as the current pipeline to be used. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setPipeline + * @since 3.0.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - The pipeline instance to be activated. + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was activated. + */ + setPipeline: function (pipelineInstance, gameObject) + { + 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(gameObject); + + return this.currentPipeline; + }, + + /** + * Use this to reset the gl context to the state that Phaser requires to continue rendering. + * Calling this will: + * + * * Disable `DEPTH_TEST`, `CULL_FACE` and `STENCIL_TEST`. + * * Clear the depth buffer and stencil buffers. + * * Reset the viewport size. + * * Reset the blend mode. + * * Bind a blank texture as the active texture on texture unit zero. + * * Rebinds the given pipeline instance. + * + * You should call this having previously called `clearPipeline` and then wishing to return + * control to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#rebindPipeline + * @since 3.16.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - The pipeline instance to be activated. + */ + rebindPipeline: function (pipelineInstance) + { + var gl = this.gl; + + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.disable(gl.STENCIL_TEST); + + gl.clear(gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); + + gl.viewport(0, 0, this.width, this.height); + + this.setBlendMode(0, true); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, this.blankTexture.glTexture); + + this.currentActiveTextureUnit = 0; + this.currentTextures[0] = this.blankTexture.glTexture; + + this.currentPipeline = pipelineInstance; + this.currentPipeline.bind(); + this.currentPipeline.onBind(); + }, + + /** + * Flushes the current WebGLPipeline being used and then clears it, along with the + * the current shader program and vertex buffer. Then resets the blend mode to NORMAL. + * Call this before jumping to your own gl context handler, and then call `rebindPipeline` when + * you wish to return control to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#clearPipeline + * @since 3.16.0 + */ + clearPipeline: function () + { + this.flush(); + + this.currentPipeline = null; + this.currentProgram = null; + this.currentVertexBuffer = null; + this.currentIndexBuffer = null; + + this.setBlendMode(0, true); + }, + + /** + * Sets the blend mode to the value given. + * + * If the current blend mode is different from the one given, the pipeline is flushed and the new + * blend mode is enabled. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode + * @since 3.0.0 + * + * @param {integer} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. + * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. + * + * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. + */ + setBlendMode: function (blendModeId, force) + { + if (force === undefined) { force = false; } + + var gl = this.gl; + var blendMode = this.blendModes[blendModeId]; + + if (force || (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId)) + { + this.flush(); + + 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]); + } + + this.currentBlendMode = blendModeId; + + return true; + } + + return false; + }, + + /** + * Creates a new custom blend mode for the renderer. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#addBlendMode + * @since 3.0.0 + * + * @param {function} func - An array containing the WebGL functions to use for the source and the destination blending factors, respectively. See the possible constants for {@link WebGLRenderingContext#blendFunc()}. + * @param {function} equation - The equation to use for combining the RGB and alpha components of a new pixel with a rendered one. See the possible constants for {@link WebGLRenderingContext#blendEquation()}. + * + * @return {integer} The index of the new blend mode, used for referencing it in the future. + */ + addBlendMode: function (func, equation) + { + var index = this.blendModes.push({ func: func, equation: equation }); + + return index - 1; + }, + + /** + * Updates the function bound to a given custom blend mode. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#updateBlendMode + * @since 3.0.0 + * + * @param {integer} index - The index of the custom blend mode. + * @param {function} func - The function to use for the blend mode. + * @param {function} equation - The equation to use for the blend mode. + * + * @return {this} This WebGLRenderer instance. + */ + updateBlendMode: function (index, func, equation) + { + if (this.blendModes[index]) + { + this.blendModes[index].func = func; + + if (equation) + { + this.blendModes[index].equation = equation; + } + } + + return this; + }, + + /** + * Removes a custom blend mode from the renderer. + * Any Game Objects still using this blend mode will error, so be sure to clear them first. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#removeBlendMode + * @since 3.0.0 + * + * @param {integer} index - The index of the custom blend mode to be removed. + * + * @return {this} This WebGLRenderer instance. + */ + removeBlendMode: function (index) + { + if (index > 17 && this.blendModes[index]) + { + this.blendModes.splice(index, 1); + } + + return this; + }, + + /** + * Sets the current active texture for texture unit zero to be a blank texture. + * This only happens if there isn't a texture already in use by texture unit zero. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlankTexture + * @private + * @since 3.12.0 + * + * @param {boolean} [force=false] - Force a blank texture set, regardless of what's already bound? + */ + setBlankTexture: function (force) + { + if (force === undefined) { force = false; } + + if (force || this.currentActiveTextureUnit !== 0 || !this.currentTextures[0]) + { + this.setTexture2D(this.blankTexture.glTexture, 0); + } + }, + + /** + * Binds a texture at a texture unit. If a texture is already + * bound to that unit it will force a flush on the current pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D + * @since 3.0.0 + * + * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. + * @param {integer} textureUnit - The texture unit to which the texture will be bound. + * @param {boolean} [flush=true] - Will the current pipeline be flushed if this is a new texture, or not? + * + * @return {this} This WebGLRenderer instance. + */ + setTexture2D: function (texture, textureUnit, flush) + { + if (flush === undefined) { flush = true; } + + var gl = this.gl; + + if (texture !== this.currentTextures[textureUnit]) + { + if (flush) + { + this.flush(); + } + + if (this.currentActiveTextureUnit !== textureUnit) + { + gl.activeTexture(gl.TEXTURE0 + textureUnit); + + this.currentActiveTextureUnit = textureUnit; + } + + gl.bindTexture(gl.TEXTURE_2D, texture); + + this.currentTextures[textureUnit] = texture; + } + + return this; + }, + + /** + * Binds a framebuffer. If there was another framebuffer already bound it will force a pipeline flush. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer + * @since 3.0.0 + * + * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * + * @return {this} This WebGLRenderer instance. + */ + setFramebuffer: function (framebuffer, updateScissor) + { + if (updateScissor === undefined) { updateScissor = false; } + + var gl = this.gl; + + var width = this.width; + var height = this.height; + + if (framebuffer !== this.currentFramebuffer) + { + if (framebuffer && framebuffer.renderTexture) + { + width = framebuffer.renderTexture.width; + height = framebuffer.renderTexture.height; + } + else + { + this.flush(); + } + + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + + gl.viewport(0, 0, width, height); + + if (updateScissor) + { + if (framebuffer) + { + this.drawingBufferHeight = height; + + this.pushScissor(0, 0, width, height); + } + else + { + this.drawingBufferHeight = this.height; + + this.popScissor(); + } + } + + this.currentFramebuffer = framebuffer; + } + + return this; + }, + + /** + * Binds a program. If there was another program already bound it will force a pipeline flush. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram + * @since 3.0.0 + * + * @param {WebGLProgram} program - The program that needs to be bound. + * + * @return {this} This WebGLRenderer instance. + */ + setProgram: function (program) + { + var gl = this.gl; + + if (program !== this.currentProgram) + { + this.flush(); + + gl.useProgram(program); + + this.currentProgram = program; + } + + return this; + }, + + /** + * Bounds a vertex buffer. If there is a vertex buffer already bound it'll force a pipeline flush. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer + * @since 3.0.0 + * + * @param {WebGLBuffer} vertexBuffer - The buffer that needs to be bound. + * + * @return {this} This WebGLRenderer instance. + */ + setVertexBuffer: function (vertexBuffer) + { + var gl = this.gl; + + if (vertexBuffer !== this.currentVertexBuffer) + { + this.flush(); + + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + + this.currentVertexBuffer = vertexBuffer; + } + + return this; + }, + + /** + * Bounds a index buffer. If there is a index buffer already bound it'll force a pipeline flush. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer + * @since 3.0.0 + * + * @param {WebGLBuffer} indexBuffer - The buffer the needs to be bound. + * + * @return {this} This WebGLRenderer instance. + */ + setIndexBuffer: function (indexBuffer) + { + var gl = this.gl; + + if (indexBuffer !== this.currentIndexBuffer) + { + this.flush(); + + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); + + this.currentIndexBuffer = indexBuffer; + } + + return this; + }, + + /** + * Creates a texture from an image source. If the source is not valid it creates an empty texture. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource + * @since 3.0.0 + * + * @param {object} source - The source of the texture. + * @param {integer} width - The width of the texture. + * @param {integer} height - The height of the texture. + * @param {integer} scaleMode - The scale mode to be used by the texture. + * + * @return {?WebGLTexture} The WebGL Texture that was created, or `null` if it couldn't be created. + */ + createTextureFromSource: function (source, width, height, scaleMode) + { + 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)) + { + wrap = gl.REPEAT; + } + + if (scaleMode === CONST.ScaleModes.LINEAR && this.config.antialias) + { + filter = gl.LINEAR; + } + + 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; + }, + + /** + * A wrapper for creating a WebGLTexture. If no pixel data is passed it will create an empty texture. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D + * @since 3.0.0 + * + * @param {integer} mipLevel - Mip level of the texture. + * @param {integer} minFilter - Filtering of the texture. + * @param {integer} magFilter - Filtering of the texture. + * @param {integer} wrapT - Wrapping mode of the texture. + * @param {integer} wrapS - Wrapping mode of the texture. + * @param {integer} format - Which format does the texture use. + * @param {object} pixels - pixel data. + * @param {integer} width - Width of the texture in pixels. + * @param {integer} height - Height of the texture in pixels. + * @param {boolean} pma - Does the texture have premultiplied alpha? + * + * @return {WebGLTexture} The WebGLTexture that was created. + */ + createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma) + { + pma = (pma === undefined || pma === null) ? true : pma; + + var gl = this.gl; + var texture = gl.createTexture(); + + 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; + }, + + /** + * Wrapper for creating WebGLFramebuffer. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer + * @since 3.0.0 + * + * @param {integer} width - Width in pixels of the framebuffer + * @param {integer} height - Height in pixels of the framebuffer + * @param {WebGLTexture} renderTexture - The color texture to where the color pixels are written + * @param {boolean} addDepthStencilBuffer - Indicates if the current framebuffer support depth and stencil buffers + * + * @return {WebGLFramebuffer} Raw WebGLFramebuffer + */ + createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) + { + var gl = this.gl; + var framebuffer = gl.createFramebuffer(); + var complete = 0; + + this.setFramebuffer(framebuffer); + + 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; + + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); + + 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]); + } + + framebuffer.renderTexture = renderTexture; + + this.setFramebuffer(null); + + return framebuffer; + }, + + /** + * Wrapper for creating a WebGLProgram + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram + * @since 3.0.0 + * + * @param {string} vertexShader - Source to the vertex shader + * @param {string} fragmentShader - Source to the fragment shader + * + * @return {WebGLProgram} Raw WebGLProgram + */ + 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); + + gl.shaderSource(vs, vertexShader); + gl.shaderSource(fs, fragmentShader); + gl.compileShader(vs); + gl.compileShader(fs); + + 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); + + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) + { + throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); + } + + return program; + }, + + /** + * Wrapper for creating a vertex buffer. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer + * @since 3.0.0 + * + * @param {ArrayBuffer} initialDataOrSize - It's either ArrayBuffer or an integer indicating the size of the vbo + * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW + * + * @return {WebGLBuffer} Raw vertex buffer + */ + createVertexBuffer: function (initialDataOrSize, bufferUsage) + { + var gl = this.gl; + var vertexBuffer = gl.createBuffer(); + + this.setVertexBuffer(vertexBuffer); + + gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); + + this.setVertexBuffer(null); + + return vertexBuffer; + }, + + /** + * Wrapper for creating a vertex buffer. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer + * @since 3.0.0 + * + * @param {ArrayBuffer} initialDataOrSize - Either ArrayBuffer or an integer indicating the size of the vbo. + * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. + * + * @return {WebGLBuffer} Raw index buffer + */ + 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; + }, + + /** + * Removes the given texture from the nativeTextures array and then deletes it from the GPU. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture + * @since 3.0.0 + * + * @param {WebGLTexture} texture - The WebGL Texture to be deleted. + * + * @return {this} This WebGLRenderer instance. + */ + deleteTexture: function (texture) + { + var index = this.nativeTextures.indexOf(texture); + + if (index !== -1) + { + SpliceOne(this.nativeTextures, index); + } + + this.gl.deleteTexture(texture); + + if (this.currentTextures[0] === texture && !this.game.pendingDestroy) + { + // texture we just deleted is in use, so bind a blank texture + this.setBlankTexture(true); + } + + return this; + }, + + /** + * Deletes a WebGLFramebuffer from the GL instance. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer + * @since 3.0.0 + * + * @param {WebGLFramebuffer} framebuffer - The Framebuffer to be deleted. + * + * @return {this} This WebGLRenderer instance. + */ + deleteFramebuffer: function (framebuffer) + { + this.gl.deleteFramebuffer(framebuffer); + + return this; + }, + + /** + * Deletes a WebGLProgram from the GL instance. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram + * @since 3.0.0 + * + * @param {WebGLProgram} program - The shader program to be deleted. + * + * @return {this} This WebGLRenderer instance. + */ + deleteProgram: function (program) + { + this.gl.deleteProgram(program); + + return this; + }, + + /** + * Deletes a WebGLBuffer from the GL instance. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer + * @since 3.0.0 + * + * @param {WebGLBuffer} vertexBuffer - The WebGLBuffer to be deleted. + * + * @return {this} This WebGLRenderer instance. + */ + deleteBuffer: function (buffer) + { + this.gl.deleteBuffer(buffer); + + return this; + }, + + /** + * Controls the pre-render operations for the given camera. + * Handles any clipping needed by the camera and renders the background color if a color is visible. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to pre-render. + */ + preRenderCamera: function (camera) + { + var cx = camera._cx; + var cy = camera._cy; + var cw = camera._cw; + var ch = camera._ch; + + var TextureTintPipeline = this.pipelines.TextureTintPipeline; + + var color = camera.backgroundColor; + + if (camera.renderToTexture) + { + this.flush(); + + this.pushScissor(cx, cy, cw, -ch); + + this.setFramebuffer(camera.framebuffer); + + var gl = this.gl; + + gl.clearColor(0, 0, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT); + + TextureTintPipeline.projOrtho(cx, cw + cx, cy, ch + cy, -1000, 1000); + + if (color.alphaGL > 0) + { + TextureTintPipeline.drawFillRect( + cx, cy, cw + cx, ch + cy, + Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), + color.alphaGL + ); + } + + camera.emit(CameraEvents.PRE_RENDER, camera); + } + else + { + this.pushScissor(cx, cy, cw, ch); + + if (color.alphaGL > 0) + { + TextureTintPipeline.drawFillRect( + cx, cy, cw , ch, + Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), + color.alphaGL + ); + } + } + }, + + /** + * Controls the post-render operations for the given camera. + * Renders the foreground camera effects like flash and fading. It resets the current scissor state. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to post-render. + */ + postRenderCamera: function (camera) + { + var TextureTintPipeline = this.pipelines.TextureTintPipeline; + + camera.flashEffect.postRenderWebGL(TextureTintPipeline, Utils.getTintFromFloats); + camera.fadeEffect.postRenderWebGL(TextureTintPipeline, Utils.getTintFromFloats); + + camera.dirty = false; + + this.popScissor(); + + if (camera.renderToTexture) + { + TextureTintPipeline.flush(); + + this.setFramebuffer(null); + + camera.emit(CameraEvents.POST_RENDER, camera); + + TextureTintPipeline.projOrtho(0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0); + + var getTint = Utils.getTintAppendFloatAlpha; + + var pipeline = (camera.pipeline) ? camera.pipeline : TextureTintPipeline; + + pipeline.batchTexture( + camera, + camera.glTexture, + camera.width, camera.height, + camera.x, camera.y, + camera.width, camera.height, + camera.zoom, camera.zoom, + camera.rotation, + camera.flipX, !camera.flipY, + 1, 1, + 0, 0, + 0, 0, camera.width, camera.height, + getTint(camera._tintTL, camera._alphaTL), + getTint(camera._tintTR, camera._alphaTR), + getTint(camera._tintBL, camera._alphaBL), + getTint(camera._tintBR, camera._alphaBR), + (camera._isTinted && camera.tintFill), + 0, 0, + this.defaultCamera, + null + ); + + // Force clear the current texture so that items next in the batch (like Graphics) don't try and use it + this.setBlankTexture(true); + } + }, + + /** + * Clears the current vertex buffer and updates pipelines. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender + * @since 3.0.0 + */ + preRender: function () + { + if (this.contextLost) { return; } + + var gl = this.gl; + var pipelines = this.pipelines; + + // Make sure we are bound to the main frame buffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + if (this.config.clearBeforeRender) + { + var clearColor = this.config.backgroundColor; + + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); + } + + gl.enable(gl.SCISSOR_TEST); + + for (var key in pipelines) + { + pipelines[key].onPreRender(); + } + + // TODO - Find a way to stop needing to create these arrays every frame + // and equally not need a huge array buffer created to hold them + + this.currentScissor = [ 0, 0, this.width, this.height ]; + this.scissorStack = [ this.currentScissor ]; + + if (this.game.scene.customViewports) + { + gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); + } + + this.setPipeline(this.pipelines.TextureTintPipeline); + }, + + /** + * The core render step for a Scene Camera. + * + * Iterates through the given Game Object's array and renders them with the given Camera. + * + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. + * + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#render + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to render. + * @param {Phaser.GameObjects.GameObject} children - The Game Object's within the Scene to be rendered. + * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently un-used. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. + */ + 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) + { + pipelines[key].onRender(scene, camera); + } + + // Apply scissor for cam region + render background color, if not transparent + this.preRenderCamera(camera); + + for (var i = 0; i < childCount; i++) + { + var child = list[i]; + + if (!child.willRender(camera)) + { + continue; + } + + if (child.blendMode !== this.currentBlendMode) + { + this.setBlendMode(child.blendMode); + } + + var mask = child.mask; + + if (mask) + { + mask.preRenderWebGL(this, child, camera); + + child.renderWebGL(this, child, interpolationPercentage, camera); + + mask.postRenderWebGL(this, child); + } + else + { + child.renderWebGL(this, child, interpolationPercentage, camera); + } + } + + this.setBlendMode(CONST.BlendModes.NORMAL); + + // Applies camera effects and pops the scissor, if set + this.postRenderCamera(camera); + }, + + /** + * The post-render step happens after all Cameras in all Scenes have been rendered. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender + * @since 3.0.0 + */ + postRender: function () + { + if (this.contextLost) { return; } + + this.flush(); + + // Unbind custom framebuffer here + + var state = this.snapshotState; + + if (state.callback) + { + WebGLSnapshot(this.canvas, state); + + state.callback = null; + } + + var pipelines = this.pipelines; + + for (var key in pipelines) + { + pipelines[key].onPostRender(); + } + }, + + /** + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot + * @since 3.0.0 + * + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshot: function (callback, type, encoderOptions) + { + return this.snapshotArea(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gl.drawingBufferWidth); + state.height = Math.min(height, this.gl.drawingBufferHeight); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; + + return this; + }, + + /** + * Creates a WebGL Texture based on the given canvas element. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture + * @since 3.0.0 + * + * @param {HTMLCanvasElement} srcCanvas - The Canvas element that will be used to populate the texture. + * @param {WebGLTexture} [dstTexture] - Is this going to replace an existing texture? If so, pass it here. + * @param {boolean} [noRepeat=false] - Should this canvas never be allowed to set REPEAT? (such as for Text objects) + * + * @return {WebGLTexture} The newly created WebGL Texture. + */ + canvasToTexture: function (srcCanvas, dstTexture, noRepeat) + { + if (noRepeat === undefined) { noRepeat = false; } + + var gl = this.gl; + + if (!dstTexture) + { + var wrapping = gl.CLAMP_TO_EDGE; + + if (!noRepeat && IsSizePowerOfTwo(srcCanvas.width, srcCanvas.height)) + { + wrapping = gl.REPEAT; + } + + var filter = (this.config.antialias) ? gl.LINEAR : gl.NEAREST; + + dstTexture = this.createTexture2D(0, filter, filter, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); + } + else + { + this.setTexture2D(dstTexture, 0); + + 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 minification and magnification filter for a texture. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter + * @since 3.0.0 + * + * @param {integer} texture - The texture to set the filter for. + * @param {integer} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. + * + * @return {this} This WebGL Renderer instance. + */ + setTextureFilter: function (texture, filter) + { + var gl = this.gl; + var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; + + 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; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {number} x - [description] + * + * @return {this} This WebGL Renderer instance. + */ + setFloat1: function (program, name, x) + { + this.setProgram(program); + + this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {this} This WebGL Renderer instance. + */ + 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 - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} z - [description] + * + * @return {this} This WebGL Renderer instance. + */ + setFloat3: function (program, name, x, y, z) + { + this.setProgram(program); + + this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); + + return this; + }, + + /** + * Sets uniform of a WebGLProgram + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {number} x - X component + * @param {number} y - Y component + * @param {number} z - Z component + * @param {number} w - W component + * + * @return {this} This WebGL Renderer instance. + */ + 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 value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1v + * @since 3.13.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGL Renderer instance. + */ + setFloat1v: function (program, name, arr) + { + this.setProgram(program); + + this.gl.uniform1fv(this.gl.getUniformLocation(program, name), arr); + + return this; + }, + + /** + * Sets the value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2v + * @since 3.13.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGL Renderer instance. + */ + setFloat2v: function (program, name, arr) + { + this.setProgram(program); + + this.gl.uniform2fv(this.gl.getUniformLocation(program, name), arr); + + return this; + }, + + /** + * Sets the value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3v + * @since 3.13.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGL Renderer instance. + */ + setFloat3v: function (program, name, arr) + { + this.setProgram(program); + + this.gl.uniform3fv(this.gl.getUniformLocation(program, name), arr); + + return this; + }, + + /** + * Sets the value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4v + * @since 3.13.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGL Renderer instance. + */ + + setFloat4v: function (program, name, arr) + { + this.setProgram(program); + + this.gl.uniform4fv(this.gl.getUniformLocation(program, name), arr); + + return this; + }, + + /** + * Sets the value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {integer} x - [description] + * + * @return {this} This WebGL Renderer instance. + */ + setInt1: function (program, name, x) + { + this.setProgram(program); + + this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); + + return this; + }, + + /** + * Sets the value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {integer} x - The new X component + * @param {integer} y - The new Y component + * + * @return {this} This WebGL Renderer instance. + */ + setInt2: function (program, name, x, y) + { + this.setProgram(program); + + this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); + + return this; + }, + + /** + * Sets the value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {integer} x - The new X component + * @param {integer} y - The new Y component + * @param {integer} z - The new Z component + * + * @return {this} This WebGL Renderer instance. + */ + 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 value of a uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {integer} x - X component + * @param {integer} y - Y component + * @param {integer} z - Z component + * @param {integer} w - W component + * + * @return {this} This WebGL Renderer instance. + */ + setInt4: function (program, name, x, y, z, w) + { + this.setProgram(program); + + this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); + + return this; + }, + + /** + * Sets the value of a 2x2 matrix uniform variable in the given WebGLProgram. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. + * @param {Float32Array} matrix - The new matrix value. + * + * @return {this} This WebGL Renderer instance. + */ + setMatrix2: function (program, name, transpose, matrix) + { + this.setProgram(program); + + this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {this} This WebGL Renderer instance. + */ + setMatrix3: function (program, name, transpose, matrix) + { + this.setProgram(program); + + this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); + + return this; + }, + + /** + * Sets uniform of a WebGLProgram + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 + * @since 3.0.0 + * + * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. + * @param {string} name - The name of the uniform to look-up and modify. + * @param {boolean} transpose - Is the matrix transposed + * @param {Float32Array} matrix - Matrix data + * + * @return {this} This WebGL Renderer instance. + */ + setMatrix4: function (program, name, transpose, matrix) + { + this.setProgram(program); + + this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); + + return this; + }, + + /** + * Returns the maximum number of texture units that can be used in a fragment shader. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextures + * @since 3.8.0 + * + * @return {integer} The maximum number of textures WebGL supports. + */ + getMaxTextures: function () + { + return this.config.maxTextures; + }, + + /** + * Returns the largest texture size (either width or height) that can be created. + * Note that VRAM may not allow a texture of any given size, it just expresses + * hardware / driver support for a given size. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextureSize + * @since 3.8.0 + * + * @return {integer} The maximum supported texture size. + */ + getMaxTextureSize: function () + { + return this.config.maxTextureSize; + }, + + /** + * Destroy this WebGLRenderer, cleaning up all related resources such as pipelines, native textures, etc. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy + * @since 3.0.0 + */ + destroy: function () + { + // 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]; + } + + delete this.gl; + delete this.game; + + this.contextLost = true; + this.extensions = {}; + this.nativeTextures.length = 0; + } + +}); + +module.exports = WebGLRenderer; + + +/***/ }), +/* 401 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var modes = __webpack_require__(66); +var CanvasFeatures = __webpack_require__(426); + +/** + * Returns an array which maps the default blend modes to supported Canvas blend modes. + * + * If the browser doesn't support a blend mode, it will default to the normal `source-over` blend mode. + * + * @function Phaser.Renderer.Canvas.GetBlendModes + * @since 3.0.0 + * + * @return {array} Which Canvas blend mode corresponds to which default Phaser blend mode. + */ +var GetBlendModes = function () +{ + var output = []; + var useNew = CanvasFeatures.supportNewBlendModes; + var so = 'source-over'; + + output[modes.NORMAL] = so; + output[modes.ADD] = 'lighter'; + output[modes.MULTIPLY] = (useNew) ? 'multiply' : so; + output[modes.SCREEN] = (useNew) ? 'screen' : so; + output[modes.OVERLAY] = (useNew) ? 'overlay' : so; + output[modes.DARKEN] = (useNew) ? 'darken' : so; + output[modes.LIGHTEN] = (useNew) ? 'lighten' : so; + output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : so; + output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : so; + output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : so; + output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : so; + output[modes.DIFFERENCE] = (useNew) ? 'difference' : so; + output[modes.EXCLUSION] = (useNew) ? 'exclusion' : so; + output[modes.HUE] = (useNew) ? 'hue' : so; + output[modes.SATURATION] = (useNew) ? 'saturation' : so; + output[modes.COLOR] = (useNew) ? 'color' : so; + output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : so; + output[modes.ERASE] = 'destination-out'; + output[modes.SOURCE_IN] = 'source-in'; + output[modes.SOURCE_OUT] = 'source-out'; + output[modes.SOURCE_ATOP] = 'source-atop'; + output[modes.DESTINATION_OVER] = 'destination-over'; + output[modes.DESTINATION_IN] = 'destination-in'; + output[modes.DESTINATION_OUT] = 'destination-out'; + output[modes.DESTINATION_ATOP] = 'destination-atop'; + output[modes.LIGHTER] = 'lighter'; + output[modes.COPY] = 'copy'; + output[modes.XOR] = 'xor'; + + return output; +}; + +module.exports = GetBlendModes; + + +/***/ }), +/* 402 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(26); +var Color = __webpack_require__(37); +var GetFastValue = __webpack_require__(1); + +/** + * Takes a snapshot of an area from the current frame displayed by a canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. + * + * @function Phaser.Renderer.Snapshot.Canvas + * @since 3.0.0 + * + * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {SnapshotState} config - The snapshot configuration object. + */ +var CanvasSnapshot = function (canvas, config) +{ + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); + var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); + var width = GetFastValue(config, 'width', canvas.width); + var height = GetFastValue(config, 'height', canvas.height); + var getPixel = GetFastValue(config, 'getPixel', false); + + if (getPixel) + { + var context = canvas.getContext('2d'); + var imageData = context.getImageData(x, y, 1, 1); + var data = imageData.data; + + callback.call(null, new Color(data[0], data[1], data[2], data[3] / 255)); + } + else if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) + { + // Area Grab + var copyCanvas = CanvasPool.createWebGL(this, width, height); + var ctx = copyCanvas.getContext('2d'); + + ctx.drawImage(canvas, x, y, width, height, 0, 0, width, height); + + var image1 = new Image(); + + image1.onerror = function () + { + callback.call(null); + + CanvasPool.remove(copyCanvas); + }; + + image1.onload = function () + { + callback.call(null, image1); + + CanvasPool.remove(copyCanvas); + }; + + image1.src = copyCanvas.toDataURL(type, encoderOptions); + } + else + { + // Full Grab + var image2 = new Image(); + + image2.onerror = function () + { + callback.call(null); + }; + + image2.onload = function () + { + callback.call(null, image2); + }; + + image2.src = canvas.toDataURL(type, encoderOptions); + } +}; + +module.exports = CanvasSnapshot; + + +/***/ }), +/* 403 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasSnapshot = __webpack_require__(402); +var CameraEvents = __webpack_require__(45); +var Class = __webpack_require__(0); +var CONST = __webpack_require__(30); +var GetBlendModes = __webpack_require__(401); +var ScaleModes = __webpack_require__(111); +var Smoothing = __webpack_require__(140); +var TransformMatrix = __webpack_require__(46); + +/** + * @classdesc + * The Canvas Renderer is responsible for managing 2D canvas rendering contexts, including the one used by the Game's canvas. It tracks the internal state of a given context and can renderer textured Game Objects to it, taking into account alpha, blending, and scaling. + * + * @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({ + + 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; + + /** + * A constant which allows the renderer to be easily identified as a Canvas Renderer. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#type + * @type {integer} + * @since 3.0.0 + */ + this.type = CONST.CANVAS; + + /** + * The total number of Game Objects which were rendered in a frame. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.drawCount = 0; + + /** + * The width of the canvas being rendered to. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#width + * @type {integer} + * @since 3.0.0 + */ + this.width = 0; + + /** + * The height of the canvas being rendered to. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#height + * @type {integer} + * @since 3.0.0 + */ + this.height = 0; + + /** + * The local configuration settings of the CanvasRenderer. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#config + * @type {object} + * @since 3.0.0 + */ + this.config = { + clearBeforeRender: game.config.clearBeforeRender, + backgroundColor: game.config.backgroundColor, + resolution: game.config.resolution, + antialias: game.config.antialias, + roundPixels: game.config.roundPixels + }; + + /** + * The scale mode which should be used by the CanvasRenderer. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode + * @type {integer} + * @since 3.0.0 + */ + this.scaleMode = (game.config.antialias) ? ScaleModes.LINEAR : ScaleModes.NEAREST; + + /** + * The canvas element which the Game uses. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.gameCanvas = game.canvas; + + /** + * The canvas context used to render all Cameras in all Scenes during the game loop. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.gameContext = (this.game.config.context) ? this.game.config.context : this.gameCanvas.getContext('2d'); + + /** + * The canvas context currently used by the CanvasRenderer for all rendering operations. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.currentContext = this.gameContext; + + /** + * The blend modes supported by the Canvas Renderer. + * + * This object maps the {@link Phaser.BlendModes} to canvas compositing operations. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes + * @type {array} + * @since 3.0.0 + */ + this.blendModes = GetBlendModes(); + + // image-rendering: optimizeSpeed; + // image-rendering: pixelated; + + /** + * The scale mode currently in use by the Canvas Renderer. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentScaleMode + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentScaleMode = 0; + + /** + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState + * @type {SnapshotState} + * @since 3.16.0 + */ + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92 + }; + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix1 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix1 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix2 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix2 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix3 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix3 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix4 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.12.0 + */ + this._tempMatrix4 = new TransformMatrix(); + + this.init(); + }, + + /** + * Prepares the game canvas for rendering. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#init + * @since 3.0.0 + */ + init: function () + { + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height); + }, + + /** + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height) + { + this.resize(baseSize.width, baseSize.height); + } + }, + + /** + * Resize the main game canvas. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#resize + * @since 3.0.0 + * + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. + */ + resize: function (width, height) + { + this.width = width; + this.height = height; + + // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) + if (this.scaleMode === ScaleModes.NEAREST) + { + Smoothing.disable(this.gameContext); + } + }, + + /** + * A NOOP method for handling lost context. Intentionally empty. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost + * @since 3.0.0 + * + * @param {function} callback - Ignored parameter. + */ + onContextLost: function () + { + }, + + /** + * A NOOP method for handling restored context. Intentionally empty. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored + * @since 3.0.0 + * + * @param {function} callback - Ignored parameter. + */ + onContextRestored: function () + { + }, + + /** + * Resets the transformation matrix of the current context to the identity matrix, thus resetting any transformation. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform + * @since 3.0.0 + */ + resetTransform: function () + { + this.currentContext.setTransform(1, 0, 0, 1, 0, 0); + }, + + /** + * Sets the blend mode (compositing operation) of the current context. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode + * @since 3.0.0 + * + * @param {string} blendMode - The new blend mode which should be used. + * + * @return {this} This CanvasRenderer object. + */ + setBlendMode: function (blendMode) + { + this.currentContext.globalCompositeOperation = blendMode; + + return this; + }, + + /** + * Changes the Canvas Rendering Context that all draw operations are performed against. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#setContext + * @since 3.12.0 + * + * @param {?CanvasRenderingContext2D} [ctx] - The new Canvas Rendering Context to draw everything to. Leave empty to reset to the Game Canvas. + * + * @return {this} The Canvas Renderer instance. + */ + setContext: function (ctx) + { + this.currentContext = (ctx) ? ctx : this.gameContext; + + return this; + }, + + /** + * Sets the global alpha of the current context. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha + * @since 3.0.0 + * + * @param {number} alpha - The new alpha to use, where 0 is fully transparent and 1 is fully opaque. + * + * @return {this} This CanvasRenderer object. + */ + setAlpha: function (alpha) + { + this.currentContext.globalAlpha = alpha; + + return this; + }, + + /** + * Called at the start of the render loop. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender + * @since 3.0.0 + */ + preRender: function () + { + var ctx = this.gameContext; + var config = this.config; + + var width = this.width; + var height = this.height; + + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; + ctx.setTransform(1, 0, 0, 1, 0, 0); + + if (config.clearBeforeRender) + { + ctx.clearRect(0, 0, width, height); + } + + if (!config.transparent) + { + ctx.fillStyle = config.backgroundColor.rgba; + ctx.fillRect(0, 0, width, height); + } + + ctx.save(); + + this.drawCount = 0; + }, + + /** + * Renders the Scene to the given Camera. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#render + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to render. + * @param {Phaser.GameObjects.DisplayList} children - The Game Objects within the Scene to be rendered. + * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently unused. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. + */ + render: function (scene, children, interpolationPercentage, camera) + { + var list = children.list; + var childCount = list.length; + + var cx = camera._cx; + var cy = camera._cy; + var cw = camera._cw; + var ch = camera._ch; + + var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; + + // Save context pre-clip + ctx.save(); + + if (this.game.scene.customViewports) + { + ctx.beginPath(); + ctx.rect(cx, cy, cw, ch); + ctx.clip(); + } + + this.currentContext = ctx; + + if (!camera.transparent) + { + ctx.fillStyle = camera.backgroundColor.rgba; + ctx.fillRect(cx, cy, cw, ch); + } + + ctx.globalAlpha = camera.alpha; + + ctx.globalCompositeOperation = 'source-over'; + + this.drawCount += list.length; + + if (camera.renderToTexture) + { + camera.emit(CameraEvents.PRE_RENDER, camera); + } + + camera.matrix.copyToContext(ctx); + + for (var i = 0; i < childCount; i++) + { + var child = list[i]; + + if (!child.willRender(camera)) + { + continue; + } + + 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); + ctx.globalCompositeOperation = 'source-over'; + ctx.globalAlpha = 1; + + camera.flashEffect.postRenderCanvas(ctx); + camera.fadeEffect.postRenderCanvas(ctx); + + camera.dirty = false; + + // Restore pre-clip context + ctx.restore(); + + if (camera.renderToTexture) + { + camera.emit(CameraEvents.POST_RENDER, camera); + + scene.sys.context.drawImage(camera.canvas, cx, cy); + } + }, + + /** + * Restores the game context's global settings and takes a snapshot if one is scheduled. + * + * The post-render step happens after all Cameras in all Scenes have been rendered. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender + * @since 3.0.0 + */ + postRender: function () + { + var ctx = this.gameContext; + + ctx.restore(); + + var state = this.snapshotState; + + if (state.callback) + { + CanvasSnapshot(this.gameCanvas, state); + + state.callback = null; + } + }, + + /** + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot + * @since 3.0.0 + * + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshot: function (callback, type, encoderOptions) + { + return this.snapshotArea(0, 0, this.gameCanvas.width, this.gameCanvas.height, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gameCanvas.width); + state.height = Math.min(height, this.gameCanvas.height); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; + + return this; + }, + + /** + * Takes a Sprite Game Object, or any object that extends it, and draws it to the current context. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#batchSprite + * @since 3.12.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The texture based Game Object to draw. + * @param {Phaser.Textures.Frame} frame - The frame to draw, doesn't have to be that owned by the Game Object. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + */ + batchSprite: function (sprite, frame, camera, parentTransformMatrix) + { + var alpha = camera.alpha * sprite.alpha; + + if (alpha === 0) + { + // Nothing to see, so abort early + return; + } + + var ctx = this.currentContext; + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var cd = frame.canvasData; + + var frameX = cd.x; + var frameY = cd.y; + var frameWidth = frame.cutWidth; + var frameHeight = frame.cutHeight; + var res = frame.source.resolution; + + var x = -sprite.displayOriginX + frame.x; + var y = -sprite.displayOriginY + frame.y; + + var fx = (sprite.flipX) ? -1 : 1; + var fy = (sprite.flipY) ? -1 : 1; + + if (sprite.isCropped) + { + var crop = sprite._crop; + + if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY) + { + frame.updateCropUVs(crop, sprite.flipX, sprite.flipY); + } + + frameWidth = crop.cw; + frameHeight = crop.ch; + + frameX = crop.cx; + frameY = crop.cy; + + x = -sprite.displayOriginX + crop.x; + y = -sprite.displayOriginY + crop.y; + + if (fx === -1) + { + if (x >= 0) + { + x = -(x + frameWidth); + } + else if (x < 0) + { + x = (Math.abs(x) - frameWidth); + } + } + + if (fy === -1) + { + if (y >= 0) + { + y = -(y + frameHeight); + } + else if (y < 0) + { + y = (Math.abs(y) - frameHeight); + } + } + } + + spriteMatrix.applyITRS(sprite.x, sprite.y, sprite.rotation, sprite.scaleX, sprite.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = sprite.x; + spriteMatrix.f = sprite.y; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + else + { + spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; + spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + + ctx.save(); + + calcMatrix.setToContext(ctx); + + ctx.scale(fx, fy); + + ctx.globalCompositeOperation = this.blendModes[sprite.blendMode]; + + ctx.globalAlpha = alpha; + + ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); + + ctx.restore(); + }, + + /** + * Destroys all object references in the Canvas Renderer. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.gameCanvas = null; + this.gameContext = null; + + this.game = null; + } + +}); + +module.exports = CanvasRenderer; + + +/***/ }), +/* 404 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @since 3.0.0 + */ +var CanvasInterpolation = { + + /** + * 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' ]; + + types.forEach(function (type) + { + canvas.style['image-rendering'] = type; + }); + + canvas.style.msInterpolationMode = 'nearest-neighbor'; + + return canvas; + }, + + /** + * 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'; + + return canvas; + } + +}; + +module.exports = CanvasInterpolation; + + +/***/ }), +/* 405 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasInterpolation = __webpack_require__(404); +var CanvasPool = __webpack_require__(26); +var CONST = __webpack_require__(30); +var Features = __webpack_require__(207); + +/** + * 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.Core.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; + + if ((config.customEnvironment || config.canvas) && config.renderType === CONST.AUTO) + { + throw new Error('Must set explicit renderType in custom environment'); + } + + // Not a custom environment, didn't provide their own canvas and not headless, so determine the renderer: + if (!config.customEnvironment && !config.canvas && 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.antialias) + { + CanvasPool.disableSmoothing(); + } + + var baseSize = game.scale.baseSize; + + var width = baseSize.width; + var height = baseSize.height; + + // Does the game config provide its own canvas element to use? + if (config.canvas) + { + game.canvas = config.canvas; + + game.canvas.width = width; + game.canvas.height = height; + } + else + { + game.canvas = CanvasPool.create(game, width, 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.antialias) + { + CanvasInterpolation.setCrisp(game.canvas); + } + + if (config.renderType === CONST.HEADLESS) + { + // Nothing more to do here + return; + } + + var CanvasRenderer; + var WebGLRenderer; + + if (true) + { + CanvasRenderer = __webpack_require__(403); + WebGLRenderer = __webpack_require__(400); + + // Let the config pick the renderer type, as both are included + if (config.renderType === CONST.WEBGL) + { + game.renderer = new WebGLRenderer(game); + } + else + { + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } + } + + if (false) + {} + + if (false) + {} +}; + +module.exports = CreateRenderer; + + +/***/ }), +/* 406 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(202); +var Matrix3 = __webpack_require__(408); + +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 + * A quaternion. + * + * @class Quaternion + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +var Quaternion = new Class({ + + initialize: + + function Quaternion (x, y, z, w) + { + /** + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The y component of this Quaternion. + * + * @name Phaser.Math.Quaternion#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The z component of this Quaternion. + * + * @name Phaser.Math.Quaternion#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The w component of this Quaternion. + * + * @name Phaser.Math.Quaternion#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; + } + }, + + /** + * Copy the components of a given Quaternion or Vector into this Quaternion. + * + * @method Phaser.Math.Quaternion#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z; + this.w = src.w; + + return this; + }, + + /** + * Set the components of this Quaternion. + * + * @method Phaser.Math.Quaternion#set + * @since 3.0.0 + * + * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=0] - The w component. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + set: function (x, y, z, w) + { + 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; + }, + + /** + * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. + * + * @method Phaser.Math.Quaternion#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z; + this.w += v.w; + + return this; + }, + + /** + * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. + * + * @method Phaser.Math.Quaternion#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + this.w -= v.w; + + return this; + }, + + /** + * Scale this Quaternion by the given value. + * + * @method Phaser.Math.Quaternion#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + scale: function (scale) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; + + return this; + }, + + /** + * Calculate the length of this Quaternion. + * + * @method Phaser.Math.Quaternion#length + * @since 3.0.0 + * + * @return {number} The length of this Quaternion. + */ + length: function () + { + 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); + }, + + /** + * Calculate the length of this Quaternion squared. + * + * @method Phaser.Math.Quaternion#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Quaternion, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return x * x + y * y + z * z + w * w; + }, + + /** + * Normalize this Quaternion. + * + * @method Phaser.Math.Quaternion#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + + 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; + }, + + /** + * Calculate the dot product of this Quaternion and the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#dot + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. + * + * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, + + /** + * Linearly interpolate this Quaternion towards the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#lerp + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. + * @param {number} [t=0] - The percentage of interpolation. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + lerp: function (v, t) + { + 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; + }, + + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotationTo + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - [description] + * @param {Phaser.Math.Vector3} b - [description] + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotationTo: function (a, b) + { + 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(); + + 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(); + } + }, + + /** + * Set the axes of this Quaternion. + * + * @method Phaser.Math.Quaternion#setAxes + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} view - The view axis. + * @param {Phaser.Math.Vector3} right - The right axis. + * @param {Phaser.Math.Vector3} up - The upwards axis. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setAxes: function (view, right, up) + { + var m = tmpMat3.val; + + 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(); + }, + + /** + * Reset this Matrix to an identity (default) Quaternion. + * + * @method Phaser.Math.Quaternion#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + identity: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + + return this; + }, + + /** + * Set the axis angle of this Quaternion. + * + * @method Phaser.Math.Quaternion#setAxisAngle + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} axis - The axis. + * @param {number} rad - The angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setAxisAngle: function (axis, rad) + { + 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; + }, + + /** + * Multiply this Quaternion by the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + multiply: function (b) + { + 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; + + 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; + }, + + /** + * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#slerp + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. + * @param {number} t - The percentage of interpolation. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + slerp: function (b, t) + { + // 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) + { + cosom = -cosom; + bx = - bx; + by = - by; + bz = - bz; + bw = - bw; + } + + // "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) + { + // 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; + }, + + /** + * Invert this Quaternion. + * + * @method Phaser.Math.Quaternion#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + invert: 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 + + this.x = -a0 * invDot; + this.y = -a1 * invDot; + this.z = -a2 * invDot; + this.w = a3 * invDot; + + return this; + }, + + /** + * Convert this Quaternion into its conjugate. + * + * Sets the x, y and z components. + * + * @method Phaser.Math.Quaternion#conjugate + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + conjugate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Rotate this Quaternion on the X axis. + * + * @method Phaser.Math.Quaternion#rotateX + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotateX: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this Quaternion on the Y axis. + * + * @method Phaser.Math.Quaternion#rotateY + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + }, + + /** + * Rotate this Quaternion on the Z axis. + * + * @method Phaser.Math.Quaternion#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotateZ: function (rad) + { + 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); + + 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; + }, + + /** + * Create a unit (or rotation) Quaternion from its x, y, and z components. + * + * Sets the w component. + * + * @method Phaser.Math.Quaternion#calculateW + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + calculateW: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); + + return this; + }, + + /** + * Convert the given Matrix into this Quaternion. + * + * @method Phaser.Math.Quaternion#fromMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + + +/***/ }), +/* 407 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 EPSILON = 0.000001; + +/** + * @classdesc + * A four-dimensional matrix. + * + * @class Matrix4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. + */ +var Matrix4 = new Class({ + + initialize: + + function Matrix4 (m) + { + /** + * The matrix values. + * + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(16); + + if (m) + { + // Assume Matrix4 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, + + /** + * Make a clone of this Matrix4. + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} A clone of this Matrix4. + */ + clone: function () + { + return new Matrix4(this); + }, + + // TODO - Should work with basic values + + /** + * This method is an alias for `Matrix4.copy`. + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + copy: function (src) + { + 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]; + 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; + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix4#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromArray: function (a) + { + 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; + }, + + /** + * Reset this Matrix. + * + * Sets all values to `0`. + * + * @method Phaser.Math.Matrix4#zero + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + zero: function () + { + 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; + + return this; + }, + + /** + * Set the `x`, `y` and `z` values of this Matrix. + * + * @method Phaser.Math.Matrix4#xyz + * @since 3.0.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + xyz: function (x, y, z) + { + this.identity(); + + var out = this.val; + + out[12] = x; + out[13] = y; + out[14] = z; + + return this; + }, + + /** + * Set the scaling values of this Matrix. + * + * @method Phaser.Math.Matrix4#scaling + * @since 3.0.0 + * + * @param {number} x - The x scaling value. + * @param {number} y - The y scaling value. + * @param {number} z - The z scaling value. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scaling: function (x, y, z) + { + this.zero(); + + var out = this.val; + + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; + + return this; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix4#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + identity: function () + { + 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; + + return this; + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix4#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + transpose: function () + { + 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; + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix4#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + invert: 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 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; + + return this; + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix4#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + adjoint: 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)); + + return this; + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix4#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: 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 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; + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix4#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + multiply: function (src) + { + 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; + + 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.Math.Matrix4#multiplyLocal + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - [description] + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + multiplyLocal: function (src) + { + 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); + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix4#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + translate: function (v) + { + var x = v.x; + var y = v.y; + var z = v.z; + var a = this.val; + + 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; + }, + + /** + * Translate this Matrix using the given values. + * + * @method Phaser.Math.Matrix4#translateXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + translateXYZ: function (x, y, z) + { + var a = this.val; + + 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; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix4#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scale: 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; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#scaleXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scaleXYZ: function (x, y, 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; + + return this; + }, + + /** + * Derive a rotation matrix around the given axis. + * + * @method Phaser.Math.Matrix4#makeRotationAxis + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. + * @param {number} angle - The rotation angle in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + makeRotationAxis: function (axis, angle) + { + // 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.fromArray([ + 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; + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotate: function (rad, axis) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its X axis. + * + * @method Phaser.Math.Matrix4#rotateX + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateX: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its Y axis. + * + * @method Phaser.Math.Matrix4#rotateY + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateY: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its Z axis. + * + * @method Phaser.Math.Matrix4#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateZ: function (rad) + { + 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]; + + // 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; + }, + + /** + * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * + * @method Phaser.Math.Matrix4#fromRotationTranslation + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. + * @param {Phaser.Math.Vector3} v - The Vector to set translation from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromRotationTranslation: function (q, v) + { + // 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; + + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + + out[12] = v.x; + out[13] = v.y; + out[14] = v.z; + out[15] = 1; + + return this; + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix4#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromQuat: function (q) + { + 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; + + 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[15] = 1; + + return this; + }, + + /** + * Generate a frustum matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#frustum + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + frustum: function (left, right, bottom, top, near, far) + { + 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; + + 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; + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspective + * @since 3.0.0 + * + * @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. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + perspective: function (fovy, aspect, near, far) + { + 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; + + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + + return this; + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspectiveLH + * @since 3.0.0 + * + * @param {number} width - The width of the frustum. + * @param {number} height - The height of the frustum. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + perspectiveLH: function (width, height, near, far) + { + 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; + + out[12] = 0; + out[13] = 0; + out[14] = (near * far) / (near - far); + out[15] = 0; + + return this; + }, + + /** + * Generate an orthogonal projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#ortho + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + ortho: function (left, right, bottom, top, near, far) + { + 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; + + 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; + }, + + /** + * Generate a look-at matrix with the given eye position, focal point, and up axis. + * + * @method Phaser.Math.Matrix4#lookAt + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer + * @param {Phaser.Math.Vector3} center - Point the viewer is looking at + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + lookAt: function (eye, center, up) + { + var out = this.val; + + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; + + var upx = up.x; + var upy = up.y; + var upz = up.z; + + 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(); + } + + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + + z0 *= len; + z1 *= len; + z2 *= len; + + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + + if (!len) + { + y0 = 0; + y1 = 0; + y2 = 0; + } + else + { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + 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; + }, + + /** + * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. + * + * @method Phaser.Math.Matrix4#yawPitchRoll + * @since 3.0.0 + * + * @param {number} yaw - [description] + * @param {number} pitch - [description] + * @param {number} roll - [description] + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + yawPitchRoll: function (yaw, pitch, roll) + { + 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; + }, + + /** + * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. + * + * @method Phaser.Math.Matrix4#setWorldMatrix + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. + * @param {Phaser.Math.Vector3} position - The position of the world matrix. + * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. + * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. + * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + { + 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) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix !== undefined) + { + this.multiplyLocal(projectionMatrix); + } + + return this; + } + +}); + +var _tempMat1 = new Matrix4(); +var _tempMat2 = new Matrix4(); + +module.exports = Matrix4; + + +/***/ }), +/* 408 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 + * A three-dimensional matrix. + * + * Defaults to the identity matrix when instantiated. + * + * @class Matrix3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. + */ +var Matrix3 = new Class({ + + initialize: + + function Matrix3 (m) + { + /** + * The matrix values. + * + * @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(); + } + }, + + /** + * Make a clone of this Matrix3. + * + * @method Phaser.Math.Matrix3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} A clone of this Matrix3. + */ + clone: function () + { + return new Matrix3(this); + }, + + /** + * This method is an alias for `Matrix3.copy`. + * + * @method Phaser.Math.Matrix3#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix3#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + copy: function (src) + { + 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; + }, + + /** + * Copy the values of a given Matrix4 into this Matrix3. + * + * @method Phaser.Math.Matrix3#fromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromMat4: function (m) + { + 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; + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix3#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromArray: function (a) + { + 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; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix3#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + 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; + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix3#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + transpose: function () + { + 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; + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix3#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + invert: 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 a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + + 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; + + if (!det) + { + 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; + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix3#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + adjoint: 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 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; + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix3#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: 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 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); + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix3#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + multiply: function (src) + { + 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]; + + 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; + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix3#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + translate: function (v) + { + var a = this.val; + var x = v.x; + var y = v.y; + + 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; + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix3#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + rotate: function (rad) + { + 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; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x` and `y` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix3#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + scale: function (v) + { + 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; + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix3#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromQuat: function (q) + { + 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; + + out[2] = xz + wy; + out[5] = yz - wx; + out[8] = 1 - (xx + yy); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Math.Matrix3#normalFromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - [description] + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + normalFromMat4: function (m) + { + 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; + + 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; + + 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; + + +/***/ }), +/* 409 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Takes the `x` and `y` coordinates and transforms them into the same space as + * defined by the position, rotation and scale values. + * + * @function Phaser.Math.TransformXY + * @since 3.0.0 + * + * @param {number} x - The x coordinate to be transformed. + * @param {number} y - The y coordinate to be transformed. + * @param {number} positionX - Horizontal position of the transform point. + * @param {number} positionY - Vertical position of the transform point. + * @param {number} rotation - Rotation of the transform point, in radians. + * @param {number} scaleX - Horizontal scale of the transform point. + * @param {number} scaleY - Vertical scale of the transform point. + * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. + * + * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. + */ +var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) +{ + if (output === undefined) { output = new Vector2(); } + + var radianSin = Math.sin(rotation); + var radianCos = Math.cos(rotation); + + // Rotate and Scale + var a = radianCos * scaleX; + var b = radianSin * scaleX; + var c = -radianSin * scaleY; + var d = radianCos * scaleY; + + // Invert + var id = 1 / ((a * d) + (c * -b)); + + output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); + output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); + + return output; +}; + +module.exports = TransformXY; + + +/***/ }), +/* 410 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * + * @function Phaser.Math.RoundAwayFromZero + * @since 3.0.0 + * + * @param {number} value - The number to round. + * + * @return {number} The rounded number, rounded away from zero. + */ +var RoundAwayFromZero = function (value) +{ + // "Opposite" of truncate. + return (value > 0) ? Math.ceil(value) : Math.floor(value); +}; + +module.exports = RoundAwayFromZero; + + +/***/ }), +/* 411 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. + * + * @function Phaser.Math.Rotate + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. + * @param {number} angle - The angle to be rotated by in an anticlockwise direction. + * + * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. + */ +var Rotate = function (point, angle) +{ + var x = point.x; + var y = point.y; + + point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); + point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); + + return point; +}; + +module.exports = Rotate; + + +/***/ }), +/* 412 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. + * + * @function Phaser.Math.FloatBetween + * @since 3.0.0 + * + * @param {number} min - The lower bound for the float, inclusive. + * @param {number} max - The upper bound for the float exclusive. + * + * @return {number} A random float within the given range. + */ +var FloatBetween = function (min, max) +{ + return Math.random() * (max - min) + min; +}; + +module.exports = FloatBetween; + + +/***/ }), +/* 413 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using ceil. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. + * As will `14` snap to `15`... but `16` will snap to `20`. + * + * @function Phaser.Math.Snap.Ceil + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapCeil = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.ceil(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapCeil; + + +/***/ }), +/* 414 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Returns the nearest power of 2 to the given `value`. + * + * @function Phaser.Math.Pow2.GetPowerOfTwo + * @since 3.0.0 + * + * @param {number} value - The value. + * + * @return {integer} The nearest power of 2 to `value`. + */ +var GetPowerOfTwo = function (value) +{ + var index = Math.log(value) / 0.6931471805599453; + + return (1 << Math.ceil(index)); +}; + +module.exports = GetPowerOfTwo; + + +/***/ }), +/* 415 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SmoothStep = __webpack_require__(215); + +/** + * A Smooth Step interpolation method. + * + * @function Phaser.Math.Interpolation.SmoothStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep} + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The interpolated value. + */ +var SmoothStepInterpolation = function (t, min, max) +{ + return min + (max - min) * SmoothStep(t, 0, 1); +}; + +module.exports = SmoothStepInterpolation; + + +/***/ }), +/* 416 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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 * p; +} + +function P1 (t, p) +{ + return 2 * (1 - t) * t * p; +} + +function P2 (t, p) +{ + return t * t * p; +} + +// p0 = start point +// p1 = control point 1 +// p2 = end point + +// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js + +/** + * A quadratic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.QuadraticBezier + * @since 3.2.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The control point. + * @param {number} p2 - The end point. + * + * @return {number} The interpolated value. + */ +var QuadraticBezierInterpolation = function (t, p0, p1, p2) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2); +}; + +module.exports = QuadraticBezierInterpolation; + + +/***/ }), +/* 417 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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 + +/** + * A cubic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.CubicBezier + * @since 3.0.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The first control point. + * @param {number} p2 - The second control point. + * @param {number} p3 - The end point. + * + * @return {number} The interpolated value. + */ +var CubicBezierInterpolation = function (t, p0, p1, p2, p3) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); +}; + +module.exports = CubicBezierInterpolation; + + +/***/ }), +/* 418 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the factorial of a given number for integer values greater than 0. + * + * @function Phaser.Math.Factorial + * @since 3.0.0 + * + * @param {number} value - A positive integer to calculate the factorial of. + * + * @return {number} The factorial of the given number. + */ +var Factorial = function (value) +{ + if (value === 0) + { + return 1; + } + + var res = value; + + while (--value) + { + res *= value; + } + + return res; +}; + +module.exports = Factorial; + + +/***/ }), +/* 419 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Factorial = __webpack_require__(418); + +/** + * [description] + * + * @function Phaser.Math.Bernstein + * @since 3.0.0 + * + * @param {number} n - [description] + * @param {number} i - [description] + * + * @return {number} [description] + */ +var Bernstein = function (n, i) +{ + return Factorial(n) / Factorial(i) / Factorial(n - i); +}; + +module.exports = Bernstein; + + +/***/ }), +/* 420 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether `a` is fuzzily less than `b`. + * + * `a` is fuzzily less than `b` if it is less than `b + epsilon`. + * + * @function Phaser.Math.Fuzzy.LessThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. + */ +var LessThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return a < b + epsilon; +}; + +module.exports = LessThan; + + +/***/ }), +/* 421 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether `a` is fuzzily greater than `b`. + * + * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. + * + * @function Phaser.Math.Fuzzy.GreaterThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. + */ +var GreaterThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return a > b - epsilon; +}; + +module.exports = GreaterThan; + + +/***/ }), +/* 422 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the distance between two sets of coordinates (points), squared. + * + * @function Phaser.Math.Distance.Squared + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The distance between each point, squared. + */ +var DistanceSquared = function (x1, y1, x2, y2) +{ + var dx = x1 - x2; + var dy = y1 - y2; + + return dx * dx + dy * dy; +}; + +module.exports = DistanceSquared; + + +/***/ }), +/* 423 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Normalize an angle to the [0, 2pi] range. + * + * @function Phaser.Math.Angle.Normalize + * @since 3.0.0 + * + * @param {number} angle - The angle to normalize, in radians. + * + * @return {number} The normalized angle, in radians. + */ +var Normalize = function (angle) +{ + angle = angle % (2 * Math.PI); + + if (angle >= 0) + { + return angle; + } + else + { + return angle + 2 * Math.PI; + } +}; + +module.exports = Normalize; + + +/***/ }), +/* 424 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * @function Phaser.Math.Angle.Between + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var Between = function (x1, y1, x2, y2) +{ + return Math.atan2(y2 - y1, x2 - x1); +}; + +module.exports = Between; + + +/***/ }), +/* 425 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); +var Extend = __webpack_require__(21); + +/** + * @namespace Phaser.Math + */ + +var PhaserMath = { + + // Collections of functions + Angle: __webpack_require__(1178), + Distance: __webpack_require__(1170), + Easing: __webpack_require__(1168), + Fuzzy: __webpack_require__(1167), + Interpolation: __webpack_require__(1164), + Pow2: __webpack_require__(1159), + Snap: __webpack_require__(1157), + + // Expose the RNG Class + RandomDataGenerator: __webpack_require__(1155), + + // Single functions + Average: __webpack_require__(1154), + Bernstein: __webpack_require__(419), + Between: __webpack_require__(204), + CatmullRom: __webpack_require__(205), + CeilTo: __webpack_require__(1153), + Clamp: __webpack_require__(24), + DegToRad: __webpack_require__(39), + Difference: __webpack_require__(1152), + Factorial: __webpack_require__(418), + FloatBetween: __webpack_require__(412), + FloorTo: __webpack_require__(1151), + FromPercent: __webpack_require__(110), + GetSpeed: __webpack_require__(1150), + IsEven: __webpack_require__(1149), + IsEvenStrict: __webpack_require__(1148), + Linear: __webpack_require__(139), + MaxAdd: __webpack_require__(1147), + MinSub: __webpack_require__(1146), + Percent: __webpack_require__(1145), + RadToDeg: __webpack_require__(203), + RandomXY: __webpack_require__(1144), + RandomXYZ: __webpack_require__(1143), + RandomXYZW: __webpack_require__(1142), + Rotate: __webpack_require__(411), + RotateAround: __webpack_require__(466), + RotateAroundDistance: __webpack_require__(217), + RoundAwayFromZero: __webpack_require__(410), + RoundTo: __webpack_require__(1141), + SinCosTableGenerator: __webpack_require__(1140), + SmootherStep: __webpack_require__(216), + SmoothStep: __webpack_require__(215), + TransformXY: __webpack_require__(409), + Within: __webpack_require__(1139), + Wrap: __webpack_require__(63), + + // Vector classes + Vector2: __webpack_require__(3), + Vector3: __webpack_require__(202), + Vector4: __webpack_require__(1138), + Matrix3: __webpack_require__(408), + Matrix4: __webpack_require__(407), + Quaternion: __webpack_require__(406), + RotateVec3: __webpack_require__(1137) + +}; + +// Merge in the consts + +PhaserMath = Extend(false, PhaserMath, CONST); + +// Export it + +module.exports = PhaserMath; + + +/***/ }), +/* 426 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(26); + +/** + * 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. + * + * @typedef {object} Phaser.Device.CanvasFeatures + * @since 3.0.0 + * + * @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 = { + + supportInverseAlpha: false, + supportNewBlendModes: false + +}; + +function checkBlendMode () +{ + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; + + var magenta = new Image(); + + magenta.onload = function () + { + var yellow = new Image(); + + yellow.onload = function () + { + var canvas = CanvasPool.create(yellow, 6, 1); + var context = canvas.getContext('2d'); + + context.globalCompositeOperation = 'multiply'; + + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + if (!context.getImageData(2, 0, 1, 1)) + { + return false; + } + + var data = context.getImageData(2, 0, 1, 1).data; + + CanvasPool.remove(yellow); + + CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); + }; + + yellow.src = pngHead + '/wCKxvRF' + pngEnd; + }; + + magenta.src = pngHead + 'AP804Oa6' + pngEnd; + + return false; +} + +function checkInverseAlpha () +{ + var canvas = CanvasPool.create(this, 2, 1); + var context = canvas.getContext('2d'); + + context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + + // Draw a single pixel + context.fillRect(0, 0, 1, 1); + + // Get the color values + var s1 = context.getImageData(0, 0, 1, 1); + + if (s1 === null) + { + return false; + } + + // Plot them to x2 + context.putImageData(s1, 1, 0); + + // 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) + { + CanvasFeatures.supportNewBlendModes = checkBlendMode(); + CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + } + + return CanvasFeatures; +} + +module.exports = init(); + + +/***/ }), +/* 427 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// This singleton is instantiated as soon as Phaser loads, +// before a Phaser.Game instance has even been created. +// Which means all instances of Phaser Games can share it, +// without having to re-poll the device all over again + +/** + * @namespace Phaser.Device + * @since 3.0.0 + */ + +/** + * @typedef {object} Phaser.DeviceConf + * + * @property {Phaser.Device.OS} os - The OS Device functions. + * @property {Phaser.Device.Browser} browser - The Browser Device functions. + * @property {Phaser.Device.Features} features - The Features Device functions. + * @property {Phaser.Device.Input} input - The Input Device functions. + * @property {Phaser.Device.Audio} audio - The Audio Device functions. + * @property {Phaser.Device.Video} video - The Video Device functions. + * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. + * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. + */ + +module.exports = { + + os: __webpack_require__(108), + browser: __webpack_require__(138), + features: __webpack_require__(207), + input: __webpack_require__(1182), + audio: __webpack_require__(1181), + video: __webpack_require__(1180), + fullscreen: __webpack_require__(1179), + canvasFeatures: __webpack_require__(426) + +}; + + +/***/ }), +/* 428 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(30); +var Device = __webpack_require__(427); +var GetFastValue = __webpack_require__(1); +var GetValue = __webpack_require__(4); +var IsPlainObject = __webpack_require__(8); +var PhaserMath = __webpack_require__(425); +var NOOP = __webpack_require__(2); +var DefaultPlugins = __webpack_require__(201); +var ValueToColor = __webpack_require__(212); + +/** + * This callback type is completely empty, a no-operation. + * + * @callback NOOP + */ + +/** + * @callback BootCallback + * + * @param {Phaser.Game} game - The game. + */ + +/** + * Config object containing various sound settings. + * + * @typedef {object} AudioConfig + * + * @property {boolean} [disableWebAudio=false] - Use HTML5 Audio instead of Web Audio. + * @property {AudioContext} [context] - An existing Web Audio context. + * @property {boolean} [noAudio=false] - Disable all audio output. + * + * @see Phaser.Sound.SoundManagerCreator + */ + +/** + * @typedef {object} InputConfig + * + * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. + * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. + * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. + * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. + * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. + * @property {number} [smoothFactor=0] - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + * @property {boolean} [inputQueue=false] - Should Phaser use a queued input system for native DOM Events or not? + */ + +/** + * @typedef {object} MouseInputConfig + * + * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether mouse input events have `preventDefault` called on them. + */ + +/** + * @typedef {object} KeyboardInputConfig + * + * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. + * @property {?integer} [capture] - `preventDefault` will be called on every non-modified key which has a key code in this array. By default it is empty. + */ + +/** + * @typedef {object} TouchInputConfig + * + * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. + */ + +/** + * @typedef {object} GamepadInputConfig + * + * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. + */ + +/** + * @typedef {object} BannerConfig + * + * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. + * @property {string} [text='#ffffff'] - The color of the banner text. + * @property {string[]} [background] - The background colors of the banner. + */ + +/** + * @typedef {object} FPSConfig + * + * @property {integer} [min=5] - The minimum acceptable rendering rate, in frames per second. + * @property {integer} [target=60] - The optimum rendering rate, in frames per second. + * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. + * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. + * @property {integer} [panicMax=120] - The amount of frames the time step counts before we trust the delta values again. + */ + +/** + * @typedef {object} RenderConfig + * + * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. + * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. + * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. + * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. + * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + * @property {integer} [batchSize=2000] - The default WebGL batch size. + * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + +/** + * @typedef {object} WidthHeight + * + * @property {integer} [width=0] - The width. + * @property {integer} [height=0] - The height. + */ + +/** + * @typedef {object} ScaleConfig + * + * @property {(integer|string)} [width=1024] - The base width of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(integer|string)} [height=768] - The base height of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(Phaser.Scale.ZoomType|integer)} [zoom=1] - The zoom value of the game canvas. + * @property {number} [resolution=1] - The rendering resolution of the canvas. This is reserved for future use and is currently ignored. + * @property {?(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If undefined, or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {boolean} [expandParent=true] - Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%? + * @property {Phaser.Scale.ScaleModeType} [mode=Phaser.Scale.ScaleModes.NONE] - The scale mode. + * @property {WidthHeight} [min] - The minimum width and height the canvas can be scaled down to. + * @property {WidthHeight} [max] - The maximum width the canvas can be scaled up to. + * @property {boolean} [autoRound=false] - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * @property {Phaser.Scale.CenterType} [autoCenter=Phaser.Scale.Center.NO_CENTER] - Automatically center the canvas within the parent? + * @property {integer} [resizeInterval=500] - How many ms should elapse before checking if the browser size has changed? + * @property {?(HTMLElement|string)} [fullscreenTarget] - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + +/** + * @typedef {object} CallbacksConfig + * + * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. + * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + +/** + * @typedef {object} LoaderConfig + * + * @property {string} [baseURL] - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + * @property {string} [path] - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. + * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. + * @property {boolean} [async=true] - Should the XHR request use async or not? + * @property {string} [user] - Optional username for all XHR requests. + * @property {string} [password] - Optional password for all XHR requests. + * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. + */ + +/** + * @typedef {object} DOMContainerConfig + * + * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. + * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. + */ + +/** + * @typedef {object} ImagesConfig + * + * @property {string} [default] - URL to use for the 'default' texture. + * @property {string} [missing] - URL to use for the 'missing' texture. + */ + +/** + * @typedef {object} PhysicsConfig + * + * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. + * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. + * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. + * @property {object} [matter] - Matter Physics configuration. + */ + +/** + * @typedef {object} PluginObjectItem + * + * @property {string} [key] - A key to identify the plugin in the Plugin Manager. + * @property {*} [plugin] - The plugin itself. Usually a class/constructor. + * @property {boolean} [start] - Whether the plugin should be started automatically. + * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). + * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). + * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @property {*} [data] - Arbitrary data passed to the plugin's init() method. + * + * @example + * // Global plugin + * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } + * @example + * // Scene plugin + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + */ + +/** + * @typedef {object} PluginObject + * + * @property {?PluginObjectItem[]} [global] - Global plugins to install. + * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. + * @property {string[]} [default] - The default set of scene plugins (names). + * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. + */ + +/** + * @typedef {object} GameConfig + * + * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. + * @property {(integer|string)} [height=768] - The height of the game, in game pixels. + * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. + * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. + * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. + * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If undefined or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. + * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. + * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. + * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. + * @property {string[]} [seed] - Seed for the random number generator. + * @property {string} [title=''] - The title of the game. Shown in the browser console. + * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. + * @property {string} [version=''] - The version of the game. Shown in the browser console. + * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. + * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. + * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). + * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. + * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. + * @property {FPSConfig} [fps] - Game loop configuration. + * @property {RenderConfig} [render] - Game renderer configuration. + * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. + * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. + * @property {LoaderConfig} [loader] - Loader configuration. + * @property {ImagesConfig} [images] - Images configuration. + * @property {object} [physics] - Physics configuration. + * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. + * @property {ScaleConfig} [scale] - The Scale Manager configuration. + */ + +/** + * @classdesc + * The active game configuration settings, parsed from a {@link GameConfig} object. + * + * @class Config + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * + * @see Phaser.Game#config + */ +var Config = new Class({ + + initialize: + + function Config (config) + { + if (config === undefined) { config = {}; } + + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; + + var defaultBannerTextColor = '#ffffff'; + + /** + * @const {(integer|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + */ + this.width = GetValue(config, 'width', 1024); + + /** + * @const {(integer|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + */ + this.height = GetValue(config, 'height', 768); + + /** + * @const {(Phaser.Scale.ZoomType|integer)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + */ + this.zoom = GetValue(config, 'zoom', 1); + + /** + * @const {number} Phaser.Core.Config#resolution - The canvas device pixel resolution. Currently un-used. + */ + this.resolution = GetValue(config, 'resolution', 1); + + /** + * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. + */ + this.parent = GetValue(config, 'parent', undefined); + + /** + * @const {Phaser.Scale.ScaleModeType} Phaser.Core.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. + */ + this.scaleMode = GetValue(config, 'scaleMode', 0); + + /** + * @const {boolean} Phaser.Core.Config#expandParent - Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%? + */ + this.expandParent = GetValue(config, 'expandParent', true); + + /** + * @const {integer} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + */ + this.autoRound = GetValue(config, 'autoRound', false); + + /** + * @const {Phaser.Scale.CenterType} Phaser.Core.Config#autoCenter - Automatically center the canvas within the parent? + */ + this.autoCenter = GetValue(config, 'autoCenter', 0); + + /** + * @const {integer} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + */ + this.resizeInterval = GetValue(config, 'resizeInterval', 500); + + /** + * @const {?(HTMLElement|string)} Phaser.Core.Config#fullscreenTarget - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); + + /** + * @const {integer} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minWidth = GetValue(config, 'minWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxWidth = GetValue(config, 'maxWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minHeight = GetValue(config, 'minHeight', 0); + + /** + * @const {integer} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxHeight = GetValue(config, 'maxHeight', 0); + + // Scale Manager - Anything set in here over-rides anything set above + + var scaleConfig = GetValue(config, 'scale', null); + + if (scaleConfig) + { + this.width = GetValue(scaleConfig, 'width', this.width); + this.height = GetValue(scaleConfig, 'height', this.height); + this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); + this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); + this.parent = GetValue(scaleConfig, 'parent', this.parent); + this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); + this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); + this.autoRound = GetValue(scaleConfig, 'autoRound', this.autoRound); + this.autoCenter = GetValue(scaleConfig, 'autoCenter', this.autoCenter); + this.resizeInterval = GetValue(scaleConfig, 'resizeInterval', this.resizeInterval); + this.fullscreenTarget = GetValue(scaleConfig, 'fullscreenTarget', this.fullscreenTarget); + this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); + this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); + this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); + this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); + } + + /** + * @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) + */ + this.renderType = GetValue(config, 'type', CONST.AUTO); + + /** + * @const {?HTMLCanvasElement} Phaser.Core.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. + */ + this.canvas = GetValue(config, 'canvas', null); + + /** + * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Core.Config#context - Force Phaser to use your own Canvas context instead of creating one. + */ + this.context = GetValue(config, 'context', null); + + /** + * @const {?string} Phaser.Core.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. + */ + this.canvasStyle = GetValue(config, 'canvasStyle', null); + + /** + * @const {boolean} Phaser.Core.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. + */ + this.customEnvironment = GetValue(config, 'customEnvironment', false); + + /** + * @const {?object} Phaser.Core.Config#sceneConfig - The default Scene configuration object. + */ + this.sceneConfig = GetValue(config, 'scene', null); + + /** + * @const {string[]} Phaser.Core.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. + */ + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + + PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); + + /** + * @const {string} Phaser.Core.Config#gameTitle - The title of the game. + */ + this.gameTitle = GetValue(config, 'title', ''); + + /** + * @const {string} Phaser.Core.Config#gameURL - The URL of the game. + */ + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); + + /** + * @const {string} Phaser.Core.Config#gameVersion - The version of the game. + */ + this.gameVersion = GetValue(config, 'version', ''); + + /** + * @const {boolean} Phaser.Core.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. + */ + this.autoFocus = GetValue(config, 'autoFocus', true); + + // DOM Element Container + + /** + * @const {?boolean} Phaser.Core.Config#domCreateContainer - EXPERIMENTAL: Do not currently use. + */ + this.domCreateContainer = GetValue(config, 'dom.createContainer', false); + + /** + * @const {?boolean} Phaser.Core.Config#domBehindCanvas - EXPERIMENTAL: Do not currently use. + */ + this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); + + // Input + + /** + * @const {boolean} Phaser.Core.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. + */ + this.inputKeyboard = GetValue(config, 'input.keyboard', true); + + /** + * @const {*} Phaser.Core.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. + */ + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + + /** + * @const {?integer[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + */ + this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); + + /** + * @const {(boolean|object)} Phaser.Core.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. + */ + this.inputMouse = GetValue(config, 'input.mouse', true); + + /** + * @const {?*} Phaser.Core.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. + */ + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. + */ + this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + + /** + * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. + */ + this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); + + /** + * @const {?*} Phaser.Core.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. + */ + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. + */ + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + + /** + * @const {integer} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + */ + this.inputActivePointers = GetValue(config, 'input.activePointers', 1); + + /** + * @const {integer} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + */ + this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); + + /** + * @const {boolean} Phaser.Core.Config#inputQueue - Should Phaser use a queued input system for native DOM Events or not? + */ + this.inputQueue = GetValue(config, 'input.queue', false); + + /** + * @const {boolean} Phaser.Core.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. + */ + this.inputGamepad = GetValue(config, 'input.gamepad', false); + + /** + * @const {*} Phaser.Core.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. + */ + this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); + + /** + * @const {boolean} Phaser.Core.Config#disableContextMenu - Set to `true` to disable the right-click context menu. + */ + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + + /** + * @const {AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. + */ + this.audio = GetValue(config, 'audio'); + + // If you do: { banner: false } it won't display any banner at all + + /** + * @const {boolean} Phaser.Core.Config#hideBanner - Don't write the banner line to the console.log. + */ + this.hideBanner = (GetValue(config, 'banner', null) === false); + + /** + * @const {boolean} Phaser.Core.Config#hidePhaser - Omit Phaser's name and version from the banner. + */ + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + + /** + * @const {string} Phaser.Core.Config#bannerTextColor - The color of the banner text. + */ + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + + /** + * @const {string[]} Phaser.Core.Config#bannerBackgroundColor - The background colors of the banner. + */ + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } + + /** + * @const {?FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + */ + this.fps = GetValue(config, 'fps', null); + + // Renderer Settings + // These can either be in a `render` object within the Config, or specified on their own + + var renderConfig = GetValue(config, 'render', config); + + /** + * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + */ + this.antialias = GetValue(renderConfig, 'antialias', true); + + /** + * @const {boolean} Phaser.Core.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + */ + this.roundPixels = GetValue(renderConfig, 'roundPixels', false); + + /** + * @const {boolean} Phaser.Core.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). + */ + this.pixelArt = GetValue(renderConfig, 'pixelArt', this.zoom !== 1); + + if (this.pixelArt) + { + this.antialias = false; + this.roundPixels = true; + } + + /** + * @const {boolean} Phaser.Core.Config#transparent - Whether the game canvas will have a transparent background. + */ + this.transparent = GetValue(renderConfig, 'transparent', false); + + /** + * @const {boolean} Phaser.Core.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. + */ + this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); + + /** + * @const {boolean} Phaser.Core.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. + */ + this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); + + /** + * @const {boolean} Phaser.Core.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + */ + this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); + + /** + * @const {string} Phaser.Core.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + */ + this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); + + /** + * @const {integer} Phaser.Core.Config#batchSize - The default WebGL Batch size. + */ + this.batchSize = GetValue(renderConfig, 'batchSize', 2000); + + /** + * @const {integer} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + this.maxLights = GetValue(renderConfig, 'maxLights', 10); + + var bgc = GetValue(config, 'backgroundColor', 0); + + /** + * @const {Phaser.Display.Color} Phaser.Core.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. + */ + this.backgroundColor = ValueToColor(bgc); + + if (bgc === 0 && this.transparent) + { + this.backgroundColor.alpha = 0; + } + + /** + * @const {BootCallback} Phaser.Core.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. + */ + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); + + /** + * @const {BootCallback} Phaser.Core.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + + /** + * @const {PhysicsConfig} Phaser.Core.Config#physics - The Physics Configuration object. + */ + this.physics = GetValue(config, 'physics', {}); + + /** + * @const {(boolean|string)} Phaser.Core.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. + */ + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + + /** + * @const {string} Phaser.Core.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + */ + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + */ + this.loaderPath = GetValue(config, 'loader.path', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + */ + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); + + /** + * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + */ + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + + /** + * @const {string} Phaser.Core.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. + */ + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + + /** + * @const {boolean} Phaser.Core.Config#loaderAsync - Should the XHR request use async or not? + */ + this.loaderAsync = GetValue(config, 'loader.async', true); + + /** + * @const {string} Phaser.Core.Config#loaderUser - Optional username for all XHR requests. + */ + this.loaderUser = GetValue(config, 'loader.user', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPassword - Optional password for all XHR requests. + */ + this.loaderPassword = GetValue(config, 'loader.password', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + */ + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + + /* + * Allows `plugins` property to either be an array, in which case it just replaces + * the default plugins like previously, or a config object. + * + * plugins: { + * global: [ + * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, + * ], + * scene: [ + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + * ], + * default: [], OR + * defaultMerge: [ + * 'ModPlayer' + * ] + * } + */ + + /** + * @const {any} Phaser.Core.Config#installGlobalPlugins - An array of global plugins to be installed. + */ + this.installGlobalPlugins = []; + + /** + * @const {any} Phaser.Core.Config#installScenePlugins - An array of Scene level plugins to be installed. + */ + this.installScenePlugins = []; + + var plugins = GetValue(config, 'plugins', null); + var defaultPlugins = DefaultPlugins.DefaultScene; + + if (plugins) + { + // Old 3.7 array format? + if (Array.isArray(plugins)) + { + this.defaultPlugins = plugins; + } + else if (IsPlainObject(plugins)) + { + this.installGlobalPlugins = GetFastValue(plugins, 'global', []); + this.installScenePlugins = GetFastValue(plugins, 'scene', []); + + if (Array.isArray(plugins.default)) + { + defaultPlugins = plugins.default; + } + else if (Array.isArray(plugins.defaultMerge)) + { + defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); + } + } + } + + /** + * @const {any} Phaser.Core.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). + */ + this.defaultPlugins = defaultPlugins; + + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + + /** + * @const {string} Phaser.Core.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. + */ + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + + /** + * @const {string} Phaser.Core.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. + */ + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + + if (window) + { + if (window.FORCE_WEBGL) + { + this.renderType = CONST.WEBGL; + } + else if (window.FORCE_CANVAS) + { + this.renderType = CONST.CANVAS; + } + } + } + +}); + +module.exports = Config; + + +/***/ }), +/* 429 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Stepped + */ + +module.exports = __webpack_require__(1206); + + +/***/ }), +/* 430 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104062,20 +112911,20 @@ module.exports = __webpack_require__(1024); module.exports = { - In: __webpack_require__(1027), - Out: __webpack_require__(1026), - InOut: __webpack_require__(1025) + In: __webpack_require__(1209), + Out: __webpack_require__(1208), + InOut: __webpack_require__(1207) }; /***/ }), -/* 396 */ +/* 431 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104085,20 +112934,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1030), - Out: __webpack_require__(1029), - InOut: __webpack_require__(1028) + In: __webpack_require__(1212), + Out: __webpack_require__(1211), + InOut: __webpack_require__(1210) }; /***/ }), -/* 397 */ +/* 432 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104108,20 +112957,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1033), - Out: __webpack_require__(1032), - InOut: __webpack_require__(1031) + In: __webpack_require__(1215), + Out: __webpack_require__(1214), + InOut: __webpack_require__(1213) }; /***/ }), -/* 398 */ +/* 433 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104131,20 +112980,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1036), - Out: __webpack_require__(1035), - InOut: __webpack_require__(1034) + In: __webpack_require__(1218), + Out: __webpack_require__(1217), + InOut: __webpack_require__(1216) }; /***/ }), -/* 399 */ +/* 434 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104152,16 +113001,16 @@ module.exports = { * @namespace Phaser.Math.Easing.Linear */ -module.exports = __webpack_require__(1037); +module.exports = __webpack_require__(1219); /***/ }), -/* 400 */ +/* 435 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104171,20 +113020,20 @@ module.exports = __webpack_require__(1037); module.exports = { - In: __webpack_require__(1040), - Out: __webpack_require__(1039), - InOut: __webpack_require__(1038) + In: __webpack_require__(1222), + Out: __webpack_require__(1221), + InOut: __webpack_require__(1220) }; /***/ }), -/* 401 */ +/* 436 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104194,20 +113043,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1043), - Out: __webpack_require__(1042), - InOut: __webpack_require__(1041) + In: __webpack_require__(1225), + Out: __webpack_require__(1224), + InOut: __webpack_require__(1223) }; /***/ }), -/* 402 */ +/* 437 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104217,20 +113066,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1046), - Out: __webpack_require__(1045), - InOut: __webpack_require__(1044) + In: __webpack_require__(1228), + Out: __webpack_require__(1227), + InOut: __webpack_require__(1226) }; /***/ }), -/* 403 */ +/* 438 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104240,20 +113089,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1049), - Out: __webpack_require__(1048), - InOut: __webpack_require__(1047) + In: __webpack_require__(1231), + Out: __webpack_require__(1230), + InOut: __webpack_require__(1229) }; /***/ }), -/* 404 */ +/* 439 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104263,20 +113112,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1052), - Out: __webpack_require__(1051), - InOut: __webpack_require__(1050) + In: __webpack_require__(1234), + Out: __webpack_require__(1233), + InOut: __webpack_require__(1232) }; /***/ }), -/* 405 */ +/* 440 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104286,20 +113135,20 @@ module.exports = { module.exports = { - In: __webpack_require__(1055), - Out: __webpack_require__(1054), - InOut: __webpack_require__(1053) + In: __webpack_require__(1237), + Out: __webpack_require__(1236), + InOut: __webpack_require__(1235) }; /***/ }), -/* 406 */ +/* 441 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104309,26 +113158,26 @@ module.exports = { module.exports = { - Fade: __webpack_require__(1058), - Flash: __webpack_require__(1057), - Pan: __webpack_require__(1056), - Shake: __webpack_require__(1023), - Zoom: __webpack_require__(1022) + Fade: __webpack_require__(1240), + Flash: __webpack_require__(1239), + Pan: __webpack_require__(1238), + Shake: __webpack_require__(1205), + Zoom: __webpack_require__(1204) }; /***/ }), -/* 407 */ +/* 442 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(41); +var Color = __webpack_require__(37); /** * Converts a CSS 'web' string into a Phaser Color object. @@ -104365,16 +113214,16 @@ module.exports = RGBStringToColor; /***/ }), -/* 408 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(41); +var Color = __webpack_require__(37); /** * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. @@ -104395,12 +113244,12 @@ module.exports = ObjectToColor; /***/ }), -/* 409 */ +/* 444 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104443,17 +113292,17 @@ module.exports = IntegerToRGB; /***/ }), -/* 410 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(41); -var IntegerToRGB = __webpack_require__(409); +var Color = __webpack_require__(37); +var IntegerToRGB = __webpack_require__(444); /** * Converts the given color value into an instance of a Color object. @@ -104476,12 +113325,12 @@ module.exports = IntegerToColor; /***/ }), -/* 411 */ +/* 446 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104564,12 +113413,12 @@ module.exports = RGBToHSV; /***/ }), -/* 412 */ +/* 447 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104595,16 +113444,16 @@ module.exports = GetColor32; /***/ }), -/* 413 */ +/* 448 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(41); +var Color = __webpack_require__(37); /** * Converts a hex string into a Phaser Color object. @@ -104648,24 +113497,24 @@ module.exports = HexStringToColor; /***/ }), -/* 414 */ +/* 449 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(131); +var BaseCamera = __webpack_require__(141); var CanvasPool = __webpack_require__(26); -var CenterOn = __webpack_require__(193); +var CenterOn = __webpack_require__(209); var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(16); -var Effects = __webpack_require__(406); -var Linear = __webpack_require__(129); -var Rectangle = __webpack_require__(10); +var Components = __webpack_require__(14); +var Effects = __webpack_require__(441); +var Linear = __webpack_require__(139); +var Rectangle = __webpack_require__(11); var Vector2 = __webpack_require__(3); /** @@ -104897,7 +113746,7 @@ var Camera = new Class({ * * This is only set if Phaser is running with the WebGL Renderer. * - * @name Phaser.Cameras.Scene2D.Camera#framebuffer + * @name Phaser.Cameras.Scene2D.Camera#glTexture * @type {?WebGLTexture} * @since 3.13.0 */ @@ -105139,6 +113988,8 @@ var Camera = new Class({ * Fades the Camera in from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeIn + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -105161,6 +114012,8 @@ var Camera = new Class({ * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades. * * @method Phaser.Cameras.Scene2D.Camera#fadeOut + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -105182,6 +114035,8 @@ var Camera = new Class({ * Fades the Camera from the given color to transparent over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeFrom + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.5.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -105204,6 +114059,8 @@ var Camera = new Class({ * Fades the Camera from transparent to the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fade + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.0.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -105226,6 +114083,8 @@ var Camera = new Class({ * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#flash + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.0.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -105248,6 +114107,8 @@ var Camera = new Class({ * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#shake + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.0.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -105269,13 +114130,15 @@ var Camera = new Class({ * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#pan + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -105292,12 +114155,14 @@ var Camera = new Class({ * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#zoomTo + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -105317,10 +114182,9 @@ var Camera = new Class({ * @protected * @since 3.0.0 * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. + * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (baseScale, resolution) + preRender: function (resolution) { var width = this.width; var height = this.height; @@ -105328,7 +114192,7 @@ var Camera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * baseScale; + var zoom = this.zoom * resolution; var matrix = this.matrix; var originX = width * this.originX; @@ -105410,11 +114274,7 @@ var Camera = new Class({ displayHeight ); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); this.shakeEffect.preRender(); @@ -105614,17 +114474,18 @@ module.exports = Camera; /***/ }), -/* 415 */ +/* 450 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCache = __webpack_require__(416); +var BaseCache = __webpack_require__(452); var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(28); /** * @classdesc @@ -105768,7 +114629,7 @@ var CacheManager = new Class({ */ this.custom = {}; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -105837,18 +114698,41 @@ module.exports = CacheManager; /***/ }), -/* 416 */ +/* 451 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cache.Events + */ + +module.exports = { + + ADD: __webpack_require__(1262), + REMOVE: __webpack_require__(1261) + +}; + + +/***/ }), +/* 452 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(198); -var EventEmitter = __webpack_require__(11); +var CustomMap = __webpack_require__(214); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(451); /** * @classdesc @@ -105890,23 +114774,12 @@ var BaseCache = new Class({ this.events = new EventEmitter(); }, - /** - * 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} cache - The BaseCache to which the object was added. - * @param {string} key - The key of the object added to the cache. - * @param {*} object - 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 + * @fires Phaser.Cache.Events#ADD * @since 3.0.0 * * @param {string} key - The unique key by which the data added to the cache will be referenced. @@ -105918,7 +114791,7 @@ var BaseCache = new Class({ { this.entries.set(key, data); - this.events.emit('add', this, key, data); + this.events.emit(Events.ADD, this, key, data); return this; }, @@ -105970,17 +114843,6 @@ var BaseCache = new Class({ 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} cache - The BaseCache from which the object was removed. - * @param {string} key - The key of the object removed from the cache. - * @param {*} object - The object that was removed from the cache. - */ - /** * Removes and item from this cache based on the given key. * @@ -105989,7 +114851,7 @@ var BaseCache = new Class({ * 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 + * @fires Phaser.Cache.Events#REMOVE * @since 3.0.0 * * @param {string} key - The unique key of the item to remove from the cache. @@ -106004,7 +114866,7 @@ var BaseCache = new Class({ { this.entries.delete(key); - this.events.emit('remove', this, key, entry.data); + this.events.emit(Events.REMOVE, this, key, entry.data); } return this; @@ -106031,28 +114893,23 @@ module.exports = BaseCache; /***/ }), -/* 417 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Animation = __webpack_require__(420); +var Animation = __webpack_require__(226); var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(198); -var EventEmitter = __webpack_require__(11); +var CustomMap = __webpack_require__(214); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(146); +var GameEvents = __webpack_require__(28); var GetValue = __webpack_require__(4); -var Pad = __webpack_require__(197); - -/** - * @typedef {object} JSONAnimationManager - * - * @property {JSONAnimation[]} anims - [description] - * @property {number} globalTimeScale - [description] - */ +var Pad = __webpack_require__(213); /** * @classdesc @@ -106103,7 +114960,9 @@ var AnimationManager = new Class({ this.textureManager = null; /** - * [description] + * The global time scale of the Animation Manager. + * + * This scales the time delta between two frames, thus influencing the speed of time for the Animation Manager. * * @name Phaser.Animations.AnimationManager#globalTimeScale * @type {number} @@ -106113,7 +114972,9 @@ var AnimationManager = new Class({ this.globalTimeScale = 1; /** - * [description] + * The Animations registered in the Animation Manager. + * + * This map should be modified with the {@link #add} and {@link #create} methods of the Animation Manager. * * @name Phaser.Animations.AnimationManager#anims * @type {Phaser.Structs.Map.} @@ -106123,7 +114984,7 @@ var AnimationManager = new Class({ this.anims = new CustomMap(); /** - * [description] + * Whether the Animation Manager is paused along with all of its Animations. * * @name Phaser.Animations.AnimationManager#paused * @type {boolean} @@ -106133,7 +114994,7 @@ var AnimationManager = new Class({ this.paused = false; /** - * [description] + * The name of this Animation Manager. * * @name Phaser.Animations.AnimationManager#name * @type {string} @@ -106141,31 +115002,32 @@ var AnimationManager = new Class({ */ this.name = 'AnimationManager'; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** - * [description] + * Registers event listeners after the Game boots. * * @method Phaser.Animations.AnimationManager#boot + * @listens Phaser.Core.Events#DESTROY * @since 3.0.0 */ boot: function () { this.textureManager = this.game.textures; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * [description] + * Adds an existing Animation to the Animation Manager. * * @method Phaser.Animations.AnimationManager#add - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {string} key - [description] - * @param {Phaser.Animations.Animation} animation - [description] + * @param {string} key - The key under which the Animation should be added. The Animation will be updated with it. Must be unique. + * @param {Phaser.Animations.Animation} animation - The Animation which should be added to the Animation Manager. * * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ @@ -106173,7 +115035,8 @@ var AnimationManager = new Class({ { if (this.anims.has(key)) { - console.warn('Animation with key', key, 'already exists'); + console.warn('Animation key exists: ' + key); + return; } @@ -106181,48 +115044,79 @@ var AnimationManager = new Class({ this.anims.set(key, animation); - this.emit('add', key, animation); + this.emit(Events.ADD_ANIMATION, key, animation); return this; }, /** - * [description] + * Checks to see if the given key is already in use within the Animation Manager or not. + * + * Animations are global. Keys created in one scene can be used from any other Scene in your game. They are not Scene specific. + * + * @method Phaser.Animations.AnimationManager#exists + * @since 3.16.0 + * + * @param {string} key - The key of the Animation to check. + * + * @return {boolean} `true` if the Animation already exists in the Animation Manager, or `false` if the key is available. + */ + exists: function (key) + { + return this.anims.has(key); + }, + + /** + * Creates a new Animation and adds it to the Animation Manager. + * + * Animations are global. Once created, you can use them in any Scene in your game. They are not Scene specific. + * + * If an invalid key is given this method will return `false`. + * + * If you pass the key of an animation that already exists in the Animation Manager, that animation will be returned. + * + * A brand new animation is only created if the key is valid and not already in use. + * + * If you wish to re-use an existing key, call `AnimationManager.remove` first, then this method. * * @method Phaser.Animations.AnimationManager#create - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {AnimationConfig} config - [description] + * @param {Phaser.Animations.Types.Animation} config - The configuration settings for the Animation. * - * @return {Phaser.Animations.Animation} The Animation that was created. + * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` is the key is already in use. */ create: function (config) { var key = config.key; - if (!key || this.anims.has(key)) + var anim = false; + + if (key) { - console.warn('Invalid Animation Key, or Key already in use: ' + key); - return; + anim = this.get(key); + + if (!anim) + { + anim = new Animation(this, key, config); + + this.anims.set(key, anim); + + this.emit(Events.ADD_ANIMATION, key, anim); + } } - var anim = new Animation(this, key, config); - - this.anims.set(key, anim); - - this.emit('add', key, anim); - return anim; }, /** - * [description] + * Loads this Animation Manager's Animations and settings from a JSON object. * * @method Phaser.Animations.AnimationManager#fromJSON * @since 3.0.0 * - * @param {(string|JSONAnimationManager|JSONAnimation)} data - [description] + * @param {(string|Phaser.Animations.Types.JSONAnimations|Phaser.Animations.Types.JSONAnimation)} data - The JSON object to parse. * @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added. * * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. @@ -106266,29 +115160,15 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNamesConfig - * - * @property {string} [prefix=''] - [description] - * @property {integer} [start=0] - [description] - * @property {integer} [end=0] - [description] - * @property {string} [suffix=''] - [description] - * @property {integer} [zeroPad=0] - [description] - * @property {AnimationFrameConfig[]} [outputArray=[]] - [description] - * @property {boolean} [frames=false] - [description] - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with string frame names, as configured by the given {@link AnimationFrameConfig}. + * [description] * * @method Phaser.Animations.AnimationManager#generateFrameNames * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNamesConfig} [config] - The configuration object for the animation frame names. + * @param {Phaser.Animations.Types.GenerateFrameNames} [config] - The configuration object for the animation frame names. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNames: function (key, config) { @@ -106355,27 +115235,17 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNumbersConfig + * Generate an array of {@link Phaser.Animations.Types.AnimationFrame} objects from a texture key and configuration object. * - * @property {integer} [start=0] - The starting frame of the animation. - * @property {integer} [end=-1] - The ending frame of the animation. - * @property {(boolean|integer)} [first=false] - A frame to put at the beginning of the animation, before `start` or `outputArray` or `frames`. - * @property {AnimationFrameConfig[]} [outputArray=[]] - An array to concatenate the output onto. - * @property {(boolean|integer[])} [frames=false] - A custom sequence of frames. - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with numbered frame names, as configured by the given {@link GenerateFrameNumbersConfig}. + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Animations.Types.GenerateFrameNumbers}. * * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNumbersConfig} config - The configuration object for the animation frames. + * @param {Phaser.Animations.Types.GenerateFrameNumbers} config - The configuration object for the animation frames. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNumbers: function (key, config) { @@ -106455,7 +115325,7 @@ var AnimationManager = new Class({ * @param {string} key - The key of the animation to load. * @param {(string|integer)} [startFrame] - The name of a start frame to set on the loaded animation. * - * @return {Phaser.GameObjects.GameObject} [description] + * @return {Phaser.GameObjects.GameObject} The Game Object with the animation loaded into it. */ load: function (child, key, startFrame) { @@ -106473,7 +115343,7 @@ var AnimationManager = new Class({ * Pause all animations. * * @method Phaser.Animations.AnimationManager#pauseAll - * @fires PauseAllAnimationEvent + * @fires Phaser.Animations.Events#PAUSE_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -106484,7 +115354,7 @@ var AnimationManager = new Class({ { this.paused = true; - this.emit('pauseall'); + this.emit(Events.PAUSE_ALL); } return this; @@ -106527,7 +115397,7 @@ var AnimationManager = new Class({ * Remove an animation. * * @method Phaser.Animations.AnimationManager#remove - * @fires RemoveAnimationEvent + * @fires Phaser.Animations.Events#REMOVE_ANIMATION * @since 3.0.0 * * @param {string} key - The key of the animation to remove. @@ -106540,7 +115410,7 @@ var AnimationManager = new Class({ if (anim) { - this.emit('remove', key, anim); + this.emit(Events.REMOVE_ANIMATION, key, anim); this.anims.delete(key); } @@ -106552,7 +115422,7 @@ var AnimationManager = new Class({ * Resume all paused animations. * * @method Phaser.Animations.AnimationManager#resumeAll - * @fires ResumeAllAnimationEvent + * @fires Phaser.Animations.Events#RESUME_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -106563,7 +115433,7 @@ var AnimationManager = new Class({ { this.paused = false; - this.emit('resumeall'); + this.emit(Events.RESUME_ALL); } return this; @@ -106610,14 +115480,14 @@ var AnimationManager = new Class({ }, /** - * [description] + * Get the animation data as javascript object by giving key, or get the data of all animations as array of objects, if key wasn't provided. * * @method Phaser.Animations.AnimationManager#toJSON * @since 3.0.0 * * @param {string} key - [description] * - * @return {JSONAnimationManager} [description] + * @return {Phaser.Animations.Types.JSONAnimations} [description] */ toJSON: function (key) { @@ -106642,7 +115512,8 @@ var AnimationManager = new Class({ }, /** - * [description] + * Destroy this Animation Manager and clean up animation definitions and references to other objects. + * This method should not be called directly. It will be called automatically as a response to a `destroy` event from the Phaser.Game instance. * * @method Phaser.Animations.AnimationManager#destroy * @since 3.0.0 @@ -106662,1241 +115533,12 @@ module.exports = AnimationManager; /***/ }), -/* 418 */ -/***/ (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); - -/** - * @typedef {object} JSONAnimationFrame - * - * @property {string} key - The key of the Texture this AnimationFrame uses. - * @property {(string|integer)} frame - The key of the Frame within the Texture that this AnimationFrame uses. - * @property {number} duration - Additional time (in ms) that this frame should appear for during playback. - */ - -/** - * @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({ - - initialize: - - 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; - - /** - * 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; - - /** - * The index of this AnimationFrame within the Animation sequence. - * - * @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; - - /** - * 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; - }, - - /** - * Generates a JavaScript object suitable for converting to JSON. - * - * @method Phaser.Animations.AnimationFrame#toJSON - * @since 3.0.0 - * - * @return {JSONAnimationFrame} 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; - } - -}); - -module.exports = AnimationFrame; - - -/***/ }), -/* 419 */ +/* 454 */ /***/ (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.Array.FindClosestInSorted - * @since 3.0.0 - * - * @param {number} value - The value to search for in the array. - * @param {array} array - The array to search, which must be sorted. - * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. - * - * @return {number|object} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. - */ -var FindClosestInSorted = function (value, array, key) -{ - if (!array.length) - { - return NaN; - } - else if (array.length === 1) - { - return array[0]; - } - - var i = 1; - var low; - var high; - - if (key) - { - if (value < array[0][key]) - { - return array[0]; - } - - while (array[i][key] < value) - { - i++; - } - } - else - { - while (array[i] < value) - { - i++; - } - } - - if (i > array.length) - { - i = array.length; - } - - if (key) - { - low = array[i - 1][key]; - high = array[i][key]; - - return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; - } - else - { - low = array[i - 1]; - high = array[i]; - - return ((high - value) <= (value - low)) ? high : low; - } -}; - -module.exports = FindClosestInSorted; - - -/***/ }), -/* 420 */ -/***/ (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 Clamp = __webpack_require__(24); -var Class = __webpack_require__(0); -var FindClosestInSorted = __webpack_require__(419); -var Frame = __webpack_require__(418); -var GetValue = __webpack_require__(4); - -/** - * @typedef {object} JSONAnimation - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {string} type - A frame based animation (as opposed to a bone based animation) - * @property {JSONAnimationFrame[]} frames - [description] - * @property {integer} frameRate - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} duration - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} skipMissedFrames - Skip frames if the time lags, or always advanced anyway? - * @property {integer} delay - Delay before starting playback. Value given in milliseconds. - * @property {integer} repeat - Number of times to repeat the animation (-1 for infinity) - * @property {integer} repeatDelay - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} yoyo - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} showOnStart - Should sprite.visible = true when the animation starts to play? - * @property {boolean} hideOnComplete - Should sprite.visible = false when the animation finishes? - */ - -/** - * @typedef {object} AnimationFrameConfig - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {(string|number)} frame - [description] - * @property {number} [duration=0] - [description] - * @property {boolean} [visible] - [description] - */ - -/** - * @typedef {object} AnimationConfig - * - * @property {string} [key] - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {AnimationFrameConfig[]} [frames] - An object containing data used to generate the frames for the animation - * @property {string} [defaultTextureKey=null] - The key of the texture all frames of the animation will use. Can be overridden on a per frame basis. - * @property {integer} [frameRate] - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} [duration] - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} [skipMissedFrames=true] - Skip frames if the time lags, or always advanced anyway? - * @property {integer} [delay=0] - Delay before starting playback. Value given in milliseconds. - * @property {integer} [repeat=0] - Number of times to repeat the animation (-1 for infinity) - * @property {integer} [repeatDelay=0] - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? - * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? - */ - -/** - * @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. - * - * @class Animation - * @memberof Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationManager} manager - [description] - * @param {string} key - [description] - * @param {AnimationConfig} config - [description] - */ -var Animation = new Class({ - - initialize: - - function Animation (manager, key, config) - { - /** - * A reference to the global Animation Manager - * - * @name Phaser.Animations.Animation#manager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.manager = manager; - - /** - * The unique identifying string for this animation - * - * @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 {Phaser.Animations.AnimationFrame[]} - * @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, in milliseconds. - * If the `frameRate` property has been set then it overrides this value, - * otherwise the `frameRate` is derived from `duration`. - * - * @name Phaser.Animations.Animation#duration - * @type {integer} - * @since 3.0.0 - */ - 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) * 1000; - } - 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 = 4000 ms - // So frameRate is 12 / (4000 / 1000) = 3 fps - this.frameRate = this.frames.length / (this.duration / 1000); - } - 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 * 1000 (half a second, or 500ms) - this.duration = (this.frames.length / this.frameRate) * 1000; - } - - /** - * How many ms per frame, not including frame specific modifiers. - * - * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} - * @since 3.0.0 - */ - this.msPerFrame = 1000 / this.frameRate; - - /** - * 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); - - /** - * The delay in ms before the playback will begin. - * - * @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. Set to -1 to repeat forever. - * - * @name Phaser.Animations.Animation#repeat - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeat = GetValue(config, 'repeat', 0); - - /** - * The delay in ms before the a repeat playthrough starts. - * - * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = GetValue(config, 'repeatDelay', 0); - - /** - * 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); - - /** - * 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); - - /** - * 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); - - /** - * Global pause. All Game Objects using this Animation instance are impacted by this property. - * - * @name Phaser.Animations.Animation#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - this.manager.on('pauseall', this.pause, this); - this.manager.on('resumeall', this.resume, this); - }, - - /** - * Add frames to the end of the animation. - * - * @method Phaser.Animations.Animation#addFrame - * @since 3.0.0 - * - * @param {(string|AnimationFrameConfig[])} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrame: function (config) - { - return this.addFrameAt(this.frames.length, config); - }, - - /** - * Add frame/s into the animation. - * - * @method Phaser.Animations.Animation#addFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * @param {(string|AnimationFrameConfig[])} 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); - } - - this.updateFrameSequence(); - } - - return this; - }, - - /** - * Check if the given frame index is valid. - * - * @method Phaser.Animations.Animation#checkFrame - * @since 3.0.0 - * - * @param {integer} index - The index to be checked. - * - * @return {boolean} `true` if the index is valid, otherwise `false`. - */ - checkFrame: function (index) - { - return (index >= 0 && index < this.frames.length); - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#completeAnimation - * @protected - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - completeAnimation: function (component) - { - if (this.hideOnComplete) - { - component.parent.visible = false; - } - - component.stop(); - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#getFirstTick - * @protected - * @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) - { - component.nextTick += component._delay; - } - }, - - /** - * Returns the AnimationFrame at the provided index - * - * @method Phaser.Animations.Animation#getFrameAt - * @protected - * @since 3.0.0 - * - * @param {integer} index - The index in the AnimationFrame array - * - * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence - */ - getFrameAt: function (index) - { - return this.frames[index]; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#getFrames - * @since 3.0.0 - * - * @param {Phaser.Textures.TextureManager} textureManager - [description] - * @param {(string|AnimationFrameConfig[])} frames - [description] - * @param {string} [defaultTextureKey] - [description] - * - * @return {Phaser.Animations.AnimationFrame[]} [description] - */ - getFrames: function (textureManager, frames, defaultTextureKey) - { - 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.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.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 - - // When is the next update due? - component.accumulator -= component.nextTick; - - component.nextTick = component.msPerFrame + component.currentFrame.duration; - }, - - /** - * Loads the Animation values into the Animation Component. - * - * @method Phaser.Animations.Animation#load - * @private - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to load values into. - * @param {integer} startFrame - The start frame of the animation to load. - */ - load: function (component, startFrame) - { - if (startFrame >= this.frames.length) - { - startFrame = 0; - } - - if (component.currentAnim !== this) - { - component.currentAnim = this; - - 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; - } - - var frame = this.frames[startFrame]; - - if (startFrame === 0 && !component.forward) - { - frame = this.getLastFrame(); - } - - component.updateFrame(frame); - }, - - /** - * Returns the frame closest to the given progress value between 0 and 1. - * - * @method Phaser.Animations.Animation#getFrameByProgress - * @since 3.4.0 - * - * @param {number} value - A value between 0 and 1. - * - * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. - */ - getFrameByProgress: function (value) - { - value = Clamp(value, 0, 1); - - return FindClosestInSorted(value, this.frames, 'progress'); - }, - - /** - * Advance the animation frame. - * - * @method Phaser.Animations.Animation#nextFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. - */ - nextFrame: function (component) - { - var frame = component.currentFrame; - - // TODO: Add frame skip support - - if (frame.isLast) - { - // We're at the end of the animation - - // Yoyo? (happens before repeat) - if (component._yoyo) - { - this.handleYoyoFrame(component, false); - } - else if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - - if (component._reverse && component.forward) - { - component.forward = false; - } - else - { - this.repeatAnimation(component); - } - } - else - { - this.completeAnimation(component); - } - } - else - { - this.updateAndGetNextTick(component, frame.nextFrame); - } - }, - - /** - * Handle the yoyo functionality in nextFrame and previousFrame methods. - * - * @method Phaser.Animations.Animation#handleYoyoFrame - * @private - * @since 3.12.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. - * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) - */ - handleYoyoFrame: function (component, isReverse) - { - if (!isReverse) { isReverse = false; } - - if (component._reverse === !isReverse && component.repeatCounter > 0) - { - component.forward = isReverse; - - this.repeatAnimation(component); - - return; - } - - if (component._reverse !== isReverse && component.repeatCounter === 0) - { - this.completeAnimation(component); - - return; - } - - component.forward = isReverse; - - var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; - - this.updateAndGetNextTick(component, frame); - }, - - /** - * Returns the animation last frame. - * - * @method Phaser.Animations.Animation#getLastFrame - * @since 3.12.0 - * - * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. - */ - getLastFrame: function () - { - return this.frames[this.frames.length - 1]; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#previousFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - previousFrame: function (component) - { - var frame = component.currentFrame; - - // TODO: Add frame skip support - - if (frame.isFirst) - { - // We're at the start of the animation - - if (component._yoyo) - { - this.handleYoyoFrame(component, true); - } - else if (component.repeatCounter > 0) - { - if (component._reverse && !component.forward) - { - component.currentFrame = this.getLastFrame(); - this.repeatAnimation(component); - } - else - { - // Repeat (happens before complete) - component.forward = true; - this.repeatAnimation(component); - } - } - else - { - this.completeAnimation(component); - } - } - else - { - this.updateAndGetNextTick(component, frame.prevFrame); - } - }, - - /** - * Update Frame and Wait next tick. - * - * @method Phaser.Animations.Animation#updateAndGetNextTick - * @private - * @since 3.12.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. - */ - updateAndGetNextTick: function (component, frame) - { - component.updateFrame(frame); - - this.getNextTick(component); - }, - - /** - * [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); - } - - return this; - }, - - /** - * Removes a frame from the AnimationFrame array at the provided index - * and updates the animation accordingly. - * - * @method Phaser.Animations.Animation#removeFrameAt - * @since 3.0.0 - * - * @param {integer} index - The index in the AnimationFrame array - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrameAt: function (index) - { - this.frames.splice(index, 1); - - this.updateFrameSequence(); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#repeatAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - repeatAnimation: function (component) - { - if (component._pendingStop === 2) - { - return this.completeAnimation(component); - } - - if (component._repeatDelay > 0 && component.pendingRepeat === false) - { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += component._repeatDelay; - } - else - { - component.repeatCounter--; - - component.updateFrame(component.currentFrame[(component.forward) ? 'nextFrame' : 'prevFrame']); - - if (component.isPlaying) - { - this.getNextTick(component); - - component.pendingRepeat = false; - - component.parent.emit('animationrepeat', this, component.currentFrame, component.repeatCounter, component.parent); - } - } - }, - - /** - * [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 {JSONAnimation} [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; - }, - - /** - * [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); - - 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; - }, - - /** - * [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 () - { - this.manager.off('pauseall', this.pause, this); - this.manager.off('resumeall', this.resume, this); - - this.manager.remove(this.key); - - for (var i = 0; i < this.frames.length; i++) - { - this.frames[i].destroy(); - } - - this.frames = []; - - this.manager = null; - } - -}); - -module.exports = Animation; - - -/***/ }), -/* 421 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -107965,12 +115607,12 @@ module.exports = BresenhamPoints; /***/ }), -/* 422 */ +/* 455 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -108005,12 +115647,12 @@ module.exports = RotateRight; /***/ }), -/* 423 */ +/* 456 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -108045,16 +115687,16 @@ module.exports = RotateLeft; /***/ }), -/* 424 */ +/* 457 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(134); +var Perimeter = __webpack_require__(145); var Point = __webpack_require__(6); // Return an array of points from the perimeter of the rectangle @@ -108165,12 +115807,36 @@ module.exports = MarchingAnts; /***/ }), -/* 425 */ +/* 458 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data.Events + */ + +module.exports = { + + CHANGE_DATA: __webpack_require__(1325), + CHANGE_DATA_KEY: __webpack_require__(1324), + REMOVE_DATA: __webpack_require__(1323), + SET_DATA: __webpack_require__(1322) + +}; + + +/***/ }), +/* 459 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -108254,19 +115920,19 @@ module.exports = Visible; /***/ }), -/* 426 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(18); -var TransformMatrix = __webpack_require__(42); -var WrapAngle = __webpack_require__(205); -var WrapAngleDegrees = __webpack_require__(204); +var MATH_CONST = __webpack_require__(20); +var TransformMatrix = __webpack_require__(46); +var WrapAngle = __webpack_require__(221); +var WrapAngleDegrees = __webpack_require__(220); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -108517,8 +116183,8 @@ var Transform = { { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } this.x = x + (Math.random() * width); this.y = y + (Math.random() * height); @@ -108722,12 +116388,12 @@ module.exports = Transform; /***/ }), -/* 427 */ +/* 461 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -108809,12 +116475,12 @@ module.exports = ToJSON; /***/ }), -/* 428 */ +/* 462 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -108916,12 +116582,12 @@ module.exports = ScrollFactor; /***/ }), -/* 429 */ +/* 463 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -108929,11 +116595,21 @@ var Class = __webpack_require__(0); /** * @classdesc - * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect a visible pixel from the geometry mask. The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity). - * - * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and alpha of the pixel from the Geometry Mask do not matter. - * - * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. Moving or transforming the underlying Graphics object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask. You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed in front of all masked objects which has its own visual properties and, naturally, respects the camera's visual properties, but isn't affected by and doesn't follow the masked objects by itself. + * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect + * a visible pixel from the geometry mask. The mask is essentially a clipping path which can only + * make a masked pixel fully visible or fully invisible without changing its alpha (opacity). + * + * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) + * should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed + * if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and + * alpha of the pixel from the Geometry Mask do not matter. + * + * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. + * Moving or transforming the underlying Graphics object will change the mask (and affect the visibility + * of any masked objects), whereas moving or transforming a masked object will not affect the mask. + * You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed + * in front of all masked objects which has its own visual properties and, naturally, respects the camera's + * visual properties, but isn't affected by and doesn't follow the masked objects by itself. * * @class GeometryMask * @memberof Phaser.Display.Masks @@ -108957,6 +116633,16 @@ var GeometryMask = new Class({ * @since 3.0.0 */ this.geometryMask = graphicsGeometry; + + /** + * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels + * drawn to the Geometry Mask. + * + * @name Phaser.Display.Masks.GeometryMask#invertAlpha + * @type {boolean} + * @since 3.16.0 + */ + this.invertAlpha = false; }, /** @@ -108998,12 +116684,22 @@ var GeometryMask = new Class({ gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); + geometryMask.renderWebGL(renderer, geometryMask, 0, camera); + renderer.flush(); // Use stencil buffer to affect next rendering object gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, 1, 1); + + if (this.invertAlpha) + { + gl.stencilFunc(gl.NOTEQUAL, 1, 1); + } + else + { + gl.stencilFunc(gl.EQUAL, 1, 1); + } + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); }, @@ -109061,7 +116757,7 @@ var GeometryMask = new Class({ /** * Destroys this GeometryMask and nulls any references it holds. - * + * * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, * so be sure to call `clearMask` on any Game Object using it, before destroying it. * @@ -109079,12 +116775,12 @@ module.exports = GeometryMask; /***/ }), -/* 430 */ +/* 464 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109092,14 +116788,37 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. + * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, + * not a clipping path. It is only available when using the WebGL Renderer. + * + * A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). + * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha + * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the + * Bitmap Mask doesn't matter. + * + * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an + * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means + * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects + * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the + * corresponding pixel in the mask. + * + * The Bitmap Mask's location matches the location of its Game Object, not the location of the + * masked objects. Moving or transforming the underlying Game Object will change the mask + * (and affect the visibility of any masked objects), whereas moving or transforming a masked object + * will not affect the mask. + * + * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a + * Scene's display list, it will only be used for the mask and its full texture will not be directly + * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will + * render as a normal Game Object and will also serve as a mask. * * @class BitmapMask * @memberof Phaser.Display.Masks * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which this Bitmap Mask will be used in. * @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite. */ var BitmapMask = new Class({ @@ -109129,7 +116848,7 @@ var BitmapMask = new Class({ this.bitmapMask = renderable; /** - * [description] + * The texture used for the mask's framebuffer. * * @name Phaser.Display.Masks.BitmapMask#maskTexture * @type {WebGLTexture} @@ -109139,7 +116858,7 @@ var BitmapMask = new Class({ this.maskTexture = null; /** - * [description] + * The texture used for the main framebuffer. * * @name Phaser.Display.Masks.BitmapMask#mainTexture * @type {WebGLTexture} @@ -109149,7 +116868,7 @@ var BitmapMask = new Class({ this.mainTexture = null; /** - * [description] + * Whether the Bitmap Mask is dirty and needs to be updated. * * @name Phaser.Display.Masks.BitmapMask#dirty * @type {boolean} @@ -109159,7 +116878,7 @@ var BitmapMask = new Class({ this.dirty = true; /** - * [description] + * The framebuffer to which a masked Game Object is rendered. * * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer * @type {WebGLFramebuffer} @@ -109168,7 +116887,7 @@ var BitmapMask = new Class({ this.mainFramebuffer = null; /** - * [description] + * The framebuffer to which the Bitmap Mask's masking Game Object is rendered. * * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer * @type {WebGLFramebuffer} @@ -109177,7 +116896,9 @@ var BitmapMask = new Class({ this.maskFramebuffer = null; /** - * [description] + * Whether to invert the mask's alpha. + * + * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. * * @name Phaser.Display.Masks.BitmapMask#invertAlpha * @type {boolean} @@ -109218,7 +116939,7 @@ var BitmapMask = new Class({ }, /** - * [description] + * Sets a new masking Game Object for the Bitmap Mask. * * @method Phaser.Display.Masks.BitmapMask#setBitmap * @since 3.0.0 @@ -109231,13 +116952,15 @@ var BitmapMask = new Class({ }, /** - * [description] + * Prepares the WebGL Renderer to render a Game Object with this mask applied. + * + * This renders the masking Game Object to the mask framebuffer and switches to the main framebuffer so that the masked Game Object will be rendered to it instead of being rendered directly to the frame. * * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] - * @param {Phaser.GameObjects.GameObject} maskedObject - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to prepare. + * @param {Phaser.GameObjects.GameObject} maskedObject - The masked Game Object which will be drawn. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ preRenderWebGL: function (renderer, maskedObject, camera) @@ -109246,12 +116969,14 @@ var BitmapMask = new Class({ }, /** - * [description] + * Finalizes rendering of a masked Game Object. + * + * This resets the previously bound framebuffer and switches the WebGL Renderer to the Bitmap Mask Pipeline, which uses a special fragment shader to apply the masking effect. * * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to clean up. */ postRenderWebGL: function (renderer) { @@ -109259,13 +116984,13 @@ var BitmapMask = new Class({ }, /** - * [description] + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] - * @param {Phaser.GameObjects.GameObject} mask - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + * @param {Phaser.GameObjects.GameObject} mask - The masked Game Object which would be rendered. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ preRenderCanvas: function () @@ -109274,12 +116999,12 @@ var BitmapMask = new Class({ }, /** - * [description] + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. */ postRenderCanvas: function () { @@ -109322,17 +117047,17 @@ module.exports = BitmapMask; /***/ }), -/* 431 */ +/* 465 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapMask = __webpack_require__(430); -var GeometryMask = __webpack_require__(429); +var BitmapMask = __webpack_require__(464); +var GeometryMask = __webpack_require__(463); /** * Provides methods used for getting and setting the mask of a Game Object. @@ -109469,12 +117194,12 @@ module.exports = Mask; /***/ }), -/* 432 */ +/* 466 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109509,12 +117234,12 @@ module.exports = RotateAround; /***/ }), -/* 433 */ +/* 467 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109548,17 +117273,17 @@ module.exports = GetPoint; /***/ }), -/* 434 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetPoint = __webpack_require__(209); -var Perimeter = __webpack_require__(134); +var GetPoint = __webpack_require__(225); +var Perimeter = __webpack_require__(145); // Return an array of points from the perimeter of the rectangle // each spaced out based on the quantity or step required @@ -109572,8 +117297,8 @@ var Perimeter = __webpack_require__(134); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. - * @param {number} step - [description] - * @param {integer} quantity - [description] + * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsy. Ignored if quantity is positive. + * @param {integer} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsy, step param will be used to calculate the number of points. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. * * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. @@ -109602,12 +117327,12 @@ module.exports = GetPoints; /***/ }), -/* 435 */ +/* 469 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109695,16 +117420,16 @@ module.exports = Depth; /***/ }), -/* 436 */ +/* 470 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(72); +var BlendModes = __webpack_require__(66); /** * Provides methods used for setting the blend mode of a Game Object. @@ -109737,6 +117462,7 @@ var BlendMode = { * * ADD * * MULTIPLY * * SCREEN + * * ERASE * * Canvas has more available depending on browser support. * @@ -109785,6 +117511,7 @@ var BlendMode = { * * ADD * * MULTIPLY * * SCREEN + * * ERASE (only works when rendering to a framebuffer, like a Render Texture) * * Canvas has more available depending on browser support. * @@ -109792,7 +117519,7 @@ var BlendMode = { * * 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 + * reasons try to be careful about the construction of your Scene and the frequency in which blend modes * are used. * * @method Phaser.GameObjects.Components.BlendMode#setBlendMode @@ -109815,73 +117542,276 @@ module.exports = BlendMode; /***/ }), -/* 437 */ +/* 471 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * This event is dispatched when an animation starts playing. - * - * Listen for it on the Game Object: `sprite.on('animationstart', listener)` + * @classdesc + * A single frame in an Animation sequence. * - * @event Phaser.GameObjects.Components.Animation#onStartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. + * 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 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({ + + initialize: + + 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; + + /** + * 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; + + /** + * The index of this AnimationFrame within the Animation sequence. + * + * @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; + + /** + * 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; + }, + + /** + * Generates a JavaScript object suitable for converting to JSON. + * + * @method Phaser.Animations.AnimationFrame#toJSON + * @since 3.0.0 + * + * @return {Phaser.Animations.Types.JSONAnimationFrame} 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; + } + +}); + +module.exports = AnimationFrame; + + +/***/ }), +/* 472 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * This event is dispatched when an animation restarts. - * - * Listen for it on the Game Object: `sprite.on('animationrestart', listener)` + * Searches a pre-sorted array for the closet value to the given number. * - * @event Phaser.GameObjects.Components.Animation#onRestartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. + * If the `key` argument is given it will assume the array contains objects that all have the required `key` property name, + * and will check for the closest value of those to the given number. + * + * @function Phaser.Utils.Array.FindClosestInSorted + * @since 3.0.0 + * + * @param {number} value - The value to search for in the array. + * @param {array} array - The array to search, which must be sorted. + * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. + * + * @return {(number|any)} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. */ +var FindClosestInSorted = function (value, array, key) +{ + if (!array.length) + { + return NaN; + } + else if (array.length === 1) + { + return array[0]; + } + + var i = 1; + var low; + var high; + + if (key) + { + if (value < array[0][key]) + { + return array[0]; + } + + while (array[i][key] < value) + { + i++; + } + } + else + { + while (array[i] < value) + { + i++; + } + } + + if (i > array.length) + { + i = array.length; + } + + if (key) + { + low = array[i - 1][key]; + high = array[i][key]; + + return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; + } + else + { + low = array[i - 1]; + high = array[i]; + + return ((high - value) <= (value - low)) ? high : low; + } +}; + +module.exports = FindClosestInSorted; + + +/***/ }), +/* 473 */ +/***/ (function(module, exports, __webpack_require__) { /** - * This event is dispatched when an animation repeats. - * - * Listen for it on the Game Object: `sprite.on('animationrepeat', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onRepeatEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {integer} repeatCount - The number of times this animation has repeated. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * This event is dispatched when an animation updates. This happens when the animation frame changes, - * based on the animation frame rate and other factors like timeScale and delay. - * - * Listen for it on the Game Object: `sprite.on('animationupdate', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onUpdateEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation completes playing, either naturally or via Animation.stop. - * - * Listen for it on the Game Object: `sprite.on('animationcomplete', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onCompleteEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ +var BaseAnimation = __webpack_require__(226); +var Class = __webpack_require__(0); +var Events = __webpack_require__(146); /** * @classdesc @@ -109920,7 +117850,7 @@ var Animation = new Class({ */ this.animationManager = parent.scene.sys.anims; - this.animationManager.once('remove', this.remove, this); + this.animationManager.once(Events.REMOVE_ANIMATION, this.remove, this); /** * Is an animation currently playing or not? @@ -109952,6 +117882,16 @@ var Animation = new Class({ */ this.currentFrame = null; + /** + * The key of the next Animation to be loaded into this Animation Controller when the current animation completes. + * + * @name Phaser.GameObjects.Components.Animation#nextAnim + * @type {?string} + * @default null + * @since 3.16.0 + */ + this.nextAnim = null; + /** * Time scale factor. * @@ -110064,9 +118004,10 @@ var Animation = new Class({ * An Internal trigger that's play the animation in reverse mode ('true') or not ('false'), * needed because forward can be changed by yoyo feature. * - * @name Phaser.GameObjects.Components.Animation#forward + * @name Phaser.GameObjects.Components.Animation#_reverse * @type {boolean} * @default false + * @private * @since 3.12.0 */ this._reverse = false; @@ -110159,6 +118100,37 @@ var Animation = new Class({ this._pendingStopValue; }, + /** + * Sets an animation to be played immediately after the current one completes. + * + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, or have the `stop` method called directly on it. + * + * An animation set to repeat forever will never enter a completed state. + * + * You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` callback). + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing. + * + * Call this method with no arguments to reset the chained animation. + * + * @method Phaser.GameObjects.Components.Animation#chain + * @since 3.16.0 + * + * @param {(string|Phaser.Animations.Animation)} [key] - The string-based key of the animation to play next, as defined previously in the Animation Manager. Or an Animation instance. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + */ + chain: function (key) + { + if (key instanceof BaseAnimation) + { + key = key.key; + } + + this.nextAnim = key; + + return this.parent; + }, + /** * Sets the amount of time, in milliseconds, that the animation will be delayed before starting playback. * @@ -110328,13 +118300,15 @@ var Animation = new Class({ }, /** - * Plays an Animation on the Game Object that owns this Animation Component. + * Plays an Animation on a Game Object that has the Animation component, such as a Sprite. + * + * Animations are stored in the global Animation Manager and are referenced by a unique string-based key. * * @method Phaser.GameObjects.Components.Animation#play * @fires Phaser.GameObjects.Components.Animation#onStartEvent * @since 3.0.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. + * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * @@ -110345,6 +118319,11 @@ var Animation = new Class({ if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (key instanceof BaseAnimation) + { + key = key.key; + } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) { return this.parent; @@ -110363,7 +118342,7 @@ var Animation = new Class({ * @fires Phaser.GameObjects.Components.Animation#onStartEvent * @since 3.12.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. + * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * @@ -110374,6 +118353,11 @@ var Animation = new Class({ if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (key instanceof BaseAnimation) + { + key = key.key; + } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) { return this.parent; @@ -110386,11 +118370,12 @@ var Animation = new Class({ }, /** - * Load an Animation and fires 'onStartEvent' event, - * extracted from 'play' method + * Load an Animation and fires 'onStartEvent' event, extracted from 'play' method. * * @method Phaser.GameObjects.Components.Animation#_startAnimation - * @fires Phaser.GameObjects.Components.Animation#onStartEvent + * @fires Phaser.Animations.Events#START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_KEY_ANIMATION_EVENT * @since 3.12.0 * * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. @@ -110418,26 +118403,33 @@ var Animation = new Class({ gameObject.visible = true; } - gameObject.emit('animationstart', this.currentAnim, this.currentFrame, gameObject); + var frame = this.currentFrame; + + anim.emit(Events.ANIMATION_START, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_START + key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_START, anim, frame, gameObject); return gameObject; }, /** - * Reverse an Animation that is already playing on the Game Object. + * Reverse the Animation that is already playing on the Game Object. * * @method Phaser.GameObjects.Components.Animation#reverse * @since 3.12.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. - * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - reverse: function (key) + reverse: function () { - if (!this.isPlaying || this.currentAnim.key !== key) { return this.parent; } - this._reverse = !this._reverse; - this.forward = !this.forward; + if (this.isPlaying) + { + this._reverse = !this._reverse; + + this.forward = !this.forward; + } return this.parent; }, @@ -110583,7 +118575,9 @@ var Animation = new Class({ * Restarts the current animation from its beginning, optionally including its delay value. * * @method Phaser.GameObjects.Components.Animation#restart - * @fires Phaser.GameObjects.Components.Animation#onRestartEvent + * @fires Phaser.Animations.Events#RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_KEY_ANIMATION_EVENT * @since 3.0.0 * * @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting. @@ -110594,7 +118588,9 @@ var Animation = new Class({ { if (includeDelay === undefined) { includeDelay = false; } - this.currentAnim.getFirstTick(this, includeDelay); + var anim = this.currentAnim; + + anim.getFirstTick(this, includeDelay); this.forward = true; this.isPlaying = true; @@ -110602,17 +118598,26 @@ var Animation = new Class({ this._paused = false; // Set frame - this.updateFrame(this.currentAnim.frames[0]); + this.updateFrame(anim.frames[0]); var gameObject = this.parent; + var frame = this.currentFrame; - gameObject.emit('animationrestart', this.currentAnim, this.currentFrame, gameObject); + anim.emit(Events.ANIMATION_RESTART, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_RESTART + anim.key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_RESTART, anim, frame, gameObject); return this.parent; }, /** * Immediately stops the current animation from playing and dispatches the `animationcomplete` event. + * + * If no animation is set, no event will be dispatched. + * + * If there is another animation queued (via the `chain` method) then it will start playing immediately. * * @method Phaser.GameObjects.Components.Animation#stop * @fires Phaser.GameObjects.Components.Animation#onCompleteEvent @@ -110627,8 +118632,26 @@ var Animation = new Class({ this.isPlaying = false; var gameObject = this.parent; + var anim = this.currentAnim; + var frame = this.currentFrame; - gameObject.emit('animationcomplete', this.currentAnim, this.currentFrame, gameObject); + if (anim) + { + anim.emit(Events.ANIMATION_COMPLETE, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_COMPLETE + anim.key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_COMPLETE, anim, frame, gameObject); + } + + if (this.nextAnim) + { + var key = this.nextAnim; + + this.nextAnim = null; + + this.play(key); + } return gameObject; }, @@ -110676,7 +118699,7 @@ var Animation = new Class({ * @fires Phaser.GameObjects.Components.Animation#onCompleteEvent * @since 3.4.0 * - * @param {Phaser.Animations.AnimationFrame} delay - The frame to check before stopping this animation. + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -110811,7 +118834,8 @@ var Animation = new Class({ * Internal frame change handler. * * @method Phaser.GameObjects.Components.Animation#updateFrame - * @fires Phaser.GameObjects.Components.Animation#onUpdateEvent + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE_EVENT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE_EVENT * @private * @since 3.0.0 * @@ -110830,7 +118854,9 @@ var Animation = new Class({ var anim = this.currentAnim; - gameObject.emit('animationupdate', anim, animationFrame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_UPDATE + anim.key, anim, animationFrame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_UPDATE, anim, animationFrame, gameObject); if (this._pendingStop === 3 && this._pendingStopValue === animationFrame) { @@ -110839,6 +118865,50 @@ var Animation = new Class({ } }, + /** + * Advances the animation to the next frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. + * + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in reverse, calling this method doesn't then change the direction to forwards. + * + * @method Phaser.GameObjects.Components.Animation#nextFrame + * @since 3.16.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + */ + nextFrame: function () + { + if (this.currentAnim) + { + this.currentAnim.nextFrame(this); + } + + return this.parent; + }, + + /** + * Advances the animation to the previous frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. + * + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in forwards, calling this method doesn't then change the direction to backwards. + * + * @method Phaser.GameObjects.Components.Animation#previousFrame + * @since 3.16.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + */ + previousFrame: function () + { + if (this.currentAnim) + { + this.currentAnim.previousFrame(this); + } + + return this.parent; + }, + /** * Sets if the current Animation will yoyo when it reaches the end. * A yoyo'ing animation will play through consecutively, and then reverse-play back to the start again. @@ -110883,7 +118953,7 @@ var Animation = new Class({ */ destroy: function () { - this.animationManager.off('remove', this.remove, this); + this.animationManager.off(Events.REMOVE_ANIMATION, this.remove, this); this.animationManager = null; this.parent = null; @@ -110898,12 +118968,12 @@ module.exports = Animation; /***/ }), -/* 438 */ +/* 474 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -111193,12 +119263,12 @@ module.exports = Alpha; /***/ }), -/* 439 */ +/* 475 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -111221,19 +119291,19 @@ module.exports = Circumference; /***/ }), -/* 440 */ +/* 476 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(439); -var CircumferencePoint = __webpack_require__(211); -var FromPercent = __webpack_require__(103); -var MATH_CONST = __webpack_require__(18); +var Circumference = __webpack_require__(475); +var CircumferencePoint = __webpack_require__(228); +var FromPercent = __webpack_require__(110); +var MATH_CONST = __webpack_require__(20); /** * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, @@ -111273,517 +119343,18 @@ module.exports = GetPoints; /***/ }), -/* 441 */ +/* 477 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); - -/** - * @classdesc - * A seeded Random Data Generator. - * - * Access via `Phaser.Math.RND` which is an instance of this class pre-defined - * by Phaser. Or, create your own instance to use as you require. - * - * The `Math.RND` generator is seeded by the Game Config property value `seed`. - * If no such config property exists, a random number is used. - * - * If you create your own instance of this class you should provide a seed for it. - * If no seed is given it will use a 'random' one based on Date.now. - * - * @class RandomDataGenerator - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. - */ -var RandomDataGenerator = new Class({ - - initialize: - - function RandomDataGenerator (seeds) - { - if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } - - /** - * 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; - - /** - * Signs to choose from. - * - * @name Phaser.Math.RandomDataGenerator#signs - * @type {number[]} - * @since 3.0.0 - */ - this.signs = [ -1, 1 ]; - - if (seeds) - { - this.init(seeds); - } - }, - - /** - * Private random helper. - * - * @method Phaser.Math.RandomDataGenerator#rnd - * @since 3.0.0 - * @private - * - * @return {number} A random number. - */ - rnd: function () - { - 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 {string} data - The value to hash. - * - * @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++) - { - 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 - }, - - /** - * Initialize the state of the random data generator. - * - * @method Phaser.Math.RandomDataGenerator#init - * @since 3.0.0 - * - * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. - */ - 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 {string[]} 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 {*} 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 {*} 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(','); - }, - - /** - * Shuffles the given array, using the current seed. - * - * @method Phaser.Math.RandomDataGenerator#shuffle - * @since 3.7.0 - * - * @param {array} [array] - The array to be shuffled. - * - * @return {array} The shuffled array. - */ - shuffle: function (array) - { - var len = array.length - 1; - - for (var i = len; i > 0; i--) - { - var randomIndex = Math.floor(this.frac() * (len + 1)); - var itemAtIndex = array[randomIndex]; - - array[randomIndex] = array[i]; - array[i] = itemAtIndex; - } - - return array; - } - -}); - -module.exports = RandomDataGenerator; - - -/***/ }), -/* 442 */ -/***/ (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__(211); -var FromPercent = __webpack_require__(103); -var MATH_CONST = __webpack_require__(18); +var CircumferencePoint = __webpack_require__(228); +var FromPercent = __webpack_require__(110); +var MATH_CONST = __webpack_require__(20); var Point = __webpack_require__(6); /** @@ -111815,19 +119386,19 @@ module.exports = GetPoint; /***/ }), -/* 443 */ +/* 478 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(48); -var GetTop = __webpack_require__(46); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetRight = __webpack_require__(52); +var GetTop = __webpack_require__(50); +var SetRight = __webpack_require__(51); +var SetTop = __webpack_require__(49); /** * Takes given Game Object and aligns it so that it is positioned in the top right of the other. @@ -111859,19 +119430,19 @@ module.exports = TopRight; /***/ }), -/* 444 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(50); -var GetTop = __webpack_require__(46); -var SetLeft = __webpack_require__(49); -var SetTop = __webpack_require__(45); +var GetLeft = __webpack_require__(54); +var GetTop = __webpack_require__(50); +var SetLeft = __webpack_require__(53); +var SetTop = __webpack_require__(49); /** * Takes given Game Object and aligns it so that it is positioned in the top left of the other. @@ -111903,19 +119474,19 @@ module.exports = TopLeft; /***/ }), -/* 445 */ +/* 480 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterX = __webpack_require__(85); -var GetTop = __webpack_require__(46); -var SetCenterX = __webpack_require__(84); -var SetTop = __webpack_require__(45); +var GetCenterX = __webpack_require__(91); +var GetTop = __webpack_require__(50); +var SetCenterX = __webpack_require__(90); +var SetTop = __webpack_require__(49); /** * Takes given Game Object and aligns it so that it is positioned in the top center of the other. @@ -111947,19 +119518,19 @@ module.exports = TopCenter; /***/ }), -/* 446 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(82); -var GetRight = __webpack_require__(48); -var SetCenterY = __webpack_require__(83); -var SetRight = __webpack_require__(47); +var GetCenterY = __webpack_require__(88); +var GetRight = __webpack_require__(52); +var SetCenterY = __webpack_require__(89); +var SetRight = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the right center of the other. @@ -111991,19 +119562,19 @@ module.exports = RightCenter; /***/ }), -/* 447 */ +/* 482 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(82); -var GetLeft = __webpack_require__(50); -var SetCenterY = __webpack_require__(83); -var SetLeft = __webpack_require__(49); +var GetCenterY = __webpack_require__(88); +var GetLeft = __webpack_require__(54); +var SetCenterY = __webpack_require__(89); +var SetLeft = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned in the left center of the other. @@ -112035,17 +119606,17 @@ module.exports = LeftCenter; /***/ }), -/* 448 */ +/* 483 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetCenterX = __webpack_require__(84); -var SetCenterY = __webpack_require__(83); +var SetCenterX = __webpack_require__(90); +var SetCenterY = __webpack_require__(89); /** * Positions the Game Object so that it is centered on the given coordinates. @@ -112072,18 +119643,18 @@ module.exports = CenterOn; /***/ }), -/* 449 */ +/* 484 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(448); -var GetCenterX = __webpack_require__(85); -var GetCenterY = __webpack_require__(82); +var CenterOn = __webpack_require__(483); +var GetCenterX = __webpack_require__(91); +var GetCenterY = __webpack_require__(88); /** * Takes given Game Object and aligns it so that it is positioned in the center of the other. @@ -112114,19 +119685,19 @@ module.exports = Center; /***/ }), -/* 450 */ +/* 485 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(52); -var GetRight = __webpack_require__(48); -var SetBottom = __webpack_require__(51); -var SetRight = __webpack_require__(47); +var GetBottom = __webpack_require__(56); +var GetRight = __webpack_require__(52); +var SetBottom = __webpack_require__(55); +var SetRight = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. @@ -112158,19 +119729,19 @@ module.exports = BottomRight; /***/ }), -/* 451 */ +/* 486 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(52); -var GetLeft = __webpack_require__(50); -var SetBottom = __webpack_require__(51); -var SetLeft = __webpack_require__(49); +var GetBottom = __webpack_require__(56); +var GetLeft = __webpack_require__(54); +var SetBottom = __webpack_require__(55); +var SetLeft = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. @@ -112202,19 +119773,19 @@ module.exports = BottomLeft; /***/ }), -/* 452 */ +/* 487 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(52); -var GetCenterX = __webpack_require__(85); -var SetBottom = __webpack_require__(51); -var SetCenterX = __webpack_require__(84); +var GetBottom = __webpack_require__(56); +var GetCenterX = __webpack_require__(91); +var SetBottom = __webpack_require__(55); +var SetCenterX = __webpack_require__(90); /** * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. @@ -112246,28 +119817,28 @@ module.exports = BottomCenter; /***/ }), -/* 453 */ +/* 488 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ALIGN_CONST = __webpack_require__(212); +var ALIGN_CONST = __webpack_require__(229); var AlignInMap = []; -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(452); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(451); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(450); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(449); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(447); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(446); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(445); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(444); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(443); +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(487); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(486); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(485); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(484); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(482); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(481); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(480); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(479); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(478); /** * Takes given Game Object and aligns it so that it is positioned relative to the other. @@ -112295,12 +119866,12 @@ module.exports = QuickSet; /***/ }), -/* 454 */ +/* 489 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112310,66 +119881,66 @@ module.exports = QuickSet; module.exports = { - Angle: __webpack_require__(1122), - Call: __webpack_require__(1121), - GetFirst: __webpack_require__(1120), - GetLast: __webpack_require__(1119), - GridAlign: __webpack_require__(1118), - IncAlpha: __webpack_require__(1107), - IncX: __webpack_require__(1106), - IncXY: __webpack_require__(1105), - IncY: __webpack_require__(1104), - PlaceOnCircle: __webpack_require__(1103), - PlaceOnEllipse: __webpack_require__(1102), - PlaceOnLine: __webpack_require__(1101), - PlaceOnRectangle: __webpack_require__(1100), - PlaceOnTriangle: __webpack_require__(1099), - PlayAnimation: __webpack_require__(1098), - PropertyValueInc: __webpack_require__(37), - PropertyValueSet: __webpack_require__(27), - RandomCircle: __webpack_require__(1097), - RandomEllipse: __webpack_require__(1096), - RandomLine: __webpack_require__(1095), - RandomRectangle: __webpack_require__(1094), - RandomTriangle: __webpack_require__(1093), - Rotate: __webpack_require__(1092), - RotateAround: __webpack_require__(1091), - RotateAroundDistance: __webpack_require__(1090), - ScaleX: __webpack_require__(1089), - ScaleXY: __webpack_require__(1088), - ScaleY: __webpack_require__(1087), - SetAlpha: __webpack_require__(1086), - SetBlendMode: __webpack_require__(1085), - SetDepth: __webpack_require__(1084), - SetHitArea: __webpack_require__(1083), - SetOrigin: __webpack_require__(1082), - SetRotation: __webpack_require__(1081), - SetScale: __webpack_require__(1080), - SetScaleX: __webpack_require__(1079), - SetScaleY: __webpack_require__(1078), - SetTint: __webpack_require__(1077), - SetVisible: __webpack_require__(1076), - SetX: __webpack_require__(1075), - SetXY: __webpack_require__(1074), - SetY: __webpack_require__(1073), - ShiftPosition: __webpack_require__(1072), - Shuffle: __webpack_require__(1071), - SmootherStep: __webpack_require__(1070), - SmoothStep: __webpack_require__(1069), - Spread: __webpack_require__(1068), - ToggleVisible: __webpack_require__(1067), - WrapInRectangle: __webpack_require__(1066) + Angle: __webpack_require__(1358), + Call: __webpack_require__(1357), + GetFirst: __webpack_require__(1356), + GetLast: __webpack_require__(1355), + GridAlign: __webpack_require__(1354), + IncAlpha: __webpack_require__(1320), + IncX: __webpack_require__(1319), + IncXY: __webpack_require__(1318), + IncY: __webpack_require__(1317), + PlaceOnCircle: __webpack_require__(1316), + PlaceOnEllipse: __webpack_require__(1315), + PlaceOnLine: __webpack_require__(1314), + PlaceOnRectangle: __webpack_require__(1313), + PlaceOnTriangle: __webpack_require__(1312), + PlayAnimation: __webpack_require__(1311), + PropertyValueInc: __webpack_require__(40), + PropertyValueSet: __webpack_require__(29), + RandomCircle: __webpack_require__(1310), + RandomEllipse: __webpack_require__(1309), + RandomLine: __webpack_require__(1308), + RandomRectangle: __webpack_require__(1307), + RandomTriangle: __webpack_require__(1306), + Rotate: __webpack_require__(1305), + RotateAround: __webpack_require__(1304), + RotateAroundDistance: __webpack_require__(1303), + ScaleX: __webpack_require__(1302), + ScaleXY: __webpack_require__(1301), + ScaleY: __webpack_require__(1300), + SetAlpha: __webpack_require__(1299), + SetBlendMode: __webpack_require__(1298), + SetDepth: __webpack_require__(1297), + SetHitArea: __webpack_require__(1296), + SetOrigin: __webpack_require__(1295), + SetRotation: __webpack_require__(1294), + SetScale: __webpack_require__(1293), + SetScaleX: __webpack_require__(1292), + SetScaleY: __webpack_require__(1291), + SetTint: __webpack_require__(1290), + SetVisible: __webpack_require__(1289), + SetX: __webpack_require__(1288), + SetXY: __webpack_require__(1287), + SetY: __webpack_require__(1286), + ShiftPosition: __webpack_require__(1285), + Shuffle: __webpack_require__(1284), + SmootherStep: __webpack_require__(1283), + SmoothStep: __webpack_require__(1282), + Spread: __webpack_require__(1281), + ToggleVisible: __webpack_require__(1280), + WrapInRectangle: __webpack_require__(1279) }; /***/ }), -/* 455 */ +/* 490 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112377,28 +119948,28 @@ module.exports = { * Takes the given string and reverses it, returning the reversed string. * For example if given the string `Atari 520ST` it would return `TS025 iratA`. * - * @function Phaser.Utils.String.ReverseString + * @function Phaser.Utils.String.Reverse * @since 3.0.0 * * @param {string} string - The string to be reversed. * * @return {string} The reversed string. */ -var ReverseString = function (string) +var Reverse = function (string) { return string.split('').reverse().join(''); }; -module.exports = ReverseString; +module.exports = Reverse; /***/ }), -/* 456 */ +/* 491 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112428,12 +119999,12 @@ module.exports = Format; /***/ }), -/* 457 */ +/* 492 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112443,26 +120014,26 @@ module.exports = Format; module.exports = { - Format: __webpack_require__(456), - Pad: __webpack_require__(197), - Reverse: __webpack_require__(455), - UppercaseFirst: __webpack_require__(356), - UUID: __webpack_require__(323) + Format: __webpack_require__(491), + Pad: __webpack_require__(213), + Reverse: __webpack_require__(490), + UppercaseFirst: __webpack_require__(361), + UUID: __webpack_require__(329) }; /***/ }), -/* 458 */ +/* 493 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Creates a new Object using all values from obj1. @@ -112472,10 +120043,10 @@ var Clone = __webpack_require__(69); * @function Phaser.Utils.Objects.MergeRight * @since 3.0.0 * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] + * @param {object} obj1 - The first object to merge. + * @param {object} obj2 - The second object to merge. Keys from this object which also exist in `obj1` will be copied to `obj1`. * - * @return {object} [description] + * @return {object} The merged object. `obj1` and `obj2` are not modified. */ var MergeRight = function (obj1, obj2) { @@ -112496,12 +120067,12 @@ module.exports = MergeRight; /***/ }), -/* 459 */ +/* 494 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112533,12 +120104,12 @@ module.exports = HasAll; /***/ }), -/* 460 */ +/* 495 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112572,44 +120143,44 @@ module.exports = GetMinMaxValue; /***/ }), -/* 461 */ +/* 496 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.Utils.Object + * @namespace Phaser.Utils.Objects */ module.exports = { - Clone: __webpack_require__(69), + Clone: __webpack_require__(76), Extend: __webpack_require__(21), GetAdvancedValue: __webpack_require__(13), GetFastValue: __webpack_require__(1), - GetMinMaxValue: __webpack_require__(460), + GetMinMaxValue: __webpack_require__(495), GetValue: __webpack_require__(4), - HasAll: __webpack_require__(459), - HasAny: __webpack_require__(326), - HasValue: __webpack_require__(77), + HasAll: __webpack_require__(494), + HasAny: __webpack_require__(332), + HasValue: __webpack_require__(82), IsPlainObject: __webpack_require__(8), - Merge: __webpack_require__(79), - MergeRight: __webpack_require__(458) + Merge: __webpack_require__(84), + MergeRight: __webpack_require__(493) }; /***/ }), -/* 462 */ +/* 497 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -112619,40 +120190,41 @@ module.exports = { module.exports = { - Array: __webpack_require__(180), - Objects: __webpack_require__(461), - String: __webpack_require__(457) + Array: __webpack_require__(192), + Objects: __webpack_require__(496), + String: __webpack_require__(492) }; /***/ }), -/* 463 */ +/* 498 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(216); -var PluginCache = __webpack_require__(15); -var TimelineBuilder = __webpack_require__(215); -var TWEEN_CONST = __webpack_require__(93); -var TweenBuilder = __webpack_require__(105); +var NumberTweenBuilder = __webpack_require__(234); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var TimelineBuilder = __webpack_require__(233); +var TWEEN_CONST = __webpack_require__(99); +var TweenBuilder = __webpack_require__(112); /** * @classdesc - * [description] + * The Tween Manager is a default Scene Plugin which controls and updates Tweens and Timelines. * * @class TweenManager * @memberof Phaser.Tweens * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which owns this Tween Manager. */ var TweenManager = new Class({ @@ -112661,7 +120233,7 @@ var TweenManager = new Class({ function TweenManager (scene) { /** - * [description] + * The Scene which owns this Tween Manager. * * @name Phaser.Tweens.TweenManager#scene * @type {Phaser.Scene} @@ -112670,7 +120242,7 @@ var TweenManager = new Class({ this.scene = scene; /** - * [description] + * The Systems object of the Scene which owns this Tween Manager. * * @name Phaser.Tweens.TweenManager#systems * @type {Phaser.Scenes.Systems} @@ -112679,7 +120251,9 @@ var TweenManager = new Class({ this.systems = scene.sys; /** - * [description] + * The time scale of the Tween Manager. + * + * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager. * * @name Phaser.Tweens.TweenManager#timeScale * @type {number} @@ -112689,7 +120263,7 @@ var TweenManager = new Class({ this.timeScale = 1; /** - * [description] + * An array of Tweens and Timelines which will be added to the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_add * @type {array} @@ -112699,7 +120273,7 @@ var TweenManager = new Class({ this._add = []; /** - * [description] + * An array of Tweens and Timelines pending to be later added to the Tween Manager. * * @name Phaser.Tweens.TweenManager#_pending * @type {array} @@ -112709,7 +120283,7 @@ var TweenManager = new Class({ this._pending = []; /** - * [description] + * An array of Tweens and Timelines which are still incomplete and are actively processed by the Tween Manager. * * @name Phaser.Tweens.TweenManager#_active * @type {array} @@ -112719,7 +120293,7 @@ var TweenManager = new Class({ this._active = []; /** - * [description] + * An array of Tweens and Timelines which will be removed from the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_destroy * @type {array} @@ -112729,7 +120303,7 @@ var TweenManager = new Class({ this._destroy = []; /** - * [description] + * The number of Tweens and Timelines which need to be processed by the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_toProcess * @type {integer} @@ -112739,8 +120313,8 @@ var TweenManager = new Class({ */ this._toProcess = 0; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -112753,7 +120327,7 @@ var TweenManager = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -112769,9 +120343,9 @@ var TweenManager = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); this.timeScale = 1; }, @@ -112782,9 +120356,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#createTimeline * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Timeline and its Tweens. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline object. */ createTimeline: function (config) { @@ -112797,9 +120371,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#timeline * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Timeline and its Tweens. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline object. */ timeline: function (config) { @@ -112821,9 +120395,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#create * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Tween as per {@link Phaser.Tweens.Builders.TweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Tween object. */ create: function (config) { @@ -112836,9 +120410,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#add * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Tween as per the {@link Phaser.Tweens.Builders.TweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Tween. */ add: function (config) { @@ -112857,7 +120431,7 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#existing * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to add. * * @return {Phaser.Tweens.TweenManager} This Tween Manager object. */ @@ -112876,9 +120450,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#addCounter * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Number Tween as per the {@link Phaser.Tweens.Builders.NumberTweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Number Tween. */ addCounter: function (config) { @@ -112892,7 +120466,9 @@ var TweenManager = new Class({ }, /** - * [description] + * Updates the Tween Manager's internal lists at the start of the frame. + * + * This method will return immediately if no changes have been indicated. * * @method Phaser.Tweens.TweenManager#preUpdate * @since 3.0.0 @@ -112970,12 +120546,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Updates all Tweens and Timelines of the Tween Manager. * * @method Phaser.Tweens.TweenManager#update * @since 3.0.0 * - * @param {number} timestamp - [description] + * @param {number} timestamp - The current time in milliseconds. * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ update: function (timestamp, delta) @@ -113002,12 +120578,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't. * * @method Phaser.Tweens.TweenManager#makeActive * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to check. * * @return {Phaser.Tweens.TweenManager} This Tween Manager object. */ @@ -113040,9 +120616,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#each * @since 3.0.0 * - * @param {function} callback - [description] - * @param {object} [scope] - [description] - * @param {...*} [args] - [description] + * @param {function} callback - The function to call. + * @param {object} [scope] - The scope (`this` object) to call the function with. + * @param {...*} [args] - The arguments to pass into the function. Its first argument will always be the Tween currently being iterated. */ each: function (callback, scope) { @@ -113062,12 +120638,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns an array of all active Tweens and Timelines in the Tween Manager. * * @method Phaser.Tweens.TweenManager#getAllTweens * @since 3.0.0 * - * @return {Phaser.Tweens.Tween[]} [description] + * @return {Phaser.Tweens.Tween[]} A new array containing references to all active Tweens and Timelines. */ getAllTweens: function () { @@ -113083,12 +120659,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns the scale of the time delta for all Tweens and Timelines owned by this Tween Manager. * * @method Phaser.Tweens.TweenManager#getGlobalTimeScale * @since 3.0.0 * - * @return {number} [description] + * @return {number} The scale of the time delta, usually 1. */ getGlobalTimeScale: function () { @@ -113096,14 +120672,14 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns an array of all Tweens or Timelines in the Tween Manager which affect the given target or array of targets. * * @method Phaser.Tweens.TweenManager#getTweensOf * @since 3.0.0 * - * @param {(object|array)} target - [description] + * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. * - * @return {Phaser.Tweens.Tween[]} [description] + * @return {Phaser.Tweens.Tween[]} A new array containing all Tweens and Timelines which affect the given target(s). */ getTweensOf: function (target) { @@ -113144,14 +120720,14 @@ var TweenManager = new Class({ }, /** - * [description] + * Checks if the given object is being affected by a playing Tween. * * @method Phaser.Tweens.TweenManager#isTweening * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - target Phaser.Tweens.Tween object * - * @return {boolean} [description] + * @return {boolean} returns if target tween object is active or not */ isTweening: function (target) { @@ -113172,12 +120748,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Stops all Tweens in this Tween Manager. They will be removed at the start of the frame. * * @method Phaser.Tweens.TweenManager#killAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ killAll: function () { @@ -113192,14 +120768,16 @@ var TweenManager = new Class({ }, /** - * [description] + * Stops all Tweens which affect the given target or array of targets. The Tweens will be removed from the Tween Manager at the start of the frame. + * + * @see {@link #getTweensOf} * * @method Phaser.Tweens.TweenManager#killTweensOf * @since 3.0.0 * - * @param {(object|array)} target - [description] + * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ killTweensOf: function (target) { @@ -113214,12 +120792,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Pauses all Tweens in this Tween Manager. * * @method Phaser.Tweens.TweenManager#pauseAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ pauseAll: function () { @@ -113234,12 +120812,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Resumes all Tweens in this Tween Manager. * * @method Phaser.Tweens.TweenManager#resumeAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ resumeAll: function () { @@ -113254,14 +120832,16 @@ var TweenManager = new Class({ }, /** - * [description] + * Sets a new scale of the time delta for this Tween Manager. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens. * * @method Phaser.Tweens.TweenManager#setGlobalTimeScale * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new scale of the time delta, where 1 is the normal speed. * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ setGlobalTimeScale: function (value) { @@ -113290,9 +120870,9 @@ var TweenManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -113306,7 +120886,7 @@ var TweenManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -113320,12 +120900,227 @@ module.exports = TweenManager; /***/ }), -/* 464 */ +/* 499 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Update Event. + * + * This event is dispatched by a Tween Timeline every time it updates, which can happen a lot of times per second, + * so be careful about listening to this event unless you absolutely require it. + * + * Listen to it from a Timeline instance using `Timeline.on('update', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('update', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_UPDATE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'update'; + + +/***/ }), +/* 500 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Start Event. + * + * This event is dispatched by a Tween Timeline when it starts. + * + * Listen to it from a Timeline instance using `Timeline.on('start', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('start', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_START + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'start'; + + +/***/ }), +/* 501 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Resume Event. + * + * This event is dispatched by a Tween Timeline when it is resumed from a paused state. + * + * Listen to it from a Timeline instance using `Timeline.on('resume', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('resume', listener); + * // At some point later ... + * timeline.resume(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_RESUME + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'resume'; + + +/***/ }), +/* 502 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Pause Event. + * + * This event is dispatched by a Tween Timeline when it is paused. + * + * Listen to it from a Timeline instance using `Timeline.on('pause', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('pause', listener); + * // At some point later ... + * timeline.pause(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_PAUSE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'pause'; + + +/***/ }), +/* 503 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Loop Event. + * + * This event is dispatched by a Tween Timeline every time it loops. + * + * Listen to it from a Timeline instance using `Timeline.on('loop', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * loop: 4, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('loop', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_LOOP + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + * @param {integer} loopCount - The number of loops left before this Timeline completes. + */ +module.exports = 'loop'; + + +/***/ }), +/* 504 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Complete Event. + * + * This event is dispatched by a Tween Timeline when it completes playback. + * + * Listen to it from a Timeline instance using `Timeline.on('complete', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('complete', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_COMPLETE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'complete'; + + +/***/ }), +/* 505 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113392,12 +121187,12 @@ module.exports = [ /***/ }), -/* 465 */ +/* 506 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113407,31 +121202,31 @@ module.exports = [ module.exports = { - GetBoolean: __webpack_require__(94), - GetEaseFunction: __webpack_require__(95), - GetNewValue: __webpack_require__(106), - GetProps: __webpack_require__(218), - GetTargets: __webpack_require__(140), - GetTweens: __webpack_require__(217), - GetValueOp: __webpack_require__(139), - NumberTweenBuilder: __webpack_require__(216), - TimelineBuilder: __webpack_require__(215), - TweenBuilder: __webpack_require__(105) + GetBoolean: __webpack_require__(100), + GetEaseFunction: __webpack_require__(101), + GetNewValue: __webpack_require__(113), + GetProps: __webpack_require__(236), + GetTargets: __webpack_require__(152), + GetTweens: __webpack_require__(235), + GetValueOp: __webpack_require__(151), + NumberTweenBuilder: __webpack_require__(234), + TimelineBuilder: __webpack_require__(233), + TweenBuilder: __webpack_require__(112) }; /***/ }), -/* 466 */ +/* 507 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(93); +var CONST = __webpack_require__(99); var Extend = __webpack_require__(21); /** @@ -113440,12 +121235,13 @@ var Extend = __webpack_require__(21); var Tweens = { - Builders: __webpack_require__(465), + Builders: __webpack_require__(506), + Events: __webpack_require__(231), - TweenManager: __webpack_require__(463), - Tween: __webpack_require__(137), - TweenData: __webpack_require__(136), - Timeline: __webpack_require__(214) + TweenManager: __webpack_require__(498), + Tween: __webpack_require__(149), + TweenData: __webpack_require__(148), + Timeline: __webpack_require__(232) }; @@ -113456,29 +121252,30 @@ module.exports = Tweens; /***/ }), -/* 467 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); -var TimerEvent = __webpack_require__(219); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var TimerEvent = __webpack_require__(237); /** * @classdesc - * [description] + * The Clock is a Scene plugin which creates and updates Timer Events for its Scene. * * @class Clock * @memberof Phaser.Time * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which owns this Clock. */ var Clock = new Class({ @@ -113487,7 +121284,7 @@ var Clock = new Class({ function Clock (scene) { /** - * [description] + * The Scene which owns this Clock. * * @name Phaser.Time.Clock#scene * @type {Phaser.Scene} @@ -113496,7 +121293,7 @@ var Clock = new Class({ this.scene = scene; /** - * [description] + * The Scene Systems object of the Scene which owns this Clock. * * @name Phaser.Time.Clock#systems * @type {Phaser.Scenes.Systems} @@ -113505,7 +121302,9 @@ var Clock = new Class({ this.systems = scene.sys; /** - * [description] + * The current time of the Clock, in milliseconds. + * + * If accessed externally, this is equivalent to the `time` parameter normally passed to a Scene's `update` method. * * @name Phaser.Time.Clock#now * @type {number} @@ -113517,7 +121316,9 @@ var Clock = new Class({ // which then influences anything using this Clock for calculations, like TimerEvents /** - * [description] + * The scale of the Clock's time delta. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Clock and anything which uses it, such as its Timer Events. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing the Clock. * * @name Phaser.Time.Clock#timeScale * @type {number} @@ -113527,7 +121328,9 @@ var Clock = new Class({ this.timeScale = 1; /** - * [description] + * Whether the Clock is paused (`true`) or active (`false`). + * + * When paused, the Clock will not update any of its Timer Events, thus freezing time. * * @name Phaser.Time.Clock#paused * @type {boolean} @@ -113537,7 +121340,7 @@ var Clock = new Class({ this.paused = false; /** - * [description] + * An array of all Timer Events whose delays haven't expired - these are actively updating Timer Events. * * @name Phaser.Time.Clock#_active * @type {Phaser.Time.TimerEvent[]} @@ -113548,7 +121351,7 @@ var Clock = new Class({ this._active = []; /** - * [description] + * An array of all Timer Events which will be added to the Clock at the start of the frame. * * @name Phaser.Time.Clock#_pendingInsertion * @type {Phaser.Time.TimerEvent[]} @@ -113559,7 +121362,7 @@ var Clock = new Class({ this._pendingInsertion = []; /** - * [description] + * An array of all Timer Events which will be removed from the Clock at the start of the frame. * * @name Phaser.Time.Clock#_pendingRemoval * @type {Phaser.Time.TimerEvent[]} @@ -113569,8 +121372,8 @@ var Clock = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -113583,7 +121386,7 @@ var Clock = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -113599,20 +121402,20 @@ var Clock = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * [description] + * Creates a Timer Event and adds it to the Clock at the start of the frame. * * @method Phaser.Time.Clock#addEvent * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The configuration for the Timer Event. * - * @return {Phaser.Time.TimerEvent} [description] + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ addEvent: function (config) { @@ -113624,17 +121427,19 @@ var Clock = new Class({ }, /** - * [description] + * Creates a Timer Event and adds it to the Clock at the start of the frame. + * + * This is a shortcut for {@link #addEvent} which can be shorter and is compatible with the syntax of the GreenSock Animation Platform (GSAP). * * @method Phaser.Time.Clock#delayedCall * @since 3.0.0 * - * @param {number} delay - [description] - * @param {function} callback - [description] - * @param {Array.<*>} args - [description] - * @param {*} callbackScope - [description] + * @param {number} delay - The delay of the function call, in milliseconds. + * @param {function} callback - The function to call after the delay expires. + * @param {Array.<*>} args - The arguments to call the function with. + * @param {*} callbackScope - The scope (`this` object) to call the function with. * - * @return {Phaser.Time.TimerEvent} [description] + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ delayedCall: function (delay, callback, args, callbackScope) { @@ -113642,12 +121447,12 @@ var Clock = new Class({ }, /** - * [description] + * Clears and recreates the array of pending Timer Events. * * @method Phaser.Time.Clock#clearPendingEvents * @since 3.0.0 * - * @return {Phaser.Time.Clock} [description] + * @return {Phaser.Time.Clock} This Clock object. */ clearPendingEvents: function () { @@ -113657,12 +121462,12 @@ var Clock = new Class({ }, /** - * [description] + * Schedules all active Timer Events for removal at the start of the frame. * * @method Phaser.Time.Clock#removeAllEvents * @since 3.0.0 * - * @return {Phaser.Time.Clock} [description] + * @return {Phaser.Time.Clock} This Clock object. */ removeAllEvents: function () { @@ -113672,7 +121477,7 @@ var Clock = new Class({ }, /** - * [description] + * Updates the arrays of active and pending Timer Events. Called at the start of the frame. * * @method Phaser.Time.Clock#preUpdate * @since 3.0.0 @@ -113723,7 +121528,7 @@ var Clock = new Class({ }, /** - * [description] + * Updates the Clock's internal time and all of its Timer Events. * * @method Phaser.Time.Clock#update * @since 3.0.0 @@ -113819,9 +121624,9 @@ var Clock = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -113836,7 +121641,7 @@ var Clock = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -113850,12 +121655,12 @@ module.exports = Clock; /***/ }), -/* 468 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -113865,24 +121670,24 @@ module.exports = Clock; module.exports = { - Clock: __webpack_require__(467), - TimerEvent: __webpack_require__(219) + Clock: __webpack_require__(508), + TimerEvent: __webpack_require__(237) }; /***/ }), -/* 469 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var ParseToTilemap = __webpack_require__(141); +var ParseToTilemap = __webpack_require__(153); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -113938,17 +121743,17 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 470 */ +/* 511 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(14); -var ParseToTilemap = __webpack_require__(141); +var GameObjectCreator = __webpack_require__(15); +var ParseToTilemap = __webpack_require__(153); /** * @typedef {object} TilemapConfig @@ -113999,12 +121804,12 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 471 */ +/* 512 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114090,8 +121895,10 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer if (tileTexCoords) { - var halfWidth = tile.width / 2; - var halfHeight = tile.height / 2; + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; + var halfWidth = tileWidth / 2; + var halfHeight = tileHeight / 2; ctx.save(); @@ -114112,9 +121919,9 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer ctx.drawImage( image, tileTexCoords.x, tileTexCoords.y, - tile.width, tile.height, + tileWidth, tileHeight, -halfWidth, -halfHeight, - tile.width, tile.height + tileWidth, tileHeight ); ctx.restore(); @@ -114128,12 +121935,12 @@ module.exports = StaticTilemapLayerCanvasRenderer; /***/ }), -/* 472 */ +/* 513 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114200,12 +122007,12 @@ module.exports = StaticTilemapLayerWebGLRenderer; /***/ }), -/* 473 */ +/* 514 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114214,12 +122021,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(472); + renderWebGL = __webpack_require__(513); } if (true) { - renderCanvas = __webpack_require__(471); + renderCanvas = __webpack_require__(512); } module.exports = { @@ -114231,12 +122038,12 @@ module.exports = { /***/ }), -/* 474 */ +/* 515 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114358,16 +122165,16 @@ module.exports = DynamicTilemapLayerCanvasRenderer; /***/ }), -/* 475 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -114453,7 +122260,7 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer src, texture, texture.width, texture.height, - (tw + x + tile.pixelX) * sx, (th + y + tile.pixelY) * sy, + x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), tile.width, tile.height, sx, sy, tile.rotation, @@ -114475,12 +122282,12 @@ module.exports = DynamicTilemapLayerWebGLRenderer; /***/ }), -/* 476 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114489,12 +122296,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(475); + renderWebGL = __webpack_require__(516); } if (true) { - renderCanvas = __webpack_require__(474); + renderCanvas = __webpack_require__(515); } module.exports = { @@ -114506,16 +122313,16 @@ module.exports = { /***/ }), -/* 477 */ +/* 518 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tileset = __webpack_require__(107); +var Tileset = __webpack_require__(114); /** * [description] @@ -114557,17 +122364,17 @@ module.exports = ParseTilesets; /***/ }), -/* 478 */ +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LayerData = __webpack_require__(87); -var Tile = __webpack_require__(61); +var LayerData = __webpack_require__(93); +var Tile = __webpack_require__(67); /** * [description] @@ -114641,12 +122448,12 @@ module.exports = ParseTileLayers; /***/ }), -/* 479 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114714,12 +122521,12 @@ module.exports = AssignTileProperties; /***/ }), -/* 480 */ +/* 521 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -114787,28 +122594,28 @@ module.exports = BuildTilesetIndex; /***/ }), -/* 481 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = __webpack_require__(1); -var ParseObject = __webpack_require__(225); -var ObjectLayer = __webpack_require__(224); +var ParseObject = __webpack_require__(243); +var ObjectLayer = __webpack_require__(242); /** - * [description] + * Parses a Tiled JSON object into an array of ObjectLayer objects. * * @function Phaser.Tilemaps.Parsers.Tiled.ParseObjectLayers * @since 3.0.0 * - * @param {object} json - [description] + * @param {object} json - The Tiled JSON object. * - * @return {array} [description] + * @return {array} An array of all object layers in the tilemap as `ObjectLayer`s. */ var ParseObjectLayers = function (json) { @@ -114846,27 +122653,27 @@ module.exports = ParseObjectLayers; /***/ }), -/* 482 */ +/* 523 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasValue = __webpack_require__(77); +var HasValue = __webpack_require__(82); /** - * [description] + * Returns a new object that only contains the `keys` that were found on the object provided. If no `keys` are found, an empty object is returned. * * @function Phaser.Tilemaps.Parsers.Tiled.Pick * @since 3.0.0 * - * @param {object} object - [description] - * @param {array} keys - [description] + * @param {object} object - The object to pick the provided keys from. + * @param {array} keys - An array of properties to retrieve from the provided object. * - * @return {object} [description] + * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. */ var Pick = function (object, keys) { @@ -114889,18 +122696,18 @@ module.exports = Pick; /***/ }), -/* 483 */ +/* 524 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tileset = __webpack_require__(107); -var ImageCollection = __webpack_require__(226); -var ParseObject = __webpack_require__(225); +var Tileset = __webpack_require__(114); +var ImageCollection = __webpack_require__(244); +var ParseObject = __webpack_require__(243); /** * Tilesets & Image Collections @@ -114972,6 +122779,19 @@ var ParseTilesets = function (json) tiles[tile.id].objectgroup.objects = parsedObjects2; } } + + // Copy animation data + if (tile.animation) + { + if (tiles.hasOwnProperty(tile.id)) + { + tiles[tile.id].animation = tile.animation; + } + else + { + tiles[tile.id] = { animation: tile.animation }; + } + } } newSet.tileData = tiles; @@ -115045,12 +122865,12 @@ module.exports = ParseTilesets; /***/ }), -/* 484 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -115097,12 +122917,12 @@ module.exports = ParseImageLayers; /***/ }), -/* 485 */ +/* 526 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -115140,20 +122960,20 @@ module.exports = Base64Decode; /***/ }), -/* 486 */ +/* 527 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Base64Decode = __webpack_require__(485); +var Base64Decode = __webpack_require__(526); var GetFastValue = __webpack_require__(1); -var LayerData = __webpack_require__(87); -var ParseGID = __webpack_require__(227); -var Tile = __webpack_require__(61); +var LayerData = __webpack_require__(93); +var ParseGID = __webpack_require__(245); +var Tile = __webpack_require__(67); /** * [description] @@ -115266,12 +123086,12 @@ module.exports = ParseTileLayers; /***/ }), -/* 487 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -115281,28 +123101,28 @@ module.exports = ParseTileLayers; module.exports = { - Parse: __webpack_require__(230), - Parse2DArray: __webpack_require__(142), - ParseCSV: __webpack_require__(229), + Parse: __webpack_require__(248), + Parse2DArray: __webpack_require__(154), + ParseCSV: __webpack_require__(247), - Impact: __webpack_require__(223), - Tiled: __webpack_require__(228) + Impact: __webpack_require__(241), + Tiled: __webpack_require__(246) }; /***/ }), -/* 488 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); var Vector2 = __webpack_require__(3); /** @@ -115337,16 +123157,16 @@ module.exports = WorldToTileXY; /***/ }), -/* 489 */ +/* 530 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -115417,17 +123237,17 @@ module.exports = WeightedRandomize; /***/ }), -/* 490 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileToWorldX = __webpack_require__(109); -var TileToWorldY = __webpack_require__(108); +var TileToWorldX = __webpack_require__(116); +var TileToWorldY = __webpack_require__(115); var Vector2 = __webpack_require__(3); /** @@ -115461,16 +123281,16 @@ module.exports = TileToWorldXY; /***/ }), -/* 491 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -115512,17 +123332,17 @@ module.exports = SwapByIndex; /***/ }), -/* 492 */ +/* 533 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); -var ShuffleArray = __webpack_require__(132); +var GetTilesWithin = __webpack_require__(22); +var ShuffleArray = __webpack_require__(142); /** * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given @@ -115557,16 +123377,16 @@ module.exports = Shuffle; /***/ }), -/* 493 */ +/* 534 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. @@ -115600,12 +123420,12 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 494 */ +/* 535 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -115647,17 +123467,17 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 495 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(62); -var CalculateFacesWithin = __webpack_require__(38); +var SetTileCollision = __webpack_require__(68); +var CalculateFacesWithin = __webpack_require__(41); /** * Sets collision on the tiles within a layer by checking each tile's collision group data @@ -115707,18 +123527,18 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 496 */ +/* 537 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(62); -var CalculateFacesWithin = __webpack_require__(38); -var HasValue = __webpack_require__(77); +var SetTileCollision = __webpack_require__(68); +var CalculateFacesWithin = __webpack_require__(41); +var HasValue = __webpack_require__(82); /** * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property @@ -115782,18 +123602,18 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 497 */ +/* 538 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(62); -var CalculateFacesWithin = __webpack_require__(38); -var SetLayerCollisionIndex = __webpack_require__(143); +var SetTileCollision = __webpack_require__(68); +var CalculateFacesWithin = __webpack_require__(41); +var SetLayerCollisionIndex = __webpack_require__(155); /** * Sets collision on all tiles in the given layer, except for tiles that have an index specified in @@ -115839,18 +123659,18 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 498 */ +/* 539 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(62); -var CalculateFacesWithin = __webpack_require__(38); -var SetLayerCollisionIndex = __webpack_require__(143); +var SetTileCollision = __webpack_require__(68); +var CalculateFacesWithin = __webpack_require__(41); +var SetLayerCollisionIndex = __webpack_require__(155); /** * Sets collision on a range of tiles in a layer whose index is between the specified `start` and @@ -115907,18 +123727,18 @@ module.exports = SetCollisionBetween; /***/ }), -/* 499 */ +/* 540 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(62); -var CalculateFacesWithin = __webpack_require__(38); -var SetLayerCollisionIndex = __webpack_require__(143); +var SetTileCollision = __webpack_require__(68); +var CalculateFacesWithin = __webpack_require__(41); +var SetLayerCollisionIndex = __webpack_require__(155); /** * Sets collision on the given tile or tiles within a layer by index. You can pass in either a @@ -115970,17 +123790,17 @@ module.exports = SetCollision; /***/ }), -/* 500 */ +/* 541 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); -var Color = __webpack_require__(383); +var GetTilesWithin = __webpack_require__(22); +var Color = __webpack_require__(385); var defaultTileColor = new Color(105, 210, 231, 150); var defaultCollidingTileColor = new Color(243, 134, 48, 200); @@ -116059,18 +123879,18 @@ module.exports = RenderDebug; /***/ }), -/* 501 */ +/* 542 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RemoveTileAt = __webpack_require__(231); -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var RemoveTileAt = __webpack_require__(249); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); /** * Removes the tile at the given world coordinates in the specified layer and updates the layer's @@ -116100,17 +123920,17 @@ module.exports = RemoveTileAtWorldXY; /***/ }), -/* 502 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); -var GetRandom = __webpack_require__(178); +var GetTilesWithin = __webpack_require__(22); +var GetRandom = __webpack_require__(190); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -116158,17 +123978,17 @@ module.exports = Randomize; /***/ }), -/* 503 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CalculateFacesWithin = __webpack_require__(38); -var PutTileAt = __webpack_require__(144); +var CalculateFacesWithin = __webpack_require__(41); +var PutTileAt = __webpack_require__(156); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -116222,18 +124042,18 @@ module.exports = PutTilesAt; /***/ }), -/* 504 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PutTileAt = __webpack_require__(144); -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var PutTileAt = __webpack_require__(156); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); /** * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either @@ -116265,18 +124085,18 @@ module.exports = PutTileAtWorldXY; /***/ }), -/* 505 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasTileAt = __webpack_require__(232); -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var HasTileAt = __webpack_require__(250); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); /** * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns @@ -116305,18 +124125,18 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 506 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var GetTilesWithin = __webpack_require__(22); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. @@ -116355,23 +124175,23 @@ module.exports = GetTilesWithinWorldXY; /***/ }), -/* 507 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Geom = __webpack_require__(302); -var GetTilesWithin = __webpack_require__(19); -var Intersects = __webpack_require__(301); +var Geom = __webpack_require__(309); +var GetTilesWithin = __webpack_require__(22); +var Intersects = __webpack_require__(308); var NOOP = __webpack_require__(2); -var TileToWorldX = __webpack_require__(109); -var TileToWorldY = __webpack_require__(108); -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var TileToWorldX = __webpack_require__(116); +var TileToWorldY = __webpack_require__(115); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); var TriangleToRectangle = function (triangle, rect) { @@ -116452,18 +124272,18 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 508 */ +/* 549 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTileAt = __webpack_require__(110); -var WorldToTileX = __webpack_require__(54); -var WorldToTileY = __webpack_require__(53); +var GetTileAt = __webpack_require__(117); +var WorldToTileX = __webpack_require__(58); +var WorldToTileY = __webpack_require__(57); /** * Gets a tile at the given world coordinates from the given layer. @@ -116493,16 +124313,16 @@ module.exports = GetTileAtWorldXY; /***/ }), -/* 509 */ +/* 550 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * @callback EachTileCallback @@ -116543,16 +124363,16 @@ module.exports = ForEachTile; /***/ }), -/* 510 */ +/* 551 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * @callback FindTileCallback @@ -116597,12 +124417,12 @@ module.exports = FindTile; /***/ }), -/* 511 */ +/* 552 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -116685,16 +124505,16 @@ module.exports = FindByIndex; /***/ }), -/* 512 */ +/* 553 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); +var GetTilesWithin = __webpack_require__(22); /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given @@ -116733,18 +124553,18 @@ module.exports = FilterTiles; /***/ }), -/* 513 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); -var CalculateFacesWithin = __webpack_require__(38); -var SetTileCollision = __webpack_require__(62); +var GetTilesWithin = __webpack_require__(22); +var CalculateFacesWithin = __webpack_require__(41); +var SetTileCollision = __webpack_require__(68); /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the @@ -116787,17 +124607,17 @@ module.exports = Fill; /***/ }), -/* 514 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SnapFloor = __webpack_require__(158); -var SnapCeil = __webpack_require__(271); +var SnapFloor = __webpack_require__(107); +var SnapCeil = __webpack_require__(413); /** * Returns the tiles in the given layer that are within the camera's viewport. This is used internally. @@ -116863,15 +124683,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawTop; y < drawBottom; y++) { - for (x = drawLeft; x < drawRight; x++) + for (x = drawLeft; mapData[y] && x < drawRight; x++) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -116882,15 +124702,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawTop; y < drawBottom; y++) { - for (x = drawRight; x >= drawLeft; x--) + for (x = drawRight; mapData[y] && x >= drawLeft; x--) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -116901,15 +124721,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawBottom; y >= drawTop; y--) { - for (x = drawLeft; x < drawRight; x++) + for (x = drawLeft; mapData[y] && x < drawRight; x++) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -116920,15 +124740,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawBottom; y >= drawTop; y--) { - for (x = drawRight; x >= drawLeft; x--) + for (x = drawRight; mapData[y] && x >= drawLeft; x--) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -116944,19 +124764,19 @@ module.exports = CullTiles; /***/ }), -/* 515 */ +/* 556 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileToWorldX = __webpack_require__(109); -var TileToWorldY = __webpack_require__(108); -var GetTilesWithin = __webpack_require__(19); -var ReplaceByIndex = __webpack_require__(233); +var TileToWorldX = __webpack_require__(116); +var TileToWorldY = __webpack_require__(115); +var GetTilesWithin = __webpack_require__(22); +var ReplaceByIndex = __webpack_require__(251); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -117029,17 +124849,17 @@ module.exports = CreateFromTiles; /***/ }), -/* 516 */ +/* 557 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(19); -var CalculateFacesWithin = __webpack_require__(38); +var GetTilesWithin = __webpack_require__(22); +var CalculateFacesWithin = __webpack_require__(41); /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile @@ -117094,12 +124914,12 @@ module.exports = Copy; /***/ }), -/* 517 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117109,35 +124929,35 @@ module.exports = Copy; module.exports = { - Components: __webpack_require__(111), - Parsers: __webpack_require__(487), + Components: __webpack_require__(118), + Parsers: __webpack_require__(528), - Formats: __webpack_require__(30), - ImageCollection: __webpack_require__(226), - ParseToTilemap: __webpack_require__(141), - Tile: __webpack_require__(61), - Tilemap: __webpack_require__(222), - TilemapCreator: __webpack_require__(470), - TilemapFactory: __webpack_require__(469), - Tileset: __webpack_require__(107), + Formats: __webpack_require__(32), + ImageCollection: __webpack_require__(244), + ParseToTilemap: __webpack_require__(153), + Tile: __webpack_require__(67), + Tilemap: __webpack_require__(240), + TilemapCreator: __webpack_require__(511), + TilemapFactory: __webpack_require__(510), + Tileset: __webpack_require__(114), - LayerData: __webpack_require__(87), - MapData: __webpack_require__(86), - ObjectLayer: __webpack_require__(224), + LayerData: __webpack_require__(93), + MapData: __webpack_require__(92), + ObjectLayer: __webpack_require__(242), - DynamicTilemapLayer: __webpack_require__(221), - StaticTilemapLayer: __webpack_require__(220) + DynamicTilemapLayer: __webpack_require__(239), + StaticTilemapLayer: __webpack_require__(238) }; /***/ }), -/* 518 */ +/* 559 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117172,17 +124992,17 @@ module.exports = CONST; /***/ }), -/* 519 */ +/* 560 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Extend = __webpack_require__(21); -var FilterMode = __webpack_require__(518); +var FilterMode = __webpack_require__(559); /** * @namespace Phaser.Textures @@ -117204,12 +125024,13 @@ var FilterMode = __webpack_require__(518); var Textures = { + Events: __webpack_require__(136), FilterMode: FilterMode, - Frame: __webpack_require__(123), - Parsers: __webpack_require__(345), - Texture: __webpack_require__(181), - TextureManager: __webpack_require__(347), - TextureSource: __webpack_require__(346) + Frame: __webpack_require__(131), + Parsers: __webpack_require__(350), + Texture: __webpack_require__(193), + TextureManager: __webpack_require__(352), + TextureSource: __webpack_require__(351) }; @@ -117219,12 +125040,12 @@ module.exports = Textures; /***/ }), -/* 520 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117234,23 +125055,24 @@ module.exports = Textures; module.exports = { - List: __webpack_require__(122), - Map: __webpack_require__(198), - ProcessQueue: __webpack_require__(256), - RTree: __webpack_require__(255), - Set: __webpack_require__(96) + List: __webpack_require__(130), + Map: __webpack_require__(214), + ProcessQueue: __webpack_require__(274), + RTree: __webpack_require__(273), + Set: __webpack_require__(102), + Size: __webpack_require__(364) }; /***/ }), -/* 521 */ +/* 562 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117285,37 +125107,40 @@ module.exports = { module.exports = { - SoundManagerCreator: __webpack_require__(354), + SoundManagerCreator: __webpack_require__(359), - BaseSound: __webpack_require__(124), - BaseSoundManager: __webpack_require__(125), + Events: __webpack_require__(75), - WebAudioSound: __webpack_require__(348), - WebAudioSoundManager: __webpack_require__(349), + BaseSound: __webpack_require__(132), + BaseSoundManager: __webpack_require__(133), - HTML5AudioSound: __webpack_require__(352), - HTML5AudioSoundManager: __webpack_require__(353), + WebAudioSound: __webpack_require__(353), + WebAudioSoundManager: __webpack_require__(354), - NoAudioSound: __webpack_require__(350), - NoAudioSoundManager: __webpack_require__(351) + HTML5AudioSound: __webpack_require__(357), + HTML5AudioSoundManager: __webpack_require__(358), + + NoAudioSound: __webpack_require__(355), + NoAudioSoundManager: __webpack_require__(356) }; /***/ }), -/* 522 */ +/* 563 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); +var Events = __webpack_require__(16); var GetFastValue = __webpack_require__(1); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); /** * @classdesc @@ -117459,8 +125284,8 @@ var ScenePlugin = new Class({ */ this._willRemove = false; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(Events.BOOT, this.boot, this); + scene.sys.events.on(Events.START, this.pluginStart, this); }, /** @@ -117473,7 +125298,7 @@ var ScenePlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(Events.DESTROY, this.destroy, this); }, /** @@ -117489,7 +125314,7 @@ var ScenePlugin = new Class({ { this._target = null; - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(Events.SHUTDOWN, this.shutdown, this); }, /** @@ -117518,7 +125343,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#restart * @since 3.4.0 - * + * * @param {object} [data] - The Scene data. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. @@ -117534,8 +125359,8 @@ var ScenePlugin = new Class({ }, /** - * @typedef {object} Phaser.Scenes.ScenePlugin.SceneTransitionConfig - * + * @typedef {object} SceneTransitionConfig + * * @property {string} target - The Scene key to transition to. * @property {integer} [duration=1000] - The duration, in ms, for the transition to last. * @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`) @@ -117549,24 +125374,24 @@ var ScenePlugin = new Class({ /** * This will start a transition from the current Scene to the target Scene given. - * + * * The transition will last for the duration specified in milliseconds. - * + * * You can have the target Scene moved above or below this one in the display list. - * + * * You can specify an update callback. This callback will be invoked _every frame_ for the duration * of the transition. * * This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop. - * - * There are also 5 transition related events: This scene will emit the event `transitionto` when + * + * There are also 5 transition related events: This scene will emit the event `transitionout` when * the transition begins, which is typically the frame after calling this method. - * + * * The target Scene will emit the event `transitioninit` when that Scene's `init` method is called. * It will then emit the event `transitionstart` when its `create` method is called. * If the Scene was sleeping and has been woken up, it will emit the event `transitionwake` instead of these two, * as the Scenes `init` and `create` methods are not invoked when a Scene wakes up. - * + * * When the duration of the transition has elapsed it will emit the event `transitioncomplete`. * These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep. * @@ -117576,11 +125401,12 @@ var ScenePlugin = new Class({ * this Scenes update loop to stop, then the transition will also pause for that duration. There are * checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to * override this understand that until the target Scene completes it might never be unlocked for input events. - * + * * @method Phaser.Scenes.ScenePlugin#transition + * @fires Phaser.Scenes.Events#TRANSITION_OUT * @since 3.5.0 * - * @param {Phaser.Scenes.ScenePlugin.SceneTransitionConfig} config - The transition configuration object. + * @param {SceneTransitionConfig} config - The transition configuration object. * * @return {boolean} `true` is the transition was started, otherwise `false`. */ @@ -117642,9 +125468,9 @@ var ScenePlugin = new Class({ this.manager.start(key, GetFastValue(config, 'data')); } - this.systems.events.emit('transitionout', target, duration); + this.systems.events.emit(Events.TRANSITION_OUT, target, duration); - this.systems.events.on('update', this.step, this); + this.systems.events.on(Events.UPDATE, this.step, this); return true; }, @@ -117704,6 +125530,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#transitionComplete * @private + * @fires Phaser.Scenes.Events#TRANSITION_COMPLETE * @since 3.5.0 */ transitionComplete: function () @@ -117712,10 +125539,10 @@ var ScenePlugin = new Class({ var targetSettings = this._target.sys.settings; // Stop the step - this.systems.events.off('update', this.step, this); + this.systems.events.off(Events.UPDATE, this.step, this); // Notify target scene - targetSys.events.emit('transitioncomplete', this.scene); + targetSys.events.emit(Events.TRANSITION_COMPLETE, this.scene); // Clear target scene settings targetSettings.isTransition = false; @@ -117751,12 +125578,13 @@ var ScenePlugin = new Class({ * @param {string} key - The Scene key. * @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene. * @param {boolean} autoStart - Whether to start the Scene after it's added. + * @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ - add: function (key, sceneConfig, autoStart) + add: function (key, sceneConfig, autoStart, data) { - this.manager.add(key, sceneConfig, autoStart); + this.manager.add(key, sceneConfig, autoStart, data); return this; }, @@ -117784,7 +125612,7 @@ var ScenePlugin = new Class({ /** * Runs the given Scene, but does not change the state of this Scene. - * + * * If the given Scene is paused, it will resume it. If sleeping, it will wake it. * If not running at all, it will be started. * @@ -117915,7 +125743,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#stop * @since 3.0.0 * - * @param {string} key - The Scene to stop. + * @param {string} [key] - The Scene to stop. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -117985,7 +125813,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isSleeping * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is sleeping. */ @@ -118002,7 +125830,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isActive * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is active. */ @@ -118019,7 +125847,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isVisible * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is visible. */ @@ -118117,7 +125945,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#remove * @since 3.2.0 * - * @param {(string|Phaser.Scene)} key - The Scene to be removed. + * @param {(string|Phaser.Scene)} [key] - The Scene to be removed. * * @return {Phaser.Scenes.SceneManager} This SceneManager. */ @@ -118136,7 +125964,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveUp * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -118155,7 +125983,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveDown * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -118176,7 +126004,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#bringToTop * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -118197,7 +126025,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#sendToBack * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -118254,9 +126082,9 @@ var ScenePlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('shutdown', this.shutdown, this); - eventEmitter.off('postupdate', this.step, this); - eventEmitter.off('transitionout'); + eventEmitter.off(Events.SHUTDOWN, this.shutdown, this); + eventEmitter.off(Events.POST_UPDATE, this.step, this); + eventEmitter.off(Events.TRANSITION_OUT); }, /** @@ -118271,7 +126099,7 @@ var ScenePlugin = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(Events.START, this.start, this); this.scene = null; this.systems = null; @@ -118287,16 +126115,16 @@ module.exports = ScenePlugin; /***/ }), -/* 523 */ +/* 564 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(126); +var CONST = __webpack_require__(134); var Extend = __webpack_require__(21); /** @@ -118305,10 +126133,11 @@ var Extend = __webpack_require__(21); var Scene = { - SceneManager: __webpack_require__(358), - ScenePlugin: __webpack_require__(522), - Settings: __webpack_require__(355), - Systems: __webpack_require__(182) + Events: __webpack_require__(16), + SceneManager: __webpack_require__(363), + ScenePlugin: __webpack_require__(563), + Settings: __webpack_require__(360), + Systems: __webpack_require__(194) }; @@ -118319,12 +126148,68 @@ module.exports = Scene; /***/ }), -/* 524 */ +/* 565 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Extend = __webpack_require__(21); +var CONST = __webpack_require__(196); + +/** + * @namespace Phaser.Scale + * + * @borrows Phaser.Scale.Center.NO_CENTER as NO_CENTER + * @borrows Phaser.Scale.Center.CENTER_BOTH as CENTER_BOTH + * @borrows Phaser.Scale.Center.CENTER_HORIZONTALLY as CENTER_HORIZONTALLY + * @borrows Phaser.Scale.Center.CENTER_VERTICALLY as CENTER_VERTICALLY + * + * @borrows Phaser.Scale.Orientation.LANDSCAPE as LANDSCAPE + * @borrows Phaser.Scale.Orientation.PORTRAIT as PORTRAIT + * + * @borrows Phaser.Scale.ScaleModes.NONE as NONE + * @borrows Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT as WIDTH_CONTROLS_HEIGHT + * @borrows Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH as HEIGHT_CONTROLS_WIDTH + * @borrows Phaser.Scale.ScaleModes.FIT as FIT + * @borrows Phaser.Scale.ScaleModes.ENVELOP as ENVELOP + * @borrows Phaser.Scale.ScaleModes.RESIZE as RESIZE + * + * @borrows Phaser.Scale.Zoom.NO_ZOOM as NO_ZOOM + * @borrows Phaser.Scale.Zoom.ZOOM_2X as ZOOM_2X + * @borrows Phaser.Scale.Zoom.ZOOM_4X as ZOOM_4X + * @borrows Phaser.Scale.Zoom.MAX_ZOOM as MAX_ZOOM + */ + +var Scale = { + + Center: __webpack_require__(380), + Events: __webpack_require__(365), + Orientation: __webpack_require__(379), + ScaleManager: __webpack_require__(366), + ScaleModes: __webpack_require__(378), + Zoom: __webpack_require__(377) + +}; + +Scale = Extend(false, Scale, CONST.CENTER); +Scale = Extend(false, Scale, CONST.ORIENTATION); +Scale = Extend(false, Scale, CONST.SCALE_MODE); +Scale = Extend(false, Scale, CONST.ZOOM); + +module.exports = Scale; + + +/***/ }), +/* 566 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118334,20 +126219,20 @@ module.exports = Scene; module.exports = { - BitmapMaskPipeline: __webpack_require__(369), - ForwardDiffuseLightPipeline: __webpack_require__(368), - TextureTintPipeline: __webpack_require__(183) + BitmapMaskPipeline: __webpack_require__(398), + ForwardDiffuseLightPipeline: __webpack_require__(397), + TextureTintPipeline: __webpack_require__(199) }; /***/ }), -/* 525 */ +/* 567 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118357,10 +126242,10 @@ module.exports = { module.exports = { - Utils: __webpack_require__(9), - WebGLPipeline: __webpack_require__(184), - WebGLRenderer: __webpack_require__(371), - Pipelines: __webpack_require__(524), + Utils: __webpack_require__(10), + WebGLPipeline: __webpack_require__(200), + WebGLRenderer: __webpack_require__(400), + Pipelines: __webpack_require__(566), // Constants BYTE: 0, @@ -118373,19 +126258,32 @@ module.exports = { /***/ }), -/* 526 */ +/* 568 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * @callback SnapshotCallback * - * @param {HTMLImageElement} snapshot - [description] + * @param {(Phaser.Display.Color|HTMLImageElement)} snapshot - Either a Color object if a single pixel is being grabbed, or a new Image which contains a snapshot of the canvas contents. + */ + +/** + * @typedef {object} SnapshotState + * + * @property {SnapshotCallback} callback - The function to call after the snapshot is taken. + * @property {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @property {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * @property {integer} [x=0] - The x coordinate to start the snapshot from. + * @property {integer} [y=0] - The y coordinate to start the snapshot from. + * @property {integer} [width] - The width of the snapshot. + * @property {integer} [height] - The height of the snapshot. + * @property {boolean} [getPixel=false] - Is this a snapshot to get a single pixel, or an area? */ /** @@ -118394,19 +126292,19 @@ module.exports = { module.exports = { - Canvas: __webpack_require__(373), - WebGL: __webpack_require__(370) + Canvas: __webpack_require__(402), + WebGL: __webpack_require__(399) }; /***/ }), -/* 527 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118416,59 +126314,49 @@ module.exports = { module.exports = { - CanvasRenderer: __webpack_require__(374), - GetBlendModes: __webpack_require__(372), - SetTransform: __webpack_require__(23) + CanvasRenderer: __webpack_require__(403), + GetBlendModes: __webpack_require__(401), + SetTransform: __webpack_require__(25) }; /***/ }), -/* 528 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} RendererConfig - * - * @property {boolean} clearBeforeRender - [description] - * @property {boolean} antialias - [description] - * @property {Phaser.Display.Color} backgroundColor - [description] - * @property {number} resolution - [description] - * @property {boolean} autoResize - [description] - * @property {boolean} roundPixels - [description] - */ - /** * @namespace Phaser.Renderer */ module.exports = { - Canvas: __webpack_require__(527), - Snapshot: __webpack_require__(526), - WebGL: __webpack_require__(525) + Canvas: __webpack_require__(569), + Snapshot: __webpack_require__(568), + WebGL: __webpack_require__(567) }; /***/ }), -/* 529 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ -var BasePlugin = __webpack_require__(234); +var BasePlugin = __webpack_require__(252); var Class = __webpack_require__(0); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -118498,7 +126386,7 @@ var ScenePlugin = new Class({ this.scene = scene; this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); }, /** @@ -118546,12 +126434,12 @@ module.exports = ScenePlugin; /***/ }), -/* 530 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -118561,20 +126449,20 @@ module.exports = ScenePlugin; module.exports = { - BasePlugin: __webpack_require__(234), - DefaultPlugins: __webpack_require__(185), - PluginCache: __webpack_require__(15), - PluginManager: __webpack_require__(360), - ScenePlugin: __webpack_require__(529) + BasePlugin: __webpack_require__(252), + DefaultPlugins: __webpack_require__(201), + PluginCache: __webpack_require__(17), + PluginManager: __webpack_require__(367), + ScenePlugin: __webpack_require__(571) }; /***/ }), -/* 531 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(148); +var Matter = __webpack_require__(160); /** * A coordinate wrapping plugin for matter.js. @@ -118753,10 +126641,10 @@ module.exports = MatterWrap; */ /***/ }), -/* 532 */ +/* 574 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(148); +var Matter = __webpack_require__(160); /** * An attractors plugin for matter.js. @@ -118895,27 +126783,28 @@ module.exports = MatterAttractors; /***/ }), -/* 533 */ +/* 575 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(245); +var Factory = __webpack_require__(263); var GetFastValue = __webpack_require__(1); var GetValue = __webpack_require__(4); -var MatterAttractors = __webpack_require__(532); -var MatterLib = __webpack_require__(240); -var MatterWrap = __webpack_require__(531); -var Merge = __webpack_require__(79); -var Plugin = __webpack_require__(147); -var PluginCache = __webpack_require__(15); -var World = __webpack_require__(235); -var Vertices = __webpack_require__(29); +var MatterAttractors = __webpack_require__(574); +var MatterLib = __webpack_require__(258); +var MatterWrap = __webpack_require__(573); +var Merge = __webpack_require__(84); +var Plugin = __webpack_require__(159); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var World = __webpack_require__(253); +var Vertices = __webpack_require__(31); /** * @classdesc @@ -119004,8 +126893,8 @@ var MatterPhysics = new Class({ Plugin.use(MatterLib, MatterWrap); } - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -119021,7 +126910,7 @@ var MatterPhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -119043,9 +126932,9 @@ var MatterPhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -119205,9 +127094,9 @@ var MatterPhysics = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -119228,7 +127117,7 @@ var MatterPhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -119242,7 +127131,7 @@ module.exports = MatterPhysics; /***/ }), -/* 534 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119259,7 +127148,7 @@ var Svg = {}; module.exports = Svg; -var Bounds = __webpack_require__(33); +var Bounds = __webpack_require__(35); var Common = __webpack_require__(12); (function() { @@ -119473,7 +127362,7 @@ var Common = __webpack_require__(12); })(); /***/ }), -/* 535 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { // @if DEBUG @@ -119486,7 +127375,7 @@ var Metrics = {}; module.exports = Metrics; -var Composite = __webpack_require__(63); +var Composite = __webpack_require__(69); var Common = __webpack_require__(12); (function() { @@ -119572,7 +127461,7 @@ var Common = __webpack_require__(12); /***/ }), -/* 536 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119587,11 +127476,11 @@ var Query = {}; module.exports = Query; -var Vector = __webpack_require__(34); -var SAT = __webpack_require__(149); -var Bounds = __webpack_require__(33); -var Bodies = __webpack_require__(55); -var Vertices = __webpack_require__(29); +var Vector = __webpack_require__(36); +var SAT = __webpack_require__(161); +var Bounds = __webpack_require__(35); +var Bodies = __webpack_require__(59); +var Vertices = __webpack_require__(31); (function() { @@ -119708,38 +127597,46 @@ var Vertices = __webpack_require__(29); /***/ }), -/* 537 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bounds = __webpack_require__(33); +var Bounds = __webpack_require__(35); var Class = __webpack_require__(0); -var Composite = __webpack_require__(63); -var Constraint = __webpack_require__(73); -var Detector = __webpack_require__(150); -var GetFastValue = __webpack_require__(1); -var Merge = __webpack_require__(79); -var Sleeping = __webpack_require__(89); +var Composite = __webpack_require__(69); +var Constraint = __webpack_require__(78); +var Detector = __webpack_require__(162); +var Events = __webpack_require__(164); +var InputEvents = __webpack_require__(44); +var Merge = __webpack_require__(84); +var Sleeping = __webpack_require__(95); var Vector2 = __webpack_require__(3); -var Vertices = __webpack_require__(29); +var Vertices = __webpack_require__(31); /** * @classdesc - * [description] + * A Pointer Constraint is a special type of constraint that allows you to click + * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, + * and when one is pressed down it checks to see if that hit any part of any active + * body in the world. If it did, and the body has input enabled, it will begin to + * drag it until either released, or you stop it via the `stopDrag` method. + * + * You can adjust the stiffness, length and other properties of the constraint via + * the `options` object on creation. * * @class PointerConstraint * @memberof Phaser.Physics.Matter * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Physics.Matter.World} world - [description] - * @param {object} options - [description] + * @param {Phaser.Scene} scene - A reference to the Scene to which this Pointer Constraint belongs. + * @param {Phaser.Physics.Matter.World} world - A reference to the Matter World instance to which this Constraint belongs. + * @param {object} [options] - A Constraint configuration object. */ var PointerConstraint = new Class({ @@ -119766,7 +127663,8 @@ var PointerConstraint = new Class({ }; /** - * [description] + * A reference to the Scene to which this Pointer Constraint belongs. + * This is the same Scene as the Matter World instance. * * @name Phaser.Physics.Matter.PointerConstraint#scene * @type {Phaser.Scene} @@ -119775,7 +127673,7 @@ var PointerConstraint = new Class({ this.scene = scene; /** - * [description] + * A reference to the Matter World instance to which this Constraint belongs. * * @name Phaser.Physics.Matter.PointerConstraint#world * @type {Phaser.Physics.Matter.World} @@ -119784,27 +127682,18 @@ var PointerConstraint = new Class({ this.world = world; /** - * [description] + * The Camera the Pointer was interacting with when the input + * down event was processed. * * @name Phaser.Physics.Matter.PointerConstraint#camera * @type {Phaser.Cameras.Scene2D.Camera} * @since 3.0.0 */ - var camera = GetFastValue(options, 'camera', null); - - if (!camera) - { - this.camera = scene.sys.cameras.main; - } - else - { - this.camera = camera; - - delete options.camera; - } + this.camera = null; /** - * [description] + * A reference to the Input Pointer that activated this Constraint. + * This is set in the `onDown` handler. * * @name Phaser.Physics.Matter.PointerConstraint#pointer * @type {Phaser.Input.Pointer} @@ -119814,7 +127703,10 @@ var PointerConstraint = new Class({ this.pointer = null; /** - * [description] + * Is this Constraint active or not? + * + * An active constraint will be processed each update. An inactive one will be skipped. + * Use this to toggle a Pointer Constraint on and off. * * @name Phaser.Physics.Matter.PointerConstraint#active * @type {boolean} @@ -119824,7 +127716,7 @@ var PointerConstraint = new Class({ this.active = true; /** - * The transformed position. + * The internal transformed position. * * @name Phaser.Physics.Matter.PointerConstraint#position * @type {Phaser.Math.Vector2} @@ -119833,7 +127725,25 @@ var PointerConstraint = new Class({ this.position = new Vector2(); /** - * [description] + * The body that is currently being dragged, if any. + * + * @name Phaser.Physics.Matter.PointerConstraint#body + * @type {?MatterJS.Body} + * @since 3.16.2 + */ + this.body = null; + + /** + * The part of the body that was clicked on to start the drag. + * + * @name Phaser.Physics.Matter.PointerConstraint#part + * @type {?MatterJS.Body} + * @since 3.16.2 + */ + this.part = null; + + /** + * The native Matter Constraint that is used to attach to bodies. * * @name Phaser.Physics.Matter.PointerConstraint#constraint * @type {object} @@ -119841,49 +127751,90 @@ var PointerConstraint = new Class({ */ this.constraint = Constraint.create(Merge(options, defaults)); - this.world.on('beforeupdate', this.update, this); + this.world.on(Events.BEFORE_UPDATE, this.update, this); - scene.sys.input.on('pointerdown', this.onDown, this); - - scene.sys.input.on('pointerup', this.onUp, this); + scene.sys.input.on(InputEvents.POINTER_DOWN, this.onDown, this); }, /** - * [description] + * A Pointer has been pressed down onto the Scene. + * + * If this Constraint doesn't have an active Pointer then a hit test is + * run against all active bodies in the world. If one is found it is bound + * to this constraint and the drag begins. * * @method Phaser.Physics.Matter.PointerConstraint#onDown + * @fires Phaser.Physics.Matter.Events#DRAG_START * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. */ onDown: function (pointer) { - this.pointer = pointer; + if (!this.pointer) + { + if (this.getBody(pointer)) + { + this.pointer = pointer; + + this.camera = pointer.camera; + } + } }, /** - * [description] + * Scans all active bodies in the current Matter World to see if any of them + * are hit by the Pointer. The _first one_ found to hit is set as the active contraint + * body. * - * @method Phaser.Physics.Matter.PointerConstraint#onUp - * @since 3.0.0 + * @method Phaser.Physics.Matter.PointerConstraint#getBody + * @since 3.16.2 + * + * @return {boolean} `true` if a body was found and set, otherwise `false`. */ - onUp: function () + getBody: function (pointer) { - this.pointer = null; + var pos = this.position; + var constraint = this.constraint; + + pointer.camera.getWorldPoint(pointer.x, pointer.y, pos); + + var bodies = Composite.allBodies(this.world.localWorld); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + if (!body.ignorePointer && + Bounds.contains(body.bounds, pos) && + Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) + { + if (this.hitTestBody(body, pos)) + { + this.world.emit(Events.DRAG_START, this.body, this.part, this); + + return true; + } + } + } + + return false; }, /** - * [description] + * Scans the current body to determine if a part of it was clicked on. + * If a part is found the body is set as the `constraint.bodyB` property, + * as well as the `body` property of this class. The part is also set. * - * @method Phaser.Physics.Matter.PointerConstraint#getBodyPart - * @since 3.0.0 + * @method Phaser.Physics.Matter.PointerConstraint#hitTestBody + * @since 3.16.2 * - * @param {MatterJS.Body} body - [description] - * @param {Phaser.Math.Vector2} position - [description] + * @param {MatterJS.Body} body - The Matter Body to check. + * @param {Phaser.Math.Vector2} position - A translated hit test position. * - * @return {boolean} [description] + * @return {boolean} `true` if a part of the body was hit, otherwise `false`. */ - getBodyPart: function (body, position) + hitTestBody: function (body, position) { var constraint = this.constraint; @@ -119907,6 +127858,9 @@ var PointerConstraint = new Class({ Sleeping.set(body, false); + this.part = part; + this.body = body; + return true; } } @@ -119915,67 +127869,73 @@ var PointerConstraint = new Class({ }, /** - * [description] + * Internal update handler. Called in the Matter BEFORE_UPDATE step. * * @method Phaser.Physics.Matter.PointerConstraint#update + * @fires Phaser.Physics.Matter.Events#DRAG * @since 3.0.0 */ update: function () { - if (!this.active) + var body = this.body; + var pointer = this.pointer; + + if (!this.active || !pointer || !body) { return; } - var pointer = this.pointer; - var constraint = this.constraint; - - if (!pointer) + if (pointer.isDown) { - // Pointer is up / released - if (constraint.bodyB) - { - constraint.bodyB = null; - } + var pos = this.position; + var constraint = this.constraint; + + this.camera.getWorldPoint(pointer.x, pointer.y, pos); + + Sleeping.set(body, false); + + constraint.pointA.x = pos.x; + constraint.pointA.y = pos.y; + + this.world.emit(Events.DRAG, body, this); } else { - var pos = this.position; - - this.camera.getWorldPoint(pointer.x, pointer.y, pos); - - if (constraint.bodyB) - { - // Pointer is down and we have bodyB, so wake it up - Sleeping.set(constraint.bodyB, false); - - constraint.pointA.x = pos.x; - constraint.pointA.y = pos.y; - } - else - { - var bodies = Composite.allBodies(this.world.localWorld); - - // Pointer is down and no bodyB, so check if we've hit anything - for (var i = 0; i < bodies.length; i++) - { - var body = bodies[i]; - - if (!body.ignorePointer && Bounds.contains(body.bounds, pos) && - Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) - { - if (this.getBodyPart(body, pos)) - { - break; - } - } - } - } + // Pointer has been released since the last world step + this.stopDrag(); } }, /** - * [description] + * Stops the Pointer Constraint from dragging the body any further. + * + * This is called automatically if the Pointer is released while actively + * dragging a body. Or, you can call it manually to release a body from a + * constraint without having to first release the pointer. + * + * @method Phaser.Physics.Matter.PointerConstraint#stopDrag + * @fires Phaser.Physics.Matter.Events#DRAG_END + * @since 3.16.2 + */ + stopDrag: function () + { + var body = this.body; + var constraint = this.constraint; + + if (body) + { + this.world.emit(Events.DRAG_END, body, this); + + this.pointer = null; + this.body = null; + this.part = null; + + constraint.bodyB = null; + } + }, + + /** + * Destroys this Pointer Constraint instance and all of its references. * * @method Phaser.Physics.Matter.PointerConstraint#destroy * @since 3.0.0 @@ -119984,13 +127944,14 @@ var PointerConstraint = new Class({ { this.world.removeConstraint(this.constraint); + this.pointer = null; this.constraint = null; + this.body = null; + this.part = null; - this.world.off('beforeupdate', this.update); + this.world.off(Events.BEFORE_UPDATE, this.update); - this.scene.sys.input.off('pointerdown', this.onDown, this); - - this.scene.sys.input.off('pointerup', this.onUp, this); + this.scene.sys.input.off(InputEvents.POINTER_DOWN, this.onDown, this); } }); @@ -119999,16 +127960,16 @@ module.exports = PointerConstraint; /***/ }), -/* 538 */ +/* 580 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(25); +var Body = __webpack_require__(27); /** * [description] @@ -120036,12 +127997,12 @@ var Velocity = { }, /** - * [description] + * Sets the horizontal velocity of the physics body. * * @method Phaser.Physics.Matter.Components.Velocity#setVelocityX * @since 3.0.0 * - * @param {number} x - [description] + * @param {number} x - The horizontal velocity value. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -120055,12 +128016,12 @@ var Velocity = { }, /** - * [description] + * Sets vertical velocity of the physics body. * * @method Phaser.Physics.Matter.Components.Velocity#setVelocityY * @since 3.0.0 * - * @param {number} y - [description] + * @param {number} y - The vertical velocity value. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -120074,13 +128035,13 @@ var Velocity = { }, /** - * [description] + * Sets both the horizontal and vertical velocity of the physics body. * * @method Phaser.Physics.Matter.Components.Velocity#setVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The horizontal velocity value. + * @param {number} [y=x] - The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the `x` value. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -120099,19 +128060,19 @@ module.exports = Velocity; /***/ }), -/* 539 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(25); -var MATH_CONST = __webpack_require__(18); -var WrapAngle = __webpack_require__(205); -var WrapAngleDegrees = __webpack_require__(204); +var Body = __webpack_require__(27); +var MATH_CONST = __webpack_require__(20); +var WrapAngle = __webpack_require__(221); +var WrapAngleDegrees = __webpack_require__(220); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -120188,8 +128149,9 @@ var Transform = { set: function (value) { - var factor = 1 / this._scaleX; - + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; + this._scaleX = value; if (this._scaleX === 0) @@ -120202,7 +128164,7 @@ var Transform = { } // Reset Matter scale back to 1 (sigh) - Body.scale(this.body, factor, this._scaleY); + Body.scale(this.body, factorX, factorY); Body.scale(this.body, value, this._scaleY); } @@ -120225,7 +128187,8 @@ var Transform = { set: function (value) { - var factor = 1 / this._scaleY; + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; this._scaleY = value; @@ -120238,7 +128201,7 @@ var Transform = { this.renderFlags |= _FLAG; } - Body.scale(this.body, this._scaleX, factor); + Body.scale(this.body, factorX, factorY); Body.scale(this.body, this._scaleX, value); } @@ -120405,16 +128368,376 @@ module.exports = Transform; /***/ }), -/* 540 */ +/* 582 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepStartEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Body goes to sleep. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_START + * + * @param {Phaser.Physics.Matter.Events.SleepStartEvent} event - The Sleep Event object. + * @param {MatterJS.Body} body - The body that has gone to sleep. + */ +module.exports = 'sleepstart'; + + +/***/ }), +/* 583 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepEndEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep End Event. + * + * This event is dispatched by a Matter Physics World instance when a Body stop sleeping. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_END + * + * @param {Phaser.Physics.Matter.Events.SleepEndEvent} event - The Sleep Event object. + * @param {MatterJS.Body} body - The body that has stopped sleeping. + */ +module.exports = 'sleepend'; + + +/***/ }), +/* 584 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics World Resume Event. + * + * This event is dispatched by an Matter Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`. + * + * @event Phaser.Physics.Matter.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 585 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics World Pause Event. + * + * This event is dispatched by an Matter Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`. + * + * @event Phaser.Physics.Matter.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 586 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * starts dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_START + * + * @param {MatterJS.Body} body - The Body that has started being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {MatterJS.Body} part - The part of the body that was clicked on. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 587 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * is actively dragging a body. It is emitted each time the pointer moves. + * + * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG + * + * @param {MatterJS.Body} body - The Body that is being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'drag'; + + +/***/ }), +/* 588 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag End Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * stops dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_END + * + * @param {MatterJS.Body} body - The Body that has stopped being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that was dragging the body. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 589 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionStartEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Start Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have started to collide in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_START + * + * @param {Phaser.Physics.Matter.Events.CollisionStartEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionstart'; + + +/***/ }), +/* 590 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionEndEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision End Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have finished colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_END + * + * @param {Phaser.Physics.Matter.Events.CollisionEndEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionend'; + + +/***/ }), +/* 591 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionActiveEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Active Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that are colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_ACTIVE + * + * @param {Phaser.Physics.Matter.Events.CollisionActiveEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionactive'; + + +/***/ }), +/* 592 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.BeforeUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Before Update Event. + * + * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place. + * + * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#BEFORE_UPDATE + * + * @param {Phaser.Physics.Matter.Events.BeforeUpdateEvent} event - The Update Event object. + */ +module.exports = 'beforeupdate'; + + +/***/ }), +/* 593 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.AfterUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics After Update Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved. + * + * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#AFTER_UPDATE + * + * @param {Phaser.Physics.Matter.Events.AfterUpdateEvent} event - The Update Event object. + */ +module.exports = 'afterupdate'; + + +/***/ }), +/* 594 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MatterEvents = __webpack_require__(74); +var Events = __webpack_require__(164); +var MatterEvents = __webpack_require__(79); /** * [description] @@ -120480,7 +128803,7 @@ var Sleep = { MatterEvents.on(this.body, 'sleepStart', function (event) { - world.emit('sleepstart', event, this); + world.emit(Events.SLEEP_START, event, this); }); } else @@ -120509,7 +128832,7 @@ var Sleep = { MatterEvents.on(this.body, 'sleepEnd', function (event) { - world.emit('sleepend', event, this); + world.emit(Events.SLEEP_END, event, this); }); } else @@ -120526,7 +128849,7 @@ module.exports = Sleep; /***/ }), -/* 541 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120535,13 +128858,13 @@ module.exports = Sleep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(55); -var Body = __webpack_require__(25); -var Bounds = __webpack_require__(33); +var Bodies = __webpack_require__(59); +var Body = __webpack_require__(27); +var Bounds = __webpack_require__(35); var Common = __webpack_require__(12); var GetFastValue = __webpack_require__(1); -var Vector = __webpack_require__(34); -var Vertices = __webpack_require__(29); +var Vector = __webpack_require__(36); +var Vertices = __webpack_require__(31); /** * Use PhysicsEditorParser.parseBody() to build a Matter body object, based on a physics data file @@ -120703,20 +129026,20 @@ module.exports = PhysicsEditorParser; /***/ }), -/* 542 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(55); -var Body = __webpack_require__(25); +var Bodies = __webpack_require__(59); +var Body = __webpack_require__(27); var GetFastValue = __webpack_require__(1); -var PhysicsEditorParser = __webpack_require__(541); -var Vertices = __webpack_require__(29); +var PhysicsEditorParser = __webpack_require__(595); +var Vertices = __webpack_require__(31); /** * [description] @@ -120729,13 +129052,13 @@ var SetBody = { // Calling any of these methods resets previous properties you may have set on the body, including plugins, mass, etc /** - * [description] + * Set the body on a Game Object to a rectangle. * * @method Phaser.Physics.Matter.Components.SetBody#setRectangle * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. * @param {object} options - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. @@ -120762,14 +129085,14 @@ var SetBody = { }, /** - * [description] + * Set the body on the Game Object to a polygon shape. * * @method Phaser.Physics.Matter.Components.SetBody#setPolygon * @since 3.0.0 * - * @param {number} radius - [description] - * @param {number} sides - [description] - * @param {object} options - [description] + * @param {number} radius - The radius of the polygon. + * @param {number} sides - The amount of sides creating the polygon. + * @param {object} options - A matterjs config object. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -120779,15 +129102,15 @@ var SetBody = { }, /** - * [description] + * Creates a new matterjs trapezoid body. * * @method Phaser.Physics.Matter.Components.SetBody#setTrapezoid * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} slope - [description] - * @param {object} options - [description] + * @param {number} width - The width of the trapezoid. + * @param {number} height - The height of the trapezoid. + * @param {number} slope - The angle of slope for the trapezoid. + * @param {object} options - A matterjs config object for the body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -120953,12 +129276,12 @@ module.exports = SetBody; /***/ }), -/* 543 */ +/* 597 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121006,16 +129329,16 @@ module.exports = Sensor; /***/ }), -/* 544 */ +/* 598 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(25); +var Body = __webpack_require__(27); /** * [description] @@ -121061,20 +129384,20 @@ module.exports = Static; /***/ }), -/* 545 */ +/* 599 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(25); +var Body = __webpack_require__(27); var Vector2 = __webpack_require__(3); /** - * [description] + * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly. * * @name Phaser.Physics.Matter.Components.Mass * @since 3.0.0 @@ -121082,12 +129405,12 @@ var Vector2 = __webpack_require__(3); var Mass = { /** - * [description] + * Sets the mass of the Game Object's Matter Body. * * @method Phaser.Physics.Matter.Components.Mass#setMass * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new mass of the body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -121099,12 +129422,12 @@ var Mass = { }, /** - * [description] + * Sets density of the body. * * @method Phaser.Physics.Matter.Components.Mass#setDensity * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new density of the body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -121138,12 +129461,12 @@ module.exports = Mass; /***/ }), -/* 546 */ +/* 600 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121178,17 +129501,17 @@ module.exports = Gravity; /***/ }), -/* 547 */ +/* 601 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly. * * @name Phaser.Physics.Matter.Components.Friction * @since 3.0.0 @@ -121196,14 +129519,14 @@ module.exports = Gravity; var Friction = { /** - * [description] + * Sets new friction values for this Game Object's Matter Body. * * @method Phaser.Physics.Matter.Components.Friction#setFriction * @since 3.0.0 * - * @param {number} value - [description] - * @param {number} [air] - [description] - * @param {number} [fstatic] - [description] + * @param {number} value - The new friction of the body, between 0 and 1, where 0 allows the Body to slide indefinitely, while 1 allows it to stop almost immediately after a force is applied. + * @param {number} [air] - If provided, the new air resistance of the Body. The higher the value, the faster the Body will slow as it moves through space. 0 means the body has no air resistance. + * @param {number} [fstatic] - If provided, the new static friction of the Body. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. 0 means the body will never "stick" when it is nearly stationary. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -121225,12 +129548,12 @@ var Friction = { }, /** - * [description] + * Sets a new air resistance for this Game Object's Matter Body. A value of 0 means the Body will never slow as it moves through space. The higher the value, the faster a Body slows when moving through space. * * @method Phaser.Physics.Matter.Components.Friction#setFrictionAir * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new air resistance for the Body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -121242,12 +129565,12 @@ var Friction = { }, /** - * [description] + * Sets a new static friction for this Game Object's Matter Body. A value of 0 means the Body will never "stick" when it is nearly stationary. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. * * @method Phaser.Physics.Matter.Components.Friction#setFrictionStatic * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new static friction for the Body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -121264,16 +129587,16 @@ module.exports = Friction; /***/ }), -/* 548 */ +/* 602 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(25); +var Body = __webpack_require__(27); /** * A component to apply force to Matter.js bodies. @@ -121412,17 +129735,17 @@ module.exports = Force; /***/ }), -/* 549 */ +/* 603 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly. * * @name Phaser.Physics.Matter.Components.Collision * @since 3.0.0 @@ -121430,7 +129753,7 @@ module.exports = Force; var Collision = { /** - * [description] + * Sets the collision category of this Game Object's Matter Body. This number must be a power of two between 2^0 (= 1) and 2^31. Two bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision categories are included in their collision masks (see {@link #setCollidesWith}). * * @method Phaser.Physics.Matter.Components.Collision#setCollisionCategory * @since 3.0.0 @@ -121447,7 +129770,7 @@ var Collision = { }, /** - * [description] + * Sets the collision group of this Game Object's Matter Body. If this is zero or two Matter Bodies have different values, they will collide according to the usual rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}). If two Matter Bodies have the same positive value, they will always collide; if they have the same negative value, they will never collide. * * @method Phaser.Physics.Matter.Components.Collision#setCollisionGroup * @since 3.0.0 @@ -121464,7 +129787,7 @@ var Collision = { }, /** - * [description] + * Sets the collision mask for this Game Object's Matter Body. Two Matter Bodies with different collision groups will only collide if each one includes the other's category in its mask based on a bitwise AND, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` are both true. * * @method Phaser.Physics.Matter.Components.Collision#setCollidesWith * @since 3.0.0 @@ -121500,17 +129823,17 @@ module.exports = Collision; /***/ }), -/* 550 */ +/* 604 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * A component to set restitution on objects. * * @name Phaser.Physics.Matter.Components.Bounce * @since 3.0.0 @@ -121518,12 +129841,12 @@ module.exports = Collision; var Bounce = { /** - * [description] + * Sets the restitution on the physics object. * * @method Phaser.Physics.Matter.Components.Bounce#setBounce * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: `Math.max(bodyA.restitution, bodyB.restitution)` * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -121540,16 +129863,16 @@ module.exports = Bounce; /***/ }), -/* 551 */ +/* 605 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Components = __webpack_require__(113); +var Components = __webpack_require__(120); var GetFastValue = __webpack_require__(1); var Vector2 = __webpack_require__(3); @@ -121651,12 +129974,12 @@ module.exports = MatterGameObject; /***/ }), -/* 552 */ +/* 606 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -121666,14 +129989,14 @@ module.exports = MatterGameObject; module.exports = { - Factory: __webpack_require__(245), - Image: __webpack_require__(242), - Matter: __webpack_require__(148), - MatterPhysics: __webpack_require__(533), - PolyDecomp: __webpack_require__(244), - Sprite: __webpack_require__(241), - TileBody: __webpack_require__(151), - World: __webpack_require__(235) + Factory: __webpack_require__(263), + Image: __webpack_require__(260), + Matter: __webpack_require__(160), + MatterPhysics: __webpack_require__(575), + PolyDecomp: __webpack_require__(262), + Sprite: __webpack_require__(259), + TileBody: __webpack_require__(163), + World: __webpack_require__(253) }; @@ -121740,19 +130063,19 @@ module.exports = { /***/ }), -/* 553 */ +/* 607 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @function Phaser.Physics.Impact.SeperateY + * @function Phaser.Physics.Impact.SeparateY * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - [description] @@ -121760,7 +130083,7 @@ module.exports = { * @param {Phaser.Physics.Impact.Body} bottom - [description] * @param {Phaser.Physics.Impact.Body} [weak] - [description] */ -var SeperateY = function (world, top, bottom, weak) +var SeparateY = function (world, top, bottom, weak) { var nudge = (top.pos.y + top.size.y - bottom.pos.y); var nudgeX; @@ -121821,23 +130144,23 @@ var SeperateY = function (world, top, bottom, weak) } }; -module.exports = SeperateY; +module.exports = SeparateY; /***/ }), -/* 554 */ +/* 608 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @function Phaser.Physics.Impact.SeperateX + * @function Phaser.Physics.Impact.SeparateX * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - [description] @@ -121845,7 +130168,7 @@ module.exports = SeperateY; * @param {Phaser.Physics.Impact.Body} right - [description] * @param {Phaser.Physics.Impact.Body} [weak] - [description] */ -var SeperateX = function (world, left, right, weak) +var SeparateX = function (world, left, right, weak) { var nudge = left.pos.x + left.size.x - right.pos.x; @@ -121877,32 +130200,34 @@ var SeperateX = function (world, left, right, weak) } }; -module.exports = SeperateX; +module.exports = SeparateX; /***/ }), -/* 555 */ +/* 609 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var COLLIDES = __webpack_require__(91); -var SeperateX = __webpack_require__(554); -var SeperateY = __webpack_require__(553); +var COLLIDES = __webpack_require__(97); +var Events = __webpack_require__(167); +var SeparateX = __webpack_require__(608); +var SeparateY = __webpack_require__(607); /** * Impact Physics Solver * * @function Phaser.Physics.Impact.Solver + * @fires Phaser.Physics.Impact.Events#COLLIDE * @since 3.0.0 * - * @param {Phaser.Physics.Impact.World} world - [description] - * @param {Phaser.Physics.Impact.Body} bodyA - [description] - * @param {Phaser.Physics.Impact.Body} bodyB - [description] + * @param {Phaser.Physics.Impact.World} world - The Impact simulation to run the solver in. + * @param {Phaser.Physics.Impact.Body} bodyA - The first body in the collision. + * @param {Phaser.Physics.Impact.Body} bodyB - The second body in the collision. */ var Solver = function (world, bodyA, bodyB) { @@ -121921,33 +130246,33 @@ var Solver = function (world, bodyA, bodyB) { if (bodyA.last.y < bodyB.last.y) { - SeperateY(world, bodyA, bodyB, weak); + SeparateY(world, bodyA, bodyB, weak); } else { - SeperateY(world, bodyB, bodyA, weak); + SeparateY(world, bodyB, bodyA, weak); } bodyA.collideWith(bodyB, 'y'); bodyB.collideWith(bodyA, 'y'); - world.emit('collide', bodyA, bodyB, 'y'); + world.emit(Events.COLLIDE, bodyA, bodyB, 'y'); } else if (bodyA.last.y + bodyA.size.y > bodyB.last.y && bodyA.last.y < bodyB.last.y + bodyB.size.y) { if (bodyA.last.x < bodyB.last.x) { - SeperateX(world, bodyA, bodyB, weak); + SeparateX(world, bodyA, bodyB, weak); } else { - SeperateX(world, bodyB, bodyA, weak); + SeparateX(world, bodyB, bodyA, weak); } bodyA.collideWith(bodyB, 'x'); bodyB.collideWith(bodyA, 'x'); - world.emit('collide', bodyA, bodyB, 'x'); + world.emit(Events.COLLIDE, bodyA, bodyB, 'x'); } }; @@ -121955,21 +130280,22 @@ module.exports = Solver; /***/ }), -/* 556 */ +/* 610 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(250); +var Factory = __webpack_require__(268); var GetFastValue = __webpack_require__(1); -var Merge = __webpack_require__(79); -var PluginCache = __webpack_require__(15); -var World = __webpack_require__(246); +var Merge = __webpack_require__(84); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var World = __webpack_require__(264); /** * @classdesc @@ -122033,8 +130359,8 @@ var ImpactPhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -122050,7 +130376,7 @@ var ImpactPhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -122072,8 +130398,8 @@ var ImpactPhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -122135,8 +130461,8 @@ var ImpactPhysics = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -122157,7 +130483,7 @@ var ImpactPhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -122171,12 +130497,12 @@ module.exports = ImpactPhysics; /***/ }), -/* 557 */ +/* 611 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122271,12 +130597,12 @@ module.exports = Velocity; /***/ }), -/* 558 */ +/* 612 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122347,12 +130673,12 @@ module.exports = SetGameObject; /***/ }), -/* 559 */ +/* 613 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122397,12 +130723,12 @@ module.exports = Offset; /***/ }), -/* 560 */ +/* 614 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122459,12 +130785,12 @@ module.exports = Gravity; /***/ }), -/* 561 */ +/* 615 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122536,12 +130862,12 @@ module.exports = Friction; /***/ }), -/* 562 */ +/* 616 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122661,16 +130987,16 @@ module.exports = Debug; /***/ }), -/* 563 */ +/* 617 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var COLLIDES = __webpack_require__(91); +var COLLIDES = __webpack_require__(97); /** * @callback CollideCallback @@ -122817,16 +131143,16 @@ module.exports = Collides; /***/ }), -/* 564 */ +/* 618 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TYPE = __webpack_require__(90); +var TYPE = __webpack_require__(96); /** * The Impact Check Against component. @@ -122939,12 +131265,12 @@ module.exports = CheckAgainst; /***/ }), -/* 565 */ +/* 619 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123019,16 +131345,16 @@ module.exports = Bounce; /***/ }), -/* 566 */ +/* 620 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TYPE = __webpack_require__(90); +var TYPE = __webpack_require__(96); /** * The Impact Body Type component. @@ -123103,12 +131429,12 @@ module.exports = BodyType; /***/ }), -/* 567 */ +/* 621 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123177,12 +131503,12 @@ module.exports = BodyScale; /***/ }), -/* 568 */ +/* 622 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123254,12 +131580,12 @@ module.exports = Acceleration; /***/ }), -/* 569 */ +/* 623 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123325,12 +131651,82 @@ module.exports = { /***/ }), -/* 570 */ +/* 624 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Resume Event. + * + * This event is dispatched by an Impact Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.impact.world.on('resume', listener)`. + * + * @event Phaser.Physics.Impact.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 625 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Pause Event. + * + * This event is dispatched by an Impact Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.impact.world.on('pause', listener)`. + * + * @event Phaser.Physics.Impact.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 626 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Collide Event. + * + * This event is dispatched by an Impact Physics World instance if two bodies collide. + * + * Listen to it from a Scene using: `this.impact.world.on('collide', listener)`. + * + * @event Phaser.Physics.Impact.Events#COLLIDE + * + * @param {Phaser.Physics.Impact.Body} bodyA - The first body involved in the collision. + * @param {Phaser.Physics.Impact.Body} bodyB - The second body involved in the collision. + * @param {string} axis - The collision axis. Either `x` or `y`. + */ +module.exports = 'collide'; + + +/***/ }), +/* 627 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123420,12 +131816,12 @@ module.exports = UpdateMotion; /***/ }), -/* 571 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123476,12 +131872,12 @@ module.exports = GetVelocity; /***/ }), -/* 572 */ +/* 629 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123502,44 +131898,49 @@ module.exports = GetVelocity; */ module.exports = { - Body: __webpack_require__(252), - COLLIDES: __webpack_require__(91), - CollisionMap: __webpack_require__(251), - Factory: __webpack_require__(250), - Image: __webpack_require__(248), - ImpactBody: __webpack_require__(249), - ImpactPhysics: __webpack_require__(556), - Sprite: __webpack_require__(247), - TYPE: __webpack_require__(90), - World: __webpack_require__(246) + Body: __webpack_require__(270), + Events: __webpack_require__(167), + COLLIDES: __webpack_require__(97), + CollisionMap: __webpack_require__(269), + Factory: __webpack_require__(268), + Image: __webpack_require__(266), + ImpactBody: __webpack_require__(267), + ImpactPhysics: __webpack_require__(610), + Sprite: __webpack_require__(265), + TYPE: __webpack_require__(96), + World: __webpack_require__(264) }; /***/ }), -/* 573 */ +/* 630 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapY = __webpack_require__(257); +var GetOverlapY = __webpack_require__(275); /** - * [description] + * Separates two overlapping bodies on the Y-axis (vertically). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} [description] + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. */ var SeparateY = function (body1, body2, overlapOnly, bias) { @@ -123604,29 +132005,33 @@ module.exports = SeparateY; /***/ }), -/* 574 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapX = __webpack_require__(258); +var GetOverlapX = __webpack_require__(276); /** - * [description] + * Separates two overlapping bodies on the X-axis (horizontally). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateX * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} [description] + * @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`. */ var SeparateX = function (body1, body2, overlapOnly, bias) { @@ -123691,12 +132096,12 @@ module.exports = SeparateX; /***/ }), -/* 575 */ +/* 632 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123738,28 +132143,29 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 576 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(575); +var ProcessTileSeparationY = __webpack_require__(632); /** * Check the body against the given tile on the Y axis. + * Used internally by the SeparateTile function. * * @function Phaser.Physics.Arcade.Tilemap.TileCheckY * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileTop - [description] - * @param {number} tileBottom - [description] - * @param {number} tileBias - [description] + * @param {number} tileTop - The top position of the tile within the tile world. + * @param {number} tileBottom - The bottom position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * * @return {number} The amount of separation that occurred. */ @@ -123813,12 +132219,12 @@ module.exports = TileCheckY; /***/ }), -/* 577 */ +/* 634 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123860,28 +132266,29 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 578 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(577); +var ProcessTileSeparationX = __webpack_require__(634); /** * Check the body against the given tile on the X axis. + * Used internally by the SeparateTile function. * * @function Phaser.Physics.Arcade.Tilemap.TileCheckX * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileLeft - [description] - * @param {number} tileRight - [description] - * @param {number} tileBias - [description] + * @param {number} tileLeft - The left position of the tile within the tile world. + * @param {number} tileRight - The right position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * * @return {number} The amount of separation that occurred. */ @@ -123935,18 +132342,18 @@ module.exports = TileCheckX; /***/ }), -/* 579 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileCheckX = __webpack_require__(578); -var TileCheckY = __webpack_require__(576); -var TileIntersectsBody = __webpack_require__(254); +var TileCheckX = __webpack_require__(635); +var TileCheckY = __webpack_require__(633); +var TileIntersectsBody = __webpack_require__(272); /** * The core separation function to separate a physics body and a tile. @@ -123954,14 +132361,14 @@ var TileIntersectsBody = __webpack_require__(254); * @function Phaser.Physics.Arcade.Tilemap.SeparateTile * @since 3.0.0 * - * @param {number} i - [description] + * @param {number} i - The index of the tile within the map data. * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. - * @param {Phaser.Geom.Rectangle} tileWorldRect - [description] + * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against. - * @param {number} tileBias - [description] + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * - * @return {boolean} Returns true if the body was separated, otherwise false. + * @return {boolean} `true` if the body was separated, otherwise `false`. */ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias) { @@ -124048,29 +132455,29 @@ module.exports = SeparateTile; /***/ }), -/* 580 */ +/* 637 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object. * * @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks * @since 3.0.0 * - * @param {Phaser.Tilemaps.Tilemap} tile - [description] - * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Tilemaps.Tile} tile - The Tile to process. + * @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile. * - * @return {boolean} [description] + * @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair. */ var ProcessTileCallbacks = function (tile, sprite) { - // Tile callbacks take priority over layer level callbacks + // Tile callbacks take priority over layer level callbacks if (tile.collisionCallback) { return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile); @@ -124089,17 +132496,220 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 581 */ +/* 638 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * The Arcade Physics World Bounds Event. + * + * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_ + * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`. + * + * @event Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that hit the world bounds. + * @param {boolean} up - Is the Body blocked up? I.e. collided with the top of the world bounds. + * @param {boolean} down - Is the Body blocked down? I.e. collided with the bottom of the world bounds. + * @param {boolean} left - Is the Body blocked left? I.e. collided with the left of the world bounds. + * @param {boolean} right - Is the Body blocked right? I.e. collided with the right of the world bounds. + */ +module.exports = 'worldbounds'; + + +/***/ }), +/* 639 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_ + * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_OVERLAP + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the overlap. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body overlapped. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the overlap. + */ +module.exports = 'tileoverlap'; + + +/***/ }), +/* 640 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_ + * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_COLLIDE + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the collision. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body collided with. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the collision. + */ +module.exports = 'tilecollide'; + + +/***/ }), +/* 641 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Resume Event. + * + * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`. + * + * @event Phaser.Physics.Arcade.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 642 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Pause Event. + * + * This event is dispatched by an Arcade Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`. + * + * @event Phaser.Physics.Arcade.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 643 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least + * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#OVERLAP + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the overlap. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the overlap. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the overlap. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the overlap. + */ +module.exports = 'overlap'; + + +/***/ }), +/* 644 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least + * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#COLLIDE + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the collision. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the collision. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the collision. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the collision. + */ +module.exports = 'collide'; + + +/***/ }), +/* 645 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Provides methods for modifying the velocity of an Arcade Physics body. + * + * Should be applied as a mixin and not used directly. * * @name Phaser.Physics.Arcade.Components.Velocity * @since 3.0.0 @@ -124107,13 +132717,13 @@ module.exports = ProcessTileCallbacks; var Velocity = { /** - * [description] + * Sets the velocity of the Body. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left. + * @param {number} [y=x] - The vertical velocity of the body. Positive values move the body down, while negative values move it up. * * @return {this} This Game Object. */ @@ -124125,12 +132735,14 @@ var Velocity = { }, /** - * [description] + * Sets the horizontal component of the body's velocity. + * + * Positive values move the body to the right, while negative values move it to the left. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityX * @since 3.0.0 * - * @param {number} x - [description] + * @param {number} x - The new horizontal velocity. * * @return {this} This Game Object. */ @@ -124142,12 +132754,14 @@ var Velocity = { }, /** - * [description] + * Sets the vertical component of the body's velocity. + * + * Positive values move the body down, while negative values move it up. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityY * @since 3.0.0 * - * @param {number} y - [description] + * @param {number} y - The new vertical velocity of the body. * * @return {this} This Game Object. */ @@ -124159,13 +132773,13 @@ var Velocity = { }, /** - * [description] + * Sets the maximum velocity of the body. * * @method Phaser.Physics.Arcade.Components.Velocity#setMaxVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The new maximum horizontal velocity. + * @param {number} [y=x] - The new maximum vertical velocity. * * @return {this} This Game Object. */ @@ -124182,12 +132796,12 @@ module.exports = Velocity; /***/ }), -/* 582 */ +/* 646 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124264,17 +132878,17 @@ module.exports = Size; /***/ }), -/* 583 */ +/* 647 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the mass properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Mass * @since 3.0.0 @@ -124282,12 +132896,12 @@ module.exports = Size; var Mass = { /** - * [description] + * Sets the mass of the physics body * * @method Phaser.Physics.Arcade.Components.Mass#setMass * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - New value for the mass of the body. * * @return {this} This Game Object. */ @@ -124304,17 +132918,17 @@ module.exports = Mass; /***/ }), -/* 584 */ +/* 648 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the immovable properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Immovable * @since 3.0.0 @@ -124322,12 +132936,12 @@ module.exports = Mass; var Immovable = { /** - * [description] + * Sets Whether this Body can be moved by collisions with another Body. * * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable * @since 3.0.0 * - * @param {boolean} [value=true] - [description] + * @param {boolean} [value=true] - Sets if this body can be moved by collisions with another Body. * * @return {this} This Game Object. */ @@ -124346,12 +132960,12 @@ module.exports = Immovable; /***/ }), -/* 585 */ +/* 649 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124424,12 +133038,12 @@ module.exports = Gravity; /***/ }), -/* 586 */ +/* 650 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124502,17 +133116,17 @@ module.exports = Friction; /***/ }), -/* 587 */ +/* 651 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the enable properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Enable * @since 3.0.0 @@ -124626,17 +133240,17 @@ module.exports = Enable; /***/ }), -/* 588 */ +/* 652 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the drag properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Drag * @since 3.0.0 @@ -124644,13 +133258,24 @@ module.exports = Enable; var Drag = { /** - * [description] + * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDrag * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The amount of horizontal drag to apply. + * @param {number} [y=x] - The amount of vertical drag to apply. * * @return {this} This Game Object. */ @@ -124662,12 +133287,23 @@ var Drag = { }, /** - * [description] + * Sets the body's horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDragX * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of horizontal drag to apply. * * @return {this} This Game Object. */ @@ -124679,12 +133315,23 @@ var Drag = { }, /** - * [description] + * Sets the body's vertical drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDragY * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of vertical drag to apply. * * @return {this} This Game Object. */ @@ -124696,7 +133343,15 @@ var Drag = { }, /** - * [description] + * If this Body is using `drag` for deceleration this function controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. * * @method Phaser.Physics.Arcade.Components.Drag#setDamping * @since 3.10.0 @@ -124718,17 +133373,17 @@ module.exports = Drag; /***/ }), -/* 589 */ +/* 653 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the debug properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Debug * @since 3.0.0 @@ -124736,14 +133391,17 @@ module.exports = Drag; var Debug = { /** - * [description] + * Sets the debug values of this body. + * + * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole. + * Note that there is a performance cost in drawing debug displays. It should never be used in production. * * @method Phaser.Physics.Arcade.Components.Debug#setDebug * @since 3.0.0 * - * @param {boolean} showBody - [description] - * @param {boolean} showVelocity - [description] - * @param {number} bodyColor - [description] + * @param {boolean} showBody - Set to `true` to have this body render its outline to the debug display. + * @param {boolean} showVelocity - Set to `true` to have this body render a velocity marker to the debug display. + * @param {number} bodyColor - The color of the body outline when rendered to the debug display. * * @return {this} This Game Object. */ @@ -124757,12 +133415,12 @@ var Debug = { }, /** - * [description] + * Sets the color of the body outline when it renders to the debug display. * * @method Phaser.Physics.Arcade.Components.Debug#setDebugBodyColor * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The color of the body outline when rendered to the debug display. * * @return {this} This Game Object. */ @@ -124774,7 +133432,7 @@ var Debug = { }, /** - * [description] + * Set to `true` to have this body render its outline to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugShowBody * @type {boolean} @@ -124795,7 +133453,7 @@ var Debug = { }, /** - * [description] + * Set to `true` to have this body render a velocity marker to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugShowVelocity * @type {boolean} @@ -124816,7 +133474,7 @@ var Debug = { }, /** - * [description] + * The color of the body outline when it renders to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugBodyColor * @type {number} @@ -124842,17 +133500,17 @@ module.exports = Debug; /***/ }), -/* 590 */ +/* 654 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the bounce properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Bounce * @since 3.0.0 @@ -124860,13 +133518,16 @@ module.exports = Debug; var Bounce = { /** - * [description] + * Sets the bounce values of this body. + * + * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object. + * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounce * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. + * @param {number} [y=x] - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -124878,12 +133539,12 @@ var Bounce = { }, /** - * [description] + * Sets the horizontal bounce value for this body. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounceX * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -124895,12 +133556,12 @@ var Bounce = { }, /** - * [description] + * Sets the vertical bounce value for this body. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounceY * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -124912,12 +133573,12 @@ var Bounce = { }, /** - * [description] + * Sets if this body should collide with the world bounds or not. * * @method Phaser.Physics.Arcade.Components.Bounce#setCollideWorldBounds * @since 3.0.0 * - * @param {boolean} value - [description] + * @param {boolean} value - `true` if this body should collide with the world bounds, otherwise `false`. * * @return {this} This Game Object. */ @@ -124934,17 +133595,17 @@ module.exports = Bounce; /***/ }), -/* 591 */ +/* 655 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Angular * @since 3.0.0 @@ -124952,12 +133613,16 @@ module.exports = Bounce; var Angular = { /** - * [description] + * Sets the angular velocity of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularVelocity * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of angular velocity. * * @return {this} This Game Object. */ @@ -124969,12 +133634,16 @@ var Angular = { }, /** - * [description] + * Sets the angular acceleration of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularAcceleration * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of angular acceleration. * * @return {this} This Game Object. */ @@ -124986,12 +133655,12 @@ var Angular = { }, /** - * [description] + * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularDrag * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of drag. * * @return {this} This Game Object. */ @@ -125008,17 +133677,17 @@ module.exports = Angular; /***/ }), -/* 592 */ +/* 656 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Provides methods used for setting the acceleration properties of an Arcade Body. + * Provides methods used for setting the acceleration properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Acceleration * @since 3.0.0 @@ -125083,25 +133752,26 @@ module.exports = Acceleration; /***/ }), -/* 593 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var DistanceBetween = __webpack_require__(58); -var DistanceSquared = __webpack_require__(277); -var Factory = __webpack_require__(266); +var DegToRad = __webpack_require__(39); +var DistanceBetween = __webpack_require__(62); +var DistanceSquared = __webpack_require__(422); +var Factory = __webpack_require__(285); var GetFastValue = __webpack_require__(1); -var Merge = __webpack_require__(79); -var PluginCache = __webpack_require__(15); +var Merge = __webpack_require__(84); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); var Vector2 = __webpack_require__(3); -var World = __webpack_require__(261); +var World = __webpack_require__(280); /** * @classdesc @@ -125168,8 +133838,8 @@ var ArcadePhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -125185,7 +133855,7 @@ var ArcadePhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -125207,9 +133877,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -125556,9 +134226,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -125578,7 +134248,7 @@ var ArcadePhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -125592,23 +134262,23 @@ module.exports = ArcadePhysics; /***/ }), -/* 594 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(39); +var CONST = __webpack_require__(42); var Extend = __webpack_require__(21); /** * @callback ArcadePhysicsCallback * - * @param {Phaser.GameObjects.GameObject} object1 - [description] - * @param {Phaser.GameObjects.GameObject} object2 - [description] + * @param {Phaser.GameObjects.GameObject} object1 - The first Body to separate. + * @param {Phaser.GameObjects.GameObject} object2 - The second Body to separate. */ /** @@ -125617,16 +134287,16 @@ var Extend = __webpack_require__(21); var Arcade = { - ArcadePhysics: __webpack_require__(593), - Body: __webpack_require__(260), - Collider: __webpack_require__(259), - Factory: __webpack_require__(266), - Group: __webpack_require__(263), - Image: __webpack_require__(265), - Sprite: __webpack_require__(114), - StaticBody: __webpack_require__(253), - StaticGroup: __webpack_require__(262), - World: __webpack_require__(261) + ArcadePhysics: __webpack_require__(657), + Body: __webpack_require__(279), + Collider: __webpack_require__(277), + Factory: __webpack_require__(285), + Group: __webpack_require__(282), + Image: __webpack_require__(284), + Sprite: __webpack_require__(121), + StaticBody: __webpack_require__(271), + StaticGroup: __webpack_require__(281), + World: __webpack_require__(280) }; @@ -125637,12 +134307,12 @@ module.exports = Arcade; /***/ }), -/* 595 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125652,2098 +134322,33 @@ module.exports = Arcade; module.exports = { - Arcade: __webpack_require__(594), - Impact: __webpack_require__(572), - Matter: __webpack_require__(552) + Arcade: __webpack_require__(658), + Impact: __webpack_require__(629), + Matter: __webpack_require__(606) }; /***/ }), -/* 596 */ +/* 660 */ /***/ (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__(154); -var Matrix4 = __webpack_require__(268); -var Quaternion = __webpack_require__(267); - -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 - The vector to be rotated. - * @param {Phaser.Math.Vector3} axis - The axis to rotate around. - * @param {number} radians - The angle of rotation in radians. - * - * @return {Phaser.Math.Vector3} The given vector. - */ -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; - - -/***/ }), -/* 597 */ -/***/ (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 - * A representation of a vector in 4D space. - * - * A four-component vector. - * - * @class Vector4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. - */ -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 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector4#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector4#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - /** - * The w component of this Vector. - * - * @name Phaser.Math.Vector4#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.w = 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; - } - }, - - /** - * Make a clone of this Vector4. - * - * @method Phaser.Math.Vector4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} A clone of this Vector4. - */ - clone: function () - { - return new Vector4(this.x, this.y, this.z, this.w); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - this.w = src.w || 0; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict quality check against each Vector's components. - * - * @method Phaser.Math.Vector4#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The vector to check equality with. - * - * @return {boolean} A boolean indicating whether the two Vectors are equal or not. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); - }, - - /** - * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. - * - * @method Phaser.Math.Vector4#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. - * @param {number} y - The y value to set for this Vector. - * @param {number} z - The z value to set for this Vector. - * @param {number} w - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - set: function (x, y, z, w) - { - 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; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector4#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - this.w += v.w || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector4#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - this.w -= v.w || 0; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector4#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - - return this; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector4#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - 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); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector4#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return x * x + y * y + z * z + w * w; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector4#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - 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; - - 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; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector4#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. - * - * @return {number} The dot product of this Vector and the given Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector4#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - lerp: function (v, t) - { - 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; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector4#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - this.w *= v.w || 1; - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector4#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - this.w /= v.w || 1; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector4#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - 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); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector4#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - 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; - - return dx * dx + dy * dy + dz * dz + dw * dw; - }, - - /** - * Negate the `x`, `y`, `z` and `w` components of this Vector. - * - * @method Phaser.Math.Vector4#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector4#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var m = mat.val; - - 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; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector4#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformQuat: function (q) - { - // TODO: is this really the same as Vector3? - // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ - // 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; - - // 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; - - // 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; - }, - - /** - * Make this Vector the zero vector (0, 0, 0, 0). - * - * @method Phaser.Math.Vector4#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; - - return this; - } - -}); - -// 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; - -module.exports = Vector4; - - -/***/ }), -/* 598 */ -/***/ (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 two values are within the given `tolerance` of each other. - * - * @function Phaser.Math.Within - * @since 3.0.0 - * - * @param {number} a - The first value to use in the calculation. - * @param {number} b - The second value to use in the calculation. - * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. - * - * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. - */ -var Within = function (a, b, tolerance) -{ - return (Math.abs(a - b) <= tolerance); -}; - -module.exports = Within; - - -/***/ }), -/* 599 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @typedef {object} SinCosTable - * - * @property {number} sin - The sine value. - * @property {number} cos - The cosine value. - * @property {number} length - The length. - */ - -/** - * Generate a series of sine and cosine values. - * - * @function Phaser.Math.SinCosTableGenerator - * @since 3.0.0 - * - * @param {number} length - The number of values to generate. - * @param {number} [sinAmp=1] - The sine value amplitude. - * @param {number} [cosAmp=1] - The cosine value amplitude. - * @param {number} [frequency=1] - The frequency of the values. - * - * @return {SinCosTable} The generated values. - */ -var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) -{ - if (sinAmp === undefined) { sinAmp = 1; } - if (cosAmp === undefined) { cosAmp = 1; } - if (frequency === undefined) { frequency = 1; } - - frequency *= Math.PI / length; - - var cos = []; - var sin = []; - - for (var c = 0; c < length; c++) - { - cosAmp -= sinAmp * frequency; - sinAmp += cosAmp * frequency; - - cos[c] = cosAmp; - sin[c] = sinAmp; - } - - return { - sin: sin, - cos: cos, - length: length - }; -}; - -module.exports = SinCosTableGenerator; - - -/***/ }), -/* 600 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Round a value to a given decimal place. - * - * @function Phaser.Math.RoundTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var RoundTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.round(value * p) / p; -}; - -module.exports = RoundTo; - - -/***/ }), -/* 601 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random four-dimensional vector. - * - * @function Phaser.Math.RandomXYZW - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector4} The given Vector. - */ -var RandomXYZW = function (vec4, scale) -{ - if (scale === undefined) { scale = 1; } - - // TODO: 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; - - -/***/ }), -/* 602 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random position vector in a spherical area, optionally defined by the given radius. - * - * @function Phaser.Math.RandomXYZ - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. - * @param {number} [radius=1] - The radius. - * - * @return {Phaser.Math.Vector3} The given Vector. - */ -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; - - -/***/ }), -/* 603 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random unit vector. - * - * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. - * - * Optionally accepts a scale value to scale the resulting vector by. - * - * @function Phaser.Math.RandomXY - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector2} The given Vector. - */ -var RandomXY = function (vector, scale) -{ - if (scale === undefined) { scale = 1; } - - var r = Math.random() * 2 * Math.PI; - - vector.x = Math.cos(r) * scale; - vector.y = Math.sin(r) * scale; - - return vector; -}; - -module.exports = RandomXY; - - -/***/ }), -/* 604 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Work out what percentage `value` is of the range between `min` and `max`. - * If `max` isn't given then it will return the percentage of `value` to `min`. - * - * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. - * - * @function Phaser.Math.Percent - * @since 3.0.0 - * - * @param {number} value - The value to determine the percentage of. - * @param {number} min - The minimum value. - * @param {number} [max] - The maximum value. - * @param {number} [upperMax] - The mid-way point in the range that represents 100%. - * - * @return {number} A value between 0 and 1 representing the percentage. - */ -var Percent = function (value, min, max, upperMax) -{ - if (max === undefined) { max = min + 1; } - - var percentage = (value - min) / (max - min); - - if (percentage > 1) - { - if (upperMax !== undefined) - { - percentage = ((upperMax - value)) / (upperMax - max); - - if (percentage < 0) - { - percentage = 0; - } - } - else - { - percentage = 1; - } - } - else if (percentage < 0) - { - percentage = 0; - } - - return percentage; -}; - -module.exports = Percent; - - -/***/ }), -/* 605 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Subtract an `amount` from `value`, limiting the minimum result to `min`. - * - * @function Phaser.Math.MinSub - * @since 3.0.0 - * - * @param {number} value - The value to subtract from. - * @param {number} amount - The amount to subtract. - * @param {number} min - The minimum value to return. - * - * @return {number} The resulting value. - */ -var MinSub = function (value, amount, min) -{ - return Math.max(value - amount, min); -}; - -module.exports = MinSub; - - -/***/ }), -/* 606 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Add an `amount` to a `value`, limiting the maximum result to `max`. - * - * @function Phaser.Math.MaxAdd - * @since 3.0.0 - * - * @param {number} value - The value to add to. - * @param {number} amount - The amount to add. - * @param {number} max - The maximum value to return. - * - * @return {number} The resulting value. - */ -var MaxAdd = function (value, amount, max) -{ - return Math.min(value + amount, max); -}; - -module.exports = MaxAdd; - - -/***/ }), -/* 607 */ -/***/ (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 if a given value is an even number using a strict type check. - * - * @function Phaser.Math.IsEvenStrict - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEvenStrict = function (value) -{ - // Use strict equality === for "is number" test - return (value === parseFloat(value)) ? !(value % 2) : void 0; -}; - -module.exports = IsEvenStrict; - - -/***/ }), -/* 608 */ -/***/ (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 if a given value is an even number. - * - * @function Phaser.Math.IsEven - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEven = function (value) -{ - // Use abstract equality == for "is number" test - - // eslint-disable-next-line eqeqeq - return (value == parseFloat(value)) ? !(value % 2) : void 0; -}; - -module.exports = IsEven; - - -/***/ }), -/* 609 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the speed required to cover a distance in the time given. - * - * @function Phaser.Math.GetSpeed - * @since 3.0.0 - * - * @param {number} distance - The distance to travel in pixels. - * @param {integer} time - The time, in ms, to cover the distance in. - * - * @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given. - */ -var GetSpeed = function (distance, time) -{ - return (distance / time) / 1000; -}; - -module.exports = GetSpeed; - - -/***/ }), -/* 610 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Floors to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.FloorTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var FloorTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.floor(value * p) / p; -}; - -module.exports = FloorTo; - - -/***/ }), -/* 611 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates the positive difference of two given numbers. - * - * @function Phaser.Math.Difference - * @since 3.0.0 - * - * @param {number} a - The first number in the calculation. - * @param {number} b - The second number in the calculation. - * - * @return {number} The positive difference of the two given numbers. - */ -var Difference = function (a, b) -{ - return Math.abs(a - b); -}; - -module.exports = Difference; - - -/***/ }), -/* 612 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Ceils to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.CeilTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {number} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var CeilTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.ceil(value * p) / p; -}; - -module.exports = CeilTo; - - -/***/ }), -/* 613 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the mean average of the given values. - * - * @function Phaser.Math.Average - * @since 3.0.0 - * - * @param {number[]} values - The values to average. - * - * @return {number} The average value. - */ -var Average = function (values) -{ - var sum = 0; - - for (var i = 0; i < values.length; i++) - { - sum += (+values[i]); - } - - return sum / values.length; -}; - -module.exports = Average; - - -/***/ }), -/* 614 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using rounding. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. - * - * @function Phaser.Math.Snap.To - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapTo = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.round(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapTo; - - -/***/ }), -/* 615 */ -/***/ (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.Math.Snap - */ - -module.exports = { - - Ceil: __webpack_require__(271), - Floor: __webpack_require__(158), - To: __webpack_require__(614) - -}; - - -/***/ }), -/* 616 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Tests the value and returns `true` if it is a power of two. - * - * @function Phaser.Math.Pow2.IsValuePowerOfTwo - * @since 3.0.0 - * - * @param {number} value - The value to check if it's a power of two. - * - * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. - */ -var IsValuePowerOfTwo = function (value) -{ - return (value > 0 && (value & (value - 1)) === 0); -}; - -module.exports = IsValuePowerOfTwo; - - -/***/ }), -/* 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} - */ - -/** - * @namespace Phaser.Math.Pow2 - */ - -module.exports = { - - GetNext: __webpack_require__(322), - IsSize: __webpack_require__(127), - IsValue: __webpack_require__(616) - -}; - - -/***/ }), -/* 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 SmootherStep = __webpack_require__(200); - -/** - * A Smoother Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmootherStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmootherStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmootherStep(t, 0, 1); -}; - -module.exports = SmootherStepInterpolation; - - -/***/ }), -/* 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 Linear = __webpack_require__(129); - -/** - * A linear interpolation method. - * - * @function Phaser.Math.Interpolation.Linear - * @since 3.0.0 - * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {!number} k - The percentage of interpolation, between 0 and 1. - * - * @return {!number} The interpolated value. - */ -var LinearInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - - if (k < 0) - { - return Linear(v[0], v[1], f); - } - - if (k > 1) - { - return Linear(v[m], v[m - 1], m - f); - } - - return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); -}; - -module.exports = LinearInterpolation; - - -/***/ }), -/* 620 */ -/***/ (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 CatmullRom = __webpack_require__(189); - -/** - * A Catmull-Rom interpolation method. - * - * @function Phaser.Math.Interpolation.CatmullRom - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var CatmullRomInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - - if (v[0] === v[m]) - { - if (k < 0) - { - i = Math.floor(f = m * (1 + k)); - } - - return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); - } - else - { - if (k < 0) - { - return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); - } - - if (k > 1) - { - return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); - } - - return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); - } -}; - -module.exports = CatmullRomInterpolation; - - -/***/ }), -/* 621 */ -/***/ (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 Bernstein = __webpack_require__(273); - -/** - * A bezier interpolation method. - * - * @function Phaser.Math.Interpolation.Bezier - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var BezierInterpolation = function (v, k) -{ - var b = 0; - var n = v.length - 1; - - for (var i = 0; i <= n; i++) - { - b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); - } - - return b; -}; - -module.exports = BezierInterpolation; - - -/***/ }), -/* 622 */ -/***/ (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.Math.Interpolation - */ - -module.exports = { - - Bezier: __webpack_require__(621), - CatmullRom: __webpack_require__(620), - CubicBezier: __webpack_require__(390), - Linear: __webpack_require__(619), - QuadraticBezier: __webpack_require__(386), - SmoothStep: __webpack_require__(363), - SmootherStep: __webpack_require__(618) - -}; - - -/***/ }), -/* 623 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the fuzzy floor of the given value. - * - * @function Phaser.Math.Fuzzy.Floor - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The floor of the value. - */ -var Floor = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.floor(value + epsilon); -}; - -module.exports = Floor; - - -/***/ }), -/* 624 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the fuzzy ceiling of the given value. - * - * @function Phaser.Math.Fuzzy.Ceil - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The fuzzy ceiling of the value. - */ -var Ceil = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.ceil(value - epsilon); -}; - -module.exports = Ceil; - - -/***/ }), -/* 625 */ -/***/ (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.Math.Fuzzy - */ - -module.exports = { - - Ceil: __webpack_require__(624), - Equal: __webpack_require__(276), - Floor: __webpack_require__(623), - GreaterThan: __webpack_require__(275), - LessThan: __webpack_require__(274) - -}; - - -/***/ }), -/* 626 */ -/***/ (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.Math.Easing - */ - -module.exports = { - - Back: __webpack_require__(405), - Bounce: __webpack_require__(404), - Circular: __webpack_require__(403), - Cubic: __webpack_require__(402), - Elastic: __webpack_require__(401), - Expo: __webpack_require__(400), - Linear: __webpack_require__(399), - Quadratic: __webpack_require__(398), - Quartic: __webpack_require__(397), - Quintic: __webpack_require__(396), - Sine: __webpack_require__(395), - Stepped: __webpack_require__(394) - -}; - - -/***/ }), -/* 627 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points) to the power of `pow`. - * - * @function Phaser.Math.Distance.Power - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * @param {number} pow - The exponent. - * - * @return {number} The distance between each point. - */ -var DistancePower = function (x1, y1, x2, y2, pow) -{ - if (pow === undefined) { pow = 2; } - - return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); -}; - -module.exports = DistancePower; - - -/***/ }), -/* 628 */ -/***/ (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.Math.Distance - */ - -module.exports = { - - Between: __webpack_require__(58), - Power: __webpack_require__(627), - Squared: __webpack_require__(277) - -}; - - -/***/ }), -/* 629 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Gets the shortest angle between `angle1` and `angle2`. - * - * Both angles must be in the range -180 to 180, which is the same clamped - * range that `sprite.angle` uses, so you can pass in two sprite angles to - * this method and get the shortest angle back between the two of them. - * - * The angle returned will be in the same range. If the returned angle is - * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's - * a clockwise rotation. - * - * TODO: Wrap the angles in this function? - * - * @function Phaser.Math.Angle.ShortestBetween - * @since 3.0.0 - * - * @param {number} angle1 - The first angle in the range -180 to 180. - * @param {number} angle2 - The second angle in the range -180 to 180. - * - * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. - */ -var ShortestBetween = function (angle1, angle2) -{ - var difference = angle2 - angle1; - - if (difference === 0) - { - return 0; - } - - var times = Math.floor((difference - (-180)) / 360); - - return difference - (times * 360); - -}; - -module.exports = ShortestBetween; - - -/***/ }), -/* 630 */ -/***/ (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 MATH_CONST = __webpack_require__(18); - -/** - * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. - * - * @function Phaser.Math.Angle.RotateTo - * @since 3.0.0 - * - * @param {number} currentAngle - The current angle, in radians. - * @param {number} targetAngle - The target angle to rotate to, in radians. - * @param {number} [lerp=0.05] - The lerp value to add to the current angle. - * - * @return {number} The adjusted angle. - */ -var RotateTo = function (currentAngle, targetAngle, lerp) -{ - if (lerp === undefined) { lerp = 0.05; } - - if (currentAngle === targetAngle) - { - return currentAngle; - } - - if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) - { - currentAngle = targetAngle; - } - else - { - if (Math.abs(targetAngle - currentAngle) > Math.PI) - { - if (targetAngle < currentAngle) - { - targetAngle += MATH_CONST.PI2; - } - else - { - targetAngle -= MATH_CONST.PI2; - } - } - - if (targetAngle > currentAngle) - { - currentAngle += lerp; - } - else if (targetAngle < currentAngle) - { - currentAngle -= lerp; - } - } - - return currentAngle; -}; - -module.exports = RotateTo; - - -/***/ }), -/* 631 */ -/***/ (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 Normalize = __webpack_require__(278); - -/** - * Reverse the given angle. - * - * @function Phaser.Math.Angle.Reverse - * @since 3.0.0 - * - * @param {number} angle - The angle to reverse, in radians. - * - * @return {number} The reversed angle, in radians. - */ -var Reverse = function (angle) -{ - return Normalize(angle + Math.PI); -}; - -module.exports = Reverse; - - -/***/ }), -/* 632 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenPointsY - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point1 - The first point. - * @param {(Phaser.Geom.Point|object)} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPointsY = function (point1, point2) -{ - return Math.atan2(point2.x - point1.x, point2.y - point1.y); -}; - -module.exports = BetweenPointsY; - - -/***/ }), -/* 633 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * Calculates the angle of the vector from the first point to the second point. - * - * @function Phaser.Math.Angle.BetweenPoints - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point1 - The first point. - * @param {(Phaser.Geom.Point|object)} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPoints = function (point1, point2) -{ - return Math.atan2(point2.y - point1.y, point2.x - point1.x); -}; - -module.exports = BetweenPoints; - - -/***/ }), -/* 634 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenY - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var BetweenY = function (x1, y1, x2, y2) -{ - return Math.atan2(x2 - x1, y2 - y1); -}; - -module.exports = BetweenY; - - -/***/ }), -/* 635 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * @function Phaser.Math.Angle.Between - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var Between = function (x1, y1, x2, y2) -{ - return Math.atan2(y2 - y1, x2 - x1); -}; - -module.exports = Between; - - -/***/ }), -/* 636 */ -/***/ (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.Math.Angle - */ - -module.exports = { - - Between: __webpack_require__(635), - BetweenY: __webpack_require__(634), - BetweenPoints: __webpack_require__(633), - BetweenPointsY: __webpack_require__(632), - Reverse: __webpack_require__(631), - RotateTo: __webpack_require__(630), - ShortestBetween: __webpack_require__(629), - Normalize: __webpack_require__(278), - Wrap: __webpack_require__(205), - WrapDegrees: __webpack_require__(204) - -}; - - -/***/ }), -/* 637 */ -/***/ (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 CONST = __webpack_require__(18); -var Extend = __webpack_require__(21); - -/** - * @namespace Phaser.Math - */ - -var PhaserMath = { - - // Collections of functions - Angle: __webpack_require__(636), - Distance: __webpack_require__(628), - Easing: __webpack_require__(626), - Fuzzy: __webpack_require__(625), - Interpolation: __webpack_require__(622), - Pow2: __webpack_require__(617), - Snap: __webpack_require__(615), - - // Expose the RNG Class - RandomDataGenerator: __webpack_require__(441), - - // Single functions - Average: __webpack_require__(613), - Bernstein: __webpack_require__(273), - Between: __webpack_require__(188), - CatmullRom: __webpack_require__(189), - CeilTo: __webpack_require__(612), - Clamp: __webpack_require__(24), - DegToRad: __webpack_require__(36), - Difference: __webpack_require__(611), - Factorial: __webpack_require__(272), - FloatBetween: __webpack_require__(327), - FloorTo: __webpack_require__(610), - FromPercent: __webpack_require__(103), - GetSpeed: __webpack_require__(609), - IsEven: __webpack_require__(608), - IsEvenStrict: __webpack_require__(607), - Linear: __webpack_require__(129), - MaxAdd: __webpack_require__(606), - MinSub: __webpack_require__(605), - Percent: __webpack_require__(604), - RadToDeg: __webpack_require__(190), - RandomXY: __webpack_require__(603), - RandomXYZ: __webpack_require__(602), - RandomXYZW: __webpack_require__(601), - Rotate: __webpack_require__(270), - RotateAround: __webpack_require__(432), - RotateAroundDistance: __webpack_require__(201), - RoundAwayFromZero: __webpack_require__(342), - RoundTo: __webpack_require__(600), - SinCosTableGenerator: __webpack_require__(599), - SmootherStep: __webpack_require__(200), - SmoothStep: __webpack_require__(199), - TransformXY: __webpack_require__(361), - Within: __webpack_require__(598), - Wrap: __webpack_require__(59), - - // Vector classes - Vector2: __webpack_require__(3), - Vector3: __webpack_require__(154), - Vector4: __webpack_require__(597), - Matrix3: __webpack_require__(269), - Matrix4: __webpack_require__(268), - Quaternion: __webpack_require__(267), - RotateVec3: __webpack_require__(596) - -}; - -// Merge in the consts - -PhaserMath = Extend(false, PhaserMath, CONST); - -// Export it - -module.exports = PhaserMath; - - -/***/ }), -/* 638 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var CustomSet = __webpack_require__(96); -var EventEmitter = __webpack_require__(11); +var CONST = __webpack_require__(19); +var CustomSet = __webpack_require__(102); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(85); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var PluginCache = __webpack_require__(15); -var XHRSettings = __webpack_require__(115); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var XHRSettings = __webpack_require__(122); /** * @classdesc @@ -127797,7 +134402,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#scene * @type {Phaser.Scene} - * @protected * @since 3.0.0 */ this.scene = scene; @@ -127807,7 +134411,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#systems * @type {Phaser.Scenes.Systems} - * @protected * @since 3.0.0 */ this.systems = scene.sys; @@ -127817,7 +134420,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#cacheManager * @type {Phaser.Cache.CacheManager} - * @protected * @since 3.7.0 */ this.cacheManager = scene.sys.cache; @@ -127827,11 +134429,20 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#textureManager * @type {Phaser.Textures.TextureManager} - * @protected * @since 3.7.0 */ this.textureManager = scene.sys.textures; + /** + * A reference to the global Scene Manager. + * + * @name Phaser.Loader.LoaderPlugin#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @protected + * @since 3.16.0 + */ + this.sceneManager = scene.sys.game.scene; + // Inject the available filetypes into the Loader FileTypesManager.install(this); @@ -128037,8 +134648,8 @@ var LoaderPlugin = new Class({ */ this.state = CONST.LOADER_IDLE; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.pluginStart, this); }, /** @@ -128051,7 +134662,7 @@ var LoaderPlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -128065,7 +134676,7 @@ var LoaderPlugin = new Class({ */ pluginStart: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -128185,16 +134796,6 @@ var LoaderPlugin = new Class({ return this; }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#addFileEvent - * @param {string} key - The key of the file that was added. - * @param {string} type - The type of the file that was added. - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that had the file added to it. - * @param {Phaser.Loader.File} loader - The File object that was added to the Loader. - */ - /** * Adds a file, or array of files, into the load queue. * @@ -128207,7 +134808,7 @@ var LoaderPlugin = new Class({ * however you can call this as long as the file given to it is well formed. * * @method Phaser.Loader.LoaderPlugin#addFile - * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @fires Phaser.Loader.Events#ADD * @since 3.0.0 * * @param {(Phaser.Loader.File|Phaser.Loader.File[])} file - The file, or array of files, to be added to the load queue. @@ -128229,7 +134830,7 @@ var LoaderPlugin = new Class({ { this.list.set(item); - this.emit('addfile', item.key, item.type, this, item); + this.emit(Events.ADD, item.key, item.type, this, item); if (this.isLoading()) { @@ -128395,13 +134996,6 @@ var LoaderPlugin = new Class({ return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE); }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#startEvent - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader instance that started. - */ - /** * Starts the Loader running. This will reset the progress and totals and then emit a `start` event. * If there is nothing in the queue the Loader will immediately complete, otherwise it will start @@ -128414,7 +135008,7 @@ var LoaderPlugin = new Class({ * If the Loader is already running this method will simply return. * * @method Phaser.Loader.LoaderPlugin#start - * @fires Phaser.Loader.LoaderPlugin#startEvent + * @fires Phaser.Loader.Events#START * @since 3.0.0 */ start: function () @@ -128430,7 +135024,7 @@ var LoaderPlugin = new Class({ this.totalComplete = 0; this.totalToLoad = this.list.size; - this.emit('start', this); + this.emit(Events.START, this); if (this.list.size === 0) { @@ -128447,32 +135041,24 @@ var LoaderPlugin = new Class({ this.checkLoadQueue(); - this.systems.events.on('update', this.update, this); + this.systems.events.on(SceneEvents.UPDATE, this.update, this); } }, - /** - * This event is fired when the Loader updates its progress, typically as a result of - * a file having completed loading. - * - * @event Phaser.Loader.LoaderPlugin#progressEvent - * @param {number} progress - The current progress of the load. A value between 0 and 1. - */ - /** * Called automatically during the load process. * It updates the `progress` value and then emits a progress event, which you can use to * display a loading bar in your game. * * @method Phaser.Loader.LoaderPlugin#updateProgress - * @fires Phaser.Loader.LoaderPlugin#progressEvent + * @fires Phaser.Loader.Events#PROGRESS * @since 3.0.0 */ updateProgress: function () { this.progress = 1 - ((this.list.size + this.inflight.size) / this.totalToLoad); - this.emit('progress', this.progress); + this.emit(Events.PROGRESS, this.progress); }, /** @@ -128529,20 +135115,6 @@ var LoaderPlugin = new Class({ }, this); }, - /** - * This event is fired when the a file successfully completes loading, _before_ it is processed. - * - * @event Phaser.Loader.LoaderPlugin#loadEvent - * @param {Phaser.Loader.File} file - The file that has completed loading. - */ - - /** - * This event is fired when the a file errors during load. - * - * @event Phaser.Loader.LoaderPlugin#loadErrorEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * An internal method called automatically by the XHRLoader belong to a File. * @@ -128550,8 +135122,8 @@ var LoaderPlugin = new Class({ * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue. * * @method Phaser.Loader.LoaderPlugin#nextFile - * @fires Phaser.Loader.LoaderPlugin#loadEvent - * @fires Phaser.Loader.LoaderPlugin#loadErrorEvent + * @fires Phaser.Loader.Events#FILE_LOAD + * @fires Phaser.Loader.Events#FILE_LOAD_ERROR * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File that just finished loading, or errored during load. @@ -128575,7 +135147,7 @@ var LoaderPlugin = new Class({ this.queue.set(file); - this.emit('load', file); + this.emit(Events.FILE_LOAD, file); file.onProcess(); } @@ -128585,7 +135157,7 @@ var LoaderPlugin = new Class({ this._deleteQueue.set(file); - this.emit('loaderror', file); + this.emit(Events.FILE_LOAD_ERROR, file); this.fileProcessComplete(file); } @@ -128647,14 +135219,6 @@ var LoaderPlugin = new Class({ } }, - /** - * This event is fired when the Loader has finished loading everything and the queue is empty. - * By this point every loaded file will now be in its associated cache and ready for use. - * - * @event Phaser.Loader.LoaderPlugin#completeEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * Called at the end when the load queue is exhausted and all files have either loaded or errored. * By this point every loaded file will now be in its associated cache and ready for use. @@ -128662,12 +135226,13 @@ var LoaderPlugin = new Class({ * Also clears down the Sets, puts progress to 1 and clears the deletion queue. * * @method Phaser.Loader.LoaderPlugin#loadComplete - * @fires Phaser.Loader.LoaderPlugin#completeEvent + * @fires Phaser.Loader.Events#COMPLETE + * @fires Phaser.Loader.Events#POST_PROCESS * @since 3.7.0 */ loadComplete: function () { - this.emit('loadcomplete', this); + this.emit(Events.POST_PROCESS, this); this.list.clear(); this.inflight.clear(); @@ -128677,14 +135242,14 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_COMPLETE; - this.systems.events.off('update', this.update, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); // Call 'destroy' on each file ready for deletion this._deleteQueue.iterateLocal('destroy'); this._deleteQueue.clear(); - this.emit('complete', this, this.totalComplete, this.totalFailed); + this.emit(Events.COMPLETE, this, this.totalComplete, this.totalFailed); }, /** @@ -128792,8 +135357,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_SHUTDOWN; - this.systems.events.off('update', this.update, this); - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -128810,8 +135375,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_DESTROYED; - this.systems.events.off('update', this.update, this); - this.systems.events.off('start', this.pluginStart, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.START, this.pluginStart, this); this.list = null; this.inflight = null; @@ -128821,6 +135386,7 @@ var LoaderPlugin = new Class({ this.systems = null; this.textureManager = null; this.cacheManager = null; + this.sceneManager = null; } }); @@ -128831,22 +135397,22 @@ module.exports = LoaderPlugin; /***/ }), -/* 639 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var ImageFile = __webpack_require__(65); +var ImageFile = __webpack_require__(71); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(64); -var TextFile = __webpack_require__(279); +var MultiFile = __webpack_require__(70); +var TextFile = __webpack_require__(286); /** * @typedef {object} Phaser.Loader.FileTypes.UnityAtlasFileConfig @@ -128896,6 +135462,8 @@ var UnityAtlasFile = new Class({ { var config = key; + key = GetFastValue(config, 'key'); + image = new ImageFile(loader, { key: key, url: GetFastValue(config, 'textureURL'), @@ -128936,7 +135504,7 @@ var UnityAtlasFile = new Class({ */ addToCache: function () { - if (this.failed === 0 && !this.complete) + if (this.isReadyToProcess()) { var image = this.files[0]; var text = this.files[1]; @@ -129083,19 +135651,19 @@ module.exports = UnityAtlasFile; /***/ }), -/* 640 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); -var TILEMAP_FORMATS = __webpack_require__(30); +var JSONFile = __webpack_require__(60); +var TILEMAP_FORMATS = __webpack_require__(32); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapJSONFileConfig @@ -129248,19 +135816,19 @@ module.exports = TilemapJSONFile; /***/ }), -/* 641 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); -var TILEMAP_FORMATS = __webpack_require__(30); +var JSONFile = __webpack_require__(60); +var TILEMAP_FORMATS = __webpack_require__(32); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapImpactFileConfig @@ -129413,22 +135981,22 @@ module.exports = TilemapImpactFile; /***/ }), -/* 642 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); -var TILEMAP_FORMATS = __webpack_require__(30); +var TILEMAP_FORMATS = __webpack_require__(32); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapCSVFileConfig @@ -129617,18 +136185,18 @@ module.exports = TilemapCSVFile; /***/ }), -/* 643 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -129974,18 +136542,18 @@ module.exports = SVGFile; /***/ }), -/* 644 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(65); +var ImageFile = __webpack_require__(71); /** * @typedef {object} Phaser.Loader.FileTypes.SpriteSheetFileConfig @@ -130176,18 +136744,18 @@ module.exports = SpriteSheetFile; /***/ }), -/* 645 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -130356,18 +136924,18 @@ module.exports = ScriptFile; /***/ }), -/* 646 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -130573,18 +137141,245 @@ module.exports = ScenePluginFile; /***/ }), -/* 647 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(1); +var IsPlainObject = __webpack_require__(8); + +/** + * @typedef {object} Phaser.Loader.FileTypes.SceneFileConfig + * + * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. + * @property {string} [url] - The absolute or relative URL to load the file from. + * @property {string} [extension='txt'] - The default file extension to use if no url is provided. + * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ + +/** + * @classdesc + * An external Scene JavaScript File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile. + * + * @class SceneFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var SceneFile = new Class({ + + Extends: File, + + initialize: + + function SceneFile (loader, key, url, xhrSettings) + { + var extension = 'js'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'text', + cache: loader.cacheManager.text, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.SceneFile#onProcess + * @since 3.16.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = this.xhrLoader.responseText; + + this.onProcessComplete(); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.SceneFile#addToCache + * @since 3.16.0 + */ + addToCache: function () + { + var code = this.data.concat('(function(){\n' + 'return new ' + this.key + '();\n' + '}).call(this);'); + + this.loader.sceneManager.add(this.key, eval(code)); + + this.complete = true; + } + +}); + +/** + * Adds an external Scene file, or array of Scene files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('Level1', 'src/Level1.js'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Scene Manager upon a successful load. + * + * For a Scene File it's vitally important that the key matches the class name in the JavaScript file. + * + * For example here is the source file: + * + * ```javascript + * class ExternalScene extends Phaser.Scene { + * + * constructor () + * { + * super('myScene'); + * } + * + * } + * ``` + * + * Because the class is called `ExternalScene` that is the exact same key you must use when loading it: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('ExternalScene', 'src/yourScene.js'); + * } + * ``` + * + * The key that is used within the Scene Manager can either be set to the same, or you can override it in the Scene + * constructor, as we've done in the example above, where the Scene key was changed to `myScene`. + * + * The key should be unique both in terms of files being loaded and Scenes already present in the Scene Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Scene Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.sceneFile({ + * key: 'Level1', + * url: 'src/Level1.js' + * }); + * ``` + * + * See the documentation for `Phaser.Loader.FileTypes.SceneFileConfig` for more details. + * + * Once the file has finished loading it will be added to the Scene Manager. + * + * ```javascript + * this.load.sceneFile('Level1', 'src/Level1.js'); + * // and later in your game ... + * this.scene.start('Level1'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `WORLD1.` and the key was `Story` the final key will be `WORLD1.Story` and + * this is what you would use to retrieve the text from the Scene Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Scene File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#sceneFile + * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @since 3.16.0 + * + * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig|Phaser.Loader.FileTypes.SceneFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {Phaser.Loader.LoaderPlugin} The Loader instance. + */ +FileTypesManager.register('sceneFile', 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 SceneFile(this, key[i])); + } + } + else + { + this.addFile(new SceneFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = SceneFile; + + +/***/ }), +/* 670 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -130700,7 +137495,14 @@ var PluginFile = new Class({ document.head.appendChild(this.data); - pluginManager.install(this.key, window[this.key], start, mapping); + var plugin = pluginManager.install(this.key, window[this.key], start, mapping); + + if (start || mapping) + { + // Install into the current Scene Systems and Scene + this.loader.systems[mapping] = plugin; + this.loader.scene[mapping] = plugin; + } } this.onProcessComplete(); @@ -130761,7 +137563,7 @@ var PluginFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.PluginFileConfig|Phaser.Loader.FileTypes.PluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function. - * @param {boolean} [start] - The plugin mapping configuration object. + * @param {boolean} [start] - Automatically start the plugin after loading? * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * @@ -130789,19 +137591,19 @@ module.exports = PluginFile; /***/ }), -/* 648 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); +var CONST = __webpack_require__(19); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); +var JSONFile = __webpack_require__(60); /** * @typedef {object} Phaser.Loader.FileTypes.PackFileConfig @@ -131017,22 +137819,22 @@ module.exports = PackFile; /***/ }), -/* 649 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var ImageFile = __webpack_require__(65); +var ImageFile = __webpack_require__(71); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(56); -var MultiFile = __webpack_require__(64); +var JSONFile = __webpack_require__(60); +var MultiFile = __webpack_require__(70); /** * @typedef {object} Phaser.Loader.FileTypes.MultiAtlasFileConfig @@ -131100,7 +137902,7 @@ var MultiAtlasFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.MultiFile#onFileComplete + * @method Phaser.Loader.FileTypes.MultiAtlasFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -131173,7 +137975,7 @@ var MultiAtlasFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.MultiFile#addToCache + * @method Phaser.Loader.FileTypes.MultiAtlasFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -131353,18 +138155,18 @@ module.exports = MultiAtlasFile; /***/ }), -/* 650 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -131622,18 +138424,18 @@ module.exports = HTMLTextureFile; /***/ }), -/* 651 */ +/* 674 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -131806,18 +138608,18 @@ module.exports = HTMLFile; /***/ }), -/* 652 */ +/* 675 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -131991,23 +138793,23 @@ module.exports = GLSLFile; /***/ }), -/* 653 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var ImageFile = __webpack_require__(65); +var ImageFile = __webpack_require__(71); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(64); -var ParseXMLBitmapFont = __webpack_require__(338); -var XMLFile = __webpack_require__(155); +var MultiFile = __webpack_require__(70); +var ParseXMLBitmapFont = __webpack_require__(344); +var XMLFile = __webpack_require__(168); /** * @typedef {object} Phaser.Loader.FileTypes.BitmapFontFileConfig @@ -132247,18 +139049,18 @@ module.exports = BitmapFontFile; /***/ }), -/* 654 */ +/* 677 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(20); -var File = __webpack_require__(22); +var CONST = __webpack_require__(19); +var File = __webpack_require__(23); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); @@ -132439,22 +139241,22 @@ module.exports = BinaryFile; /***/ }), -/* 655 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AudioFile = __webpack_require__(281); +var AudioFile = __webpack_require__(288); var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(56); -var MultiFile = __webpack_require__(64); +var JSONFile = __webpack_require__(60); +var MultiFile = __webpack_require__(70); /** * @typedef {object} Phaser.Loader.FileTypes.AudioSpriteFileConfig @@ -132540,7 +139342,7 @@ var AudioSpriteFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.AudioSpriteFile#onFileComplete + * @method Phaser.Loader.FileTypes.AudioSpriteFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -132576,7 +139378,7 @@ var AudioSpriteFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.AudioSpriteFile#addToCache + * @method Phaser.Loader.FileTypes.AudioSpriteFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -132740,22 +139542,22 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio /***/ }), -/* 656 */ +/* 679 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var ImageFile = __webpack_require__(65); +var ImageFile = __webpack_require__(71); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(64); -var XMLFile = __webpack_require__(155); +var MultiFile = __webpack_require__(70); +var XMLFile = __webpack_require__(168); /** * @typedef {object} Phaser.Loader.FileTypes.AtlasXMLFileConfig @@ -132995,22 +139797,22 @@ module.exports = AtlasXMLFile; /***/ }), -/* 657 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(1); -var ImageFile = __webpack_require__(65); +var ImageFile = __webpack_require__(71); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(56); -var MultiFile = __webpack_require__(64); +var JSONFile = __webpack_require__(60); +var MultiFile = __webpack_require__(70); /** * @typedef {object} Phaser.Loader.FileTypes.AtlasJSONFileConfig @@ -133257,18 +140059,19 @@ module.exports = AtlasJSONFile; /***/ }), -/* 658 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); +var JSONFile = __webpack_require__(60); +var LoaderEvents = __webpack_require__(85); /** * @classdesc @@ -133316,7 +140119,7 @@ var AnimationJSONFile = new Class({ onProcess: function () { // We need to hook into this event: - this.loader.once('loadcomplete', this.onLoadComplete, this); + this.loader.once(LoaderEvents.POST_PROCESS, this.onLoadComplete, this); // But the rest is the same as a normal JSON file JSONFile.prototype.onProcess.call(this); @@ -133459,12 +140262,12 @@ module.exports = AnimationJSONFile; /***/ }), -/* 659 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133474,47 +140277,48 @@ module.exports = AnimationJSONFile; module.exports = { - AnimationJSONFile: __webpack_require__(658), - AtlasJSONFile: __webpack_require__(657), - AtlasXMLFile: __webpack_require__(656), - AudioFile: __webpack_require__(281), - AudioSpriteFile: __webpack_require__(655), - BinaryFile: __webpack_require__(654), - BitmapFontFile: __webpack_require__(653), - GLSLFile: __webpack_require__(652), - HTML5AudioFile: __webpack_require__(280), - HTMLFile: __webpack_require__(651), - HTMLTextureFile: __webpack_require__(650), - ImageFile: __webpack_require__(65), - JSONFile: __webpack_require__(56), - MultiAtlasFile: __webpack_require__(649), - PackFile: __webpack_require__(648), - PluginFile: __webpack_require__(647), - ScenePluginFile: __webpack_require__(646), - ScriptFile: __webpack_require__(645), - SpriteSheetFile: __webpack_require__(644), - SVGFile: __webpack_require__(643), - TextFile: __webpack_require__(279), - TilemapCSVFile: __webpack_require__(642), - TilemapImpactFile: __webpack_require__(641), - TilemapJSONFile: __webpack_require__(640), - UnityAtlasFile: __webpack_require__(639), - XMLFile: __webpack_require__(155) + AnimationJSONFile: __webpack_require__(681), + AtlasJSONFile: __webpack_require__(680), + AtlasXMLFile: __webpack_require__(679), + AudioFile: __webpack_require__(288), + AudioSpriteFile: __webpack_require__(678), + BinaryFile: __webpack_require__(677), + BitmapFontFile: __webpack_require__(676), + GLSLFile: __webpack_require__(675), + HTML5AudioFile: __webpack_require__(287), + HTMLFile: __webpack_require__(674), + HTMLTextureFile: __webpack_require__(673), + ImageFile: __webpack_require__(71), + JSONFile: __webpack_require__(60), + MultiAtlasFile: __webpack_require__(672), + PackFile: __webpack_require__(671), + PluginFile: __webpack_require__(670), + SceneFile: __webpack_require__(669), + ScenePluginFile: __webpack_require__(668), + ScriptFile: __webpack_require__(667), + SpriteSheetFile: __webpack_require__(666), + SVGFile: __webpack_require__(665), + TextFile: __webpack_require__(286), + TilemapCSVFile: __webpack_require__(664), + TilemapImpactFile: __webpack_require__(663), + TilemapJSONFile: __webpack_require__(662), + UnityAtlasFile: __webpack_require__(661), + XMLFile: __webpack_require__(168) }; /***/ }), -/* 660 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(20); +var CONST = __webpack_require__(19); var Extend = __webpack_require__(21); /** @@ -133523,16 +140327,18 @@ var Extend = __webpack_require__(21); var Loader = { - FileTypes: __webpack_require__(659), + Events: __webpack_require__(85), - File: __webpack_require__(22), + FileTypes: __webpack_require__(682), + + File: __webpack_require__(23), FileTypesManager: __webpack_require__(7), - GetURL: __webpack_require__(157), - LoaderPlugin: __webpack_require__(638), - MergeXHRSettings: __webpack_require__(156), - MultiFile: __webpack_require__(64), - XHRLoader: __webpack_require__(282), - XHRSettings: __webpack_require__(115) + GetURL: __webpack_require__(170), + LoaderPlugin: __webpack_require__(660), + MergeXHRSettings: __webpack_require__(169), + MultiFile: __webpack_require__(70), + XHRLoader: __webpack_require__(289), + XHRSettings: __webpack_require__(122) }; @@ -133543,12 +140349,12 @@ module.exports = Loader; /***/ }), -/* 661 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133559,19 +140365,19 @@ module.exports = Loader; /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(362) + TouchManager: __webpack_require__(368) }; /* eslint-enable */ /***/ }), -/* 662 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133582,19 +140388,19 @@ module.exports = { /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(365) + MouseManager: __webpack_require__(370) }; /* eslint-enable */ /***/ }), -/* 663 */ +/* 686 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133621,12 +140427,12 @@ module.exports = UpDuration; /***/ }), -/* 664 */ +/* 687 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133653,12 +140459,12 @@ module.exports = DownDuration; /***/ }), -/* 665 */ +/* 688 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133695,12 +140501,12 @@ module.exports = JustUp; /***/ }), -/* 666 */ +/* 689 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133737,127 +140543,16 @@ module.exports = JustDown; /***/ }), -/* 667 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Used internally by the Keyboard Plugin. - * - * @function Phaser.Input.Keyboard.ProcessKeyUp - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to process the event for. - * @param {KeyboardEvent} event - The native Keyboard event. - * - * @return {Phaser.Input.Keyboard.Key} The Key that was processed. - */ -var ProcessKeyUp = function (key, event) -{ - key.originalEvent = event; - - if (key.preventDefault) - { - event.preventDefault(); - } - - if (!key.enabled) - { - return; - } - - key.isDown = false; - key.isUp = true; - key.timeUp = event.timeStamp; - key.duration = key.timeUp - key.timeDown; - key.repeats = 0; - - key._justDown = false; - key._justUp = true; - key._tick = -1; - - return key; -}; - -module.exports = ProcessKeyUp; - - -/***/ }), -/* 668 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Used internally by the Keyboard Plugin. - * - * @function Phaser.Input.Keyboard.ProcessKeyDown - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to process the event for. - * @param {KeyboardEvent} event - The native Keyboard event. - * - * @return {Phaser.Input.Keyboard.Key} The Key that was processed. - */ -var ProcessKeyDown = function (key, event) -{ - key.originalEvent = event; - - if (key.preventDefault) - { - event.preventDefault(); - } - - if (!key.enabled) - { - return; - } - - key.altKey = event.altKey; - key.ctrlKey = event.ctrlKey; - key.shiftKey = event.shiftKey; - key.location = event.location; - - if (key.isDown === false) - { - key.isDown = true; - key.isUp = false; - key.timeDown = event.timeStamp; - key.duration = 0; - key._justDown = true; - key._justUp = false; - } - - key.repeats++; - - return key; -}; - -module.exports = ProcessKeyDown; - - -/***/ }), -/* 669 */ +/* 690 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var KeyCodes = __webpack_require__(159); +var KeyCodes = __webpack_require__(135); var KeyMap = {}; @@ -133870,12 +140565,12 @@ module.exports = KeyMap; /***/ }), -/* 670 */ +/* 691 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133905,12 +140600,12 @@ module.exports = ResetKeyCombo; /***/ }), -/* 671 */ +/* 692 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133947,16 +140642,16 @@ module.exports = AdvanceKeyCombo; /***/ }), -/* 672 */ +/* 693 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(671); +var AdvanceKeyCombo = __webpack_require__(692); /** * Used internally by the KeyCombo class. @@ -134028,26 +140723,27 @@ module.exports = ProcessKeyCombo; /***/ }), -/* 673 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(123); +var GameEvents = __webpack_require__(28); var GetValue = __webpack_require__(4); -var InputPluginCache = __webpack_require__(116); -var Key = __webpack_require__(284); -var KeyCodes = __webpack_require__(159); -var KeyCombo = __webpack_require__(283); -var KeyMap = __webpack_require__(669); -var ProcessKeyDown = __webpack_require__(668); -var ProcessKeyUp = __webpack_require__(667); -var SnapFloor = __webpack_require__(158); +var InputEvents = __webpack_require__(44); +var InputPluginCache = __webpack_require__(124); +var Key = __webpack_require__(291); +var KeyCodes = __webpack_require__(135); +var KeyCombo = __webpack_require__(290); +var KeyMap = __webpack_require__(690); +var SnapFloor = __webpack_require__(107); /** * @classdesc @@ -134066,7 +140762,7 @@ var SnapFloor = __webpack_require__(158); * Or, to listen for a specific key: * * ```javascript - * this.input.keyboard.on('keydown_A', callback, context); + * this.input.keyboard.on('keydown-A', callback, context); * ``` * * You can also create Key objects, which you can then poll in your game loop: @@ -134074,6 +140770,10 @@ var SnapFloor = __webpack_require__(158); * ```javascript * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); * ``` + * + * If you have multiple parallel Scenes, each trying to get keyboard input, be sure to disable capture on them to stop them from + * stealing input from another Scene in the list. You can do this with `this.input.keyboard.enabled = false` within the + * Scene to stop all input, or `this.input.keyboard.preventDefault = false` to stop a Scene halting input on another Scene. * * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details. @@ -134100,6 +140800,15 @@ var KeyboardPlugin = new Class({ { EventEmitter.call(this); + /** + * A reference to the core game, so we can listen for visibility events. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#game + * @type {Phaser.Game} + * @since 3.16.0 + */ + this.game = sceneInputPlugin.systems.game; + /** * A reference to the Scene that this Input Plugin is responsible for. * @@ -134128,7 +140837,16 @@ var KeyboardPlugin = new Class({ this.sceneInputPlugin = sceneInputPlugin; /** - * A boolean that controls if the Keyboard Plugin is enabled or not. + * A reference to the global Keyboard Manager. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#manager + * @type {Phaser.Input.InputPlugin} + * @since 3.16.0 + */ + this.manager = sceneInputPlugin.manager.keyboard; + + /** + * A boolean that controls if this Keyboard Plugin is enabled or not. * Can be toggled on the fly. * * @name Phaser.Input.Keyboard.KeyboardPlugin#enabled @@ -134138,16 +140856,6 @@ var KeyboardPlugin = new Class({ */ this.enabled = true; - /** - * The Keyboard Event target, as defined in the Scene or Game Config. - * Typically the browser window, but can be any interactive DOM element. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#target - * @type {any} - * @since 3.10.0 - */ - this.target; - /** * An array of Key objects to process. * @@ -134166,38 +140874,8 @@ var KeyboardPlugin = new Class({ */ this.combos = []; - /** - * An internal event queue. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#queue - * @type {KeyboardEvent[]} - * @private - * @since 3.10.0 - */ - this.queue = []; - - /** - * Internal event handler. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#onKeyHandler - * @type {function} - * @private - * @since 3.10.0 - */ - this.onKeyHandler; - - /** - * Internal time value. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#time - * @type {number} - * @private - * @since 3.11.0 - */ - this.time = 0; - - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -134211,12 +140889,17 @@ var KeyboardPlugin = new Class({ boot: function () { var settings = this.settings.input; - var config = this.scene.sys.game.config; - this.enabled = GetValue(settings, 'keyboard', config.inputKeyboard); - this.target = GetValue(settings, 'keyboard.target', config.inputKeyboardEventTarget); + this.enabled = GetValue(settings, 'keyboard', true); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + var captures = GetValue(settings, 'keyboard.capture', null); + + if (captures) + { + this.addCaptures(captures); + } + + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -134230,12 +140913,18 @@ var KeyboardPlugin = new Class({ */ start: function () { - if (this.enabled) + if (this.sceneInputPlugin.manager.useQueue) { - this.startListeners(); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.on(InputEvents.MANAGER_PROCESS, this.update, this); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); + + this.game.events.on(GameEvents.BLUR, this.resetKeys, this); }, /** @@ -134252,59 +140941,153 @@ var KeyboardPlugin = new Class({ }, /** - * Starts the Keyboard Event listeners running. - * This is called automatically and does not need to be manually invoked. + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. * - * @method Phaser.Input.Keyboard.KeyboardPlugin#startListeners - * @private - * @since 3.10.0 + * This `addCapture` method enables consuming keyboard events for specific keys, so they don't bubble up the browser + * and cause the default behaviors. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable event capture for. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ - startListeners: function () + addCapture: function (keycode) { - var _this = this; + this.manager.addCapture(keycode); - var handler = function (event) - { - if (event.defaultPrevented || !_this.isActive()) - { - // Do nothing if event already handled - return; - } - - _this.queue.push(event); - - var key = _this.keys[event.keyCode]; - - if (key && key.preventDefault) - { - event.preventDefault(); - } - - }; - - this.onKeyHandler = handler; - - this.target.addEventListener('keydown', handler, false); - this.target.addEventListener('keyup', handler, false); - - // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + return this; }, /** - * Stops the Keyboard Event listeners. - * This is called automatically and does not need to be manually invoked. + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. * - * @method Phaser.Input.Keyboard.KeyboardPlugin#stopListeners - * @private - * @since 3.10.0 + * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable event capture for. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ - stopListeners: function () + removeCapture: function (keycode) { - this.target.removeEventListener('keydown', this.onKeyHandler); - this.target.removeEventListener('keyup', this.onKeyHandler); + this.manager.removeCapture(keycode); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + return this; + }, + + /** + * Returns an array that contains all of the keyboard captures currently enabled. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures + * @since 3.16.0 + * + * @return {integer[]} An array of all the currently capturing key codes. + */ + getCaptures: function () + { + return this.manager.captures; + }, + + /** + * Allows Phaser to prevent any key captures you may have defined from bubbling up the browser. + * You can use this to re-enable event capturing if you had paused it via `disableGlobalCapture`. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#enableGlobalCapture + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + enableGlobalCapture: function () + { + this.manager.preventDefault = true; + + return this; + }, + + /** + * Disables Phaser from preventing any key captures you may have defined, without actually removing them. + * You can use this to temporarily disable event capturing if, for example, you swap to a DOM element. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#disableGlobalCapture + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + disableGlobalCapture: function () + { + this.manager.preventDefault = false; + + return this; + }, + + /** + * Removes all keyboard captures. + * + * Note that this is a global change. It will clear all event captures across your game, not just for this specific Scene. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#clearCaptures + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + clearCaptures: function () + { + this.manager.clearCaptures(); + + return this; }, /** @@ -134364,11 +141147,16 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(object|string)} keys - An object containing Key Codes, or a comma-separated string. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * * @return {object} An object containing Key objects mapped to the input properties. */ - addKeys: function (keys) + addKeys: function (keys, enableCapture, emitOnRepeat) { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var output = {}; if (typeof keys === 'string') @@ -134381,7 +141169,7 @@ var KeyboardPlugin = new Class({ if (currentKey) { - output[currentKey] = this.addKey(currentKey); + output[currentKey] = this.addKey(currentKey, enableCapture, emitOnRepeat); } } } @@ -134389,7 +141177,7 @@ var KeyboardPlugin = new Class({ { for (var key in keys) { - output[key] = this.addKey(keys[key]); + output[key] = this.addKey(keys[key], enableCapture, emitOnRepeat); } } @@ -134407,11 +141195,16 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * * @return {Phaser.Input.Keyboard.Key} The newly created Key object, or a reference to it if it already existed in the keys array. */ - addKey: function (key) + addKey: function (key, enableCapture, emitOnRepeat) { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var keys = this.keys; if (key instanceof Key) @@ -134427,6 +141220,13 @@ var KeyboardPlugin = new Class({ keys[key.keyCode] = key; } + if (enableCapture) + { + this.addCapture(key.keyCode); + } + + key.setEmitOnRepeat(emitOnRepeat); + return key; } @@ -134438,6 +141238,13 @@ var KeyboardPlugin = new Class({ if (!keys[key]) { keys[key] = new Key(key); + + if (enableCapture) + { + this.addCapture(key); + } + + keys[key].setEmitOnRepeat(emitOnRepeat); } return keys[key]; @@ -134452,6 +141259,8 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ removeKey: function (key) { @@ -134475,6 +141284,8 @@ var KeyboardPlugin = new Class({ { keys[key] = undefined; } + + return this; }, /** @@ -134535,7 +141346,7 @@ var KeyboardPlugin = new Class({ * @param {Phaser.Input.Keyboard.Key} key - A Key object. * @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down. * - * @return {boolean} `True` if the Key is down within the duration specified, otherwise `false`. + * @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`. */ checkDown: function (key, duration) { @@ -134555,29 +141366,22 @@ var KeyboardPlugin = new Class({ }, /** - * Internal update handler called by the Input Manager, which is in turn invoked by the Game step. + * Internal update handler called by the Input Plugin, which is in turn invoked by the Game step. * * @method Phaser.Input.Keyboard.KeyboardPlugin#update * @private * @since 3.10.0 - * - * @param {number} time - The game loop time value. */ - update: function (time) + update: function () { - this.time = time; + var queue = this.manager.queue; + var len = queue.length; - var len = this.queue.length; - - if (!this.enabled || len === 0) + if (!this.isActive() || len === 0) { return; } - // Clears the queue array, and also means we don't work on array data that could potentially - // be modified during the processing phase - var queue = this.queue.splice(0, len); - var keys = this.keys; // Process the event queue, dispatching all of the events that have stored up @@ -134585,40 +141389,98 @@ var KeyboardPlugin = new Class({ { var event = queue[i]; var code = event.keyCode; + var key = keys[code]; + var repeat = false; + + // Override the default functions (it's too late for the browser to use them anyway, so we may as well) + if (event.cancelled === undefined) + { + // Event allowed to flow across all handlers in this Scene, and any other Scene in the Scene list + event.cancelled = 0; + + // Won't reach any more local (Scene level) handlers + event.stopImmediatePropagation = function () + { + event.cancelled = 1; + }; + + // Won't reach any more handlers in any Scene further down the Scene list + event.stopPropagation = function () + { + event.cancelled = -1; + }; + } + + if (event.cancelled === -1) + { + // This event has been stopped from broadcasting to any other Scene, so abort. + continue; + } if (event.type === 'keydown') { - if (KeyMap[code] && (keys[code] === undefined || keys[code].isDown === false)) + // Key specific callback first + if (key) { - // Will emit a keyboard or keyup event - this.emit(event.type, event); + repeat = key.isDown; - this.emit('keydown_' + KeyMap[code], event); + key.onDown(event); } - if (keys[code]) + if (!event.cancelled && (!key || !repeat)) { - ProcessKeyDown(keys[code], event); + if (KeyMap[code]) + { + this.emit(Events.KEY_DOWN + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. + this.emit('keydown_' + KeyMap[code], event); + } + + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_DOWN, event); + } } } else { - // Will emit a keyboard or keyup event - this.emit(event.type, event); - - this.emit('keyup_' + KeyMap[code], event); - - if (keys[code]) + // Key specific callback first + if (key) { - ProcessKeyUp(keys[code], event); + key.onUp(event); } + + if (!event.cancelled) + { + if (KeyMap[code]) + { + this.emit(Events.KEY_UP + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. + this.emit('keyup_' + KeyMap[code], event); + } + + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_UP, event); + } + } + } + + // Reset the cancel state for other Scenes to use + if (event.cancelled === 1) + { + event.cancelled = 0; } } }, /** * Resets all Key objects created by _this_ Keyboard Plugin back to their default un-pressed states. - * This can only reset keys created via the `addKey`, `addKeys` or `createCursors` methods. + * This can only reset keys created via the `addKey`, `addKeys` or `createCursorKeys` methods. * If you have created a Key object directly you'll need to reset it yourself. * * This method is called automatically when the Keyboard Plugin shuts down, but can be @@ -134626,6 +141488,8 @@ var KeyboardPlugin = new Class({ * * @method Phaser.Input.Keyboard.KeyboardPlugin#resetKeys * @since 3.15.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ resetKeys: function () { @@ -134658,7 +141522,16 @@ var KeyboardPlugin = new Class({ { this.resetKeys(); - this.stopListeners(); + if (this.sceneInputPlugin.manager.useQueue) + { + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.off(InputEvents.MANAGER_PROCESS, this.update, this); + } + + this.game.events.off(GameEvents.BLUR, this.resetKeys); this.removeAllListeners(); @@ -134676,6 +141549,17 @@ var KeyboardPlugin = new Class({ { this.shutdown(); + var keys = this.keys; + + for (var i = 0; i < keys.length; i++) + { + // Because it's a sparsely populated array + if (keys[i]) + { + keys[i].destroy(); + } + } + this.keys = []; this.combos = []; this.queue = []; @@ -134683,7 +141567,24 @@ var KeyboardPlugin = new Class({ this.scene = null; this.settings = null; this.sceneInputPlugin = null; - this.target = null; + this.manager = null; + }, + + /** + * Internal time value. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#time + * @type {number} + * @private + * @since 3.11.0 + */ + time: { + + get: function () + { + return this.sceneInputPlugin.manager.time; + } + } }); @@ -134702,12 +141603,243 @@ module.exports = KeyboardPlugin; /***/ }), -/* 674 */ +/* 695 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('up', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * @event Phaser.Input.Keyboard.Events#UP + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was released. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'up'; + + +/***/ }), +/* 696 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released + * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keyup-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#KEY_UP + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup-'; + + +/***/ }), +/* 697 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed + * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keydown-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#KEY_DOWN + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown-'; + + +/***/ }), +/* 698 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('down', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * @event Phaser.Input.Keyboard.Events#DOWN + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was pressed. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'down'; + + +/***/ }), +/* 699 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Combo Match Event. + * + * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched. + * + * Listen for this event from the Key Plugin after a combo has been created: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * @event Phaser.Input.Keyboard.Events#COMBO_MATCH + * + * @param {Phaser.Input.Keyboard.KeyCombo} keycombo - The Key Combo object that was matched. + * @param {KeyboardEvent} event - The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'keycombomatch'; + + +/***/ }), +/* 700 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`. + * + * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_UP + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup'; + + +/***/ }), +/* 701 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`. + * + * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_DOWN + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown'; + + +/***/ }), +/* 702 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134717,28 +141849,31 @@ module.exports = KeyboardPlugin; module.exports = { - KeyboardPlugin: __webpack_require__(673), + Events: __webpack_require__(123), - Key: __webpack_require__(284), - KeyCodes: __webpack_require__(159), + KeyboardManager: __webpack_require__(371), + KeyboardPlugin: __webpack_require__(694), - KeyCombo: __webpack_require__(283), + Key: __webpack_require__(291), + KeyCodes: __webpack_require__(135), - JustDown: __webpack_require__(666), - JustUp: __webpack_require__(665), - DownDuration: __webpack_require__(664), - UpDuration: __webpack_require__(663) + KeyCombo: __webpack_require__(290), + + JustDown: __webpack_require__(689), + JustUp: __webpack_require__(688), + DownDuration: __webpack_require__(687), + UpDuration: __webpack_require__(686) }; /***/ }), -/* 675 */ +/* 703 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134769,32 +141904,34 @@ module.exports = CreatePixelPerfectHandler; /***/ }), -/* 676 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(81); -var CircleContains = __webpack_require__(44); +var Circle = __webpack_require__(87); +var CircleContains = __webpack_require__(48); var Class = __webpack_require__(0); -var CreateInteractiveObject = __webpack_require__(288); -var CreatePixelPerfectHandler = __webpack_require__(675); -var DistanceBetween = __webpack_require__(58); -var Ellipse = __webpack_require__(99); -var EllipseContains = __webpack_require__(98); -var EventEmitter = __webpack_require__(11); +var CreateInteractiveObject = __webpack_require__(295); +var CreatePixelPerfectHandler = __webpack_require__(703); +var DistanceBetween = __webpack_require__(62); +var Ellipse = __webpack_require__(105); +var EllipseContains = __webpack_require__(104); +var Events = __webpack_require__(44); +var EventEmitter = __webpack_require__(9); var GetFastValue = __webpack_require__(1); -var InputPluginCache = __webpack_require__(116); +var InputPluginCache = __webpack_require__(124); var IsPlainObject = __webpack_require__(8); -var PluginCache = __webpack_require__(15); -var Rectangle = __webpack_require__(10); -var RectangleContains = __webpack_require__(43); -var Triangle = __webpack_require__(66); -var TriangleContains = __webpack_require__(76); +var PluginCache = __webpack_require__(17); +var Rectangle = __webpack_require__(11); +var RectangleContains = __webpack_require__(47); +var SceneEvents = __webpack_require__(16); +var Triangle = __webpack_require__(72); +var TriangleContains = __webpack_require__(81); /** * @classdesc @@ -134981,7 +142118,7 @@ var InputPlugin = new Class({ * Internal event propagation callback container. * * @name Phaser.Input.InputPlugin#_eventContainer - * @type {object} + * @type {Phaser.Input.EventData} * @private * @since 3.13.0 */ @@ -135098,6 +142235,16 @@ var InputPlugin = new Class({ */ this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; + /** + * A array containing the dragStates, for this Scene, index by the Pointer ID. + * + * @name Phaser.Input.InputPlugin#_dragState + * @type {integer[]} + * @private + * @since 3.16.0 + */ + this._dragState = []; + /** * A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID. * @@ -135118,8 +142265,8 @@ var InputPlugin = new Class({ */ this._validTypes = [ 'onDown', 'onUp', 'onOver', 'onOut', 'onMove', 'onDragStart', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDrop' ]; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -135127,6 +142274,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#boot + * @fires Phaser.Input.Events#BOOT * @private * @since 3.5.1 */ @@ -135136,10 +142284,10 @@ var InputPlugin = new Class({ this.displayList = this.systems.displayList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); // Registered input plugins listen for this - this.pluginEvents.emit('boot'); + this.pluginEvents.emit(Events.BOOT); }, /** @@ -135148,6 +142296,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#start + * @fires Phaser.Input.Events#START * @private * @since 3.5.0 */ @@ -135155,18 +142304,60 @@ var InputPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('transitionstart', this.transitionIn, this); - eventEmitter.on('transitionout', this.transitionOut, this); - eventEmitter.on('transitioncomplete', this.transitionComplete, this); - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); + eventEmitter.on(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.once('shutdown', this.shutdown, this); + if (this.manager.useQueue) + { + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + } + + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + + this.manager.events.on(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.on(Events.GAME_OVER, this.onGameOver, this); this.enabled = true; + // Populate the pointer drag states + this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + // Registered input plugins listen for this - this.pluginEvents.emit('start'); + this.pluginEvents.emit(Events.START); + }, + + /** + * Game Over handler. + * + * @method Phaser.Input.InputPlugin#onGameOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.2 + */ + onGameOver: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OVER, event.timeStamp, event); + } + }, + + /** + * Game Out handler. + * + * @method Phaser.Input.InputPlugin#onGameOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.2 + */ + onGameOut: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OUT, event.timeStamp, event); + } }, /** @@ -135174,13 +142365,14 @@ var InputPlugin = new Class({ * deleting old Game Objects. * * @method Phaser.Input.InputPlugin#preUpdate + * @fires Phaser.Input.Events#PRE_UPDATE * @private * @since 3.0.0 */ preUpdate: function () { // Registered input plugins listen for this - this.pluginEvents.emit('preUpdate'); + this.pluginEvents.emit(Events.PRE_UPDATE); var removeList = this._pendingRemoval; var insertList = this._pendingInsertion; @@ -135237,6 +142429,7 @@ var InputPlugin = new Class({ * Called automatically by the Scene Systems step. * * @method Phaser.Input.InputPlugin#update + * @fires Phaser.Input.Events#UPDATE * @private * @since 3.0.0 * @@ -135250,10 +142443,10 @@ var InputPlugin = new Class({ return; } - this.pluginEvents.emit('update', time, delta); - var manager = this.manager; + this.pluginEvents.emit(Events.UPDATE, time, delta); + // Another Scene above this one has already consumed the input events, or we're in transition if (manager.globalTopOnly && manager.ignoreEvents) { @@ -135281,8 +142474,9 @@ var InputPlugin = new Class({ } var pointers = this.manager.pointers; + var pointersTotal = this.manager.pointersTotal; - for (var i = 0; i < this.manager.pointersTotal; i++) + for (var i = 0; i < pointersTotal; i++) { var pointer = pointers[i]; @@ -135311,8 +142505,11 @@ var InputPlugin = new Class({ var total = this.processDragEvents(pointer, time); - // TODO: Enable for touch - if (!pointer.wasTouch) + // TODO: Enable for touch - the method needs recoding to take ALL pointers at once + // and process them all together, in the same batch, otherwise the justOut and stillOver + // arrays will get corrupted in multi-touch enabled games. For now, we'll enable it for + // single touch games (which is probably the majority anyway). + if (pointersTotal < 3 || !pointer.wasTouch) { total += this.processOverOutEvents(pointer); } @@ -135322,16 +142519,16 @@ var InputPlugin = new Class({ total += this.processDownEvents(pointer); } - if (pointer.justUp) - { - total += this.processUpEvents(pointer); - } - if (pointer.justMoved) { total += this.processMoveEvents(pointer); } + if (pointer.justUp) + { + total += this.processUpEvents(pointer); + } + if (total > 0 && manager.globalTopOnly) { // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame @@ -135522,6 +142719,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processDownEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. @@ -135552,7 +142753,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointerdown', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_DOWN, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -135560,7 +142761,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectdown', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_DOWN, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -135569,20 +142770,89 @@ var InputPlugin = new Class({ } } - // Contains ALL Game Objects currently over in the array + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - this.emit('pointerdown', pointer, currentlyOver); + if (pointer.downElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_DOWN, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_DOWN_OUTSIDE, pointer); + } } return total; }, + /** + * Returns the drag state of the given Pointer for this Input Plugin. + * + * The state will be one of the following: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#getDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. + * + * @return {integer} The drag state of the given Pointer. + */ + getDragState: function (pointer) + { + return this._dragState[pointer.id]; + }, + + /** + * Sets the drag state of the given Pointer for this Input Plugin. + * + * The state must be one of the following values: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#setDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. + * @param {integer} state - The drag state value. An integer between 0 and 5. + */ + setDragState: function (pointer, state) + { + this._dragState[pointer.id] = state; + }, + /** * An internal method that handles the Pointer drag events. * * @method Phaser.Input.InputPlugin#processDragEvents * @private + * @fires Phaser.Input.Events#DRAG_END + * @fires Phaser.Input.Events#DRAG_ENTER + * @fires Phaser.Input.Events#DRAG + * @fires Phaser.Input.Events#DRAG_LEAVE + * @fires Phaser.Input.Events#DRAG_OVER + * @fires Phaser.Input.Events#DRAG_START + * @fires Phaser.Input.Events#DROP + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @fires Phaser.Input.Events#GAMEOBJECT_DROP * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. @@ -135611,19 +142881,19 @@ var InputPlugin = new Class({ // 4 = Pointer actively dragging the draglist and has moved // 5 = Pointer actively dragging but has been released, notify draglist - if (pointer.dragState === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) + if (this.getDragState(pointer) === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) { - pointer.dragState = 1; + this.setDragState(pointer, 1); } - else if (pointer.dragState > 0 && !pointer.primaryDown && pointer.justUp) + else if (this.getDragState(pointer) > 0 && !pointer.primaryDown && pointer.justUp) { - pointer.dragState = 5; + this.setDragState(pointer, 5); } // Process the various drag states // 1 = Primary button down and objects below, so collect a draglist - if (pointer.dragState === 1) + if (this.getDragState(pointer) === 1) { // Get draggable objects, sort them, pick the top (or all) and store them somewhere var draglist = []; @@ -135640,7 +142910,7 @@ var InputPlugin = new Class({ if (draglist.length === 0) { - pointer.dragState = 0; + this.setDragState(pointer, 0); return 0; } @@ -135660,35 +142930,35 @@ var InputPlugin = new Class({ if (this.dragDistanceThreshold === 0 && this.dragTimeThreshold === 0) { // No drag criteria, so snap immediately to mode 3 - pointer.dragState = 3; + this.setDragState(pointer, 3); } else { // Check the distance / time - pointer.dragState = 2; + this.setDragState(pointer, 2); } } // 2 = Pointer being checked if meets drag criteria - if (pointer.dragState === 2) + if (this.getDragState(pointer) === 2) { // Has it moved far enough to be considered a drag? if (this.dragDistanceThreshold > 0 && DistanceBetween(pointer.x, pointer.y, pointer.downX, pointer.downY) >= this.dragDistanceThreshold) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } // Held down long enough to be considered a drag? if (this.dragTimeThreshold > 0 && (time >= pointer.downTime + this.dragTimeThreshold)) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } } // 3 = Pointer meets criteria and is freshly down, notify the draglist - if (pointer.dragState === 3) + if (this.getDragState(pointer) === 3) { list = this._drag[pointer.id]; @@ -135706,18 +142976,18 @@ var InputPlugin = new Class({ input.dragStartX = gameObject.x; input.dragStartY = gameObject.y; - gameObject.emit('dragstart', pointer, input.dragX, input.dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG_START, pointer, input.dragX, input.dragY); - this.emit('dragstart', pointer, gameObject); + this.emit(Events.DRAG_START, pointer, gameObject); } - pointer.dragState = 4; + this.setDragState(pointer, 4); return list.length; } // 4 = Pointer actively dragging the draglist and has moved - if (pointer.dragState === 4 && pointer.justMoved && !pointer.justUp) + if (this.getDragState(pointer) === 4 && pointer.justMoved && !pointer.justUp) { var dropZones = this._tempZones; @@ -135738,29 +143008,29 @@ var InputPlugin = new Class({ if (index === 0) { // We're still over it, and it's still the top of the display list, phew ... - gameObject.emit('dragover', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_OVER, pointer, input.target); - this.emit('dragover', pointer, gameObject, input.target); + this.emit(Events.DRAG_OVER, pointer, gameObject, input.target); } else if (index > 0) { // Still over it but it's no longer top of the display list (targets must always be at the top) - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { // Nope, we've moved on (or the target has!), leave the old target - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); // Anything new to replace it? // Yup! @@ -135768,9 +143038,9 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { @@ -135783,24 +143053,24 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } var dragX = pointer.x - gameObject.input.dragX; var dragY = pointer.y - gameObject.input.dragY; - gameObject.emit('drag', pointer, dragX, dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG, pointer, dragX, dragY); - this.emit('drag', pointer, gameObject, dragX, dragY); + this.emit(Events.DRAG, pointer, gameObject, dragX, dragY); } return list.length; } // 5 = Pointer was actively dragging but has been released, notify draglist - if (pointer.dragState === 5) + if (this.getDragState(pointer) === 5) { list = this._drag[pointer.id]; @@ -135821,9 +143091,9 @@ var InputPlugin = new Class({ if (input.target) { - gameObject.emit('drop', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DROP, pointer, input.target); - this.emit('drop', pointer, gameObject, input.target); + this.emit(Events.DROP, pointer, gameObject, input.target); input.target = null; @@ -135832,13 +143102,13 @@ var InputPlugin = new Class({ // And finally the dragend event - gameObject.emit('dragend', pointer, input.dragX, input.dragY, dropped); + gameObject.emit(Events.GAMEOBJECT_DRAG_END, pointer, input.dragX, input.dragY, dropped); - this.emit('dragend', pointer, gameObject, dropped); + this.emit(Events.DRAG_END, pointer, gameObject, dropped); } } - pointer.dragState = 0; + this.setDragState(pointer, 0); list.splice(0); } @@ -135850,6 +143120,9 @@ var InputPlugin = new Class({ * An internal method that handles the Pointer movement event. * * @method Phaser.Input.InputPlugin#processMoveEvents + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @fires Phaser.Input.Events#GAMEOBJECT_MOVE + * @fires Phaser.Input.Events#POINTER_MOVE * @private * @since 3.0.0 * @@ -135881,7 +143154,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointermove', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_MOVE, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -135889,7 +143162,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectmove', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_MOVE, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -135905,7 +143178,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointermove', pointer, currentlyOver); + this.emit(Events.POINTER_MOVE, pointer, currentlyOver); } return total; @@ -135916,6 +143189,12 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processOverOutEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_OVER + * @fires Phaser.Input.Events#POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @fires Phaser.Input.Events#GAMEOBJECT_OUT + * @fires Phaser.Input.Events#POINTER_OUT * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -135997,7 +143276,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerout', pointer, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); manager.resetCursor(gameObject.input); @@ -136009,7 +143288,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectout', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -136020,7 +143299,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerout', pointer, justOut); + this.emit(Events.POINTER_OUT, pointer, justOut); } } @@ -136045,7 +143324,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerover', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); manager.setCursor(gameObject.input); @@ -136057,7 +143336,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectover', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -136068,7 +143347,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerover', pointer, justOver); + this.emit(Events.POINTER_OVER, pointer, justOver); } } @@ -136086,6 +143365,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processUpEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @fires Phaser.Input.Events#GAMEOBJECT_UP + * @fires Phaser.Input.Events#POINTER_UP + * @fires Phaser.Input.Events#POINTER_UP_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -136113,9 +143396,15 @@ var InputPlugin = new Class({ continue; } - // pointerupoutside + gameObject.emit(Events.GAMEOBJECT_POINTER_UP, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - gameObject.emit('pointerup', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + // Clear over and emit 'pointerout' on touch. + if (pointer.wasTouch) + { + this._over[pointer.id] = []; + + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + } if (_eventData.cancelled) { @@ -136123,7 +143412,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectup', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_UP, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -136132,10 +143421,17 @@ var InputPlugin = new Class({ } } + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - // Contains ALL Game Objects currently up in the array - this.emit('pointerup', pointer, currentlyOver); + if (pointer.upElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_UP, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_UP_OUTSIDE, pointer); + } } return currentlyOver.length; @@ -136453,20 +143749,20 @@ var InputPlugin = new Class({ var width = 0; var height = 0; - if (frame) - { - width = frame.realWidth; - height = frame.realHeight; - } - else if (gameObject.width) + if (gameObject.width) { width = gameObject.width; height = gameObject.height; } + else if (frame) + { + width = frame.realWidth; + height = frame.realHeight; + } if (gameObject.type === 'Container' && (width === 0 || height === 0)) { - console.warn('Container.setInteractive() must specify a Shape or call setSize() first'); + console.warn('Container.setInteractive must specify a Shape or call setSize() first'); continue; } @@ -136740,6 +144036,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -136762,6 +144062,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this DOM event. @@ -136777,6 +144078,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -136799,6 +144104,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -136814,6 +144120,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -136836,6 +144146,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -136951,19 +144262,21 @@ var InputPlugin = new Class({ * We need to kill and reset all internal properties as well as stop listening to Scene events. * * @method Phaser.Input.InputPlugin#shutdown + * @fires Phaser.Input.Events#SHUTDOWN * @private * @since 3.0.0 */ shutdown: function () { // Registered input plugins listen for this - this.pluginEvents.emit('shutdown'); + this.pluginEvents.emit(Events.SHUTDOWN); this._temp.length = 0; this._list.length = 0; this._draggable.length = 0; this._pendingRemoval.length = 0; this._pendingInsertion.length = 0; + this._dragState.length = 0; for (var i = 0; i < 10; i++) { @@ -136975,13 +144288,21 @@ var InputPlugin = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('transitionstart', this.transitionIn, this); - eventEmitter.off('transitionout', this.transitionOut, this); - eventEmitter.off('transitioncomplete', this.transitionComplete, this); + eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + + if (this.manager.useQueue) + { + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + } + + this.manager.events.off(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.off(Events.GAME_OVER, this.onGameOver, this); + + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -136989,6 +144310,7 @@ var InputPlugin = new Class({ * We need to shutdown and then kill off all external references. * * @method Phaser.Input.InputPlugin#destroy + * @fires Phaser.Input.Events#DESTROY * @private * @since 3.0.0 */ @@ -136997,11 +144319,11 @@ var InputPlugin = new Class({ this.shutdown(); // Registered input plugins listen for this - this.pluginEvents.emit('destroy'); + this.pluginEvents.emit(Events.DESTROY); this.pluginEvents.removeAllListeners(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.cameras = null; @@ -137046,6 +144368,23 @@ var InputPlugin = new Class({ }, + /** + * Are any mouse or touch pointers currently over the game canvas? + * + * @name Phaser.Input.InputPlugin#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isOver: { + + get: function () + { + return this.manager.isOver; + } + + }, + /** * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` @@ -137270,12 +144609,12 @@ module.exports = InputPlugin; /***/ }), -/* 677 */ +/* 705 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137321,12 +144660,12 @@ module.exports = { /***/ }), -/* 678 */ +/* 706 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137360,12 +144699,12 @@ module.exports = { /***/ }), -/* 679 */ +/* 707 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137410,12 +144749,12 @@ module.exports = { /***/ }), -/* 680 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137425,28 +144764,30 @@ module.exports = { module.exports = { - DUALSHOCK_4: __webpack_require__(679), - SNES_USB: __webpack_require__(678), - XBOX_360: __webpack_require__(677) + DUALSHOCK_4: __webpack_require__(707), + SNES_USB: __webpack_require__(706), + XBOX_360: __webpack_require__(705) }; /***/ }), -/* 681 */ +/* 709 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); -var Gamepad = __webpack_require__(285); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(171); +var Gamepad = __webpack_require__(292); var GetValue = __webpack_require__(4); -var InputPluginCache = __webpack_require__(116); +var InputPluginCache = __webpack_require__(124); +var InputEvents = __webpack_require__(44); /** * @typedef {object} Pad @@ -137626,8 +144967,8 @@ var GamepadPlugin = new Class({ */ this._pad4; - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -137647,7 +144988,7 @@ var GamepadPlugin = new Class({ this.enabled = GetValue(settings, 'gamepad', config.inputGamepad) && game.device.input.gamepads; this.target = GetValue(settings, 'gamepad.target', config.inputGamepadEventTarget); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -137666,7 +145007,7 @@ var GamepadPlugin = new Class({ this.startListeners(); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -137720,7 +145061,7 @@ var GamepadPlugin = new Class({ // until more browsers support this // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); }, /** @@ -137736,7 +145077,7 @@ var GamepadPlugin = new Class({ this.target.removeEventListener('gamepadconnected', this.onGamepadHandler); this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); }, /** @@ -137883,6 +145224,8 @@ var GamepadPlugin = new Class({ * * @method Phaser.Input.Gamepad.GamepadPlugin#update * @private + * @fires Phaser.Input.Gamepad.Events#CONNECTED + * @fires Phaser.Input.Gamepad.Events#DISCONNECTED * @since 3.10.0 */ update: function () @@ -137911,11 +145254,11 @@ var GamepadPlugin = new Class({ if (event.type === 'gamepadconnected') { - this.emit('connected', pad, event); + this.emit(Events.CONNECTED, pad, event); } else if (event.type === 'gamepaddisconnected') { - this.emit('disconnected', pad, event); + this.emit(Events.DISCONNECTED, pad, event); } } }, @@ -138076,12 +145419,185 @@ module.exports = GamepadPlugin; /***/ }), -/* 682 */ +/* 710 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by a Gamepad instance when a button has been released on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('up', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP + * + * @param {integer} index - The index of the button that was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + */ +module.exports = 'up'; + + +/***/ }), +/* 711 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by a Gamepad instance when a button has been pressed on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('down', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * + * @param {integer} index - The index of the button that was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + */ +module.exports = 'down'; + + +/***/ }), +/* 712 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Disconnected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`. + * + * @event Phaser.Input.Gamepad.Events#DISCONNECTED + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was disconnected. + * @param {Event} event - The native DOM Event that triggered the disconnection. + */ +module.exports = 'disconnected'; + + +/***/ }), +/* 713 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Connected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`. + * + * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, + * this is for security reasons. However, it may also trust the page already, in which case you won't get the + * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads + * already connected. + * + * @event Phaser.Input.Gamepad.Events#CONNECTED + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was connected. + * @param {Event} event - The native DOM Event that triggered the connection. + */ +module.exports = 'connected'; + + +/***/ }), +/* 714 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`. + * + * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_UP + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was released. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'up'; + + +/***/ }), +/* 715 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`. + * + * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_DOWN + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was pressed. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'down'; + + +/***/ }), +/* 716 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138091,26 +145607,27 @@ module.exports = GamepadPlugin; module.exports = { - Axis: __webpack_require__(287), - Button: __webpack_require__(286), - Gamepad: __webpack_require__(285), - GamepadPlugin: __webpack_require__(681), + Axis: __webpack_require__(294), + Button: __webpack_require__(293), + Events: __webpack_require__(171), + Gamepad: __webpack_require__(292), + GamepadPlugin: __webpack_require__(709), - Configs: __webpack_require__(680) + Configs: __webpack_require__(708) }; /***/ }), -/* 683 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(366); +var CONST = __webpack_require__(372); var Extend = __webpack_require__(21); /** @@ -138119,15 +145636,16 @@ var Extend = __webpack_require__(21); var Input = { - CreateInteractiveObject: __webpack_require__(288), - Gamepad: __webpack_require__(682), - InputManager: __webpack_require__(367), - InputPlugin: __webpack_require__(676), - InputPluginCache: __webpack_require__(116), - Keyboard: __webpack_require__(674), - Mouse: __webpack_require__(662), - Pointer: __webpack_require__(364), - Touch: __webpack_require__(661) + CreateInteractiveObject: __webpack_require__(295), + Events: __webpack_require__(44), + Gamepad: __webpack_require__(716), + InputManager: __webpack_require__(373), + InputPlugin: __webpack_require__(704), + InputPluginCache: __webpack_require__(124), + Keyboard: __webpack_require__(702), + Mouse: __webpack_require__(685), + Pointer: __webpack_require__(369), + Touch: __webpack_require__(684) }; @@ -138138,30 +145656,30 @@ module.exports = Input; /***/ }), -/* 684 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(160); +var RotateAroundXY = __webpack_require__(172); /** - * [description] + * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. * * @function Phaser.Geom.Triangle.RotateAroundPoint * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} point - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {Phaser.Geom.Point} point - The Point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var RotateAroundPoint = function (triangle, point, angle) { @@ -138172,30 +145690,30 @@ module.exports = RotateAroundPoint; /***/ }), -/* 685 */ +/* 719 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(160); -var InCenter = __webpack_require__(289); +var RotateAroundXY = __webpack_require__(172); +var InCenter = __webpack_require__(296); /** - * [description] + * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. * * @function Phaser.Geom.Triangle.Rotate * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var Rotate = function (triangle, angle) { @@ -138208,16 +145726,16 @@ module.exports = Rotate; /***/ }), -/* 686 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(71); +var Length = __webpack_require__(64); // The 2D area of a triangle. The area value is always non-negative. @@ -138244,12 +145762,12 @@ module.exports = Perimeter; /***/ }), -/* 687 */ +/* 721 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138280,12 +145798,12 @@ module.exports = Equals; /***/ }), -/* 688 */ +/* 722 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138311,27 +145829,27 @@ module.exports = CopyFrom; /***/ }), -/* 689 */ +/* 723 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(76); +var Contains = __webpack_require__(81); /** - * [description] + * Tests if a triangle contains a point. * * @function Phaser.Geom.Triangle.ContainsPoint * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Triangle} triangle - The triangle. + * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|any)} point - The point to test, or any point-like object with public `x` and `y` properties. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is within the triangle, otherwise `false`. */ var ContainsPoint = function (triangle, point) { @@ -138342,26 +145860,26 @@ module.exports = ContainsPoint; /***/ }), -/* 690 */ +/* 724 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(66); +var Triangle = __webpack_require__(72); /** - * [description] + * Clones a Triangle object. * * @function Phaser.Geom.Triangle.Clone * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} source - [description] + * @param {Phaser.Geom.Triangle} source - The Triangle to clone. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} A new Triangle identical to the given one but separate from it. */ var Clone = function (source) { @@ -138372,31 +145890,31 @@ module.exports = Clone; /***/ }), -/* 691 */ +/* 725 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(81); +var Circle = __webpack_require__(87); // Adapted from https://gist.github.com/mutoo/5617691 /** - * [description] + * Finds the circumscribed circle (circumcircle) of a Triangle object. The circumcircle is the circle which touches all of the triangle's vertices. * * @function Phaser.Geom.Triangle.CircumCircle * @since 3.0.0 * * @generic {Phaser.Geom.Circle} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Circle} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use as input. + * @param {Phaser.Geom.Circle} [out] - An optional Circle to store the result in. * - * @return {Phaser.Geom.Circle} [description] + * @return {Phaser.Geom.Circle} The updated `out` Circle, or a new Circle if none was provided. */ var CircumCircle = function (triangle, out) { @@ -138455,12 +145973,12 @@ module.exports = CircumCircle; /***/ }), -/* 692 */ +/* 726 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138531,24 +146049,24 @@ module.exports = CircumCenter; /***/ }), -/* 693 */ +/* 727 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Centroid = __webpack_require__(291); -var Offset = __webpack_require__(290); +var Centroid = __webpack_require__(298); +var Offset = __webpack_require__(297); /** * @callback CenterFunction * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to return the center coordinates of. * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} The center point of the Triangle according to the function. */ /** @@ -138584,16 +146102,16 @@ module.exports = CenterOn; /***/ }), -/* 694 */ +/* 728 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(66); +var Triangle = __webpack_require__(72); // 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) @@ -138633,17 +146151,17 @@ module.exports = BuildRight; /***/ }), -/* 695 */ +/* 729 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EarCut = __webpack_require__(70); -var Triangle = __webpack_require__(66); +var EarCut = __webpack_require__(77); +var Triangle = __webpack_require__(72); /** * [description] @@ -138708,16 +146226,16 @@ module.exports = BuildFromPolygon; /***/ }), -/* 696 */ +/* 730 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(66); +var Triangle = __webpack_require__(72); /** * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). @@ -138752,26 +146270,26 @@ module.exports = BuildEquilateral; /***/ }), -/* 697 */ +/* 731 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // The 2D area of a triangle. The area value is always non-negative. /** - * [description] + * Returns the area of a Triangle. * * @function Phaser.Geom.Triangle.Area * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. * - * @return {number} [description] + * @return {number} The area of the Triangle, always non-negative. */ var Area = function (triangle) { @@ -138791,70 +146309,70 @@ module.exports = Area; /***/ }), -/* 698 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(66); +var Triangle = __webpack_require__(72); -Triangle.Area = __webpack_require__(697); -Triangle.BuildEquilateral = __webpack_require__(696); -Triangle.BuildFromPolygon = __webpack_require__(695); -Triangle.BuildRight = __webpack_require__(694); -Triangle.CenterOn = __webpack_require__(693); -Triangle.Centroid = __webpack_require__(291); -Triangle.CircumCenter = __webpack_require__(692); -Triangle.CircumCircle = __webpack_require__(691); -Triangle.Clone = __webpack_require__(690); -Triangle.Contains = __webpack_require__(76); -Triangle.ContainsArray = __webpack_require__(163); -Triangle.ContainsPoint = __webpack_require__(689); -Triangle.CopyFrom = __webpack_require__(688); -Triangle.Decompose = __webpack_require__(297); -Triangle.Equals = __webpack_require__(687); -Triangle.GetPoint = __webpack_require__(306); -Triangle.GetPoints = __webpack_require__(305); -Triangle.InCenter = __webpack_require__(289); -Triangle.Perimeter = __webpack_require__(686); -Triangle.Offset = __webpack_require__(290); -Triangle.Random = __webpack_require__(202); -Triangle.Rotate = __webpack_require__(685); -Triangle.RotateAroundPoint = __webpack_require__(684); -Triangle.RotateAroundXY = __webpack_require__(160); +Triangle.Area = __webpack_require__(731); +Triangle.BuildEquilateral = __webpack_require__(730); +Triangle.BuildFromPolygon = __webpack_require__(729); +Triangle.BuildRight = __webpack_require__(728); +Triangle.CenterOn = __webpack_require__(727); +Triangle.Centroid = __webpack_require__(298); +Triangle.CircumCenter = __webpack_require__(726); +Triangle.CircumCircle = __webpack_require__(725); +Triangle.Clone = __webpack_require__(724); +Triangle.Contains = __webpack_require__(81); +Triangle.ContainsArray = __webpack_require__(175); +Triangle.ContainsPoint = __webpack_require__(723); +Triangle.CopyFrom = __webpack_require__(722); +Triangle.Decompose = __webpack_require__(304); +Triangle.Equals = __webpack_require__(721); +Triangle.GetPoint = __webpack_require__(313); +Triangle.GetPoints = __webpack_require__(312); +Triangle.InCenter = __webpack_require__(296); +Triangle.Perimeter = __webpack_require__(720); +Triangle.Offset = __webpack_require__(297); +Triangle.Random = __webpack_require__(218); +Triangle.Rotate = __webpack_require__(719); +Triangle.RotateAroundPoint = __webpack_require__(718); +Triangle.RotateAroundXY = __webpack_require__(172); module.exports = Triangle; /***/ }), -/* 699 */ +/* 733 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // Scales the width and height of this Rectangle by the given amounts. /** - * [description] + * Scales the width and height of this Rectangle by the given amounts. * * @function Phaser.Geom.Rectangle.Scale * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The `Rectangle` object that will be scaled by the specified amount(s). + * @param {number} x - The factor by which to scale the rectangle horizontally. + * @param {number} y - The amount by which to scale the rectangle vertically. If this is not specified, the rectangle will be scaled by the factor `x` in both directions. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The rectangle object with updated `width` and `height` properties as calculated from the scaling factor(s). */ var Scale = function (rect, x, y) { @@ -138870,12 +146388,12 @@ module.exports = Scale; /***/ }), -/* 700 */ +/* 734 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138899,17 +146417,17 @@ module.exports = SameDimensions; /***/ }), -/* 701 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Between = __webpack_require__(188); -var ContainsRect = __webpack_require__(292); +var Between = __webpack_require__(204); +var ContainsRect = __webpack_require__(299); var Point = __webpack_require__(6); /** @@ -138970,17 +146488,17 @@ module.exports = RandomOutside; /***/ }), -/* 702 */ +/* 736 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var DegToRad = __webpack_require__(36); +var DegToRad = __webpack_require__(39); /** * [description] @@ -139027,25 +146545,25 @@ module.exports = PerimeterPoint; /***/ }), -/* 703 */ +/* 737 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if two Rectangles overlap. If a Rectangle is within another Rectangle, the two will be considered overlapping. Thus, the Rectangles are treated as "solid". * * @function Phaser.Geom.Rectangle.Overlaps * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the two Rectangles overlap, `false` otherwise. */ var Overlaps = function (rectA, rectB) { @@ -139061,12 +146579,12 @@ module.exports = Overlaps; /***/ }), -/* 704 */ +/* 738 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139095,12 +146613,12 @@ module.exports = OffsetPoint; /***/ }), -/* 705 */ +/* 739 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139130,12 +146648,12 @@ module.exports = Offset; /***/ }), -/* 706 */ +/* 740 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139174,12 +146692,12 @@ module.exports = MergeXY; /***/ }), -/* 707 */ +/* 741 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139221,12 +146739,12 @@ module.exports = MergeRect; /***/ }), -/* 708 */ +/* 742 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139270,17 +146788,17 @@ module.exports = MergePoints; /***/ }), -/* 709 */ +/* 743 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); -var Intersects = __webpack_require__(164); +var Rectangle = __webpack_require__(11); +var Intersects = __webpack_require__(176); /** * Takes two Rectangles and first checks to see if they intersect. @@ -139321,34 +146839,33 @@ module.exports = Intersection; /***/ }), -/* 710 */ +/* 744 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(193); +var CenterOn = __webpack_require__(209); -// 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 -// to the left and right by the x value, and to the top and the bottom by the y value. /** - * [description] + * Increases the size of a Rectangle by a specified amount. + * + * The center of the Rectangle stays the same. The amounts are added to each side, so the actual increase in width or height is two times bigger than the respective argument. * * @function Phaser.Geom.Rectangle.Inflate * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to inflate. + * @param {number} x - How many pixels the left and the right side should be moved by horizontally. + * @param {number} y - How many pixels the top and the bottom side should be moved by vertically. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The inflated Rectangle. */ var Inflate = function (rect, x, y) { @@ -139364,12 +146881,12 @@ module.exports = Inflate; /***/ }), -/* 711 */ +/* 745 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139405,12 +146922,12 @@ module.exports = GetSize; /***/ }), -/* 712 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139443,12 +146960,12 @@ module.exports = GetCenter; /***/ }), -/* 713 */ +/* 747 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139478,26 +146995,26 @@ module.exports = FloorAll; /***/ }), -/* 714 */ +/* 748 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rounds down (floors) the top left X and Y co-ordinates of the given Rectangle to the largest integer less than or equal to them * * @function Phaser.Geom.Rectangle.Floor * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle to floor the top left X and Y co-ordinates of * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The rectangle that was passed to this function with its co-ordinates floored. */ var Floor = function (rect) { @@ -139511,33 +147028,33 @@ module.exports = Floor; /***/ }), -/* 715 */ +/* 749 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(161); - -// Fits the target rectangle around the source rectangle. -// Preserves aspect ration. -// Scales and centers the target rectangle to the source rectangle +var GetAspectRatio = __webpack_require__(173); /** - * [description] + * Adjusts the target rectangle, changing its width, height and position, + * so that it fully covers the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitInside` function, the target rectangle may extend further out than the source. * * @function Phaser.Geom.Rectangle.FitOutside * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @param {Phaser.Geom.Rectangle} target - [description] - * @param {Phaser.Geom.Rectangle} source - [description] + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envlope the target in. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ var FitOutside = function (target, source) { @@ -139564,33 +147081,33 @@ module.exports = FitOutside; /***/ }), -/* 716 */ +/* 750 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(161); - -// Fits the target rectangle into the source rectangle. -// Preserves aspect ratio. -// Scales and centers the target rectangle to the source rectangle +var GetAspectRatio = __webpack_require__(173); /** - * [description] + * Adjusts the target rectangle, changing its width, height and position, + * so that it fits inside the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitOutside` function, there may be some space inside the source area not covered. * * @function Phaser.Geom.Rectangle.FitInside * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @param {Phaser.Geom.Rectangle} target - [description] - * @param {Phaser.Geom.Rectangle} source - [description] + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envlope the target in. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ var FitInside = function (target, source) { @@ -139617,25 +147134,25 @@ module.exports = FitInside; /***/ }), -/* 717 */ +/* 751 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Compares the `x`, `y`, `width` and `height` properties of two rectangles. * * @function Phaser.Geom.Rectangle.Equals * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {Phaser.Geom.Rectangle} toCompare - [description] + * @param {Phaser.Geom.Rectangle} rect - Rectangle A + * @param {Phaser.Geom.Rectangle} toCompare - Rectangle B * - * @return {boolean} [description] + * @return {boolean} `true` if the rectangles' properties are an exact match, otherwise `false`. */ var Equals = function (rect, toCompare) { @@ -139651,12 +147168,12 @@ module.exports = Equals; /***/ }), -/* 718 */ +/* 752 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139682,16 +147199,16 @@ module.exports = CopyFrom; /***/ }), -/* 719 */ +/* 753 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(43); +var Contains = __webpack_require__(47); /** * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. @@ -139713,16 +147230,16 @@ module.exports = ContainsPoint; /***/ }), -/* 720 */ +/* 754 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Rectangle = __webpack_require__(11); /** * Creates a new Rectangle which is identical to the given one. @@ -139743,26 +147260,26 @@ module.exports = Clone; /***/ }), -/* 721 */ +/* 755 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rounds a Rectangle's position and size up to the smallest integer greater than or equal to each respective value. * * @function Phaser.Geom.Rectangle.CeilAll * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to modify. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified Rectangle. */ var CeilAll = function (rect) { @@ -139778,12 +147295,12 @@ module.exports = CeilAll; /***/ }), -/* 722 */ +/* 756 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139811,24 +147328,24 @@ module.exports = Ceil; /***/ }), -/* 723 */ +/* 757 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the area of the given Rectangle object. * * @function Phaser.Geom.Rectangle.Area * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle to calculate the area of. * - * @return {number} [description] + * @return {number} The area of the Rectangle object. */ var Area = function (rect) { @@ -139839,26 +147356,26 @@ module.exports = Area; /***/ }), -/* 724 */ +/* 758 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Reverses the order of the points of a Polygon. * * @function Phaser.Geom.Polygon.Reverse * @since 3.0.0 * * @generic {Phaser.Geom.Polygon} O - [polygon,$return] * - * @param {Phaser.Geom.Polygon} polygon - [description] + * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. * - * @return {Phaser.Geom.Polygon} [description] + * @return {Phaser.Geom.Polygon} The modified Polygon. */ var Reverse = function (polygon) { @@ -139871,12 +147388,12 @@ module.exports = Reverse; /***/ }), -/* 725 */ +/* 759 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139914,16 +147431,16 @@ module.exports = GetNumberArray; /***/ }), -/* 726 */ +/* 760 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(166); +var Contains = __webpack_require__(178); /** * [description] @@ -139945,26 +147462,26 @@ module.exports = ContainsPoint; /***/ }), -/* 727 */ +/* 761 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(167); +var Polygon = __webpack_require__(179); /** - * [description] + * Create a new polygon which is a copy of the specified polygon * * @function Phaser.Geom.Polygon.Clone * @since 3.0.0 * - * @param {Phaser.Geom.Polygon} polygon - [description] + * @param {Phaser.Geom.Polygon} polygon - The polygon to create a clone of * - * @return {Phaser.Geom.Polygon} [description] + * @return {Phaser.Geom.Polygon} A new separate Polygon cloned from the specified polygon, based on the same points. */ var Clone = function (polygon) { @@ -139975,54 +147492,54 @@ module.exports = Clone; /***/ }), -/* 728 */ +/* 762 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(167); +var Polygon = __webpack_require__(179); -Polygon.Clone = __webpack_require__(727); -Polygon.Contains = __webpack_require__(166); -Polygon.ContainsPoint = __webpack_require__(726); -Polygon.GetAABB = __webpack_require__(313); -Polygon.GetNumberArray = __webpack_require__(725); -Polygon.GetPoints = __webpack_require__(312); -Polygon.Perimeter = __webpack_require__(311); -Polygon.Reverse = __webpack_require__(724); -Polygon.Smooth = __webpack_require__(310); +Polygon.Clone = __webpack_require__(761); +Polygon.Contains = __webpack_require__(178); +Polygon.ContainsPoint = __webpack_require__(760); +Polygon.GetAABB = __webpack_require__(320); +Polygon.GetNumberArray = __webpack_require__(759); +Polygon.GetPoints = __webpack_require__(319); +Polygon.Perimeter = __webpack_require__(318); +Polygon.Reverse = __webpack_require__(758); +Polygon.Smooth = __webpack_require__(317); module.exports = Polygon; /***/ }), -/* 729 */ +/* 763 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetMagnitude = __webpack_require__(295); +var GetMagnitude = __webpack_require__(302); /** - * [description] + * Changes the magnitude (length) of a two-dimensional vector without changing its direction. * * @function Phaser.Geom.Point.SetMagnitude * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [point,$return] * - * @param {Phaser.Geom.Point} point - [description] - * @param {number} magnitude - [description] + * @param {Phaser.Geom.Point} point - The Point to treat as the end point of the vector. + * @param {number} magnitude - The new magnitude of the vector. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The modified Point. */ var SetMagnitude = function (point, magnitude) { @@ -140044,12 +147561,12 @@ module.exports = SetMagnitude; /***/ }), -/* 730 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140088,17 +147605,17 @@ module.exports = ProjectUnit; /***/ }), -/* 731 */ +/* 765 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var GetMagnitudeSq = __webpack_require__(294); +var GetMagnitudeSq = __webpack_require__(301); /** * [description] @@ -140134,29 +147651,29 @@ module.exports = Project; /***/ }), -/* 732 */ +/* 766 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * [description] + * Inverts a Point's coordinates. * * @function Phaser.Geom.Point.Negative * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Point} point - The Point to invert. + * @param {Phaser.Geom.Point} [out] - The Point to return the inverted coordinates in. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The modified `out` Point, or a new Point if none was provided. */ var Negative = function (point, out) { @@ -140169,12 +147686,12 @@ module.exports = Negative; /***/ }), -/* 733 */ +/* 767 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140199,31 +147716,31 @@ module.exports = Invert; /***/ }), -/* 734 */ +/* 768 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * Interpolate two given Point objects, based on `t` value. Return result either as new Point if `out` parameter is omitted or load result into Point passed as `out` parameter and return it. For `out` parameter you can also use any object with public x/y properties. + * [description] * * @function Phaser.Geom.Point.Interpolate * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} pointA - [description] - * @param {Phaser.Geom.Point} pointB - [description] - * @param {number} [t=0] - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Point} pointA - The starting `Point` for the interpolation. + * @param {Phaser.Geom.Point} pointB - The target `Point` for the interpolation. + * @param {number} [t=0] - The amount to interpolate between the two points. Generally, a value between 0 (returns the starting `Point`) and 1 (returns the target `Point`). If omitted, 0 is used. + * @param {(Phaser.Geom.Point|object)} [out] - An optional `Point` object whose `x` and `y` values will be set to the result of the interpolation (can also be any object with `x` and `y` properties). If omitted, a new `Point` created and returned. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} Either the object from the `out` argument with the properties `x` and `y` set to the result of the interpolation or a newly created `Point` object. */ var Interpolate = function (pointA, pointB, t, out) { @@ -140240,16 +147757,16 @@ module.exports = Interpolate; /***/ }), -/* 735 */ +/* 769 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Rectangle = __webpack_require__(11); /** * Calculates the Axis Aligned Bounding Box (or aabb) from an array of points. @@ -140310,19 +147827,20 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 736 */ +/* 770 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * [description] + * Get the centroid or geometric center of a plane figure (the arithmetic mean position of all the points in the figure). + * Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin. * * @function Phaser.Geom.Point.GetCentroid * @since 3.0.0 @@ -140373,12 +147891,12 @@ module.exports = GetCentroid; /***/ }), -/* 737 */ +/* 771 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140403,12 +147921,12 @@ module.exports = Floor; /***/ }), -/* 738 */ +/* 772 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140432,12 +147950,12 @@ module.exports = Equals; /***/ }), -/* 739 */ +/* 773 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140463,12 +147981,12 @@ module.exports = CopyFrom; /***/ }), -/* 740 */ +/* 774 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140493,12 +148011,12 @@ module.exports = Clone; /***/ }), -/* 741 */ +/* 775 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140523,43 +148041,43 @@ module.exports = Ceil; /***/ }), -/* 742 */ +/* 776 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -Point.Ceil = __webpack_require__(741); -Point.Clone = __webpack_require__(740); -Point.CopyFrom = __webpack_require__(739); -Point.Equals = __webpack_require__(738); -Point.Floor = __webpack_require__(737); -Point.GetCentroid = __webpack_require__(736); -Point.GetMagnitude = __webpack_require__(295); -Point.GetMagnitudeSq = __webpack_require__(294); -Point.GetRectangleFromPoints = __webpack_require__(735); -Point.Interpolate = __webpack_require__(734); -Point.Invert = __webpack_require__(733); -Point.Negative = __webpack_require__(732); -Point.Project = __webpack_require__(731); -Point.ProjectUnit = __webpack_require__(730); -Point.SetMagnitude = __webpack_require__(729); +Point.Ceil = __webpack_require__(775); +Point.Clone = __webpack_require__(774); +Point.CopyFrom = __webpack_require__(773); +Point.Equals = __webpack_require__(772); +Point.Floor = __webpack_require__(771); +Point.GetCentroid = __webpack_require__(770); +Point.GetMagnitude = __webpack_require__(302); +Point.GetMagnitudeSq = __webpack_require__(301); +Point.GetRectangleFromPoints = __webpack_require__(769); +Point.Interpolate = __webpack_require__(768); +Point.Invert = __webpack_require__(767); +Point.Negative = __webpack_require__(766); +Point.Project = __webpack_require__(765); +Point.ProjectUnit = __webpack_require__(764); +Point.SetMagnitude = __webpack_require__(763); module.exports = Point; /***/ }), -/* 743 */ +/* 777 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140582,12 +148100,12 @@ module.exports = Width; /***/ }), -/* 744 */ +/* 778 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140610,12 +148128,12 @@ module.exports = Slope; /***/ }), -/* 745 */ +/* 779 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140650,16 +148168,16 @@ module.exports = SetToAngle; /***/ }), -/* 746 */ +/* 780 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(162); +var RotateAroundXY = __webpack_require__(174); /** * Rotate a line around a point by the given angle in radians. @@ -140684,16 +148202,16 @@ module.exports = RotateAroundPoint; /***/ }), -/* 747 */ +/* 781 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(162); +var RotateAroundXY = __webpack_require__(174); /** * Rotate a line around its midpoint by the given angle in radians. @@ -140720,17 +148238,17 @@ module.exports = Rotate; /***/ }), -/* 748 */ +/* 782 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Angle = __webpack_require__(75); -var NormalAngle = __webpack_require__(296); +var Angle = __webpack_require__(80); +var NormalAngle = __webpack_require__(303); /** * Calculate the reflected angle between two lines. @@ -140754,12 +148272,12 @@ module.exports = ReflectAngle; /***/ }), -/* 749 */ +/* 783 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140782,12 +148300,12 @@ module.exports = PerpSlope; /***/ }), -/* 750 */ +/* 784 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140820,27 +148338,28 @@ module.exports = Offset; /***/ }), -/* 751 */ +/* 785 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(18); -var Angle = __webpack_require__(75); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(80); /** - * [description] + * The Y value of the normal of the given line. + * The normal of a line is a vector that points perpendicular from it. * * @function Phaser.Geom.Line.NormalY * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Line} line - The line to calculate the normal of. * - * @return {number} [description] + * @return {number} The Y value of the normal of the Line. */ var NormalY = function (line) { @@ -140851,17 +148370,17 @@ module.exports = NormalY; /***/ }), -/* 752 */ +/* 786 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(18); -var Angle = __webpack_require__(75); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(80); /** * [description] @@ -140882,12 +148401,12 @@ module.exports = NormalX; /***/ }), -/* 753 */ +/* 787 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140910,17 +148429,64 @@ module.exports = Height; /***/ }), -/* 754 */ +/* 788 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Get the shortest distance from a Line to the given Point. + * + * @function Phaser.Geom.Line.GetShortestDistance + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the distance from. + * @param {(Phaser.Geom.Point|object)} point - The point to get the shortest distance to. + * + * @return {number} The shortest distance from the line to the point. + */ +var GetShortestDistance = function (line, point) +{ + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return false; + } + + var s = (((y1 - point.y) * (x2 - x1)) - ((x1 - point.x) * (y2 - y1))) / L2; + + return Math.abs(s) * Math.sqrt(L2); +}; + +module.exports = GetShortestDistance; + + +/***/ }), +/* 789 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(18); -var Angle = __webpack_require__(75); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(80); var Point = __webpack_require__(6); /** @@ -140954,12 +148520,67 @@ module.exports = GetNormal; /***/ }), -/* 755 */ +/* 790 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Point = __webpack_require__(6); + +/** + * Get the nearest point on a line perpendicular to the given point. + * + * @function Phaser.Geom.Line.GetNearestPoint + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the nearest point on. + * @param {(Phaser.Geom.Point|object)} point - The point to get the nearest point to. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the nearest point on the line. + * + * @return {(Phaser.Geom.Point|object)} The nearest point on the line. + */ +var GetNearestPoint = function (line, point, out) +{ + if (out === undefined) { out = new Point(); } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return out; + } + + var r = (((point.x - x1) * (x2 - x1)) + ((point.y - y1) * (y2 - y1))) / L2; + + out.x = x1 + (r * (x2 - x1)); + out.y = y1 + (r * (y2 - y1)); + + return out; +}; + +module.exports = GetNearestPoint; + + +/***/ }), +/* 791 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140992,12 +148613,70 @@ module.exports = GetMidPoint; /***/ }), -/* 756 */ +/* 792 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Length = __webpack_require__(64); + +/** + * Extends the start and end points of a Line by the given amounts. + * + * The amounts can be positive or negative. Positive points will increase the length of the line, + * while negative ones will decrease it. + * + * If no `right` value is provided it will extend the length of the line equally in both directions. + * + * Pass a value of zero to leave the start or end point unchanged. + * + * @function Phaser.Geom.Line.Extend + * @since 3.16.0 + * + * @param {Phaser.Geom.Line} line - The line instance to extend. + * @param {number} left - The amount to extend the start of the line by. + * @param {number} [right] - The amount to extend the end of the line by. If not given it will be set to the `left` value. + * + * @return {Phaser.Geom.Line} The modified Line instance. + */ +var Extend = function (line, left, right) +{ + if (right === undefined) { right = left; } + + var length = Length(line); + + var slopX = line.x2 - line.x1; + var slopY = line.y2 - line.y1; + + if (left) + { + line.x1 = line.x1 - slopX / length * left; + line.y1 = line.y1 - slopY / length * left; + } + + if (right) + { + line.x2 = line.x2 + slopX / length * right; + line.y2 = line.y2 + slopY / length * right; + } + + return line; +}; + +module.exports = Extend; + + +/***/ }), +/* 793 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141026,12 +148705,12 @@ module.exports = Equals; /***/ }), -/* 757 */ +/* 794 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141057,16 +148736,16 @@ module.exports = CopyFrom; /***/ }), -/* 758 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(60); +var Line = __webpack_require__(65); /** * Clone the given line. @@ -141087,12 +148766,12 @@ module.exports = Clone; /***/ }), -/* 759 */ +/* 796 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141127,70 +148806,75 @@ module.exports = CenterOn; /***/ }), -/* 760 */ +/* 797 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(60); +var Line = __webpack_require__(65); -Line.Angle = __webpack_require__(75); -Line.BresenhamPoints = __webpack_require__(421); -Line.CenterOn = __webpack_require__(759); -Line.Clone = __webpack_require__(758); -Line.CopyFrom = __webpack_require__(757); -Line.Equals = __webpack_require__(756); -Line.GetMidPoint = __webpack_require__(755); -Line.GetNormal = __webpack_require__(754); -Line.GetPoint = __webpack_require__(433); -Line.GetPoints = __webpack_require__(208); -Line.Height = __webpack_require__(753); -Line.Length = __webpack_require__(71); -Line.NormalAngle = __webpack_require__(296); -Line.NormalX = __webpack_require__(752); -Line.NormalY = __webpack_require__(751); -Line.Offset = __webpack_require__(750); -Line.PerpSlope = __webpack_require__(749); -Line.Random = __webpack_require__(207); -Line.ReflectAngle = __webpack_require__(748); -Line.Rotate = __webpack_require__(747); -Line.RotateAroundPoint = __webpack_require__(746); -Line.RotateAroundXY = __webpack_require__(162); -Line.SetToAngle = __webpack_require__(745); -Line.Slope = __webpack_require__(744); -Line.Width = __webpack_require__(743); +Line.Angle = __webpack_require__(80); +Line.BresenhamPoints = __webpack_require__(454); +Line.CenterOn = __webpack_require__(796); +Line.Clone = __webpack_require__(795); +Line.CopyFrom = __webpack_require__(794); +Line.Equals = __webpack_require__(793); +Line.Extend = __webpack_require__(792); +Line.GetMidPoint = __webpack_require__(791); +Line.GetNearestPoint = __webpack_require__(790); +Line.GetNormal = __webpack_require__(789); +Line.GetPoint = __webpack_require__(467); +Line.GetPoints = __webpack_require__(224); +Line.GetShortestDistance = __webpack_require__(788); +Line.Height = __webpack_require__(787); +Line.Length = __webpack_require__(64); +Line.NormalAngle = __webpack_require__(303); +Line.NormalX = __webpack_require__(786); +Line.NormalY = __webpack_require__(785); +Line.Offset = __webpack_require__(784); +Line.PerpSlope = __webpack_require__(783); +Line.Random = __webpack_require__(223); +Line.ReflectAngle = __webpack_require__(782); +Line.Rotate = __webpack_require__(781); +Line.RotateAroundPoint = __webpack_require__(780); +Line.RotateAroundXY = __webpack_require__(174); +Line.SetToAngle = __webpack_require__(779); +Line.Slope = __webpack_require__(778); +Line.Width = __webpack_require__(777); module.exports = Line; /***/ }), -/* 761 */ +/* 798 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ContainsArray = __webpack_require__(163); -var Decompose = __webpack_require__(297); -var LineToLine = __webpack_require__(117); +var ContainsArray = __webpack_require__(175); +var Decompose = __webpack_require__(304); +var LineToLine = __webpack_require__(125); /** - * [description] + * Checks if two Triangles intersect. + * + * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". * * @function Phaser.Geom.Intersects.TriangleToTriangle * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangleA - [description] - * @param {Phaser.Geom.Triangle} triangleB - [description] + * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. + * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Triangles intersect, otherwise `false`. */ var TriangleToTriangle = function (triangleA, triangleB) { @@ -141256,17 +148940,17 @@ module.exports = TriangleToTriangle; /***/ }), -/* 762 */ +/* 799 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(76); -var LineToLine = __webpack_require__(117); +var Contains = __webpack_require__(81); +var LineToLine = __webpack_require__(125); /** * Checks if a Triangle and a Line intersect. @@ -141312,28 +148996,30 @@ module.exports = TriangleToLine; /***/ }), -/* 763 */ +/* 800 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToCircle = __webpack_require__(300); -var Contains = __webpack_require__(76); +var LineToCircle = __webpack_require__(307); +var Contains = __webpack_require__(81); /** - * [description] + * Checks if a Triangle and a Circle intersect. + * + * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. * * @function Phaser.Geom.Intersects.TriangleToCircle * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Circle} circle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. + * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Triangle and the `Circle` intersect, otherwise `false`. */ var TriangleToCircle = function (triangle, circle) { @@ -141375,29 +149061,29 @@ module.exports = TriangleToCircle; /***/ }), -/* 764 */ +/* 801 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Check if rectangle intersects with values. * * @function Phaser.Geom.Intersects.RectangleToValues * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} left - [description] - * @param {number} right - [description] - * @param {number} top - [description] - * @param {number} bottom - [description] - * @param {number} [tolerance=0] - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle object + * @param {number} left - The x coordinate of the left of the Rectangle. + * @param {number} right - The x coordinate of the right of the Rectangle. + * @param {number} top - The y coordinate of the top of the Rectangle. + * @param {number} bottom - The y coordinate of the bottom of the Rectangle. + * @param {number} [tolerance=0] - Tolerance allowed in the calculation, expressed in pixels. * - * @return {boolean} [description] + * @return {boolean} Returns true if there is an intersection. */ var RectangleToValues = function (rect, left, right, top, bottom, tolerance) { @@ -141415,19 +149101,19 @@ module.exports = RectangleToValues; /***/ }), -/* 765 */ +/* 802 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToLine = __webpack_require__(117); -var Contains = __webpack_require__(43); -var ContainsArray = __webpack_require__(163); -var Decompose = __webpack_require__(298); +var LineToLine = __webpack_require__(125); +var Contains = __webpack_require__(47); +var ContainsArray = __webpack_require__(175); +var Decompose = __webpack_require__(305); /** * Checks for intersection between Rectangle shape and Triangle shape. @@ -141508,27 +149194,27 @@ module.exports = RectangleToTriangle; /***/ }), -/* 766 */ +/* 803 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PointToLine = __webpack_require__(299); +var PointToLine = __webpack_require__(306); /** - * [description] + * Checks if a Point is located on the given line segment. * * @function Phaser.Geom.Intersects.PointToLineSegment * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Point} point - The Point to check for intersection. + * @param {Phaser.Geom.Line} line - The line segment to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point is on the given line segment, otherwise `false`. */ var PointToLineSegment = function (point, line) { @@ -141549,12 +149235,12 @@ module.exports = PointToLineSegment; /***/ }), -/* 767 */ +/* 804 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141572,10 +149258,10 @@ module.exports = PointToLineSegment; * @function Phaser.Geom.Intersects.LineToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] - * @param {(Phaser.Geom.Rectangle|object)} rect - [description] + * @param {Phaser.Geom.Line} line - The Line to check for intersection. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Line and the Rectangle intersect, `false` otherwise. */ var LineToRectangle = function (line, rect) { @@ -141650,17 +149336,17 @@ module.exports = LineToRectangle; /***/ }), -/* 768 */ +/* 805 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); -var RectangleToRectangle = __webpack_require__(164); +var Rectangle = __webpack_require__(11); +var RectangleToRectangle = __webpack_require__(176); /** * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. @@ -141699,25 +149385,25 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 769 */ +/* 806 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks for intersection between a circle and a rectangle. * * @function Phaser.Geom.Intersects.CircleToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Circle} circle - [description] - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Circle} circle - The circle to be checked. + * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. * - * @return {boolean} [description] + * @return {boolean} `true` if the two objects intersect, otherwise `false`. */ var CircleToRectangle = function (circle, rect) { @@ -141753,16 +149439,16 @@ module.exports = CircleToRectangle; /***/ }), -/* 770 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DistanceBetween = __webpack_require__(58); +var DistanceBetween = __webpack_require__(62); /** * Checks if two Circles intersect. @@ -141784,12 +149470,12 @@ module.exports = CircleToCircle; /***/ }), -/* 771 */ +/* 808 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141818,12 +149504,12 @@ module.exports = OffsetPoint; /***/ }), -/* 772 */ +/* 809 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141853,16 +149539,16 @@ module.exports = Offset; /***/ }), -/* 773 */ +/* 810 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Rectangle = __webpack_require__(11); /** * Returns the bounds of the Ellipse object. @@ -141893,12 +149579,12 @@ module.exports = GetBounds; /***/ }), -/* 774 */ +/* 811 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141928,12 +149614,12 @@ module.exports = Equals; /***/ }), -/* 775 */ +/* 812 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141960,16 +149646,16 @@ module.exports = CopyFrom; /***/ }), -/* 776 */ +/* 813 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(98); +var Contains = __webpack_require__(104); /** * Check to see if the Ellipse contains all four points of the given Rectangle object. @@ -141996,16 +149682,16 @@ module.exports = ContainsRect; /***/ }), -/* 777 */ +/* 814 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(98); +var Contains = __webpack_require__(104); /** * Check to see if the Ellipse contains the given Point object. @@ -142027,16 +149713,16 @@ module.exports = ContainsPoint; /***/ }), -/* 778 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(99); +var Ellipse = __webpack_require__(105); /** * Creates a new Ellipse instance based on the values contained in the given source. @@ -142057,12 +149743,12 @@ module.exports = Clone; /***/ }), -/* 779 */ +/* 816 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142091,43 +149777,43 @@ module.exports = Area; /***/ }), -/* 780 */ +/* 817 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(99); +var Ellipse = __webpack_require__(105); -Ellipse.Area = __webpack_require__(779); -Ellipse.Circumference = __webpack_require__(334); -Ellipse.CircumferencePoint = __webpack_require__(172); -Ellipse.Clone = __webpack_require__(778); -Ellipse.Contains = __webpack_require__(98); -Ellipse.ContainsPoint = __webpack_require__(777); -Ellipse.ContainsRect = __webpack_require__(776); -Ellipse.CopyFrom = __webpack_require__(775); -Ellipse.Equals = __webpack_require__(774); -Ellipse.GetBounds = __webpack_require__(773); -Ellipse.GetPoint = __webpack_require__(336); -Ellipse.GetPoints = __webpack_require__(335); -Ellipse.Offset = __webpack_require__(772); -Ellipse.OffsetPoint = __webpack_require__(771); -Ellipse.Random = __webpack_require__(203); +Ellipse.Area = __webpack_require__(816); +Ellipse.Circumference = __webpack_require__(339); +Ellipse.CircumferencePoint = __webpack_require__(184); +Ellipse.Clone = __webpack_require__(815); +Ellipse.Contains = __webpack_require__(104); +Ellipse.ContainsPoint = __webpack_require__(814); +Ellipse.ContainsRect = __webpack_require__(813); +Ellipse.CopyFrom = __webpack_require__(812); +Ellipse.Equals = __webpack_require__(811); +Ellipse.GetBounds = __webpack_require__(810); +Ellipse.GetPoint = __webpack_require__(341); +Ellipse.GetPoints = __webpack_require__(340); +Ellipse.Offset = __webpack_require__(809); +Ellipse.OffsetPoint = __webpack_require__(808); +Ellipse.Random = __webpack_require__(219); module.exports = Ellipse; /***/ }), -/* 781 */ +/* 818 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142156,12 +149842,12 @@ module.exports = OffsetPoint; /***/ }), -/* 782 */ +/* 819 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142191,16 +149877,16 @@ module.exports = Offset; /***/ }), -/* 783 */ +/* 820 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); +var Rectangle = __webpack_require__(11); /** * Returns the bounds of the Circle object. @@ -142231,12 +149917,12 @@ module.exports = GetBounds; /***/ }), -/* 784 */ +/* 821 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142265,12 +149951,12 @@ module.exports = Equals; /***/ }), -/* 785 */ +/* 822 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142297,16 +149983,16 @@ module.exports = CopyFrom; /***/ }), -/* 786 */ +/* 823 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(44); +var Contains = __webpack_require__(48); /** * Check to see if the Circle contains all four points of the given Rectangle object. @@ -142333,16 +150019,16 @@ module.exports = ContainsRect; /***/ }), -/* 787 */ +/* 824 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(44); +var Contains = __webpack_require__(48); /** * Check to see if the Circle contains the given Point object. @@ -142364,16 +150050,16 @@ module.exports = ContainsPoint; /***/ }), -/* 788 */ +/* 825 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(81); +var Circle = __webpack_require__(87); /** * Creates a new Circle instance based on the values contained in the given source. @@ -142394,12 +150080,12 @@ module.exports = Clone; /***/ }), -/* 789 */ +/* 826 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142422,49 +150108,50 @@ module.exports = Area; /***/ }), -/* 790 */ +/* 827 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(81); +var Circle = __webpack_require__(87); -Circle.Area = __webpack_require__(789); -Circle.Circumference = __webpack_require__(439); -Circle.CircumferencePoint = __webpack_require__(211); -Circle.Clone = __webpack_require__(788); -Circle.Contains = __webpack_require__(44); -Circle.ContainsPoint = __webpack_require__(787); -Circle.ContainsRect = __webpack_require__(786); -Circle.CopyFrom = __webpack_require__(785); -Circle.Equals = __webpack_require__(784); -Circle.GetBounds = __webpack_require__(783); -Circle.GetPoint = __webpack_require__(442); -Circle.GetPoints = __webpack_require__(440); -Circle.Offset = __webpack_require__(782); -Circle.OffsetPoint = __webpack_require__(781); -Circle.Random = __webpack_require__(210); +Circle.Area = __webpack_require__(826); +Circle.Circumference = __webpack_require__(475); +Circle.CircumferencePoint = __webpack_require__(228); +Circle.Clone = __webpack_require__(825); +Circle.Contains = __webpack_require__(48); +Circle.ContainsPoint = __webpack_require__(824); +Circle.ContainsRect = __webpack_require__(823); +Circle.CopyFrom = __webpack_require__(822); +Circle.Equals = __webpack_require__(821); +Circle.GetBounds = __webpack_require__(820); +Circle.GetPoint = __webpack_require__(477); +Circle.GetPoints = __webpack_require__(476); +Circle.Offset = __webpack_require__(819); +Circle.OffsetPoint = __webpack_require__(818); +Circle.Random = __webpack_require__(227); module.exports = Circle; /***/ }), -/* 791 */ +/* 828 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(303); -var PluginCache = __webpack_require__(15); +var LightsManager = __webpack_require__(310); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -142524,7 +150211,7 @@ var LightsPlugin = new Class({ if (!scene.sys.settings.isBooted) { - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); } LightsManager.call(this); @@ -142540,8 +150227,8 @@ var LightsPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); + eventEmitter.on(SceneEvents.SHUTDOWN, this.shutdown, this); + eventEmitter.on(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -142568,19 +150255,19 @@ module.exports = LightsPlugin; /***/ }), -/* 792 */ +/* 829 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var Quad = __webpack_require__(165); +var Quad = __webpack_require__(177); /** * Creates a new Quad Game Object and returns it. @@ -142618,20 +150305,20 @@ GameObjectCreator.register('quad', function (config, addToScene) /***/ }), -/* 793 */ +/* 830 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); var GetValue = __webpack_require__(4); -var Mesh = __webpack_require__(118); +var Mesh = __webpack_require__(126); /** * Creates a new Mesh Game Object and returns it. @@ -142673,16 +150360,16 @@ GameObjectCreator.register('mesh', function (config, addToScene) /***/ }), -/* 794 */ +/* 831 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Quad = __webpack_require__(165); +var Quad = __webpack_require__(177); var GameObjectFactory = __webpack_require__(5); /** @@ -142719,16 +150406,16 @@ if (true) /***/ }), -/* 795 */ +/* 832 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Mesh = __webpack_require__(118); +var Mesh = __webpack_require__(126); var GameObjectFactory = __webpack_require__(5); /** @@ -142769,12 +150456,12 @@ if (true) /***/ }), -/* 796 */ +/* 833 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142798,16 +150485,16 @@ module.exports = MeshCanvasRenderer; /***/ }), -/* 797 */ +/* 834 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -142870,7 +150557,7 @@ var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera var meshVerticesLength = vertices.length; var vertexCount = Math.floor(meshVerticesLength * 0.5); - if (pipeline.vertexCount + vertexCount >= pipeline.vertexCapacity) + if (pipeline.vertexCount + vertexCount > pipeline.vertexCapacity) { pipeline.flush(); } @@ -142895,8 +150582,8 @@ var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (camera.roundPixels) { - tx |= 0; - ty |= 0; + tx = Math.round(tx); + ty = Math.round(ty); } vertexViewF32[++vertexOffset] = tx; @@ -142916,12 +150603,12 @@ module.exports = MeshWebGLRenderer; /***/ }), -/* 798 */ +/* 835 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142930,12 +150617,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(797); + renderWebGL = __webpack_require__(834); } if (true) { - renderCanvas = __webpack_require__(796); + renderCanvas = __webpack_require__(833); } module.exports = { @@ -142947,18 +150634,18 @@ module.exports = { /***/ }), -/* 799 */ +/* 836 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(14); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var Zone = __webpack_require__(135); +var Zone = __webpack_require__(147); /** * Creates a new Zone Game Object and returns it. @@ -142986,19 +150673,19 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 800 */ +/* 837 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var TileSprite = __webpack_require__(168); +var TileSprite = __webpack_require__(180); /** * @typedef {object} TileSprite @@ -143052,19 +150739,19 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) /***/ }), -/* 801 */ +/* 838 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var Text = __webpack_require__(169); +var Text = __webpack_require__(181); /** * Creates a new Text Game Object and returns it. @@ -143139,18 +150826,18 @@ GameObjectCreator.register('text', function (config, addToScene) /***/ }), -/* 802 */ +/* 839 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(119); -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BitmapText = __webpack_require__(127); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); var GetValue = __webpack_require__(4); @@ -143192,20 +150879,20 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) /***/ }), -/* 803 */ +/* 840 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var BuildGameObjectAnimation = __webpack_require__(339); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var BuildGameObjectAnimation = __webpack_require__(345); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var Sprite = __webpack_require__(57); +var Sprite = __webpack_require__(61); /** * @typedef {object} SpriteConfig @@ -143253,19 +150940,19 @@ GameObjectCreator.register('sprite', function (config, addToScene) /***/ }), -/* 804 */ +/* 841 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var RenderTexture = __webpack_require__(170); +var RenderTexture = __webpack_require__(182); /** * @typedef {object} RenderTextureConfig @@ -143312,19 +150999,19 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) /***/ }), -/* 805 */ +/* 842 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(14); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); var GetFastValue = __webpack_require__(1); -var ParticleEmitterManager = __webpack_require__(171); +var ParticleEmitterManager = __webpack_require__(183); /** * Creates a new Particle Emitter Manager Game Object and returns it. @@ -143369,19 +151056,19 @@ GameObjectCreator.register('particles', function (config, addToScene) /***/ }), -/* 806 */ +/* 843 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); -var Image = __webpack_require__(78); +var Image = __webpack_require__(83); /** * Creates a new Image Game Object and returns it. @@ -143419,17 +151106,17 @@ GameObjectCreator.register('image', function (config, addToScene) /***/ }), -/* 807 */ +/* 844 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(14); -var Group = __webpack_require__(97); +var GameObjectCreator = __webpack_require__(15); +var Group = __webpack_require__(103); /** * Creates a new Group Game Object and returns it. @@ -143439,7 +151126,7 @@ var Group = __webpack_require__(97); * @method Phaser.GameObjects.GameObjectCreator#group * @since 3.0.0 * - * @param {GroupConfig} config - The configuration object this Game Object will use to create itself. + * @param {GroupConfig|GroupCreateConfig} config - The configuration object this Game Object will use to create itself. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ @@ -143452,17 +151139,17 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 808 */ +/* 845 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(14); -var Graphics = __webpack_require__(174); +var GameObjectCreator = __webpack_require__(15); +var Graphics = __webpack_require__(186); /** * Creates a new Graphics Game Object and returns it. @@ -143500,18 +151187,18 @@ GameObjectCreator.register('graphics', function (config, addToScene) /***/ }), -/* 809 */ +/* 846 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(175); -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var BitmapText = __webpack_require__(187); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); /** @@ -143560,19 +151247,19 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) /***/ }), -/* 810 */ +/* 847 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(32); -var Container = __webpack_require__(176); -var GameObjectCreator = __webpack_require__(14); +var BuildGameObject = __webpack_require__(34); +var Container = __webpack_require__(188); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); /** @@ -143609,18 +151296,18 @@ GameObjectCreator.register('container', function (config, addToScene) /***/ }), -/* 811 */ +/* 848 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Blitter = __webpack_require__(177); -var BuildGameObject = __webpack_require__(32); -var GameObjectCreator = __webpack_require__(14); +var Blitter = __webpack_require__(189); +var BuildGameObject = __webpack_require__(34); +var GameObjectCreator = __webpack_require__(15); var GetAdvancedValue = __webpack_require__(13); /** @@ -143659,17 +151346,17 @@ GameObjectCreator.register('blitter', function (config, addToScene) /***/ }), -/* 812 */ +/* 849 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Triangle = __webpack_require__(307); +var Triangle = __webpack_require__(314); /** * Creates a new Triangle Shape Game Object and adds it to the Scene. @@ -143710,16 +151397,16 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f /***/ }), -/* 813 */ +/* 850 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Star = __webpack_require__(308); +var Star = __webpack_require__(315); var GameObjectFactory = __webpack_require__(5); /** @@ -143762,17 +151449,17 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad /***/ }), -/* 814 */ +/* 851 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Rectangle = __webpack_require__(309); +var Rectangle = __webpack_require__(316); /** * Creates a new Rectangle Shape Game Object and adds it to the Scene. @@ -143807,17 +151494,17 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor /***/ }), -/* 815 */ +/* 852 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Polygon = __webpack_require__(314); +var Polygon = __webpack_require__(321); /** * Creates a new Polygon Shape Game Object and adds it to the Scene. @@ -143860,17 +151547,17 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp /***/ }), -/* 816 */ +/* 853 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Line = __webpack_require__(315); +var Line = __webpack_require__(322); /** * Creates a new Line Shape Game Object and adds it to the Scene. @@ -143911,17 +151598,17 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, /***/ }), -/* 817 */ +/* 854 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var IsoTriangle = __webpack_require__(316); +var IsoTriangle = __webpack_require__(323); /** * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. @@ -143964,17 +151651,17 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed /***/ }), -/* 818 */ +/* 855 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var IsoBox = __webpack_require__(317); +var IsoBox = __webpack_require__(324); /** * Creates a new IsoBox Shape Game Object and adds it to the Scene. @@ -144015,17 +151702,17 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill /***/ }), -/* 819 */ +/* 856 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Grid = __webpack_require__(318); +var Grid = __webpack_require__(325); /** * Creates a new Grid Shape Game Object and adds it to the Scene. @@ -144070,16 +151757,16 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel /***/ }), -/* 820 */ +/* 857 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(319); +var Ellipse = __webpack_require__(326); var GameObjectFactory = __webpack_require__(5); /** @@ -144122,17 +151809,17 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, /***/ }), -/* 821 */ +/* 858 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Curve = __webpack_require__(320); +var Curve = __webpack_require__(327); /** * Creates a new Curve Shape Game Object and adds it to the Scene. @@ -144172,16 +151859,16 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) /***/ }), -/* 822 */ +/* 859 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arc = __webpack_require__(321); +var Arc = __webpack_require__(328); var GameObjectFactory = __webpack_require__(5); /** @@ -144245,16 +151932,16 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph /***/ }), -/* 823 */ +/* 860 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Zone = __webpack_require__(135); +var Zone = __webpack_require__(147); var GameObjectFactory = __webpack_require__(5); /** @@ -144287,16 +151974,16 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 824 */ +/* 861 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileSprite = __webpack_require__(168); +var TileSprite = __webpack_require__(180); var GameObjectFactory = __webpack_require__(5); /** @@ -144331,16 +152018,16 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 825 */ +/* 862 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Text = __webpack_require__(169); +var Text = __webpack_require__(181); var GameObjectFactory = __webpack_require__(5); /** @@ -144396,16 +152083,16 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 826 */ +/* 863 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(119); +var BitmapText = __webpack_require__(127); var GameObjectFactory = __webpack_require__(5); /** @@ -144460,17 +152147,17 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align /***/ }), -/* 827 */ +/* 864 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Sprite = __webpack_require__(57); +var Sprite = __webpack_require__(61); /** * Creates a new Sprite Game Object and adds it to the Scene. @@ -144507,17 +152194,17 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 828 */ +/* 865 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var RenderTexture = __webpack_require__(170); +var RenderTexture = __webpack_require__(182); /** * Creates a new Render Texture Game Object and adds it to the Scene. @@ -144545,17 +152232,17 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height) /***/ }), -/* 829 */ +/* 866 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var PathFollower = __webpack_require__(324); +var PathFollower = __webpack_require__(330); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -144593,17 +152280,17 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 830 */ +/* 867 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var ParticleEmitterManager = __webpack_require__(171); +var ParticleEmitterManager = __webpack_require__(183); /** * Creates a new Particle Emitter Manager Game Object and adds it to the Scene. @@ -144639,16 +152326,16 @@ GameObjectFactory.register('particles', function (key, frame, emitters) /***/ }), -/* 831 */ +/* 868 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Image = __webpack_require__(78); +var Image = __webpack_require__(83); var GameObjectFactory = __webpack_require__(5); /** @@ -144681,16 +152368,16 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 832 */ +/* 869 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Group = __webpack_require__(97); +var Group = __webpack_require__(103); var GameObjectFactory = __webpack_require__(5); /** @@ -144702,7 +152389,7 @@ var GameObjectFactory = __webpack_require__(5); * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument. - * @param {GroupConfig} [config] - A Group Configuration object. + * @param {GroupConfig|GroupCreateConfig} [config] - A Group Configuration object. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ @@ -144713,16 +152400,16 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 833 */ +/* 870 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Graphics = __webpack_require__(174); +var Graphics = __webpack_require__(186); var GameObjectFactory = __webpack_require__(5); /** @@ -144752,16 +152439,58 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 834 */ +/* 871 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DynamicBitmapText = __webpack_require__(175); +var Extern = __webpack_require__(342); +var GameObjectFactory = __webpack_require__(5); + +/** + * Creates a new Extern Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Extern Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#extern + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Extern} The Game Object that was created. + */ +GameObjectFactory.register('extern', function () +{ + var extern = new Extern(this.scene); + + this.displayList.add(extern); + this.updateList.add(extern); + + return extern; +}); + +// 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 + + +/***/ }), +/* 872 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var DynamicBitmapText = __webpack_require__(187); var GameObjectFactory = __webpack_require__(5); /** @@ -144821,17 +152550,17 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 835 */ +/* 873 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Container = __webpack_require__(176); +var Container = __webpack_require__(188); var GameObjectFactory = __webpack_require__(5); /** @@ -144855,16 +152584,16 @@ GameObjectFactory.register('container', function (x, y, children) /***/ }), -/* 836 */ +/* 874 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Blitter = __webpack_require__(177); +var Blitter = __webpack_require__(189); var GameObjectFactory = __webpack_require__(5); /** @@ -144897,18 +152626,18 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) /***/ }), -/* 837 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -144962,6 +152691,9 @@ var TriangleCanvasRenderer = function (renderer, src, interpolationPercentage, c ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -144969,17 +152701,17 @@ module.exports = TriangleCanvasRenderer; /***/ }), -/* 838 */ +/* 876 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StrokePathWebGL = __webpack_require__(67); -var Utils = __webpack_require__(9); +var StrokePathWebGL = __webpack_require__(73); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -145072,12 +152804,12 @@ module.exports = TriangleWebGLRenderer; /***/ }), -/* 839 */ +/* 877 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145086,12 +152818,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(838); + renderWebGL = __webpack_require__(876); } if (true) { - renderCanvas = __webpack_require__(837); + renderCanvas = __webpack_require__(875); } module.exports = { @@ -145103,18 +152835,18 @@ module.exports = { /***/ }), -/* 840 */ +/* 878 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -145178,6 +152910,9 @@ var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -145185,17 +152920,17 @@ module.exports = StarCanvasRenderer; /***/ }), -/* 841 */ +/* 879 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(92); -var StrokePathWebGL = __webpack_require__(67); +var FillPathWebGL = __webpack_require__(98); +var StrokePathWebGL = __webpack_require__(73); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -145263,12 +152998,12 @@ module.exports = StarWebGLRenderer; /***/ }), -/* 842 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145277,12 +153012,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(841); + renderWebGL = __webpack_require__(879); } if (true) { - renderCanvas = __webpack_require__(840); + renderCanvas = __webpack_require__(878); } module.exports = { @@ -145294,18 +153029,18 @@ module.exports = { /***/ }), -/* 843 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -145358,6 +153093,9 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -145365,17 +153103,17 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 844 */ +/* 882 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StrokePathWebGL = __webpack_require__(67); -var Utils = __webpack_require__(9); +var StrokePathWebGL = __webpack_require__(73); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -145436,7 +153174,9 @@ var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, c fillTint.TR = fillTintColor; fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; - + + pipeline.setTexture2D(); + pipeline.batchFillRect( -dx, -dy, @@ -145455,12 +153195,12 @@ module.exports = RectangleWebGLRenderer; /***/ }), -/* 845 */ +/* 883 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145469,12 +153209,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(844); + renderWebGL = __webpack_require__(882); } if (true) { - renderCanvas = __webpack_require__(843); + renderCanvas = __webpack_require__(881); } module.exports = { @@ -145486,18 +153226,18 @@ module.exports = { /***/ }), -/* 846 */ +/* 884 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -145561,6 +153301,9 @@ var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -145568,17 +153311,17 @@ module.exports = PolygonCanvasRenderer; /***/ }), -/* 847 */ +/* 885 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(92); -var StrokePathWebGL = __webpack_require__(67); +var FillPathWebGL = __webpack_require__(98); +var StrokePathWebGL = __webpack_require__(73); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -145646,12 +153389,12 @@ module.exports = PolygonWebGLRenderer; /***/ }), -/* 848 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145660,12 +153403,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(847); + renderWebGL = __webpack_require__(885); } if (true) { - renderCanvas = __webpack_require__(846); + renderCanvas = __webpack_require__(884); } module.exports = { @@ -145677,17 +153420,17 @@ module.exports = { /***/ }), -/* 849 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -145724,6 +153467,9 @@ var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -145731,16 +153477,16 @@ module.exports = LineCanvasRenderer; /***/ }), -/* 850 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -145824,12 +153570,12 @@ module.exports = LineWebGLRenderer; /***/ }), -/* 851 */ +/* 889 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -145838,12 +153584,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(850); + renderWebGL = __webpack_require__(888); } if (true) { - renderCanvas = __webpack_require__(849); + renderCanvas = __webpack_require__(887); } module.exports = { @@ -145855,17 +153601,17 @@ module.exports = { /***/ }), -/* 852 */ +/* 890 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -145959,6 +153705,9 @@ var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage ctx.fill(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -145966,16 +153715,16 @@ module.exports = IsoTriangleCanvasRenderer; /***/ }), -/* 853 */ +/* 891 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -146143,12 +153892,12 @@ module.exports = IsoTriangleWebGLRenderer; /***/ }), -/* 854 */ +/* 892 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -146157,12 +153906,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(853); + renderWebGL = __webpack_require__(891); } if (true) { - renderCanvas = __webpack_require__(852); + renderCanvas = __webpack_require__(890); } module.exports = { @@ -146174,17 +153923,17 @@ module.exports = { /***/ }), -/* 855 */ +/* 893 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -146265,6 +154014,9 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam ctx.fill(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -146272,16 +154024,16 @@ module.exports = IsoBoxCanvasRenderer; /***/ }), -/* 856 */ +/* 894 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -146430,12 +154182,12 @@ module.exports = IsoBoxWebGLRenderer; /***/ }), -/* 857 */ +/* 895 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -146444,12 +154196,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(856); + renderWebGL = __webpack_require__(894); } if (true) { - renderCanvas = __webpack_require__(855); + renderCanvas = __webpack_require__(893); } module.exports = { @@ -146461,18 +154213,18 @@ module.exports = { /***/ }), -/* 858 */ +/* 896 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -146525,6 +154277,9 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -146532,16 +154287,16 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 859 */ +/* 897 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -146758,12 +154513,12 @@ module.exports = GridWebGLRenderer; /***/ }), -/* 860 */ +/* 898 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -146772,12 +154527,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(859); + renderWebGL = __webpack_require__(897); } if (true) { - renderCanvas = __webpack_require__(858); + renderCanvas = __webpack_require__(896); } module.exports = { @@ -146789,18 +154544,18 @@ module.exports = { /***/ }), -/* 861 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -146864,6 +154619,9 @@ var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -146871,17 +154629,17 @@ module.exports = EllipseCanvasRenderer; /***/ }), -/* 862 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(92); -var StrokePathWebGL = __webpack_require__(67); +var FillPathWebGL = __webpack_require__(98); +var StrokePathWebGL = __webpack_require__(73); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -146949,12 +154707,12 @@ module.exports = EllipseWebGLRenderer; /***/ }), -/* 863 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -146963,12 +154721,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(862); + renderWebGL = __webpack_require__(900); } if (true) { - renderCanvas = __webpack_require__(861); + renderCanvas = __webpack_require__(899); } module.exports = { @@ -146980,18 +154738,18 @@ module.exports = { /***/ }), -/* 864 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -147058,6 +154816,9 @@ var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, came ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -147065,17 +154826,17 @@ module.exports = CurveCanvasRenderer; /***/ }), -/* 865 */ +/* 903 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(92); -var StrokePathWebGL = __webpack_require__(67); +var FillPathWebGL = __webpack_require__(98); +var StrokePathWebGL = __webpack_require__(73); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -147143,12 +154904,12 @@ module.exports = CurveWebGLRenderer; /***/ }), -/* 866 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147157,12 +154918,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(865); + renderWebGL = __webpack_require__(903); } if (true) { - renderCanvas = __webpack_require__(864); + renderCanvas = __webpack_require__(902); } module.exports = { @@ -147174,19 +154935,19 @@ module.exports = { /***/ }), -/* 867 */ +/* 905 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DegToRad = __webpack_require__(36); -var FillStyleCanvas = __webpack_require__(35); -var LineStyleCanvas = __webpack_require__(40); -var SetTransform = __webpack_require__(23); +var DegToRad = __webpack_require__(39); +var FillStyleCanvas = __webpack_require__(38); +var LineStyleCanvas = __webpack_require__(43); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -147240,6 +155001,9 @@ var ArcCanvasRenderer = function (renderer, src, interpolationPercentage, camera ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -147247,17 +155011,17 @@ module.exports = ArcCanvasRenderer; /***/ }), -/* 868 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(92); -var StrokePathWebGL = __webpack_require__(67); +var FillPathWebGL = __webpack_require__(98); +var StrokePathWebGL = __webpack_require__(73); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -147325,12 +155089,12 @@ module.exports = ArcWebGLRenderer; /***/ }), -/* 869 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147339,12 +155103,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(868); + renderWebGL = __webpack_require__(906); } if (true) { - renderCanvas = __webpack_require__(867); + renderCanvas = __webpack_require__(905); } module.exports = { @@ -147356,12 +155120,12 @@ module.exports = { /***/ }), -/* 870 */ +/* 908 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147391,16 +155155,16 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 871 */ +/* 909 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -147451,12 +155215,12 @@ module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 872 */ +/* 910 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147465,12 +155229,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(871); + renderWebGL = __webpack_require__(909); } if (true) { - renderCanvas = __webpack_require__(870); + renderCanvas = __webpack_require__(908); } module.exports = { @@ -147482,12 +155246,12 @@ module.exports = { /***/ }), -/* 873 */ +/* 911 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -147499,7 +155263,7 @@ var CanvasPool = __webpack_require__(26); * @function Phaser.GameObjects.Text.MeasureText * @since 3.0.0 * - * @param {Phaser.GameObjects.Text.TextStyle} textStyle - The TextStyle object to measure. + * @param {Phaser.GameObjects.TextStyle} textStyle - The TextStyle object to measure. * * @return {object} An object containing the ascent, descent and fontSize of the TextStyle. */ @@ -147617,19 +155381,19 @@ module.exports = MeasureText; /***/ }), -/* 874 */ +/* 912 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(13); var GetValue = __webpack_require__(4); -var MeasureText = __webpack_require__(873); +var MeasureText = __webpack_require__(911); // Key: [ Object Key, Default Value ] @@ -147685,10 +155449,14 @@ var propertyMap = { /** * @classdesc - * Style settings for a Text object. + * A TextStyle class manages all of the style settings for a Text object. + * + * Text Game Objects create a TextStyle instance automatically, which is + * accessed via the `Text.style` property. You do not normally need to + * instantiate one yourself. * * @class TextStyle - * @memberof Phaser.GameObjects.Text + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -147704,7 +155472,7 @@ var TextStyle = new Class({ /** * The Text object that this TextStyle is styling. * - * @name Phaser.GameObjects.Text.TextStyle#parent + * @name Phaser.GameObjects.TextStyle#parent * @type {Phaser.GameObjects.Text} * @since 3.0.0 */ @@ -147713,7 +155481,7 @@ var TextStyle = new Class({ /** * The font family. * - * @name Phaser.GameObjects.Text.TextStyle#fontFamily + * @name Phaser.GameObjects.TextStyle#fontFamily * @type {string} * @default 'Courier' * @since 3.0.0 @@ -147723,7 +155491,7 @@ var TextStyle = new Class({ /** * The font size. * - * @name Phaser.GameObjects.Text.TextStyle#fontSize + * @name Phaser.GameObjects.TextStyle#fontSize * @type {string} * @default '16px' * @since 3.0.0 @@ -147733,7 +155501,7 @@ var TextStyle = new Class({ /** * The font style. * - * @name Phaser.GameObjects.Text.TextStyle#fontStyle + * @name Phaser.GameObjects.TextStyle#fontStyle * @type {string} * @since 3.0.0 */ @@ -147742,7 +155510,7 @@ var TextStyle = new Class({ /** * The background color. * - * @name Phaser.GameObjects.Text.TextStyle#backgroundColor + * @name Phaser.GameObjects.TextStyle#backgroundColor * @type {string} * @since 3.0.0 */ @@ -147751,7 +155519,7 @@ var TextStyle = new Class({ /** * The text fill color. * - * @name Phaser.GameObjects.Text.TextStyle#color + * @name Phaser.GameObjects.TextStyle#color * @type {string} * @default '#fff' * @since 3.0.0 @@ -147761,7 +155529,7 @@ var TextStyle = new Class({ /** * The text stroke color. * - * @name Phaser.GameObjects.Text.TextStyle#stroke + * @name Phaser.GameObjects.TextStyle#stroke * @type {string} * @default '#fff' * @since 3.0.0 @@ -147771,7 +155539,7 @@ var TextStyle = new Class({ /** * The text stroke thickness. * - * @name Phaser.GameObjects.Text.TextStyle#strokeThickness + * @name Phaser.GameObjects.TextStyle#strokeThickness * @type {number} * @default 0 * @since 3.0.0 @@ -147781,7 +155549,7 @@ var TextStyle = new Class({ /** * The horizontal shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetX + * @name Phaser.GameObjects.TextStyle#shadowOffsetX * @type {number} * @default 0 * @since 3.0.0 @@ -147791,7 +155559,7 @@ var TextStyle = new Class({ /** * The vertical shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetY + * @name Phaser.GameObjects.TextStyle#shadowOffsetY * @type {number} * @default 0 * @since 3.0.0 @@ -147801,7 +155569,7 @@ var TextStyle = new Class({ /** * The shadow color. * - * @name Phaser.GameObjects.Text.TextStyle#shadowColor + * @name Phaser.GameObjects.TextStyle#shadowColor * @type {string} * @default '#000' * @since 3.0.0 @@ -147811,7 +155579,7 @@ var TextStyle = new Class({ /** * The shadow blur radius. * - * @name Phaser.GameObjects.Text.TextStyle#shadowBlur + * @name Phaser.GameObjects.TextStyle#shadowBlur * @type {number} * @default 0 * @since 3.0.0 @@ -147821,7 +155589,7 @@ var TextStyle = new Class({ /** * Whether shadow stroke is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowStroke + * @name Phaser.GameObjects.TextStyle#shadowStroke * @type {boolean} * @default false * @since 3.0.0 @@ -147831,7 +155599,7 @@ var TextStyle = new Class({ /** * Whether shadow fill is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowFill + * @name Phaser.GameObjects.TextStyle#shadowFill * @type {boolean} * @default false * @since 3.0.0 @@ -147841,7 +155609,7 @@ var TextStyle = new Class({ /** * The text alignment. * - * @name Phaser.GameObjects.Text.TextStyle#align + * @name Phaser.GameObjects.TextStyle#align * @type {string} * @default 'left' * @since 3.0.0 @@ -147851,7 +155619,7 @@ var TextStyle = new Class({ /** * The maximum number of lines to draw. * - * @name Phaser.GameObjects.Text.TextStyle#maxLines + * @name Phaser.GameObjects.TextStyle#maxLines * @type {integer} * @default 0 * @since 3.0.0 @@ -147863,7 +155631,7 @@ var TextStyle = new Class({ * * `0` means no fixed with. * - * @name Phaser.GameObjects.Text.TextStyle#fixedWidth + * @name Phaser.GameObjects.TextStyle#fixedWidth * @type {number} * @default 0 * @since 3.0.0 @@ -147875,7 +155643,7 @@ var TextStyle = new Class({ * * `0` means no fixed height. * - * @name Phaser.GameObjects.Text.TextStyle#fixedHeight + * @name Phaser.GameObjects.TextStyle#fixedHeight * @type {number} * @default 0 * @since 3.0.0 @@ -147886,7 +155654,7 @@ var TextStyle = new Class({ * The resolution the text is rendered to its internal canvas at. * The default is 0, which means it will use the resolution set in the Game Config. * - * @name Phaser.GameObjects.Text.TextStyle#resolution + * @name Phaser.GameObjects.TextStyle#resolution * @type {number} * @default 0 * @since 3.12.0 @@ -147896,7 +155664,7 @@ var TextStyle = new Class({ /** * Whether the text should render right to left. * - * @name Phaser.GameObjects.Text.TextStyle#rtl + * @name Phaser.GameObjects.TextStyle#rtl * @type {boolean} * @default false * @since 3.0.0 @@ -147906,7 +155674,7 @@ var TextStyle = new Class({ /** * The test string to use when measuring the font. * - * @name Phaser.GameObjects.Text.TextStyle#testString + * @name Phaser.GameObjects.TextStyle#testString * @type {string} * @default '|MÉqgy' * @since 3.0.0 @@ -147916,7 +155684,7 @@ var TextStyle = new Class({ /** * The amount of horizontal padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineX + * @name Phaser.GameObjects.TextStyle#baselineX * @type {number} * @default 1.2 * @since 3.3.0 @@ -147926,7 +155694,7 @@ var TextStyle = new Class({ /** * The amount of vertical padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineY + * @name Phaser.GameObjects.TextStyle#baselineY * @type {number} * @default 1.4 * @since 3.3.0 @@ -147936,7 +155704,7 @@ var TextStyle = new Class({ /** * The font style, size and family. * - * @name Phaser.GameObjects.Text.TextStyle#_font + * @name Phaser.GameObjects.TextStyle#_font * @type {string} * @private * @since 3.0.0 @@ -147976,7 +155744,7 @@ var TextStyle = new Class({ * backgroundColor: '#ff00ff' * }); * - * @method Phaser.GameObjects.Text.TextStyle#setStyle + * @method Phaser.GameObjects.TextStyle#setStyle * @since 3.0.0 * * @param {object} style - The style settings to set. @@ -148014,15 +155782,13 @@ var TextStyle = new Class({ // Allow for 'font' override var font = GetValue(style, 'font', null); - if (font === null) + if (font !== null) { - this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); - } - else - { - this._font = font; + this.setFont(font, false); } + this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); + // Allow for 'fill' to be used in place of 'color' var fill = GetValue(style, 'fill', null); @@ -148044,7 +155810,7 @@ var TextStyle = new Class({ /** * Synchronize the font settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncFont + * @method Phaser.GameObjects.TextStyle#syncFont * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -148058,7 +155824,7 @@ var TextStyle = new Class({ /** * Synchronize the text style settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncStyle + * @method Phaser.GameObjects.TextStyle#syncStyle * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -148079,7 +155845,7 @@ var TextStyle = new Class({ /** * Synchronize the shadow settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncShadow + * @method Phaser.GameObjects.TextStyle#syncShadow * @since 3.0.0 * * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. @@ -148106,7 +155872,7 @@ var TextStyle = new Class({ /** * Update the style settings for the parent Text object. * - * @method Phaser.GameObjects.Text.TextStyle#update + * @method Phaser.GameObjects.TextStyle#update * @since 3.0.0 * * @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics. @@ -148133,15 +155899,18 @@ var TextStyle = new Class({ * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. * - * @method Phaser.GameObjects.Text.TextStyle#setFont + * @method Phaser.GameObjects.TextStyle#setFont * @since 3.0.0 * * @param {(string|object)} font - The font family or font settings to set. + * @param {boolean} [updateText=true] - Whether to update the text immediately. * * @return {Phaser.GameObjects.Text} The parent Text object. */ - setFont: function (font) + setFont: function (font, updateText) { + if (updateText === undefined) { updateText = true; } + var fontFamily = font; var fontSize = ''; var fontStyle = ''; @@ -148152,14 +155921,27 @@ var TextStyle = new Class({ fontSize = GetValue(font, 'fontSize', '16px'); fontStyle = GetValue(font, 'fontStyle', ''); } + else + { + var fontSplit = font.split(' '); + + var i = 0; + + fontStyle = (fontSplit.length > 2) ? fontSplit[i++] : ''; + fontSize = fontSplit[i++] || '16px'; + fontFamily = fontSplit[i++] || 'Courier'; + } if (fontFamily !== this.fontFamily || fontSize !== this.fontSize || fontStyle !== this.fontStyle) { this.fontFamily = fontFamily; this.fontSize = fontSize; this.fontStyle = fontStyle; - - this.update(true); + + if (updateText) + { + this.update(true); + } } return this.parent; @@ -148168,7 +155950,7 @@ var TextStyle = new Class({ /** * Set the font family. * - * @method Phaser.GameObjects.Text.TextStyle#setFontFamily + * @method Phaser.GameObjects.TextStyle#setFontFamily * @since 3.0.0 * * @param {string} family - The font family. @@ -148190,7 +155972,7 @@ var TextStyle = new Class({ /** * Set the font style. * - * @method Phaser.GameObjects.Text.TextStyle#setFontStyle + * @method Phaser.GameObjects.TextStyle#setFontStyle * @since 3.0.0 * * @param {string} style - The font style. @@ -148212,7 +155994,7 @@ var TextStyle = new Class({ /** * Set the font size. * - * @method Phaser.GameObjects.Text.TextStyle#setFontSize + * @method Phaser.GameObjects.TextStyle#setFontSize * @since 3.0.0 * * @param {(number|string)} size - The font size. @@ -148239,7 +156021,7 @@ var TextStyle = new Class({ /** * Set the test string to use when measuring the font. * - * @method Phaser.GameObjects.Text.TextStyle#setTestString + * @method Phaser.GameObjects.TextStyle#setTestString * @since 3.0.0 * * @param {string} string - The test string to use when measuring the font. @@ -148258,7 +156040,7 @@ var TextStyle = new Class({ * * Pass in `0` for either of these parameters to disable fixed width or height respectively. * - * @method Phaser.GameObjects.Text.TextStyle#setFixedSize + * @method Phaser.GameObjects.TextStyle#setFixedSize * @since 3.0.0 * * @param {number} width - The fixed width to set. @@ -148287,7 +156069,7 @@ var TextStyle = new Class({ /** * Set the background color. * - * @method Phaser.GameObjects.Text.TextStyle#setBackgroundColor + * @method Phaser.GameObjects.TextStyle#setBackgroundColor * @since 3.0.0 * * @param {string} color - The background color. @@ -148304,7 +156086,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setFill + * @method Phaser.GameObjects.TextStyle#setFill * @since 3.0.0 * * @param {string} color - The text fill color. @@ -148321,7 +156103,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setColor + * @method Phaser.GameObjects.TextStyle#setColor * @since 3.0.0 * * @param {string} color - The text fill color. @@ -148344,7 +156126,7 @@ var TextStyle = new Class({ * * Please use with caution, as the more high res Text you have, the more memory it uses up. * - * @method Phaser.GameObjects.Text.TextStyle#setResolution + * @method Phaser.GameObjects.TextStyle#setResolution * @since 3.12.0 * * @param {number} value - The resolution for this Text object to use. @@ -148361,7 +156143,7 @@ var TextStyle = new Class({ /** * Set the stroke settings. * - * @method Phaser.GameObjects.Text.TextStyle#setStroke + * @method Phaser.GameObjects.TextStyle#setStroke * @since 3.0.0 * * @param {string} color - The stroke color. @@ -148397,7 +156179,7 @@ var TextStyle = new Class({ * Calling this method always re-measures the parent Text object, * so only call it when you actually change the shadow settings. * - * @method Phaser.GameObjects.Text.TextStyle#setShadow + * @method Phaser.GameObjects.TextStyle#setShadow * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -148431,7 +156213,7 @@ var TextStyle = new Class({ /** * Set the shadow offset. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowOffset + * @method Phaser.GameObjects.TextStyle#setShadowOffset * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -148453,7 +156235,7 @@ var TextStyle = new Class({ /** * Set the shadow color. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowColor + * @method Phaser.GameObjects.TextStyle#setShadowColor * @since 3.0.0 * * @param {string} [color='#000'] - The shadow color. @@ -148472,7 +156254,7 @@ var TextStyle = new Class({ /** * Set the shadow blur radius. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowBlur + * @method Phaser.GameObjects.TextStyle#setShadowBlur * @since 3.0.0 * * @param {number} [blur=0] - The shadow blur radius. @@ -148491,7 +156273,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow stroke. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowStroke + * @method Phaser.GameObjects.TextStyle#setShadowStroke * @since 3.0.0 * * @param {boolean} enabled - Whether shadow stroke is enabled or not. @@ -148508,7 +156290,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow fill. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowFill + * @method Phaser.GameObjects.TextStyle#setShadowFill * @since 3.0.0 * * @param {boolean} enabled - Whether shadow fill is enabled or not. @@ -148527,7 +156309,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by width. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapWidth + * @method Phaser.GameObjects.TextStyle#setWordWrapWidth * @since 3.0.0 * * @param {number} width - The maximum width of a line in pixels. Set to null to remove wrapping. @@ -148552,7 +156334,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by callback. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapCallback + * @method Phaser.GameObjects.TextStyle#setWordWrapCallback * @since 3.0.0 * * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the @@ -148578,7 +156360,7 @@ var TextStyle = new Class({ * * Expects values like `'left'`, `'right'`, `'center'` or `'justified'`. * - * @method Phaser.GameObjects.Text.TextStyle#setAlign + * @method Phaser.GameObjects.TextStyle#setAlign * @since 3.0.0 * * @param {string} align - The text alignment. @@ -148597,7 +156379,7 @@ var TextStyle = new Class({ /** * Set the maximum number of lines to draw. * - * @method Phaser.GameObjects.Text.TextStyle#setMaxLines + * @method Phaser.GameObjects.TextStyle#setMaxLines * @since 3.0.0 * * @param {integer} [max=0] - The maximum number of lines to draw. @@ -148616,7 +156398,7 @@ var TextStyle = new Class({ /** * Get the current text metrics. * - * @method Phaser.GameObjects.Text.TextStyle#getTextMetrics + * @method Phaser.GameObjects.TextStyle#getTextMetrics * @since 3.0.0 * * @return {BitmapTextMetrics} The text metrics. @@ -148635,7 +156417,7 @@ var TextStyle = new Class({ /** * Build a JSON representation of this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#toJSON + * @method Phaser.GameObjects.TextStyle#toJSON * @since 3.0.0 * * @return {object} A JSON representation of this Text Style. @@ -148657,7 +156439,7 @@ var TextStyle = new Class({ /** * Destroy this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#destroy + * @method Phaser.GameObjects.TextStyle#destroy * @since 3.0.0 */ destroy: function () @@ -148671,12 +156453,12 @@ module.exports = TextStyle; /***/ }), -/* 875 */ +/* 913 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -148707,16 +156489,16 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 876 */ +/* 914 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -148772,12 +156554,12 @@ module.exports = TextWebGLRenderer; /***/ }), -/* 877 */ +/* 915 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -148786,12 +156568,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(876); + renderWebGL = __webpack_require__(914); } if (true) { - renderCanvas = __webpack_require__(875); + renderCanvas = __webpack_require__(913); } module.exports = { @@ -148803,12 +156585,12 @@ module.exports = { /***/ }), -/* 878 */ +/* 916 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -148885,12 +156667,12 @@ module.exports = GetTextSize; /***/ }), -/* 879 */ +/* 917 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149001,12 +156783,12 @@ module.exports = ParseRetroFont; /***/ }), -/* 880 */ +/* 918 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149117,16 +156899,16 @@ module.exports = RETRO_FONT_CONST; /***/ }), -/* 881 */ +/* 919 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RETRO_FONT_CONST = __webpack_require__(880); +var RETRO_FONT_CONST = __webpack_require__(918); var Extend = __webpack_require__(21); /** @@ -149149,7 +156931,7 @@ var Extend = __webpack_require__(21); * @since 3.6.0 */ -var RetroFont = { Parse: __webpack_require__(879) }; +var RetroFont = { Parse: __webpack_require__(917) }; // Merge in the consts RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); @@ -149158,12 +156940,12 @@ module.exports = RetroFont; /***/ }), -/* 882 */ +/* 920 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149191,16 +156973,16 @@ module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 883 */ +/* 921 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -149254,12 +157036,12 @@ module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 884 */ +/* 922 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149268,12 +157050,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(883); + renderWebGL = __webpack_require__(921); } if (true) { - renderCanvas = __webpack_require__(882); + renderCanvas = __webpack_require__(920); } module.exports = { @@ -149285,12 +157067,12 @@ module.exports = { /***/ }), -/* 885 */ +/* 923 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149300,20 +157082,20 @@ module.exports = { module.exports = { - DeathZone: __webpack_require__(329), - EdgeZone: __webpack_require__(328), - RandomZone: __webpack_require__(325) + DeathZone: __webpack_require__(334), + EdgeZone: __webpack_require__(333), + RandomZone: __webpack_require__(331) }; /***/ }), -/* 886 */ +/* 924 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149412,8 +157194,8 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol if (roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); @@ -149429,16 +157211,16 @@ module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 887 */ +/* 925 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -149552,25 +157334,22 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola if (roundPixels) { - tx0 |= 0; - ty0 |= 0; - - tx1 |= 0; - ty1 |= 0; - - tx2 |= 0; - ty2 |= 0; - - tx3 |= 0; - ty3 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); + + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); + + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); + + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } var tint = getTint(particle.tint, alpha); - if (pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect)) - { - pipeline.setTexture2D(texture, 0); - } + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, 0); } } }; @@ -149579,12 +157358,12 @@ module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 888 */ +/* 926 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -149593,12 +157372,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(887); + renderWebGL = __webpack_require__(925); } if (true) { - renderCanvas = __webpack_require__(886); + renderCanvas = __webpack_require__(924); } module.exports = { @@ -149610,20 +157389,20 @@ module.exports = { /***/ }), -/* 889 */ +/* 927 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(327); -var GetEaseFunction = __webpack_require__(95); +var FloatBetween = __webpack_require__(412); +var GetEaseFunction = __webpack_require__(101); var GetFastValue = __webpack_require__(1); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(63); /** * The returned value sets what the property will be at the START of the particle's life, on emit. @@ -149693,14 +157472,14 @@ var Wrap = __webpack_require__(59); /** * @typedef {object} EmitterOpCustomEmitConfig * - * @property {EmitterOpOnEmitCallback} onEmit - [description] + * @property {EmitterOpOnEmitCallback} onEmit - A callback that is invoked each time the emitter emits a particle. */ /** * @typedef {object} EmitterOpCustomUpdateConfig * - * @property {EmitterOpOnEmitCallback} [onEmit] - [description] - * @property {EmitterOpOnUpdateCallback} onUpdate - [description] + * @property {EmitterOpOnEmitCallback} [onEmit] - A callback that is invoked each time the emitter emits a particle. + * @property {EmitterOpOnUpdateCallback} onUpdate - A callback that is invoked each time the emitter updates. */ /** @@ -150279,12 +158058,12 @@ module.exports = EmitterOp; /***/ }), -/* 890 */ +/* 928 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150294,22 +158073,22 @@ module.exports = EmitterOp; module.exports = { - GravityWell: __webpack_require__(332), - Particle: __webpack_require__(331), - ParticleEmitter: __webpack_require__(330), - ParticleEmitterManager: __webpack_require__(171), - Zones: __webpack_require__(885) + GravityWell: __webpack_require__(337), + Particle: __webpack_require__(336), + ParticleEmitter: __webpack_require__(335), + ParticleEmitterManager: __webpack_require__(183), + Zones: __webpack_require__(923) }; /***/ }), -/* 891 */ +/* 929 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150337,12 +158116,12 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 892 */ +/* 930 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150370,12 +158149,12 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 893 */ +/* 931 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150384,12 +158163,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(892); + renderWebGL = __webpack_require__(930); } if (true) { - renderCanvas = __webpack_require__(891); + renderCanvas = __webpack_require__(929); } module.exports = { @@ -150401,12 +158180,12 @@ module.exports = { /***/ }), -/* 894 */ +/* 932 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150434,12 +158213,12 @@ module.exports = SpriteCanvasRenderer; /***/ }), -/* 895 */ +/* 933 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150467,12 +158246,12 @@ module.exports = SpriteWebGLRenderer; /***/ }), -/* 896 */ +/* 934 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150481,12 +158260,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(895); + renderWebGL = __webpack_require__(933); } if (true) { - renderCanvas = __webpack_require__(894); + renderCanvas = __webpack_require__(932); } module.exports = { @@ -150498,17 +158277,17 @@ module.exports = { /***/ }), -/* 897 */ +/* 935 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Commands = __webpack_require__(173); -var Utils = __webpack_require__(9); +var Commands = __webpack_require__(185); +var Utils = __webpack_require__(10); // TODO: Remove the use of this var Point = function (x, y, width) @@ -150550,12 +158329,12 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca return; } - var pipeline = this.pipeline; + var pipeline = renderer.currentPipeline; var camMatrix = pipeline._tempMatrix1; var graphicsMatrix = pipeline._tempMatrix2; var currentMatrix = pipeline._tempMatrix4; - + renderer.setPipeline(pipeline); currentMatrix.loadIdentity(); @@ -150863,12 +158642,12 @@ module.exports = GraphicsWebGLRenderer; /***/ }), -/* 898 */ +/* 936 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150877,15 +158656,15 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(897); + renderWebGL = __webpack_require__(935); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(333); + renderCanvas = __webpack_require__(338); } if (true) { - renderCanvas = __webpack_require__(333); + renderCanvas = __webpack_require__(338); } module.exports = { @@ -150897,16 +158676,122 @@ module.exports = { /***/ }), -/* 899 */ +/* 937 */ +/***/ (function(module, exports) { + + + +/***/ }), +/* 938 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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.Extern#renderWebGL + * @since 3.16.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Extern} 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. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +{ + var pipeline = renderer.currentPipeline; + + renderer.clearPipeline(); + + var camMatrix = renderer._tempMatrix1; + var spriteMatrix = renderer._tempMatrix2; + var calcMatrix = renderer._tempMatrix3; + + spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = src.x; + spriteMatrix.f = src.y; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + else + { + spriteMatrix.e -= camera.scrollX * src.scrollFactorX; + spriteMatrix.f -= camera.scrollY * src.scrollFactorY; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + + // Callback + src.render.call(src, renderer, camera, calcMatrix); + + renderer.rebindPipeline(pipeline); +}; + +module.exports = ExternWebGLRenderer; + + +/***/ }), +/* 939 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTransform = __webpack_require__(23); +var renderWebGL = __webpack_require__(2); +var renderCanvas = __webpack_require__(2); + +if (true) +{ + renderWebGL = __webpack_require__(938); +} + +if (true) +{ + renderCanvas = __webpack_require__(937); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 940 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -150938,6 +158823,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc var textureFrame = src.frame; var displayCallback = src.displayCallback; + var callbackData = src.callbackData; var cameraScrollX = camera.scrollX * src.scrollFactorX; var cameraScrollY = camera.scrollY * src.scrollFactorY; @@ -150963,7 +158849,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc var lastGlyph = null; var lastCharCode = 0; - // var ctx = renderer.currentContext; var image = src.frame.source.image; var textureX = textureFrame.cutX; @@ -150974,7 +158859,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (src.cropWidth > 0 && src.cropHeight > 0) { - ctx.save(); ctx.beginPath(); ctx.rect(0, 0, src.cropWidth, src.cropHeight); ctx.clip(); @@ -151023,7 +158907,15 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (displayCallback) { - var output = displayCallback({ tint: { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }, index: index, charCode: charCode, x: x, y: y, scale: scale, rotation: 0, data: glyph.data }); + callbackData.index = index; + callbackData.charCode = charCode; + callbackData.x = x; + callbackData.y = y; + callbackData.scale = scale; + callbackData.rotation = rotation; + callbackData.data = glyph.data; + + var output = displayCallback(callbackData); x = output.x; y = output.y; @@ -151039,8 +158931,8 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (camera.roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.save(); @@ -151061,11 +158953,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc lastCharCode = charCode; } - if (src.cropWidth > 0 && src.cropHeight > 0) - { - ctx.restore(); - } - + // Restore the context saved in SetTransform ctx.restore(); }; @@ -151073,16 +158961,16 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 900 */ +/* 941 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -151351,20 +159239,20 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); } if (crop) @@ -151379,12 +159267,12 @@ module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 901 */ +/* 942 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151393,12 +159281,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(900); + renderWebGL = __webpack_require__(941); } if (true) { - renderCanvas = __webpack_require__(899); + renderCanvas = __webpack_require__(940); } module.exports = { @@ -151410,13 +159298,13 @@ module.exports = { /***/ }), -/* 902 */ +/* 943 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151508,13 +159396,13 @@ module.exports = ContainerCanvasRenderer; /***/ }), -/* 903 */ +/* 944 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151605,13 +159493,13 @@ module.exports = ContainerWebGLRenderer; /***/ }), -/* 904 */ +/* 945 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151620,12 +159508,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(903); + renderWebGL = __webpack_require__(944); } if (true) { - renderCanvas = __webpack_require__(902); + renderCanvas = __webpack_require__(943); } module.exports = { @@ -151637,12 +159525,12 @@ module.exports = { /***/ }), -/* 905 */ +/* 946 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151665,7 +159553,7 @@ var Class = __webpack_require__(0); * handled via the Blitter parent. * * @class Bob - * @memberof Phaser.GameObjects.Blitter + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -151684,7 +159572,7 @@ var Bob = new Class({ /** * The Blitter object that this Bob belongs to. * - * @name Phaser.GameObjects.Blitter.Bob#parent + * @name Phaser.GameObjects.Bob#parent * @type {Phaser.GameObjects.Blitter} * @since 3.0.0 */ @@ -151693,7 +159581,7 @@ var Bob = new Class({ /** * The x position of this Bob, relative to the x position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#x + * @name Phaser.GameObjects.Bob#x * @type {number} * @since 3.0.0 */ @@ -151702,7 +159590,7 @@ var Bob = new Class({ /** * The y position of this Bob, relative to the y position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#y + * @name Phaser.GameObjects.Bob#y * @type {number} * @since 3.0.0 */ @@ -151712,7 +159600,7 @@ var Bob = new Class({ * The frame that the Bob uses to render with. * To change the frame use the `Bob.setFrame` method. * - * @name Phaser.GameObjects.Blitter.Bob#frame + * @name Phaser.GameObjects.Bob#frame * @type {Phaser.Textures.Frame} * @protected * @since 3.0.0 @@ -151722,7 +159610,7 @@ var Bob = new Class({ /** * A blank object which can be used to store data related to this Bob in. * - * @name Phaser.GameObjects.Blitter.Bob#data + * @name Phaser.GameObjects.Bob#data * @type {object} * @default {} * @since 3.0.0 @@ -151732,7 +159620,7 @@ var Bob = new Class({ /** * The visible state of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_visible + * @name Phaser.GameObjects.Bob#_visible * @type {boolean} * @private * @since 3.0.0 @@ -151742,7 +159630,7 @@ var Bob = new Class({ /** * The alpha value of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_alpha + * @name Phaser.GameObjects.Bob#_alpha * @type {number} * @private * @default 1 @@ -151755,7 +159643,7 @@ var Bob = new Class({ * A Bob that is flipped horizontally will render inversed on the horizontal axis. * Flipping always takes place from the middle of the texture. * - * @name Phaser.GameObjects.Blitter.Bob#flipX + * @name Phaser.GameObjects.Bob#flipX * @type {boolean} * @since 3.0.0 */ @@ -151766,7 +159654,7 @@ var Bob = new Class({ * A Bob 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. * - * @name Phaser.GameObjects.Blitter.Bob#flipY + * @name Phaser.GameObjects.Bob#flipY * @type {boolean} * @since 3.0.0 */ @@ -151778,12 +159666,12 @@ var Bob = new Class({ * The frame must be part of the Texture the parent Blitter is using. * If no value is given it will use the default frame of the Blitter parent. * - * @method Phaser.GameObjects.Blitter.Bob#setFrame + * @method Phaser.GameObjects.Bob#setFrame * @since 3.0.0 * * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFrame: function (frame) { @@ -151802,10 +159690,10 @@ var Bob = new Class({ /** * Resets the horizontal and vertical flipped state of this Bob back to their default un-flipped state. * - * @method Phaser.GameObjects.Blitter.Bob#resetFlip + * @method Phaser.GameObjects.Bob#resetFlip * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ resetFlip: function () { @@ -151822,14 +159710,14 @@ var Bob = new Class({ * * Also resets the flipX and flipY values, sets alpha back to 1 and visible to true. * - * @method Phaser.GameObjects.Blitter.Bob#reset + * @method Phaser.GameObjects.Bob#reset * @since 3.0.0 * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ reset: function (x, y, frame) { @@ -151855,12 +159743,12 @@ var Bob = new Class({ /** * Sets the horizontal flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipX + * @method Phaser.GameObjects.Bob#setFlipX * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipX: function (value) { @@ -151872,12 +159760,12 @@ var Bob = new Class({ /** * Sets the vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipY + * @method Phaser.GameObjects.Bob#setFlipY * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipY: function (value) { @@ -151889,13 +159777,13 @@ var Bob = new Class({ /** * Sets the horizontal and vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlip + * @method Phaser.GameObjects.Bob#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.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlip: function (x, y) { @@ -151910,12 +159798,12 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setVisible + * @method Phaser.GameObjects.Bob#setVisible * @since 3.0.0 * * @param {boolean} value - The visible state of the Game Object. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setVisible: function (value) { @@ -151930,12 +159818,12 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setAlpha + * @method Phaser.GameObjects.Bob#setAlpha * @since 3.0.0 * * @param {number} value - The alpha value used for this Bob. Between 0 and 1. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setAlpha: function (value) { @@ -151948,7 +159836,7 @@ var Bob = new Class({ * Destroys this Bob instance. * Removes itself from the Blitter and clears the parent, frame and data properties. * - * @method Phaser.GameObjects.Blitter.Bob#destroy + * @method Phaser.GameObjects.Bob#destroy * @since 3.0.0 */ destroy: function () @@ -151967,7 +159855,7 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#visible + * @name Phaser.GameObjects.Bob#visible * @type {boolean} * @since 3.0.0 */ @@ -151991,7 +159879,7 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#alpha + * @name Phaser.GameObjects.Bob#alpha * @type {number} * @since 3.0.0 */ @@ -152016,12 +159904,12 @@ module.exports = Bob; /***/ }), -/* 906 */ +/* 947 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -152099,8 +159987,8 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca { if (roundPixels) { - dx |= 0; - dy |= 0; + dx = Math.round(dx); + dy = Math.round(dy); } ctx.drawImage( @@ -152144,16 +160032,16 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 907 */ +/* 948 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -152255,15 +160143,15 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); } // TL x/y, BL x/y, BR x/y, TR x/y - if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect)) + if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, 0)) { prevTextureSourceIndex = -1; } @@ -152274,12 +160162,12 @@ module.exports = BlitterWebGLRenderer; /***/ }), -/* 908 */ +/* 949 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -152288,12 +160176,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(907); + renderWebGL = __webpack_require__(948); } if (true) { - renderCanvas = __webpack_require__(906); + renderCanvas = __webpack_require__(947); } module.exports = { @@ -152305,16 +160193,16 @@ module.exports = { /***/ }), -/* 909 */ +/* 950 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTransform = __webpack_require__(23); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -152458,8 +160346,8 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, if (roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.save(); @@ -152480,16 +160368,16 @@ module.exports = BitmapTextCanvasRenderer; /***/ }), -/* 910 */ +/* 951 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(9); +var Utils = __webpack_require__(10); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -152688,20 +160576,20 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); } }; @@ -152709,12 +160597,12 @@ module.exports = BitmapTextWebGLRenderer; /***/ }), -/* 911 */ +/* 952 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -152723,12 +160611,12 @@ var renderCanvas = __webpack_require__(2); if (true) { - renderWebGL = __webpack_require__(910); + renderWebGL = __webpack_require__(951); } if (true) { - renderCanvas = __webpack_require__(909); + renderCanvas = __webpack_require__(950); } module.exports = { @@ -152740,16 +160628,16 @@ module.exports = { /***/ }), -/* 912 */ +/* 953 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(338); +var ParseXMLBitmapFont = __webpack_require__(344); /** * Parse an XML Bitmap Font from an Atlas. @@ -152793,12 +160681,12 @@ module.exports = ParseFromAtlas; /***/ }), -/* 913 */ +/* 954 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153035,17 +160923,18 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 914 */ +/* 955 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -153119,8 +161008,8 @@ var UpdateList = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -153133,7 +161022,7 @@ var UpdateList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -153149,9 +161038,9 @@ var UpdateList = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -153321,9 +161210,9 @@ var UpdateList = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -153337,7 +161226,7 @@ var UpdateList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -153368,12 +161257,12 @@ module.exports = UpdateList; /***/ }), -/* 915 */ +/* 956 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153416,16 +161305,16 @@ module.exports = Swap; /***/ }), -/* 916 */ +/* 957 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(68); +var SafeRange = __webpack_require__(74); /** * Scans the array for elements with the given property. If found, the property is set to the `value`. @@ -153471,12 +161360,12 @@ module.exports = SetAll; /***/ }), -/* 917 */ +/* 958 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153509,12 +161398,12 @@ module.exports = SendToBack; /***/ }), -/* 918 */ +/* 959 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153552,16 +161441,16 @@ module.exports = Replace; /***/ }), -/* 919 */ +/* 960 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(100); +var SpliceOne = __webpack_require__(106); /** * Removes a random object from the given array and returns it. @@ -153590,16 +161479,16 @@ module.exports = RemoveRandomElement; /***/ }), -/* 920 */ +/* 961 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(68); +var SafeRange = __webpack_require__(74); /** * Removes the item within the given range in the array. @@ -153653,16 +161542,16 @@ module.exports = RemoveBetween; /***/ }), -/* 921 */ +/* 962 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(100); +var SpliceOne = __webpack_require__(106); /** * Removes the item from the given position in the array. @@ -153704,16 +161593,16 @@ module.exports = RemoveAt; /***/ }), -/* 922 */ +/* 963 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RoundAwayFromZero = __webpack_require__(342); +var RoundAwayFromZero = __webpack_require__(410); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -153750,7 +161639,7 @@ var RoundAwayFromZero = __webpack_require__(342); * @param {number} [end=null] - The end of the range. * @param {number} [step=1] - The value to increment or decrement by. * - * @return {number[]} [description] + * @return {number[]} The array of number values. */ var NumberArrayStep = function (start, end, step) { @@ -153781,12 +161670,12 @@ module.exports = NumberArrayStep; /***/ }), -/* 923 */ +/* 964 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153845,12 +161734,12 @@ module.exports = NumberArray; /***/ }), -/* 924 */ +/* 965 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153870,10 +161759,10 @@ var MoveUp = function (array, item) { var currentIndex = array.indexOf(item); - if (currentIndex !== -1 && currentIndex < array.length - 2) + if (currentIndex !== -1 && currentIndex < array.length - 1) { + // The element one above `item` in the array var item2 = array[currentIndex + 1]; - var index2 = array.indexOf(item2); array[currentIndex] = item2; @@ -153887,12 +161776,12 @@ module.exports = MoveUp; /***/ }), -/* 925 */ +/* 966 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153934,12 +161823,12 @@ module.exports = MoveTo; /***/ }), -/* 926 */ +/* 967 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153976,16 +161865,16 @@ module.exports = MoveDown; /***/ }), -/* 927 */ +/* 968 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(68); +var SafeRange = __webpack_require__(74); /** * Returns the first element in the array. @@ -154035,16 +161924,16 @@ module.exports = GetFirst; /***/ }), -/* 928 */ +/* 969 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(68); +var SafeRange = __webpack_require__(74); /** * Returns all elements in the array. @@ -154097,16 +161986,16 @@ module.exports = GetAll; /***/ }), -/* 929 */ +/* 970 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(68); +var SafeRange = __webpack_require__(74); /** * Passes each element in the array, between the start and end indexes, to the given callback. @@ -154153,12 +162042,12 @@ module.exports = EachInRange; /***/ }), -/* 930 */ +/* 971 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154199,16 +162088,16 @@ module.exports = Each; /***/ }), -/* 931 */ +/* 972 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(68); +var SafeRange = __webpack_require__(74); /** * Returns the total number of elements in the array which have a property matching the given value. @@ -154251,12 +162140,12 @@ module.exports = CountAllMatching; /***/ }), -/* 932 */ +/* 973 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154289,12 +162178,12 @@ module.exports = BringToTop; /***/ }), -/* 933 */ +/* 974 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154411,12 +162300,12 @@ module.exports = AddAt; /***/ }), -/* 934 */ +/* 975 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154528,26 +162417,26 @@ module.exports = Add; /***/ }), -/* 935 */ +/* 976 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(121); +var RotateMatrix = __webpack_require__(129); /** - * [description] + * Rotates the array matrix to the left (or -90 degrees) * * @function Phaser.Utils.Array.Matrix.RotateRight * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var RotateRight = function (matrix) { @@ -154558,26 +162447,26 @@ module.exports = RotateRight; /***/ }), -/* 936 */ +/* 977 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(121); +var RotateMatrix = __webpack_require__(129); /** - * [description] + * Rotates the array matrix to the left (or 90 degrees) * * @function Phaser.Utils.Array.Matrix.RotateLeft * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var RotateLeft = function (matrix) { @@ -154588,26 +162477,26 @@ module.exports = RotateLeft; /***/ }), -/* 937 */ +/* 978 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(121); +var RotateMatrix = __webpack_require__(129); /** - * [description] + * Rotates the array matrix 180 degrees. * * @function Phaser.Utils.Array.Matrix.Rotate180 * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var Rotate180 = function (matrix) { @@ -154618,40 +162507,45 @@ module.exports = Rotate180; /***/ }), -/* 938 */ +/* 979 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Reverses the rows in the given Array Matrix. * * @function Phaser.Utils.Array.Matrix.ReverseRows * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array matrix to reverse the rows for. * - * @return {array} [description] + * @return {array} The column reversed matrix. */ var ReverseRows = function (matrix) { - return matrix.reverse(); + for (var i = 0; i < matrix.length; i++) + { + matrix[i].reverse(); + } + + return matrix; }; module.exports = ReverseRows; /***/ }), -/* 939 */ +/* 980 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154667,32 +162561,24 @@ module.exports = ReverseRows; */ var ReverseColumns = function (matrix) { - for (var i = 0; i < matrix.length; i++) - { - matrix[i].reverse(); - } - - return matrix; + return matrix.reverse(); }; module.exports = ReverseColumns; /***/ }), -/* 940 */ +/* 981 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pad = __webpack_require__(197); -var CheckMatrix = __webpack_require__(179); - -// Generates a string (which you can pass to console.log) from the given -// Array Matrix. +var Pad = __webpack_require__(213); +var CheckMatrix = __webpack_require__(191); /** * Generates a string (which you can pass to console.log) from the given Array Matrix. @@ -154760,12 +162646,12 @@ module.exports = MatrixToString; /***/ }), -/* 941 */ +/* 982 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154775,33 +162661,34 @@ module.exports = MatrixToString; module.exports = { - CheckMatrix: __webpack_require__(179), - MatrixToString: __webpack_require__(940), - ReverseColumns: __webpack_require__(939), - ReverseRows: __webpack_require__(938), - Rotate180: __webpack_require__(937), - RotateLeft: __webpack_require__(936), - RotateMatrix: __webpack_require__(121), - RotateRight: __webpack_require__(935), - TransposeMatrix: __webpack_require__(343) + CheckMatrix: __webpack_require__(191), + MatrixToString: __webpack_require__(981), + ReverseColumns: __webpack_require__(980), + ReverseRows: __webpack_require__(979), + Rotate180: __webpack_require__(978), + RotateLeft: __webpack_require__(977), + RotateMatrix: __webpack_require__(129), + RotateRight: __webpack_require__(976), + TransposeMatrix: __webpack_require__(348) }; /***/ }), -/* 942 */ +/* 983 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var List = __webpack_require__(122); -var PluginCache = __webpack_require__(15); -var StableSort = __webpack_require__(120); +var List = __webpack_require__(130); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var StableSort = __webpack_require__(128); /** * @classdesc @@ -154857,8 +162744,8 @@ var DisplayList = new Class({ */ this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -154871,7 +162758,7 @@ var DisplayList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -154885,7 +162772,7 @@ var DisplayList = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -154932,46 +162819,8 @@ var DisplayList = new Class({ }, /** - * Given an array of Game Objects, sort the array and return it, so that - * the objects are in index order with the lowest at the bottom. - * - * @method Phaser.GameObjects.DisplayList#sortGameObjects - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects to sort. - * - * @return {array} The sorted array of Game Objects. - */ - sortGameObjects: function (gameObjects) - { - if (gameObjects === undefined) { gameObjects = this.list; } - - this.scene.sys.depthSort(); - - return gameObjects.sort(this.sortIndexHandler.bind(this)); - }, - - /** - * Get the top-most Game Object in the given array of Game Objects, after sorting it. - * - * Note that the given array is sorted in place, even though it isn't returned directly it will still be updated. - * - * @method Phaser.GameObjects.DisplayList#getTopGameObject - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects. - * - * @return {Phaser.GameObjects.GameObject} The top-most Game Object in the array of Game Objects. - */ - getTopGameObject: function (gameObjects) - { - this.sortGameObjects(gameObjects); - - return gameObjects[gameObjects.length - 1]; - }, - - /** - * All members of the group. + * Returns an array which contains all objects currently on the Display List. + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. * * @method Phaser.GameObjects.DisplayList#getChildren * @since 3.12.0 @@ -155002,7 +162851,7 @@ var DisplayList = new Class({ this.list.length = 0; - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -155017,7 +162866,7 @@ var DisplayList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -155031,12 +162880,12 @@ module.exports = DisplayList; /***/ }), -/* 943 */ +/* 984 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -155046,93 +162895,97 @@ module.exports = DisplayList; var GameObjects = { - DisplayList: __webpack_require__(942), - GameObjectCreator: __webpack_require__(14), + Events: __webpack_require__(143), + + DisplayList: __webpack_require__(983), + GameObjectCreator: __webpack_require__(15), GameObjectFactory: __webpack_require__(5), - UpdateList: __webpack_require__(914), + UpdateList: __webpack_require__(955), - Components: __webpack_require__(16), + Components: __webpack_require__(14), - BuildGameObject: __webpack_require__(32), - BuildGameObjectAnimation: __webpack_require__(339), - GameObject: __webpack_require__(17), - BitmapText: __webpack_require__(119), - Blitter: __webpack_require__(177), - Container: __webpack_require__(176), - DynamicBitmapText: __webpack_require__(175), - Graphics: __webpack_require__(174), - Group: __webpack_require__(97), - Image: __webpack_require__(78), - Particles: __webpack_require__(890), - PathFollower: __webpack_require__(324), - RenderTexture: __webpack_require__(170), - RetroFont: __webpack_require__(881), - Sprite: __webpack_require__(57), - Text: __webpack_require__(169), - TileSprite: __webpack_require__(168), - Zone: __webpack_require__(135), + BuildGameObject: __webpack_require__(34), + BuildGameObjectAnimation: __webpack_require__(345), + GameObject: __webpack_require__(18), + BitmapText: __webpack_require__(127), + Blitter: __webpack_require__(189), + Container: __webpack_require__(188), + DynamicBitmapText: __webpack_require__(187), + Extern: __webpack_require__(342), + Graphics: __webpack_require__(186), + Group: __webpack_require__(103), + Image: __webpack_require__(83), + Particles: __webpack_require__(928), + PathFollower: __webpack_require__(330), + RenderTexture: __webpack_require__(182), + RetroFont: __webpack_require__(919), + Sprite: __webpack_require__(61), + Text: __webpack_require__(181), + TileSprite: __webpack_require__(180), + Zone: __webpack_require__(147), // Shapes - Shape: __webpack_require__(31), - Arc: __webpack_require__(321), - Curve: __webpack_require__(320), - Ellipse: __webpack_require__(319), - Grid: __webpack_require__(318), - IsoBox: __webpack_require__(317), - IsoTriangle: __webpack_require__(316), - Line: __webpack_require__(315), - Polygon: __webpack_require__(314), - Rectangle: __webpack_require__(309), - Star: __webpack_require__(308), - Triangle: __webpack_require__(307), + Shape: __webpack_require__(33), + Arc: __webpack_require__(328), + Curve: __webpack_require__(327), + Ellipse: __webpack_require__(326), + Grid: __webpack_require__(325), + IsoBox: __webpack_require__(324), + IsoTriangle: __webpack_require__(323), + Line: __webpack_require__(322), + Polygon: __webpack_require__(321), + Rectangle: __webpack_require__(316), + Star: __webpack_require__(315), + Triangle: __webpack_require__(314), // Game Object Factories Factories: { - Blitter: __webpack_require__(836), - Container: __webpack_require__(835), - DynamicBitmapText: __webpack_require__(834), - Graphics: __webpack_require__(833), - Group: __webpack_require__(832), - Image: __webpack_require__(831), - Particles: __webpack_require__(830), - PathFollower: __webpack_require__(829), - RenderTexture: __webpack_require__(828), - Sprite: __webpack_require__(827), - StaticBitmapText: __webpack_require__(826), - Text: __webpack_require__(825), - TileSprite: __webpack_require__(824), - Zone: __webpack_require__(823), + Blitter: __webpack_require__(874), + Container: __webpack_require__(873), + DynamicBitmapText: __webpack_require__(872), + Extern: __webpack_require__(871), + Graphics: __webpack_require__(870), + Group: __webpack_require__(869), + Image: __webpack_require__(868), + Particles: __webpack_require__(867), + PathFollower: __webpack_require__(866), + RenderTexture: __webpack_require__(865), + Sprite: __webpack_require__(864), + StaticBitmapText: __webpack_require__(863), + Text: __webpack_require__(862), + TileSprite: __webpack_require__(861), + Zone: __webpack_require__(860), // Shapes - Arc: __webpack_require__(822), - Curve: __webpack_require__(821), - Ellipse: __webpack_require__(820), - Grid: __webpack_require__(819), - IsoBox: __webpack_require__(818), - IsoTriangle: __webpack_require__(817), - Line: __webpack_require__(816), - Polygon: __webpack_require__(815), - Rectangle: __webpack_require__(814), - Star: __webpack_require__(813), - Triangle: __webpack_require__(812) + Arc: __webpack_require__(859), + Curve: __webpack_require__(858), + Ellipse: __webpack_require__(857), + Grid: __webpack_require__(856), + IsoBox: __webpack_require__(855), + IsoTriangle: __webpack_require__(854), + Line: __webpack_require__(853), + Polygon: __webpack_require__(852), + Rectangle: __webpack_require__(851), + Star: __webpack_require__(850), + Triangle: __webpack_require__(849) }, Creators: { - Blitter: __webpack_require__(811), - Container: __webpack_require__(810), - DynamicBitmapText: __webpack_require__(809), - Graphics: __webpack_require__(808), - Group: __webpack_require__(807), - Image: __webpack_require__(806), - Particles: __webpack_require__(805), - RenderTexture: __webpack_require__(804), - Sprite: __webpack_require__(803), - StaticBitmapText: __webpack_require__(802), - Text: __webpack_require__(801), - TileSprite: __webpack_require__(800), - Zone: __webpack_require__(799) + Blitter: __webpack_require__(848), + Container: __webpack_require__(847), + DynamicBitmapText: __webpack_require__(846), + Graphics: __webpack_require__(845), + Group: __webpack_require__(844), + Image: __webpack_require__(843), + Particles: __webpack_require__(842), + RenderTexture: __webpack_require__(841), + Sprite: __webpack_require__(840), + StaticBitmapText: __webpack_require__(839), + Text: __webpack_require__(838), + TileSprite: __webpack_require__(837), + Zone: __webpack_require__(836) } }; @@ -155143,26 +162996,26 @@ if (false) if (true) { // WebGL only Game Objects - GameObjects.Mesh = __webpack_require__(118); - GameObjects.Quad = __webpack_require__(165); + GameObjects.Mesh = __webpack_require__(126); + GameObjects.Quad = __webpack_require__(177); - GameObjects.Factories.Mesh = __webpack_require__(795); - GameObjects.Factories.Quad = __webpack_require__(794); + GameObjects.Factories.Mesh = __webpack_require__(832); + GameObjects.Factories.Quad = __webpack_require__(831); - GameObjects.Creators.Mesh = __webpack_require__(793); - GameObjects.Creators.Quad = __webpack_require__(792); + GameObjects.Creators.Mesh = __webpack_require__(830); + GameObjects.Creators.Quad = __webpack_require__(829); - GameObjects.Light = __webpack_require__(304); + GameObjects.Light = __webpack_require__(311); - __webpack_require__(303); - __webpack_require__(791); + __webpack_require__(310); + __webpack_require__(828); } module.exports = GameObjects; /***/ }), -/* 944 */ +/* 985 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155200,7 +163053,7 @@ module.exports = Purchase; /***/ }), -/* 945 */ +/* 986 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155238,7 +163091,7 @@ module.exports = Product; /***/ }), -/* 946 */ +/* 987 */ /***/ (function(module, exports) { /** @@ -155278,7 +163131,7 @@ module.exports = LeaderboardScore; /***/ }), -/* 947 */ +/* 988 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155288,8 +163141,8 @@ module.exports = LeaderboardScore; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(11); -var LeaderboardScore = __webpack_require__(946); +var EventEmitter = __webpack_require__(9); +var LeaderboardScore = __webpack_require__(987); /** * @classdesc @@ -155422,13 +163275,15 @@ var Leaderboard = new Class({ * * The data is requested in an async call, so the result isn't available immediately. * - * When the call completes this Leaderboard will emit the `setscore` event along with the score, any extra data and the name of the Leaderboard. + * When the call completes this Leaderboard will emit the `setscore` event along with the LeaderboardScore object and the name of the Leaderboard. + * + * If the save fails the event will send `null` as the score value. * * @method Phaser.FacebookInstantGamesPlugin.Leaderboard#setScore * @since 3.13.0 * * @param {integer} score - The new score for the player. Must be a 64-bit integer number. - * @param {string} [data] - Metadata to associate with the stored score. Must be less than 2KB in size. + * @param {(string|any)} [data] - Metadata to associate with the stored score. Must be less than 2KB in size. If an object is given it will be passed to `JSON.stringify`. * * @return {this} This Leaderboard instance. */ @@ -155436,11 +163291,27 @@ var Leaderboard = new Class({ { if (data === undefined) { data = ''; } + if (typeof data === 'object') + { + data = JSON.stringify(data); + } + var _this = this; this.ref.setScoreAsync(score, data).then(function (entry) { - _this.emit('setscore', entry.getScore(), entry.getExtraData(), _this.name); + if (entry) + { + var score = LeaderboardScore(entry); + + _this.playerScore = score; + + _this.emit('setscore', score, _this.name); + } + else + { + _this.emit('setscore', null, _this.name); + } }).catch(function (e) { @@ -155456,6 +163327,8 @@ var Leaderboard = new Class({ * The data is requested in an async call, so the result isn't available immediately. * * When the call completes this Leaderboard will emit the `getplayerscore` event along with the score and the name of the Leaderboard. + * + * If the player has not yet saved a score, the event will send `null` as the score value, and `playerScore` will be set to `null` as well. * * @method Phaser.FacebookInstantGamesPlugin.Leaderboard#getPlayerScore * @since 3.13.0 @@ -155468,11 +163341,18 @@ var Leaderboard = new Class({ this.ref.getPlayerEntryAsync().then(function (entry) { - var score = LeaderboardScore(entry); + if (entry) + { + var score = LeaderboardScore(entry); - _this.playerScore = score; - - _this.emit('getplayerscore', score, _this.name); + _this.playerScore = score; + + _this.emit('getplayerscore', score, _this.name); + } + else + { + _this.emit('getplayerscore', null, _this.name); + } }).catch(function (e) { @@ -155487,7 +163367,7 @@ var Leaderboard = new Class({ * * The data is requested in an async call, so the result isn't available immediately. * - * When the call completes this Leaderboard will emit the `getplayerscore` event along with the score and the name of the Leaderboard. + * When the call completes this Leaderboard will emit the `getscores` event along with an array of LeaderboardScore entries and the name of the Leaderboard. * * @method Phaser.FacebookInstantGamesPlugin.Leaderboard#getScores * @since 3.13.0 @@ -155504,7 +163384,7 @@ var Leaderboard = new Class({ var _this = this; - this.ref.getEntriesAsync().then(function (entries) + this.ref.getEntriesAsync(count, offset).then(function (entries) { _this.scores = []; @@ -155520,6 +163400,47 @@ var Leaderboard = new Class({ console.warn(e); }); + return this; + }, + + /** + * Retrieves a set of leaderboard entries, based on the current player's connected players (including the current player), ordered by local rank within the set of connected players. + * + * The data is requested in an async call, so the result isn't available immediately. + * + * When the call completes this Leaderboard will emit the `getconnectedscores` event along with an array of LeaderboardScore entries and the name of the Leaderboard. + * + * @method Phaser.FacebookInstantGamesPlugin.Leaderboard#getConnectedScores + * @since 3.16.0 + * + * @param {integer} [count=10] - The number of entries to attempt to fetch from the leaderboard. Currently, up to a maximum of 100 entries may be fetched per query. + * @param {integer} [offset=0] - The offset from the top of the leaderboard that entries will be fetched from. + * + * @return {this} This Leaderboard instance. + */ + getConnectedScores: function (count, offset) + { + if (count === undefined) { count = 10; } + if (offset === undefined) { offset = 0; } + + var _this = this; + + this.ref.getConnectedPlayerEntriesAsync().then(function (entries) + { + _this.scores = []; + + entries.forEach(function (entry) + { + _this.scores.push(LeaderboardScore(entry)); + }); + + _this.emit('getconnectedscores', _this.scores, _this.name); + + }).catch(function (e) + { + console.warn(e); + }); + return this; } @@ -155529,7 +163450,7 @@ module.exports = Leaderboard; /***/ }), -/* 948 */ +/* 989 */ /***/ (function(module, exports) { /** @@ -155547,11 +163468,11 @@ module.exports = Leaderboard; * @property {boolean} video - Is this a video ad? */ -var AdInstance = function (instance, video) +var AdInstance = function (placementID, instance, video) { return { instance: instance, - placementID: instance.getPlacementID(), + placementID: placementID, shown: false, video: video }; @@ -155561,816 +163482,12 @@ module.exports = AdInstance; /***/ }), -/* 949 */ +/* 990 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Visibility Handler hidden event. - * - * The document in which the Game is embedded has entered a hidden state. - * - * @event Phaser.Boot.VisibilityHandler#hidden - */ - -/** - * Visibility Handler visible event. - * - * The document in which the Game is embedded has entered a visible state. - * - * @event Phaser.Boot.VisibilityHandler#visible - */ - -/** - * Visibility Handler blur event. - * - * The window in which the Game is embedded has entered a blurred state. - * - * @event Phaser.Boot.VisibilityHandler#blur - */ - -/** - * Visibility Handler focus event. - * - * The window in which the Game is embedded has entered a focused state. - * - * @event Phaser.Boot.VisibilityHandler#focus - */ - -/** - * The Visibility Handler is responsible for listening out for document level visibility change events. - * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses - * the provided Event Emitter and fires the related events. - * - * @function Phaser.Boot.VisibilityHandler - * @fires Phaser.Boot.VisibilityHandler#hidden - * @fires Phaser.Boot.VisibilityHandler#visible - * @fires Phaser.Boot.VisibilityHandler#blur - * @fires Phaser.Boot.VisibilityHandler#focus - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. - */ -var VisibilityHandler = function (game) -{ - var hiddenVar; - var eventEmitter = game.events; - - if (document.hidden !== undefined) - { - hiddenVar = 'visibilitychange'; - } - else - { - var vendors = [ 'webkit', 'moz', 'ms' ]; - - vendors.forEach(function (prefix) - { - if (document[prefix + 'Hidden'] !== undefined) - { - document.hidden = function () - { - return document[prefix + 'Hidden']; - }; - - hiddenVar = prefix + 'visibilitychange'; - } - - }); - } - - var onChange = function (event) - { - if (document.hidden || event.type === 'pause') - { - eventEmitter.emit('hidden'); - } - else - { - eventEmitter.emit('visible'); - } - }; - - if (hiddenVar) - { - document.addEventListener(hiddenVar, onChange, false); - } - - window.onblur = function () - { - eventEmitter.emit('blur'); - }; - - window.onfocus = function () - { - eventEmitter.emit('focus'); - }; - - // Automatically give the window focus unless config says otherwise - if (window.focus && game.config.autoFocus) - { - window.focus(); - - game.canvas.addEventListener('mousedown', function () - { - window.focus(); - }, { passive: true }); - } - - if (game.canvas) - { - game.canvas.onmouseout = function () - { - game.isOver = false; - eventEmitter.emit('mouseout'); - }; - - game.canvas.onmouseover = function () - { - game.isOver = true; - eventEmitter.emit('mouseover'); - }; - } -}; - -module.exports = VisibilityHandler; - - -/***/ }), -/* 950 */ -/***/ (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 GetValue = __webpack_require__(4); -var NOOP = __webpack_require__(2); -var RequestAnimationFrame = __webpack_require__(377); - -// Frame Rate config -// fps: { -// min: 10, -// target: 60, -// forceSetTimeOut: false, -// deltaHistory: 10, -// panicMax: 120 -// } - -// http://www.testufo.com/#test=animation-time-graph - -/** - * @callback TimeStepCallback - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} average - The Delta Average. - * @param {number} interpolation - Interpolation - how far between what is expected and where we are? - */ - -/** - * @classdesc - * [description] - * - * @class TimeStep - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. - * @param {FPSConfig} config - */ -var TimeStep = new Class({ - - initialize: - - function TimeStep (game, config) - { - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.Boot.TimeStep#game - * @type {Phaser.Game} - * @readonly - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#raf - * @type {Phaser.DOM.RequestAnimationFrame} - * @readonly - * @since 3.0.0 - */ - this.raf = new RequestAnimationFrame(); - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * - * @name Phaser.Boot.TimeStep#started - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.started = false; - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * The difference between this value and `started` is that `running` is toggled when - * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if - * the TimeStep is actually stopped, not just paused. - * - * @name Phaser.Boot.TimeStep#running - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.running = false; - - /** - * The minimum fps rate you want the Time Step to run at. - * - * @name Phaser.Boot.TimeStep#minFps - * @type {integer} - * @default 5 - * @since 3.0.0 - */ - this.minFps = GetValue(config, 'min', 5); - - /** - * The target fps rate for the Time Step to run at. - * - * Setting this value will not actually change the speed at which the browser runs, that is beyond - * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step - * is spiraling out of control. - * - * @name Phaser.Boot.TimeStep#targetFps - * @type {integer} - * @default 60 - * @since 3.0.0 - */ - this.targetFps = GetValue(config, 'target', 60); - - /** - * The minFps value in ms. - * Defaults to 200ms between frames (i.e. super slow!) - * - * @name Phaser.Boot.TimeStep#_min - * @type {number} - * @private - * @since 3.0.0 - */ - this._min = 1000 / this.minFps; - - /** - * The targetFps value in ms. - * Defaults to 16.66ms between frames (i.e. normal) - * - * @name Phaser.Boot.TimeStep#_target - * @type {number} - * @private - * @since 3.0.0 - */ - this._target = 1000 / this.targetFps; - - /** - * An exponential moving average of the frames per second. - * - * @name Phaser.Boot.TimeStep#actualFps - * @type {integer} - * @readonly - * @default 60 - * @since 3.0.0 - */ - this.actualFps = this.targetFps; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#nextFpsUpdate - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.nextFpsUpdate = 0; - - /** - * The number of frames processed this second. - * - * @name Phaser.Boot.TimeStep#framesThisSecond - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.framesThisSecond = 0; - - /** - * A callback to be invoked each time the Time Step steps. - * - * @name Phaser.Boot.TimeStep#callback - * @type {TimeStepCallback} - * @default NOOP - * @since 3.0.0 - */ - this.callback = NOOP; - - /** - * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting - * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. - * - * @name Phaser.Boot.TimeStep#forceSetTimeOut - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#time - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.time = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#startTime - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.startTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#lastTime - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.lastTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#frame - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.frame = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#inFocus - * @type {boolean} - * @readonly - * @default true - * @since 3.0.0 - */ - this.inFocus = true; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#_pauseTime - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._pauseTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#_coolDown - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._coolDown = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#delta - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.delta = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaIndex - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.deltaIndex = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaHistory - * @type {integer[]} - * @since 3.0.0 - */ - this.deltaHistory = []; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaSmoothingMax - * @type {integer} - * @default 10 - * @since 3.0.0 - */ - this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#panicMax - * @type {integer} - * @default 120 - * @since 3.0.0 - */ - this.panicMax = GetValue(config, 'panicMax', 120); - - /** - * The actual elapsed time in ms between one update and the next. - * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. - * So please be careful when using this value in calculations. - * - * @name Phaser.Boot.TimeStep#rawDelta - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.rawDelta = 0; - }, - - /** - * Called when the DOM window.onBlur event triggers. - * - * @method Phaser.Boot.TimeStep#blur - * @since 3.0.0 - */ - blur: function () - { - this.inFocus = false; - }, - - /** - * Called when the DOM window.onFocus event triggers. - * - * @method Phaser.Boot.TimeStep#focus - * @since 3.0.0 - */ - focus: function () - { - this.inFocus = true; - - this.resetDelta(); - }, - - /** - * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) - * - * @method Phaser.Boot.TimeStep#pause - * @since 3.0.0 - */ - pause: function () - { - this._pauseTime = window.performance.now(); - }, - - /** - * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) - * - * @method Phaser.Boot.TimeStep#resume - * @since 3.0.0 - */ - resume: function () - { - this.resetDelta(); - - this.startTime += this.time - this._pauseTime; - }, - - /** - * [description] - * - * @method Phaser.Boot.TimeStep#resetDelta - * @since 3.0.0 - */ - resetDelta: function () - { - var now = window.performance.now(); - - this.time = now; - this.lastTime = now; - this.nextFpsUpdate = now + 1000; - this.framesThisSecond = 0; - this.frame = 0; - - // Pre-populate smoothing array - - for (var i = 0; i < this.deltaSmoothingMax; i++) - { - this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); - } - - this.delta = 0; - this.deltaIndex = 0; - - this._coolDown = this.panicMax; - }, - - /** - * Starts the Time Step running, if it is not already doing so. - * Called automatically by the Game Boot process. - * - * @method Phaser.Boot.TimeStep#start - * @since 3.0.0 - * - * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. - */ - start: function (callback) - { - if (this.started) - { - return this; - } - - this.started = true; - this.running = true; - - for (var i = 0; i < this.deltaSmoothingMax; i++) - { - this.deltaHistory[i] = this._target; - } - - this.resetDelta(); - - this.startTime = window.performance.now(); - - this.callback = callback; - - this.raf.start(this.step.bind(this), this.forceSetTimeOut); - }, - - /** - * The main step method. This is called each time the browser updates, either by Request Animation Frame, - * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. - * You generally should never call this method directly. - * - * @method Phaser.Boot.TimeStep#step - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - */ - step: function (time) - { - this.frame++; - - var before = time - this.lastTime; - - if (before < 0) - { - // Because, Chrome. - before = 0; - } - - this.rawDelta = before; - - var idx = this.deltaIndex; - var history = this.deltaHistory; - var max = this.deltaSmoothingMax; - - // delta time (time is in ms) - var dt = before; - - // When a browser switches tab, then comes back again, it takes around 10 frames before - // the delta time settles down so we employ a 'cooling down' period before we start - // trusting the delta values again, to avoid spikes flooding through our delta average - - if (this._coolDown > 0 || !this.inFocus) - { - this._coolDown--; - - dt = Math.min(dt, this._target); - } - - if (dt > this._min) - { - // Probably super bad start time or browser tab context loss, - // so use the last 'sane' dt value - - dt = history[idx]; - - // Clamp delta to min (in case history has become corrupted somehow) - dt = Math.min(dt, this._min); - } - - // Smooth out the delta over the previous X frames - - // add the delta to the smoothing array - history[idx] = dt; - - // adjusts the delta history array index based on the smoothing count - // this stops the array growing beyond the size of deltaSmoothingMax - this.deltaIndex++; - - if (this.deltaIndex > max) - { - this.deltaIndex = 0; - } - - // Delta Average - var avg = 0; - - // Loop the history array, adding the delta values together - - for (var i = 0; i < max; i++) - { - avg += history[i]; - } - - // Then divide by the array length to get the average delta - avg /= max; - - // Set as the world delta value - this.delta = avg; - - // Real-world timer advance - this.time += this.rawDelta; - - // Update the estimate of the frame rate, `fps`. Every second, the number - // of frames that occurred in that second are included in an exponential - // moving average of all frames per second, with an alpha of 0.25. This - // means that more recent seconds affect the estimated frame rate more than - // older seconds. - // - // When a browser window is NOT minimized, but is covered up (i.e. you're using - // another app which has spawned a window over the top of the browser), then it - // will start to throttle the raf callback time. It waits for a while, and then - // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. - // So if the game was running at 60fps, and the player opens a new window, then - // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. - // - // When they make the game visible again, the frame rate is increased at a rate of - // approx. 8fps, back up to 60fps (or the max it can obtain) - // - // There is no easy way to determine if this drop in frame rate is because the - // browser is throttling raf, or because the game is struggling with performance - // because you're asking it to do too much on the device. - - if (time > this.nextFpsUpdate) - { - // Compute the new exponential moving average with an alpha of 0.25. - this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; - this.nextFpsUpdate = time + 1000; - this.framesThisSecond = 0; - } - - this.framesThisSecond++; - - // Interpolation - how far between what is expected and where we are? - var interpolation = avg / this._target; - - this.callback(time, avg, interpolation); - - // Shift time value over - this.lastTime = time; - }, - - /** - * Manually calls TimeStep.step, passing in the performance.now value to it. - * - * @method Phaser.Boot.TimeStep#tick - * @since 3.0.0 - */ - tick: function () - { - this.step(window.performance.now()); - }, - - /** - * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. - * - * @method Phaser.Boot.TimeStep#sleep - * @since 3.0.0 - */ - sleep: function () - { - if (this.running) - { - this.raf.stop(); - - this.running = false; - } - }, - - /** - * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. - * The `seamless` argument controls if the wake-up should adjust the start time or not. - * - * @method Phaser.Boot.TimeStep#wake - * @since 3.0.0 - * - * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. - */ - wake: function (seamless) - { - if (this.running) - { - this.sleep(); - } - else if (seamless) - { - this.startTime += -this.lastTime + (this.lastTime = window.performance.now()); - } - - this.raf.start(this.step.bind(this), this.useRAF); - - this.running = true; - - this.step(window.performance.now()); - }, - - /** - * Stops the TimeStep running. - * - * @method Phaser.Boot.TimeStep#stop - * @since 3.0.0 - * - * @return {Phaser.Boot.TimeStep} The TimeStep object. - */ - stop: function () - { - this.running = false; - this.started = false; - - this.raf.stop(); - - return this; - }, - - /** - * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null - * any objects. - * - * @method Phaser.Boot.TimeStep#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); - - this.callback = NOOP; - - this.raf = null; - this.game = null; - } - -}); - -module.exports = TimeStep; - - -/***/ }), -/* 951 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156535,12 +163652,12 @@ TextureImporter: /***/ }), -/* 952 */ +/* 991 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156562,8 +163679,8 @@ var GetFastValue = __webpack_require__(1); * @param {object} config - An object describing how to parse the Sprite Sheet. * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. - * @param {number} [config.startFrame=0] - [description] - * @param {number} [config.endFrame=-1] - [description] + * @param {number} [config.startFrame=0] - Index of the start frame in the sprite sheet + * @param {number} [config.endFrame=-1] - Index of the end frame in the sprite sheet. -1 mean all the rest of the frames * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. * @@ -156657,27 +163774,33 @@ var SpriteSheetFromAtlas = function (texture, frame, config) { var destX = (leftRow) ? leftPad : 0; var destY = (topRow) ? topPad : 0; - var destWidth = frameWidth; - var destHeight = frameHeight; + + var trimWidth = 0; + var trimHeight = 0; if (leftRow) { - destWidth = leftWidth; + trimWidth += (frameWidth - leftWidth); } - else if (rightRow) + + if (rightRow) { - destWidth = rightWidth; + trimWidth += (frameWidth - rightWidth); } if (topRow) { - destHeight = topHeight; + trimHeight += (frameHeight - topHeight); } - else if (bottomRow) + + if (bottomRow) { - destHeight = bottomHeight; + trimHeight += (frameHeight - bottomHeight); } + var destWidth = frameWidth - trimWidth; + var destHeight = frameHeight - trimHeight; + sheetFrame.cutWidth = destWidth; sheetFrame.cutHeight = destHeight; @@ -156692,7 +163815,7 @@ var SpriteSheetFromAtlas = function (texture, frame, config) } else if (rightRow) { - frameX += rightRow; + frameX += rightWidth; } else { @@ -156726,12 +163849,12 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 953 */ +/* 992 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156851,16 +163974,16 @@ module.exports = SpriteSheet; /***/ }), -/* 954 */ +/* 993 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -156950,16 +164073,16 @@ module.exports = JSONHash; /***/ }), -/* 955 */ +/* 994 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -157057,12 +164180,12 @@ module.exports = JSONArray; /***/ }), -/* 956 */ +/* 995 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157092,12 +164215,12 @@ module.exports = Image; /***/ }), -/* 957 */ +/* 996 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157127,12 +164250,12 @@ module.exports = Canvas; /***/ }), -/* 958 */ +/* 997 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157208,19 +164331,20 @@ module.exports = AtlasXML; /***/ }), -/* 959 */ +/* 998 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Color = __webpack_require__(41); -var IsSizePowerOfTwo = __webpack_require__(127); -var Texture = __webpack_require__(181); +var Clamp = __webpack_require__(24); +var Color = __webpack_require__(37); +var IsSizePowerOfTwo = __webpack_require__(137); +var Texture = __webpack_require__(193); /** * @classdesc @@ -157436,6 +164560,148 @@ var CanvasTexture = new Class({ return this.update(); }, + /** + * Draws the given texture frame to this CanvasTexture, then updates the internal + * ImageData buffer and arrays. + * + * @method Phaser.Textures.CanvasTexture#drawFrame + * @since 3.16.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {integer} [x=0] - The x coordinate to draw the source at. + * @param {integer} [y=0] - The y coordinate to draw the source at. + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + drawFrame: function (key, frame, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + var textureFrame = this.manager.getFrame(key, frame); + + if (textureFrame) + { + var cd = textureFrame.canvasData; + + var width = textureFrame.cutWidth; + var height = textureFrame.cutHeight; + var res = textureFrame.source.resolution; + + this.context.drawImage( + textureFrame.source.image, + cd.x, cd.y, + width, + height, + x, y, + width / res, + height / res + ); + + return this.update(); + } + else + { + return this; + } + }, + + /** + * Sets a pixel in the CanvasTexture to the given color and alpha values. + * + * This is an expensive operation to run in large quantities, so use sparingly. + * + * @method Phaser.Textures.CanvasTexture#setPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @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=255] - The alpha value. A number between 0 and 255. + * + * @return {this} This CanvasTexture. + */ + setPixel: function (x, y, red, green, blue, alpha) + { + if (alpha === undefined) { alpha = 255; } + + x = Math.abs(Math.floor(x)); + y = Math.abs(Math.floor(y)); + + var index = this.getIndex(x, y); + + if (index > -1) + { + var imageData = this.context.getImageData(x, y, 1, 1); + + imageData.data[0] = red; + imageData.data[1] = green; + imageData.data[2] = blue; + imageData.data[3] = alpha; + + this.context.putImageData(imageData, x, y); + } + + return this; + }, + + /** + * Puts the ImageData into the context of this CanvasTexture at the given coordinates. + * + * @method Phaser.Textures.CanvasTexture#putData + * @since 3.16.0 + * + * @param {ImageData} imageData - The ImageData to put at the given location. + * @param {integer} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {integer} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. + * + * @return {this} This CanvasTexture. + */ + putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) + { + if (dirtyX === undefined) { dirtyX = 0; } + if (dirtyY === undefined) { dirtyY = 0; } + if (dirtyWidth === undefined) { dirtyWidth = imageData.width; } + if (dirtyHeight === undefined) { dirtyHeight = imageData.height; } + + this.context.putImageData(imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight); + + return this; + }, + + /** + * Gets an ImageData region from this CanvasTexture from the position and size specified. + * You can write this back using `CanvasTexture.putData`, or manipulate it. + * + * @method Phaser.Textures.CanvasTexture#getData + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {integer} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. + * + * @return {ImageData} The ImageData extracted from this CanvasTexture. + */ + getData: function (x, y, width, height) + { + x = Clamp(Math.floor(x), 0, this.width - 1); + y = Clamp(Math.floor(y), 0, this.height - 1); + width = Clamp(width, 1, this.width - x); + height = Clamp(height, 1, this.height - y); + + var imageData = this.context.getImageData(x, y, width, height); + + return imageData; + }, + /** * Get the color of a specific pixel from this texture and store it in a Color object. * @@ -157445,9 +164711,9 @@ var CanvasTexture = new Class({ * @method Phaser.Textures.CanvasTexture#getPixel * @since 3.13.0 * - * @param {integer} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {Phaser.Display.Color} [out] - An object into which 4 properties will be set: r, g, b and a. If not provided a Color object will be created. + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. * * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. */ @@ -157458,16 +164724,115 @@ var CanvasTexture = new Class({ out = new Color(); } - var index = ~~(x + (y * this.width)); + var index = this.getIndex(x, y); - index *= 4; + if (index > -1) + { + var data = this.data; - var r = this.data[index]; - var g = this.data[++index]; - var b = this.data[++index]; - var a = this.data[++index]; + var r = data[index + 0]; + var g = data[index + 1]; + var b = data[index + 2]; + var a = data[index + 3]; - return out.setTo(r, g, b, a); + out.setTo(r, g, b, a); + } + + return out; + }, + + /** + * An object containing the position and color data for a single pixel in a CanvasTexture. + * + * @typedef {object} PixelConfig + * + * @property {integer} x - The x-coordinate of the pixel. + * @property {integer} y - The y-coordinate of the pixel. + * @property {integer} color - The color of the pixel, not including the alpha channel. + * @property {float} alpha - The alpha of the pixel, between 0 and 1. + */ + + /** + * Returns an array containing all of the pixels in the given region. + * + * If the requested region extends outside the bounds of this CanvasTexture, + * the region is truncated to fit. + * + * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, + * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. + * + * @method Phaser.Textures.CanvasTexture#getPixels + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} width - The width of the region to get. Must be an integer. + * @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. + * + * @return {PixelConfig[]} An array of Pixel objects. + */ + getPixels: function (x, y, width, height) + { + if (height === undefined) { height = width; } + + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); + + var left = Clamp(x, 0, this.width); + var right = Clamp(x + width, 0, this.width); + var top = Clamp(y, 0, this.height); + var bottom = Clamp(y + height, 0, this.height); + + var pixel = new Color(); + + var out = []; + + for (var py = top; py < bottom; py++) + { + var row = []; + + for (var px = left; px < right; px++) + { + pixel = this.getPixel(px, py, pixel); + + row.push({ x: px, y: py, color: pixel.color, alpha: pixel.alphaGL }); + } + + out.push(row); + } + + return out; + }, + + /** + * Returns the Image Data index for the given pixel in this CanvasTexture. + * + * The index can be used to read directly from the `this.data` array. + * + * The index points to the red value in the array. The subsequent 3 indexes + * point to green, blue and alpha respectively. + * + * @method Phaser.Textures.CanvasTexture#getIndex + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @return {integer} + */ + getIndex: function (x, y) + { + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); + + if (x < this.width && y < this.height) + { + return (x + y * this.width) * 4; + } + else + { + return -1; + } }, /** @@ -157514,16 +164879,27 @@ var CanvasTexture = new Class({ }, /** - * Clears this Canvas Texture, resetting it back to transparent. + * Clears the given region of this Canvas Texture, resetting it back to transparent. + * If no region is given, the whole Canvas Texture is cleared. * * @method Phaser.Textures.CanvasTexture#clear * @since 3.7.0 + * + * @param {integer} [x=0] - The x coordinate of the top-left of the region to clear. + * @param {integer} [y=0] - The y coordinate of the top-left of the region to clear. + * @param {integer} [width] - The width of the region. + * @param {integer} [height] - The height of the region. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ - clear: function () + clear: function (x, y, width, height) { - this.context.clearRect(0, 0, this.width, this.height); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + + this.context.clearRect(x, y, width, height); return this.update(); }, @@ -157561,6 +164937,25 @@ var CanvasTexture = new Class({ } return this; + }, + + /** + * Destroys this Texture and releases references to its sources and frames. + * + * @method Phaser.Textures.CanvasTexture#destroy + * @since 3.16.0 + */ + destroy: function () + { + Texture.prototype.destroy.call(this); + + this._source = null; + this.canvas = null; + this.context = null; + this.imageData = null; + this.data = null; + this.pixels = null; + this.buffer = null; } }); @@ -157569,12 +164964,633 @@ module.exports = CanvasTexture; /***/ }), -/* 960 */ +/* 999 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Volume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their volume changes. + * + * Listen to it from a Sound instance using `Sound.on('volume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('volume', listener); + * music.play(); + * music.setVolume(0.5); + * ``` + * + * @event Phaser.Sound.Events#VOLUME + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} volume - The new volume of the Sound. + */ +module.exports = 'volume'; + + +/***/ }), +/* 1000 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Unlocked Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched during the update loop when the Sound Manager becomes unlocked. For + * Web Audio this is on the first user gesture on the page. + * + * Listen to it from a Scene using: `this.sound.on('unlocked', listener)`. + * + * @event Phaser.Sound.Events#UNLOCKED + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'unlocked'; + + +/***/ }), +/* 1001 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Stop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are stopped. + * + * Listen to it from a Sound instance using `Sound.on('stop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('stop', listener); + * music.play(); + * music.stop(); + * ``` + * + * @event Phaser.Sound.Events#STOP + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'stop'; + + +/***/ }), +/* 1002 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Stop All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `stopAll` method is invoked and after all current Sounds + * have been stopped. + * + * Listen to it from a Scene using: `this.sound.on('stopall', listener)`. + * + * @event Phaser.Sound.Events#STOP_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'stopall'; + + +/***/ }), +/* 1003 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Seek Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are seeked to a new position. + * + * Listen to it from a Sound instance using `Sound.on('seek', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('seek', listener); + * music.play(); + * music.setSeek(5000); + * ``` + * + * @event Phaser.Sound.Events#SEEK + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'seek'; + + +/***/ }), +/* 1004 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Resume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are resumed from a paused state. + * + * Listen to it from a Sound instance using `Sound.on('resume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('resume', listener); + * music.play(); + * music.pause(); + * music.resume(); + * ``` + * + * @event Phaser.Sound.Events#RESUME + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'resume'; + + +/***/ }), +/* 1005 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `resumeAll` method is invoked and after all current Sounds + * have been resumed. + * + * Listen to it from a Scene using: `this.sound.on('resumeall', listener)`. + * + * @event Phaser.Sound.Events#RESUME_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'resumeall'; + + +/***/ }), +/* 1006 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Rate Change Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their rate changes. + * + * Listen to it from a Sound instance using `Sound.on('rate', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('rate', listener); + * music.play(); + * music.setRate(0.5); + * ``` + * + * @event Phaser.Sound.Events#RATE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} rate - The new rate of the Sound. + */ +module.exports = 'rate'; + + +/***/ }), +/* 1007 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Play Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are played. + * + * Listen to it from a Sound instance using `Sound.on('play', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('play', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#PLAY + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'play'; + + +/***/ }), +/* 1008 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Pause Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are paused. + * + * Listen to it from a Sound instance using `Sound.on('pause', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('pause', listener); + * music.play(); + * music.pause(); + * ``` + * + * @event Phaser.Sound.Events#PAUSE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'pause'; + + +/***/ }), +/* 1009 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `pauseAll` method is invoked and after all current Sounds + * have been paused. + * + * Listen to it from a Scene using: `this.sound.on('pauseall', listener)`. + * + * @event Phaser.Sound.Events#PAUSE_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'pauseall'; + + +/***/ }), +/* 1010 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Mute Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their mute state changes. + * + * Listen to it from a Sound instance using `Sound.on('mute', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('mute', listener); + * music.play(); + * music.setMute(true); + * ``` + * + * @event Phaser.Sound.Events#MUTE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound is now muted, otherwise `false`. + */ +module.exports = 'mute'; + + +/***/ }), +/* 1011 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Looped Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they loop during playback. + * + * Listen to it from a Sound instance using `Sound.on('looped', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('looped', listener); + * music.setLoop(true); + * music.play(); + * ``` + * + * This is not to be confused with the [LOOP]{@linkcode Phaser.Sound.Events#event:LOOP} event, which only emits when the loop state of a Sound is changed. + * + * @event Phaser.Sound.Events#LOOPED + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'looped'; + + +/***/ }), +/* 1012 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Loop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their loop state is changed. + * + * Listen to it from a Sound instance using `Sound.on('loop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('loop', listener); + * music.setLoop(true); + * ``` + * + * This is not to be confused with the [LOOPED]{@linkcode Phaser.Sound.Events#event:LOOPED} event, which emits each time a Sound loops during playback. + * + * @event Phaser.Sound.Events#LOOP + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} loop - The new loop value. `true` if the Sound will loop, otherwise `false`. + */ +module.exports = 'loop'; + + +/***/ }), +/* 1013 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Volume Event. + * + * This event is dispatched by the Sound Manager when its `volume` property is changed, either directly + * or via the `setVolume` method. This changes the volume of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('volume', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_VOLUME + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {number} volume - The new global volume of the Sound Manager. + */ +module.exports = 'volume'; + + +/***/ }), +/* 1014 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Rate Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `rate` property of the Sound Manager is changed, which globally + * adjusts the playback rate of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_RATE + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} rate - The updated rate value. + */ +module.exports = 'rate'; + + +/***/ }), +/* 1015 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Mute Event. + * + * This event is dispatched by the Sound Manager when its `mute` property is changed, either directly + * or via the `setMute` method. This changes the mute state of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('mute', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_MUTE + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. + */ +module.exports = 'mute'; + + +/***/ }), +/* 1016 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Detune Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `detune` property of the Sound Manager is changed, which globally + * adjusts the detuning of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_DETUNE + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} detune - The updated detune value. + */ +module.exports = 'detune'; + + +/***/ }), +/* 1017 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Detune Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their detune value changes. + * + * Listen to it from a Sound instance using `Sound.on('detune', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('detune', listener); + * music.play(); + * music.setDetune(200); + * ``` + * + * @event Phaser.Sound.Events#DETUNE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'detune'; + + +/***/ }), +/* 1018 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Destroy Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are destroyed, either + * directly or via a Sound Manager. + * + * Listen to it from a Sound instance using `Sound.on('destroy', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('destroy', listener); + * music.destroy(); + * ``` + * + * @event Phaser.Sound.Events#DESTROY + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1019 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Complete Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they complete playback. + * + * Listen to it from a Sound instance using `Sound.on('complete', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('complete', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#COMPLETE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'complete'; + + +/***/ }), +/* 1020 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157596,6 +165612,7 @@ var InjectionMap = { cache: 'cache', plugins: 'plugins', registry: 'registry', + scale: 'scale', sound: 'sound', textures: 'textures', @@ -157631,12 +165648,12 @@ module.exports = InjectionMap; /***/ }), -/* 961 */ +/* 1021 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157648,9 +165665,9 @@ var GetFastValue = __webpack_require__(1); * @function Phaser.Scenes.GetScenePlugins * @since 3.0.0 * - * @param {Phaser.Scenes.Systems} sys - [description] + * @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins. * - * @return {array} [description] + * @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object. */ var GetScenePlugins = function (sys) { @@ -157678,17 +165695,17 @@ module.exports = GetScenePlugins; /***/ }), -/* 962 */ +/* 1022 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = __webpack_require__(1); -var UppercaseFirst = __webpack_require__(356); +var UppercaseFirst = __webpack_require__(361); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -157740,137 +165757,5266 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 963 */ +/* 1023 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Start Event. + * + * This event is dispatched when the Loader starts running. At this point load progress is zero. + * + * This event is dispatched even if there aren't any files in the load queue. + * + * Listen to it from a Scene using: `this.load.on('start', listener)`. + * + * @event Phaser.Loader.Events#START + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'start'; + + +/***/ }), +/* 1024 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Progress Event. + * + * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading. + * + * Listen to it from a Scene using: `this.load.on('progress', listener)`. + * + * @event Phaser.Loader.Events#PROGRESS + * + * @param {number} progress - The current progress of the load. A value between 0 and 1. + */ +module.exports = 'progress'; + + +/***/ }), +/* 1025 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Post Process Event. + * + * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue. + * It is dispatched before the internal lists are cleared and each File is destroyed. + * + * Use this hook to perform any last minute processing of files that can only happen once the + * Loader has completed, but prior to it emitting the `complete` event. + * + * Listen to it from a Scene using: `this.load.on('postprocess', listener)`. + * + * @event Phaser.Loader.Events#POST_PROCESS + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'postprocess'; + + +/***/ }), +/* 1026 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Progress Event. + * + * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and + * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen. + * + * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`. + * + * @event Phaser.Loader.Events#FILE_PROGRESS + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + * @param {number} percentComplete - A value between 0 and 1 indicating how 'complete' this file is. + */ +module.exports = 'fileprogress'; + + +/***/ }), +/* 1027 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Event. + * + * This event is dispatched by the Loader Plugin when a file finishes loading, + * but _before_ it is processed and added to the internal Phaser caches. + * + * Listen to it from a Scene using: `this.load.on('load', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD + * + * @param {Phaser.Loader.File} file - A reference to the File which just finished loading. + */ +module.exports = 'load'; + + +/***/ }), +/* 1028 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Error Event. + * + * This event is dispatched by the Loader Plugin when a file fails to load. + * + * Listen to it from a Scene using: `this.load.on('loaderror', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD_ERROR + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + */ +module.exports = 'loaderror'; + + +/***/ }), +/* 1029 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * It uses a special dynamic event name constructed from the key and type of the file. + * + * For example, if you have loaded an `image` with a key of `monster`, you can listen for it + * using the following: + * + * ```javascript + * this.load.on('filecomplete-image-monster', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a texture `atlas` with a key of `Level1`: + * + * ```javascript + * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: + * + * ```javascript + * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_KEY_COMPLETE + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete-'; + + +/***/ }), +/* 1030 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`. + * + * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_COMPLETE + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete'; + + +/***/ }), +/* 1031 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Complete Event. + * + * This event is dispatched when the Loader has fully processed everything in the load queue. + * By this point every loaded file will now be in its associated cache and ready for use. + * + * Listen to it from a Scene using: `this.load.on('complete', listener)`. + * + * @event Phaser.Loader.Events#COMPLETE + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {integer} totalComplete - The total number of files that successfully loaded. + * @param {integer} totalFailed - The total number of files that failed to load. + */ +module.exports = 'complete'; + + +/***/ }), +/* 1032 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Add File Event. + * + * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue. + * + * Listen to it from a Scene using: `this.load.on('addfile', listener)`. + * + * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them. + * + * @event Phaser.Loader.Events#ADD + * + * @param {string} key - The unique key of the file that was added to the Loader. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} string of the file that was added to the Loader, i.e. `image`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {Phaser.Loader.File} file - A reference to the File which was added to the Loader. + */ +module.exports = 'addfile'; + + +/***/ }), +/* 1033 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetInnerHeight = function (iOS) +{ + // Based on code by @tylerjpeterson + + if (!iOS) + { + return window.innerHeight; + } + + var axis = Math.abs(window.orientation); + + var size = { w: 0, h: 0 }; + + var ruler = document.createElement('div'); + + ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); + + document.documentElement.appendChild(ruler); + + size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; + size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; + + document.documentElement.removeChild(ruler); + + ruler = null; + + if (Math.abs(window.orientation) !== 90) + { + return size.h; + } + else + { + return size.w; + } +}; + +module.exports = GetInnerHeight; + + +/***/ }), +/* 1034 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * This event is dispatched whenever the Scale Manager detects a resize event from the browser. + * It sends three parameters to the callback, each of them being Size components. You can read + * the `width`, `height`, `aspectRatio` and other properties of these components to help with + * scaling your own game content. + * + * @event Phaser.Scale.Events#RESIZE + * + * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size multiplied by resolution. + * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. + */ +module.exports = 'resize'; + + +/***/ }), +/* 1035 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#ORIENTATION_CHANGE + * + * @param {string} orientation - + */ +module.exports = 'orientationchange'; + + +/***/ }), +/* 1036 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#LEAVE_FULLSCREEN + */ +module.exports = 'leavefullscreen'; + + +/***/ }), +/* 1037 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + */ +module.exports = 'fullscreenunsupported'; + + +/***/ }), +/* 1038 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#ENTER_FULLSCREEN + */ +module.exports = 'enterfullscreen'; + + +/***/ }), +/* 1039 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `update` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#UPDATE + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; + + +/***/ }), +/* 1040 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Start Event. + * + * This internal event is dispatched by the Input Plugin when it has finished setting-up, + * signalling to all of its internal systems to start. + * + * @event Phaser.Input.Events#START + */ +module.exports = 'start'; + + +/***/ }), +/* 1041 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Shutdown Event. + * + * This internal event is dispatched by the Input Plugin when it shuts down, signalling to all of its systems to shut themselves down. + * + * @event Phaser.Input.Events#SHUTDOWN + */ +module.exports = 'shutdown'; + + +/***/ }), +/* 1042 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Pre-Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `preUpdate` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#PRE_UPDATE + */ +module.exports = 'preupdate'; + + +/***/ }), +/* 1043 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Pointer Lock Change Event. + * + * This event is dispatched by the Input Manager when it is processing a native Pointer Lock Change DOM Event. + * + * @event Phaser.Input.Events#POINTERLOCK_CHANGE + * + * @param {Event} event - The native DOM Event. + * @param {boolean} locked - The locked state of the Mouse Pointer. + */ +module.exports = 'pointerlockchange'; + + +/***/ }), +/* 1044 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerupoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP_OUTSIDE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerupoutside'; + + +/***/ }), +/* 1045 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerup'; + + +/***/ }), +/* 1046 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerover', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOver - An array containing all interactive Game Objects that the pointer moved over when the event was created. + */ +module.exports = 'pointerover'; + + +/***/ }), +/* 1047 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOut - An array containing all interactive Game Objects that the pointer moved out of when the event was created. + */ +module.exports = 'pointerout'; + + +/***/ }), +/* 1048 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointermove', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointermove'; + + +/***/ }), +/* 1049 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdownoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN_OUTSIDE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerdownoutside'; + + +/***/ }), +/* 1050 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdown', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerdown'; + + +/***/ }), +/* 1051 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Update Event. + * + * This internal event is dispatched by the Input Manager as part of its update step. + * + * @event Phaser.Input.Events#MANAGER_UPDATE + */ +module.exports = 'update'; + + +/***/ }), +/* 1052 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Process Event. + * + * This internal event is dispatched by the Input Manager when not using the legacy queue system, + * and it wants the Input Plugins to update themselves. + * + * @event Phaser.Input.Events#MANAGER_PROCESS + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'process'; + + +/***/ }), +/* 1053 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Boot Event. + * + * This internal event is dispatched by the Input Manager when it boots. + * + * @event Phaser.Input.Events#MANAGER_BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 1054 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released while over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectup', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when released. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectup'; + + +/***/ }), +/* 1055 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Up Event. + * + * This event is dispatched by an interactive Game Object if a pointer is released while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerup', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerup'; + + +/***/ }), +/* 1056 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerover'; + + +/***/ }), +/* 1057 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Out Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves out of it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerout', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerout'; + + +/***/ }), +/* 1058 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Move Event. + * + * This event is dispatched by an interactive Game Object if a pointer is moved while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointermove', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointermove'; + + +/***/ }), +/* 1059 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Down Event. + * + * This event is dispatched by an interactive Game Object if a pointer is pressed down on it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerdown', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerdown'; + + +/***/ }), +/* 1060 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectover', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved over. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectover'; + + +/***/ }), +/* 1061 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectout', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved out of. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectout'; + + +/***/ }), +/* 1062 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved across _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectmove', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was moved on. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectmove'; + + +/***/ }), +/* 1063 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drop Event. + * + * This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target. + * + * Listen to this event from a Game Object using: `gameObject.on('drop', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DROP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; + + +/***/ }), +/* 1064 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Start Event. + * + * This event is dispatched by an interactive Game Object if a pointer starts to drag it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragstart', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * There are lots of useful drag related properties that are set within the Game Object when dragging occurs. + * For example, `gameObject.input.dragStartX`, `dragStartY` and so on. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_START + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 1065 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it over a drag target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from a Game Object using: `gameObject.on('dragover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; + + +/***/ }), +/* 1066 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Leave Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragleave', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; + + +/***/ }), +/* 1067 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves while dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('drag', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; + + +/***/ }), +/* 1068 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Enter Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it into a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragenter', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; + + +/***/ }), +/* 1069 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag End Event. + * + * This event is dispatched by an interactive Game Object if a pointer stops dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragend', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive](Phaser.GameObjects.GameObject#setInteractive) for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_END + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer stopped dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer stopped dragging the Game Object, in world space. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 1070 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down on _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectdown', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was pressed down on. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectdown'; + + +/***/ }), +/* 1071 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Over Event. + * + * This event is dispatched by the Input Plugin if the active pointer enters the game canvas and is now + * over of it, having previously been elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameover', listener)`. + * + * @event Phaser.Input.Events#GAME_OVER + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas over. + */ +module.exports = 'gameover'; + + +/***/ }), +/* 1072 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Out Event. + * + * This event is dispatched by the Input Plugin if the active pointer leaves the game canvas and is now + * outside of it, elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameout', listener)`. + * + * @event Phaser.Input.Events#GAME_OUT + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas out. + */ +module.exports = 'gameout'; + + +/***/ }), +/* 1073 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drop Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drops a Game Object on a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('drop', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DROP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DROP} event instead. + * + * @event Phaser.Input.Events#DROP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer was dragging. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; + + +/***/ }), +/* 1074 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Start Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer starts to drag any Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragstart', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_START]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_START} event instead. + * + * @event Phaser.Input.Events#DRAG_START + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 1075 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object over a Drag Target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from within a Scene using: `this.input.on('dragover', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_OVER} event instead. + * + * @event Phaser.Input.Events#DRAG_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; + + +/***/ }), +/* 1076 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Leave Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object out of a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragleave', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_LEAVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_LEAVE} event instead. + * + * @event Phaser.Input.Events#DRAG_LEAVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; + + +/***/ }), +/* 1077 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves while dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('drag', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG} event instead. + * + * @event Phaser.Input.Events#DRAG + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; + + +/***/ }), +/* 1078 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Enter Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object into a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragenter', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_ENTER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_ENTER} event instead. + * + * @event Phaser.Input.Events#DRAG_ENTER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; + + +/***/ }), +/* 1079 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag End Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer stops dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragend', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_END]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_END} event instead. + * + * @event Phaser.Input.Events#DRAG_END + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer stopped dragging. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 1080 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Destroy Event. + * + * This internal event is dispatched by the Input Plugin when it is destroyed, signalling to all of its systems to destroy themselves. + * + * @event Phaser.Input.Events#DESTROY + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1081 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Boot Event. + * + * This internal event is dispatched by the Input Plugin when it boots, signalling to all of its systems to create themselves. + * + * @event Phaser.Input.Events#BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 1082 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(28); +var AddToDOM = __webpack_require__(197); +var AnimationManager = __webpack_require__(453); +var CacheManager = __webpack_require__(450); +var CanvasPool = __webpack_require__(26); +var Class = __webpack_require__(0); +var Config = __webpack_require__(428); +var CreateRenderer = __webpack_require__(405); +var DataManager = __webpack_require__(109); +var DebugHeader = __webpack_require__(396); +var Device = __webpack_require__(427); +var DOMContentLoaded = __webpack_require__(382); +var EventEmitter = __webpack_require__(9); +var Events = __webpack_require__(28); +var InputManager = __webpack_require__(373); +var PluginCache = __webpack_require__(17); +var PluginManager = __webpack_require__(367); +var ScaleManager = __webpack_require__(366); +var SceneManager = __webpack_require__(363); +var SoundManagerCreator = __webpack_require__(359); +var TextureEvents = __webpack_require__(136); +var TextureManager = __webpack_require__(352); +var TimeStep = __webpack_require__(395); +var VisibilityHandler = __webpack_require__(393); + +if (false) +{ var CreateDOMContainer; } + +if (true) +{ + var FacebookInstantGamesPlugin = __webpack_require__(349); +} /** - * Called automatically by Phaser.Game and responsible for creating the console.log debug header. + * @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 can customize or disable the header via the Game Config object. + * 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. * - * @function Phaser.Boot.DebugHeader + * @class Game + * @memberof Phaser + * @constructor + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE * @since 3.0.0 * - * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. + * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. */ -var DebugHeader = function (game) -{ - var config = game.config; +var Game = new Class({ - if (config.hideBanner) + initialize: + + function Game (config) { - return; - } + /** + * 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.Core.Config} + * @readonly + * @since 3.0.0 + */ + this.config = new Config(config); - var renderType = 'WebGL'; + /** + * 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; - if (config.renderType === CONST.CANVAS) - { - renderType = 'Canvas'; - } - else if (config.renderType === CONST.HEADLESS) - { - renderType = 'Headless'; - } + if (false) + {} - var audioConfig = config.audio; - var deviceAudio = game.device.audio; + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * This is created automatically by Phaser unless you provide a `canvas` property + * in your Game Config. + * + * @name Phaser.Game#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = null; - var audioType; + /** + * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. + * If the game is running under Canvas it will be a 2d Canvas Rendering Context. + * If the game is running under WebGL it will be a WebGL Rendering Context. + * This context is created automatically by Phaser unless you provide a `context` property + * in your Game Config. + * + * @name Phaser.Game#context + * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} + * @since 3.0.0 + */ + this.context = null; - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) - { - audioType = 'Web Audio'; - } - else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) - { - audioType = 'No Audio'; - } - else - { - audioType = 'HTML5 Audio'; - } + /** + * 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; - if (!game.device.browser.ie) - { - var c = ''; - var args = [ c ]; + /** + * 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; - if (Array.isArray(config.bannerBackgroundColor)) + /** + * An Event Emitter which is used to broadcast game-level events from the global systems. + * + * @name Phaser.Game#events + * @type {Phaser.Events.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); + + /** + * An instance of the Data Manager + * + * @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); + + /** + * 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.DeviceConf} + * @since 3.0.0 + */ + this.device = Device; + + /** + * An instance of the Scale Manager. + * + * The Scale Manager is a global system responsible for handling scaling of the game canvas. + * + * @name Phaser.Game#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scale = new ScaleManager(this, this.config); + + /** + * 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.Sound.BaseSoundManager} + * @since 3.0.0 + */ + this.sound = SoundManagerCreator.create(this); + + /** + * 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.Core.TimeStep} + * @since 3.0.0 + */ + this.loop = new TimeStep(this, this.config.fps); + + /** + * 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.Plugins.PluginManager} + * @since 3.0.0 + */ + this.plugins = new PluginManager(this, this.config); + + if (true) { - var lastColor; + /** + * An instance of the Facebook Instant Games Plugin. + * + * This will only be available if the plugin has been built into Phaser, + * or you're using the special Facebook Instant Games custom build. + * + * @name Phaser.Game#facebook + * @type {Phaser.FacebookInstantGamesPlugin} + * @since 3.13.0 + */ + this.facebook = new FacebookInstantGamesPlugin(this); + } - config.bannerBackgroundColor.forEach(function (color) - { - c = c.concat('%c '); + /** + * Is this Game pending destruction at the start of the next frame? + * + * @name Phaser.Game#pendingDestroy + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.pendingDestroy = false; - args.push('background: ' + color); + /** + * Remove the Canvas once the destroy is over? + * + * @name Phaser.Game#removeCanvas + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.removeCanvas = false; - lastColor = color; + /** + * Remove everything when the game is destroyed. + * You cannot create a new Phaser instance on the same web page after doing this. + * + * @name Phaser.Game#noReturn + * @type {boolean} + * @private + * @since 3.12.0 + */ + this.noReturn = false; - }); + /** + * Does the window the game is running in currently have focus or not? + * This is modified by the VisibilityHandler. + * + * @name Phaser.Game#hasFocus + * @type {boolean} + * @readonly + * @since 3.9.0 + */ + this.hasFocus = false; - // inject the text color - args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + // Wait for the DOM Ready event, then call boot. + DOMContentLoaded(this.boot.bind(this)); + }, + + /** + * 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.Core.Events#BOOT + * @listens Phaser.Textures.Events#READY + * @since 3.0.0 + */ + boot: function () + { + if (!PluginCache.hasCore('EventEmitter')) + { + console.warn('Aborting. Core Plugins missing.'); + return; + } + + this.isBooted = true; + + this.config.preBoot(this); + + this.scale.preBoot(); + + CreateRenderer(this); + + if (false) + {} + + DebugHeader(this); + + AddToDOM(this.canvas, this.config.parent); + + // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready. + // So it will emit this internal event when done: + this.textures.once(TextureEvents.READY, this.texturesReady, this); + + this.events.emit(Events.BOOT); + }, + + /** + * Called automatically when the Texture Manager has finished setting up and preparing the + * default textures. + * + * @method Phaser.Game#texturesReady + * @private + * @fires Phaser.Game#ready + * @since 3.12.0 + */ + texturesReady: function () + { + // Start all the other systems + this.events.emit(Events.READY); + + this.start(); + }, + + /** + * 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; + + this.config.postBoot(this); + + if (this.renderer) + { + this.loop.start(this.step.bind(this)); } else { - c = c.concat('%c '); - - args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + this.loop.start(this.headlessStep.bind(this)); } - // URL link background color (always white) - args.push('background: #fff'); + VisibilityHandler(this); - if (config.gameTitle) - { - c = c.concat(config.gameTitle); + var eventEmitter = this.events; - if (config.gameVersion) - { - c = c.concat(' v' + config.gameVersion); - } + eventEmitter.on(Events.HIDDEN, this.onHidden, this); + eventEmitter.on(Events.VISIBLE, this.onVisible, this); + eventEmitter.on(Events.BLUR, this.onBlur, this); + eventEmitter.on(Events.FOCUS, this.onFocus, this); + }, - if (!config.hidePhaser) - { - c = c.concat(' / '); - } - } - - var fb = ( true) ? '-FB' : undefined; - - if (!config.hidePhaser) - { - c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); - } - - c = c.concat(' %c ' + config.gameURL); - - // Inject the new string back into the args array - args[0] = c; - - console.log.apply(console, args); - } - else if (window['console']) + /** + * 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.Core.Events#PRE_STEP_EVENT + * @fires Phaser.Core.Events#STEP_EVENT + * @fires Phaser.Core.Events#POST_STEP_EVENT + * @fires Phaser.Core.Events#PRE_RENDER_EVENT + * @fires Phaser.Core.Events#POST_RENDER_EVENT + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + step: function (time, delta) { - console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); - } -}; + if (this.pendingDestroy) + { + return this.runDestroy(); + } -module.exports = DebugHeader; + var eventEmitter = this.events; + + // Global Managers like Input and Sound update in the prestep + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + // This is mostly meant for user-land code and plugins + + eventEmitter.emit(Events.STEP, time, delta); + + // Update the Scene Manager and all active Scenes + + this.scene.update(time, delta); + + // Our final event before rendering starts + + eventEmitter.emit(Events.POST_STEP, time, delta); + + var renderer = this.renderer; + + // Run the Pre-render (clearing the canvas, setting background colors, etc) + + renderer.preRender(); + + eventEmitter.emit(Events.PRE_RENDER, renderer, time, delta); + + // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. + + this.scene.render(renderer); + + // The Post-Render call. Tidies up loose end, takes snapshots, etc. + + renderer.postRender(); + + // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. + + eventEmitter.emit(Events.POST_RENDER, renderer, time, delta); + }, + + /** + * 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 {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + headlessStep: function (time, delta) + { + var eventEmitter = this.events; + + // Global Managers + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + eventEmitter.emit(Events.STEP, time, delta); + + // Scenes + + this.scene.update(time, delta); + + eventEmitter.emit(Events.POST_STEP, time, delta); + + // Render + + eventEmitter.emit(Events.PRE_RENDER); + + eventEmitter.emit(Events.POST_RENDER); + }, + + /** + * 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.Core.Events#PAUSE + * @since 3.0.0 + */ + onHidden: function () + { + this.loop.pause(); + + this.events.emit(Events.PAUSE); + }, + + /** + * Called automatically by the Visibility Handler. + * This will resume the main loop and then emit a resume event. + * + * @method Phaser.Game#onVisible + * @protected + * @fires Phaser.Core.Events#RESUME + * @since 3.0.0 + */ + onVisible: function () + { + this.loop.resume(); + + this.events.emit(Events.RESUME); + }, + + /** + * 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.hasFocus = false; + + this.loop.blur(); + }, + + /** + * 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.hasFocus = true; + + this.loop.focus(); + }, + + /** + * Returns the current game frame. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * + * @method Phaser.Game#getFrame + * @since 3.16.0 + * + * @return {number} The current game frame. + */ + getFrame: function () + { + return this.loop.frame; + }, + + /** + * Returns the current game timestamp. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * + * @method Phaser.Game#getTime + * @since 3.16.0 + * + * @return {number} The current game timestamp. + */ + getTime: function () + { + return this.loop.frame.time; + }, + + /** + * Flags this Game instance as needing to be destroyed on the next frame. + * It will wait until the current frame has completed and then call `runDestroy` internally. + * + * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up + * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. + * + * @method Phaser.Game#destroy + * @fires Phaser.Core.Events#DESTROY + * @since 3.0.0 + * + * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. + * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. + */ + destroy: function (removeCanvas, noReturn) + { + if (noReturn === undefined) { noReturn = false; } + + this.pendingDestroy = true; + + this.removeCanvas = removeCanvas; + this.noReturn = noReturn; + }, + + /** + * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * + * @method Phaser.Game#runDestroy + * @private + * @since 3.5.0 + */ + runDestroy: function () + { + this.events.emit(Events.DESTROY); + + this.events.removeAllListeners(); + + this.scene.destroy(); + + if (this.renderer) + { + this.renderer.destroy(); + } + + if (this.removeCanvas && this.canvas) + { + CanvasPool.remove(this.canvas); + + if (this.canvas.parentNode) + { + this.canvas.parentNode.removeChild(this.canvas); + } + } + + if (false) + {} + + this.loop.destroy(); + + this.pendingDestroy = false; + } + +}); + +module.exports = Game; + +/** + * "Computers are good at following instructions, but not at reading your mind." - Donald Knuth + */ /***/ }), -/* 964 */ +/* 1083 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var EE = __webpack_require__(9); +var PluginCache = __webpack_require__(17); + +/** + * @classdesc + * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. + * + * @class EventEmitter + * @memberof Phaser.Events + * @constructor + * @since 3.0.0 + */ +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 () + { + this.removeAllListeners(); + } + +}); + +/** + * Return an array listing the events for which the emitter has registered listeners. + * + * @method Phaser.Events.EventEmitter#eventNames + * @since 3.0.0 + * + * @return {array} + */ + +/** + * Return the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#listeners + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {array} The registered listeners. + */ + +/** + * Return the number of listeners listening to a given event. + * + * @method Phaser.Events.EventEmitter#listenerCount + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {number} The number of listeners. + */ + +/** + * Calls each of the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#emit + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {...*} [args] - Additional arguments that will be passed to the event handler. + * + * @return {boolean} `true` if the event had listeners, else `false`. + */ + +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#on + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#addListener + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Add a one-time listener for a given event. + * + * @method Phaser.Events.EventEmitter#once + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#removeListener + * @since 3.0.0 + * + * @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 {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#off + * @since 3.0.0 + * + * @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 {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove all listeners, or those of the specified event. + * + * @method Phaser.Events.EventEmitter#removeAllListeners + * @since 3.0.0 + * + * @param {(string|symbol)} [event] - The event name. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +PluginCache.register('EventEmitter', EventEmitter, 'events'); + +module.exports = EventEmitter; + + +/***/ }), +/* 1084 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Events + */ + +module.exports = { EventEmitter: __webpack_require__(1083) }; + + +/***/ }), +/* 1085 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.DOM + */ + +var Dom = { + + AddToDOM: __webpack_require__(197), + DOMContentLoaded: __webpack_require__(382), + GetScreenOrientation: __webpack_require__(381), + GetTarget: __webpack_require__(376), + ParseXML: __webpack_require__(375), + RemoveFromDOM: __webpack_require__(374), + RequestAnimationFrame: __webpack_require__(394) + +}; + +module.exports = Dom; + + +/***/ }), +/* 1086 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Masks + */ + +module.exports = { + + BitmapMask: __webpack_require__(464), + GeometryMask: __webpack_require__(463) + +}; + + +/***/ }), +/* 1087 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ComponentToHex = __webpack_require__(384); + +/** + * 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 (prefix === '#') + { + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + } + else + { + return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + } +}; + +module.exports = RGBToString; + + +/***/ }), +/* 1088 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Between = __webpack_require__(204); +var Color = __webpack_require__(37); + +/** + * 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; } + + return new Color(Between(min, max), Between(min, max), Between(min, max)); +}; + +module.exports = RandomRGB; + + +/***/ }), +/* 1089 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Linear = __webpack_require__(139); + +/** + * @namespace Phaser.Display.Color.Interpolate + * @memberof Phaser.Display.Color + * @since 3.0.0 + */ + +/** + * Interpolates between the two given color ranges over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + var t = index / length; + + return { + r: Linear(r1, r2, t), + g: Linear(g1, g2, t), + b: Linear(b1, b2, t) + }; +}; + +/** + * Interpolates between the two given color objects over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + 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 + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); +}; + +module.exports = { + + RGBWithRGB: RGBWithRGB, + ColorWithRGB: ColorWithRGB, + ColorWithColor: ColorWithColor + +}; + + +/***/ }), +/* 1090 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var HSVToRGB = __webpack_require__(210); + +/** + * 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 {ColorObject[]} 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++) + { + colors.push(HSVToRGB(c / 359, s, v)); + } + + return colors; +}; + +module.exports = HSVColorWheel; + + +/***/ }), +/* 1091 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Color = __webpack_require__(37); +var HueToComponent = __webpack_require__(383); + +/** + * 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 q = (l < 0.5) ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + + r = HueToComponent(p, q, h + 1 / 3); + g = HueToComponent(p, q, h); + b = HueToComponent(p, q, h - 1 / 3); + } + + var color = new Color(); + + return color.setGLTo(r, g, b, 1); +}; + +module.exports = HSLToColor; + + +/***/ }), +/* 1092 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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) + { + output.a = color >>> 24; + } + + return output; +}; + +module.exports = ColorToRGBA; + + +/***/ }), +/* 1093 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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'; } + + var vendors = [ + '-webkit-', + '-khtml-', + '-moz-', + '-ms-', + '' + ]; + + vendors.forEach(function (vendor) + { + canvas.style[vendor + 'user-select'] = value; + }); + + canvas.style['-webkit-touch-callout'] = value; + canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; + + return canvas; +}; + +module.exports = UserSelect; + + +/***/ }), +/* 1094 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = TouchAction; + + +/***/ }), +/* 1095 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Canvas + */ + +module.exports = { + + CanvasInterpolation: __webpack_require__(404), + CanvasPool: __webpack_require__(26), + Smoothing: __webpack_require__(140), + TouchAction: __webpack_require__(1094), + UserSelect: __webpack_require__(1093) + +}; + + +/***/ }), +/* 1096 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = GetOffsetY; + + +/***/ }), +/* 1097 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = GetOffsetX; + + +/***/ }), +/* 1098 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Bounds + */ + +module.exports = { + + CenterOn: __webpack_require__(483), + GetBottom: __webpack_require__(56), + GetCenterX: __webpack_require__(91), + GetCenterY: __webpack_require__(88), + GetLeft: __webpack_require__(54), + GetOffsetX: __webpack_require__(1097), + GetOffsetY: __webpack_require__(1096), + GetRight: __webpack_require__(52), + GetTop: __webpack_require__(50), + SetBottom: __webpack_require__(55), + SetCenterX: __webpack_require__(90), + SetCenterY: __webpack_require__(89), + SetLeft: __webpack_require__(53), + SetRight: __webpack_require__(51), + SetTop: __webpack_require__(49) + +}; + + +/***/ }), +/* 1099 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(52); +var GetTop = __webpack_require__(50); +var SetBottom = __webpack_require__(55); +var SetRight = __webpack_require__(51); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopRight; + + +/***/ }), +/* 1100 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetLeft = __webpack_require__(54); +var GetTop = __webpack_require__(50); +var SetBottom = __webpack_require__(55); +var SetLeft = __webpack_require__(53); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopLeft; + + +/***/ }), +/* 1101 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterX = __webpack_require__(91); +var GetTop = __webpack_require__(50); +var SetBottom = __webpack_require__(55); +var SetCenterX = __webpack_require__(90); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopCenter; + + +/***/ }), +/* 1102 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(52); +var GetTop = __webpack_require__(50); +var SetLeft = __webpack_require__(53); +var SetTop = __webpack_require__(49); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = RightTop; + + +/***/ }), +/* 1103 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterY = __webpack_require__(88); +var GetRight = __webpack_require__(52); +var SetCenterY = __webpack_require__(89); +var SetLeft = __webpack_require__(53); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = RightCenter; + + +/***/ }), +/* 1104 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(56); +var GetRight = __webpack_require__(52); +var SetBottom = __webpack_require__(55); +var SetLeft = __webpack_require__(53); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = RightBottom; + + +/***/ }), +/* 1105 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetLeft = __webpack_require__(54); +var GetTop = __webpack_require__(50); +var SetRight = __webpack_require__(51); +var SetTop = __webpack_require__(49); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = LeftTop; + + +/***/ }), +/* 1106 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterY = __webpack_require__(88); +var GetLeft = __webpack_require__(54); +var SetCenterY = __webpack_require__(89); +var SetRight = __webpack_require__(51); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftCenter; + + +/***/ }), +/* 1107 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(56); +var GetLeft = __webpack_require__(54); +var SetBottom = __webpack_require__(55); +var SetRight = __webpack_require__(51); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftBottom; + + +/***/ }), +/* 1108 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(56); +var GetRight = __webpack_require__(52); +var SetRight = __webpack_require__(51); +var SetTop = __webpack_require__(49); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomRight; + + +/***/ }), +/* 1109 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(56); +var GetLeft = __webpack_require__(54); +var SetLeft = __webpack_require__(53); +var SetTop = __webpack_require__(49); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomLeft; + + +/***/ }), +/* 1110 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(56); +var GetCenterX = __webpack_require__(91); +var SetCenterX = __webpack_require__(90); +var SetTop = __webpack_require__(49); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomCenter; + + +/***/ }), +/* 1111 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.To + */ + +module.exports = { + + BottomCenter: __webpack_require__(1110), + BottomLeft: __webpack_require__(1109), + BottomRight: __webpack_require__(1108), + LeftBottom: __webpack_require__(1107), + LeftCenter: __webpack_require__(1106), + LeftTop: __webpack_require__(1105), + RightBottom: __webpack_require__(1104), + RightCenter: __webpack_require__(1103), + RightTop: __webpack_require__(1102), + TopCenter: __webpack_require__(1101), + TopLeft: __webpack_require__(1100), + TopRight: __webpack_require__(1099) + +}; + + +/***/ }), +/* 1112 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.In + */ + +module.exports = { + + BottomCenter: __webpack_require__(487), + BottomLeft: __webpack_require__(486), + BottomRight: __webpack_require__(485), + Center: __webpack_require__(484), + LeftCenter: __webpack_require__(482), + QuickSet: __webpack_require__(488), + RightCenter: __webpack_require__(481), + TopCenter: __webpack_require__(480), + TopLeft: __webpack_require__(479), + TopRight: __webpack_require__(478) + +}; + + +/***/ }), +/* 1113 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(229); +var Extend = __webpack_require__(21); + +/** + * @namespace Phaser.Display.Align + */ + +var Align = { + + In: __webpack_require__(1112), + To: __webpack_require__(1111) + +}; + +// Merge in the consts +Align = Extend(false, Align, CONST); + +module.exports = Align; + + +/***/ }), +/* 1114 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display + */ + +module.exports = { + + Align: __webpack_require__(1113), + Bounds: __webpack_require__(1098), + Canvas: __webpack_require__(1095), + Color: __webpack_require__(385), + Masks: __webpack_require__(1086) + +}; + + +/***/ }), +/* 1115 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(109); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); + +/** + * @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 - A reference to the Scene that this DataManager belongs to. + */ +var DataManagerPlugin = new Class({ + + Extends: DataManager, + + initialize: + + function DataManagerPlugin (scene) + { + DataManager.call(this, scene, scene.sys.events); + + /** + * A reference to the Scene that this DataManager belongs to. + * + * @name Phaser.Data.DataManagerPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * A reference to the Scene's Systems. + * + * @name Phaser.Data.DataManagerPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, + + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Data.DataManagerPlugin#boot + * @private + * @since 3.5.1 + */ + boot: function () + { + this.events = this.systems.events; + + this.events.once(SceneEvents.DESTROY, this.destroy, this); + }, + + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Data.DataManagerPlugin#start + * @private + * @since 3.5.0 + */ + start: function () + { + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Data.DataManagerPlugin#shutdown + * @private + * @since 3.5.0 + */ + shutdown: function () + { + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.Data.DataManagerPlugin#destroy + * @since 3.5.0 + */ + destroy: function () + { + DataManager.prototype.destroy.call(this); + + this.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; + } + +}); + +PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); + +module.exports = DataManagerPlugin; + + +/***/ }), +/* 1116 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data + */ + +module.exports = { + + DataManager: __webpack_require__(109), + DataManagerPlugin: __webpack_require__(1115), + Events: __webpack_require__(458) + +}; + + +/***/ }), +/* 1117 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(3); + +/** + * @classdesc + * A MoveTo Curve is a very simple curve consisting of only a single point. Its intended use is to move the ending point in a Path. + * + * @class MoveTo + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - `x` pixel coordinate. + * @param {number} [y] - `y` pixel coordinate. + */ +var MoveTo = new Class({ + + initialize: + + function MoveTo (x, y) + { + // Skip length calcs in paths + + /** + * Denotes that this Curve does not influence the bounds, points, and drawing of its parent Path. Must be `false` or some methods in the parent Path will throw errors. + * + * @name Phaser.Curves.MoveTo#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; + + /** + * The lone point which this curve consists of. + * + * @name Phaser.Curves.MoveTo#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = new Vector2(x, y); + }, + + /** + * Get point at relative position in curve according to length. + * + * @method Phaser.Curves.MoveTo#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.p0); + }, + + /** + * Retrieves the point at given position in the curve. This will always return this curve's only point. + * + * @method Phaser.Curves.MoveTo#getPointAt + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} u - The position in the path to retrieve, between 0 and 1. Not used. + * @param {Phaser.Math.Vector2} [out] - An optional vector in which to store the point. + * + * @return {Phaser.Math.Vector2} The modified `out` vector, or a new `Vector2` if none was provided. + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, + + /** + * Gets the resolution of this curve. + * + * @method Phaser.Curves.MoveTo#getResolution + * @since 3.0.0 + * + * @return {number} The resolution of this curve. For a MoveTo the value is always 1. + */ + getResolution: function () + { + return 1; + }, + + /** + * Gets the length of this curve. + * + * @method Phaser.Curves.MoveTo#getLength + * @since 3.0.0 + * + * @return {number} The length of this curve. For a MoveTo the value is always 0. + */ + getLength: function () + { + return 0; + }, + + /** + * Converts this curve into a JSON-serializable object. + * + * @method Phaser.Curves.MoveTo#toJSON + * @since 3.0.0 + * + * @return {JSONCurve} A primitive object with the curve's type and only point. + */ + toJSON: function () + { + return { + type: 'MoveTo', + points: [ + this.p0.x, this.p0.y + ] + }; + } + +}); + +module.exports = MoveTo; + + +/***/ }), +/* 1118 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 CubicBezierCurve = __webpack_require__(390); +var EllipseCurve = __webpack_require__(389); +var GameObjectFactory = __webpack_require__(5); +var LineCurve = __webpack_require__(388); +var MovePathTo = __webpack_require__(1117); +var QuadraticBezierCurve = __webpack_require__(387); +var Rectangle = __webpack_require__(11); +var SplineCurve = __webpack_require__(386); +var Vector2 = __webpack_require__(3); + +/** + * @typedef {object} JSONPath + * + * @property {string} type - The of the curve. + * @property {number} x - The X coordinate of the curve's starting point. + * @property {number} y - The Y coordinate of the path's starting point. + * @property {boolean} autoClose - The path is auto closed. + * @property {JSONCurve[]} curves - The list of the curves + */ + +/** + * @classdesc + * A Path combines multiple Curves into one continuous compound curve. It does not matter how many Curves are in the Path or what type they are. + * + * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. + * + * @class Path + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link JSONPath}. + * @param {number} [y=0] - The Y coordinate of the Path's starting point. + */ +var Path = new Class({ + + initialize: + + function Path (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + /** + * The name of this Path. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.Curves.Path#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; + + /** + * The list of Curves which make up this Path. + * + * @name Phaser.Curves.Path#curves + * @type {Phaser.Curves.Curve[]} + * @default [] + * @since 3.0.0 + */ + this.curves = []; + + /** + * The cached length of each Curve in the Path. + * + * Used internally by {@link #getCurveLengths}. + * + * @name Phaser.Curves.Path#cacheLengths + * @type {number[]} + * @default [] + * @since 3.0.0 + */ + this.cacheLengths = []; + + /** + * Automatically closes the path. + * + * @name Phaser.Curves.Path#autoClose + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.autoClose = false; + + /** + * The starting point of the Path. + * + * This is not necessarily equivalent to the starting point of the first Curve in the Path. In an empty Path, it's also treated as the ending point. + * + * @name Phaser.Curves.Path#startPoint + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.startPoint = new Vector2(); + + /** + * A temporary vector used to avoid object creation when adding a Curve to the Path. + * + * @name Phaser.Curves.Path#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2A = new Vector2(); + + /** + * A temporary vector used to avoid object creation when adding a Curve to the Path. + * + * @name Phaser.Curves.Path#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2B = new Vector2(); + + if (typeof x === 'object') + { + this.fromJSON(x); + } + else + { + this.startPoint.set(x, y); + } + }, + + /** + * Appends a Curve to the end of the Path. + * + * The Curve does not have to start where the Path ends or, for an empty Path, at its defined starting point. + * + * @method Phaser.Curves.Path#add + * @since 3.0.0 + * + * @param {Phaser.Curves.Curve} curve - The Curve to append. + * + * @return {Phaser.Curves.Path} This Path object. + */ + add: function (curve) + { + this.curves.push(curve); + + return this; + }, + + /** + * Creates a circular Ellipse Curve positioned at the end of the Path. + * + * @method Phaser.Curves.Path#circleTo + * @since 3.0.0 + * + * @param {number} radius - The radius of the circle. + * @param {boolean} [clockwise=false] - `true` to create a clockwise circle as opposed to a counter-clockwise circle. + * @param {number} [rotation=0] - The rotation of the circle in degrees. + * + * @return {Phaser.Curves.Path} This Path object. + */ + circleTo: function (radius, clockwise, rotation) + { + if (clockwise === undefined) { clockwise = false; } + + return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); + }, + + /** + * Ensures that the Path is closed. + * + * A closed Path starts and ends at the same point. If the Path is not closed, a straight Line Curve will be created from the ending point directly to the starting point. During the check, the actual starting point of the Path, i.e. the starting point of the first Curve, will be used as opposed to the Path's defined {@link startPoint}, which could differ. + * + * Calling this method on an empty Path will result in an error. + * + * @method Phaser.Curves.Path#closePath + * @since 3.0.0 + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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)); + } + + return this; + }, + + /** + * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. + * + * @method Phaser.Curves.Path#cubicBezierTo + * @since 3.0.0 + * + * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vec2, the p1 value. + * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vec2, the p2 value. + * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vec2, the p3 value. + * @param {number} [control1Y] - The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments. + * @param {number} [control2X] - The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. + * @param {number} [control2Y] - The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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) + { + 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 + + /** + * Creates a Quadratic Bezier Curve starting at the ending point of the Path. + * + * @method Phaser.Curves.Path#quadraticBezierTo + * @since 3.2.0 + * + * @param {(number|Phaser.Math.Vector2[])} x - The X coordinate of the second control point or, if it's a `Vector2`, the first control point. + * @param {number} [y] - The Y coordinate of the second control point or, if `x` is a `Vector2`, the second control point. + * @param {number} [controlX] - If `x` is not a `Vector2`, the X coordinate of the first control point. + * @param {number} [controlY] - If `x` is not a `Vector2`, the Y coordinate of the first control point. + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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)); + }, + + /** + * Draws all Curves in the Path to a Graphics Game Object. + * + * @method Phaser.Curves.Path#draw + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.Graphics} G - [out,$return] + * + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. + * @param {integer} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. + * + * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. + */ + 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; + }, + + /** + * 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 - The horizontal radius of the ellipse. + * @param {number} yRadius - The vertical radius of the ellipse. + * @param {number} startAngle - The start angle of the ellipse, in degrees. + * @param {number} endAngle - The end angle of the ellipse, in degrees. + * @param {boolean} clockwise - Whether the ellipse should be rotated clockwise (`true`) or counter-clockwise (`false`). + * @param {number} rotation - The rotation of the ellipse, in degrees. + * + * @return {Phaser.Curves.Path} This Path object. + */ + ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + { + 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); + }, + + /** + * Creates a Path from a Path Configuration object. + * + * The provided object should be a {@link JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. + * + * @method Phaser.Curves.Path#fromJSON + * @since 3.0.0 + * + * @param {object} data - The JSON object containing the Path data. + * + * @return {Phaser.Curves.Path} This Path object. + */ + fromJSON: function (data) + { + // 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++) + { + 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; + }, + + /** + * Returns a Rectangle with a position and size matching the bounds of this Path. + * + * @method Phaser.Curves.Path#getBounds + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. + * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. + * + * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. + */ + 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; + + 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]; + + 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); + } + + out.right = maxRight; + out.bottom = maxBottom; + + return out; + }, + + /** + * Returns an array containing the length of the Path at the end of each Curve. + * + * The result of this method will be cached to avoid recalculating it in subsequent calls. The cache is only invalidated when the {@link #curves} array changes in length, leading to potential inaccuracies if a Curve in the Path is changed, or if a Curve is removed and another is added in its place. + * + * @method Phaser.Curves.Path#getCurveLengths + * @since 3.0.0 + * + * @return {number[]} An array containing the length of the Path at the end of each one of its Curves. + */ + getCurveLengths: function () + { + // We use cache values if curves and cache array are same length + + if (this.cacheLengths.length === this.curves.length) + { + return this.cacheLengths; + } + + // Get length of sub-curve + // Push sums into cached array + + var lengths = []; + var sums = 0; + + for (var i = 0; i < this.curves.length; i++) + { + sums += this.curves[i].getLength(); + + lengths.push(sums); + } + + this.cacheLengths = lengths; + + return lengths; + }, + + /** + * Returns the ending point of the Path. + * + * A Path's ending point is equivalent to the ending point of the last Curve in the Path. For an empty Path, the ending point is at the Path's defined {@link #startPoint}. + * + * @method Phaser.Curves.Path#getEndPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - The object to store the point in. + * + * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. + */ + getEndPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + if (this.curves.length > 0) + { + this.curves[this.curves.length - 1].getPoint(1, out); + } + else + { + out.copy(this.startPoint); + } + + return out; + }, + + /** + * Returns the total length of the Path. + * + * @see {@link #getCurveLengths} + * + * @method Phaser.Curves.Path#getLength + * @since 3.0.0 + * + * @return {number} The total length of the Path. + */ + getLength: function () + { + var lens = this.getCurveLengths(); + + return lens[lens.length - 1]; + }, + + // 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') + + /** + * Calculates the coordinates of the point at the given normalized location (between 0 and 1) on the Path. + * + * The location is relative to the entire Path, not to an individual Curve. A location of 0.5 is always in the middle of the Path and is thus an equal distance away from both its starting and ending points. In a Path with one Curve, it would be in the middle of the Curve; in a Path with two Curves, it could be anywhere on either one of them depending on their lengths. + * + * @method Phaser.Curves.Path#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The location of the point to return, between 0 and 1. + * @param {Phaser.Math.Vector2} [out] - The object in which to store the calculated point. + * + * @return {?Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + */ + 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) + { + 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++; + } + + // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) + { + points.push(points[0]); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getRandomPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * + * @return {Phaser.Math.Vector2} [description] + */ + getRandomPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); + }, + + /** + * Creates a straight Line Curve from the ending point of the Path to the given coordinates. + * + * @method Phaser.Curves.Path#getSpacedPoints + * @since 3.0.0 + * + * @param {integer} [divisions=40] - The X coordinate of the line's ending point, or the line's ending point as a `Vector2`. + * + * @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)); + } + + if (this.autoClose) + { + points.push(points[0]); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + 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.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._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.Curves.Path#splineTo + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2[]} points - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + splineTo: function (points) + { + points.unshift(this.getEndPoint()); + + return this.add(new SplineCurve(points)); + }, + + /** + * [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)); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#toJSON + * @since 3.0.0 + * + * @return {JSONPath} [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.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; + + +/***/ }), +/* 1119 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Curves + */ + +/** + * @typedef {object} JSONCurve + * + * @property {string} type - The of the curve + * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` + */ + +module.exports = { + Path: __webpack_require__(1118), + + CubicBezier: __webpack_require__(390), + Curve: __webpack_require__(86), + Ellipse: __webpack_require__(389), + Line: __webpack_require__(388), + QuadraticBezier: __webpack_require__(387), + Spline: __webpack_require__(386) +}; + + +/***/ }), +/* 1120 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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. + * + * @name Phaser.Create.Palettes.MSX + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1121 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.JMP + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1122 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.CGA + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1123 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @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 {Palette} + */ +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' +}; + + +/***/ }), +/* 1124 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Palette + * + * @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. + */ + +/** + * @namespace Phaser.Create.Palettes + */ + +module.exports = { + + ARNE16: __webpack_require__(391), + C64: __webpack_require__(1123), + CGA: __webpack_require__(1122), + JMP: __webpack_require__(1121), + MSX: __webpack_require__(1120) + +}; + + +/***/ }), +/* 1125 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Create + */ + +module.exports = { + + GenerateTexture: __webpack_require__(392), + Palettes: __webpack_require__(1124) + +}; + + +/***/ }), +/* 1126 */ /***/ (function(module, exports) { module.exports = [ @@ -157905,7 +171051,7 @@ module.exports = [ /***/ }), -/* 965 */ +/* 1127 */ /***/ (function(module, exports) { module.exports = [ @@ -157949,12 +171095,12 @@ module.exports = [ /***/ }), -/* 966 */ +/* 1128 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -158540,7 +171686,7 @@ module.exports = ModelViewProjection; /***/ }), -/* 967 */ +/* 1129 */ /***/ (function(module, exports) { module.exports = [ @@ -158564,6 +171710,7 @@ module.exports = [ 'uniform sampler2D uNormSampler;', 'uniform vec3 uAmbientLightColor;', 'uniform Light uLights[kMaxLights];', + 'uniform mat3 uInverseRotationMatrix;', '', 'varying vec2 outTexCoord;', 'varying vec4 outTint;', @@ -158573,7 +171720,7 @@ module.exports = [ ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);', ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', - ' vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));', + ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', '', ' for (int index = 0; index < kMaxLights; ++index)', @@ -158598,7 +171745,7 @@ module.exports = [ /***/ }), -/* 968 */ +/* 1130 */ /***/ (function(module, exports) { module.exports = [ @@ -158617,7 +171764,7 @@ module.exports = [ /***/ }), -/* 969 */ +/* 1131 */ /***/ (function(module, exports) { module.exports = [ @@ -158653,136 +171800,2629 @@ module.exports = [ /***/ }), -/* 970 */ -/***/ (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__(384); -var CanvasPool = __webpack_require__(26); -var CONST = __webpack_require__(28); -var Features = __webpack_require__(186); - -/** - * 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.antialias) - { - CanvasPool.disableSmoothing(); - } - - // Does the game config provide its own canvas element to use? - if (config.canvas) - { - game.canvas = config.canvas; - - game.canvas.width = game.config.width; - game.canvas.height = game.config.height; - } - else - { - game.canvas = CanvasPool.create(game, config.width * config.resolution, config.height * config.resolution, 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.antialias) - { - CanvasInterpolation.setCrisp(game.canvas); - } - - // Zoomed? - 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__(374); - WebGLRenderer = __webpack_require__(371); - - // Let the config pick the renderer type, as both are included - if (config.renderType === CONST.WEBGL) - { - game.renderer = new WebGLRenderer(game); - } - else - { - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } - } - - if (false) - {} - - if (false) - {} -}; - -module.exports = CreateRenderer; - - -/***/ }), -/* 971 */ +/* 1132 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Remove Event. + * + * This event is dispatched by the Texture Manager when a texture is removed from it. + * + * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`. + * + * If you have any Game Objects still using the removed texture, they will start throwing + * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. + * + * @event Phaser.Textures.Events#REMOVE + * + * @param {string} key - The key of the Texture that was removed from the Texture Manager. + */ +module.exports = 'removetexture'; + + +/***/ }), +/* 1133 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * This internal event signifies that the Texture Manager is now ready and the Game can continue booting. + * + * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking + * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game + * instance, which tells the Game to carry on booting. + * + * @event Phaser.Textures.Events#READY + */ +module.exports = 'ready'; + + +/***/ }), +/* 1134 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Event. + * + * This event is dispatched by the Texture Manager when a texture has finished loading on it. + * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`. + * + * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event. + * + * @event Phaser.Textures.Events#LOAD + * + * @param {string} key - The key of the Texture that was loaded by the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was loaded by the Texture Manager. + */ +module.exports = 'onload'; + + +/***/ }), +/* 1135 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Error Event. + * + * This event is dispatched by the Texture Manager when a texture it requested to load failed. + * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`. + * + * @event Phaser.Textures.Events#ERROR + * + * @param {string} key - The key of the Texture that failed to load into the Texture Manager. + */ +module.exports = 'onerror'; + + +/***/ }), +/* 1136 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Add Event. + * + * This event is dispatched by the Texture Manager when a texture is added to it. + * + * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`. + * + * @event Phaser.Textures.Events#ADD + * + * @param {string} key - The key of the Texture that was added to the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. + */ +module.exports = 'addtexture'; + + +/***/ }), +/* 1137 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Vector3 = __webpack_require__(202); +var Matrix4 = __webpack_require__(407); +var Quaternion = __webpack_require__(406); + +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 - The vector to be rotated. + * @param {Phaser.Math.Vector3} axis - The axis to rotate around. + * @param {number} radians - The angle of rotation in radians. + * + * @return {Phaser.Math.Vector3} The given vector. + */ +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; + + +/***/ }), +/* 1138 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 + * A representation of a vector in 4D space. + * + * A four-component vector. + * + * @class Vector4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +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 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector4#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector4#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + /** + * The w component of this Vector. + * + * @name Phaser.Math.Vector4#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.w = 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; + } + }, + + /** + * Make a clone of this Vector4. + * + * @method Phaser.Math.Vector4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} A clone of this Vector4. + */ + clone: function () + { + return new Vector4(this.x, this.y, this.z, this.w); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + this.w = src.w || 0; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict quality check against each Vector's components. + * + * @method Phaser.Math.Vector4#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The vector to check equality with. + * + * @return {boolean} A boolean indicating whether the two Vectors are equal or not. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); + }, + + /** + * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. + * + * @method Phaser.Math.Vector4#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. + * @param {number} y - The y value to set for this Vector. + * @param {number} z - The z value to set for this Vector. + * @param {number} w - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + set: function (x, y, z, w) + { + 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; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector4#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + this.w += v.w || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector4#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + this.w -= v.w || 0; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector4#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + scale: function (scale) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; + + return this; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector4#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + 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); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector4#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return x * x + y * y + z * z + w * w; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector4#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + 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; + + 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; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector4#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. + * + * @return {number} The dot product of this Vector and the given Vector. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector4#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + lerp: function (v, t) + { + 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; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector4#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + this.w *= v.w || 1; + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector4#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + this.w /= v.w || 1; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector4#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + 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); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector4#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + 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; + + return dx * dx + dy * dy + dz * dz + dw * dw; + }, + + /** + * Negate the `x`, `y`, `z` and `w` components of this Vector. + * + * @method Phaser.Math.Vector4#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + this.w = -this.w; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector4#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var m = mat.val; + + 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; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector4#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformQuat: function (q) + { + // TODO: is this really the same as Vector3? + // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ + // 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; + + // 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; + + // 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; + }, + + /** + * Make this Vector the zero vector (0, 0, 0, 0). + * + * @method Phaser.Math.Vector4#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 0; + + return this; + } + +}); + +// 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; + +module.exports = Vector4; + + +/***/ }), +/* 1139 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Checks if the two values are within the given `tolerance` of each other. + * + * @function Phaser.Math.Within + * @since 3.0.0 + * + * @param {number} a - The first value to use in the calculation. + * @param {number} b - The second value to use in the calculation. + * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. + * + * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. + */ +var Within = function (a, b, tolerance) +{ + return (Math.abs(a - b) <= tolerance); +}; + +module.exports = Within; + + +/***/ }), +/* 1140 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} SinCosTable + * + * @property {number} sin - The sine value. + * @property {number} cos - The cosine value. + * @property {number} length - The length. + */ + +/** + * Generate a series of sine and cosine values. + * + * @function Phaser.Math.SinCosTableGenerator + * @since 3.0.0 + * + * @param {number} length - The number of values to generate. + * @param {number} [sinAmp=1] - The sine value amplitude. + * @param {number} [cosAmp=1] - The cosine value amplitude. + * @param {number} [frequency=1] - The frequency of the values. + * + * @return {SinCosTable} The generated values. + */ +var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) +{ + if (sinAmp === undefined) { sinAmp = 1; } + if (cosAmp === undefined) { cosAmp = 1; } + if (frequency === undefined) { frequency = 1; } + + frequency *= Math.PI / length; + + var cos = []; + var sin = []; + + for (var c = 0; c < length; c++) + { + cosAmp -= sinAmp * frequency; + sinAmp += cosAmp * frequency; + + cos[c] = cosAmp; + sin[c] = sinAmp; + } + + return { + sin: sin, + cos: cos, + length: length + }; +}; + +module.exports = SinCosTableGenerator; + + +/***/ }), +/* 1141 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Round a value to a given decimal place. + * + * @function Phaser.Math.RoundTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {integer} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var RoundTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.round(value * p) / p; +}; + +module.exports = RoundTo; + + +/***/ }), +/* 1142 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random four-dimensional vector. + * + * @function Phaser.Math.RandomXYZW + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector4} The given Vector. + */ +var RandomXYZW = function (vec4, scale) +{ + if (scale === undefined) { scale = 1; } + + // TODO: 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; + + +/***/ }), +/* 1143 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random position vector in a spherical area, optionally defined by the given radius. + * + * @function Phaser.Math.RandomXYZ + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. + * @param {number} [radius=1] - The radius. + * + * @return {Phaser.Math.Vector3} The given Vector. + */ +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; + + +/***/ }), +/* 1144 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random unit vector. + * + * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. + * + * Optionally accepts a scale value to scale the resulting vector by. + * + * @function Phaser.Math.RandomXY + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector2} The given Vector. + */ +var RandomXY = function (vector, scale) +{ + if (scale === undefined) { scale = 1; } + + var r = Math.random() * 2 * Math.PI; + + vector.x = Math.cos(r) * scale; + vector.y = Math.sin(r) * scale; + + return vector; +}; + +module.exports = RandomXY; + + +/***/ }), +/* 1145 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Work out what percentage `value` is of the range between `min` and `max`. + * If `max` isn't given then it will return the percentage of `value` to `min`. + * + * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. + * + * @function Phaser.Math.Percent + * @since 3.0.0 + * + * @param {number} value - The value to determine the percentage of. + * @param {number} min - The minimum value. + * @param {number} [max] - The maximum value. + * @param {number} [upperMax] - The mid-way point in the range that represents 100%. + * + * @return {number} A value between 0 and 1 representing the percentage. + */ +var Percent = function (value, min, max, upperMax) +{ + if (max === undefined) { max = min + 1; } + + var percentage = (value - min) / (max - min); + + if (percentage > 1) + { + if (upperMax !== undefined) + { + percentage = ((upperMax - value)) / (upperMax - max); + + if (percentage < 0) + { + percentage = 0; + } + } + else + { + percentage = 1; + } + } + else if (percentage < 0) + { + percentage = 0; + } + + return percentage; +}; + +module.exports = Percent; + + +/***/ }), +/* 1146 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Subtract an `amount` from `value`, limiting the minimum result to `min`. + * + * @function Phaser.Math.MinSub + * @since 3.0.0 + * + * @param {number} value - The value to subtract from. + * @param {number} amount - The amount to subtract. + * @param {number} min - The minimum value to return. + * + * @return {number} The resulting value. + */ +var MinSub = function (value, amount, min) +{ + return Math.max(value - amount, min); +}; + +module.exports = MinSub; + + +/***/ }), +/* 1147 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Add an `amount` to a `value`, limiting the maximum result to `max`. + * + * @function Phaser.Math.MaxAdd + * @since 3.0.0 + * + * @param {number} value - The value to add to. + * @param {number} amount - The amount to add. + * @param {number} max - The maximum value to return. + * + * @return {number} The resulting value. + */ +var MaxAdd = function (value, amount, max) +{ + return Math.min(value + amount, max); +}; + +module.exports = MaxAdd; + + +/***/ }), +/* 1148 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check if a given value is an even number using a strict type check. + * + * @function Phaser.Math.IsEvenStrict + * @since 3.0.0 + * + * @param {number} value - The number to perform the check with. + * + * @return {boolean} Whether the number is even or not. + */ +var IsEvenStrict = function (value) +{ + // Use strict equality === for "is number" test + return (value === parseFloat(value)) ? !(value % 2) : void 0; +}; + +module.exports = IsEvenStrict; + + +/***/ }), +/* 1149 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check if a given value is an even number. + * + * @function Phaser.Math.IsEven + * @since 3.0.0 + * + * @param {number} value - The number to perform the check with. + * + * @return {boolean} Whether the number is even or not. + */ +var IsEven = function (value) +{ + // Use abstract equality == for "is number" test + + // eslint-disable-next-line eqeqeq + return (value == parseFloat(value)) ? !(value % 2) : void 0; +}; + +module.exports = IsEven; + + +/***/ }), +/* 1150 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the speed required to cover a distance in the time given. + * + * @function Phaser.Math.GetSpeed + * @since 3.0.0 + * + * @param {number} distance - The distance to travel in pixels. + * @param {integer} time - The time, in ms, to cover the distance in. + * + * @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given. + */ +var GetSpeed = function (distance, time) +{ + return (distance / time) / 1000; +}; + +module.exports = GetSpeed; + + +/***/ }), +/* 1151 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Floors to some place comparative to a `base`, default is 10 for decimal place. + * + * The `place` is represented by the power applied to `base` to get that place. + * + * @function Phaser.Math.FloorTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {integer} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var FloorTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.floor(value * p) / p; +}; + +module.exports = FloorTo; + + +/***/ }), +/* 1152 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the positive difference of two given numbers. + * + * @function Phaser.Math.Difference + * @since 3.0.0 + * + * @param {number} a - The first number in the calculation. + * @param {number} b - The second number in the calculation. + * + * @return {number} The positive difference of the two given numbers. + */ +var Difference = function (a, b) +{ + return Math.abs(a - b); +}; + +module.exports = Difference; + + +/***/ }), +/* 1153 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Ceils to some place comparative to a `base`, default is 10 for decimal place. + * + * The `place` is represented by the power applied to `base` to get that place. + * + * @function Phaser.Math.CeilTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {number} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var CeilTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.ceil(value * p) / p; +}; + +module.exports = CeilTo; + + +/***/ }), +/* 1154 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the mean average of the given values. + * + * @function Phaser.Math.Average + * @since 3.0.0 + * + * @param {number[]} values - The values to average. + * + * @return {number} The average value. + */ +var Average = function (values) +{ + var sum = 0; + + for (var i = 0; i < values.length; i++) + { + sum += (+values[i]); + } + + return sum / values.length; +}; + +module.exports = Average; + + +/***/ }), +/* 1155 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A seeded Random Data Generator. + * + * Access via `Phaser.Math.RND` which is an instance of this class pre-defined + * by Phaser. Or, create your own instance to use as you require. + * + * The `Math.RND` generator is seeded by the Game Config property value `seed`. + * If no such config property exists, a random number is used. + * + * If you create your own instance of this class you should provide a seed for it. + * If no seed is given it will use a 'random' one based on Date.now. + * + * @class RandomDataGenerator + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. + */ +var RandomDataGenerator = new Class({ + + initialize: + + function RandomDataGenerator (seeds) + { + if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } + + /** + * 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; + + /** + * Signs to choose from. + * + * @name Phaser.Math.RandomDataGenerator#signs + * @type {number[]} + * @since 3.0.0 + */ + this.signs = [ -1, 1 ]; + + if (seeds) + { + this.init(seeds); + } + }, + + /** + * Private random helper. + * + * @method Phaser.Math.RandomDataGenerator#rnd + * @since 3.0.0 + * @private + * + * @return {number} A random number. + */ + rnd: function () + { + 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 {string} data - The value to hash. + * + * @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++) + { + 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 + }, + + /** + * Initialize the state of the random data generator. + * + * @method Phaser.Math.RandomDataGenerator#init + * @since 3.0.0 + * + * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. + */ + 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 {string[]} 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 {*} 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 {*} 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(','); + }, + + /** + * Shuffles the given array, using the current seed. + * + * @method Phaser.Math.RandomDataGenerator#shuffle + * @since 3.7.0 + * + * @param {array} [array] - The array to be shuffled. + * + * @return {array} The shuffled array. + */ + shuffle: function (array) + { + var len = array.length - 1; + + for (var i = len; i > 0; i--) + { + var randomIndex = Math.floor(this.frac() * (i + 1)); + var itemAtIndex = array[randomIndex]; + + array[randomIndex] = array[i]; + array[i] = itemAtIndex; + } + + return array; + } + +}); + +module.exports = RandomDataGenerator; + + +/***/ }), +/* 1156 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using rounding. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. + * + * @function Phaser.Math.Snap.To + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapTo = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.round(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapTo; + + +/***/ }), +/* 1157 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Snap + */ + +module.exports = { + + Ceil: __webpack_require__(413), + Floor: __webpack_require__(107), + To: __webpack_require__(1156) + +}; + + +/***/ }), +/* 1158 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Tests the value and returns `true` if it is a power of two. + * + * @function Phaser.Math.Pow2.IsValuePowerOfTwo + * @since 3.0.0 + * + * @param {number} value - The value to check if it's a power of two. + * + * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. + */ +var IsValuePowerOfTwo = function (value) +{ + return (value > 0 && (value & (value - 1)) === 0); +}; + +module.exports = IsValuePowerOfTwo; + + +/***/ }), +/* 1159 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Pow2 + */ + +module.exports = { + + GetNext: __webpack_require__(414), + IsSize: __webpack_require__(137), + IsValue: __webpack_require__(1158) + +}; + + +/***/ }), +/* 1160 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SmootherStep = __webpack_require__(216); + +/** + * A Smoother Step interpolation method. + * + * @function Phaser.Math.Interpolation.SmootherStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The interpolated value. + */ +var SmootherStepInterpolation = function (t, min, max) +{ + return min + (max - min) * SmootherStep(t, 0, 1); +}; + +module.exports = SmootherStepInterpolation; + + +/***/ }), +/* 1161 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Linear = __webpack_require__(139); + +/** + * A linear interpolation method. + * + * @function Phaser.Math.Interpolation.Linear + * @since 3.0.0 + * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {!number} k - The percentage of interpolation, between 0 and 1. + * + * @return {!number} The interpolated value. + */ +var LinearInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + + if (k < 0) + { + return Linear(v[0], v[1], f); + } + else if (k > 1) + { + return Linear(v[m], v[m - 1], m - f); + } + else + { + return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); + } +}; + +module.exports = LinearInterpolation; + + +/***/ }), +/* 1162 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CatmullRom = __webpack_require__(205); + +/** + * A Catmull-Rom interpolation method. + * + * @function Phaser.Math.Interpolation.CatmullRom + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var CatmullRomInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + + if (v[0] === v[m]) + { + if (k < 0) + { + i = Math.floor(f = m * (1 + k)); + } + + return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); + } + else + { + if (k < 0) + { + return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); + } + + if (k > 1) + { + return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); + } + + return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); + } +}; + +module.exports = CatmullRomInterpolation; + + +/***/ }), +/* 1163 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Bernstein = __webpack_require__(419); + +/** + * A bezier interpolation method. + * + * @function Phaser.Math.Interpolation.Bezier + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var BezierInterpolation = function (v, k) +{ + var b = 0; + var n = v.length - 1; + + for (var i = 0; i <= n; i++) + { + b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); + } + + return b; +}; + +module.exports = BezierInterpolation; + + +/***/ }), +/* 1164 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Interpolation + */ + +module.exports = { + + Bezier: __webpack_require__(1163), + CatmullRom: __webpack_require__(1162), + CubicBezier: __webpack_require__(417), + Linear: __webpack_require__(1161), + QuadraticBezier: __webpack_require__(416), + SmoothStep: __webpack_require__(415), + SmootherStep: __webpack_require__(1160) + +}; + + +/***/ }), +/* 1165 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the fuzzy floor of the given value. + * + * @function Phaser.Math.Fuzzy.Floor + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The floor of the value. + */ +var Floor = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.floor(value + epsilon); +}; + +module.exports = Floor; + + +/***/ }), +/* 1166 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the fuzzy ceiling of the given value. + * + * @function Phaser.Math.Fuzzy.Ceil + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The fuzzy ceiling of the value. + */ +var Ceil = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.ceil(value - epsilon); +}; + +module.exports = Ceil; + + +/***/ }), +/* 1167 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Fuzzy + */ + +module.exports = { + + Ceil: __webpack_require__(1166), + Equal: __webpack_require__(206), + Floor: __webpack_require__(1165), + GreaterThan: __webpack_require__(421), + LessThan: __webpack_require__(420) + +}; + + +/***/ }), +/* 1168 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing + */ + +module.exports = { + + Back: __webpack_require__(440), + Bounce: __webpack_require__(439), + Circular: __webpack_require__(438), + Cubic: __webpack_require__(437), + Elastic: __webpack_require__(436), + Expo: __webpack_require__(435), + Linear: __webpack_require__(434), + Quadratic: __webpack_require__(433), + Quartic: __webpack_require__(432), + Quintic: __webpack_require__(431), + Sine: __webpack_require__(430), + Stepped: __webpack_require__(429) + +}; + + +/***/ }), +/* 1169 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the distance between two sets of coordinates (points) to the power of `pow`. + * + * @function Phaser.Math.Distance.Power + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * @param {number} pow - The exponent. + * + * @return {number} The distance between each point. + */ +var DistancePower = function (x1, y1, x2, y2, pow) +{ + if (pow === undefined) { pow = 2; } + + return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); +}; + +module.exports = DistancePower; + + +/***/ }), +/* 1170 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Distance + */ + +module.exports = { + + Between: __webpack_require__(62), + Power: __webpack_require__(1169), + Squared: __webpack_require__(422) + +}; + + +/***/ }), +/* 1171 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Gets the shortest angle between `angle1` and `angle2`. + * + * Both angles must be in the range -180 to 180, which is the same clamped + * range that `sprite.angle` uses, so you can pass in two sprite angles to + * this method and get the shortest angle back between the two of them. + * + * The angle returned will be in the same range. If the returned angle is + * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's + * a clockwise rotation. + * + * TODO: Wrap the angles in this function? + * + * @function Phaser.Math.Angle.ShortestBetween + * @since 3.0.0 + * + * @param {number} angle1 - The first angle in the range -180 to 180. + * @param {number} angle2 - The second angle in the range -180 to 180. + * + * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. + */ +var ShortestBetween = function (angle1, angle2) +{ + var difference = angle2 - angle1; + + if (difference === 0) + { + return 0; + } + + var times = Math.floor((difference - (-180)) / 360); + + return difference - (times * 360); + +}; + +module.exports = ShortestBetween; + + +/***/ }), +/* 1172 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var MATH_CONST = __webpack_require__(20); + +/** + * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. + * + * @function Phaser.Math.Angle.RotateTo + * @since 3.0.0 + * + * @param {number} currentAngle - The current angle, in radians. + * @param {number} targetAngle - The target angle to rotate to, in radians. + * @param {number} [lerp=0.05] - The lerp value to add to the current angle. + * + * @return {number} The adjusted angle. + */ +var RotateTo = function (currentAngle, targetAngle, lerp) +{ + if (lerp === undefined) { lerp = 0.05; } + + if (currentAngle === targetAngle) + { + return currentAngle; + } + + if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) + { + currentAngle = targetAngle; + } + else + { + if (Math.abs(targetAngle - currentAngle) > Math.PI) + { + if (targetAngle < currentAngle) + { + targetAngle += MATH_CONST.PI2; + } + else + { + targetAngle -= MATH_CONST.PI2; + } + } + + if (targetAngle > currentAngle) + { + currentAngle += lerp; + } + else if (targetAngle < currentAngle) + { + currentAngle -= lerp; + } + } + + return currentAngle; +}; + +module.exports = RotateTo; + + +/***/ }), +/* 1173 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Normalize = __webpack_require__(423); + +/** + * Reverse the given angle. + * + * @function Phaser.Math.Angle.Reverse + * @since 3.0.0 + * + * @param {number} angle - The angle to reverse, in radians. + * + * @return {number} The reversed angle, in radians. + */ +var Reverse = function (angle) +{ + return Normalize(angle + Math.PI); +}; + +module.exports = Reverse; + + +/***/ }), +/* 1174 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Takes an angle in Phasers default clockwise format and converts it so that + * 0 is North, 90 is West, 180 is South and 270 is East, + * therefore running counter-clockwise instead of clockwise. + * + * You can pass in the angle from a Game Object using: + * + * ```javascript + * var converted = CounterClockwise(gameobject.rotation); + * ``` + * + * All values for this function are in radians. + * + * @function Phaser.Math.Angle.CounterClockwise + * @since 3.16.0 + * + * @param {number} angle - The angle to convert, in radians. + * + * @return {number} The converted angle, in radians. + */ +var CounterClockwise = function (angle) +{ + return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2); +}; + +module.exports = CounterClockwise; + + +/***/ }), +/* 1175 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenY + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var BetweenY = function (x1, y1, x2, y2) +{ + return Math.atan2(x2 - x1, y2 - y1); +}; + +module.exports = BetweenY; + + +/***/ }), +/* 1176 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenPointsY + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point1 - The first point. + * @param {(Phaser.Geom.Point|object)} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPointsY = function (point1, point2) +{ + return Math.atan2(point2.x - point1.x, point2.y - point1.y); +}; + +module.exports = BetweenPointsY; + + +/***/ }), +/* 1177 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * Calculates the angle of the vector from the first point to the second point. + * + * @function Phaser.Math.Angle.BetweenPoints + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point1 - The first point. + * @param {(Phaser.Geom.Point|object)} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPoints = function (point1, point2) +{ + return Math.atan2(point2.y - point1.y, point2.x - point1.x); +}; + +module.exports = BetweenPoints; + + +/***/ }), +/* 1178 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Angle + */ + +module.exports = { + + Between: __webpack_require__(424), + BetweenPoints: __webpack_require__(1177), + BetweenPointsY: __webpack_require__(1176), + BetweenY: __webpack_require__(1175), + CounterClockwise: __webpack_require__(1174), + Normalize: __webpack_require__(423), + Reverse: __webpack_require__(1173), + RotateTo: __webpack_require__(1172), + ShortestBetween: __webpack_require__(1171), + Wrap: __webpack_require__(221), + WrapDegrees: __webpack_require__(220) + +}; + + +/***/ }), +/* 1179 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -158816,22 +174456,23 @@ function init () { var i; - var fs = [ - 'requestFullscreen', - 'requestFullScreen', - 'webkitRequestFullscreen', - 'webkitRequestFullScreen', - 'msRequestFullscreen', - 'msRequestFullScreen', - 'mozRequestFullScreen', - 'mozRequestFullscreen' - ]; + var suffix1 = 'Fullscreen'; + var suffix2 = 'FullScreen'; - var element = document.createElement('div'); + var fs = [ + 'request' + suffix1, + 'request' + suffix2, + 'webkitRequest' + suffix1, + 'webkitRequest' + suffix2, + 'msRequest' + suffix1, + 'msRequest' + suffix2, + 'mozRequest' + suffix2, + 'mozRequest' + suffix1 + ]; for (i = 0; i < fs.length; i++) { - if (element[fs[i]]) + if (document.documentElement[fs[i]]) { Fullscreen.available = true; Fullscreen.request = fs[i]; @@ -158840,14 +174481,14 @@ function init () } var cfs = [ - 'cancelFullScreen', - 'exitFullscreen', - 'webkitCancelFullScreen', - 'webkitExitFullscreen', - 'msCancelFullScreen', - 'msExitFullscreen', - 'mozCancelFullScreen', - 'mozExitFullscreen' + 'cancel' + suffix2, + 'exit' + suffix1, + 'webkitCancel' + suffix2, + 'webkitExit' + suffix1, + 'msCancel' + suffix2, + 'msExit' + suffix1, + 'mozCancel' + suffix2, + 'mozExit' + suffix1 ]; if (Fullscreen.available) @@ -158863,11 +174504,14 @@ function init () } // Keyboard Input? - if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT']) + // Safari 5.1 says it supports fullscreen keyboard, but is lying. + if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT'] && !(/ Version\/5\.1(?:\.\d+)? Safari\//).test(navigator.userAgent)) { Fullscreen.keyboard = true; } + Object.defineProperty(Fullscreen, 'active', { get: function () { return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } }); + return Fullscreen; } @@ -158875,12 +174519,12 @@ module.exports = init(); /***/ }), -/* 972 */ +/* 1180 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -158960,16 +174604,16 @@ module.exports = init(); /***/ }), -/* 973 */ +/* 1181 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Browser = __webpack_require__(128); +var Browser = __webpack_require__(138); /** * Determines the audio playback capabilities of the device running this Phaser Game instance. @@ -159085,17 +174729,17 @@ module.exports = init(); /***/ }), -/* 974 */ +/* 1182 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(101); -var Browser = __webpack_require__(128); +var OS = __webpack_require__(108); +var Browser = __webpack_require__(138); /** * Determines the input support of the browser running this Phaser Game instance. @@ -159164,1744 +174808,7 @@ module.exports = init(); /***/ }), -/* 975 */ -/***/ (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__(28); -var Device = __webpack_require__(376); -var GetFastValue = __webpack_require__(1); -var GetValue = __webpack_require__(4); -var IsPlainObject = __webpack_require__(8); -var MATH = __webpack_require__(18); -var NOOP = __webpack_require__(2); -var DefaultPlugins = __webpack_require__(185); -var ValueToColor = __webpack_require__(196); - -/** - * This callback type is completely empty, a no-operation. - * - * @callback NOOP - */ - -/** - * @callback BootCallback - * - * @param {Phaser.Game} game - The game. - */ - -/** - * @typedef {object} InputConfig - * - * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. - * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. - * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. - * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. - * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. - */ - -/** - * @typedef {object} MouseInputConfig - * - * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether mouse input events have preventDefault() called on them. - */ - -/** - * @typedef {object} KeyboardInputConfig - * - * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. - */ - -/** - * @typedef {object} TouchInputConfig - * - * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. - */ - -/** - * @typedef {object} GamepadInputConfig - * - * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. - */ - -/** - * @typedef {object} BannerConfig - * - * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. - * @property {string} [text='#ffffff'] - The color of the banner text. - * @property {string[]} [background] - The background colors of the banner. - */ - -/** - * @typedef {object} FPSConfig - * - * @property {integer} [min=10] - The minimum acceptable rendering rate, in frames per second. - * @property {integer} [target=60] - The optimum rendering rate, in frames per second. - * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. - * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. - * @property {integer} [panicMax=120] - [description] - */ - -/** - * @typedef {object} RenderConfig - * - * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. - * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. - * @property {boolean} [autoResize=true] - Automatically resize the Game Canvas if you resize the renderer. - * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. - * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. - * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. - * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. - * @property {boolean} [preserveDrawingBuffer=false] - In WebGL mode, the drawing buffer won't be cleared automatically each frame. - * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. - * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. - * @property {integer} [batchSize=2000] - The default WebGL batch size. - * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - -/** - * @typedef {object} ScaleConfig - * - * @property {(integer|string)} [width=1024] - The base width of your game. - * @property {(integer|string)} [height=768] - The base height of your game. - * @property {integer} [zoom=1] - The zoom value of the game canvas. - * @property {number} [resolution=1] - The rendering resolution of the canvas. - * @property {(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {integer} [mode=0] - The scale mode to apply to the canvas. SHOW_ALL, EXACT_FIT, USER_SCALE, or RESIZE. - * @property {integer} [minWidth] - The minimum width the canvas can be scaled down to. - * @property {integer} [minHeight] - The minimum height the canvas can be scaled down to. - * @property {integer} [maxWidth] - The maximum width the canvas can be scaled up to. - * @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to. - */ - -/** - * @typedef {object} CallbacksConfig - * - * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. - * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. - */ - -/** - * @typedef {object} LoaderConfig - * - * @property {string} [baseURL] - An URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. - * @property {string} [path] - An URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. - * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. - * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. - * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. - * @property {boolean} [async=true] - Should the XHR request use async or not? - * @property {string} [user] - Optional username for the XHR request. - * @property {string} [password] - Optional password for the XHR request. - * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. - */ - -/** - * @typedef {object} DOMContainerConfig - * - * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. - * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. - */ - -/** - * @typedef {object} ImagesConfig - * - * @property {string} [default] - URL to use for the 'default' texture. - * @property {string} [missing] - URL to use for the 'missing' texture. - */ - -/** - * @typedef {object} PhysicsConfig - * - * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. - * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. - * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. - * @property {object} [matter] - Matter Physics configuration. - */ - -/** - * @typedef {object} PluginObjectItem - * - * @property {string} [key] - A key to identify the plugin in the Plugin Manager. - * @property {*} [plugin] - The plugin itself. Usually a class/constructor. - * @property {boolean} [start] - Whether the plugin should be started automatically. - * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). - * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). - * @property {*} [data] - Arbitrary data passed to the plugin's init() method. - * - * @example - * // Global plugin - * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } - * @example - * // Scene plugin - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - */ - -/** - * @typedef {object} PluginObject - * - * @property {?PluginObjectItem[]} [global] - Global plugins to install. - * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. - * @property {string[]} [default] - The default set of scene plugins (names). - * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. - */ - -/** - * @typedef {object} GameConfig - * - * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. - * @property {(integer|string)} [height=768] - The height of the game, in game pixels. - * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. - * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. - * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. - * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. - * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. - * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. - * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. - * @property {string[]} [seed] - Seed for the random number generator. - * @property {string} [title=''] - The title of the game. Shown in the browser console. - * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. - * @property {string} [version=''] - The version of the game. Shown in the browser console. - * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. - * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. - * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). - * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. - * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. - * @property {FPSConfig} [fps] - Game loop configuration. - * @property {RenderConfig} [render] - Game renderer configuration. - * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. - * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. - * @property {LoaderConfig} [loader] - Loader configuration. - * @property {ImagesConfig} [images] - Images configuration. - * @property {object} [physics] - Physics configuration. - * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. - */ - -/** - * @classdesc - * The active game configuration settings, parsed from a {@link GameConfig} object. - * - * @class Config - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. - * - * @see Phaser.Game#config - */ -var Config = new Class({ - - initialize: - - function Config (config) - { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; - - var defaultBannerTextColor = '#ffffff'; - - /** - * @const {(integer|string)} Phaser.Boot.Config#width - [description] - */ - this.width = GetValue(config, 'width', 1024); - - /** - * @const {(integer|string)} Phaser.Boot.Config#height - [description] - */ - this.height = GetValue(config, 'height', 768); - - /** - * @const {number} Phaser.Boot.Config#zoom - [description] - */ - this.zoom = GetValue(config, 'zoom', 1); - - /** - * @const {number} Phaser.Boot.Config#resolution - [description] - */ - this.resolution = GetValue(config, 'resolution', 1); - - /** - * @const {?*} Phaser.Boot.Config#parent - [description] - */ - this.parent = GetValue(config, 'parent', null); - - /** - * @const {integer} Phaser.Boot.Config#scaleMode - [description] - */ - this.scaleMode = GetValue(config, 'scaleMode', 0); - - /** - * @const {boolean} Phaser.Boot.Config#expandParent - [description] - */ - this.expandParent = GetValue(config, 'expandParent', false); - - /** - * @const {integer} Phaser.Boot.Config#minWidth - [description] - */ - this.minWidth = GetValue(config, 'minWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxWidth - [description] - */ - this.maxWidth = GetValue(config, 'maxWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#minHeight - [description] - */ - this.minHeight = GetValue(config, 'minHeight', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxHeight - [description] - */ - this.maxHeight = GetValue(config, 'maxHeight', 0); - - // Scale Manager - Anything set in here over-rides anything set above - - var scaleConfig = GetValue(config, 'scale', null); - - if (scaleConfig) - { - this.width = GetValue(scaleConfig, 'width', this.width); - this.height = GetValue(scaleConfig, 'height', this.height); - this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); - this.parent = GetValue(scaleConfig, 'parent', this.parent); - this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); - this.expandParent = GetValue(scaleConfig, 'mode', this.expandParent); - this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); - this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); - this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); - this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); - } - - /** - * @const {number} Phaser.Boot.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) - */ - this.renderType = GetValue(config, 'type', CONST.AUTO); - - /** - * @const {?HTMLCanvasElement} Phaser.Boot.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. - */ - this.canvas = GetValue(config, 'canvas', null); - - /** - * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Boot.Config#context - Force Phaser to use your own Canvas context instead of creating one. - */ - this.context = GetValue(config, 'context', null); - - /** - * @const {?string} Phaser.Boot.Config#canvasStyle - [description] - */ - this.canvasStyle = GetValue(config, 'canvasStyle', null); - - /** - * @const {?object} Phaser.Boot.Config#sceneConfig - [description] - */ - this.sceneConfig = GetValue(config, 'scene', null); - - /** - * @const {string[]} Phaser.Boot.Config#seed - [description] - */ - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - - MATH.RND.init(this.seed); - - /** - * @const {string} Phaser.Boot.Config#gameTitle - The title of the game. - */ - this.gameTitle = GetValue(config, 'title', ''); - - /** - * @const {string} Phaser.Boot.Config#gameURL - The URL of the game. - */ - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - - /** - * @const {string} Phaser.Boot.Config#gameVersion - The version of the game. - */ - this.gameVersion = GetValue(config, 'version', ''); - - /** - * @const {boolean} Phaser.Boot.Config#autoFocus - [description] - */ - this.autoFocus = GetValue(config, 'autoFocus', true); - - // DOM Element Container - - /** - * @const {?boolean} Phaser.Boot.Config#domCreateContainer - [description] - */ - this.domCreateContainer = GetValue(config, 'dom.createContainer', false); - - /** - * @const {?boolean} Phaser.Boot.Config#domBehindCanvas - [description] - */ - this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); - - // Input - - /** - * @const {boolean} Phaser.Boot.Config#inputKeyboard - [description] - */ - this.inputKeyboard = GetValue(config, 'input.keyboard', true); - - /** - * @const {*} Phaser.Boot.Config#inputKeyboardEventTarget - [description] - */ - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); - - /** - * @const {(boolean|object)} Phaser.Boot.Config#inputMouse - [description] - */ - this.inputMouse = GetValue(config, 'input.mouse', true); - - /** - * @const {?*} Phaser.Boot.Config#inputMouseEventTarget - [description] - */ - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputMouseCapture - [description] - */ - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouch - [description] - */ - this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); - - /** - * @const {?*} Phaser.Boot.Config#inputTouchEventTarget - [description] - */ - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouchCapture - [description] - */ - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); - - /** - * @const {integer} Phaser.Boot.Config#inputActivePointers - [description] - */ - this.inputActivePointers = GetValue(config, 'input.activePointers', 1); - - /** - * @const {boolean} Phaser.Boot.Config#inputGamepad - [description] - */ - this.inputGamepad = GetValue(config, 'input.gamepad', false); - - /** - * @const {*} Phaser.Boot.Config#inputGamepadEventTarget - [description] - */ - this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); - - /** - * @const {boolean} Phaser.Boot.Config#disableContextMenu - Set to `true` to disable context menu. Default value is `false`. - */ - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - - /** - * @const {any} Phaser.Boot.Config#audio - [description] - */ - this.audio = GetValue(config, 'audio'); - - // If you do: { banner: false } it won't display any banner at all - - /** - * @const {boolean} Phaser.Boot.Config#hideBanner - [description] - */ - this.hideBanner = (GetValue(config, 'banner', null) === false); - - /** - * @const {boolean} Phaser.Boot.Config#hidePhaser - [description] - */ - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - - /** - * @const {string} Phaser.Boot.Config#bannerTextColor - [description] - */ - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - - /** - * @const {string[]} Phaser.Boot.Config#bannerBackgroundColor - [description] - */ - 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 - // } - - /** - * @const {?FPSConfig} Phaser.Boot.Config#fps - [description] - */ - this.fps = GetValue(config, 'fps', null); - - // Renderer Settings - // These can either be in a `render` object within the Config, or specified on their own - - var renderConfig = GetValue(config, 'render', config); - - /** - * @const {boolean} Phaser.Boot.Config#autoResize - Automatically resize the Game Canvas if you resize the renderer. - */ - this.autoResize = GetValue(renderConfig, 'autoResize', true); - - /** - * @const {boolean} Phaser.Boot.Config#antialias - [description] - */ - this.antialias = GetValue(renderConfig, 'antialias', true); - - /** - * @const {boolean} Phaser.Boot.Config#roundPixels - [description] - */ - this.roundPixels = GetValue(renderConfig, 'roundPixels', false); - - /** - * @const {boolean} Phaser.Boot.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). - */ - this.pixelArt = GetValue(renderConfig, 'pixelArt', false); - - if (this.pixelArt) - { - this.antialias = false; - this.roundPixels = true; - } - - /** - * @const {boolean} Phaser.Boot.Config#transparent - [description] - */ - this.transparent = GetValue(renderConfig, 'transparent', false); - - /** - * @const {boolean} Phaser.Boot.Config#clearBeforeRender - [description] - */ - this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); - - /** - * @const {boolean} Phaser.Boot.Config#premultipliedAlpha - [description] - */ - this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); - - /** - * @const {boolean} Phaser.Boot.Config#preserveDrawingBuffer - [description] - */ - this.preserveDrawingBuffer = GetValue(renderConfig, 'preserveDrawingBuffer', false); - - /** - * @const {boolean} Phaser.Boot.Config#failIfMajorPerformanceCaveat - [description] - */ - this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); - - /** - * @const {string} Phaser.Boot.Config#powerPreference - [description] - */ - this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); - - /** - * @const {integer} Phaser.Boot.Config#batchSize - The default WebGL Batch size. - */ - this.batchSize = GetValue(renderConfig, 'batchSize', 2000); - - /** - * @const {integer} Phaser.Boot.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - this.maxLights = GetValue(renderConfig, 'maxLights', 10); - - var bgc = GetValue(config, 'backgroundColor', 0); - - /** - * @const {Phaser.Display.Color} Phaser.Boot.Config#backgroundColor - [description] - */ - this.backgroundColor = ValueToColor(bgc); - - if (bgc === 0 && this.transparent) - { - this.backgroundColor.alpha = 0; - } - - // Callbacks - - /** - * @const {BootCallback} Phaser.Boot.Config#preBoot - [description] - */ - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); - - /** - * @const {BootCallback} Phaser.Boot.Config#postBoot - [description] - */ - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); - - // Physics - // physics: { - // system: 'impact', - // setBounds: true, - // gravity: 0, - // cellSize: 64 - // } - - /** - * @const {object} Phaser.Boot.Config#physics - [description] - */ - this.physics = GetValue(config, 'physics', {}); - - /** - * @const {boolean} Phaser.Boot.Config#defaultPhysicsSystem - [description] - */ - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); - - // Loader Defaults - - /** - * @const {string} Phaser.Boot.Config#loaderBaseURL - [description] - */ - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPath - [description] - */ - this.loaderPath = GetValue(config, 'loader.path', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). - */ - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); - - /** - * @const {(string|undefined)} Phaser.Boot.Config#loaderCrossOrigin - [description] - */ - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - - /** - * @const {string} Phaser.Boot.Config#loaderResponseType - [description] - */ - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - - /** - * @const {boolean} Phaser.Boot.Config#loaderAsync - [description] - */ - this.loaderAsync = GetValue(config, 'loader.async', true); - - /** - * @const {string} Phaser.Boot.Config#loaderUser - [description] - */ - this.loaderUser = GetValue(config, 'loader.user', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPassword - [description] - */ - this.loaderPassword = GetValue(config, 'loader.password', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderTimeout - [description] - */ - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); - - // Plugins - - /* - * Allows `plugins` property to either be an array, in which case it just replaces - * the default plugins like previously, or a config object. - * - * plugins: { - * global: [ - * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, - * ], - * scene: [ - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - * ], - * default: [], OR - * defaultMerge: [ - * 'ModPlayer' - * ] - * } - */ - - /** - * @const {any} Phaser.Boot.Config#installGlobalPlugins - [description] - */ - this.installGlobalPlugins = []; - - /** - * @const {any} Phaser.Boot.Config#installScenePlugins - [description] - */ - this.installScenePlugins = []; - - var plugins = GetValue(config, 'plugins', null); - var defaultPlugins = DefaultPlugins.DefaultScene; - - if (plugins) - { - // Old 3.7 array format? - if (Array.isArray(plugins)) - { - this.defaultPlugins = plugins; - } - else if (IsPlainObject(plugins)) - { - this.installGlobalPlugins = GetFastValue(plugins, 'global', []); - this.installScenePlugins = GetFastValue(plugins, 'scene', []); - - if (Array.isArray(plugins.default)) - { - defaultPlugins = plugins.default; - } - else if (Array.isArray(plugins.defaultMerge)) - { - defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); - } - } - } - - /** - * @const {any} Phaser.Boot.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). - */ - this.defaultPlugins = defaultPlugins; - - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - - /** - * @const {string} Phaser.Boot.Config#defaultImage - [description] - */ - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - - /** - * @const {string} Phaser.Boot.Config#missingImage - [description] - */ - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); - - if (window) - { - if (window.FORCE_WEBGL) - { - this.renderType = CONST.WEBGL; - } - else if (window.FORCE_CANVAS) - { - this.renderType = CONST.CANVAS; - } - } - } - -}); - -module.exports = Config; - - -/***/ }), -/* 976 */ -/***/ (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 AddToDOM = __webpack_require__(187); -var AnimationManager = __webpack_require__(417); -var CacheManager = __webpack_require__(415); -var CanvasPool = __webpack_require__(26); -var Class = __webpack_require__(0); -var Config = __webpack_require__(975); -var CreateRenderer = __webpack_require__(970); -var DataManager = __webpack_require__(102); -var DebugHeader = __webpack_require__(963); -var Device = __webpack_require__(376); -var DOMContentLoaded = __webpack_require__(380); -var EventEmitter = __webpack_require__(11); -var InputManager = __webpack_require__(367); -var PluginCache = __webpack_require__(15); -var PluginManager = __webpack_require__(360); -var SceneManager = __webpack_require__(358); -var SoundManagerCreator = __webpack_require__(354); -var TextureManager = __webpack_require__(347); -var TimeStep = __webpack_require__(950); -var VisibilityHandler = __webpack_require__(949); - -if (false) -{ var CreateDOMContainer; } - -if (true) -{ - var FacebookInstantGamesPlugin = __webpack_require__(344); -} - -/** - * @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 {GameConfig} [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; - - if (false) - {} - - /** - * A reference to the HTML Canvas Element that Phaser uses to render the game. - * This is created automatically by Phaser unless you provide a `canvas` property - * in your Game Config. - * - * @name Phaser.Game#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = null; - - /** - * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. - * If the game is running under Canvas it will be a 2d Canvas Rendering Context. - * If the game is running under WebGL it will be a WebGL Rendering Context. - * This context is created automatically by Phaser unless you provide a `context` property - * in your Game Config. - * - * @name Phaser.Game#context - * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} - * @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 {Phaser.Events.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); - - /** - * An instance of the Data Manager - * - * @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); - - /** - * 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.DeviceConf} - * @since 3.0.0 - */ - this.device = Device; - - /** - * 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.Sound.BaseSoundManager} - * @since 3.0.0 - */ - this.sound = SoundManagerCreator.create(this); - - /** - * 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); - - /** - * 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.Plugins.PluginManager} - * @since 3.0.0 - */ - this.plugins = new PluginManager(this, this.config); - - if (true) - { - /** - * An instance of the Facebook Instant Games Plugin. - * - * This will only be available if the plugin has been built into Phaser, - * or you're using the special Facebook Instant Games custom build. - * - * @name Phaser.Game#facebook - * @type {Phaser.FacebookInstantGamesPlugin} - * @since 3.13.0 - */ - this.facebook = new FacebookInstantGamesPlugin(this); - } - - /** - * Is this Game pending destruction at the start of the next frame? - * - * @name Phaser.Game#pendingDestroy - * @type {boolean} - * @private - * @since 3.5.0 - */ - this.pendingDestroy = false; - - /** - * Remove the Canvas once the destroy is over? - * - * @name Phaser.Game#removeCanvas - * @type {boolean} - * @private - * @since 3.5.0 - */ - this.removeCanvas = false; - - /** - * Remove everything when the game is destroyed. - * You cannot create a new Phaser instance on the same web page after doing this. - * - * @name Phaser.Game#noReturn - * @type {boolean} - * @private - * @since 3.12.0 - */ - this.noReturn = false; - - /** - * Does the window the game is running in currently have focus or not? - * This is modified by the VisibilityHandler. - * - * @name Phaser.Game#hasFocus - * @type {boolean} - * @readonly - * @since 3.9.0 - */ - this.hasFocus = false; - - /** - * Is the mouse pointer currently over the game canvas or not? - * This is modified by the VisibilityHandler. - * - * @name Phaser.Game#isOver - * @type {boolean} - * @readonly - * @since 3.10.0 - */ - this.isOver = true; - - // Wait for the DOM Ready event, then call boot. - DOMContentLoaded(this.boot.bind(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`. - * - * @method Phaser.Game#boot - * @protected - * @fires Phaser.Game#boot - * @since 3.0.0 - */ - boot: function () - { - if (!PluginCache.hasCore('EventEmitter')) - { - console.warn('Aborting. Core Plugins missing.'); - return; - } - - this.isBooted = true; - - this.config.preBoot(this); - - CreateRenderer(this); - - if (false) - {} - - 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 internal event when done: - this.events.once('texturesready', this.texturesReady, this); - }, - - /** - * Called automatically when the Texture Manager has finished setting up and preparing the - * default textures. - * - * @method Phaser.Game#texturesReady - * @private - * @fires Phaser.Game#ready - * @since 3.12.0 - */ - texturesReady: function () - { - // Start all the other systems - this.events.emit('ready'); - - this.start(); - }, - - /** - * 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; - - this.config.postBoot(this); - - if (this.renderer) - { - this.loop.start(this.step.bind(this)); - } - else - { - this.loop.start(this.headlessStep.bind(this)); - } - - VisibilityHandler(this); - - var eventEmitter = this.events; - - eventEmitter.on('hidden', this.onHidden, this); - eventEmitter.on('visible', this.onVisible, this); - eventEmitter.on('blur', this.onBlur, this); - eventEmitter.on('focus', this.onFocus, this); - }, - - /** - * Game Pre-Step event. - * - * Listen for it using the event type `prestep`. - * - * This event is dispatched before the main Step starts. - * By this point none of the Scene updates have happened. - * Hook into it from plugins or systems that need to update before the Scene Manager does. - * - * @event Phaser.Game#prestepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Step event. - * - * Listen for it using the event type `step`. - * - * This event is dispatched after Pre-Step and before the Scene Manager steps. - * Hook into it from plugins or systems that need to update before the Scene Manager does, but after core Systems. - * - * @event Phaser.Game#stepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Post-Step event. - * - * Listen for it using the event type `poststep`. - * - * This event is dispatched after the Scene Manager has updated. - * Hook into it from plugins or systems that need to do things before the render starts. - * - * @event Phaser.Game#poststepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Pre-Render event. - * - * Listen for it using the event type `prerender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * Game Post-Render event. - * - * Listen for it using the event type `postrender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * 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#prestepEvent - * @fires Phaser.Game#stepEvent - * @fires Phaser.Game#poststepEvent - * @fires Phaser.Game#prerenderEvent - * @fires Phaser.Game#postrenderEvent - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - step: function (time, delta) - { - if (this.pendingDestroy) - { - return this.runDestroy(); - } - - var eventEmitter = this.events; - - // Global Managers like Input and Sound update in the prestep - - eventEmitter.emit('prestep', time, delta); - - // This is mostly meant for user-land code and plugins - - eventEmitter.emit('step', time, delta); - - // Update the Scene Manager and all active Scenes - - this.scene.update(time, delta); - - // Our final event before rendering starts - - eventEmitter.emit('poststep', time, delta); - - var renderer = this.renderer; - - // Run the Pre-render (clearing the canvas, setting background colors, etc) - - renderer.preRender(); - - eventEmitter.emit('prerender', renderer, time, delta); - - // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. - - this.scene.render(renderer); - - // The Post-Render call. Tidies up loose end, takes snapshots, etc. - - renderer.postRender(); - - // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. - - eventEmitter.emit('postrender', renderer, time, delta); - }, - - /** - * 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 {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - headlessStep: function (time, delta) - { - var eventEmitter = this.events; - - // Global Managers - - eventEmitter.emit('prestep', time, delta); - - eventEmitter.emit('step', time, delta); - - // Scenes - - this.scene.update(time, delta); - - eventEmitter.emit('poststep', time, delta); - - // Render - - eventEmitter.emit('prerender'); - - eventEmitter.emit('postrender'); - }, - - /** - * Game Pause event. - * - * Listen for it using the event type `pause`. - * - * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. - * - * @event Phaser.Game#pauseEvent - */ - - /** - * 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(); - - this.events.emit('pause'); - }, - - /** - * Game Resume event. - * - * Listen for it using the event type `resume`. - * - * 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.Game#onVisible - * @protected - * @fires Phaser.Game#resumeEvent - * @since 3.0.0 - */ - onVisible: function () - { - this.loop.resume(); - - this.events.emit('resume'); - }, - - /** - * 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.hasFocus = false; - - this.loop.blur(); - }, - - /** - * 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.hasFocus = true; - - this.loop.focus(); - }, - - /** - * Game Resize event. - * - * Listen for it using the event type `resize`. - * - * @event Phaser.Game#resizeEvent - * @param {number} width - The new width of the Game. - * @param {number} height - The new height of the Game. - */ - - /** - * Updates the Game Config with the new width and height values given. - * Then resizes the Renderer and Input Manager scale. - * - * @method Phaser.Game#resize - * @fires Phaser.Game#resizeEvent - * @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; - - if (false) - {} - - this.renderer.resize(width, height); - - this.input.resize(); - - this.scene.resize(width, height); - - this.events.emit('resize', width, height); - }, - - /** - * Game Destroy event. - * - * Listen for it using the event type `destroy`. - * - * @event Phaser.Game#destroyEvent - */ - - /** - * Flags this Game instance as needing to be destroyed on the next frame. - * It will wait until the current frame has completed and then call `runDestroy` internally. - * - * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up - * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. - * - * @method Phaser.Game#destroy - * @fires Phaser.Game#destroyEvent - * @since 3.0.0 - * - * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. - * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. - */ - destroy: function (removeCanvas, noReturn) - { - if (noReturn === undefined) { noReturn = false; } - - this.pendingDestroy = true; - - this.removeCanvas = removeCanvas; - this.noReturn = noReturn; - }, - - /** - * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. - * - * @method Phaser.Game#runDestroy - * @private - * @since 3.5.0 - */ - runDestroy: function () - { - this.events.emit('destroy'); - - this.events.removeAllListeners(); - - this.scene.destroy(); - - if (this.renderer) - { - this.renderer.destroy(); - } - - if (this.removeCanvas && this.canvas) - { - CanvasPool.remove(this.canvas); - - if (this.canvas.parentNode) - { - this.canvas.parentNode.removeChild(this.canvas); - } - } - - if (false) - {} - - this.loop.destroy(); - - this.pendingDestroy = false; - } - -}); - -module.exports = Game; - - -/***/ }), -/* 977 */ -/***/ (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 EE = __webpack_require__(11); -var PluginCache = __webpack_require__(15); - -/** - * @classdesc - * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. - * - * @class EventEmitter - * @memberof Phaser.Events - * @constructor - * @since 3.0.0 - */ -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 () - { - this.removeAllListeners(); - } - -}); - -/** - * Return an array listing the events for which the emitter has registered listeners. - * - * @method Phaser.Events.EventEmitter#eventNames - * @since 3.0.0 - * - * @return {array} - */ - -/** - * Return the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#listeners - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {array} The registered listeners. - */ - -/** - * Return the number of listeners listening to a given event. - * - * @method Phaser.Events.EventEmitter#listenerCount - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {number} The number of listeners. - */ - -/** - * Calls each of the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#emit - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {...*} [args] - Additional arguments that will be passed to the event handler. - * - * @return {boolean} `true` if the event had listeners, else `false`. - */ - -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#on - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#addListener - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Add a one-time listener for a given event. - * - * @method Phaser.Events.EventEmitter#once - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#removeListener - * @since 3.0.0 - * - * @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 {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#off - * @since 3.0.0 - * - * @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 {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove all listeners, or those of the specified event. - * - * @method Phaser.Events.EventEmitter#removeAllListeners - * @since 3.0.0 - * - * @param {(string|symbol)} [event] - The event name. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -PluginCache.register('EventEmitter', EventEmitter, 'events'); - -module.exports = EventEmitter; - - -/***/ }), -/* 978 */ -/***/ (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.Events - */ - -module.exports = { EventEmitter: __webpack_require__(977) }; - - -/***/ }), -/* 979 */ +/* 1183 */ /***/ (function(module, exports) { // shim for using process in browser @@ -161091,2597 +174998,601 @@ process.umask = function() { return 0; }; /***/ }), -/* 980 */ +/* 1184 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.DOM - */ - -var Dom = { - - AddToDOM: __webpack_require__(187), - DOMContentLoaded: __webpack_require__(380), - ParseXML: __webpack_require__(379), - RemoveFromDOM: __webpack_require__(378), - RequestAnimationFrame: __webpack_require__(377) - -}; - -module.exports = Dom; - - -/***/ }), -/* 981 */ -/***/ (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.Display.Masks + * @namespace Phaser.Core */ module.exports = { - BitmapMask: __webpack_require__(430), - GeometryMask: __webpack_require__(429) + Config: __webpack_require__(428), + CreateRenderer: __webpack_require__(405), + DebugHeader: __webpack_require__(396), + Events: __webpack_require__(28), + TimeStep: __webpack_require__(395), + VisibilityHandler: __webpack_require__(393) }; /***/ }), -/* 982 */ -/***/ (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 ComponentToHex = __webpack_require__(382); - -/** - * 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 (prefix === '#') - { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - else - { - return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); - } -}; - -module.exports = RGBToString; - - -/***/ }), -/* 983 */ -/***/ (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 Between = __webpack_require__(188); -var Color = __webpack_require__(41); - -/** - * 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; } - - return new Color(Between(min, max), Between(min, max), Between(min, max)); -}; - -module.exports = RandomRGB; - - -/***/ }), -/* 984 */ -/***/ (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 Linear = __webpack_require__(129); - -/** - * Interpolates color values - * - * @namespace Phaser.Display.Color.Interpolate - * @since 3.0.0 - */ - -/** - * 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; } - - var t = index / length; - - return { - r: Linear(r1, r2, t), - g: Linear(g1, g2, t), - b: Linear(b1, b2, t) - }; -}; - -/** - * 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; } - - 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; } - - return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); -}; - -module.exports = { - - RGBWithRGB: RGBWithRGB, - ColorWithRGB: ColorWithRGB, - ColorWithColor: ColorWithColor - -}; - - -/***/ }), -/* 985 */ -/***/ (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 HSVToRGB = __webpack_require__(194); - -/** - * 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 {ColorObject[]} 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++) - { - colors.push(HSVToRGB(c / 359, s, v)); - } - - return colors; -}; - -module.exports = HSVColorWheel; - - -/***/ }), -/* 986 */ -/***/ (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__(41); -var HueToComponent = __webpack_require__(381); - -/** - * 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 q = (l < 0.5) ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - - r = HueToComponent(p, q, h + 1 / 3); - g = HueToComponent(p, q, h); - b = HueToComponent(p, q, h - 1 / 3); - } - - var color = new Color(); - - return color.setGLTo(r, g, b, 1); -}; - -module.exports = HSLToColor; - - -/***/ }), -/* 987 */ +/* 1185 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Systems Wake Event. + * + * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('wake', listener)`. + * + * @event Phaser.Scenes.Events#WAKE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was woken up. */ -var ColorToRGBA = function (color) -{ - var output = { - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF, - a: 255 - }; - - if (color > 16777215) - { - output.a = color >>> 24; - } - - return output; -}; - -module.exports = ColorToRGBA; +module.exports = 'wake'; /***/ }), -/* 988 */ +/* 1186 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Systems Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('update', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ -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; - }); - - canvas.style['-webkit-touch-callout'] = value; - canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - - return canvas; -}; - -module.exports = UserSelect; +module.exports = 'update'; /***/ }), -/* 989 */ +/* 1187 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Wake Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before + * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead. + * + * Listen to it from a Scene using `this.scene.events.on('transitionwake', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_WAKE + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -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; -}; - -module.exports = TouchAction; +module.exports = 'transitionwake'; /***/ }), -/* 990 */ -/***/ (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.Display.Canvas - */ - -module.exports = { - - CanvasInterpolation: __webpack_require__(384), - CanvasPool: __webpack_require__(26), - Smoothing: __webpack_require__(130), - TouchAction: __webpack_require__(989), - UserSelect: __webpack_require__(988) - -}; - - -/***/ }), -/* 991 */ +/* 1188 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Start Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep. + * + * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method, + * this event is dispatched anyway. + * + * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is + * dispatched instead of this event. + * + * Listen to it from a Scene using `this.scene.events.on('transitionstart', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_START + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -var GetOffsetY = function (gameObject) -{ - return gameObject.height * gameObject.originY; -}; - -module.exports = GetOffsetY; +module.exports = 'transitionstart'; /***/ }), -/* 992 */ +/* 1189 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Out Event. + * + * This event is dispatched by a Scene when it initiates a transition to another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('transitionout', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_OUT + * + * @param {Phaser.Scene} target - A reference to the Scene that is being transitioned to. + * @param {number} duration - The duration of the transition in ms. */ -var GetOffsetX = function (gameObject) -{ - return gameObject.width * gameObject.originX; -}; - -module.exports = GetOffsetX; +module.exports = 'transitionout'; /***/ }), -/* 993 */ -/***/ (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.Display.Bounds - */ - -module.exports = { - - CenterOn: __webpack_require__(448), - GetBottom: __webpack_require__(52), - GetCenterX: __webpack_require__(85), - GetCenterY: __webpack_require__(82), - GetLeft: __webpack_require__(50), - GetOffsetX: __webpack_require__(992), - GetOffsetY: __webpack_require__(991), - GetRight: __webpack_require__(48), - GetTop: __webpack_require__(46), - SetBottom: __webpack_require__(51), - SetCenterX: __webpack_require__(84), - SetCenterY: __webpack_require__(83), - SetLeft: __webpack_require__(49), - SetRight: __webpack_require__(47), - SetTop: __webpack_require__(45) - -}; - - -/***/ }), -/* 994 */ -/***/ (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__(48); -var GetTop = __webpack_require__(46); -var SetBottom = __webpack_require__(51); -var SetRight = __webpack_require__(47); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopRight; - - -/***/ }), -/* 995 */ -/***/ (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 GetLeft = __webpack_require__(50); -var GetTop = __webpack_require__(46); -var SetBottom = __webpack_require__(51); -var SetLeft = __webpack_require__(49); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopLeft; - - -/***/ }), -/* 996 */ -/***/ (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 GetCenterX = __webpack_require__(85); -var GetTop = __webpack_require__(46); -var SetBottom = __webpack_require__(51); -var SetCenterX = __webpack_require__(84); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopCenter; - - -/***/ }), -/* 997 */ -/***/ (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__(48); -var GetTop = __webpack_require__(46); -var SetLeft = __webpack_require__(49); -var SetTop = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = RightTop; - - -/***/ }), -/* 998 */ -/***/ (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 GetCenterY = __webpack_require__(82); -var GetRight = __webpack_require__(48); -var SetCenterY = __webpack_require__(83); -var SetLeft = __webpack_require__(49); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = RightCenter; - - -/***/ }), -/* 999 */ -/***/ (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 GetBottom = __webpack_require__(52); -var GetRight = __webpack_require__(48); -var SetBottom = __webpack_require__(51); -var SetLeft = __webpack_require__(49); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = RightBottom; - - -/***/ }), -/* 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} - */ - -var GetLeft = __webpack_require__(50); -var GetTop = __webpack_require__(46); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = LeftTop; - - -/***/ }), -/* 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} - */ - -var GetCenterY = __webpack_require__(82); -var GetLeft = __webpack_require__(50); -var SetCenterY = __webpack_require__(83); -var SetRight = __webpack_require__(47); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = LeftCenter; - - -/***/ }), -/* 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} - */ - -var GetBottom = __webpack_require__(52); -var GetLeft = __webpack_require__(50); -var SetBottom = __webpack_require__(51); -var SetRight = __webpack_require__(47); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = LeftBottom; - - -/***/ }), -/* 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} - */ - -var GetBottom = __webpack_require__(52); -var GetRight = __webpack_require__(48); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomRight; - - -/***/ }), -/* 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} - */ - -var GetBottom = __webpack_require__(52); -var GetLeft = __webpack_require__(50); -var SetLeft = __webpack_require__(49); -var SetTop = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomLeft; - - -/***/ }), -/* 1005 */ -/***/ (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 GetBottom = __webpack_require__(52); -var GetCenterX = __webpack_require__(85); -var SetCenterX = __webpack_require__(84); -var SetTop = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomCenter; - - -/***/ }), -/* 1006 */ -/***/ (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.Display.Align.To - */ - -module.exports = { - - BottomCenter: __webpack_require__(1005), - BottomLeft: __webpack_require__(1004), - BottomRight: __webpack_require__(1003), - LeftBottom: __webpack_require__(1002), - LeftCenter: __webpack_require__(1001), - LeftTop: __webpack_require__(1000), - RightBottom: __webpack_require__(999), - RightCenter: __webpack_require__(998), - RightTop: __webpack_require__(997), - TopCenter: __webpack_require__(996), - TopLeft: __webpack_require__(995), - TopRight: __webpack_require__(994) - -}; - - -/***/ }), -/* 1007 */ -/***/ (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.Display.Align.In - */ - -module.exports = { - - BottomCenter: __webpack_require__(452), - BottomLeft: __webpack_require__(451), - BottomRight: __webpack_require__(450), - Center: __webpack_require__(449), - LeftCenter: __webpack_require__(447), - QuickSet: __webpack_require__(453), - RightCenter: __webpack_require__(446), - TopCenter: __webpack_require__(445), - TopLeft: __webpack_require__(444), - TopRight: __webpack_require__(443) - -}; - - -/***/ }), -/* 1008 */ -/***/ (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 CONST = __webpack_require__(212); -var Extend = __webpack_require__(21); - -/** - * @namespace Phaser.Display.Align - */ - -var Align = { - - In: __webpack_require__(1007), - To: __webpack_require__(1006) - -}; - -// Merge in the consts -Align = Extend(false, Align, CONST); - -module.exports = Align; - - -/***/ }), -/* 1009 */ -/***/ (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.Display - */ - -module.exports = { - - Align: __webpack_require__(1008), - Bounds: __webpack_require__(993), - Canvas: __webpack_require__(990), - Color: __webpack_require__(383), - Masks: __webpack_require__(981) - -}; - - -/***/ }), -/* 1010 */ -/***/ (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__(102); -var PluginCache = __webpack_require__(15); - -/** - * @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 - A reference to the Scene that this DataManager belongs to. - */ -var DataManagerPlugin = new Class({ - - Extends: DataManager, - - initialize: - - function DataManagerPlugin (scene) - { - DataManager.call(this, scene, scene.sys.events); - - /** - * A reference to the Scene that this DataManager belongs to. - * - * @name Phaser.Data.DataManagerPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene's Systems. - * - * @name Phaser.Data.DataManagerPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Data.DataManagerPlugin#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.events = this.systems.events; - - this.events.once('destroy', this.destroy, this); - }, - - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Data.DataManagerPlugin#start - * @private - * @since 3.5.0 - */ - start: function () - { - this.events.once('shutdown', this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.Data.DataManagerPlugin#shutdown - * @private - * @since 3.5.0 - */ - shutdown: function () - { - this.systems.events.off('shutdown', this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Data.DataManagerPlugin#destroy - * @since 3.5.0 - */ - destroy: function () - { - DataManager.prototype.destroy.call(this); - - this.events.off('start', this.start, this); - - this.scene = null; - this.systems = null; - } - -}); - -PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); - -module.exports = DataManagerPlugin; - - -/***/ }), -/* 1011 */ -/***/ (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__(102), - DataManagerPlugin: __webpack_require__(1010) - -}; - - -/***/ }), -/* 1012 */ -/***/ (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__(3); - -/** - * @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); - }, - - /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.MoveTo#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - 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 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, - - /** - * Gets the resolution of this curve. - * - * @method Phaser.Curves.MoveTo#getResolution - * @since 3.0.0 - * - * @return {number} The resolution of this curve. For a MoveTo the value is always 1. - */ - getResolution: function () - { - return 1; - }, - - /** - * Gets the length of this curve. - * - * @method Phaser.Curves.MoveTo#getLength - * @since 3.0.0 - * - * @return {number} The length of this curve. For a MoveTo the value is always 0. - */ - getLength: function () - { - return 0; - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#toJSON - * @since 3.0.0 - * - * @return {JSONCurve} [description] - */ - toJSON: function () - { - return { - type: 'MoveTo', - points: [ - this.p0.x, this.p0.y - ] - }; - } - -}); - -module.exports = MoveTo; - - -/***/ }), -/* 1013 */ -/***/ (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 CubicBezierCurve = __webpack_require__(391); -var EllipseCurve = __webpack_require__(389); -var GameObjectFactory = __webpack_require__(5); -var LineCurve = __webpack_require__(388); -var MovePathTo = __webpack_require__(1012); -var QuadraticBezierCurve = __webpack_require__(387); -var Rectangle = __webpack_require__(10); -var SplineCurve = __webpack_require__(385); -var Vector2 = __webpack_require__(3); - -/** - * @typedef {object} JSONPath - * - * @property {string} type - The of the curve. - * @property {number} x - [description] - * @property {number} y - [description] - * @property {boolean} autoClose - The path is auto closed. - * @property {JSONCurve[]} curves - The list of the curves - */ - -/** - * @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({ - - initialize: - - function Path (x, y) - { - 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 {Phaser.Curves.Curve[]} - * @default [] - * @since 3.0.0 - */ - this.curves = []; - - /** - * [description] - * - * @name Phaser.Curves.Path#cacheLengths - * @type {number[]} - * @default [] - * @since 3.0.0 - */ - this.cacheLengths = []; - - /** - * Automatically closes the path. - * - * @name Phaser.Curves.Path#autoClose - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.autoClose = false; - - /** - * [description] - * - * @name Phaser.Curves.Path#startPoint - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.startPoint = new Vector2(); - - /** - * [description] - * - * @name Phaser.Curves.Path#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); - - /** - * [description] - * - * @name Phaser.Curves.Path#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); - - if (typeof x === 'object') - { - this.fromJSON(x); - } - else - { - this.startPoint.set(x, y); - } - }, - - /** - * [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); - - return this; - }, - - /** - * [description] - * - * @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] - */ - circleTo: function (radius, clockwise, rotation) - { - if (clockwise === undefined) { clockwise = false; } - - return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); - }, - - /** - * [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)); - } - - return this; - }, - - /** - * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. - * - * @method Phaser.Curves.Path#cubicBezierTo - * @since 3.0.0 - * - * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vec2, the p1 value. - * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vec2, the p2 value. - * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vec2, the p3 value. - * @param {number} [control1Y] - The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments. - * @param {number} [control2X] - The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. - * @param {number} [control2Y] - The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. - * - * @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) - { - 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.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] - */ - 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.Curves.Path#draw - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.Graphics} G - [out,$return] - * - * @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]; - - if (!curve.active) - { - continue; - } - - curve.draw(graphics, pointsTotal); - } - - return graphics; - }, - - /** - * 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); - - 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.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.curves = []; - this.cacheLengths = []; - - this.startPoint.set(data.x, data.y); - - this.autoClose = data.autoClose; - - for (var i = 0; i < data.curves.length; i++) - { - 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; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getBounds - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @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; - - 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]; - - 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); - } - - out.right = maxRight; - out.bottom = maxBottom; - - return out; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getCurveLengths - * @since 3.0.0 - * - * @return {number[]} [description] - */ - getCurveLengths: function () - { - // We use cache values if curves and cache array are same length - - if (this.cacheLengths.length === this.curves.length) - { - return this.cacheLengths; - } - - // Get length of sub-curve - // Push sums into cached array - - var lengths = []; - var sums = 0; - - for (var i = 0; i < this.curves.length; i++) - { - sums += this.curves[i].getLength(); - - lengths.push(sums); - } - - this.cacheLengths = lengths; - - return lengths; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getEndPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getEndPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - if (this.curves.length > 0) - { - this.curves[this.curves.length - 1].getPoint(1, out); - } - else - { - out.copy(this.startPoint); - } - - return out; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lens = this.getCurveLengths(); - - return lens[lens.length - 1]; - }, - - // 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 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @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(); } - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; - - while (i < curveLengths.length) - { - 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++; - } - - // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) - { - points.push(points[0]); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getRandomPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. - * - * @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)); - } - - if (this.autoClose) - { - points.push(points[0]); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getStartPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - 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.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._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.Curves.Path#splineTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2[]} points - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - splineTo: function (points) - { - points.unshift(this.getEndPoint()); - - return this.add(new SplineCurve(points)); - }, - - /** - * [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)); - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#toJSON - * @since 3.0.0 - * - * @return {JSONPath} [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.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; - - -/***/ }), -/* 1014 */ -/***/ (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.Curves - */ - -/** - * @typedef {object} JSONCurve - * - * @property {string} type - The of the curve - * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` - */ - -module.exports = { - Path: __webpack_require__(1013), - - CubicBezier: __webpack_require__(391), - Curve: __webpack_require__(80), - Ellipse: __webpack_require__(389), - Line: __webpack_require__(388), - QuadraticBezier: __webpack_require__(387), - Spline: __webpack_require__(385) -}; - - -/***/ }), -/* 1015 */ +/* 1190 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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. - * - * @name Phaser.Create.Palettes.MSX - * @since 3.0.0 - * - * @type {Palette} + * The Scene Transition Init Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method, + * this event is not dispatched. + * + * Listen to it from a Scene using `this.scene.events.on('transitioninit', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_INIT + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -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' -}; +module.exports = 'transitioninit'; /***/ }), -/* 1016 */ +/* 1191 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.JMP - * @since 3.0.0 - * - * @type {Palette} + * The Scene Transition Complete Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration + * of the transition. + * + * Listen to it from a Scene using `this.scene.events.on('transitioncomplete', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_COMPLETE + * + * @param {Phaser.Scene} scene -The Scene on which the transitioned completed. */ -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' -}; +module.exports = 'transitioncomplete'; /***/ }), -/* 1017 */ +/* 1192 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.CGA - * @since 3.0.0 - * - * @type {Palette} + * The Scene Systems Start Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('start', listener)`. + * + * @event Phaser.Scenes.Events#START + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. */ -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' -}; +module.exports = 'start'; /***/ }), -/* 1018 */ +/* 1193 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @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 {Palette} + * The Scene Systems Sleep Event. + * + * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('sleep', listener)`. + * + * @event Phaser.Scenes.Events#SLEEP + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was sent to sleep. */ -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' -}; +module.exports = 'sleep'; /***/ }), -/* 1019 */ +/* 1194 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Shutdown Event. + * + * This event is dispatched by a Scene during the Scene Systems shutdown process. + * + * Listen to it from a Scene using `this.scene.events.on('shutdown', listener)`. + * + * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding + * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not + * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources. + * + * @event Phaser.Scenes.Events#SHUTDOWN + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was shutdown. + */ +module.exports = 'shutdown'; + + +/***/ }), +/* 1195 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Resume Event. + * + * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('resume', listener)`. + * + * @event Phaser.Scenes.Events#RESUME + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was resumed. + */ +module.exports = 'resume'; + + +/***/ }), +/* 1196 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Render Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('render', listener)`. + * + * A Scene will only render if it is visible and active. + * By the time this event is dispatched, the Scene will have already been rendered. + * + * @event Phaser.Scenes.Events#RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. + */ +module.exports = 'render'; + + +/***/ }), +/* 1197 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Ready Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. + * By this point in the process the Scene is now fully active and rendering. + * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event. + * + * Listen to it from a Scene using `this.scene.events.on('ready', listener)`. + * + * @event Phaser.Scenes.Events#READY + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was started. + */ +module.exports = 'ready'; + + +/***/ }), +/* 1198 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pre Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('preupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#PRE_UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'preupdate'; + + +/***/ }), +/* 1199 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Post Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('postupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#POST_UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'postupdate'; + + +/***/ }), +/* 1200 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pause Event. + * + * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an + * action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('pause', listener)`. + * + * @event Phaser.Scenes.Events#PAUSE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was paused. + */ +module.exports = 'pause'; + + +/***/ }), +/* 1201 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Destroy Event. + * + * This event is dispatched by a Scene during the Scene Systems destroy process. + * + * Listen to it from a Scene using `this.scene.events.on('destroy', listener)`. + * + * You should destroy any resources that may be in use by your Scene in this event handler. + * + * @event Phaser.Scenes.Events#DESTROY + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1202 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Boot Event. + * + * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('boot', listener)`. + * + * @event Phaser.Scenes.Events#BOOT + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'boot'; + + +/***/ }), +/* 1203 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} Palette - * - * @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. - */ - -/** - * @namespace Phaser.Create.Palettes - */ - -module.exports = { - - ARNE16: __webpack_require__(392), - C64: __webpack_require__(1018), - CGA: __webpack_require__(1017), - JMP: __webpack_require__(1016), - MSX: __webpack_require__(1015) - -}; - - -/***/ }), -/* 1020 */ -/***/ (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.Create - */ - -module.exports = { - - GenerateTexture: __webpack_require__(393), - Palettes: __webpack_require__(1019) - -}; - - -/***/ }), -/* 1021 */ -/***/ (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 Camera = __webpack_require__(414); +var Camera = __webpack_require__(449); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(1); -var PluginCache = __webpack_require__(15); -var RectangleContains = __webpack_require__(43); +var PluginCache = __webpack_require__(17); +var RectangleContains = __webpack_require__(47); +var SceneEvents = __webpack_require__(16); /** * @typedef {object} InputJSONCameraObject @@ -163807,17 +175718,8 @@ var CameraManager = new Class({ */ this.main; - /** - * This scale affects all cameras. It's used by the Scale Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#baseScale - * @type {number} - * @since 3.0.0 - */ - this.baseScale = 1; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -163826,6 +175728,7 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#boot * @private + * @listens Phaser.Scenes.Events#DESTROY * @since 3.5.1 */ boot: function () @@ -163845,7 +175748,7 @@ var CameraManager = new Class({ this.main = this.cameras[0]; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -163855,6 +175758,8 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#start * @private + * @listens Phaser.Scenes.Events#UPDATE + * @listens Phaser.Scenes.Events#SHUTDOWN * @since 3.5.0 */ start: function () @@ -163879,8 +175784,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -163895,7 +175800,7 @@ var CameraManager = new Class({ * By default Cameras are transparent and will render anything that they can see based on their `scrollX` * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. * - * The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after creation if required. * * See the Camera class documentation for more details. @@ -163916,8 +175821,8 @@ var CameraManager = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (makeMain === undefined) { makeMain = false; } if (name === undefined) { name = ''; } @@ -163944,7 +175849,7 @@ var CameraManager = new Class({ * * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. * - * The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after addition if required. * * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the @@ -164085,8 +175990,8 @@ var CameraManager = new Class({ config = [ config ]; } - var gameWidth = this.scene.sys.game.config.width; - var gameHeight = this.scene.sys.game.config.height; + var gameWidth = this.scene.sys.scale.width; + var gameHeight = this.scene.sys.scale.height; for (var i = 0; i < config.length; i++) { @@ -164271,8 +176176,6 @@ var CameraManager = new Class({ { var scene = this.scene; var cameras = this.cameras; - var baseScale = this.baseScale; - var resolution = renderer.config.resolution; for (var i = 0; i < this.cameras.length; i++) { @@ -164280,7 +176183,8 @@ var CameraManager = new Class({ if (camera.visible && camera.alpha > 0) { - camera.preRender(baseScale, resolution); + // Hard-coded to 1 for now + camera.preRender(1); renderer.render(scene, children, interpolation, camera); } @@ -164319,14 +176223,14 @@ var CameraManager = new Class({ * @protected * @since 3.0.0 * - * @param {number} timestep - The timestep value. - * @param {number} delta - The delta value since the last frame. + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - update: function (timestep, delta) + update: function (time, delta) { for (var i = 0; i < this.cameras.length; i++) { - this.cameras[i].update(timestep, delta); + this.cameras[i].update(time, delta); } }, @@ -164368,8 +176272,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -164384,7 +176288,7 @@ var CameraManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -164398,18 +176302,19 @@ module.exports = CameraManager; /***/ }), -/* 1022 */ +/* 1204 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(192); +var EaseMap = __webpack_require__(208); +var Events = __webpack_require__(45); /** * @classdesc @@ -164541,36 +176446,18 @@ var Zoom = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the Zoom effect begins to run on a camera. - * - * @event CameraZoomStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} zoom - The destination zoom value. - */ - - /** - * This event is fired when the Zoom effect completes. - * - * @event CameraZoomCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - */ - /** * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#start - * @fires CameraZoomStartEvent - * @fires CameraZoomCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. * @param {CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * and the current camera zoom value. @@ -164618,7 +176505,7 @@ var Zoom = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerazoomstart', this.camera, this, duration, zoom); + this.camera.emit(Events.ZOOM_START, this.camera, this, duration, zoom); return cam; }, @@ -164669,6 +176556,7 @@ var Zoom = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -164678,7 +176566,7 @@ var Zoom = new Class({ this.isRunning = false; - this.camera.emit('camerazoomcomplete', this.camera, this); + this.camera.emit(Events.ZOOM_COMPLETE, this.camera, this); }, /** @@ -164715,17 +176603,18 @@ module.exports = Zoom; /***/ }), -/* 1023 */ +/* 1205 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); +var Events = __webpack_require__(45); var Vector2 = __webpack_require__(3); /** @@ -164866,30 +176755,12 @@ var Shake = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the shake effect begins to run on a camera. - * - * @event CameraShakeStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} intensity - The intensity of the effect. - */ - - /** - * This event is fired when the shake effect completes. - * - * @event CameraShakeCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - */ - /** * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Shake#start - * @fires CameraShakeStartEvent - * @fires CameraShakeCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -164934,7 +176805,7 @@ var Shake = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerashakestart', this.camera, this, duration, intensity); + this.camera.emit(Events.SHAKE_START, this.camera, this, duration, intensity); return this.camera; }, @@ -164990,8 +176861,8 @@ var Shake = new Class({ if (this.camera.roundPixels) { - this._offsetX |= 0; - this._offsetY |= 0; + this._offsetX = Math.round(this._offsetX); + this._offsetY = Math.round(this._offsetY); } } else @@ -165004,6 +176875,7 @@ var Shake = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Shake#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -165016,7 +176888,7 @@ var Shake = new Class({ this.isRunning = false; - this.camera.emit('camerashakecomplete', this.camera, this); + this.camera.emit(Events.SHAKE_COMPLETE, this.camera, this); }, /** @@ -165057,12 +176929,12 @@ module.exports = Shake; /***/ }), -/* 1024 */ +/* 1206 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165099,12 +176971,12 @@ module.exports = Stepped; /***/ }), -/* 1025 */ +/* 1207 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165138,12 +177010,12 @@ module.exports = InOut; /***/ }), -/* 1026 */ +/* 1208 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165177,12 +177049,12 @@ module.exports = Out; /***/ }), -/* 1027 */ +/* 1209 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165216,12 +177088,12 @@ module.exports = In; /***/ }), -/* 1028 */ +/* 1210 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165251,12 +177123,12 @@ module.exports = InOut; /***/ }), -/* 1029 */ +/* 1211 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165279,12 +177151,12 @@ module.exports = Out; /***/ }), -/* 1030 */ +/* 1212 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165307,12 +177179,12 @@ module.exports = In; /***/ }), -/* 1031 */ +/* 1213 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165342,12 +177214,12 @@ module.exports = InOut; /***/ }), -/* 1032 */ +/* 1214 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165370,12 +177242,12 @@ module.exports = Out; /***/ }), -/* 1033 */ +/* 1215 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165398,12 +177270,12 @@ module.exports = In; /***/ }), -/* 1034 */ +/* 1216 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165433,12 +177305,12 @@ module.exports = InOut; /***/ }), -/* 1035 */ +/* 1217 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165461,12 +177333,12 @@ module.exports = Out; /***/ }), -/* 1036 */ +/* 1218 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165489,12 +177361,12 @@ module.exports = In; /***/ }), -/* 1037 */ +/* 1219 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165517,12 +177389,12 @@ module.exports = Linear; /***/ }), -/* 1038 */ +/* 1220 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165552,12 +177424,12 @@ module.exports = InOut; /***/ }), -/* 1039 */ +/* 1221 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165580,12 +177452,12 @@ module.exports = Out; /***/ }), -/* 1040 */ +/* 1222 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165608,12 +177480,12 @@ module.exports = In; /***/ }), -/* 1041 */ +/* 1223 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165625,7 +177497,7 @@ module.exports = In; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -165670,12 +177542,12 @@ module.exports = InOut; /***/ }), -/* 1042 */ +/* 1224 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165687,7 +177559,7 @@ module.exports = InOut; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -165725,12 +177597,12 @@ module.exports = Out; /***/ }), -/* 1043 */ +/* 1225 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165742,7 +177614,7 @@ module.exports = Out; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -165780,12 +177652,12 @@ module.exports = In; /***/ }), -/* 1044 */ +/* 1226 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165815,12 +177687,12 @@ module.exports = InOut; /***/ }), -/* 1045 */ +/* 1227 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165843,12 +177715,12 @@ module.exports = Out; /***/ }), -/* 1046 */ +/* 1228 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165871,12 +177743,12 @@ module.exports = In; /***/ }), -/* 1047 */ +/* 1229 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165906,12 +177778,12 @@ module.exports = InOut; /***/ }), -/* 1048 */ +/* 1230 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165934,12 +177806,12 @@ module.exports = Out; /***/ }), -/* 1049 */ +/* 1231 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165962,12 +177834,12 @@ module.exports = In; /***/ }), -/* 1050 */ +/* 1232 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -166026,12 +177898,12 @@ module.exports = InOut; /***/ }), -/* 1051 */ +/* 1233 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -166069,12 +177941,12 @@ module.exports = Out; /***/ }), -/* 1052 */ +/* 1234 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -166114,12 +177986,12 @@ module.exports = In; /***/ }), -/* 1053 */ +/* 1235 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -166154,12 +178026,12 @@ module.exports = InOut; /***/ }), -/* 1054 */ +/* 1236 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -166185,12 +178057,12 @@ module.exports = Out; /***/ }), -/* 1055 */ +/* 1237 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -166216,19 +178088,20 @@ module.exports = In; /***/ }), -/* 1056 */ +/* 1238 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); +var EaseMap = __webpack_require__(208); +var Events = __webpack_require__(45); var Vector2 = __webpack_require__(3); -var EaseMap = __webpack_require__(192); /** * @classdesc @@ -166374,39 +178247,20 @@ var Pan = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the pan effect begins to run on a camera. - * - * @event CameraPanStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} x - The destination scroll x coordinate. - * @param {number} y - The destination scroll y coordinate. - */ - - /** - * This event is fired when the pan effect completes. - * - * @event CameraPanCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - */ - /** * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Pan#start - * @fires CameraPanStartEvent - * @fires CameraPanCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -166457,7 +178311,7 @@ var Pan = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerapanstart', this.camera, this, duration, x, y); + this.camera.emit(Events.PAN_START, this.camera, this, duration, x, y); return cam; }, @@ -166519,6 +178373,7 @@ var Pan = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Pan#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -166528,7 +178383,7 @@ var Pan = new Class({ this.isRunning = false; - this.camera.emit('camerapancomplete', this.camera, this); + this.camera.emit(Events.PAN_COMPLETE, this.camera, this); }, /** @@ -166567,17 +178422,18 @@ module.exports = Pan; /***/ }), -/* 1057 */ +/* 1239 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); +var Events = __webpack_require__(45); /** * @classdesc @@ -166728,32 +178584,12 @@ var Flash = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the flash effect begins to run on a camera. - * - * @event CameraFlashStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the flash effect completes. - * - * @event CameraFlashCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - */ - /** * Flashes the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Flash#start - * @fires CameraFlashStartEvent - * @fires CameraFlashCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -166796,7 +178632,7 @@ var Flash = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('cameraflashstart', this.camera, this, duration, red, green, blue); + this.camera.emit(Events.FLASH_START, this.camera, this, duration, red, green, blue); return this.camera; }, @@ -166897,6 +178733,7 @@ var Flash = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Flash#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -166906,7 +178743,7 @@ var Flash = new Class({ this.isRunning = false; - this.camera.emit('cameraflashcomplete', this.camera, this); + this.camera.emit(Events.FLASH_COMPLETE, this.camera, this); }, /** @@ -166943,17 +178780,18 @@ module.exports = Flash; /***/ }), -/* 1058 */ +/* 1240 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(24); var Class = __webpack_require__(0); +var Events = __webpack_require__(45); /** * @classdesc @@ -167129,54 +178967,12 @@ var Fade = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the fade in effect begins to run on a camera. - * - * @event CameraFadeInStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade out effect begins to run on a camera. - * - * @event CameraFadeOutStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade in effect completes. - * - * @event CameraFadeInCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - - /** - * This event is fired when the fade out effect completes. - * - * @event CameraFadeOutCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - /** * Fades the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Fade#start - * @fires CameraFadeInStartEvent - * @fires CameraFadeInCompleteEvent - * @fires CameraFadeOutStartEvent - * @fires CameraFadeOutCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START * @since 3.5.0 * * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) @@ -167223,7 +179019,7 @@ var Fade = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - var eventName = (direction) ? 'camerafadeoutstart' : 'camerafadeinstart'; + var eventName = (direction) ? Events.FADE_OUT_START : Events.FADE_IN_START; this.camera.emit(eventName, this.camera, this, duration, red, green, blue); @@ -167326,6 +179122,8 @@ var Fade = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Fade#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -167336,7 +179134,7 @@ var Fade = new Class({ this.isRunning = false; this.isComplete = true; - var eventName = (this.direction) ? 'camerafadeoutcomplete' : 'camerafadeincomplete'; + var eventName = (this.direction) ? Events.FADE_OUT_COMPLETE : Events.FADE_IN_COMPLETE; this.camera.emit(eventName, this.camera, this); }, @@ -167376,12 +179174,387 @@ module.exports = Fade; /***/ }), -/* 1059 */ +/* 1241 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Start Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} zoom - The destination zoom value. + */ +module.exports = 'camerazoomstart'; + + +/***/ }), +/* 1242 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Complete Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + */ +module.exports = 'camerazoomcomplete'; + + +/***/ }), +/* 1243 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Start Event. + * + * This event is dispatched by a Camera instance when the Shake Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} intensity - The intensity of the effect. + */ +module.exports = 'camerashakestart'; + + +/***/ }), +/* 1244 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Complete Event. + * + * This event is dispatched by a Camera instance when the Shake Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + */ +module.exports = 'camerashakecomplete'; + + +/***/ }), +/* 1245 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pre-Render Event. + * + * This event is dispatched by a Camera instance when it is about to render. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('prerender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#PRE_RENDER + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that is about to render to a texture. + */ +module.exports = 'prerender'; + + +/***/ }), +/* 1246 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Post-Render Event. + * + * This event is dispatched by a Camera instance after is has finished rendering. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('postrender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#POST_RENDER + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that has finished rendering to a texture. + */ +module.exports = 'postrender'; + + +/***/ }), +/* 1247 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Start Event. + * + * This event is dispatched by a Camera instance when the Pan Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} x - The destination scroll x coordinate. + * @param {number} y - The destination scroll y coordinate. + */ +module.exports = 'camerapanstart'; + + +/***/ }), +/* 1248 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Complete Event. + * + * This event is dispatched by a Camera instance when the Pan Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + */ +module.exports = 'camerapancomplete'; + + +/***/ }), +/* 1249 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Start Event. + * + * This event is dispatched by a Camera instance when the Flash Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'cameraflashstart'; + + +/***/ }), +/* 1250 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Complete Event. + * + * This event is dispatched by a Camera instance when the Flash Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + */ +module.exports = 'cameraflashcomplete'; + + +/***/ }), +/* 1251 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Start Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeoutstart'; + + +/***/ }), +/* 1252 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Complete Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutcomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeoutcomplete'; + + +/***/ }), +/* 1253 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Start Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeinstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeinstart'; + + +/***/ }), +/* 1254 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Complete Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeincomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeincomplete'; + + +/***/ }), +/* 1255 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Destroy Camera Event. + * + * This event is dispatched by a Camera instance when it is destroyed by the Camera Manager. + * + * @event Phaser.Cameras.Scene2D.Events#DESTROY + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. + */ +module.exports = 'cameradestroy'; + + +/***/ }), +/* 1256 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -167391,40 +179564,27 @@ module.exports = Fade; module.exports = { - Camera: __webpack_require__(414), - CameraManager: __webpack_require__(1021), - Effects: __webpack_require__(406) + Camera: __webpack_require__(449), + CameraManager: __webpack_require__(1203), + Effects: __webpack_require__(441), + Events: __webpack_require__(45) }; /***/ }), -/* 1060 */ +/* 1257 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 -// }; - /** * @typedef {object} SmoothedKeyControlConfig * @@ -167442,14 +179602,36 @@ var GetValue = __webpack_require__(4); /** * @classdesc - * [description] + * A Smoothed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * Unlike the Fixed Camera Control you can also provide physics values for acceleration, drag and maxSpeed for smoothing effects. + * + * ```javascript + * + * 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 + * }; + * ``` + * + * You must call the `update` method of this controller every frame. * * @class SmoothedKeyControl * @memberof Phaser.Cameras.Controls * @constructor * @since 3.0.0 * - * @param {SmoothedKeyControlConfig} config - [description] + * @param {SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. */ var SmoothedKeyControl = new Class({ @@ -167637,7 +179819,7 @@ var SmoothedKeyControl = new Class({ } /** - * [description] + * Internal property to track the speed of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX * @type {number} @@ -167648,7 +179830,7 @@ var SmoothedKeyControl = new Class({ this._speedX = 0; /** - * [description] + * Internal property to track the speed of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY * @type {number} @@ -167659,7 +179841,7 @@ var SmoothedKeyControl = new Class({ this._speedY = 0; /** - * [description] + * Internal property to track the zoom of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom * @type {number} @@ -167727,12 +179909,14 @@ var SmoothedKeyControl = new Class({ }, /** - * [description] + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. * * @method Phaser.Cameras.Controls.SmoothedKeyControl#update * @since 3.0.0 * - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ update: function (delta) { @@ -167888,25 +180072,18 @@ module.exports = SmoothedKeyControl; /***/ }), -/* 1061 */ +/* 1258 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 camControl = new CameraControl({ -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// speed: float OR { x: 0, y: 0 } -// }) - /** * @typedef {object} FixedKeyControlConfig * @@ -167923,14 +180100,29 @@ var GetValue = __webpack_require__(4); /** * @classdesc - * [description] + * A Fixed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * + * ```javascript + * var camControl = new FixedKeyControl({ + * camera: this.cameras.main, + * left: cursors.left, + * right: cursors.right, + * speed: float OR { x: 0, y: 0 } + * }); + * ``` + * + * Movement is precise and has no 'smoothing' applied to it. + * + * You must call the `update` method of this controller every frame. * * @class FixedKeyControl * @memberof Phaser.Cameras.Controls * @constructor * @since 3.0.0 * - * @param {FixedKeyControlConfig} config - [description] + * @param {FixedKeyControlConfig} config - The Fixed Key Control configuration object. */ var FixedKeyControl = new Class({ @@ -168052,7 +180244,7 @@ var FixedKeyControl = new Class({ } /** - * [description] + * Internal property to track the current zoom level. * * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom * @type {number} @@ -168120,7 +180312,9 @@ var FixedKeyControl = new Class({ }, /** - * [description] + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. * * @method Phaser.Cameras.Controls.FixedKeyControl#update * @since 3.0.0 @@ -168198,12 +180392,12 @@ module.exports = FixedKeyControl; /***/ }), -/* 1062 */ +/* 1259 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168213,19 +180407,19 @@ module.exports = FixedKeyControl; module.exports = { - FixedKeyControl: __webpack_require__(1061), - SmoothedKeyControl: __webpack_require__(1060) + FixedKeyControl: __webpack_require__(1258), + SmoothedKeyControl: __webpack_require__(1257) }; /***/ }), -/* 1063 */ +/* 1260 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168235,19 +180429,67 @@ module.exports = { module.exports = { - Controls: __webpack_require__(1062), - Scene2D: __webpack_require__(1059) + Controls: __webpack_require__(1259), + Scene2D: __webpack_require__(1256) }; /***/ }), -/* 1064 */ +/* 1261 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Remove Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time an object is removed from it. + * + * @event Phaser.Cache.Events#REMOVE + * + * @param {Phaser.Cache.BaseCache} cache - The cache from which the object was removed. + * @param {string} key - The key of the object removed from the cache. + * @param {*} object - A reference to the object that was removed from the cache. + */ +module.exports = 'remove'; + + +/***/ }), +/* 1262 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Add Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time a new object is added to it. + * + * @event Phaser.Cache.Events#ADD + * + * @param {Phaser.Cache.BaseCache} cache - The cache to which the object was added. + * @param {string} key - The key of the object added to the cache. + * @param {*} object - A reference to the object that was added to the cache. + */ +module.exports = 'add'; + + +/***/ }), +/* 1263 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168257,19 +180499,336 @@ module.exports = { module.exports = { - BaseCache: __webpack_require__(416), - CacheManager: __webpack_require__(415) + BaseCache: __webpack_require__(452), + CacheManager: __webpack_require__(450), + Events: __webpack_require__(451) }; /***/ }), -/* 1065 */ +/* 1264 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Visible Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a visible state, previously having been hidden. + * + * Only browsers that support the Visibility API will cause this event to be emitted. + * + * @event Phaser.Core.Events#VISIBLE + */ +module.exports = 'visible'; + + +/***/ }), +/* 1265 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Step Event. + * + * This event is dispatched after the Game Pre-Step and before the Scene Manager steps. + * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have. + * + * @event Phaser.Core.Events#STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'step'; + + +/***/ }), +/* 1266 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Resume Event. + * + * This event is dispatched when the game loop leaves a paused state and resumes running. + * + * @event Phaser.Core.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 1267 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Ready Event. + * + * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, + * and all local systems are now able to start. + * + * @event Phaser.Core.Events#READY + */ +module.exports = 'ready'; + + +/***/ }), +/* 1268 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Pre-Step Event. + * + * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. + * Hook into it from plugins or systems that need to update before the Scene Manager does. + * + * @event Phaser.Core.Events#PRE_STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'prestep'; + + +/***/ }), +/* 1269 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PRE_RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'prerender'; + + +/***/ }), +/* 1270 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Step Event. + * + * This event is dispatched after the Scene Manager has updated. + * Hook into it from plugins or systems that need to do things before the render starts. + * + * @event Phaser.Core.Events#POST_STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'poststep'; + + +/***/ }), +/* 1271 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Render Event. + * + * This event is dispatched right at the end of the render process. + * + * Every Scene will have rendered and been drawn to the canvas by the time this event is fired. + * Use it for any last minute post-processing before the next game step begins. + * + * @event Phaser.Core.Events#POST_RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'postrender'; + + +/***/ }), +/* 1272 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 1273 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Hidden Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted. + * + * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which + * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something + * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games) + * + * @event Phaser.Core.Events#HIDDEN + */ +module.exports = 'hidden'; + + +/***/ }), +/* 1274 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Focus Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it. + * + * @event Phaser.Core.Events#FOCUS + */ +module.exports = 'focus'; + + +/***/ }), +/* 1275 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Destroy Event. + * + * This event is dispatched when the game instance has been told to destroy itself. + * Lots of internal systems listen to this event in order to clear themselves out. + * Custom plugins and game code should also do the same. + * + * @event Phaser.Core.Events#DESTROY + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1276 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Boot Event. + * + * This event is dispatched when the Phaser Game instance 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.Core.Events#BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 1277 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Blur Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps + * tab, or if they simply remove focus from the browser to another app. + * + * @event Phaser.Core.Events#BLUR + */ +module.exports = 'blur'; + + +/***/ }), +/* 1278 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168279,25 +180838,26 @@ module.exports = { module.exports = { - Animation: __webpack_require__(420), - AnimationFrame: __webpack_require__(418), - AnimationManager: __webpack_require__(417) + Animation: __webpack_require__(226), + AnimationFrame: __webpack_require__(471), + AnimationManager: __webpack_require__(453), + Events: __webpack_require__(146) }; /***/ }), -/* 1066 */ +/* 1279 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author samme - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(63); /** * Wrap each item's coordinates within a rectangle's area. @@ -168336,12 +180896,12 @@ module.exports = WrapInRectangle; /***/ }), -/* 1067 */ +/* 1280 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168372,12 +180932,12 @@ module.exports = ToggleVisible; /***/ }), -/* 1068 */ +/* 1281 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168435,16 +180995,16 @@ module.exports = Spread; /***/ }), -/* 1069 */ +/* 1282 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmoothStep = __webpack_require__(199); +var MathSmoothStep = __webpack_require__(215); /** * Smoothstep is a sigmoid-like interpolation and clamping function. @@ -168493,16 +181053,16 @@ module.exports = SmoothStep; /***/ }), -/* 1070 */ +/* 1283 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmootherStep = __webpack_require__(200); +var MathSmootherStep = __webpack_require__(216); /** * Smootherstep is a sigmoid-like interpolation and clamping function. @@ -168551,16 +181111,16 @@ module.exports = SmootherStep; /***/ }), -/* 1071 */ +/* 1284 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayShuffle = __webpack_require__(132); +var ArrayShuffle = __webpack_require__(142); /** * Shuffles the array in place. The shuffled array is both modified and returned. @@ -168584,12 +181144,12 @@ module.exports = Shuffle; /***/ }), -/* 1072 */ +/* 1285 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168714,16 +181274,16 @@ module.exports = ShiftPosition; /***/ }), -/* 1073 */ +/* 1286 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `y` @@ -168755,16 +181315,16 @@ module.exports = SetY; /***/ }), -/* 1074 */ +/* 1287 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` @@ -168802,16 +181362,16 @@ module.exports = SetXY; /***/ }), -/* 1075 */ +/* 1288 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `x` @@ -168843,16 +181403,16 @@ module.exports = SetX; /***/ }), -/* 1076 */ +/* 1289 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `visible` @@ -168881,12 +181441,12 @@ module.exports = SetVisible; /***/ }), -/* 1077 */ +/* 1290 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168920,16 +181480,16 @@ module.exports = SetTint; /***/ }), -/* 1078 */ +/* 1291 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `scaleY` @@ -168961,16 +181521,16 @@ module.exports = SetScaleY; /***/ }), -/* 1079 */ +/* 1292 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `scaleX` @@ -169002,16 +181562,16 @@ module.exports = SetScaleX; /***/ }), -/* 1080 */ +/* 1293 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` @@ -169049,16 +181609,16 @@ module.exports = SetScale; /***/ }), -/* 1081 */ +/* 1294 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `rotation` @@ -169090,16 +181650,16 @@ module.exports = SetRotation; /***/ }), -/* 1082 */ +/* 1295 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` @@ -169137,12 +181697,12 @@ module.exports = SetOrigin; /***/ }), -/* 1083 */ +/* 1296 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169176,16 +181736,16 @@ module.exports = SetHitArea; /***/ }), -/* 1084 */ +/* 1297 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `depth` @@ -169217,16 +181777,16 @@ module.exports = SetDepth; /***/ }), -/* 1085 */ +/* 1298 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `blendMode` @@ -169257,16 +181817,16 @@ module.exports = SetBlendMode; /***/ }), -/* 1086 */ +/* 1299 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(27); +var PropertyValueSet = __webpack_require__(29); /** * Takes an array of Game Objects, or any objects that have the public property `alpha` @@ -169298,16 +181858,16 @@ module.exports = SetAlpha; /***/ }), -/* 1087 */ +/* 1300 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `scaleY` property, @@ -169339,16 +181899,16 @@ module.exports = ScaleY; /***/ }), -/* 1088 */ +/* 1301 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, @@ -169386,16 +181946,16 @@ module.exports = ScaleXY; /***/ }), -/* 1089 */ +/* 1302 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `scaleX` property, @@ -169427,16 +181987,16 @@ module.exports = ScaleX; /***/ }), -/* 1090 */ +/* 1303 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathRotateAroundDistance = __webpack_require__(201); +var MathRotateAroundDistance = __webpack_require__(217); /** * Rotates an array of Game Objects around a point by the given angle and distance. @@ -169476,17 +182036,17 @@ module.exports = RotateAroundDistance; /***/ }), -/* 1091 */ +/* 1304 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundDistance = __webpack_require__(201); -var DistanceBetween = __webpack_require__(58); +var RotateAroundDistance = __webpack_require__(217); +var DistanceBetween = __webpack_require__(62); /** * Rotates each item around the given point by the given angle. @@ -169522,16 +182082,16 @@ module.exports = RotateAround; /***/ }), -/* 1092 */ +/* 1305 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `rotation` property, @@ -169563,16 +182123,16 @@ module.exports = Rotate; /***/ }), -/* 1093 */ +/* 1306 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(202); +var Random = __webpack_require__(218); /** * Takes an array of Game Objects and positions them at random locations within the Triangle. @@ -169603,16 +182163,16 @@ module.exports = RandomTriangle; /***/ }), -/* 1094 */ +/* 1307 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(206); +var Random = __webpack_require__(222); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -169641,16 +182201,16 @@ module.exports = RandomRectangle; /***/ }), -/* 1095 */ +/* 1308 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(207); +var Random = __webpack_require__(223); /** * Takes an array of Game Objects and positions them at random locations on the Line. @@ -169681,16 +182241,16 @@ module.exports = RandomLine; /***/ }), -/* 1096 */ +/* 1309 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(203); +var Random = __webpack_require__(219); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -169721,16 +182281,16 @@ module.exports = RandomEllipse; /***/ }), -/* 1097 */ +/* 1310 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(210); +var Random = __webpack_require__(227); /** * Takes an array of Game Objects and positions them at random locations within the Circle. @@ -169761,12 +182321,12 @@ module.exports = RandomCircle; /***/ }), -/* 1098 */ +/* 1311 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169798,16 +182358,16 @@ module.exports = PlayAnimation; /***/ }), -/* 1099 */ +/* 1312 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BresenhamPoints = __webpack_require__(421); +var BresenhamPoints = __webpack_require__(454); /** * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. @@ -169859,18 +182419,18 @@ module.exports = PlaceOnTriangle; /***/ }), -/* 1100 */ +/* 1313 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MarchingAnts = __webpack_require__(424); -var RotateLeft = __webpack_require__(423); -var RotateRight = __webpack_require__(422); +var MarchingAnts = __webpack_require__(457); +var RotateLeft = __webpack_require__(456); +var RotateRight = __webpack_require__(455); /** * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. @@ -169917,16 +182477,16 @@ module.exports = PlaceOnRectangle; /***/ }), -/* 1101 */ +/* 1314 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetPoints = __webpack_require__(208); +var GetPoints = __webpack_require__(224); /** * Positions an array of Game Objects on evenly spaced points of a Line. @@ -169961,12 +182521,12 @@ module.exports = PlaceOnLine; /***/ }), -/* 1102 */ +/* 1315 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170013,12 +182573,12 @@ module.exports = PlaceOnEllipse; /***/ }), -/* 1103 */ +/* 1316 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170062,16 +182622,16 @@ module.exports = PlaceOnCircle; /***/ }), -/* 1104 */ +/* 1317 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `y` property, @@ -170103,16 +182663,16 @@ module.exports = IncY; /***/ }), -/* 1105 */ +/* 1318 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, @@ -170150,16 +182710,16 @@ module.exports = IncXY; /***/ }), -/* 1106 */ +/* 1319 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `x` property, @@ -170191,16 +182751,16 @@ module.exports = IncX; /***/ }), -/* 1107 */ +/* 1320 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `alpha` property, @@ -170232,12 +182792,151 @@ module.exports = IncAlpha; /***/ }), -/* 1108 */ +/* 1321 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Destroy Event. + * + * This event is dispatched when a Game Object instance is being destroyed. + * + * Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`. + * + * @event Phaser.GameObjects.Events#DESTROY + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object which is being destroyed. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1322 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Set Data Event. + * + * This event is dispatched by a Data Manager when a new item is added to the data store. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the addition of a new data item on a Game Object you would use: `sprite.data.on('setdata', listener)`. + * + * @event Phaser.Data.Events#SET_DATA + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'setdata'; + + +/***/ }), +/* 1323 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Data Event. + * + * This event is dispatched by a Data Manager when an item is removed from it. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the removal of a data item on a Game Object you would use: `sprite.data.on('removedata', listener)`. + * + * @event Phaser.Data.Events#REMOVE_DATA + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was removed from the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'removedata'; + + +/***/ }), +/* 1324 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Key Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the change of a specific data item from a Game Object you would use: `sprite.data.on('changedata-key', listener)`, + * where `key` is the unique string key of the data item. For example, if you have a data item stored called `gold` + * then you can listen for `sprite.data.on('changedata-gold')`. + * + * @event Phaser.Data.Events#CHANGE_DATA_KEY + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + * @param {any} previousValue - The previous item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'changedata-'; + + +/***/ }), +/* 1325 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * a change data event from a Game Object you would use: `sprite.data.on('changedata', listener)`. + * + * This event is dispatched for all items that change in the Data Manager. + * To listen for the change of a specific item, use the `CHANGE_DATA_KEY_EVENT` event. + * + * @event Phaser.Data.Events#CHANGE_DATA + * + * @param {any} parent - A reference to the object that the Data Manager responsible for this event belongs to. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The new value of the item in the Data Manager. + * @param {any} previousValue - The previous value of the item in the Data Manager. + */ +module.exports = 'changedata'; + + +/***/ }), +/* 1326 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170571,12 +183270,12 @@ module.exports = Tint; /***/ }), -/* 1109 */ +/* 1327 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170779,12 +183478,12 @@ module.exports = TextureCrop; /***/ }), -/* 1110 */ +/* 1328 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170909,12 +183608,12 @@ module.exports = Texture; /***/ }), -/* 1111 */ +/* 1329 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -171096,16 +183795,16 @@ module.exports = Size; /***/ }), -/* 1112 */ +/* 1330 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ScaleModes = __webpack_require__(104); +var ScaleModes = __webpack_require__(111); /** * Provides methods used for getting and setting the scale of a Game Object. @@ -171167,12 +183866,12 @@ module.exports = ScaleMode; /***/ }), -/* 1113 */ +/* 1331 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -171370,17 +184069,17 @@ module.exports = Origin; /***/ }), -/* 1114 */ +/* 1332 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(10); -var RotateAround = __webpack_require__(432); +var Rectangle = __webpack_require__(11); +var RotateAround = __webpack_require__(466); var Vector2 = __webpack_require__(3); /** @@ -171652,12 +184351,12 @@ module.exports = GetBounds; /***/ }), -/* 1115 */ +/* 1333 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -171800,12 +184499,12 @@ module.exports = Flip; /***/ }), -/* 1116 */ +/* 1334 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -171925,12 +184624,12 @@ module.exports = Crop; /***/ }), -/* 1117 */ +/* 1335 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -172074,20 +184773,500 @@ module.exports = ComputedSize; /***/ }), -/* 1118 */ +/* 1336 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Update Event. + * + * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_UPDATE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate'; + + +/***/ }), +/* 1337 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Start Event. + * + * This event is dispatched by a Sprite when an animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_START` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart'; + + +/***/ }), +/* 1338 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Restart Event. + * + * This event is dispatched by a Sprite when an animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_RESTART` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart'; + + +/***/ }), +/* 1339 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Repeat Event. + * + * This event is dispatched by a Sprite when an animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_REPEAT` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat'; + + +/***/ }), +/* 1340 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Update Event. + * + * This event is dispatched by a Sprite when a specific animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationupdate-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate-'; + + +/***/ }), +/* 1341 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Start Event. + * + * This event is dispatched by a Sprite when a specific animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationstart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart-'; + + +/***/ }), +/* 1342 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Restart Event. + * + * This event is dispatched by a Sprite when a specific animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrestart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart-'; + + +/***/ }), +/* 1343 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Repeat Event. + * + * This event is dispatched by a Sprite when a specific animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrepeat-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat-'; + + +/***/ }), +/* 1344 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Complete Event. + * + * This event is dispatched by a Sprite when a specific animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationcomplete-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete-'; + + +/***/ }), +/* 1345 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Complete Event. + * + * This event is dispatched by a Sprite when an animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_COMPLETE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete'; + + +/***/ }), +/* 1346 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Animations Event. + * + * This event is dispatched when the global Animation Manager resumes, having been previously paused. + * + * When this happens all current animations will continue updating again. + * + * @event Phaser.Animations.Events#RESUME_ALL + */ +module.exports = 'resumeall'; + + +/***/ }), +/* 1347 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Animation Event. + * + * This event is dispatched when an animation is removed from the global Animation Manager. + * + * @event Phaser.Animations.Events#REMOVE_ANIMATION + * + * @param {string} key - The key of the Animation that was removed from the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the removed Animation. + */ +module.exports = 'remove'; + + +/***/ }), +/* 1348 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Animations Event. + * + * This event is dispatched when the global Animation Manager is told to pause. + * + * When this happens all current animations will stop updating, although it doesn't necessarily mean + * that the game has paused as well. + * + * @event Phaser.Animations.Events#PAUSE_ALL + */ +module.exports = 'pauseall'; + + +/***/ }), +/* 1349 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Start Event. + * + * This event is dispatched by an Animation instance when it starts playing. + * + * Be careful with the volume of events this could generate. If a group of Sprites all play the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that started playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'start'; + + +/***/ }), +/* 1350 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Restart Event. + * + * This event is dispatched by an Animation instance when it restarts. + * + * Be careful with the volume of events this could generate. If a group of Sprites all restart the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that restarted playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'restart'; + + +/***/ }), +/* 1351 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Repeat Event. + * + * This event is dispatched when a currently playing animation repeats. + * + * The event is dispatched directly from the Animation object itself. Which means that listeners + * bound to this event will be invoked every time the Animation repeats, for every Game Object that may have it. + * + * @event Phaser.Animations.Events#ANIMATION_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that repeated. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation was on when it repeated. + */ +module.exports = 'repeat'; + + +/***/ }), +/* 1352 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Complete Event. + * + * This event is dispatched by an Animation instance when it completes, i.e. finishes playing or is manually stopped. + * + * Be careful with the volume of events this could generate. If a group of Sprites all complete the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'complete'; + + +/***/ }), +/* 1353 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Add Animation Event. + * + * This event is dispatched when a new animation is added to the global Animation Manager. + * + * This can happen either as a result of an animation instance being added to the Animation Manager, + * or the Animation Manager creating a new animation directly. + * + * @event Phaser.Animations.Events#ADD_ANIMATION + * + * @param {string} key - The key of the Animation that was added to the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the newly created Animation. + */ +module.exports = 'add'; + + +/***/ }), +/* 1354 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AlignIn = __webpack_require__(453); -var CONST = __webpack_require__(212); +var AlignIn = __webpack_require__(488); +var CONST = __webpack_require__(229); var GetFastValue = __webpack_require__(1); var NOOP = __webpack_require__(2); -var Zone = __webpack_require__(135); +var Zone = __webpack_require__(147); var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); @@ -172198,12 +185377,12 @@ module.exports = GridAlign; /***/ }), -/* 1119 */ +/* 1355 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -172256,12 +185435,12 @@ module.exports = GetLast; /***/ }), -/* 1120 */ +/* 1356 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -172314,12 +185493,12 @@ module.exports = GetFirst; /***/ }), -/* 1121 */ +/* 1357 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -172359,16 +185538,16 @@ module.exports = Call; /***/ }), -/* 1122 */ +/* 1358 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(37); +var PropertyValueInc = __webpack_require__(40); /** * Takes an array of Game Objects, or any objects that have a public `angle` property, @@ -172400,7 +185579,7 @@ module.exports = Angle; /***/ }), -/* 1123 */ +/* 1359 */ /***/ (function(module, exports) { /** @@ -172453,7 +185632,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o /***/ }), -/* 1124 */ +/* 1360 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {// References: @@ -172523,10 +185702,10 @@ if (!global.cancelAnimationFrame) { }; } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(213))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(230))) /***/ }), -/* 1125 */ +/* 1361 */ /***/ (function(module, exports) { /** @@ -172563,7 +185742,7 @@ if (!global.cancelAnimationFrame) { /***/ }), -/* 1126 */ +/* 1362 */ /***/ (function(module, exports) { // ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc @@ -172575,7 +185754,7 @@ if (!Math.trunc) { /***/ }), -/* 1127 */ +/* 1363 */ /***/ (function(module, exports) { /** @@ -172590,7 +185769,7 @@ if (!window.console) /***/ }), -/* 1128 */ +/* 1364 */ /***/ (function(module, exports) { /* Copyright 2013 Chris Wilson @@ -172777,7 +185956,7 @@ BiquadFilterNode.type and OscillatorNode.type. /***/ }), -/* 1129 */ +/* 1365 */ /***/ (function(module, exports) { /** @@ -172793,7 +185972,7 @@ if (!Array.isArray) /***/ }), -/* 1130 */ +/* 1366 */ /***/ (function(module, exports) { /** @@ -172833,32 +186012,32 @@ if (!Array.prototype.forEach) /***/ }), -/* 1131 */ +/* 1367 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(1130); -__webpack_require__(1129); -__webpack_require__(1128); -__webpack_require__(1127); -__webpack_require__(1126); -__webpack_require__(1125); -__webpack_require__(1124); -__webpack_require__(1123); +__webpack_require__(1366); +__webpack_require__(1365); +__webpack_require__(1364); +__webpack_require__(1363); +__webpack_require__(1362); +__webpack_require__(1361); +__webpack_require__(1360); +__webpack_require__(1359); /***/ }), -/* 1132 */ +/* 1368 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -__webpack_require__(1131); +__webpack_require__(1367); -var CONST = __webpack_require__(28); +var CONST = __webpack_require__(30); var Extend = __webpack_require__(21); /** @@ -172867,35 +186046,37 @@ var Extend = __webpack_require__(21); var Phaser = { - Actions: __webpack_require__(454), - Animation: __webpack_require__(1065), - Cache: __webpack_require__(1064), - Cameras: __webpack_require__(1063), + Actions: __webpack_require__(489), + Animations: __webpack_require__(1278), + Cache: __webpack_require__(1263), + Cameras: __webpack_require__(1260), + Core: __webpack_require__(1184), Class: __webpack_require__(0), - Create: __webpack_require__(1020), - Curves: __webpack_require__(1014), - Data: __webpack_require__(1011), - Display: __webpack_require__(1009), - DOM: __webpack_require__(980), - Events: __webpack_require__(978), - Game: __webpack_require__(976), - GameObjects: __webpack_require__(943), - Geom: __webpack_require__(302), - Input: __webpack_require__(683), - Loader: __webpack_require__(660), - Math: __webpack_require__(637), - Physics: __webpack_require__(595), - Plugins: __webpack_require__(530), - Renderer: __webpack_require__(528), - Scene: __webpack_require__(357), - Scenes: __webpack_require__(523), - Sound: __webpack_require__(521), - Structs: __webpack_require__(520), - Textures: __webpack_require__(519), - Tilemaps: __webpack_require__(517), - Time: __webpack_require__(468), - Tweens: __webpack_require__(466), - Utils: __webpack_require__(462) + Create: __webpack_require__(1125), + Curves: __webpack_require__(1119), + Data: __webpack_require__(1116), + Display: __webpack_require__(1114), + DOM: __webpack_require__(1085), + Events: __webpack_require__(1084), + Game: __webpack_require__(1082), + GameObjects: __webpack_require__(984), + Geom: __webpack_require__(309), + Input: __webpack_require__(717), + Loader: __webpack_require__(683), + Math: __webpack_require__(425), + Physics: __webpack_require__(659), + Plugins: __webpack_require__(572), + Renderer: __webpack_require__(570), + Scale: __webpack_require__(565), + Scene: __webpack_require__(362), + Scenes: __webpack_require__(564), + Sound: __webpack_require__(562), + Structs: __webpack_require__(561), + Textures: __webpack_require__(560), + Tilemaps: __webpack_require__(558), + Time: __webpack_require__(509), + Tweens: __webpack_require__(507), + Utils: __webpack_require__(497) }; @@ -172906,7 +186087,7 @@ if (false) if (true) { - Phaser.FacebookInstantGamesPlugin = __webpack_require__(344); + Phaser.FacebookInstantGamesPlugin = __webpack_require__(349); } // Merge in the consts @@ -172925,7 +186106,7 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(213))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(230))) /***/ }) /******/ ]); diff --git a/dist/phaser-facebook-instant-games.min.js b/dist/phaser-facebook-instant-games.min.js index 7ed8baff3..f373af945 100644 --- a/dist/phaser-facebook-instant-games.min.js +++ b/dist/phaser-facebook-instant-games.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()}(window,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.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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=1132)}([function(t,e){function i(t,e,i){var n=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&n.value&&"object"==typeof n.value&&(n=n.value),!(!n||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(n))&&(void 0===n.enumerable&&(n.enumerable=!0),void 0===n.configurable&&(n.configurable=!0),n)}function n(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function s(t,e,s,r){for(var a in e)if(e.hasOwnProperty(a)){var h=i(e,a,s);if(!1!==h){if(n((r||t).prototype,a)){if(o.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=e[a]}}function r(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i0&&(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){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o>>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;n=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=l},function(t,e,i){"use strict";var n=Object.prototype.hasOwnProperty,s="~";function r(){}function o(t,e,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new function(t,e,i){this.fn=t,this.context=e,this.once=i||!1}(i,n||t,r),a=s?s+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function h(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),h.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)n.call(t,e)&&i.push(s?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},h.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,r=i.length,o=new Array(r);n0;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"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},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]"===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.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;i0&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return i.unshift(this.scene.sys.displayList.getIndex(t)),i},destroy:function(t){if(void 0===t&&(t=!1),this.scene&&!this.ignoreDestroy){this.preDestroy&&this.preDestroy.call(this),this.emit("destroy",this);var e=this.scene.sys;t||(e.displayList.remove(this),e.updateList.remove(this)),this.input&&(e.input.clear(this),this.input=void 0),this.data&&(this.data.destroy(),this.data=void 0),this.body&&(this.body.destroy(),this.body=void 0),t||e.queueDepthSort(),this.active=!1,this.visible=!1,this.scene=void 0,this.parentContainer=void 0,this.removeAllListeners()}}});a.RENDER_MASK=15,t.exports=a},function(t,e,i){var n=i(441),s={PI2:2*Math.PI,TAU:.5*Math.PI,EPSILON:1e-6,DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,RND:new n};t.exports=s},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=o.width),void 0===s&&(s=o.height);var a=n(r,"isNotEmpty",!1),h=n(r,"isColliding",!1),l=n(r,"hasInterestingFace",!1);t<0&&(i+=t,t=0),e<0&&(s+=e,e=0),t+i>o.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var u=[],c=e;c=400&&t.status<=599&&(i=!1),this.resetXHR(),this.loader.nextFile(this,i)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit("fileprogress",this,this.percentComplete))},onProcess:function(){this.state=s.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=s.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=s.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit("filecomplete",e,i,t),this.loader.emit("filecomplete-"+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});u.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},u.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=u},function(t,e){t.exports=function(t,e,i,n,s){var r=n.alpha*i.alpha;if(r<=0)return!1;var o=t._tempMatrix1.copyFromArray(n.matrix.matrix),a=t._tempMatrix2.applyITRS(i.x,i.y,i.rotation,i.scaleX,i.scaleY),h=t._tempMatrix3;return s?(o.multiplyWithOffset(s,-n.scrollX*i.scrollFactorX,-n.scrollY*i.scrollFactorY),a.e=i.x,a.f=i.y,o.multiply(a,h)):(a.e-=n.scrollX*i.scrollFactorX,a.f-=n.scrollY*i.scrollFactorY,o.multiply(a,h)),e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=r,e.save(),h.setToContext(e),!0}},function(t,e){t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},function(t,e,i){var n={};t.exports=n;var s=i(29),r=i(34),o=i(89),a=i(12),h=i(33),l=i(152);!function(){n._inertiaScale=4,n._nextCollidingGroupId=1,n._nextNonCollidingGroupId=-1,n._nextCategory=1,n.create=function(e){var i={id:a.nextId(),type:"body",label:"Body",gameObject:null,parts:[],plugin:{},angle:0,vertices:s.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},previousPositionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,ignoreGravity:!1,ignorePointer:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0},lineWidth:0},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,_original:null},n=a.extend(i,e);return t(n,e),n},n.nextGroup=function(t){return t?n._nextNonCollidingGroupId--:n._nextCollidingGroupId++},n.nextCategory=function(){return n._nextCategory=n._nextCategory<<1,n._nextCategory};var t=function(t,e){e=e||{},n.set(t,{bounds:t.bounds||h.create(t.vertices),positionPrev:t.positionPrev||r.clone(t.position),anglePrev:t.anglePrev||t.angle,vertices:t.vertices,parts:t.parts||[t],isStatic:t.isStatic,isSleeping:t.isSleeping,parent:t.parent||t}),s.rotate(t.vertices,t.angle,t.position),l.rotate(t.axes,t.angle),h.update(t.bounds,t.vertices,t.velocity),n.set(t,{axes:e.axes||t.axes,area:e.area||t.area,mass:e.mass||t.mass,inertia:e.inertia||t.inertia});var i=t.isStatic?"#2e2b44":a.choose(["#006BA6","#0496FF","#FFBC42","#D81159","#8F2D56"]);t.render.fillStyle=t.render.fillStyle||i,t.render.strokeStyle=t.render.strokeStyle||"#000",t.render.sprite.xOffset+=-(t.bounds.min.x-t.position.x)/(t.bounds.max.x-t.bounds.min.x),t.render.sprite.yOffset+=-(t.bounds.min.y-t.position.y)/(t.bounds.max.y-t.bounds.min.y)};n.set=function(t,e,i){var s;for(s in"string"==typeof e&&(s=e,(e={})[s]=i),e)if(e.hasOwnProperty(s))switch(i=e[s],s){case"isStatic":n.setStatic(t,i);break;case"isSleeping":o.set(t,i);break;case"mass":n.setMass(t,i);break;case"density":n.setDensity(t,i);break;case"inertia":n.setInertia(t,i);break;case"vertices":n.setVertices(t,i);break;case"position":n.setPosition(t,i);break;case"angle":n.setAngle(t,i);break;case"velocity":n.setVelocity(t,i);break;case"angularVelocity":n.setAngularVelocity(t,i);break;case"parts":n.setParts(t,i);break;default:t[s]=i}},n.setStatic=function(t,e){for(var i=0;i0&&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,e,i,r){var o=0,a=0;r=r||t.position;for(var u=0;u0&&(o+=c.area,a+=c.inertia),c.position.x=r.x+(c.position.x-r.x)*e,c.position.y=r.y+(c.position.y-r.y)*i,h.update(c.bounds,c.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(n.setMass(t,t.density*o),n.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null)},n.update=function(t,e,i,n){var o=Math.pow(e*i*t.timeScale,2),a=1-t.frictionAir*i*t.timeScale,u=t.position.x-t.positionPrev.x,c=t.position.y-t.positionPrev.y;t.velocity.x=u*a*n+t.force.x/t.mass*o,t.velocity.y=c*a*n+t.force.y/t.mass*o,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*a*n+t.torque/t.inertia*o,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=r.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(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},n._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n={VERSION:"3.15.1",BlendModes:i(72),ScaleModes:i(104),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=n},function(t,e,i){var n={};t.exports=n;var s=i(34),r=i(12);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){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e,i){var n=i(0),s=i(16),r=i(17),o=i(60),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Transform,s.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.initPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]}});t.exports=a},function(t,e,i){var n=i(72),s=i(13),r=i(104);t.exports=function(t,e,i){e.x=s(i,"x",0),e.y=s(i,"y",0),e.depth=s(i,"depth",0),e.flipX=s(i,"flipX",!1),e.flipY=s(i,"flipY",!1);var o=s(i,"scale",null);"number"==typeof o?e.setScale(o):null!==o&&(e.scaleX=s(o,"x",1),e.scaleY=s(o,"y",1));var a=s(i,"scrollFactor",null);"number"==typeof a?e.setScrollFactor(a):null!==a&&(e.scrollFactorX=s(a,"x",1),e.scrollFactorY=s(a,"y",1)),e.rotation=s(i,"rotation",0);var h=s(i,"angle",null);null!==h&&(e.angle=h),e.alpha=s(i,"alpha",1);var l=s(i,"origin",null);if("number"==typeof l)e.setOrigin(l);else if(null!==l){var u=s(l,"x",.5),c=s(l,"y",.5);e.setOrigin(u,c)}return e.scaleMode=s(i,"scaleMode",r.DEFAULT),e.blendMode=s(i,"blendMode",n.NORMAL),e.visible=s(i,"visible",!0),s(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},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){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){t.exports=function(t,e,i){var n=i||e.fillColor,s=e.fillAlpha,r=(16711680&n)>>>16,o=(65280&n)>>>8,a=255&n;t.fillStyle="rgba("+r+","+o+","+a+","+s+")"}},function(t,e,i){var n=i(18);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e){t.exports=function(t,e,i,n,s,r){var o;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=s;o=0;o--)t[o][e]+=i+a*n,a++;return t}},function(t,e,i){var n=i(110),s=i(19);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;d>>16,r=(65280&i)>>>8,o=255&i;t.strokeStyle="rgba("+s+","+r+","+o+","+n+")",t.lineWidth=e.lineWidth}},function(t,e,i){var n=i(0),s=i(195),r=i(412),o=i(194),a=i(411),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=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,n)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=n,this._locked=!1,this.update(s)},setGLTo:function(t,e,i,n){return void 0===n&&(n=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=n,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,n=this.b,o=this.a;return this._color=s(e,i,n),this._color32=r(e,i,n,o),this._rgba="rgba("+e+","+i+","+n+","+o/255+")",t&&a(e,i,n,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t));return this.setTo(i,n,s)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,n=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),n=Math.max(0,Math.min(255,n-Math.round(-t/100*255))),this.setTo(e,i,n)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,n,s,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},scaleY:{get:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3];return n[0]=s*i+o*e,n[1]=r*i+a*e,n[2]=s*-e+o*i,n[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,s=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=n[0],c=n[1],d=n[2],f=n[3],p=n[4],g=n[5],v=void 0===e?this:e;return v.a=u*s+c*o,v.b=u*r+c*a,v.c=d*s+f*o,v.d=d*r+f*a,v.e=p*s+g*o+h,v.f=p*r+g*a+l,v},multiplyWithOffset:function(t,e,i){var n=this.matrix,s=t.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=e*r+i*a+n[4],u=e*o+i*h+n[5],c=s[0],d=s[1],f=s[2],p=s[3],g=s[4],v=s[5];return n[0]=c*r+d*a,n[1]=c*o+d*h,n[2]=f*r+p*a,n[3]=f*o+p*h,n[4]=g*r+v*a+l,n[5]=g*o+v*h+u,this},transform:function(t,e,i,n,s,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+n*l,o[3]=i*h+n*u,o[4]=s*a+r*l+c,o[5]=s*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],l=n[5];return i.x=t*s+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=e*s-i*n;return t[0]=s/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-s*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;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],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,s,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],s=e[2],r=e[3],o=i*i,a=n*n,h=s*s,l=r*r,u=Math.sqrt(o+h),c=Math.sqrt(a+l);return t.translateX=e[4],t.translateY=e[5],t.scaleX=u,t.scaleY=c,t.rotation=Math.acos(i/u)*(Math.atan(-s/i)<0?-1:1),t},applyITRS:function(t,e,i,n,s){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*n,r[1]=o*n,r[2]=-o*s,r[3]=a*s,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=r*c*e+-o*c*t+(-u*r+l*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=r},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){t.exports=function(t,e,i){return t.radius>0&&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){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x+t.width-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y+t.height-t.height*t.originY}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e,i){var n={};t.exports=n;var s=i(29),r=i(12),o=i(25),a=i(33),h=i(34),l=i(244);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=i(0),s=i(20),r=i(22),o=i(7),a=i(1),h=i(4),l=i(8),u=new n({Extends:r,initialize:function(t,e,i,n,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:n,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=s.FILE_POPULATED)},onProcess:function(){if(this.state!==s.FILE_POPULATED){this.state=s.FILE_PROCESSING;var t=JSON.parse(this.xhrLoader.responseText),e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;sthis.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=h},function(t,e,i){var n=i(0),s=i(16),r=i(293),o=new n({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.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=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},function(t,e,i){var n={};t.exports=n;var s=i(74),r=i(12),o=i(33),a=i(25);n.create=function(t){return r.extend({id:r.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{}},t)},n.setModified=function(t,e,i,s){if(t.isModified=e,i&&t.parent&&n.setModified(t.parent,e,i,s),s)for(var r=0;r=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=l},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=t.strokeTint,a=n.getTintAppendFloatAlphaAndSwap(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-s,f=h[1]-r;e.closePath||(l-=2);for(var p=2;ps||e>=i||i>s||e+i>s){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},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,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 w=i;wh&&(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===_(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)&&w(s,r)&&w(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=b(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)&&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 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 _(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){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){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,i){var n={};t.exports=n;var s=i(29),r=i(34),o=i(89),a=i(33),h=i(152),l=i(12);n._warming=.4,n._torqueDampen=1,n._minLength=1e-6,n.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?r.add(e.bodyA.position,e.pointA):e.pointA,n=e.bodyB?r.add(e.bodyB.position,e.pointB):e.pointB,s=r.magnitude(r.sub(i,n));e.length=void 0!==e.length?e.length:s,e.id=e.id||l.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?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,i){var n={};t.exports=n;var s=i(12);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r0){i||(i={}),n=e.split(" ");for(var l=0;l=0&&y>=0&&v+y<1}},function(t,e){t.exports=function(t,e){return t.hasOwnProperty(e)}},function(t,e,i){var n=i(0),s=i(16),r=i(17),o=i(893),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Size,s.TextureCrop,s.Tint,s.Transform,s.Visible,o],initialize:function(t,e,i,n,s){r.call(this,t,"Image"),this._crop=this.resetCropObject(),this.setTexture(n,s),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline()}});t.exports=a},function(t,e,i){var n=i(69);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(0),s=i(191),r=i(10),o=i(3),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){var n=i(0),s=i(44),r=i(442),o=i(440),a=i(210),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){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},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,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","map"),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.widthInPixels=s(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.tileHeight),this.format=s(t,"format",null),this.orientation=s(t,"orientation","orthogonal"),this.renderOrder=s(t,"renderOrder","right-down"),this.version=s(t,"version","1"),this.properties=s(t,"properties",{}),this.layers=s(t,"layers",[]),this.images=s(t,"images",[]),this.objects=s(t,"objects",{}),this.collision=s(t,"collision",{}),this.tilesets=s(t,"tilesets",[]),this.imageCollections=s(t,"imageCollections",[]),this.tiles=s(t,"tiles",[])}});t.exports=r},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","layer"),this.x=s(t,"x",0),this.y=s(t,"y",0),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.baseTileWidth=s(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=s(t,"baseTileHeight",this.tileHeight),this.widthInPixels=s(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=s(t,"alpha",1),this.visible=s(t,"visible",!0),this.properties=s(t,"properties",{}),this.indexes=s(t,"indexes",[]),this.collideIndexes=s(t,"collideIndexes",[]),this.callbacks=s(t,"callbacks",[]),this.bodies=s(t,"bodies",[]),this.data=s(t,"data",[]),this.tilemapLayer=s(t,"tilemapLayer",null)}});t.exports=r},function(t,e){t.exports=function(t,e,i){return t>=0&&t=0&&e0&&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){t.exports={NONE:0,A:1,B:2,BOTH:3}},function(t,e){t.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r,o){for(var a=n.getTintAppendFloatAlphaAndSwap(i.fillColor,i.fillAlpha*s),h=i.pathData,l=i.pathIndexes,u=0;u-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 t=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof s&&(l.x=s),"number"==typeof r&&(l.y=r),l):n?this.create(s,r,o,a,h):null},get:function(t,e,i,n,s){return this.getFirst(!1,!0,t,e,i,n,s)},getFirstAlive:function(t,e,i,n,s,r){return this.getFirst(!0,t,e,i,n,s,r)},getFirstDead:function(t,e,i,n,s,r){return this.getFirst(!1,t,e,i,n,s,r)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=t.length)){for(var i=t.length-1,n=t[e],s=e;s=this.firstgid&&t=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e,i){var n=i(0),s=i(16),r=i(17),o=i(798),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,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"),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.lengthl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(a-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){for(var i=[null],n=2;n0?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=a},function(t,e,i){var n=i(0),s=i(24),r=i(21),o=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.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(r,o,n,s)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var s=this.data,r=s.cut;r.x=i,r.y=n,r.w=t,r.h=e,r.r=i+t,r.b=n+e,s.sourceSize.w=t,s.sourceSize.h=e,s.spriteSourceSize.w=t,s.spriteSourceSize.h=e,s.radius=.5*Math.sqrt(t*t+e*e);var o=s.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,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,a.r=i+s,a.b=n+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()},setCropUVs:function(t,e,i,n,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=s(e,0,d)),g=l+(i=s(i,0,f)),v=n=s(n,0,d-e),y=r=s(r,0,f-i),m=this.data;if(m.trim){var x=m.spriteSourceSize,w=e+(n=s(n,0,u-e)),b=i+(r=s(r,0,c-i));if(!(x.rw||x.y>b)){var T=Math.max(x.x,e),S=Math.max(x.y,i),A=Math.min(x.r,w)-T,_=Math.min(x.b,b)-S;v=A,y=_,p=o?h+(u-(T-x.x)-A):h+(T-x.x),g=a?l+(c-(S-x.y)-_):l+(S-x.y),e=T,i=S,n=A,r=_}else p=0,g=0,v=0,y=0}else o&&(p=h+(u-e-n)),a&&(g=l+(c-i-r));var C=this.source.width,M=this.source.height;return t.u0=Math.max(0,p/C),t.v0=Math.max(0,g/M),t.u1=Math.min(1,(p+v)/C),t.v1=Math.min(1,(g+y)/M),t.x=e,t.y=i,t.cx=p,t.cy=g,t.cw=v,t.ch=y,t.width=n,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(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=r(!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}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(0),s=i(11),r=i(21),o=i(2),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={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},this.currentConfig=this.config,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 "+t.name+" already exists in Sound"),!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.warn("Audio Marker: "+t.name+" missing in 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!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in 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,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit("destroy",this),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)}});t.exports=a},function(t,e,i){var n=i(0),s=i(69),r=i(11),o=i(2),a=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.on("prestep",this.update,this),t.events.once("destroy",this.destroy,this)},add:o,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var r=s(e),o=i.spritemap[n];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:r})}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:o,onBlur:o,onFocus:o,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)})},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit("rate",this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit("detune",this,t)}}});t.exports=a},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){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n,s=i(101),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=function(t,e,i){return(e-t)*i+t}},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;i-y&&T>-m&&b<_&&T-y&&A>-m&&S<_&&As&&(t=s),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,s=Math.max(n,n+e.height-i);return ts&&(t=s),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=l(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,s){return this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,s?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),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){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.config=t.sys.game.config,this.sceneManager=t.sys.game.scene;var e=this.config.resolution;return this.resolution=e,this._cx=this._x*e,this._cy=this._y*e,this._cw=this._width*e,this._ch=this._height*e,this.updateSystem(),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),0===t&&(t=.001),this.zoom=t,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},update:function(){},updateSystem:function(){if(this.config){var t=0!==this._x||0!==this._y||this.config.width!==this._width||this.config.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit("cameradestroy",this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this._bounds=null,this.scene=null,this.config=null,this.sceneManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this._cx=t*this.resolution,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._cy=t*this.resolution,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this._cw=t*this.resolution,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this._ch=t*this.resolution,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoom}},displayHeight:{get:function(){return this.height/this.zoom}}});t.exports=c},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}},function(t,e){var i={defaultPipeline:null,pipeline:null,initPipeline:function(t){void 0===t&&(t="TextureTintPipeline");var e=this.scene.sys.game.renderer;return!!(e&&e.gl&&e.hasPipeline(t))&&(this.defaultPipeline=e.getPipeline(t),this.pipeline=this.defaultPipeline,!0)},setPipeline:function(t){var e=this.scene.sys.game.renderer;return e&&e.gl&&e.hasPipeline(t)&&(this.pipeline=e.getPipeline(t)),this},resetPipeline:function(){return this.pipeline=this.defaultPipeline,null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=i},function(t,e){t.exports=function(t){return 2*(t.width+t.height)}},function(t,e,i){var n=i(72),s=i(81),r=i(44),o=i(0),a=i(16),h=i(17),l=i(10),u=i(43),c=new o({Extends:h,Mixins:[a.Depth,a.GetBounds,a.Origin,a.ScaleMode,a.Transform,a.ScrollFactor,a.Visible],initialize:function(t,e,i,s,r){void 0===s&&(s=1),void 0===r&&(r=s),h.call(this,t,"Zone"),this.setPosition(e,i),this.width=s,this.height=r,this.blendMode=n.NORMAL,this.updateDisplayOrigin()},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}},setSize:function(t,e,i){return void 0===i&&(i=!0),this.width=t,this.height=e,i&&this.input&&this.input.hitArea instanceof l&&(this.input.hitArea.width=t,this.input.hitArea.height=e),this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},setCircleDropZone:function(t){return this.setDropZone(new s(0,0,t),r)},setRectangleDropZone:function(t,e){return this.setDropZone(new l(0,0,t,e),u)},setDropZone:function(t,e){return void 0===t?this.setRectangleDropZone(this.width,this.height):this.input||this.setInteractive(t,e,!0),this},setAlpha:function(){},renderCanvas:function(){},renderWebGL:function(){}});t.exports=c},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(0),s=i(14),r=i(5),o=i(93),a=new n({initialize:function(t,e,i){this.parent=t,this.parentIsTimeline=t.hasOwnProperty("isTimeline"),this.data=e,this.totalData=e.length,this.targets=i,this.totalTargets=i.length,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.offset=0,this.calculatedOffset=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onRepeat:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},getValue:function(){return this.data[0].current},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},isPaused:function(){return this.state===o.PAUSED},hasTarget:function(t){return-1!==this.targets.indexOf(t)},updateTo:function(t,e,i){for(var n=0;n0&&(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)),this.parent.makeActive(this))}},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.play(),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){this.state===o.ACTIVE&&void 0!==t&&this.seek(t),this.state!==o.REMOVED&&(this.state!==o.PAUSED&&this.state!==o.PENDING_ADD||(this.parent._destroy.push(this),this.parent._toProcess++),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={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1}},function(t,e){function i(t){return!!t.getStart&&"function"==typeof t.getStart}function n(t){return!!t.getEnd&&"function"==typeof t.getEnd}var s=function(t,e){var r,o,a=function(t,e,i){return i},h=function(t,e,i){return i},l=typeof e;if("number"===l)a=function(){return e};else if("string"===l){var u=e[0],c=parseFloat(e.substr(2));switch(u){case"+":a=function(t,e,i){return i+c};break;case"-":a=function(t,e,i){return i-c};break;case"*":a=function(t,e,i){return i*c};break;case"/":a=function(t,e,i){return i/c};break;default:a=function(){return parseFloat(e)}}}else"function"===l?a=e:"object"===l&&(i(o=e)||n(o))?(n(e)&&(a=e.getEnd),i(e)&&(h=e.getStart)):e.hasOwnProperty("value")&&(r=s(t,e.value));return r||(r={getEnd:a,getStart:h}),r};t.exports=s},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"targets",null);return null===e?e:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(30),s=i(86),r=i(230),o=i(222);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",n.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new s({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},function(t,e,i){var n=i(30),s=i(87),r=i(86),o=i(61);t.exports=function(t,e,i,a,h){for(var l=new s({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:n.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;pr?(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=i(240);n.Body=i(25),n.Composite=i(63),n.World=i(146),n.Detector=i(150),n.Grid=i(239),n.Pairs=i(238),n.Pair=i(112),n.Query=i(536),n.Resolver=i(237),n.SAT=i(149),n.Constraint=i(73),n.Common=i(12),n.Engine=i(236),n.Events=i(74),n.Sleeping=i(89),n.Plugin=i(147),n.Bodies=i(55),n.Composites=i(243),n.Axes=i(152),n.Bounds=i(33),n.Svg=i(534),n.Vector=i(34),n.Vertices=i(29),n.World.add=n.Composite.add,n.World.remove=n.Composite.remove,n.World.addComposite=n.Composite.addComposite,n.World.addBody=n.Composite.addBody,n.World.addConstraint=n.Composite.addConstraint,n.World.clear=n.Composite.clear,t.exports=n},function(t,e,i){var n={};t.exports=n;var s=i(29),r=i(34);n.collides=function(t,e,i){var o,a,h,l,u=!1;if(i){var c=t.parent,d=e.parent,f=c.speed*c.speed+c.angularSpeed*c.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;u=i&&i.collided&&f<.2,l=i}else l={collided:!1,bodyA:t,bodyB:e};if(i&&u){var p=l.axisBody,g=p===t?e:t,v=[p.axes[i.axisNumber]];if(h=n._overlapAxes(p.vertices,g.vertices,v),l.reused=!0,h.overlap<=0)return l.collided=!1,l}else{if((o=n._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return l.collided=!1,l;if((a=n._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return l.collided=!1,l;o.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))1?1:0;d1?1:0;p0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n=i(55),s=i(25),r=i(0),o=i(113),a=i(1),h=i(77),l=i(29),u=new r({Mixins:[o.Bounce,o.Collision,o.Friction,o.Gravity,o.Mass,o.Sensor,o.Sleep,o.Static],initialize:function(t,e,i){this.tile=e,this.world=t,e.physics.matterBody&&e.physics.matterBody.destroy(),e.physics.matterBody=this;var n=a(i,"body",null),s=a(i,"addToWorld",!0);if(n)this.setBody(n,s);else{var r=e.getCollisionGroup();a(r,"objects",[]).length>0?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(34),r=i(12);n.fromVertices=function(t){for(var e={},i=0;i0&&(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],w=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+y)*w,this.y=(e*o+i*u+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(20),r=i(22),o=i(7),a=i(1),h=i(8),l=i(379),u=new n({Extends:r,initialize:function(t,e,i,n){var s="xml";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),s=a(o,"extension",s)}var l={type:"xml",cache:t.cacheManager.xml,extension:s,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,l)},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=l(this.xhrLoader.responseText),this.data?this.onProcessComplete():(console.warn("Invalid XMLFile: "+this.key),this.onProcessError())}});o.register("xml",function(t,e,i){if(Array.isArray(t))for(var n=0;n=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){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(0),s=i(118),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()},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,t=this.frame,this.uv[0]=t.u0,this.uv[1]=t.v0,this.uv[2]=t.u0,this.uv[3]=t.v1,this.uv[4]=t.u1,this.uv[5]=t.v1,this.uv[6]=t.u0,this.uv[7]=t.v0,this.uv[8]=t.u1,this.uv[9]=t.v1,this.uv[10]=t.u1,this.uv[11]=t.v0,this},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){for(var n=!1,s=-1,r=t.points.length-1;++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],h0&&(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(h[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(h[p],o,a));return e.restore(),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),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&&c(this.canvas),s.remove(this.canvas),this.texture.destroy()}});t.exports=p},function(t,e,i){var n=i(131),s=i(26),r=i(0),o=i(16),a=i(28),h=i(123),l=i(17),u=i(884),c=i(323),d=new r({Extends:l,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Crop,o.Depth,o.Flip,o.GetBounds,o.Mask,o.Origin,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Tint,o.Transform,o.Visible,u],initialize:function(t,e,i,r,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=32),void 0===o&&(o=32),l.call(this,t,"RenderTexture"),this.renderer=t.sys.game.renderer,this.textureManager=t.sys.textures,this.globalTint=16777215,this.globalAlpha=1,this.canvas=s.create2D(this,r,o),this.context=this.canvas.getContext("2d"),this.framebuffer=null,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(c(),this.canvas),this.frame=this.texture.get(),this._saved=!1,this.camera=new n(0,0,r,o),this.dirty=!1,this.gl=null;var h=this.renderer;if(h.type===a.WEBGL){var u=h.gl;this.gl=u,this.drawGameObject=this.batchGameObjectWebGL,this.framebuffer=h.createFramebuffer(r,o,this.frame.source.glTexture,!1)}else h.type===a.CANVAS&&(this.drawGameObject=this.batchGameObjectCanvas);this.camera.setScene(t),this.setPosition(e,i),this.setSize(r,o),this.setOrigin(0,0),this.initPipeline()},setSize:function(t,e){return this.resize(t,e)},resize:function(t,e){if(void 0===e&&(e=t),t!==this.width||e!==this.height){if(this.canvas.width=t,this.canvas.height=e,this.gl){var i=this.gl;this.renderer.deleteTexture(this.frame.source.glTexture),this.renderer.deleteFramebuffer(this.framebuffer),this.frame.source.glTexture=this.renderer.createTexture2D(0,i.NEAREST,i.NEAREST,i.CLAMP_TO_EDGE,i.CLAMP_TO_EDGE,i.RGBA,null,t,e,!1),this.framebuffer=this.renderer.createFramebuffer(t,e,this.frame.source.glTexture,!1),this.frame.glTexture=this.frame.source.glTexture}this.frame.source.width=t,this.frame.source.height=e,this.camera.setSize(t,e),this.frame.setSize(t,e),this.width=t,this.height=e}return this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e){void 0===e&&(e=1);var i=255&(t>>16|0),n=255&(t>>8|0),s=255&(0|t);if(this.gl){this.renderer.setFramebuffer(this.framebuffer);var r=this.gl;r.clearColor(i/255,n/255,s/255,e),r.clear(r.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null)}else this.context.fillStyle="rgb("+i+","+n+","+s+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height);return this},clear:function(){if(this.dirty){if(this.gl){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null)}else{var e=this.context;e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this.canvas.width,this.canvas.height),e.restore()}this.dirty=!1}return this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.gl;if(this.camera.preRender(1,1,1),r){this.renderer.setFramebuffer(this.framebuffer);var o=this.pipeline;o.projOrtho(0,this.width,0,this.height,-1e3,1e3),this.batchList(t,e,i,n,s),o.flush(),this.renderer.setFramebuffer(null),o.projOrtho(0,o.width,o.height,0,-1e3,1e3)}else this.renderer.setContext(this.context),this.batchList(t,e,i,n,s),this.renderer.setContext();return this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.gl,a=this.textureManager.getFrame(t,e);if(a){if(this.camera.preRender(1,1,1),o){this.renderer.setFramebuffer(this.framebuffer);var h=this.pipeline;h.projOrtho(0,this.width,0,this.height,-1e3,1e3),h.batchTextureFrame(a,i,n,r,s,this.camera.matrix,null),h.flush(),this.renderer.setFramebuffer(null),h.projOrtho(0,h.width,h.height,0,-1e3,1e3)}else this.batchTextureFrame(a,i,n,s,r);this.dirty=!0}return this},batchList:function(t,e,i,n,s){for(var r=0;r0?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;s-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,o=r.game.renderer;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),w.TargetCamera.setScene(this.scene),w.TargetCamera.setViewport(0,0,e,i),w.TargetCamera.scrollX=this.x,w.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var a=(n=r.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(s=a.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(o,this,0,w.TargetCamera,null,s,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});w.TargetCamera=new n,t.exports=w},function(t,e,i){var n=i(119),s=i(0),r=i(901),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a){n.call(this,t,e,i,s,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(180),s=i(72),r=i(0),o=i(16),a=i(17),h=i(10),l=i(904),u=i(337),c=i(3),d=new r({Extends:a,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.ScrollFactor,o.Transform,o.Visible,l],initialize:function(t,e,i,n){a.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._displayList=t.sys.displayList,this._sortKey="",this._sysEvents=t.sys.events,this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new h),t.setTo(this.x,this.y,0,0),this.list.length>0)for(var e=this.list,i=new h,n=0;n-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){var i,n=[null],s=this.list.slice(),r=s.length;for(i=2;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}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[],this._displayList=null}});t.exports=d},function(t,e,i){var n=i(908),s=i(905),r=i(0),o=i(16),a=i(123),h=i(17),l=i(122),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,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(),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},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]}},function(t,e){t.exports=function(t){if(!Array.isArray(t)||t.length<2||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){t&&(this.settings.data=t),this.settings.status=s.START,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this),this.events.emit("ready",this,t)},resize:function(t,e){this.events.emit("resize",t,e)},shutdown:function(t){this.events.off("transitioninit"),this.events.off("transitionstart"),this.events.off("transitioncomplete"),this.events.off("transitionout"),this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this,t)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this),this.events.removeAllListeners();for(var t=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],e=0;e0?(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.vertexCount,r=this.topology,o=this.vertexSize,a=this.renderer,h=this.batches,l=0,u=null;if(0===h.length||0===s)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,s*o));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(a.setTexture2D(u.texture,0),n.drawArrays(r,u.first,l)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},batchSprite:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix1,s=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,l=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,g=o.cutWidth,v=o.cutHeight,y=-t.displayOriginX+f,m=-t.displayOriginY+p;if(t.isCropped){var x=t._crop;x.flipX===t.flipX&&x.flipY===t.flipY||o.updateCropUVs(x,t.flipX,t.flipY),h=x.u0,l=x.v0,c=x.u1,d=x.v1,g=x.width,v=x.height,f=x.x,p=x.y,y=-t.displayOriginX+f,m=-t.displayOriginY+p}t.flipX&&(y+=g,g*=-1),t.flipY&&(m+=v,v*=-1);var w=y+g,b=m+v;s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y,n.multiply(s,r)):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY,n.multiply(s,r));var T=r.getX(y,m),S=r.getY(y,m),A=r.getX(y,b),_=r.getY(y,b),C=r.getX(w,b),M=r.getY(w,b),P=r.getX(w,m),E=r.getY(w,m),k=u.getTintAppendFloatAlpha(t._tintTL,e.alpha*t._alphaTL),F=u.getTintAppendFloatAlpha(t._tintTR,e.alpha*t._alphaTR),L=u.getTintAppendFloatAlpha(t._tintBL,e.alpha*t._alphaBL),R=u.getTintAppendFloatAlpha(t._tintBR,e.alpha*t._alphaBR);e.roundPixels&&(T|=0,S|=0,A|=0,_|=0,C|=0,M|=0,P|=0,E|=0),this.setTexture2D(a,0);var O=t._isTinted&&t.tintFill;this.batchQuad(T,S,A,_,C,M,P,E,h,l,c,d,k,F,L,R,O)},batchQuad:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v){var y=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),y=!0);var m=this.vertexViewF32,x=this.vertexViewU32,w=this.vertexCount*this.vertexComponentCount-1;return m[++w]=t,m[++w]=e,m[++w]=h,m[++w]=l,m[++w]=v,x[++w]=d,m[++w]=i,m[++w]=n,m[++w]=h,m[++w]=c,m[++w]=v,x[++w]=p,m[++w]=s,m[++w]=r,m[++w]=u,m[++w]=c,m[++w]=v,x[++w]=g,m[++w]=t,m[++w]=e,m[++w]=h,m[++w]=l,m[++w]=v,x[++w]=d,m[++w]=s,m[++w]=r,m[++w]=u,m[++w]=c,m[++w]=v,x[++w]=g,m[++w]=o,m[++w]=a,m[++w]=u,m[++w]=l,m[++w]=v,x[++w]=f,this.vertexCount+=6,y},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f){var p=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),p=!0);var g=this.vertexViewF32,v=this.vertexViewU32,y=this.vertexCount*this.vertexComponentCount-1;return g[++y]=t,g[++y]=e,g[++y]=o,g[++y]=a,g[++y]=f,v[++y]=u,g[++y]=i,g[++y]=n,g[++y]=o,g[++y]=l,g[++y]=f,v[++y]=c,g[++y]=s,g[++y]=r,g[++y]=h,g[++y]=l,g[++y]=f,v[++y]=d,this.vertexCount+=3,p},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m,x,w,b,T,S,A,_,C,M,P,E,k){this.renderer.setPipeline(this,t);var F=this._tempMatrix1,L=this._tempMatrix2,R=this._tempMatrix3,O=y/i+C,D=m/n+M,I=(y+x)/i+C,B=(m+w)/n+M,Y=o,X=a,z=-g,N=-v;if(t.isCropped){var U=t._crop;Y=U.width,X=U.height,o=U.width,a=U.height;var V=y=U.x,G=m=U.y;c&&(V=x-U.x-U.width),d&&!e.isRenderTexture&&(G=w-U.y-U.height),O=V/i+C,D=G/n+M,I=(V+U.width)/i+C,B=(G+U.height)/n+M,z=-g+y,N=-v+m}d^=!k&&e.isRenderTexture?1:0,c&&(Y*=-1,z+=o),d&&(X*=-1,N+=a);var W=z+Y,H=N+X;L.applyITRS(s,r,u,h,l),F.copyFrom(P.matrix),E?(F.multiplyWithOffset(E,-P.scrollX*f,-P.scrollY*p),L.e=s,L.f=r,F.multiply(L,R)):(L.e-=P.scrollX*f,L.f-=P.scrollY*p,F.multiply(L,R));var j=R.getX(z,N),q=R.getY(z,N),K=R.getX(z,H),J=R.getY(z,H),Z=R.getX(W,H),Q=R.getY(W,H),$=R.getX(W,N),tt=R.getY(W,N);P.roundPixels&&(j|=0,q|=0,K|=0,J|=0,Z|=0,Q|=0,$|=0,tt|=0),this.setTexture2D(e,0),this.batchQuad(j,q,K,J,Z,Q,$,tt,O,D,I,B,b,T,S,A,_)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.setPipeline(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),f=h.getY(e,i),p=h.getX(e,c),g=h.getY(e,c),v=h.getX(l,c),y=h.getY(l,c),m=h.getX(l,i),x=h.getY(l,i);this.setTexture2D(t.glTexture,0),n=u.getTintAppendFloatAlpha(n,s),this.batchQuad(d,f,p,g,v,y,m,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0)},drawFillRect:function(t,e,i,n,s,r){var o=t+i,a=e+n,h=u.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,h,h,h,h,2)},batchFillRect:function(t,e,i,n,s,r){this.renderer.setPipeline(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),y=this.currentFrame,m=y.u0,x=y.v0,w=y.u1,b=y.v1;this.batchQuad(l,u,c,d,f,p,g,v,m,x,w,b,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.fillTint.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,y=g.v0,m=g.u1,x=g.v1;this.batchTri(l,u,c,d,f,p,v,y,m,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=s,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=this.tintEffect,f=0;f0&&H[4]?this.batchQuad(R,O,E,k,H[0],H[1],H[2],H[3],U,V,G,W,B,Y,X,z,I):(j[0]=R,j[1]=O,j[2]=E,j[3]=k,j[4]=1),h&&j[4]?this.batchQuad(M,P,F,L,j[0],j[1],j[2],j[3],U,V,G,W,B,Y,X,z,I):(H[0]=M,H[1]=P,H[2]=F,H[3]=L,H[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),s=i(9),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,this.active=!1},boot:function(){},addAttribute:function(t,e,i,n,s){return this.attributes.push({name:t,size:e,type:this.renderer.glFormats[i],normalized:n,offset:s}),this},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},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},setFloat1v:function(t,e){return this.renderer.setFloat1v(this.program,t,e),this},setFloat2v:function(t,e){return this.renderer.setFloat2v(this.program,t,e),this},setFloat3v:function(t,e){return this.renderer.setFloat3v(this.program,t,e),this},setFloat4v:function(t,e){return this.renderer.setFloat4v(this.program,t,e),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={Global:["game","anims","cache","plugins","registry","scale","sound","textures"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]};n.Global.push("facebook"),t.exports=n},function(t,e,i){var n=i(101),s=i(128),r=i(26),o={canvas:!1,canvasBitBltShift:null,file:!1,fileSystem:!1,getUserMedia:!0,littleEndian:!1,localStorage:!1,pointerLock:!1,support32bit:!1,vibration:!1,webGL:!1,worker:!1};t.exports=function(){o.canvas=!!window.CanvasRenderingContext2D||n.cocoonJS;try{o.localStorage=!!localStorage.getItem}catch(t){o.localStorage=!1}o.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),o.fileSystem=!!window.requestFileSystem;var t,e,i,a=!1;return o.webGL=function(){if(window.WebGLRenderingContext)try{var t=r.createWebGL(this);n.cocoonJS&&(t.screencanvas=!1);var e=t.getContext("webgl")||t.getContext("experimental-webgl"),i=r.create2D(this),s=i.getContext("2d").createImageData(1,1);return a=s.data instanceof Uint8ClampedArray,r.remove(t),r.remove(i),!!e}catch(t){return!1}return!1}(),o.worker=!!window.Worker,o.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,o.getUserMedia=o.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,s.firefox&&s.firefoxVersion<21&&(o.getUserMedia=!1),!n.iOS&&(s.ie||s.firefox||s.chrome)&&(o.canvasBitBltShift=!0),(s.safari||s.mobileSafari)&&(o.canvasBitBltShift=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(o.vibration=!0),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(o.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null)),o.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==o.littleEndian&&a,o}()},function(t,e){t.exports=function(t,e,i){var n;if(void 0===i&&(i=!0),e)"string"==typeof e?n=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(n=e);else if(t.parentElement)return t;return n||(n=document.body),i&&n.style&&(n.style.overflow="hidden"),n.appendChild(t),t}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e){t.exports=function(t,e,i,n,s){var r=.5*(n-e),o=.5*(s-i),a=t*t;return(2*i-2*n+r+o)*(t*a)+(-3*i+3*n-2*r-o)*a+r*t+i}},function(t,e,i){var n=i(18);t.exports=function(t){return t*n.RAD_TO_DEG}},function(t,e,i){var n=i(10);t.exports=function(t,e){if(void 0===e&&(e=new n),0===t.length)return e;for(var i,s,r,o=Number.MAX_VALUE,a=Number.MAX_VALUE,h=Number.MIN_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER,u=0;u=(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=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},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=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x2-t.x1,s=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=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,i){var n=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random()*Math.PI*2,s=Math.sqrt(Math.random());return e.x=t.x+s*Math.cos(i)*t.width/2,e.y=t.y+s*Math.sin(i)*t.height/2,e}},function(t,e,i){var n=i(59);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n=i(59);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(6);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(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},function(t,e,i){var n=i(71),s=i(6);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)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(6);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(6);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){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){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,i){var n=i(0),s=i(11),r=i(105),o=i(93),a=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.isTimeline=!0,this.data=[],this.totalData=0,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},add:function(t){return this.queue(r(this,t))},queue:function(t){return this.isPlaying()||(t.parent=this,t.parentIsTimeline=!0,this.data.push(t),this.totalData=this.data.length),this},hasOffset:function(t){return null!==t.offset},isOffsetAbsolute:function(t){return"number"==typeof t},isOffsetRelative:function(t){if("string"===typeof t){var e=t[0];if("-"===e||"+"===e)return!0}return!1},getRelativeOffset:function(t,e){var i=t[0],n=parseFloat(t.substr(2)),s=e;switch(i){case"+":s+=n;break;case"-":s-=n}return Math.max(0,s)},calcDuration:function(){for(var t=0,e=0,i=0,n=0;n0?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;s0?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){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(0),s=i(16),r=i(28),o=i(17),a=i(473),h=i(111),l=i(42),u=i(9),c=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,a){o.call(this,t,"StaticTilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.culledTiles=[],this.skipCull=!1,this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=h.CullTiles,this.renderer=t.sys.game.renderer,this.vertexBuffer=[],this.bufferData=[],this.vertexViewF32=[],this.vertexViewU32=[],this.dirty=[],this.vertexCount=[],this._renderOrder=0,this._tempMatrix=new l,this.gidMap=[],this.setTilesets(n),this.setAlpha(this.layer.alpha),this.setPosition(s,a),this.setOrigin(),this.setSize(this.layer.tileWidth*this.layer.width,this.layer.tileHeight*this.layer.height),this.updateVBOData(),this.initPipeline("TextureTintPipeline"),t.sys.game.config.renderType===r.WEBGL&&t.sys.game.renderer.onContextRestored(function(){this.updateVBOData()},this)},setTilesets:function(t){var e=[],i=[],n=this.tilemap;Array.isArray(t)||(t=[t]);for(var s=0;sv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(1===p)for(o=0;o=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(2===p)for(o=u-1;o>=0;o--)for(a=0;av||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(3===p)for(o=u-1;o>=0;o--)for(a=l-1;a>=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));this.dirty[e]=!1,null===y?(y=i.createVertexBuffer(m,n.STATIC_DRAW),this.vertexBuffer[e]=y):(i.setVertexBuffer(y),n.bufferSubData(n.ARRAY_BUFFER,0,m))}return this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=a.x/n,l=a.y/s,c=(a.x+e.width)/n,d=(a.y+e.height)/s,f=this._tempMatrix,p=e.width,g=e.height,v=p/2,y=g/2,m=-v,x=-y;e.flipX&&(p*=-1,m+=e.width),e.flipY&&(g*=-1,x+=e.height);var w=m+p,b=x+g;f.applyITRS(v+e.pixelX,y+e.pixelY,e.rotation,1,1);var T=u.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),S=f.getX(m,x),A=f.getY(m,x),_=f.getX(m,b),C=f.getY(m,b),M=f.getX(w,b),P=f.getY(w,b),E=f.getX(w,x),k=f.getY(w,x);r.roundPixels&&(S|=0,A|=0,_|=0,C|=0,M|=0,P|=0,E|=0,k|=0);var F=this.vertexViewF32[o],L=this.vertexViewU32[o];return F[++t]=S,F[++t]=A,F[++t]=h,F[++t]=l,F[++t]=0,L[++t]=T,F[++t]=_,F[++t]=C,F[++t]=h,F[++t]=d,F[++t]=0,L[++t]=T,F[++t]=M,F[++t]=P,F[++t]=c,F[++t]=d,F[++t]=0,L[++t]=T,F[++t]=S,F[++t]=A,F[++t]=h,F[++t]=l,F[++t]=0,L[++t]=T,F[++t]=M,F[++t]=P,F[++t]=c,F[++t]=d,F[++t]=0,L[++t]=T,F[++t]=E,F[++t]=k,F[++t]=c,F[++t]=l,F[++t]=0,L[++t]=T,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),t>=0&&t<4){this._renderOrder=t;for(var e=0;e=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return a.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,s){return a.CreateFromTiles(t,e,i,n,s,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,s,r,o){return a.Copy(t,e,i,n,s,r,o,this.layer),this},destroy:function(){this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this)},fill:function(t,e,i,n,s,r){return a.Fill(t,e,i,n,s,r,this.layer),this},filterTiles:function(t,e,i,n,s,r,o){return a.FilterTiles(t,e,i,n,s,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,s,r,o){return a.FindTile(t,e,i,n,s,r,o,this.layer)},forEachTile:function(t,e,i,n,s,r,o){return a.ForEachTile(t,e,i,n,s,r,o,this.layer),this},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return a.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,s){return a.GetTilesWithin(t,e,i,n,s,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,s,r){return a.GetTilesWithinWorldXY(t,e,i,n,s,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return a.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,s){return a.PutTileAtWorldXY(t,e,i,n,s,this.layer)},putTilesAt:function(t,e,i,n){return a.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,s){return a.Randomize(t,e,i,n,s,this.layer),this},removeTileAt:function(t,e,i,n){return a.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,s){return a.RemoveTileAtWorldXY(t,e,i,n,s,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,s,r){return a.ReplaceByIndex(t,e,i,n,s,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i){return a.SetCollision(t,e,i,this.layer),this},setCollisionBetween:function(t,e,i,n){return a.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,s,r){return a.SetTileLocationCallback(t,e,i,n,s,r,this.layer),this},shuffle:function(t,e,i,n){return a.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,s,r){return a.SwapByIndex(t,e,i,n,s,r,this.layer),this},tileToWorldX:function(t,e){return a.TileToWorldX(t,e,this.layer)},tileToWorldY:function(t,e){return a.TileToWorldY(t,e,this.layer)},tileToWorldXY:function(t,e,i,n){return a.TileToWorldXY(t,e,i,n,this.layer)},weightedRandomize:function(t,e,i,n,s){return a.WeightedRandomize(t,e,i,n,s,this.layer),this},worldToTileX:function(t,e,i){return a.WorldToTileX(t,e,i,this.layer)},worldToTileY:function(t,e,i){return a.WorldToTileY(t,e,i,this.layer)},worldToTileXY:function(t,e,i,n,s){return a.WorldToTileXY(t,e,i,n,s,this.layer)}});t.exports=h},function(t,e,i){var n=i(0),s=i(36),r=i(221),o=i(21),a=i(30),h=i(87),l=i(270),u=i(220),c=i(61),d=i(111),f=i(107),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.renderOrder=e.renderOrder,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},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},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 Tileset Image: "+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 for Tileset: "+t),null;var u=this.tilesets[l];return u?(u.setTileSize(i,n),u.setSpacing(s,r),u.setImage(h),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),(u=new f(t,o,i,n,s,r)).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("Invalid Tilemap Layer ID: "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;fa&&(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(1),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","object layer"),this.opacity=s(t,"opacity",1),this.properties=s(t,"properties",{}),this.propertyTypes=s(t,"propertytypes",{}),this.type=s(t,"type","objectgroup"),this.visible=s(t,"visible",!0),this.objects=s(t,"objects",[])}});t.exports=r},function(t,e,i){var n=i(482),s=i(227),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=n(t,o);if(a.x+=e,a.y+=i,t.gid){var h=s(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?(a.ellipse=t.ellipse,a.width=t.width,a.height=t.height):t.text?(a.width=t.width,a.height=t.height,a.text=t.text):(a.rectangle=!0,a.width=t.width,a.height=t.height);return a}},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&&t-1}return!1}},function(t,e,i){var n=i(19);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionstart",e,i,n)}),d.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)}),d.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&&p.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&&p.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(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 p.add(this.localWorld,o),o},add:function(t){return p.add(this.localWorld,t),this},remove:function(t,e){var i=t.body?t.body:t;return o.removeBody(this.localWorld,i,e),this},removeConstraint:function(t,e){return o.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;i1?1:0;r1?1:0;s0&&u.trigger(t,"collisionStart",{pairs:w.collisionStart}),o.preSolvePosition(w.list),s=0;s0&&u.trigger(t,"collisionActive",{pairs:w.collisionActive}),w.collisionEnd.length>0&&u.trigger(t,"collisionEnd",{pairs:w.collisionEnd}),h.update(t.metrics,t),n._bodiesClearForces(y),u.trigger(t,"afterUpdate",v),t},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;sf.friction*f.frictionStatic*O*i&&(I=F,D=o.clamp(f.friction*L*i,-I,I));var B=r.cross(A,y),Y=r.cross(_,y),X=w/(g.inverseMass+v.inverseMass+g.inverseInertia*B*B+v.inverseInertia*Y*Y);if(R*=X,D*=X,E<0&&E*E>n._restingThresh*i)T.normalImpulse=0;else{var z=T.normalImpulse;T.normalImpulse=Math.min(T.normalImpulse+R,0),R=T.normalImpulse-z}if(k*k>n._restingThreshTangent*i)T.tangentImpulse=0;else{var N=T.tangentImpulse;T.tangentImpulse=o.clamp(T.tangentImpulse+D,-I,I),D=T.tangentImpulse-N}s.x=y.x*R+m.x*D,s.y=y.y*R+m.y*D,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(_,s)*v.inverseInertia)}}}}},function(t,e,i){var n={};t.exports=n;var s=i(112),r=i(12);n._pairMaxIdleLife=1e3,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;an._pairMaxIdleLife&&l.push(o);for(o=0;ou.bounds.max.x||p.bounds.max.yu.bounds.max.y)){var g=n._getRegion(t,p);if(!p.region||g.id!==p.region.id||s){f.broadphaseTests+=1,p.region&&!s||(p.region=g);var v=n._regionUnion(g,p.region);for(o=v.startCol;o<=v.endCol;o++)for(a=v.startRow;a<=v.endRow;a++){h=c[l=n._getBucketId(o,a)];var y=o>=g.startCol&&o<=g.endCol&&a>=g.startRow&&a<=g.endRow,m=o>=p.region.startCol&&o<=p.region.endCol&&a>=p.region.startRow&&a<=p.region.endRow;!y&&m&&m&&h&&n._bucketRemoveBody(t,h,p),(p.region===g||y&&!m||s)&&(h||(h=n._createBucket(c,l)),n._bucketAddBody(t,h,p))}p.region=g,d=!0}}}d&&(t.pairsList=n._createActivePairsList(t))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},n._regionUnion=function(t,e){var i=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 n._createRegion(i,s,r,o)},n._getRegion=function(t,e){var i=e.bounds,s=Math.floor(i.min.x/t.bucketWidth),r=Math.floor(i.max.x/t.bucketWidth),o=Math.floor(i.min.y/t.bucketHeight),a=Math.floor(i.max.y/t.bucketHeight);return n._createRegion(s,r,o,a)},n._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},n._getBucketId=function(t,e){return"C"+t+"R"+e},n._createBucket=function(t,e){return t[e]=[]},n._bucketAddBody=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(147),r=i(12);n.name="matter-js",n.version="0.14.2",n.uses=[],n.used=[],n.use=function(){s.use(n,Array.prototype.slice.call(arguments))},n.before=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathBefore(n,t,e)},n.after=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathAfter(n,t,e)}},function(t,e,i){var n=i(437),s=i(0),r=i(113),o=i(17),a=i(1),h=i(133),l=i(57),u=i(3),c=new s({Extends:l,Mixins:[r.Bounce,r.Collision,r.Force,r.Friction,r.Gravity,r.Mass,r.Sensor,r.SetBody,r.Sleep,r.Static,r.Transform,r.Velocity,h],initialize:function(t,e,i,s,r,h){o.call(this,t.scene,"Image"),this.anims=new n(this),this.setTexture(s,r),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new u(e,i);var l=a(h,"shape",null);l?this.setBody(l,h):this.setRectangle(this.width,this.height,h),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=c},function(t,e,i){var n=i(0),s=i(113),r=i(17),o=i(1),a=i(78),h=i(133),l=i(3),u=new n({Extends:a,Mixins:[s.Bounce,s.Collision,s.Force,s.Friction,s.Gravity,s.Mass,s.Sensor,s.SetBody,s.Sleep,s.Static,s.Transform,s.Velocity,h],initialize:function(t,e,i,n,s,a){r.call(this,t.scene,"Image"),this.setTexture(n,s),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new l(e,i);var h=o(a,"shape",null);h?this.setBody(h,a):this.setRectangle(this.width,this.height,a),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=u},function(t,e,i){var n={};t.exports=n;var s=i(63),r=i(73),o=i(12),a=i(25),h=i(55);n.stack=function(t,e,i,n,r,o,h){for(var l,u=s.create({label:"Stack"}),c=t,d=e,f=0,p=0;pg&&(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;l=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 L=0;L_&&(_+=e.length),A=Number.MAX_VALUE,_3&&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},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var n=t[i],s=i-1;s>=0;--s)S(n,t[s],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);return!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),!0)}};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))r.ACTIVE&&c(this,t,e))},setCollidesNever:function(t){for(var e=0;e1)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 w=Math.floor((e+v)/f);if((l>0||u===w||w<0||w>=p)&&(w=-1),u>=0&&u1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,w,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 b=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+b)/f);var _=Math.floor((i+b)/f);if((l>0||c===_||_<0||_>=g)&&(_=-1),c>=0&&c1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,u,_));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-b+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),w=g/x,b=-p/x,T=y*w+m*b,S=w*T,A=b*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:w,ny:b},!0)}return!1}});t.exports=r},function(t,e,i){var n=i(0),s=i(91),r=i(571),o=i(90),a=i(570),h=new n({initialize:function(t,e,i,n,r){void 0===n&&(n=16),void 0===r&&(r=n),this.world=t,this.gameObject=null,this.enabled=!0,this.parent,this.id=t.getNextID(),this.name="",this.size={x:n,y:r},this.offset={x:0,y:0},this.pos={x:e,y:i},this.last={x:e,y:i},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:t.defaults.maxVelocityX,y:t.defaults.maxVelocityY},this.standing=!1,this.gravityFactor=t.defaults.gravityFactor,this.bounciness=t.defaults.bounciness,this.minBounceVelocity=t.defaults.minBounceVelocity,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER,this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.updateCallback,this.slopeStanding={min:.767944870877505,max:2.3736477827122884}},reset:function(t,e){this.pos={x:t,y:e},this.last={x:t,y:e},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:100,y:100},this.standing=!1,this.gravityFactor=1,this.bounciness=0,this.minBounceVelocity=40,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER},update:function(t){var e=this.pos;this.last.x=e.x,this.last.y=e.y,this.vel.y+=this.world.gravity*t*this.gravityFactor,this.vel.x=r(t,this.vel.x,this.accel.x,this.friction.x,this.maxVel.x),this.vel.y=r(t,this.vel.y,this.accel.y,this.friction.y,this.maxVel.y);var i=this.vel.x*t,n=this.vel.y*t,s=this.world.collisionMap.trace(e.x,e.y,i,n,this.size.x,this.size.y);this.handleMovementTrace(s)&&a(this,s);var o=this.gameObject;o&&(o.x=e.x-this.offset.x+o.displayOriginX*o.scaleX,o.y=e.y-this.offset.y+o.displayOriginY*o.scaleY),this.updateCallback&&this.updateCallback(this)},drawDebug:function(t){var e=this.pos;if(this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.size.x,this.size.y)),this.debugShowVelocity){var i=e.x+this.size.x/2,n=e.y+this.size.y/2;t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.vel.x,n+this.vel.y)}},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},skipHash:function(){return!this.enabled||0===this.type&&0===this.checkAgainst&&0===this.collides},touches:function(t){return!(this.pos.x>=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(44),s=i(0),r=i(39),o=i(43),a=i(3),h=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;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=i,this.height=n,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,this._dx=0,this._dy=0},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},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y);var s=this.gameObject;return!t&&s.frame&&(t=s.frame.realWidth),!e&&s.frame&&(e=s.frame.realHeight),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)},postUpdate:function(){},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=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(341);function s(t){if(!(this instanceof s))return new s(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=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)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=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;te._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.up=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},function(t,e,i){var n=i(39);t.exports=function(t,e,i,s){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.left=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},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,i){var n=i(44),s=i(0),r=i(39),o=i(190),a=i(10),h=i(43),l=i(3),u=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;this.world=t,this.gameObject=e,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new l,this.position=new l(e.x,e.y),this.prev=new l(e.x,e.y),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=n,this.sourceWidth=i,this.sourceHeight=n,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(n/2),this.center=new l(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new l,this.newVelocity=new l,this.deltaMax=new l,this.acceleration=new l,this.allowDrag=!0,this.drag=new l,this.allowGravity=!0,this.gravity=new l,this.bounce=new l,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new l(1e4,1e4),this.friction=new l(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.moves=!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.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.physicsType=r.DYNAMIC_BODY,this._reset=!0,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._bounds=new a},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=o(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var n=!1;if(this.syncBounds){var s=t.getBounds(this._bounds);this.width=s.width,this.height=s.height,n=!0}else{var r=Math.abs(e.scaleX),a=Math.abs(e.scaleY);this._sx===r&&this._sy===a||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*a,this._sx=r,this._sy=a,n=!0)}n&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},update:function(t){this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds();var e=this.transform;if(this.position.x=e.x+e.scaleX*(this.offset.x-e.displayOriginX),this.position.y=e.y+e.scaleY*(this.offset.y-e.displayOriginY),this.updateCenter(),this.rotation=e.rotation,this.preRotation=this.rotation,this._reset&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves){this.world.updateMotion(this,t);var i=this.velocity.x,n=this.velocity.y;this.newVelocity.set(i*t,n*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(n,i),this.speed=Math.sqrt(i*i+n*n),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit("worldbounds",this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y},postUpdate:function(){this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y,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._dx<0?this.facing=r.FACING_LEFT:this._dx>0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),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(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),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):h(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._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},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.width/2):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 void 0===t&&(t=!0),this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),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},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=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 void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=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=i(260),s=i(24),r=i(0),o=i(259),a=i(39),h=i(58),l=i(11),u=i(276),c=i(275),d=i(274),f=i(258),p=i(257),g=i(4),v=i(256),y=i(580),m=i(10),x=i(255),w=i(579),b=i(574),T=i(573),S=i(96),A=i(253),_=i(254),C=i(42),M=i(3),P=i(59),E=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.bodies=new S,this.staticBodies=new S,this.pendingDestroy=new S,this.colliders=new v,this.gravity=new M(g(e,"gravity.x",0),g(e,"gravity.y",0)),this.bounds=new m(g(e,"x",0),g(e,"y",0),g(e,"width",t.sys.game.config.width),g(e,"height",t.sys.game.config.height)),this.checkCollision={up:g(e,"checkCollision.up",!0),down:g(e,"checkCollision.down",!0),left:g(e,"checkCollision.left",!0),right:g(e,"checkCollision.right",!0)},this.fps=g(e,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=g(e,"timeScale",1),this.OVERLAP_BIAS=g(e,"overlapBias",4),this.TILE_BIAS=g(e,"tileBias",16),this.forceX=g(e,"forceX",!1),this.isPaused=g(e,"isPaused",!1),this._total=0,this.drawDebug=g(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:g(e,"debugShowBody",!0),debugShowStaticBody:g(e,"debugShowStaticBody",!0),debugShowVelocity:g(e,"debugShowVelocity",!0),bodyDebugColor:g(e,"debugBodyColor",16711935),staticBodyDebugColor:g(e,"debugStaticBodyColor",255),velocityDebugColor:g(e,"debugVelocityColor",65280)},this.maxEntries=g(e,"maxEntries",16),this.useTree=g(e,"useTree",!0),this.tree=new x(this.maxEntries),this.staticTree=new x(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new C,this._tempMatrix2=new C,this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=a.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=s;)this._elapsed-=s,i++,this.step(n);this.stepsLastFrame=i}},step:function(t){var e,i,n=this.bodies.entries,s=n.length;for(e=0;e0){var l=this.tree,u=this.staticTree;for(o=(r=s.entries).length,t=0;ta.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(u.x,u.y,l.right,l.y)-u.radius):u.y>l.bottom&&(u.xl.right&&(a=h(u.x,u.y,l.right,l.bottom)-u.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 c=t.velocity.x,d=t.velocity.y,g=t.mass,v=e.velocity.x,y=e.velocity.y,m=e.mass,x=c*Math.cos(o)+d*Math.sin(o),w=c*Math.sin(o)-d*Math.cos(o),b=v*Math.cos(o)+y*Math.sin(o),T=v*Math.sin(o)-y*Math.cos(o),S=((g-m)*x+2*m*b)/(g+m),A=(2*g*x+(m-g)*b)/(g+m);t.immovable||(t.velocity.x=(S*Math.cos(o)-w*Math.sin(o))*t.bounce.x,t.velocity.y=(w*Math.cos(o)+S*Math.sin(o))*t.bounce.y,c=t.velocity.x,d=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>c?t.velocity.x*=-1:v<0&&!e.immovable&&c0&&!t.immovable&&y>d?t.velocity.y*=-1:y<0&&!e.immovable&&dMath.PI/2&&(c<0&&!t.immovable&&v0&&!e.immovable&&c>v?e.velocity.x*=-1:d<0&&!t.immovable&&y0&&!e.immovable&&c>y&&(e.velocity.y*=-1));var _=this._frameTime;return t.immovable||(t.x+=t.velocity.x*_-a*Math.cos(o),t.y+=t.velocity.y*_-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*_+a*Math.cos(o),e.y+=e.velocity.y*_+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),t.postUpdate(),e.postUpdate(),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?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):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.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);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,h,l,u=t.body;if(0!==e.length&&u&&u.enable)if(this.useTree){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===a.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(h=d.length,o=0;oc.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,p=e.getTilesWithinWorldXY(a,h,l,u);if(0===p.length)return!1;for(var g={left:0,right:0,top:0,bottom:0},v=0;v0&&(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(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(16),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],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],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],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},zero:function(){var t=this.val;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=0,this},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){var t=this.val;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},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],s=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=s,t[11]=t[14],t[12]=n,t[13]=r,t[14]=o,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=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15],y=e*o-i*r,m=e*a-n*r,x=e*h-s*r,w=i*a-n*o,b=i*h-s*o,T=n*h-s*a,S=l*p-u*f,A=l*g-c*f,_=l*v-d*f,C=u*g-c*p,M=u*v-d*p,P=c*v-d*g,E=y*P-m*M+x*C+w*_-b*A+T*S;return E?(E=1/E,t[0]=(o*P-a*M+h*C)*E,t[1]=(n*M-i*P-s*C)*E,t[2]=(p*T-g*b+v*w)*E,t[3]=(c*b-u*T-d*w)*E,t[4]=(a*_-r*P-h*A)*E,t[5]=(e*P-n*_+s*A)*E,t[6]=(g*x-f*T-v*m)*E,t[7]=(l*T-c*x+d*m)*E,t[8]=(r*M-o*_+h*S)*E,t[9]=(i*_-e*M-s*S)*E,t[10]=(f*b-p*x+v*y)*E,t[11]=(u*x-l*b-d*y)*E,t[12]=(o*A-r*C-a*S)*E,t[13]=(e*C-i*A+n*S)*E,t[14]=(p*m-f*w-g*y)*E,t[15]=(l*w-u*m+c*y)*E,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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return t[0]=o*(c*v-d*g)-u*(a*v-h*g)+p*(a*d-h*c),t[1]=-(i*(c*v-d*g)-u*(n*v-s*g)+p*(n*d-s*c)),t[2]=i*(a*v-h*g)-o*(n*v-s*g)+p*(n*h-s*a),t[3]=-(i*(a*d-h*c)-o*(n*d-s*c)+u*(n*h-s*a)),t[4]=-(r*(c*v-d*g)-l*(a*v-h*g)+f*(a*d-h*c)),t[5]=e*(c*v-d*g)-l*(n*v-s*g)+f*(n*d-s*c),t[6]=-(e*(a*v-h*g)-r*(n*v-s*g)+f*(n*h-s*a)),t[7]=e*(a*d-h*c)-r*(n*d-s*c)+l*(n*h-s*a),t[8]=r*(u*v-d*p)-l*(o*v-h*p)+f*(o*d-h*u),t[9]=-(e*(u*v-d*p)-l*(i*v-s*p)+f*(i*d-s*u)),t[10]=e*(o*v-h*p)-r*(i*v-s*p)+f*(i*h-s*o),t[11]=-(e*(o*d-h*u)-r*(i*d-s*u)+l*(i*h-s*o)),t[12]=-(r*(u*g-c*p)-l*(o*g-a*p)+f*(o*c-a*u)),t[13]=e*(u*g-c*p)-l*(i*g-n*p)+f*(i*c-n*u),t[14]=-(e*(o*g-a*p)-r*(i*g-n*p)+f*(i*a-n*o)),t[15]=e*(o*c-a*u)-r*(i*c-n*u)+l*(i*a-n*o),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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return(e*o-i*r)*(c*v-d*g)-(e*a-n*r)*(u*v-d*p)+(e*h-s*r)*(u*g-c*p)+(i*a-n*o)*(l*v-d*f)-(i*h-s*o)*(l*g-c*f)+(n*h-s*a)*(l*p-u*f)},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=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],y=e[15],m=t.val,x=m[0],w=m[1],b=m[2],T=m[3];return e[0]=x*i+w*o+b*u+T*p,e[1]=x*n+w*a+b*c+T*g,e[2]=x*s+w*h+b*d+T*v,e[3]=x*r+w*l+b*f+T*y,x=m[4],w=m[5],b=m[6],T=m[7],e[4]=x*i+w*o+b*u+T*p,e[5]=x*n+w*a+b*c+T*g,e[6]=x*s+w*h+b*d+T*v,e[7]=x*r+w*l+b*f+T*y,x=m[8],w=m[9],b=m[10],T=m[11],e[8]=x*i+w*o+b*u+T*p,e[9]=x*n+w*a+b*c+T*g,e[10]=x*s+w*h+b*d+T*v,e[11]=x*r+w*l+b*f+T*y,x=m[12],w=m[13],b=m[14],T=m[15],e[12]=x*i+w*o+b*u+T*p,e[13]=x*n+w*a+b*c+T*g,e[14]=x*s+w*h+b*d+T*v,e[15]=x*r+w*l+b*f+T*y,this},multiplyLocal:function(t){var e=[],i=this.val,n=t.val;return e[0]=i[0]*n[0]+i[1]*n[4]+i[2]*n[8]+i[3]*n[12],e[1]=i[0]*n[1]+i[1]*n[5]+i[2]*n[9]+i[3]*n[13],e[2]=i[0]*n[2]+i[1]*n[6]+i[2]*n[10]+i[3]*n[14],e[3]=i[0]*n[3]+i[1]*n[7]+i[2]*n[11]+i[3]*n[15],e[4]=i[4]*n[0]+i[5]*n[4]+i[6]*n[8]+i[7]*n[12],e[5]=i[4]*n[1]+i[5]*n[5]+i[6]*n[9]+i[7]*n[13],e[6]=i[4]*n[2]+i[5]*n[6]+i[6]*n[10]+i[7]*n[14],e[7]=i[4]*n[3]+i[5]*n[7]+i[6]*n[11]+i[7]*n[15],e[8]=i[8]*n[0]+i[9]*n[4]+i[10]*n[8]+i[11]*n[12],e[9]=i[8]*n[1]+i[9]*n[5]+i[10]*n[9]+i[11]*n[13],e[10]=i[8]*n[2]+i[9]*n[6]+i[10]*n[10]+i[11]*n[14],e[11]=i[8]*n[3]+i[9]*n[7]+i[10]*n[11]+i[11]*n[15],e[12]=i[12]*n[0]+i[13]*n[4]+i[14]*n[8]+i[15]*n[12],e[13]=i[12]*n[1]+i[13]*n[5]+i[14]*n[9]+i[15]*n[13],e[14]=i[12]*n[2]+i[13]*n[6]+i[14]*n[10]+i[15]*n[14],e[15]=i[12]*n[3]+i[13]*n[7]+i[14]*n[11]+i[15]*n[15],this.fromArray(e)},translate:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[12]=s[0]*e+s[4]*i+s[8]*n+s[12],s[13]=s[1]*e+s[5]*i+s[9]*n+s[13],s[14]=s[2]*e+s[6]*i+s[10]*n+s[14],s[15]=s[3]*e+s[7]*i+s[11]*n+s[15],this},scale:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[0]=s[0]*e,s[1]=s[1]*e,s[2]=s[2]*e,s[3]=s[3]*e,s[4]=s[4]*i,s[5]=s[5]*i,s[6]=s[6]*i,s[7]=s[7]*i,s[8]=s[8]*n,s[9]=s[9]*n,s[10]=s[10]*n,s[11]=s[11]*n,this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,o=t.y,a=t.z,h=s*r,l=s*o;return this.fromArray([h*r+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*r,0,h*a-n*o,l*a+n*r,s*a*a+i,0,0,0,0,1]),this},rotate:function(t,e){var i=this.val,n=e.x,s=e.y,r=e.z,o=Math.sqrt(n*n+s*s+r*r);if(Math.abs(o)<1e-6)return null;n*=o=1/o,s*=o,r*=o;var a=Math.sin(t),h=Math.cos(t),l=1-h,u=i[0],c=i[1],d=i[2],f=i[3],p=i[4],g=i[5],v=i[6],y=i[7],m=i[8],x=i[9],w=i[10],b=i[11],T=n*n*l+h,S=s*n*l+r*a,A=r*n*l-s*a,_=n*s*l-r*a,C=s*s*l+h,M=r*s*l+n*a,P=n*r*l+s*a,E=s*r*l-n*a,k=r*r*l+h;return i[0]=u*T+p*S+m*A,i[1]=c*T+g*S+x*A,i[2]=d*T+v*S+w*A,i[3]=f*T+y*S+b*A,i[4]=u*_+p*C+m*M,i[5]=c*_+g*C+x*M,i[6]=d*_+v*C+w*M,i[7]=f*_+y*C+b*M,i[8]=u*P+p*E+m*k,i[9]=c*P+g*E+x*k,i[10]=d*P+v*E+w*k,i[11]=f*P+y*E+b*k,this},rotateX:function(t){var e=this.val,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},rotateY:function(t){var e=this.val,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},rotateZ:function(t){var e=this.val,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},fromRotationTranslation:function(t,e){var i=this.val,n=t.x,s=t.y,r=t.z,o=t.w,a=n+n,h=s+s,l=r+r,u=n*a,c=n*h,d=n*l,f=s*h,p=s*l,g=r*l,v=o*a,y=o*h,m=o*l;return i[0]=1-(f+g),i[1]=c+m,i[2]=d-y,i[3]=0,i[4]=c-m,i[5]=1-(u+g),i[6]=p+v,i[7]=0,i[8]=d+y,i[9]=p-v,i[10]=1-(u+f),i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},fromQuat:function(t){var e=this.val,i=t.x,n=t.y,s=t.z,r=t.w,o=i+i,a=n+n,h=s+s,l=i*o,u=i*a,c=i*h,d=n*a,f=n*h,p=s*h,g=r*o,v=r*a,y=r*h;return e[0]=1-(d+p),e[1]=u+y,e[2]=c-v,e[3]=0,e[4]=u-y,e[5]=1-(l+p),e[6]=f+g,e[7]=0,e[8]=c+v,e[9]=f-g,e[10]=1-(l+d),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},frustum:function(t,e,i,n,s,r){var o=this.val,a=1/(e-t),h=1/(n-i),l=1/(s-r);return o[0]=2*s*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*s*h,o[6]=0,o[7]=0,o[8]=(e+t)*a,o[9]=(n+i)*h,o[10]=(r+s)*l,o[11]=-1,o[12]=0,o[13]=0,o[14]=r*s*2*l,o[15]=0,this},perspective:function(t,e,i,n){var s=this.val,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},perspectiveLH:function(t,e,i,n){var s=this.val;return s[0]=2*i/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/e,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=-n/(i-n),s[11]=1,s[12]=0,s[13]=0,s[14]=i*n/(i-n),s[15]=0,this},ortho:function(t,e,i,n,s,r){var o=this.val,a=t-e,h=i-n,l=s-r;return a=0===a?a:1/a,h=0===h?h:1/h,l=0===l?l:1/l,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},lookAt:function(t,e,i){var n=this.val,s=t.x,r=t.y,o=t.z,a=i.x,h=i.y,l=i.z,u=e.x,c=e.y,d=e.z;if(Math.abs(s-u)<1e-6&&Math.abs(r-c)<1e-6&&Math.abs(o-d)<1e-6)return this.identity();var f=s-u,p=r-c,g=o-d,v=1/Math.sqrt(f*f+p*p+g*g),y=h*(g*=v)-l*(p*=v),m=l*(f*=v)-a*g,x=a*p-h*f;(v=Math.sqrt(y*y+m*m+x*x))?(y*=v=1/v,m*=v,x*=v):(y=0,m=0,x=0);var w=p*x-g*m,b=g*y-f*x,T=f*m-p*y;return(v=Math.sqrt(w*w+b*b+T*T))?(w*=v=1/v,b*=v,T*=v):(w=0,b=0,T=0),n[0]=y,n[1]=w,n[2]=f,n[3]=0,n[4]=m,n[5]=b,n[6]=p,n[7]=0,n[8]=x,n[9]=T,n[10]=g,n[11]=0,n[12]=-(y*s+m*r+x*o),n[13]=-(w*s+b*r+T*o),n[14]=-(f*s+p*r+g*o),n[15]=1,this},yawPitchRoll:function(t,e,i){this.zero(),s.zero(),r.zero();var n=this.val,o=s.val,a=r.val,h=Math.sin(i),l=Math.cos(i);return n[10]=1,n[15]=1,n[0]=l,n[1]=h,n[4]=-h,n[5]=l,h=Math.sin(e),l=Math.cos(e),o[0]=1,o[15]=1,o[5]=l,o[10]=l,o[9]=-h,o[6]=h,h=Math.sin(t),l=Math.cos(t),a[5]=1,a[15]=1,a[0]=l,a[2]=-h,a[8]=h,a[10]=l,this.multiplyLocal(s),this.multiplyLocal(r),this},setWorldMatrix:function(t,e,i,n,o){return this.yawPitchRoll(t.y,t.x,t.z),s.scaling(i.x,i.y,i.z),r.xyz(e.x,e.y,e.z),this.multiplyLocal(s),this.multiplyLocal(r),void 0!==n&&this.multiplyLocal(n),void 0!==o&&this.multiplyLocal(o),this}}),s=new n,r=new n;t.exports=n},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],w=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+w*h,e[7]=m*n+x*o+w*l,e[8]=m*s+x*a+w*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,w=n*l-r*a,b=n*u-o*a,T=s*l-r*h,S=s*u-o*h,A=r*u-o*l,_=c*v-d*g,C=c*y-f*g,M=c*m-p*g,P=d*y-f*v,E=d*m-p*v,k=f*m-p*y,F=x*k-w*E+b*P+T*M-S*C+A*_;return F?(F=1/F,i[0]=(h*k-l*E+u*P)*F,i[1]=(l*M-a*k-u*C)*F,i[2]=(a*E-h*M+u*_)*F,i[3]=(r*E-s*k-o*P)*F,i[4]=(n*k-r*M+o*C)*F,i[5]=(s*M-n*E-o*_)*F,i[6]=(v*A-y*S+m*T)*F,i[7]=(y*b-g*A-m*w)*F,i[8]=(g*S-v*b+m*x)*F,this):null}});t.exports=n},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,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e,i){var n=i(272);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),te-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)=0?t:t+2*Math.PI}},function(t,e,i){var n=i(0),s=i(20),r=i(22),o=i(7),a=i(1),h=i(8),l=new n({Extends:r,initialize:function(t,e,i,n){var s="txt";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),s=a(o,"extension",s)}var l={type:"text",cache:t.cacheManager.text,extension:s,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,l)},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("text",function(t,e,i){if(Array.isArray(t))for(var n=0;n=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),s>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",e,this,t),this.pad.emit("down",i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit("up",e,this,t),this.pad.emit("up",i,t,this))},destroy:function(){this.pad=null,this.events=null}});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=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom0){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,i){t.exports={CircleToCircle:i(770),CircleToRectangle:i(769),GetRectangleIntersection:i(768),LineToCircle:i(300),LineToLine:i(117),LineToRectangle:i(767),PointToLine:i(299),PointToLineSegment:i(766),RectangleToRectangle:i(164),RectangleToTriangle:i(765),RectangleToValues:i(764),TriangleToCircle:i(763),TriangleToLine:i(762),TriangleToTriangle:i(761)}},function(t,e,i){t.exports={Circle:i(790),Ellipse:i(780),Intersects:i(301),Line:i(760),Point:i(742),Polygon:i(728),Rectangle:i(293),Triangle:i(698)}},function(t,e,i){var n=i(0),s=i(304),r=i(9),o=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1,this.maxLights=-1},enable:function(){return-1===this.maxLights&&(this.maxLights=this.scene.sys.game.renderer.config.maxLights),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,r=t.y+t.height/2,o=(t.width+t.height)/2,a={x:0,y:0},h=t.matrix,l=this.systems.game.config.height;i.length=0;for(var u=0;u0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],o):h=new s(t,e,i,a[0],a[1],a[2],o),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=o},function(t,e,i){var n=i(0),s=i(9),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(71),s=i(6);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(6),s=i(71);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=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(0),s=i(31),r=i(66),o=i(839),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),s.call(this,t,"Triangle",new r(n,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,n,s,r){return this.geom.setTo(t,e,i,n,s,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(842),s=i(0),r=i(70),o=i(31),a=new s({Extends:o,Mixins:[n],initialize:function(t,e,i,n,s,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===s&&(s=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=s,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,s=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var l=0;l0&&r.push(i([0,0],n[0])),e=0;e1&&r.push(i([0,0],n[n.length-1])),t.setTo(r)}},function(t,e,i){var n=i(71),s=i(60);t.exports=function(t){for(var e=t.points,i=0,r=0;rc+v)){var y=g.getPoint((u-c)/v);o.push(y);break}c+=v}return o}},function(t,e,i){var n=i(10);t.exports=function(t,e){void 0===e&&(e=new n);for(var i,s=1/0,r=1/0,o=-s,a=-r,h=0;h0&&(s=-h.PI2+s%h.PI2):s>h.PI2?s=h.PI2:s<0&&(s=h.PI2+s%h.PI2);for(var u,c=[a+Math.cos(n)*i,l+Math.sin(n)*i];e<1;)u=s*e+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=s+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(n)*i,l+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},function(t,e){t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<this._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=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=i(72),s=i(0),r=i(16),o=i(329),a=i(328),h=i(889),l=i(1),u=i(178),c=i(326),d=i(77),f=i(331),p=i(325),g=i(10),v=i(120),y=i(3),m=i(59),x=new s({Mixins:[r.BlendMode,r.Mask,r.ScrollFactor,r.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=f,this.x=new h(e,"x",0),this.y=new h(e,"y",0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",4294967295),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3),this.angle=new h(e,"angle",{min:0,max:360}),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new y,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&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=i(0),s=i(36),r=i(58),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.tint=16777215,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.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.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(0),s=i(1),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);s>>16,m=(65280&p)>>>8,x=255&p,c.strokeStyle="rgba("+y+","+m+","+x+","+d+")",c.lineWidth=v,w+=3;break;case n.FILL_STYLE:g=l[w+1],f=l[w+2],y=(16711680&g)>>>16,m=(65280&g)>>>8,x=255&g,c.fillStyle="rgba("+y+","+m+","+x+","+f+")",w+=2;break;case n.BEGIN_PATH:c.beginPath();break;case n.CLOSE_PATH:c.closePath();break;case n.FILL_PATH:h||c.fill();break;case n.STROKE_PATH:h||c.stroke();break;case n.FILL_RECT:h?c.rect(l[w+1],l[w+2],l[w+3],l[w+4]):c.fillRect(l[w+1],l[w+2],l[w+3],l[w+4]),w+=4;break;case n.FILL_TRIANGLE:c.beginPath(),c.moveTo(l[w+1],l[w+2]),c.lineTo(l[w+3],l[w+4]),c.lineTo(l[w+5],l[w+6]),c.closePath(),h||c.fill(),w+=6;break;case n.STROKE_TRIANGLE:c.beginPath(),c.moveTo(l[w+1],l[w+2]),c.lineTo(l[w+3],l[w+4]),c.lineTo(l[w+5],l[w+6]),c.closePath(),h||c.stroke(),w+=6;break;case n.LINE_TO:c.lineTo(l[w+1],l[w+2]),w+=2;break;case n.MOVE_TO:c.moveTo(l[w+1],l[w+2]),w+=2;break;case n.LINE_FX_TO:c.lineTo(l[w+1],l[w+2]),w+=5;break;case n.MOVE_FX_TO:c.moveTo(l[w+1],l[w+2]),w+=5;break;case n.SAVE:c.save();break;case n.RESTORE:c.restore();break;case n.TRANSLATE:c.translate(l[w+1],l[w+2]),w+=2;break;case n.SCALE:c.scale(l[w+1],l[w+2]),w+=2;break;case n.ROTATE:c.rotate(l[w+1]),w+=1;break;case n.GRADIENT_FILL_STYLE:w+=5;break;case n.GRADIENT_LINE_STYLE:w+=6;break;case n.SET_TEXTURE:w+=2}c.restore()}}},function(t,e){t.exports=function(t){var e=t.width/2,i=t.height/2,n=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*n/(10+Math.sqrt(4-3*n)))}},function(t,e,i){var n=i(334),s=i(172),r=i(103),o=i(18);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(4),s=i(132),r=function(t,e,i){for(var n=[],s=0;sr;){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){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e){t.exports=function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n}},function(t,e,i){var n=i(948),s=i(0),r=i(102),o=i(11),a=i(947),h=i(945),l=i(944),u=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.data=new r(this),this.on("setdata",this.setDataHandler,this),this.on("changedata",this.changeDataHandler,this),this.hasLoaded=!1,this.dataLocked=!1,this.supportedAPIs=[],this.entryPoint="",this.entryPointData=null,this.contextID=null,this.contextType=null,this.locale=null,this.platform=null,this.version=null,this.playerID=null,this.playerName=null,this.playerPhotoURL=null,this.playerCanSubscribeBot=!1,this.paymentsReady=!1,this.catalog=[],this.purchases=[],this.leaderboards={},this.ads=[]},setDataHandler:function(t,e,i){if(!this.dataLocked){var n={};n[e]=i;var s=this;FBInstant.player.setDataAsync(n).then(function(){s.emit("savedata",n)})}},changeDataHandler:function(t,e,i){if(!this.dataLocked){var n={};n[e]=i;var s=this;FBInstant.player.setDataAsync(n).then(function(){s.emit("savedata",n)})}},showLoadProgress:function(t){return t.load.on("progress",function(t){this.hasLoaded||FBInstant.setLoadingProgress(100*t)},this),t.load.on("complete",function(){this.hasLoaded||(this.hasLoaded=!0,FBInstant.startGameAsync().then(this.gameStarted.bind(this)))},this),this},gameStarted:function(){var t={},e=function(t){return t[1].toUpperCase()};FBInstant.getSupportedAPIs().forEach(function(i){i=i.replace(/\../g,e),t[i]=!0}),this.supportedAPIs=t,this.getID(),this.getType(),this.getLocale(),this.getPlatform(),this.getSDKVersion(),this.getPlayerID(),this.getPlayerName(),this.getPlayerPhotoURL();var i=this;FBInstant.onPause(function(){i.emit("pause")}),FBInstant.getEntryPointAsync().then(function(t){i.entryPoint=t,i.entryPointData=FBInstant.getEntryPointData(),i.emit("startgame")}).catch(function(t){console.warn(t)}),this.supportedAPIs.paymentsPurchaseAsync&&FBInstant.payments.onReady(function(){i.paymentsReady=!0}).catch(function(t){console.warn(t)})},checkAPI:function(t){return!!this.supportedAPIs[t]},getID:function(){return!this.contextID&&this.supportedAPIs.contextGetID&&(this.contextID=FBInstant.context.getID()),this.contextID},getType:function(){return!this.contextType&&this.supportedAPIs.contextGetType&&(this.contextType=FBInstant.context.getType()),this.contextType},getLocale:function(){return!this.locale&&this.supportedAPIs.getLocale&&(this.locale=FBInstant.getLocale()),this.locale},getPlatform:function(){return!this.platform&&this.supportedAPIs.getPlatform&&(this.platform=FBInstant.getPlatform()),this.platform},getSDKVersion:function(){return!this.version&&this.supportedAPIs.getSDKVersion&&(this.version=FBInstant.getSDKVersion()),this.version},getPlayerID:function(){return!this.playerID&&this.supportedAPIs.playerGetID&&(this.playerID=FBInstant.player.getID()),this.playerID},getPlayerName:function(){return!this.playerName&&this.supportedAPIs.playerGetName&&(this.playerName=FBInstant.player.getName()),this.playerName},getPlayerPhotoURL:function(){return!this.playerPhotoURL&&this.supportedAPIs.playerGetPhoto&&(this.playerPhotoURL=FBInstant.player.getPhoto()),this.playerPhotoURL},loadPlayerPhoto:function(t,e){return this.playerPhotoURL&&(t.load.setCORS("anonymous"),t.load.image(e,this.playerPhotoURL),t.load.once("filecomplete_image_"+e,function(){this.emit("photocomplete",e)},this),t.load.start()),this},canSubscribeBot:function(){if(this.supportedAPIs.playerCanSubscribeBotAsync){var t=this;FBInstant.player.canSubscribeBotAsync().then(function(){t.playerCanSubscribeBot=!0,t.emit("cansubscribebot")}).catch(function(e){t.emit("cansubscribebotfail",e)})}else this.emit("cansubscribebotfail");return this},subscribeBot:function(){if(this.playerCanSubscribeBot){var t=this;FBInstant.player.subscribeBotAsync().then(function(){t.emit("subscribebot")}).catch(function(e){t.emit("subscribebotfail",e)})}else this.emit("subscribebotfail");return this},getData:function(t){if(!this.checkAPI("playerGetDataAsync"))return this;Array.isArray(t)||(t=[t]);var e=this;return FBInstant.player.getDataAsync(t).then(function(t){for(var i in e.dataLocked=!0,t)e.data.set(i,t[i]);e.dataLocked=!1,e.emit("getdata",t)}),this},saveData:function(t){if(!this.checkAPI("playerSetDataAsync"))return this;var e=this;return FBInstant.player.setDataAsync(t).then(function(){e.emit("savedata",t)}).catch(function(t){e.emit("savedatafail",t)}),this},flushData:function(){if(!this.checkAPI("playerFlushDataAsync"))return this;var t=this;return FBInstant.player.flushDataAsync().then(function(){t.emit("flushdata")}).catch(function(e){t.emit("flushdatafail",e)}),this},getStats:function(t){if(!this.checkAPI("playerGetStatsAsync"))return this;var e=this;return FBInstant.player.getStatsAsync(t).then(function(t){e.emit("getstats",t)}).catch(function(t){e.emit("getstatsfail",t)}),this},saveStats:function(t){if(!this.checkAPI("playerSetStatsAsync"))return this;var e={};for(var i in t)"number"==typeof t[i]&&(e[i]=t[i]);var n=this;return FBInstant.player.setStatsAsync(e).then(function(){n.emit("savestats",e)}).catch(function(t){n.emit("savestatsfail",t)}),this},incStats:function(t){if(!this.checkAPI("playerIncrementStatsAsync"))return this;var e={};for(var i in t)"number"==typeof t[i]&&(e[i]=t[i]);var n=this;return FBInstant.player.incrementStatsAsync(e).then(function(t){n.emit("incstats",t)}).catch(function(t){n.emit("incstatsfail",t)}),this},saveSession:function(t){return this.checkAPI("setSessionData")?(JSON.stringify(t).length<=1e3?FBInstant.setSessionData(t):console.warn("Session data too long. Max 1000 chars."),this):this},openShare:function(t,e,i,n){return this._share("SHARE",t,e,i,n)},openInvite:function(t,e,i,n){return this._share("INVITE",t,e,i,n)},openRequest:function(t,e,i,n){return this._share("REQUEST",t,e,i,n)},openChallenge:function(t,e,i,n){return this._share("CHALLENGE",t,e,i,n)},_share:function(t,e,i,n,s){if(!this.checkAPI("shareAsync"))return this;if(void 0===s&&(s={}),i)var r=this.game.textures.getBase64(i,n);var o={intent:t,image:r,text:e,data:s},a=this;return FBInstant.shareAsync(o).then(function(){a.emit("resume")}),this},isSizeBetween:function(t,e){return this.checkAPI("contextIsSizeBetween")?FBInstant.context.isSizeBetween(t,e):this},switchContext:function(t){if(!this.checkAPI("contextSwitchAsync"))return this;if(t!==this.contextID){var e=this;FBInstant.context.switchAsync(t).then(function(){e.contextID=FBInstant.context.getID(),e.emit("switch",e.contextID)}).catch(function(t){e.emit("switchfail",t)})}return this},chooseContext:function(t){if(!this.checkAPI("contextChoseAsync"))return this;var e=this;return FBInstant.context.chooseAsync(t).then(function(){e.contextID=FBInstant.context.getID(),e.emit("choose",e.contextID)}).catch(function(t){e.emit("choosefail",t)}),this},createContext:function(t){if(!this.checkAPI("contextCreateAsync"))return this;var e=this;return FBInstant.context.createAsync(t).then(function(){e.contextID=FBInstant.context.getID(),e.emit("create",e.contextID)}).catch(function(t){e.emit("createfail",t)}),this},getPlayers:function(){if(!this.checkAPI("playerGetConnectedPlayersAsync"))return this;var t=this;return FBInstant.player.getConnectedPlayersAsync().then(function(e){t.emit("players",e)}).catch(function(e){t.emit("playersfail",e)}),this},getCatalog:function(){if(!this.paymentsReady)return this;var t=this,e=this.catalog;return FBInstant.payments.getCatalogAsync().then(function(i){e=[],i.forEach(function(t){e.push(h(t))}),t.emit("getcatalog",e)}).catch(function(e){t.emit("getcatalogfail",e)}),this},purchase:function(t,e){if(!this.paymentsReady)return this;var i={productID:t};e&&(i.developerPayload=e);var n=this;return FBInstant.payments.purchaseAsync(i).then(function(t){var e=l(t);n.emit("purchase",e)}).catch(function(t){n.emit("purchasefail",t)}),this},getPurchases:function(){if(!this.paymentsReady)return this;var t=this,e=this.purchases;return FBInstant.payments.getPurchasesAsync().then(function(i){e=[],i.forEach(function(t){e.push(l(t))}),t.emit("getpurchases",e)}).catch(function(e){t.emit("getpurchasesfail",e)}),this},consumePurchases:function(t){if(!this.paymentsReady)return this;var e=this;return FBInstant.payments.consumePurchaseAsync(t).then(function(){e.emit("consumepurchase",t)}).catch(function(t){e.emit("consumepurchasefail",t)}),this},update:function(t,e,i,n,s,r){return this._update("CUSTOM",t,e,i,n,s,r)},updateLeaderboard:function(t,e,i,n,s,r){return this._update("LEADERBOARD",t,e,i,n,s,r)},_update:function(t,e,i,n,s,r,o){if(!this.checkAPI("shareAsync"))return this;if(void 0===e&&(e=""),"string"==typeof i&&(i={default:i}),void 0===o&&(o={}),n)var a=this.game.textures.getBase64(n,s);var h={action:t,cta:e,image:a,text:i,template:r,data:o,strategy:"IMMEDIATE",notification:"NO_PUSH"},l=this;return FBInstant.updateAsync(h).then(function(){l.emit("update")}).catch(function(t){l.emit("updatefail",t)}),this},switchGame:function(t,e){if(!this.checkAPI("switchGameAsync"))return this;if(e&&JSON.stringify(e).length>1e3)return console.warn("Switch Game data too long. Max 1000 chars."),this;var i=this;return FBInstant.switchGameAsync(t,e).then(function(){i.emit("switchgame",t)}).catch(function(t){i.emit("switchgamefail",t)}),this},createShortcut:function(){var t=this;return FBInstant.canCreateShortcutAsync().then(function(e){e&&FBInstant.createShortcutAsync().then(function(){t.emit("shortcutcreated")}).catch(function(e){t.emit("shortcutfailed",e)})}),this},quit:function(){FBInstant.quit()},log:function(t,e,i){return this.checkAPI("logEvent")?(void 0===i&&(i={}),t.length>=2&&t.length<=40&&FBInstant.logEvent(t,parseFloat(e),i),this):this},preloadAds:function(t){if(!this.checkAPI("getInterstitialAdAsync"))return this;var e;Array.isArray(t)||(t=[t]);var i=this,s=0;for(e=0;e=3)return console.warn("Too many AdInstances. Show an ad before loading more"),this;for(e=0;e=3)return console.warn("Too many AdInstances. Show an ad before loading more"),this;for(e=0;e=r.x&&t=r.y&&e=r.x&&t=r.y&&e0)&&(!!n.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)&&(!!n.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!n.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(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||this.emit("mute",this,t)}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||this.emit("volume",this,t)}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||(this.calculateRate(),this.emit("rate",this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||(this.calculateRate(),this.emit("detune",this,t))}},setDetune:function(t){return this.detune=t,this},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))}},setSeek:function(t){return this.seek=t,this},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))}},setLoop:function(t){return this.loop=t,this}});t.exports=s},function(t,e,i){var n=i(125),s=i(0),r=i(352),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(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each(function(e,i){for(var n=0;n-1&&(delete this.keys[n],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,i=t.sys,n=i.settings;t.init&&(t.init.call(t,n.data),n.status=s.INIT,n.isTransition&&i.events.emit("transitioninit",n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=s.LOADING,e.once("complete",this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>s.START&&n.settings.status<=s.RUNNING&&n.step(t,e)}},resize:function(t,e){for(var i=0;i=s.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)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.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e=0;){var a=e[o];-1!==(r=t.indexOf(a))?(n(t,r),i&&i.call(s,a)):e.pop(),o--}return e}},function(t,e,i){var n=i(0),s=i(11),r=i(7),o=i(14),a=i(5),h=i(1),l=i(15),u=i(359),c=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once("boot",this.boot,this)},boot:function(){var t,e,i,n,s,r,o,a=this.game.config,l=a.installGlobalPlugins;for(l=l.concat(this._pendingGlobal),t=0;t10&&(t=10-this.pointersTotal);for(var i=0;i0},queueTouchStart:function(t){if(this.queue.push(s.TOUCH_START,t),this._hasDownCallback){var e=this.domCallbacks;this._hasDownCallback=this.processDomCallbacks(e.downOnce,e.down,t)}},queueTouchMove:function(t){if(this.queue.push(s.TOUCH_MOVE,t),this._hasMoveCallback){var e=this.domCallbacks;this._hasMoveCallback=this.processDomCallbacks(e.moveOnce,e.move,t)}},queueTouchEnd:function(t){if(this.queue.push(s.TOUCH_END,t),this._hasUpCallback){var e=this.domCallbacks;this._hasUpCallback=this.processDomCallbacks(e.upOnce,e.up,t)}},queueTouchCancel:function(t){this.queue.push(s.TOUCH_CANCEL,t)},queueMouseDown:function(t){if(this.queue.push(s.MOUSE_DOWN,t),this._hasDownCallback){var e=this.domCallbacks;this._hasDownCallback=this.processDomCallbacks(e.downOnce,e.down,t)}},queueMouseMove:function(t){if(this.queue.push(s.MOUSE_MOVE,t),this._hasMoveCallback){var e=this.domCallbacks;this._hasMoveCallback=this.processDomCallbacks(e.moveOnce,e.move,t)}},queueMouseUp:function(t){if(this.queue.push(s.MOUSE_UP,t),this._hasUpCallback){var e=this.domCallbacks;this._hasUpCallback=this.processDomCallbacks(e.upOnce,e.up,t)}},addUpCallback:function(t,e){return void 0===e&&(e=!0),e?this.domCallbacks.upOnce.push(t):this.domCallbacks.up.push(t),this._hasUpCallback=!0,this},addDownCallback:function(t,e){return void 0===e&&(e=!0),e?this.domCallbacks.downOnce.push(t):this.domCallbacks.down.push(t),this._hasDownCallback=!0,this},addMoveCallback:function(t,e){return void 0===e&&(e=!1),e?this.domCallbacks.moveOnce.push(t):this.domCallbacks.move.push(t),this._hasMoveCallback=!0,this},inputCandidate:function(t,e){var i=t.input;if(!i||!i.enabled||!t.willRender(e))return!1;var n=!0,s=t.parentContainer;if(s)do{if(!s.willRender(e)){n=!1;break}s=s.parentContainer}while(s);return n},hitTest:function(t,e,i,n){void 0===n&&(n=this._tempHitTest);var s=this._tempPoint,r=i.scrollX,o=i.scrollY;n.length=0;var a=t.x,h=t.y;1!==i.resolution&&(a+=i._x,h+=i._y),i.getWorldPoint(a,h,s),t.worldX=s.x,t.worldY=s.y;for(var l={x:0,y:0},u=this._tempMatrix,d=this._tempMatrix2,f=0;f0&&n>0&&s.scissor(t,this.drawingBufferHeight-e-n,i,n))},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},setPipeline:function(t,e){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(e),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==r.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,!0)},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},setBlankTexture:function(t){void 0===t&&(t=!1),!t&&0===this.currentActiveTextureUnit&&this.currentTextures[0]||this.setTexture2D(this.blankTexture.glTexture,0)},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,i=this.width,n=this.height;return t!==this.currentFramebuffer&&(t&&t.renderTexture?(i=t.renderTexture.width,n=t.renderTexture.height):this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),e.viewport(0,0,i,n),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 s=this.gl,a=s.NEAREST,h=s.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,o(e,i)&&(h=s.REPEAT),n===r.ScaleModes.LINEAR&&this.config.antialias&&(a=s.LINEAR),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,s.RGBA,t):this.createTexture2D(0,a,a,h,h,s.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){l=void 0===l||null===l||l;var u=this.gl,c=u.createTexture();return 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){var e=this.nativeTextures.indexOf(t);return-1!==e&&a(this.nativeTextures,e),this.gl.deleteTexture(t),this.currentTextures[0]===t&&this.setBlankTexture(!0),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=t._cx,i=t._cy,n=t._cw,s=t._ch,r=this.pipelines.TextureTintPipeline,o=t.backgroundColor;if(t.renderToTexture){this.flush(),this.pushScissor(e,i,n,-s),this.setFramebuffer(t.framebuffer);var a=this.gl;a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),r.projOrtho(e,n+e,i,s+i,-1e3,1e3),o.alphaGL>0&&r.drawFillRect(e,i,n+e,s+i,l.getTintFromFloats(o.redGL,o.greenGL,o.blueGL,1),o.alphaGL),t.emit("prerender",t)}else this.pushScissor(e,i,n,s),o.alphaGL>0&&r.drawFillRect(e,i,n,s,l.getTintFromFloats(o.redGL,o.greenGL,o.blueGL,1),o.alphaGL)},postRenderCamera:function(t){var e=this.pipelines.TextureTintPipeline;if(t.flashEffect.postRenderWebGL(e,l.getTintFromFloats),t.fadeEffect.postRenderWebGL(e,l.getTintFromFloats),t.dirty=!1,this.popScissor(),t.renderToTexture){e.flush(),this.setFramebuffer(null),t.emit("postrender",t),e.projOrtho(0,e.width,e.height,0,-1e3,1e3);var i=l.getTintAppendFloatAlpha;(t.pipeline?t.pipeline:e).batchTexture(t,t.glTexture,t.width,t.height,t.x,t.y,t.width,t.height,t.zoom,t.zoom,t.rotation,t.flipX,!t.flipY,1,1,0,0,0,0,t.width,t.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),t._isTinted&&t.tintFill,0,0,this.defaultCamera,null),this.setBlankTexture(!0)}},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;for(var n in this.config.clearBeforeRender&&(t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)),t.enable(t.SCISSOR_TEST),i)i[n].onPreRender();this.currentScissor=[0,0,this.width,this.height],this.scissorStack=[this.currentScissor],this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.setPipeline(this.pipelines.TextureTintPipeline)}},render:function(t,e,i,n){if(!this.contextLost){var s=e.list,o=s.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;l=0?g=-(g+d):g<0&&(g=Math.abs(g)-d)),-1===m&&(v>=0?v=-(v+f):v<0&&(v=Math.abs(v)-f))}a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y,o.multiply(a,h)):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY,o.multiply(a,h)),r.save(),h.setToContext(r),r.scale(y,m),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=s,r.drawImage(e.source.image,u,c,d,f,g,v,d/p,f/p),r.restore()}},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=u},function(t,e,i){var n,s,r,o=i(26),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){t.exports={os:i(101),browser:i(128),features:i(186),input:i(974),audio:i(973),video:i(972),fullscreen:i(971),canvasFeatures:i(375)}},function(t,e,i){var n=i(0),s=i(2),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.timeOutID=window.requestAnimationFrame(e),t.callback(i)},this.stepTimeout=function e(){var i=Date.now(),n=Math.max(16+t.lastTime-i,0);t.lastTime=t.tick,t.tick=i,t.timeOutID=window.setTimeout(e,n),t.callback(i)}},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=function(t){t.parentNode&&t.parentNode.removeChild(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,i){var n=i(101);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,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e){t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},function(t,e,i){var n=i(41);n.ColorToRGBA=i(987),n.ComponentToHex=i(382),n.GetColor=i(195),n.GetColor32=i(412),n.HexStringToColor=i(413),n.HSLToColor=i(986),n.HSVColorWheel=i(985),n.HSVToRGB=i(194),n.HueToComponent=i(381),n.IntegerToColor=i(410),n.IntegerToRGB=i(409),n.Interpolate=i(984),n.ObjectToColor=i(408),n.RandomRGB=i(983),n.RGBStringToColor=i(407),n.RGBToHSV=i(411),n.RGBToString=i(982),n.ValueToColor=i(196),t.exports=n},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","crisp-edges","-moz-crisp-edges","-webkit-optimize-contrast","optimize-contrast","pixelated"].forEach(function(e){t.style["image-rendering"]=e}),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(189),s=i(0),r=i(80),o=i(3),a=new s({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.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;ei;)n-=i;n16777215?{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(41),s=i(409);t.exports=function(t){var e=s(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(ef.right&&(p=u(p,p+(v-f.right),this.lerp.x)),yf.bottom&&(g=u(g,g+(y-f.bottom),this.lerp.y))):(p=u(p,v-l,this.lerp.x),g=u(g,y-c,this.lerp.y))}this.useBounds&&(p=this.clampX(p),g=this.clampY(g)),this.roundPixels&&(l=Math.round(l),c=Math.round(c)),this.scrollX=p,this.scrollY=g;var m=p+s,x=g+o;this.midPoint.set(m,x);var w=i/a,b=n/a;this.worldView.setTo(m-w/2,x-b/2,w,b),h.loadIdentity(),h.scale(e,e),h.translate(this.x+l,this.y+c),h.rotate(this.rotation),h.scale(a,a),h.translate(-l,-c),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=o(i,0,1),n=o(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var a=this.width/2,h=this.height/2,l=t.x-s,u=t.y-r;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},function(t,e,i){var n=i(416),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.html=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","html","obj","tilemap","xml"],e=0;ee.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=i(24),s=i(0),r=i(419),o=i(418),a=i(4),h=new s({initialize:function(t,e,i){this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,a(i,"frames",[]),a(i,"defaultTextureKey",null)),this.frameRate=a(i,"frameRate",null),this.duration=a(i,"duration",null),null===this.duration&&null===this.frameRate?(this.frameRate=24,this.duration=this.frameRate/this.frames.length*1e3):this.duration&&null===this.frameRate?this.frameRate=this.frames.length/(this.duration/1e3):this.duration=this.frames.length/this.frameRate*1e3,this.msPerFrame=1e3/this.frameRate,this.skipMissedFrames=a(i,"skipMissedFrames",!0),this.delay=a(i,"delay",0),this.repeat=a(i,"repeat",0),this.repeatDelay=a(i,"repeatDelay",0),this.yoyo=a(i,"yoyo",!1),this.showOnStart=a(i,"showOnStart",!1),this.hideOnComplete=a(i,"hideOnComplete",!1),this.paused=!1,this.manager.on("pauseall",this.pause,this),this.manager.on("resumeall",this.resume,this)},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){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 t>=0&&t0){s.isLast=!0,s.nextFrame=l[0],l[0].prevFrame=s;var v=1/(l.length-1);for(r=0;r=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,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);var i=this.frames[e];0!==e||t.forward||(i=this.getLastFrame()),t.updateFrame(i)},getFrameByProgress:function(t){return t=n(t,0,1),r(t,this.frames,"progress")},nextFrame:function(t){var e=t.currentFrame;e.isLast?t._yoyo?this.handleYoyoFrame(t,!1):t.repeatCounter>0?t._reverse&&t.forward?t.forward=!1:this.repeatAnimation(t):this.completeAnimation(t):this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t._reverse===!e&&t.repeatCounter>0)return t.forward=e,void this.repeatAnimation(t);if(t._reverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else this.completeAnimation(t)},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t._yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?t._reverse&&!t.forward?(t.currentFrame=this.getLastFrame(),this.repeatAnimation(t)):(t.forward=!0,this.repeatAnimation(t)):this.completeAnimation(t):this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.updateFrame(e),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){if(2===t._pendingStop)return this.completeAnimation(t);t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t._repeatDelay):(t.repeatCounter--,t.updateFrame(t.currentFrame[t.forward?"nextFrame":"prevFrame"]),t.isPlaying&&(this.getNextTick(t),t.pendingRepeat=!1,t.parent.emit("animationrepeat",this,t.currentFrame,t.repeatCounter,t.parent)))},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(){this.manager.off("pauseall",this.pause,this),this.manager.off("resumeall",this.resume,this),this.manager.remove(this.key);for(var t=0;t-h&&(c-=h,n+=l),f=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){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,i){var n=i(18),s=i(42),r=i(205),o=i(204),a={_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 o(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=r(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},setRandomPosition:function(t,e,i,n){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),this.x=t+Math.random()*i,this.y=e+Math.random()*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},getLocalTransformMatrix:function(t){return void 0===t&&(t=new s),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new s),void 0===e&&(e=new s);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t}};t.exports=a},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){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,i){var n=new(i(0))({initialize:function(t,e){this.geometryMask=e},setShape:function(t){this.geometryMask=t},preRenderWebGL:function(t,e,i){var n=t.gl,s=this.geometryMask;t.flush(),n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.NOTEQUAL,1,1),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),s.renderWebGL(t,s,0,i),t.flush(),n.colorMask(!0,!0,!0,!0),n.stencilFunc(n.EQUAL,1,1),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)},postRenderWebGL:function(t){var e=t.gl;t.flush(),e.disable(e.STENCIL_TEST)},preRenderCanvas:function(t,e,i){var n=this.geometryMask;t.currentContext.save(),n.renderCanvas(t,n,0,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){var i=t.sys.game.renderer;if(this.renderer=i,this.bitmapMask=e,this.maskTexture=null,this.mainTexture=null,this.dirty=!0,this.mainFramebuffer=null,this.maskFramebuffer=null,this.invertAlpha=!1,i&&i.gl){var n=i.width,s=i.height,r=0==(n&n-1)&&0==(s&s-1),o=i.gl,a=r?o.REPEAT:o.CLAMP_TO_EDGE,h=o.LINEAR;this.mainTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.maskTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.mainFramebuffer=i.createFramebuffer(n,s,this.mainTexture,!1),this.maskFramebuffer=i.createFramebuffer(n,s,this.maskTexture,!1),i.onContextRestored(function(t){var e=t.width,i=t.height,n=0==(e&e-1)&&0==(i&i-1),s=t.gl,r=n?s.REPEAT:s.CLAMP_TO_EDGE,o=s.LINEAR;this.mainTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.maskTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.mainFramebuffer=t.createFramebuffer(e,i,this.mainTexture,!1),this.maskFramebuffer=t.createFramebuffer(e,i,this.maskTexture,!1)},this)}},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BitmapMaskPipeline.beginMask(this,e,i)},postRenderWebGL:function(t){t.pipelines.BitmapMaskPipeline.endMask(this)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null;var t=this.renderer;t&&t.gl&&(t.deleteTexture(this.mainTexture),t.deleteTexture(this.maskTexture),t.deleteFramebuffer(this.mainFramebuffer),t.deleteFramebuffer(this.maskFramebuffer)),this.mainTexture=null,this.maskTexture=null,this.mainFramebuffer=null,this.maskFramebuffer=null,this.renderer=null}});t.exports=n},function(t,e,i){var n=i(430),s=i(429),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t){return void 0===t&&this.texture&&(t=this),new n(this.scene,t)},createGeometryMask:function(t){return void 0===t&&"Graphics"===this.type&&(t=this),new s(this.scene,t)}};t.exports=r},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x-e,a=t.y-i;return t.x=o*s-a*r+e,t.y=o*r+a*s+i,t}},function(t,e,i){var n=i(6);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(209),s=i(134);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=s(t)/i);for(var o=0;o=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.once("remove",this.remove,this),this.isPlaying=!1,this.currentAnim=null,this.currentFrame=null,this._timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this._delay=0,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this.forward=!0,this._reverse=!1,this.accumulator=0,this.nextTick=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},setDelay:function(t){return void 0===t&&(t=0),this._delay=t,this.parent},getDelay:function(){return this._delay},delayedPlay:function(t,e,i){return this.play(e,!0,i),this.nextTick+=t,this.parent},getCurrentKey:function(){if(this.currentAnim)return this.currentAnim.key},load:function(t,e){return void 0===e&&(e=0),this.isPlaying&&this.stop(),this.animationManager.load(this,t,e),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.updateFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.updateFrame(t),this.parent},isPaused:{get:function(){return this._paused}},play:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!0,this._reverse=!1,this._startAnimation(t,i))},playReverse:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!1,this._reverse=!0,this._startAnimation(t,i))},_startAnimation:function(t,e){this.load(t,e);var i=this.currentAnim,n=this.parent;return this.repeatCounter=-1===this._repeat?Number.MAX_VALUE:this._repeat,i.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,i.showOnStart&&(n.visible=!0),n.emit("animationstart",this.currentAnim,this.currentFrame,n),n},reverse:function(t){return this.isPlaying&&this.currentAnim.key===t?(this._reverse=!this._reverse,this.forward=!this.forward,this.parent):this.parent},getProgress:function(){var t=this.currentFrame.progress;return this.forward||(t=1-t),t},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},remove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},getRepeat:function(){return this._repeat},setRepeat:function(t){return this._repeat=t,this.repeatCounter=0,this.parent},getRepeatDelay:function(){return this._repeatDelay},setRepeatDelay:function(t){return this._repeatDelay=t,this.parent},restart:function(t){void 0===t&&(t=!1),this.currentAnim.getFirstTick(this,t),this.forward=!0,this.isPlaying=!0,this.pendingRepeat=!1,this._paused=!1,this.updateFrame(this.currentAnim.frames[0]);var e=this.parent;return e.emit("animationrestart",this.currentAnim,this.currentFrame,e),this.parent},stop:function(){this._pendingStop=0,this.isPlaying=!1;var t=this.parent;return t.emit("animationcomplete",this.currentAnim,this.currentFrame,t),t},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopOnRepeat:function(){return this._pendingStop=2,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},setTimeScale:function(t){return void 0===t&&(t=1),this._timeScale=t,this.parent},getTimeScale:function(){return this._timeScale},getTotalFrames:function(){return this.currentAnim.frames.length},update:function(t,e){if(this.currentAnim&&this.isPlaying&&!this.currentAnim.paused){if(this.accumulator+=e*this._timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.currentAnim.completeAnimation(this);this.accumulator>=this.nextTick&&this.currentAnim.setFrame(this)}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),e.setSizeToFrame(),t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin(),e},updateFrame:function(t){var e=this.setCurrentFrame(t);if(this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;e.emit("animationupdate",i,t,e),3===this._pendingStop&&this._pendingStopValue===t&&this.currentAnim.completeAnimation(this)}},setYoyo:function(t){return void 0===t&&(t=!1),this._yoyo=t,this.parent},getYoyo:function(){return this._yoyo},destroy:function(){this.animationManager.off("remove",this.remove,this),this.animationManager=null,this.parent=null,this.currentAnim=null,this.currentFrame=null}});t.exports=n},function(t,e,i){var n=i(24),s={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,s){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=n(t,0,1),this._alphaTR=n(e,0,1),this._alphaBL=n(i,0,1),this._alphaBR=n(s,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=n(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=n(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=n(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=n(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=n(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=s},function(t,e){t.exports=function(t){return Math.PI*t.radius*2}},function(t,e,i){var n=i(439),s=i(211),r=i(103),o=i(18);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h>>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;e0;i--){var n=Math.floor(this.frac()*(e+1)),s=t[n];t[n]=t[i],t[i]=s}return t}});t.exports=n},function(t,e,i){var n=i(211),s=i(103),r=i(18),o=i(6);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(48),s=i(46),r=i(47),o=i(45);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(50),s=i(46),r=i(49),o=i(45);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(85),s=i(46),r=i(84),o=i(45);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(82),s=i(48),r=i(83),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(82),s=i(50),r=i(83),o=i(49);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(84),s=i(83);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(448),s=i(85),r=i(82);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(52),s=i(48),r=i(51),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(52),s=i(50),r=i(51),o=i(49);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(52),s=i(85),r=i(51),o=i(84);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(212),s=[];s[n.BOTTOM_CENTER]=i(452),s[n.BOTTOM_LEFT]=i(451),s[n.BOTTOM_RIGHT]=i(450),s[n.CENTER]=i(449),s[n.LEFT_CENTER]=i(447),s[n.RIGHT_CENTER]=i(446),s[n.TOP_CENTER]=i(445),s[n.TOP_LEFT]=i(444),s[n.TOP_RIGHT]=i(443);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e,i){t.exports={Angle:i(1122),Call:i(1121),GetFirst:i(1120),GetLast:i(1119),GridAlign:i(1118),IncAlpha:i(1107),IncX:i(1106),IncXY:i(1105),IncY:i(1104),PlaceOnCircle:i(1103),PlaceOnEllipse:i(1102),PlaceOnLine:i(1101),PlaceOnRectangle:i(1100),PlaceOnTriangle:i(1099),PlayAnimation:i(1098),PropertyValueInc:i(37),PropertyValueSet:i(27),RandomCircle:i(1097),RandomEllipse:i(1096),RandomLine:i(1095),RandomRectangle:i(1094),RandomTriangle:i(1093),Rotate:i(1092),RotateAround:i(1091),RotateAroundDistance:i(1090),ScaleX:i(1089),ScaleXY:i(1088),ScaleY:i(1087),SetAlpha:i(1086),SetBlendMode:i(1085),SetDepth:i(1084),SetHitArea:i(1083),SetOrigin:i(1082),SetRotation:i(1081),SetScale:i(1080),SetScaleX:i(1079),SetScaleY:i(1078),SetTint:i(1077),SetVisible:i(1076),SetX:i(1075),SetXY:i(1074),SetY:i(1073),ShiftPosition:i(1072),Shuffle:i(1071),SmootherStep:i(1070),SmoothStep:i(1069),Spread:i(1068),ToggleVisible:i(1067),WrapInRectangle:i(1066)}},function(t,e){t.exports=function(t){return t.split("").reverse().join("")}},function(t,e){t.exports=function(t,e){return t.replace(/%([0-9]+)/g,function(t,i){return e[Number(i)-1]})}},function(t,e,i){t.exports={Format:i(456),Pad:i(197),Reverse:i(455),UppercaseFirst:i(356),UUID:i(323)}},function(t,e,i){var n=i(69);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){t.exports=function(t,e){for(var i=0;i-1&&(e.state=a.REMOVED,s.splice(r,1)):(e.state=a.REMOVED,n.splice(r,1))}for(i.length=0,i=this._add,t=0;t-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&&(t.currentPipeline&&t.currentPipeline.vertexCount>0&&t.flush(),r.vertexBuffer=e.vertexBuffer[a],t.setPipeline(r),t.setTexture2D(s[a].glTexture,0),t.gl.drawArrays(r.topology,0,e.vertexCount[a]));r.vertexBuffer=o,r.viewIdentity(),r.modelIdentity()}},function(t,e,i){var n=i(2),s=i(2);n=i(472),s=i(471),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){t.exports=function(t,e,i,n,s){e.cull(n);var r=e.culledTiles,o=r.length;if(0!==o){var a=t._tempMatrix1,h=t._tempMatrix2,l=t._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(n.matrix);var u=t.currentContext,c=e.gidMap;u.save(),s?(a.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l),l.copyToContext(u)):(h.e-=n.scrollX*e.scrollFactorX,h.f-=n.scrollY*e.scrollFactorY,h.copyToContext(u));for(var d=n.alpha*e.alpha,f=0;f-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(21);t.exports=function(t){for(var e,i,s,r,o,a=0;a1){if(Array.isArray(l.tiles)){for(var c={},d={},f=0;f>>0;return n}},function(t,e,i){var n=i(485),s=i(1),r=i(87),o=i(227),a=i(61);t.exports=function(t,e){for(var i=[],h=0;h0){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,i){t.exports={Parse:i(230),Parse2DArray:i(142),ParseCSV:i(229),Impact:i(223),Tiled:i(228)}},function(t,e,i){var n=i(54),s=i(53),r=i(3);t.exports=function(t,e,i,o,a,h){return void 0===o&&(o=new r(0,0)),o.x=n(t,i,a,h),o.y=s(e,i,a,h),o}},function(t,e,i){var n=i(19);t.exports=function(t,e,i,s,r,o){if(void 0!==r){var a,h=n(t,e,i,s,null,o),l=0;for(a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e,i){var n=i(62),s=i(38),r=i(77);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;ae)){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(62),s=i(38),r=i(143);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;a=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;r=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);else if(2===r)for(a=x;a>=m;a--)for(o=v;o=m;a--)for(o=y;o>=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);return u.tilesDrawn=i.length,u.tilesTotal=d*f,i}},function(t,e,i){var n=i(109),s=i(108),r=i(19),o=i(233);t.exports=function(t,e,i,a,h,l){void 0===i&&(i={}),Array.isArray(t)||(t=[t]);var u=l.tilemapLayer;void 0===a&&(a=u.scene),void 0===h&&(h=a.cameras.main);var c,d=r(0,0,l.width,l.height,null,l),f=[];for(c=0;c=0&&p=0&&g=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off("update",this.step,this),t.events.emit("transitioncomplete",this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(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)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off("shutdown",this.shutdown,this),t.off("postupdate",this.step,this),t.off("transitionout")},destroy:function(){this.shutdown(),this.scene.sys.events.off("start",this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});o.register("ScenePlugin",a,"scenePlugin"),t.exports=a},function(t,e,i){var n=i(126),s=i(21),r={SceneManager:i(358),ScenePlugin:i(522),Settings:i(355),Systems:i(182)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={BitmapMaskPipeline:i(369),ForwardDiffuseLightPipeline:i(368),TextureTintPipeline:i(183)}},function(t,e,i){t.exports={Utils:i(9),WebGLPipeline:i(184),WebGLRenderer:i(371),Pipelines:i(524),BYTE:0,SHORT:1,UNSIGNED_BYTE:2,UNSIGNED_SHORT:3,FLOAT:4}},function(t,e,i){t.exports={Canvas:i(373),WebGL:i(370)}},function(t,e,i){t.exports={CanvasRenderer:i(374),GetBlendModes:i(372),SetTransform:i(23)}},function(t,e,i){t.exports={Canvas:i(527),Snapshot:i(526),WebGL:i(525)}},function(t,e,i){var n=i(234),s=new(i(0))({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once("boot",this.boot,this)},boot:function(){}});t.exports=s},function(t,e,i){t.exports={BasePlugin:i(234),DefaultPlugins:i(185),PluginCache:i(15),PluginManager:i(360),ScenePlugin:i(529)}},function(t,e,i){var n=i(148),s={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.13.1",silent:!0,install:function(t){t.after("Engine.update",function(){s.Engine.update(this)})},Engine:{update:function(t){for(var e=t.world,i=n.Composite.allBodies(e),r=n.Composite.allComposites(e),o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y0)for(var a=s+1;a1;if(!d||t!=d.x||e!=d.y){d&&n?(f=d.x,p=d.y):(f=0,p=0);var s={x:f+t,y:p+e};!n&&d||(d=s),g.push(s),y=f+t,m=p+e}},w=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":y=t.x,m=t.y;break;case"H":y=t.x;break;case"V":m=t.y}x(y,m,t.pathSegType)}};for(n._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i1?1:0;n0))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){t.exports=function(t,e,i,n){var s=e.pos.x+e.size.x-i.pos.x;if(n){var r=e===n?i:e;n.vel.x=-n.vel.x*n.bounciness+r.vel.x;var o=t.collisionMap.trace(n.pos.x,n.pos.y,n===e?-s:s,0,n.size.x,n.size.y);n.pos.x=o.pos.x}else{var a=(e.vel.x-i.vel.x)/2;e.vel.x=-a,i.vel.x=a;var h=t.collisionMap.trace(e.pos.x,e.pos.y,-s/2,0,e.size.x,e.size.y);e.pos.x=Math.floor(h.pos.x);var l=t.collisionMap.trace(i.pos.x,i.pos.y,s/2,0,i.size.x,i.size.y);i.pos.x=Math.ceil(l.pos.x)}}},function(t,e,i){var n=i(91),s=i(554),r=i(553);t.exports=function(t,e,i){var o=null;e.collides===n.LITE||i.collides===n.FIXED?o=e:i.collides!==n.LITE&&e.collides!==n.FIXED||(o=i),e.last.x+e.size.x>i.last.x&&e.last.xi.last.y&&e.last.y0&&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&&o0?e-o:e+o<0?e+o:0}return n(e,-r,r)}},function(t,e,i){t.exports={Body:i(252),COLLIDES:i(91),CollisionMap:i(251),Factory:i(250),Image:i(248),ImpactBody:i(249),ImpactPhysics:i(556),Sprite:i(247),TYPE:i(90),World:i(246)}},function(t,e,i){var n=i(257);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){var n=i(258);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){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,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(575);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.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,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(577);t.exports=function(t,e,i,s,r){var o=0;return t.deltaX()<0&&!t.blocked.left&&e.collideRight&&t.checkCollision.left?e.faceRight&&t.x0&&!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,i){var n=i(578),s=i(576),r=i(254);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;a--){var h=e[a],l=o(s,r,h.x,h.y);l=0;a--){var h=e[a],l=o(s,r,h.x,h.y);l>i&&(n=h,i=l)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var o=Math.atan2(i-t.y,e-t.x);return s>0&&(n=r(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(o,n),o},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),void 0===i&&(i=new c),i.setToPolar(s(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new c),i.setToPolar(t,e)},shutdown:function(){if(this.world){var t=this.systems.events;t.off("update",this.world.update,this.world),t.off("postupdate",this.world.postUpdate,this.world),t.off("shutdown",this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off("start",this.start,this),this.scene=null,this.systems=null}});u.register("ArcadePhysics",f,"arcadePhysics"),t.exports=f},function(t,e,i){var n=i(39),s=i(21),r={ArcadePhysics:i(593),Body:i(260),Collider:i(259),Factory:i(266),Group:i(263),Image:i(265),Sprite:i(114),StaticBody:i(253),StaticGroup:i(262),World:i(261)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Arcade:i(594),Impact:i(572),Matter:i(552)}},function(t,e,i){var n=i(154),s=i(268),r=i(267),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=new(i(0))({initialize:function(t,e,i,n){this.x=0,this.y=0,this.z=0,this.w=0,"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)},clone:function(){return new n(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this.w=t.w||0,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},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||0,this.w+=t.w||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this.w-=t.w||0,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},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){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},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;o1?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,i){return Math.max(t-e,i)}},function(t,e){t.exports=function(t,e,i){return Math.min(t+e,i)}},function(t,e){t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t,e){return t/e/1e3}},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.floor(t*n)/n}},function(t,e){t.exports=function(t,e){return Math.abs(t-e)}},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.ceil(t*n)/n}},function(t,e){t.exports=function(t){for(var e=0,i=0;i0&&0==(t&t-1)}},function(t,e,i){t.exports={GetNext:i(322),IsSize:i(127),IsValue:i(616)}},function(t,e,i){var n=i(200);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){var n=i(129);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,i){var n=i(189);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return t[0]===t[i]?(e<0&&(r=Math.floor(s=i*(1+e))),n(s-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(n(-s,t[0],t[0],t[1],t[1])-t[0]):e>1?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[i=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit("start",this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on("update",this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit("progress",this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=s.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0&&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,i){var n=i(0),s=i(11),r=i(4),o=i(116),a=i(284),h=i(159),l=i(283),u=i(669),c=i(668),d=i(667),f=i(158),p=new n({Extends:s,initialize:function(t){s.call(this),this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.enabled=!0,this.target,this.keys=[],this.combos=[],this.queue=[],this.onKeyHandler,this.time=0,t.pluginEvents.once("boot",this.boot,this),t.pluginEvents.on("start",this.start,this)},boot:function(){var t=this.settings.input,e=this.scene.sys.game.config;this.enabled=r(t,"keyboard",e.inputKeyboard),this.target=r(t,"keyboard.target",e.inputKeyboardEventTarget),this.sceneInputPlugin.pluginEvents.once("destroy",this.destroy,this)},start:function(){this.enabled&&this.startListeners(),this.sceneInputPlugin.pluginEvents.once("shutdown",this.shutdown,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},startListeners:function(){var t=this,e=function(e){if(!e.defaultPrevented&&t.isActive()){t.queue.push(e);var i=t.keys[e.keyCode];i&&i.preventDefault&&e.preventDefault()}};this.onKeyHandler=e,this.target.addEventListener("keydown",e,!1),this.target.addEventListener("keyup",e,!1),this.sceneInputPlugin.pluginEvents.on("update",this.update,this)},stopListeners:function(){this.target.removeEventListener("keydown",this.onKeyHandler),this.target.removeEventListener("keyup",this.onKeyHandler),this.sceneInputPlugin.pluginEvents.off("update",this.update)},createCursorKeys:function(){return this.addKeys({up:h.UP,down:h.DOWN,left:h.LEFT,right:h.RIGHT,space:h.SPACE,shift:h.SHIFT})},addKeys:function(t){var e={};if("string"==typeof t){t=t.split(",");for(var i=0;i-1?e[i]=t:e[t.keyCode]=t,t}return"string"==typeof t&&(t=h[t.toUpperCase()]),e[t]||(e[t]=new a(t)),e[t]},removeKey:function(t){var e=this.keys;if(t instanceof a){var i=e.indexOf(t);i>-1&&(this.keys[i]=void 0)}else"string"==typeof t&&(t=h[t.toUpperCase()]);e[t]&&(e[t]=void 0)},createCombo:function(t,e){return new l(this,t,e)},checkDown:function(t,e){if(this.enabled&&t.isDown){var i=f(this.time-t.timeDown,e);if(i>t._tick)return t._tick=i,!0}return!1},update:function(t){this.time=t;var e=this.queue.length;if(this.enabled&&0!==e)for(var i=this.queue.splice(0,e),n=this.keys,s=0;s=e}}},function(t,e,i){var n=i(81),s=i(44),r=i(0),o=i(288),a=i(675),h=i(58),l=i(99),u=i(98),c=i(11),d=i(1),f=i(116),p=i(8),g=i(15),v=i(10),y=i(43),m=i(66),x=i(76),w=new r({Extends:c,initialize:function(t){c.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new c,this.enabled=!0,this.displayList,this.cameras,f.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once("destroy",this.destroy,this),this.pluginEvents.emit("boot")},start:function(){var t=this.systems.events;t.on("transitionstart",this.transitionIn,this),t.on("transitionout",this.transitionOut,this),t.on("transitioncomplete",this.transitionComplete,this),t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.once("shutdown",this.shutdown,this),this.enabled=!0,this.pluginEvents.emit("start")},preUpdate:function(){this.pluginEvents.emit("preUpdate");var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,n=e.length;if(0!==i||0!==n){for(var s=this._list,r=0;r-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._pendingRemoval.length=0,this._list=s.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},update:function(t,e){if(this.isActive()){this.pluginEvents.emit("update",t,e);var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(n=!0,this._pollTimer=this.pollRate)),n)for(var s=this.manager.pointers,r=0;r0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}}},clear:function(t){var e=t.input;if(e){this.queueForRemoval(t),e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,this.manager.resetCursor(e),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&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,s}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,s=this._eventContainer;n.cancelled=!1;for(var r=!1,o=0;o0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var a=[];for(i=0;i1&&(this.sortGameObjects(a),this.topOnly&&a.splice(1)),this._drag[t.id]=a,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&h(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)}return s.length}if(5===t.dragState){for(s=this._drag[t.id],i=0;i0){for(this.sortGameObjects(s),e=0;e0){for(this.sortGameObjects(r),e=0;e-1&&this._draggable.splice(s,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return a(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,s=!1,r=!1,a=!1;if(p(e)){var h=e;e=d(h,"hitArea",null),i=d(h,"hitAreaCallback",null),n=d(h,"draggable",!1),s=d(h,"dropZone",!1),r=d(h,"cursor",!1),a=d(h,"useHandCursor",!1);var l=d(h,"pixelPerfect",!1),u=d(h,"alphaTolerance",1);l&&(e={},i=this.makePixelPerfect(u)),e&&i||this.setHitAreaFromTexture(t)}else"function"!=typeof e||i||(i=e,e={});for(var c=0;c0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)e.x&&t.ye.y}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},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,i){var n=Math.min(t.x,e),s=Math.max(t.right,e);t.x=n,t.width=s-n;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},function(t,e){t.exports=function(t,e){var i=Math.min(t.x,e.x),n=Math.max(t.right,e.right);t.x=i,t.width=n-i;var s=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=s,t.height=r-s,t}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;on(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,i){var n=i(161);t.exports=function(t,e){var i=n(t);return ii&&(i=h.x),h.xr&&(r=h.y),h.ye.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(76),s=i(117);t.exports=function(t,e){return!!(n(t,e.getPointA())||n(t,e.getPointB())||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},function(t,e,i){var n=i(300),s=i(76);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottomt.right+r||it.bottom+r||st.right||e.rightt.bottom||e.bottom0}},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){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(10),s=i(164);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=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(58);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){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(10);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){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(98);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,i){var n=i(98);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(99);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(99);n.Area=i(779),n.Circumference=i(334),n.CircumferencePoint=i(172),n.Clone=i(778),n.Contains=i(98),n.ContainsPoint=i(777),n.ContainsRect=i(776),n.CopyFrom=i(775),n.Equals=i(774),n.GetBounds=i(773),n.GetPoint=i(336),n.GetPoints=i(335),n.Offset=i(772),n.OffsetPoint=i(771),n.Random=i(203),t.exports=n},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(10);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){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e,i){var n=i(44);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,i){var n=i(44);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(81);t.exports=function(t){return new n(t.x,t.y,t.radius)}},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(81);n.Area=i(789),n.Circumference=i(439),n.CircumferencePoint=i(211),n.Clone=i(788),n.Contains=i(44),n.ContainsPoint=i(787),n.ContainsRect=i(786),n.CopyFrom=i(785),n.Equals=i(784),n.GetBounds=i(783),n.GetPoint=i(442),n.GetPoints=i(440),n.Offset=i(782),n.OffsetPoint=i(781),n.Random=i(210),t.exports=n},function(t,e,i){var n=i(0),s=i(303),r=i(15),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(32),s=i(14),r=i(13),o=i(165);s.register("quad",function(t,e){void 0===t&&(t={});var i=r(t,"x",0),s=r(t,"y",0),a=r(t,"key",null),h=r(t,"frame",null),l=new o(this.scene,i,s,a,h);return void 0!==e&&(t.add=e),n(this.scene,l,t),l})},function(t,e,i){var n=i(32),s=i(14),r=i(13),o=i(4),a=i(118);s.register("mesh",function(t,e){void 0===t&&(t={});var i=r(t,"key",null),s=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"colors",[]),u=o(t,"alphas",[]),c=o(t,"uv",[]),d=new a(this.scene,0,0,h,c,l,u,i,s);return void 0!==e&&(t.add=e),n(this.scene,d,t),d})},function(t,e,i){var n=i(165);i(5).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(118);i(5).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){t.exports=function(){}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=this.pipeline;t.setPipeline(o,e);var a=o._tempMatrix1,h=o._tempMatrix2,l=o._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(s.matrix),r?(a.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l)):(h.e-=s.scrollX*e.scrollFactorX,h.f-=s.scrollY*e.scrollFactorY,a.multiply(h,l));var u=e.frame.glTexture,c=e.vertices,d=e.uv,f=e.colors,p=e.alphas,g=c.length,v=Math.floor(.5*g);o.vertexCount+v>=o.vertexCapacity&&o.flush(),o.setTexture2D(u,0);for(var y=o.vertexViewF32,m=o.vertexViewU32,x=o.vertexCount*o.vertexComponentCount-1,w=0,b=e.tintFill,T=0;T0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.fillColor,e.fillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,M=0;M0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.altFillColor,e.altFillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,M=0;M0){var F=o.strokeTint,L=n.getTintAppendFloatAlphaAndSwap(e.outlineFillColor,e.outlineFillAlpha*d);for(F.TL=L,F.TR=L,F.BL=L,F.BR=L,C=1;Cr;h--){for(l=0;l0&&r.maxLines1&&(d+=f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(4);t.exports=function(t,e){var i=e.width,s=e.height,r=Math.floor(i/2),o=Math.floor(s/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),l=n(e,"offset.x",0),u=n(e,"offset.y",0),c=n(e,"spacing.x",0),d=n(e,"spacing.y",0),f=n(e,"lineSpacing",0),p=n(e,"charsPerRow",null);null===p&&(p=t.sys.textures.getFrame(h).width/i)>a.length&&(p=a.length);for(var g=l,v=u,y={retroFont:!0,font:h,size:i,lineHeight:s+f,chars:{}},m=0,x=0;x?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(880),s=i(21),r={Parse:i(879)};r=s(!1,r,n),t.exports=r},function(t,e){t.exports=function(t,e,i,n,s){t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a,h,e.scaleX,e.scaleY,e.rotation,e.flipX,!e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r),t.setBlankTexture(!0)}},function(t,e,i){var n=i(2),s=i(2);n=i(883),s=i(882),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){t.exports={DeathZone:i(329),EdgeZone:i(328),RandomZone:i(325)}},function(t,e){t.exports=function(t,e,i,n,s){var r=e.emitters.list,o=r.length;if(0!==o){var a=t._tempMatrix1.copyFrom(n.matrix),h=t._tempMatrix2,l=t._tempMatrix3,u=t._tempMatrix4.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);a.multiply(u);var c=n.roundPixels,d=t.currentContext;d.save();for(var f=0;f0&&(X=X%T-T):X>T?X=T:X<0&&(X=T+X%T),null===C&&(C=new o(D+Math.cos(Y)*B,I+Math.sin(Y)*B,v),S.push(C),O+=.01);O<1+N;)b=X*O+Y,x=D+Math.cos(b)*B,w=I+Math.sin(b)*B,C.points.push(new r(x,w,v)),O+=.01;b=X+Y,x=D+Math.cos(b)*B,w=I+Math.sin(b)*B,C.points.push(new r(x,w,v));break;case n.FILL_RECT:u.setTexture2D(P),u.batchFillRect(p[++E],p[++E],p[++E],p[++E],f,c);break;case n.FILL_TRIANGLE:u.setTexture2D(P),u.batchFillTriangle(p[++E],p[++E],p[++E],p[++E],p[++E],p[++E],f,c);break;case n.STROKE_TRIANGLE:u.setTexture2D(P),u.batchStrokeTriangle(p[++E],p[++E],p[++E],p[++E],p[++E],p[++E],v,f,c);break;case n.LINE_TO:null!==C?C.points.push(new r(p[++E],p[++E],v)):(C=new o(p[++E],p[++E],v),S.push(C));break;case n.MOVE_TO:C=new o(p[++E],p[++E],v),S.push(C);break;case n.SAVE:a.push(f.copyToArray());break;case n.RESTORE:f.copyFromArray(a.pop());break;case n.TRANSLATE:D=p[++E],I=p[++E],f.translate(D,I);break;case n.SCALE:D=p[++E],I=p[++E],f.scale(D,I);break;case n.ROTATE:f.rotate(p[++E]);break;case n.SET_TEXTURE:var U=p[++E],V=p[++E];u.currentFrame=U,u.setTexture2D(U.glTexture,0),u.tintEffect=V,P=U.glTexture;break;case n.CLEAR_TEXTURE:u.currentFrame=t.blankTexture,u.tintEffect=2,P=t.blankTexture.glTexture}}}},function(t,e,i){var n=i(2),s=i(2);n=i(897),s=i(333),s=i(333),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(23);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length,h=t.currentContext;if(0!==a&&n(t,h,e,s,r)){var l=e.frame,u=e.displayCallback,c=s.scrollX*e.scrollFactorX,d=s.scrollY*e.scrollFactorY,f=e.fontData.chars,p=e.fontData.lineHeight,g=0,v=0,y=0,m=0,x=null,w=0,b=0,T=0,S=0,A=0,_=0,C=null,M=0,P=e.frame.source.image,E=l.cutX,k=l.cutY,F=0,L=e.fontSize/e.fontData.size;e.cropWidth>0&&e.cropHeight>0&&(h.save(),h.beginPath(),h.rect(0,0,e.cropWidth,e.cropHeight),h.clip());for(var R=0;R0&&e.cropHeight>0&&h.restore(),h.restore()}}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length;if(0!==a){var h=this.pipeline;t.setPipeline(h,e);var l=e.cropWidth>0||e.cropHeight>0;l&&(h.flush(),t.pushScissor(e.x,e.y,e.cropWidth*e.scaleX,e.cropHeight*e.scaleY));var u=h._tempMatrix1,c=h._tempMatrix2,d=h._tempMatrix3,f=h._tempMatrix4;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(s.matrix),r?(u.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d)):(c.e-=s.scrollX*e.scrollFactorX,c.f-=s.scrollY*e.scrollFactorY,u.multiply(c,d));var p=e.frame,g=p.glTexture,v=p.cutX,y=p.cutY,m=g.width,x=g.height,w=e._isTinted&&e.tintFill,b=n.getTintAppendFloatAlpha(e._tintTL,s.alpha*e._alphaTL),T=n.getTintAppendFloatAlpha(e._tintTR,s.alpha*e._alphaTR),S=n.getTintAppendFloatAlpha(e._tintBL,s.alpha*e._alphaBL),A=n.getTintAppendFloatAlpha(e._tintBR,s.alpha*e._alphaBR);h.setTexture2D(g,0);var _,C,M=0,P=0,E=0,k=0,F=e.letterSpacing,L=0,R=0,O=0,D=0,I=e.scrollX,B=e.scrollY,Y=e.fontData,X=Y.chars,z=Y.lineHeight,N=e.fontSize/Y.size,U=0,V=e._align,G=0,W=0;e.getTextBounds(!1);var H=e._bounds.lines;1===V?W=(H.longest-H.lengths[0])/2:2===V&&(W=H.longest-H.lengths[0]);for(var j=s.roundPixels,q=e.displayCallback,K=e.callbackData,J=0;Jv&&(r=v),o>y&&(o=y);var k=v+g.xAdvance,F=y+u;a_&&(_=M),M_&&(_=M),M-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;i0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e),s=t.indexOf(i);return-1!==n&&-1===s&&(t[n]=i,!0)}},function(t,e,i){var n=i(100);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return n(t,s)}},function(t,e,i){var n=i(68);t.exports=function(t,e,i,s,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(s)for(var h=0;ht.length-1)throw new Error("Index out of bounds");var r=n(t,e);return i&&i.call(s,r),r}},function(t,e,i){var n=i(342);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var s=[],r=Math.max(n((e-t)/(i||1)),0),o=0;o=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var n=t[i-1],s=t.indexOf(n);t[i]=n,t[s]=e}return t}},function(t,e,i){var n=i(68);t.exports=function(t,e,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=t.length),n(t,s,r))for(var o=s;o0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),s&&s.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),s&&s.call(r,l)}return e}},function(t,e){t.exports=function(t,e,i,n,s){if(void 0===s&&(s=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(s,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.pop(),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;a0||!this.inFocus)&&(this._coolDown--,r=Math.min(r,this._target)),r>this._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var o=0,a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),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){var i=0,n=function(t,e,n,s){var r=i-s.y-s.height;t.add(n,e,s.x,r,s.width,s.height)};t.exports=function(t,e,s){var r=t.source[e];t.add("__BASE",e,0,0,r.width,r.height),i=r.height;for(var o=s.split("\n"),a=/^[ ]*(- )*(\w+)+[: ]+(.*)/,h="",l="",u={x:0,y:0,width:0,height:0},c=0;cx||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var C=l,M=l,P=0,E=e.sourceIndex,k=0;kg||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,l-x),(v+=h+p)+h>r&&(v=f,y+=l+p)}return t}},function(t,e,i){var n=i(69);t.exports=function(t,e,i){if(i.frames){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);var r,o=i.frames;for(var a in o){var h=o[a];r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h),h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted()),r.customData=n(h)}for(var l in i)"frames"!==l&&(Array.isArray(i[l])?t.customData[l]=i[l].slice(0):t.customData[l]=i[l]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},function(t,e,i){var n=i(69);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;a=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,i){var n=i(101),s=i(128),r={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=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(0),s=i(28),r=i(376),o=i(1),a=i(4),h=i(8),l=i(18),u=i(2),c=i(185),d=i(196),f=new n({initialize:function(t){void 0===t&&(t={});this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.resolution=a(t,"resolution",1),this.parent=a(t,"parent",null),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!1),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.resolution=a(e,"resolution",this.resolution),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"mode",this.expandParent),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",s.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),l.RND.init(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMouseCapture=a(t,"input.mouse.capture",!0),this.inputTouch=a(t,"input.touch",r.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio"),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.autoResize=a(i,"autoResize",!0),this.antialias=a(i,"antialias",!0),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",!1),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.preserveDrawingBuffer=a(i,"preserveDrawingBuffer",!1),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",2e3),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",u),this.postBoot=a(t,"callbacks.postBoot",u),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path",""),this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),p=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?p=f.default:Array.isArray(f.defaultMerge)&&(p=p.concat(f.defaultMerge)))),this.defaultPlugins=p;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=s.WEBGL:window.FORCE_CANVAS&&(this.renderType=s.CANVAS))}});t.exports=f},function(t,e,i){var n=i(187),s=i(417),r=i(415),o=i(26),a=i(0),h=i(975),l=i(970),u=i(102),c=i(963),d=i(376),f=i(380),p=i(11),g=i(367),v=i(15),y=i(360),m=i(358),x=i(354),w=i(347),b=i(950),T=i(949),S=i(344),A=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new p,this.anims=new s(this),this.textures=new w(this),this.cache=new r(this),this.registry=new u(this),this.input=new g(this,this.config),this.scene=new m(this,this.config.sceneConfig),this.device=d,this.sound=x.create(this),this.loop=new b(this,this.config.fps),this.plugins=new y(this,this.config),this.facebook=new S(this),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isOver=!0,f(this.boot.bind(this))},boot:function(){v.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),l(this),c(this),n(this.canvas,this.config.parent),this.events.emit("boot"),this.events.once("texturesready",this.texturesReady,this)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit("ready"),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),T(this);var t=this.events;t.on("hidden",this.onHidden,this),t.on("visible",this.onVisible,this),t.on("blur",this.onBlur,this),t.on("focus",this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit("prestep",t,e),i.emit("step",t,e),this.scene.update(t,e),i.emit("poststep",t,e);var n=this.renderer;n.preRender(),i.emit("prerender",n,t,e),this.scene.render(n),n.postRender(),i.emit("postrender",n,t,e)},headlessStep:function(t,e){var i=this.events;i.emit("prestep",t,e),i.emit("step",t,e),this.scene.update(t,e),i.emit("poststep",t,e),i.emit("prerender"),i.emit("postrender")},onHidden:function(){this.loop.pause(),this.events.emit("pause")},onVisible:function(){this.loop.resume(),this.events.emit("resume")},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},resize:function(t,e){this.config.width=t,this.config.height=e,this.renderer.resize(t,e),this.input.resize(),this.scene.resize(t,e),this.events.emit("resize",t,e)},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.events.emit("destroy"),this.events.removeAllListeners(),this.scene.destroy(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=A},function(t,e,i){var n=i(0),s=i(11),r=i(15),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){t.exports={EventEmitter:i(977)}},function(t,e){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,l=[],u=!1,c=-1;function d(){u&&h&&(u=!1,h.length?l=h.concat(l):c=-1,l.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=l.length;e;){for(h=l,l=[];++c1)for(var i=1;i>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e){t.exports=function(t,e){void 0===e&&(e="none");return["-webkit-","-khtml-","-moz-","-ms-",""].forEach(function(i){t.style[i+"user-select"]=e}),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},function(t,e,i){t.exports={CanvasInterpolation:i(384),CanvasPool:i(26),Smoothing:i(130),TouchAction:i(989),UserSelect:i(988)}},function(t,e){t.exports=function(t){return t.height*t.originY}},function(t,e){t.exports=function(t){return t.width*t.originX}},function(t,e,i){t.exports={CenterOn:i(448),GetBottom:i(52),GetCenterX:i(85),GetCenterY:i(82),GetLeft:i(50),GetOffsetX:i(992),GetOffsetY:i(991),GetRight:i(48),GetTop:i(46),SetBottom:i(51),SetCenterX:i(84),SetCenterY:i(83),SetLeft:i(49),SetRight:i(47),SetTop:i(45)}},function(t,e,i){var n=i(48),s=i(46),r=i(51),o=i(47);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(50),s=i(46),r=i(51),o=i(49);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)-a),t}},function(t,e,i){var n=i(85),s=i(46),r=i(51),o=i(84);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(48),s=i(46),r=i(49),o=i(45);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(82),s=i(48),r=i(83),o=i(49);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(52),s=i(48),r=i(51),o=i(49);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(50),s=i(46),r=i(47),o=i(45);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(82),s=i(50),r=i(83),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(52),s=i(50),r=i(51),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(52),s=i(48),r=i(47),o=i(45);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){var n=i(52),s=i(50),r=i(49),o=i(45);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)+a),t}},function(t,e,i){var n=i(52),s=i(85),r=i(84),o=i(45);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){t.exports={BottomCenter:i(1005),BottomLeft:i(1004),BottomRight:i(1003),LeftBottom:i(1002),LeftCenter:i(1001),LeftTop:i(1e3),RightBottom:i(999),RightCenter:i(998),RightTop:i(997),TopCenter:i(996),TopLeft:i(995),TopRight:i(994)}},function(t,e,i){t.exports={BottomCenter:i(452),BottomLeft:i(451),BottomRight:i(450),Center:i(449),LeftCenter:i(447),QuickSet:i(453),RightCenter:i(446),TopCenter:i(445),TopLeft:i(444),TopRight:i(443)}},function(t,e,i){var n=i(212),s=i(21),r={In:i(1007),To:i(1006)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Align:i(1008),Bounds:i(993),Canvas:i(990),Color:i(383),Masks:i(981)}},function(t,e,i){var n=i(0),s=i(102),r=i(15),o=new n({Extends:s,initialize:function(t){s.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.events=this.systems.events,this.events.once("destroy",this.destroy,this)},start:function(){this.events.once("shutdown",this.shutdown,this)},shutdown:function(){this.systems.events.off("shutdown",this.shutdown,this)},destroy:function(){s.prototype.destroy.call(this),this.events.off("start",this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",o,"data"),t.exports=o},function(t,e,i){t.exports={DataManager:i(102),DataManagerPlugin:i(1010)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e){this.active=!1,this.p0=new s(t,e)},getPoint:function(t,e){return void 0===e&&(e=new s),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},function(t,e,i){var n=i(0),s=i(391),r=i(389),o=i(5),a=i(388),h=i(1012),l=i(387),u=i(10),c=i(385),d=i(3),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,n),h=new d(r,o),l=new d(t,e)),this.add(new s(u,a,h,l))},quadraticBezierTo:function(t,e,i,n){var s,r,o=this.getEndPoint();return t instanceof d?(s=t,r=e):(s=new d(i,n),r=new d(t,e)),this.add(new l(o,s,r))},draw:function(t,e){for(var i=0;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;e0&&(h.preRender(r,o),t.render(n,e,i,h))}},resetAll:function(){for(var t=0;t=1?1:1/e*(1+(e*t|0))}},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){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:1-Math.cos(t*Math.PI/2)}},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--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return t*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 1- --t*t*t*t}},function(t,e){t.exports=function(t){return t*t*t*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*(2-t)}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return 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 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},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,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),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},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){return--t*t*t+1}},function(t,e){t.exports=function(t){return t*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 Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},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 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){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,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,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e,i){var n=i(24),s=i(0),r=i(3),o=i(192),a=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new r,this.current=new r,this.destination=new r,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,a){void 0===i&&(i=1e3),void 0===n&&(n=o.Linear),void 0===s&&(s=!1),void 0===r&&(r=null),void 0===a&&(a=this.camera.scene);var h=this.camera;return!s&&this.isRunning?h:(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(h.scrollX,h.scrollY),this.destination.set(t,e),h.getScroll(t,e,this.current),"string"==typeof n&&o.hasOwnProperty(n)?this.ease=o[n]:"function"==typeof n&&(this.ease=n),this._elapsed=0,this._onUpdate=r,this._onUpdateScope=a,this.camera.emit("camerapanstart",this.camera,this,i,t,e),h)},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var s=this.camera;if(this._elapsed0?(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){var n=i(0),s=i(4),r=new n({initialize:function(t){this.camera=s(t,"camera",null),this.left=s(t,"left",null),this.right=s(t,"right",null),this.up=s(t,"up",null),this.down=s(t,"down",null),this.zoomIn=s(t,"zoomIn",null),this.zoomOut=s(t,"zoomOut",null),this.zoomSpeed=s(t,"zoomSpeed",.01),this.speedX=0,this.speedY=0;var e=s(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=s(t,"speed.x",0),this.speedY=s(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoom<.1&&(e.zoom=.1)):this.zoomOut&&this.zoomOut.isDown&&(e.zoom+=this.zoomSpeed)}},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={FixedKeyControl:i(1061),SmoothedKeyControl:i(1060)}},function(t,e,i){t.exports={Controls:i(1062),Scene2D:i(1059)}},function(t,e,i){t.exports={BaseCache:i(416),CacheManager:i(415)}},function(t,e,i){t.exports={Animation:i(420),AnimationFrame:i(418),AnimationManager:i(417)}},function(t,e,i){var n=i(59);t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=0;s1)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?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,_isTinted:!1,tintFill:!1,clearTint:function(){return this.setTint(16777215),this._isTinted=!1,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._isTinted=!0,this.tintFill=!1,this},setTintFill:function(t,e,i,n){return this.setTint(t,e,i,n),this.tintFill=!0,this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t),this._isTinted=!0}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t),this._isTinted=!0}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t),this._isTinted=!0}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t),this._isTinted=!0}},tint:{set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){return this._isTinted}}};t.exports=n},function(t,e){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},function(t,e){var i={texture:null,frame:null,isCropped:!1,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),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,i){var n=i(104),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={_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(10),s=i(432),r=i(3),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,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getTopRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomLeft:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBounds:function(t){var e,i,s,r,o,a,h,l;if(void 0===t&&(t=new n),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),s=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),s=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),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){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){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},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}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},function(t,e,i){var n=i(453),s=i(212),r=i(1),o=i(2),a=new(i(135))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1);t.exports=function(t,e){void 0===e&&(e={});var i=r(e,"width",-1),o=r(e,"height",-1),h=r(e,"cellWidth",1),l=r(e,"cellHeight",h),u=r(e,"position",s.TOP_LEFT),c=r(e,"x",0),d=r(e,"y",0),f=0,p=0,g=i*h,v=o*l;a.setPosition(c,d),a.setSize(h,l);for(var y=0;y>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s0&&(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,n.RIGHT=new n(1,0),n.LEFT=new n(-1,0),n.UP=new n(0,-1),n.DOWN=new n(0,1),n.ONE=new n(1,1),t.exports=n},function(t,e){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o>>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;n=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=l},function(t,e,i){(function(e){var i={};t.exports=i,function(){i._nextId=0,i._seed=0,i._nowStartTime=+new Date,i.extend=function(t,e){var n,s;"boolean"==typeof e?(n=2,s=e):(n=1,s=!0);for(var r=n;r0;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"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},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]"===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.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;io.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var u=[],c=e;c=400&&t.status<=599&&(n=!1),this.resetXHR(),this.loader.nextFile(this,n)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete))},onProcess:function(){this.state=s.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=s.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=s.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit(r.FILE_COMPLETE,e,i,t),this.loader.emit(r.FILE_KEY_COMPLETE+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});c.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},c.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=c},function(t,e){t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},function(t,e){t.exports=function(t,e,i,n,s){var r=n.alpha*i.alpha;if(r<=0)return!1;var o=t._tempMatrix1.copyFromArray(n.matrix.matrix),a=t._tempMatrix2.applyITRS(i.x,i.y,i.rotation,i.scaleX,i.scaleY),h=t._tempMatrix3;return s?(o.multiplyWithOffset(s,-n.scrollX*i.scrollFactorX,-n.scrollY*i.scrollFactorY),a.e=i.x,a.f=i.y,o.multiply(a,h)):(a.e-=n.scrollX*i.scrollFactorX,a.f-=n.scrollY*i.scrollFactorY,o.multiply(a,h)),e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=r,e.save(),h.setToContext(e),!0}},function(t,e,i){var n,s,r,o=i(30),a=i(140),h=[],l=!1;t.exports={create2D:function(t,e,i){return n(t,e,i,o.CANVAS)},create:n=function(t,e,i,n,r){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=o.CANVAS),void 0===r&&(r=!1);var c=s(n);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:n},n===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),r&&(c.parent=u),u.width=e,u.height=i,l&&n===o.CANVAS&&a.disable(u.getContext("2d")),u},createWebGL:function(t,e,i){return n(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:s=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e0&&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,e,i,r){var o=0,a=0;r=r||t.position;for(var u=0;u0&&(o+=c.area,a+=c.inertia),c.position.x=r.x+(c.position.x-r.x)*e,c.position.y=r.y+(c.position.y-r.y)*i,h.update(c.bounds,c.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(n.setMass(t,t.density*o),n.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null)},n.update=function(t,e,i,n){var o=Math.pow(e*i*t.timeScale,2),a=1-t.frictionAir*i*t.timeScale,u=t.position.x-t.positionPrev.x,c=t.position.y-t.positionPrev.y;t.velocity.x=u*a*n+t.force.x/t.mass*o,t.velocity.y=c*a*n+t.force.y/t.mass*o,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*a*n+t.torque/t.inertia*o,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=r.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(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},n._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n={VERSION:"3.16.2",BlendModes:i(66),ScaleModes:i(111),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=n},function(t,e,i){var n={};t.exports=n;var s=i(36),r=i(12);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){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e,i){var n=i(0),s=i(14),r=i(18),o=i(65),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Transform,s.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.initPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]}});t.exports=a},function(t,e,i){var n=i(66),s=i(13),r=i(111);t.exports=function(t,e,i){e.x=s(i,"x",0),e.y=s(i,"y",0),e.depth=s(i,"depth",0),e.flipX=s(i,"flipX",!1),e.flipY=s(i,"flipY",!1);var o=s(i,"scale",null);"number"==typeof o?e.setScale(o):null!==o&&(e.scaleX=s(o,"x",1),e.scaleY=s(o,"y",1));var a=s(i,"scrollFactor",null);"number"==typeof a?e.setScrollFactor(a):null!==a&&(e.scrollFactorX=s(a,"x",1),e.scrollFactorY=s(a,"y",1)),e.rotation=s(i,"rotation",0);var h=s(i,"angle",null);null!==h&&(e.angle=h),e.alpha=s(i,"alpha",1);var l=s(i,"origin",null);if("number"==typeof l)e.setOrigin(l);else if(null!==l){var u=s(l,"x",.5),c=s(l,"y",.5);e.setOrigin(u,c)}return e.scaleMode=s(i,"scaleMode",r.DEFAULT),e.blendMode=s(i,"blendMode",n.NORMAL),e.visible=s(i,"visible",!0),s(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},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){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,i){var n=i(0),s=i(211),r=i(447),o=i(210),a=i(446),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=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,n)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=n,this._locked=!1,this.update(s)},setGLTo:function(t,e,i,n){return void 0===n&&(n=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=n,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,n=this.b,o=this.a;return this._color=s(e,i,n),this._color32=r(e,i,n,o),this._rgba="rgba("+e+","+i+","+n+","+o/255+")",t&&a(e,i,n,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t));return this.setTo(i,n,s)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,n=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),n=Math.max(0,Math.min(255,n-Math.round(-t/100*255))),this.setTo(e,i,n)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},function(t,e){t.exports=function(t,e,i){var n=i||e.fillColor,s=e.fillAlpha,r=(16711680&n)>>>16,o=(65280&n)>>>8,a=255&n;t.fillStyle="rgba("+r+","+o+","+a+","+s+")"}},function(t,e,i){var n=i(20);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e){t.exports=function(t,e,i,n,s,r){var o;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=s;o=0;o--)t[o][e]+=i+a*n,a++;return t}},function(t,e,i){var n=i(117),s=i(22);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;d>>16,r=(65280&i)>>>8,o=255&i;t.strokeStyle="rgba("+s+","+r+","+o+","+n+")",t.lineWidth=e.lineWidth}},function(t,e,i){t.exports={BOOT:i(1081),DESTROY:i(1080),DRAG_END:i(1079),DRAG_ENTER:i(1078),DRAG:i(1077),DRAG_LEAVE:i(1076),DRAG_OVER:i(1075),DRAG_START:i(1074),DROP:i(1073),GAME_OUT:i(1072),GAME_OVER:i(1071),GAMEOBJECT_DOWN:i(1070),GAMEOBJECT_DRAG_END:i(1069),GAMEOBJECT_DRAG_ENTER:i(1068),GAMEOBJECT_DRAG:i(1067),GAMEOBJECT_DRAG_LEAVE:i(1066),GAMEOBJECT_DRAG_OVER:i(1065),GAMEOBJECT_DRAG_START:i(1064),GAMEOBJECT_DROP:i(1063),GAMEOBJECT_MOVE:i(1062),GAMEOBJECT_OUT:i(1061),GAMEOBJECT_OVER:i(1060),GAMEOBJECT_POINTER_DOWN:i(1059),GAMEOBJECT_POINTER_MOVE:i(1058),GAMEOBJECT_POINTER_OUT:i(1057),GAMEOBJECT_POINTER_OVER:i(1056),GAMEOBJECT_POINTER_UP:i(1055),GAMEOBJECT_UP:i(1054),MANAGER_BOOT:i(1053),MANAGER_PROCESS:i(1052),MANAGER_UPDATE:i(1051),POINTER_DOWN:i(1050),POINTER_DOWN_OUTSIDE:i(1049),POINTER_MOVE:i(1048),POINTER_OUT:i(1047),POINTER_OVER:i(1046),POINTER_UP:i(1045),POINTER_UP_OUTSIDE:i(1044),POINTERLOCK_CHANGE:i(1043),PRE_UPDATE:i(1042),SHUTDOWN:i(1041),START:i(1040),UPDATE:i(1039)}},function(t,e,i){t.exports={DESTROY:i(1255),FADE_IN_COMPLETE:i(1254),FADE_IN_START:i(1253),FADE_OUT_COMPLETE:i(1252),FADE_OUT_START:i(1251),FLASH_COMPLETE:i(1250),FLASH_START:i(1249),PAN_COMPLETE:i(1248),PAN_START:i(1247),POST_RENDER:i(1246),PRE_RENDER:i(1245),SHAKE_COMPLETE:i(1244),SHAKE_START:i(1243),ZOOM_COMPLETE:i(1242),ZOOM_START:i(1241)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,n,s,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},scaleY:{get:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3];return n[0]=s*i+o*e,n[1]=r*i+a*e,n[2]=s*-e+o*i,n[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,s=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=n[0],c=n[1],d=n[2],f=n[3],p=n[4],g=n[5],v=void 0===e?this:e;return v.a=u*s+c*o,v.b=u*r+c*a,v.c=d*s+f*o,v.d=d*r+f*a,v.e=p*s+g*o+h,v.f=p*r+g*a+l,v},multiplyWithOffset:function(t,e,i){var n=this.matrix,s=t.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=e*r+i*a+n[4],u=e*o+i*h+n[5],c=s[0],d=s[1],f=s[2],p=s[3],g=s[4],v=s[5];return n[0]=c*r+d*a,n[1]=c*o+d*h,n[2]=f*r+p*a,n[3]=f*o+p*h,n[4]=g*r+v*a+l,n[5]=g*o+v*h+u,this},transform:function(t,e,i,n,s,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+n*l,o[3]=i*h+n*u,o[4]=s*a+r*l+c,o[5]=s*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],l=n[5];return i.x=t*s+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=e*s-i*n;return t[0]=s/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-s*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;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],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,s,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],s=e[2],r=e[3],o=i*r-n*s;if(t.translateX=e[4],t.translateY=e[5],i||n){var a=Math.sqrt(i*i+n*n);t.rotation=n>0?Math.acos(i/a):-Math.acos(i/a),t.scaleX=a,t.scaleY=o/a}else if(s||r){var h=Math.sqrt(s*s+r*r);t.rotation=.5*Math.PI-(r>0?Math.acos(-s/h):-Math.acos(s/h)),t.scaleX=o/h,t.scaleY=h}else t.rotation=0,t.scaleX=0,t.scaleY=0;return t},applyITRS:function(t,e,i,n,s){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*n,r[1]=o*n,r[2]=-o*s,r[3]=a*s,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=r*c*e+-o*c*t+(-u*r+l*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=r},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){t.exports=function(t,e,i){return t.radius>0&&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){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x+t.width-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y+t.height-t.height*t.originY}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e,i){var n={};t.exports=n;var s=i(31),r=i(12),o=i(27),a=i(35),h=i(36),l=i(262);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=i(0),s=i(19),r=i(23),o=i(7),a=i(1),h=i(4),l=i(8),u=new n({Extends:r,initialize:function(t,e,i,n,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:n,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=s.FILE_POPULATED)},onProcess:function(){if(this.state!==s.FILE_POPULATED){this.state=s.FILE_PROCESSING;var t=JSON.parse(this.xhrLoader.responseText),e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;sthis.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=h},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,ERASE:17,SOURCE_IN:18,SOURCE_OUT:19,SOURCE_ATOP:20,DESTINATION_OVER:21,DESTINATION_IN:22,DESTINATION_OUT:23,DESTINATION_ATOP:24,LIGHTER:25,COPY:26,XOR:27}},function(t,e,i){var n=i(0),s=i(14),r=i(300),o=new n({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.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},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.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return 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=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},function(t,e,i){var n={};t.exports=n;var s=i(79),r=i(12),o=i(35),a=i(27);n.create=function(t){return r.extend({id:r.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{}},t)},n.setModified=function(t,e,i,s){if(t.isModified=e,i&&t.parent&&n.setModified(t.parent,e,i,s),s)for(var r=0;r=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=l},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=t.strokeTint,a=n.getTintAppendFloatAlphaAndSwap(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-s,f=h[1]-r;e.closePath||(l-=2);for(var p=2;ps||e>=i||i>s||e+i>s){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},function(t,e,i){t.exports={COMPLETE:i(1019),DESTROY:i(1018),DETUNE:i(1017),GLOBAL_DETUNE:i(1016),GLOBAL_MUTE:i(1015),GLOBAL_RATE:i(1014),GLOBAL_VOLUME:i(1013),LOOP:i(1012),LOOPED:i(1011),MUTE:i(1010),PAUSE_ALL:i(1009),PAUSE:i(1008),PLAY:i(1007),RATE:i(1006),RESUME_ALL:i(1005),RESUME:i(1004),SEEK:i(1003),STOP_ALL:i(1002),STOP:i(1001),UNLOCKED:i(1e3),VOLUME:i(999)}},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,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||m.next===m.prev)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 T=i;Th&&(h=u),f>l&&(l=f);g=0!==(g=Math.max(h-n,l-a))?1/g:0}return o(m,x,i,n,a,g),x}function s(t,e,i,n,s){var r,o;if(s===_(t,e,i,n)>0)for(r=e;r=e;r-=n)o=b(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)break;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.prevZ,v=t.nextZ;p&&p.z>=c&&v&&v.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;if(p=p.prevZ,v!==t.prev&&v!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&y(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;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}for(;v&&v.z<=d;){if(v!==t.prev&&v!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&y(v.prev,v,v.next)>=0)return!1;v=v.nextZ}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)&&T(s,r)&&T(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)&&T(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)&&T(t,e)&&T(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 T(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 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 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 _(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,i){var n={};t.exports=n;var s=i(31),r=i(36),o=i(95),a=i(35),h=i(165),l=i(12);n._warming=.4,n._torqueDampen=1,n._minLength=1e-6,n.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?r.add(e.bodyA.position,e.pointA):e.pointA,n=e.bodyB?r.add(e.bodyB.position,e.pointB):e.pointB,s=r.magnitude(r.sub(i,n));e.length=void 0!==e.length?e.length:s,e.id=e.id||l.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?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,i){var n={};t.exports=n;var s=i(12);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r0){i||(i={}),n=e.split(" ");for(var l=0;l=0&&y>=0&&v+y<1}},function(t,e){t.exports=function(t,e){return t.hasOwnProperty(e)}},function(t,e,i){var n=i(0),s=i(14),r=i(18),o=i(931),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Size,s.TextureCrop,s.Tint,s.Transform,s.Visible,o],initialize:function(t,e,i,n,s){r.call(this,t,"Image"),this._crop=this.resetCropObject(),this.setTexture(n,s),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline()}});t.exports=a},function(t,e,i){var n=i(76);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){t.exports={ADD:i(1032),COMPLETE:i(1031),FILE_COMPLETE:i(1030),FILE_KEY_COMPLETE:i(1029),FILE_LOAD_ERROR:i(1028),FILE_LOAD:i(1027),FILE_PROGRESS:i(1026),POST_PROCESS:i(1025),PROGRESS:i(1024),START:i(1023)}},function(t,e,i){var n=i(0),s=i(198),r=i(11),o=i(3),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){var n=i(0),s=i(48),r=i(477),o=i(476),a=i(227),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){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},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,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","map"),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.widthInPixels=s(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.tileHeight),this.format=s(t,"format",null),this.orientation=s(t,"orientation","orthogonal"),this.renderOrder=s(t,"renderOrder","right-down"),this.version=s(t,"version","1"),this.properties=s(t,"properties",{}),this.layers=s(t,"layers",[]),this.images=s(t,"images",[]),this.objects=s(t,"objects",{}),this.collision=s(t,"collision",{}),this.tilesets=s(t,"tilesets",[]),this.imageCollections=s(t,"imageCollections",[]),this.tiles=s(t,"tiles",[])}});t.exports=r},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","layer"),this.x=s(t,"x",0),this.y=s(t,"y",0),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.baseTileWidth=s(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=s(t,"baseTileHeight",this.tileHeight),this.widthInPixels=s(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=s(t,"alpha",1),this.visible=s(t,"visible",!0),this.properties=s(t,"properties",{}),this.indexes=s(t,"indexes",[]),this.collideIndexes=s(t,"collideIndexes",[]),this.callbacks=s(t,"callbacks",[]),this.bodies=s(t,"bodies",[]),this.data=s(t,"data",[]),this.tilemapLayer=s(t,"tilemapLayer",null)}});t.exports=r},function(t,e){t.exports=function(t,e,i){return t>=0&&t=0&&e0&&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){t.exports={NONE:0,A:1,B:2,BOTH:3}},function(t,e){t.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r,o){for(var a=n.getTintAppendFloatAlphaAndSwap(i.fillColor,i.fillAlpha*s),h=i.pathData,l=i.pathIndexes,u=0;u-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 t=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof s&&(l.x=s),"number"==typeof r&&(l.y=r),l):n?this.create(s,r,o,a,h):null},get:function(t,e,i,n,s){return this.getFirst(!1,!0,t,e,i,n,s)},getFirstAlive:function(t,e,i,n,s,r){return this.getFirst(!0,t,e,i,n,s,r)},getFirstDead:function(t,e,i,n,s,r){return this.getFirst(!1,t,e,i,n,s,r)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=t.length)){for(var i=t.length-1,n=t[e],s=e;s=this.firstgid&&t=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e,i){var n=i(0),s=i(14),r=i(18),o=i(835),a=i(2),h=new n({Extends:r,Mixins:[s.BlendMode,s.Depth,s.GetBounds,s.Mask,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"),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.lengthl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(a-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){for(var i=[null],n=2;n0?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=a},function(t,e,i){var n=i(0),s=i(24),r=i(21),o=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.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(r,o,n,s)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var s=this.data,r=s.cut;r.x=i,r.y=n,r.w=t,r.h=e,r.r=i+t,r.b=n+e,s.sourceSize.w=t,s.sourceSize.h=e,s.spriteSourceSize.w=t,s.spriteSourceSize.h=e,s.radius=.5*Math.sqrt(t*t+e*e);var o=s.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,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,a.r=i+s,a.b=n+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()},setCropUVs:function(t,e,i,n,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=s(e,0,d)),g=l+(i=s(i,0,f)),v=n=s(n,0,d-e),y=r=s(r,0,f-i),m=this.data;if(m.trim){var x=m.spriteSourceSize,T=e+(n=s(n,0,u-e)),w=i+(r=s(r,0,c-i));if(!(x.rT||x.y>w)){var b=Math.max(x.x,e),S=Math.max(x.y,i),A=Math.min(x.r,T)-b,_=Math.min(x.b,w)-S;v=A,y=_,p=o?h+(u-(b-x.x)-A):h+(b-x.x),g=a?l+(c-(S-x.y)-_):l+(S-x.y),e=b,i=S,n=A,r=_}else p=0,g=0,v=0,y=0}else o&&(p=h+(u-e-n)),a&&(g=l+(c-i-r));var E=this.source.width,C=this.source.height;return t.u0=Math.max(0,p/E),t.v0=Math.max(0,g/C),t.u1=Math.min(1,(p+v)/E),t.v1=Math.min(1,(g+y)/C),t.x=e,t.y=i,t.cx=p,t.cy=g,t.cw=v,t.ch=y,t.width=n,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(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=r(!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}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(0),s=i(9),r=i(75),o=i(21),a=i(2),h=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={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},this.currentConfig=this.config,this.config=o(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 "+t.name+" already exists in Sound"),!1):(t=o(!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]=o(!0,this.markers[t.name],t),!0):(console.warn("Audio Marker: "+t.name+" missing in 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!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in 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=o(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:a,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit(r.DESTROY,this),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)}});t.exports=h},function(t,e,i){var n=i(0),s=i(76),r=i(9),o=i(75),a=i(28),h=i(2),l=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on(a.BLUR,function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on(a.FOCUS,function(){this.pauseOnBlur&&this.onFocus()},this),t.events.on(a.PRE_STEP,this.update,this),t.events.once(a.DESTROY,this.destroy,this)},add:h,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var r=s(e),o=i.spritemap[n];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:r})}return i},play:function(t,e){var i=this.add(t);return i.once(o.COMPLETE,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(o.COMPLETE,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(o.PAUSE_ALL,this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit(o.RESUME_ALL,this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit(o.STOP_ALL,this)},unlock:h,onBlur:h,onFocus:h,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit(o.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)})},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit(o.GLOBAL_RATE,this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit(o.GLOBAL_DETUNE,this,t)}}});t.exports=l},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){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,NUMPAD_ZERO:96,NUMPAD_ONE:97,NUMPAD_TWO:98,NUMPAD_THREE:99,NUMPAD_FOUR:100,NUMPAD_FIVE:101,NUMPAD_SIX:102,NUMPAD_SEVEN:103,NUMPAD_EIGHT:104,NUMPAD_NINE:105,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,SEMICOLON_FIREFOX:59,COLON:58,COMMA_FIREFOX_WINDOWS:60,COMMA_FIREFOX:62,BRACKET_RIGHT_FIREFOX:174,BRACKET_LEFT_FIREFOX:175}},function(t,e,i){t.exports={ADD:i(1136),ERROR:i(1135),LOAD:i(1134),READY:i(1133),REMOVE:i(1132)}},function(t,e){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n,s=i(108),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=function(t,e,i){return(e-t)*i+t}},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;iC&&w_&&bs&&(t=s),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,s=Math.max(n,n+e.height-i);return ts&&(t=s),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=u(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,s){return void 0===s&&(s=!1),this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,s?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(t){void 0===t&&(t=new h);var e=this._bounds;return t.setTo(e.x,e.y,e.width,e.height),t},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){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.sceneManager=t.sys.game.scene,this.scaleManager=t.sys.scale;var e=this.scaleManager.resolution;return this.resolution=e,this._cx=this._x*e,this._cy=this._y*e,this._cw=this._width*e,this._ch=this._height*e,this.updateSystem(),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),0===t&&(t=.001),this.zoom=t,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},update:function(){},updateSystem:function(){if(this.scaleManager){var t=0!==this._x||0!==this._y||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit(a.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this._cx=t*this.resolution,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._cy=t*this.resolution,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this._cw=t*this.resolution,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this._ch=t*this.resolution,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoom}},displayHeight:{get:function(){return this.height/this.zoom}}});t.exports=d},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;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){t.exports={DESTROY:i(1321)}},function(t,e){var i={defaultPipeline:null,pipeline:null,initPipeline:function(t){void 0===t&&(t="TextureTintPipeline");var e=this.scene.sys.game.renderer;return!!(e&&e.gl&&e.hasPipeline(t))&&(this.defaultPipeline=e.getPipeline(t),this.pipeline=this.defaultPipeline,!0)},setPipeline:function(t){var e=this.scene.sys.game.renderer;return e&&e.gl&&e.hasPipeline(t)&&(this.pipeline=e.getPipeline(t)),this},resetPipeline:function(){return this.pipeline=this.defaultPipeline,null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=i},function(t,e){t.exports=function(t){return 2*(t.width+t.height)}},function(t,e,i){t.exports={ADD_ANIMATION:i(1353),ANIMATION_COMPLETE:i(1352),ANIMATION_REPEAT:i(1351),ANIMATION_RESTART:i(1350),ANIMATION_START:i(1349),PAUSE_ALL:i(1348),REMOVE_ANIMATION:i(1347),RESUME_ALL:i(1346),SPRITE_ANIMATION_COMPLETE:i(1345),SPRITE_ANIMATION_KEY_COMPLETE:i(1344),SPRITE_ANIMATION_KEY_REPEAT:i(1343),SPRITE_ANIMATION_KEY_RESTART:i(1342),SPRITE_ANIMATION_KEY_START:i(1341),SPRITE_ANIMATION_KEY_UPDATE:i(1340),SPRITE_ANIMATION_REPEAT:i(1339),SPRITE_ANIMATION_RESTART:i(1338),SPRITE_ANIMATION_START:i(1337),SPRITE_ANIMATION_UPDATE:i(1336)}},function(t,e,i){var n=i(66),s=i(87),r=i(48),o=i(0),a=i(14),h=i(18),l=i(11),u=i(47),c=new o({Extends:h,Mixins:[a.Depth,a.GetBounds,a.Origin,a.ScaleMode,a.Transform,a.ScrollFactor,a.Visible],initialize:function(t,e,i,s,r){void 0===s&&(s=1),void 0===r&&(r=s),h.call(this,t,"Zone"),this.setPosition(e,i),this.width=s,this.height=r,this.blendMode=n.NORMAL,this.updateDisplayOrigin()},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}},setSize:function(t,e,i){return void 0===i&&(i=!0),this.width=t,this.height=e,i&&this.input&&this.input.hitArea instanceof l&&(this.input.hitArea.width=t,this.input.hitArea.height=e),this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},setCircleDropZone:function(t){return this.setDropZone(new s(0,0,t),r)},setRectangleDropZone:function(t,e){return this.setDropZone(new l(0,0,t,e),u)},setDropZone:function(t,e){return void 0===t?this.setRectangleDropZone(this.width,this.height):this.input||this.setInteractive(t,e,!0),this},setAlpha:function(){},setBlendMode:function(){},renderCanvas:function(){},renderWebGL:function(){}});t.exports=c},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(0),s=i(15),r=i(5),o=i(99),a=new n({initialize:function(t,e,i){this.parent=t,this.parentIsTimeline=t.hasOwnProperty("isTimeline"),this.data=e,this.totalData=e.length,this.targets=i,this.totalTargets=i.length,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.offset=0,this.calculatedOffset=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onRepeat:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},getValue:function(){return this.data[0].current},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},isPaused:function(){return this.state===o.PAUSED},hasTarget:function(t){return-1!==this.targets.indexOf(t)},updateTo:function(t,e,i){void 0===i&&(i=!1);for(var n=0;n0&&(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)return this;this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;return 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)),this.parent.makeActive(this)),this},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.play(),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}return this},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}return this},stop:function(t){return this.state===o.ACTIVE&&void 0!==t&&this.seek(t),this.state!==o.REMOVED&&(this.state!==o.PAUSED&&this.state!==o.PENDING_ADD||(this.parent._destroy.push(this),this.parent._toProcess++),this.state=o.PENDING_REMOVE),this},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={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1}},function(t,e){function i(t){return!!t.getStart&&"function"==typeof t.getStart}function n(t){return!!t.getEnd&&"function"==typeof t.getEnd}var s=function(t,e){var r,o,a=function(t,e,i){return i},h=function(t,e,i){return i},l=typeof e;if("number"===l)a=function(){return e};else if("string"===l){var u=e[0],c=parseFloat(e.substr(2));switch(u){case"+":a=function(t,e,i){return i+c};break;case"-":a=function(t,e,i){return i-c};break;case"*":a=function(t,e,i){return i*c};break;case"/":a=function(t,e,i){return i/c};break;default:a=function(){return parseFloat(e)}}}else"function"===l?a=e:"object"===l&&(i(o=e)||n(o))?(n(e)&&(a=e.getEnd),i(e)&&(h=e.getStart)):e.hasOwnProperty("value")&&(r=s(t,e.value));return r||(r={getEnd:a,getStart:h}),r};t.exports=s},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"targets",null);return null===e?e:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(32),s=i(92),r=i(248),o=i(240);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",n.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new s({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},function(t,e,i){var n=i(32),s=i(93),r=i(92),o=i(67);t.exports=function(t,e,i,a,h){for(var l=new s({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:n.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;pr?(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=i(258);n.Body=i(27),n.Composite=i(69),n.World=i(158),n.Detector=i(162),n.Grid=i(257),n.Pairs=i(256),n.Pair=i(119),n.Query=i(578),n.Resolver=i(255),n.SAT=i(161),n.Constraint=i(78),n.Common=i(12),n.Engine=i(254),n.Events=i(79),n.Sleeping=i(95),n.Plugin=i(159),n.Bodies=i(59),n.Composites=i(261),n.Axes=i(165),n.Bounds=i(35),n.Svg=i(576),n.Vector=i(36),n.Vertices=i(31),n.World.add=n.Composite.add,n.World.remove=n.Composite.remove,n.World.addComposite=n.Composite.addComposite,n.World.addBody=n.Composite.addBody,n.World.addConstraint=n.Composite.addConstraint,n.World.clear=n.Composite.clear,t.exports=n},function(t,e,i){var n={};t.exports=n;var s=i(31),r=i(36);n.collides=function(t,e,i){var o,a,h,l,u=!1;if(i){var c=t.parent,d=e.parent,f=c.speed*c.speed+c.angularSpeed*c.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;u=i&&i.collided&&f<.2,l=i}else l={collided:!1,bodyA:t,bodyB:e};if(i&&u){var p=l.axisBody,g=p===t?e:t,v=[p.axes[i.axisNumber]];if(h=n._overlapAxes(p.vertices,g.vertices,v),l.reused=!0,h.overlap<=0)return l.collided=!1,l}else{if((o=n._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return l.collided=!1,l;if((a=n._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return l.collided=!1,l;o.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))1?1:0;d1?1:0;p0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n=i(59),s=i(27),r=i(0),o=i(120),a=i(1),h=i(82),l=i(31),u=new r({Mixins:[o.Bounce,o.Collision,o.Friction,o.Gravity,o.Mass,o.Sensor,o.Sleep,o.Static],initialize:function(t,e,i){this.tile=e,this.world=t,e.physics.matterBody&&e.physics.matterBody.destroy(),e.physics.matterBody=this;var n=a(i,"body",null),s=a(i,"addToWorld",!0);if(n)this.setBody(n,s);else{var r=e.getCollisionGroup();a(r,"objects",[]).length>0?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){t.exports={AFTER_UPDATE:i(593),BEFORE_UPDATE:i(592),COLLISION_ACTIVE:i(591),COLLISION_END:i(590),COLLISION_START:i(589),DRAG_END:i(588),DRAG:i(587),DRAG_START:i(586),PAUSE:i(585),RESUME:i(584),SLEEP_END:i(583),SLEEP_START:i(582)}},function(t,e,i){var n={};t.exports=n;var s=i(36),r=i(12);n.fromVertices=function(t){for(var e={},i=0;i=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){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(0),s=i(126),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()},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,t=this.frame,this.uv[0]=t.u0,this.uv[1]=t.v0,this.uv[2]=t.u0,this.uv[3]=t.v1,this.uv[4]=t.u1,this.uv[5]=t.v1,this.uv[6]=t.u0,this.uv[7]=t.v0,this.uv[8]=t.u1,this.uv[9]=t.v1,this.uv[10]=t.u1,this.uv[11]=t.v0,this},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){for(var n=!1,s=-1,r=t.points.length-1;++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],h0&&(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(h[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(h[p],o,a));return e.restore(),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),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&&c(this.canvas),s.remove(this.canvas),this.texture.destroy()}});t.exports=p},function(t,e,i){var n=i(66),s=i(141),r=i(26),o=i(0),a=i(14),h=i(30),l=i(131),u=i(18),c=i(922),d=i(10),f=i(329),p=new o({Extends:u,Mixins:[a.Alpha,a.BlendMode,a.ComputedSize,a.Crop,a.Depth,a.Flip,a.GetBounds,a.Mask,a.Origin,a.Pipeline,a.ScaleMode,a.ScrollFactor,a.Tint,a.Transform,a.Visible,c],initialize:function(t,e,i,n,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=32),void 0===o&&(o=32),u.call(this,t,"RenderTexture"),this.renderer=t.sys.game.renderer,this.textureManager=t.sys.textures,this.globalTint=16777215,this.globalAlpha=1,this.canvas=r.create2D(this,n,o),this.context=this.canvas.getContext("2d"),this.framebuffer=null,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(f(),this.canvas),this.frame=this.texture.get(),this._saved=!1,this._eraseMode=!1,this.camera=new s(0,0,n,o),this.dirty=!1,this.gl=null;var a=this.renderer;if(a.type===h.WEBGL){var l=a.gl;this.gl=l,this.drawGameObject=this.batchGameObjectWebGL,this.framebuffer=a.createFramebuffer(n,o,this.frame.source.glTexture,!1)}else a.type===h.CANVAS&&(this.drawGameObject=this.batchGameObjectCanvas);this.camera.setScene(t),this.setPosition(e,i),this.setSize(n,o),this.setOrigin(0,0),this.initPipeline()},setSize:function(t,e){return this.resize(t,e)},resize:function(t,e){if(void 0===e&&(e=t),t!==this.width||e!==this.height){if(this.canvas.width=t,this.canvas.height=e,this.gl){var i=this.gl;this.renderer.deleteTexture(this.frame.source.glTexture),this.renderer.deleteFramebuffer(this.framebuffer),this.frame.source.glTexture=this.renderer.createTexture2D(0,i.NEAREST,i.NEAREST,i.CLAMP_TO_EDGE,i.CLAMP_TO_EDGE,i.RGBA,null,t,e,!1),this.framebuffer=this.renderer.createFramebuffer(t,e,this.frame.source.glTexture,!1),this.frame.glTexture=this.frame.source.glTexture}this.frame.source.width=t,this.frame.source.height=e,this.camera.setSize(t,e),this.frame.setSize(t,e),this.width=t,this.height=e}return this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e){void 0===e&&(e=1);var i=255&(t>>16|0),n=255&(t>>8|0),s=255&(0|t);if(this.gl){var r=this.renderer,o=this.getBounds();r.setFramebuffer(this.framebuffer,!0),this.pipeline.drawFillRect(o.x,o.y,o.right,o.bottom,d.getTintFromFloats(i/255,n/255,s/255,1),e),r.setFramebuffer(null,!0)}else this.context.fillStyle="rgba("+i+","+n+","+s+","+e+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height);return this},clear:function(){if(this.dirty){var t=this.gl;if(t){var e=this.renderer;e.setFramebuffer(this.framebuffer,!0),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),e.setFramebuffer(null,!0)}else{var i=this.context;i.save(),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.restore()}this.dirty=!1}return this},erase:function(t,e,i){this._eraseMode=!0;var s=this.renderer.currentBlendMode;return this.renderer.setBlendMode(n.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(s),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.gl;if(this.camera.preRender(1,1),r){var o=this.camera._cx,a=this.camera._cy,h=this.camera._cw,l=this.camera._ch;this.renderer.setFramebuffer(this.framebuffer,!1),this.renderer.pushScissor(o,a,h,l,l);var u=this.pipeline;u.projOrtho(0,this.width,0,this.height,-1e3,1e3),this.batchList(t,e,i,n,s),u.flush(),this.renderer.setFramebuffer(null,!1),this.renderer.popScissor(),u.projOrtho(0,u.width,u.height,0,-1e3,1e3)}else this.renderer.setContext(this.context),this.batchList(t,e,i,n,s),this.renderer.setContext();return this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.gl,a=this.textureManager.getFrame(t,e);if(a){if(this.camera.preRender(1,1),o){var h=this.camera._cx,l=this.camera._cy,u=this.camera._cw,c=this.camera._ch;this.renderer.setFramebuffer(this.framebuffer,!1),this.renderer.pushScissor(h,l,u,c,c);var d=this.pipeline;d.projOrtho(0,this.width,0,this.height,-1e3,1e3),d.batchTextureFrame(a,i,n,r,s,this.camera.matrix,null),d.flush(),this.renderer.setFramebuffer(null,!1),this.renderer.popScissor(),d.projOrtho(0,d.width,d.height,0,-1e3,1e3)}else this.batchTextureFrame(a,i,n,s,r);this.dirty=!0}return this},batchList:function(t,e,i,n,s){for(var r=0;r0?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;s-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,o=r.game.renderer;if(void 0===e&&(e=r.scale.width),void 0===i&&(i=r.scale.height),T.TargetCamera.setScene(this.scene),T.TargetCamera.setViewport(0,0,e,i),T.TargetCamera.scrollX=this.x,T.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var a=(n=r.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(s=a.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(o,this,0,T.TargetCamera,null,s,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});T.TargetCamera=new n,t.exports=T},function(t,e,i){var n=i(127),s=i(0),r=i(942),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a){n.call(this,t,e,i,s,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={parent:this,color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(192),s=i(66),r=i(0),o=i(14),a=i(143),h=i(18),l=i(11),u=i(945),c=i(343),d=i(3),f=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.ScrollFactor,o.Transform,o.Visible,u],initialize:function(t,e,i,n){h.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._displayList=t.sys.displayList,this._sortKey="",this._sysEvents=t.sys.events,this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new l),t.setTo(this.x,this.y,0,0),this.list.length>0)for(var e=this.list,i=new l,n=0;n-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){var i,n=[null],s=this.list.slice(),r=s.length;for(i=2;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}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[],this._displayList=null}});t.exports=f},function(t,e,i){var n=i(949),s=i(946),r=i(0),o=i(14),a=i(131),h=i(18),l=i(130),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,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(),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},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]}},function(t,e){t.exports=function(t){if(!Array.isArray(t)||t.length<2||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){t&&(this.settings.data=t),this.settings.status=s.START,this.settings.active=!0,this.settings.visible=!0,this.events.emit(o.START,this),this.events.emit(o.READY,this,t)},shutdown:function(t){this.events.off(o.TRANSITION_INIT),this.events.off(o.TRANSITION_START),this.events.off(o.TRANSITION_COMPLETE),this.events.off(o.TRANSITION_OUT),this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit(o.SHUTDOWN,this,t)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit(o.DESTROY,this),this.events.removeAllListeners();for(var t=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],e=0;e=0;){var a=e[o];-1!==(r=t.indexOf(a))?(n(t,r),i&&i.call(s,a)):e.pop(),o--}return e}},function(t,e,i){var n={CENTER:i(380),ORIENTATION:i(379),SCALE_MODE:i(378),ZOOM:i(377)};t.exports=n},function(t,e){t.exports=function(t,e){var i;if(e)"string"==typeof e?i=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(i=e);else if(t.parentElement)return t;return i||(i=document.body),i.appendChild(t),t}},function(t,e,i){var n=i(11);t.exports=function(t,e){if(void 0===e&&(e=new n),0===t.length)return e;for(var i,s,r,o=Number.MAX_VALUE,a=Number.MAX_VALUE,h=Number.MIN_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER,u=0;u0)||!((e>0?i[n-1].textures[e-1]:i[n-1].texture)===t)},pushBatch:function(t,e){if(0===e)this.batches.push({first:this.vertexCount,texture:t,textures:[]});else{var i=[];i[e-1]=t,this.batches.push({first:this.vertexCount,texture:null,textures:i})}},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.vertexCount,r=this.topology,o=this.vertexSize,a=this.renderer,h=this.batches,l=h.length,u=0,c=null;if(0===l||0===s)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,s*o));for(var d=0;d0){for(e=0;e0){for(e=0;e0&&(a.setTexture2D(c.texture,0,!1),n.drawArrays(r,c.first,u)),this.vertexCount=0,h.length=0,this.flushLocked=!1,this},batchSprite:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix1,s=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,l=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,g=o.cutWidth,v=o.cutHeight,y=-t.displayOriginX+f,m=-t.displayOriginY+p;if(t.isCropped){var x=t._crop;x.flipX===t.flipX&&x.flipY===t.flipY||o.updateCropUVs(x,t.flipX,t.flipY),h=x.u0,l=x.v0,c=x.u1,d=x.v1,g=x.width,v=x.height,f=x.x,p=x.y,y=-t.displayOriginX+f,m=-t.displayOriginY+p}t.flipX&&(y+=g,g*=-1),t.flipY&&(m+=v,v*=-1);var T=y+g,w=m+v;s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y,n.multiply(s,r)):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY,n.multiply(s,r));var b=r.getX(y,m),S=r.getY(y,m),A=r.getX(y,w),_=r.getY(y,w),E=r.getX(T,w),C=r.getY(T,w),M=r.getX(T,m),P=r.getY(T,m),O=u.getTintAppendFloatAlpha(t._tintTL,e.alpha*t._alphaTL),R=u.getTintAppendFloatAlpha(t._tintTR,e.alpha*t._alphaTR),L=u.getTintAppendFloatAlpha(t._tintBL,e.alpha*t._alphaBL),D=u.getTintAppendFloatAlpha(t._tintBR,e.alpha*t._alphaBR);e.roundPixels&&(b=Math.round(b),S=Math.round(S),A=Math.round(A),_=Math.round(_),E=Math.round(E),C=Math.round(C),M=Math.round(M),P=Math.round(P)),this.setTexture2D(a,0);var F=t._isTinted&&t.tintFill;this.batchQuad(b,S,A,_,E,C,M,P,h,l,c,d,O,R,L,D,F,a,0)},batchQuad:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m){var x=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),x=!0,this.setTexture2D(y,m));var T=this.vertexViewF32,w=this.vertexViewU32,b=this.vertexCount*this.vertexComponentCount-1;return T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=v,w[++b]=d,T[++b]=i,T[++b]=n,T[++b]=h,T[++b]=c,T[++b]=v,w[++b]=p,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=v,w[++b]=g,T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=v,w[++b]=d,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=v,w[++b]=g,T[++b]=o,T[++b]=a,T[++b]=u,T[++b]=l,T[++b]=v,w[++b]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g){var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),this.setTexture2D(p,g),v=!0);var y=this.vertexViewF32,m=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return y[++x]=t,y[++x]=e,y[++x]=o,y[++x]=a,y[++x]=f,m[++x]=u,y[++x]=i,y[++x]=n,y[++x]=o,y[++x]=l,y[++x]=f,m[++x]=c,y[++x]=s,y[++x]=r,y[++x]=h,y[++x]=l,y[++x]=f,m[++x]=d,this.vertexCount+=3,v},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m,x,T,w,b,S,A,_,E,C,M,P,O){this.renderer.setPipeline(this,t);var R=this._tempMatrix1,L=this._tempMatrix2,D=this._tempMatrix3,F=y/i+E,I=m/n+C,k=(y+x)/i+E,B=(m+T)/n+C,N=o,Y=a,X=-g,z=-v;if(t.isCropped){var U=t._crop;N=U.width,Y=U.height,o=U.width,a=U.height;var G=y=U.x,W=m=U.y;c&&(G=x-U.x-U.width),d&&!e.isRenderTexture&&(W=T-U.y-U.height),F=G/i+E,I=W/n+C,k=(G+U.width)/i+E,B=(W+U.height)/n+C,X=-g+y,z=-v+m}d^=!O&&e.isRenderTexture?1:0,c&&(N*=-1,X+=o),d&&(Y*=-1,z+=a);var V=X+N,H=z+Y;L.applyITRS(s,r,u,h,l),R.copyFrom(M.matrix),P?(R.multiplyWithOffset(P,-M.scrollX*f,-M.scrollY*p),L.e=s,L.f=r,R.multiply(L,D)):(L.e-=M.scrollX*f,L.f-=M.scrollY*p,R.multiply(L,D));var j=D.getX(X,z),q=D.getY(X,z),K=D.getX(X,H),J=D.getY(X,H),Z=D.getX(V,H),Q=D.getY(V,H),$=D.getX(V,z),tt=D.getY(V,z);M.roundPixels&&(j=Math.round(j),q=Math.round(q),K=Math.round(K),J=Math.round(J),Z=Math.round(Z),Q=Math.round(Q),$=Math.round($),tt=Math.round(tt)),this.setTexture2D(e,0),this.batchQuad(j,q,K,J,Z,Q,$,tt,F,I,k,B,w,b,S,A,_,e,0)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.setPipeline(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),f=h.getY(e,i),p=h.getX(e,c),g=h.getY(e,c),v=h.getX(l,c),y=h.getY(l,c),m=h.getX(l,i),x=h.getY(l,i);this.setTexture2D(t.glTexture,0),n=u.getTintAppendFloatAlpha(n,s),this.batchQuad(d,f,p,g,v,y,m,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,0)},drawFillRect:function(t,e,i,n,s,r){var o=t+i,a=e+n;this.setTexture2D();var h=u.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,h,h,h,h,2)},batchFillRect:function(t,e,i,n,s,r){this.renderer.setPipeline(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),y=this.currentFrame,m=y.u0,x=y.v0,T=y.u1,w=y.v1;this.batchQuad(l,u,c,d,f,p,g,v,m,x,T,w,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.fillTint.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,y=g.v0,m=g.u1,x=g.v1;this.batchTri(l,u,c,d,f,p,v,y,m,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=s,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=this.tintEffect,f=0;f0&&H[4]?this.batchQuad(D,F,P,O,H[0],H[1],H[2],H[3],U,G,W,V,B,N,Y,X,k):(j[0]=D,j[1]=F,j[2]=P,j[3]=O,j[4]=1),h&&j[4]?this.batchQuad(C,M,R,L,j[0],j[1],j[2],j[3],U,G,W,V,B,N,Y,X,k):(H[0]=C,H[1]=M,H[2]=R,H[3]=L,H[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),s=i(10),r=new n({initialize:function(t){this.name="WebGLPipeline",this.game=t.game,this.view=t.game.canvas,this.resolution=1,this.width=0,this.height=0,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,this.active=!1},boot:function(){},addAttribute:function(t,e,i,n,s){return this.attributes.push({name:t,size:e,type:this.renderer.glFormats[i],normalized:n,offset:s}),this},shouldFlush:function(){return this.vertexCount>=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this.resolution=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},setFloat1v:function(t,e){return this.renderer.setFloat1v(this.program,t,e),this},setFloat2v:function(t,e){return this.renderer.setFloat2v(this.program,t,e),this},setFloat3v:function(t,e){return this.renderer.setFloat3v(this.program,t,e),this},setFloat4v:function(t,e){return this.renderer.setFloat4v(this.program,t,e),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={Global:["game","anims","cache","plugins","registry","scale","sound","textures"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]};n.Global.push("facebook"),t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){this.x=0,this.y=0,this.z=0,"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],T=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+y)*T,this.y=(e*o+i*u+n*p+m)*T,this.z=(e*a+i*c+n*g+x)*T,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}});n.ZERO=new n,n.RIGHT=new n(1,0,0),n.LEFT=new n(-1,0,0),n.UP=new n(0,-1,0),n.DOWN=new n(0,1,0),n.FORWARD=new n(0,0,1),n.BACK=new n(0,0,-1),n.ONE=new n(1,1,1),t.exports=n},function(t,e,i){var n=i(20);t.exports=function(t){return t*n.RAD_TO_DEG}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e){t.exports=function(t,e,i,n,s){var r=.5*(n-e),o=.5*(s-i),a=t*t;return(2*i-2*n+r+o)*(t*a)+(-3*i+3*n-2*r-o)*a+r*t+i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)=(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=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},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=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x2-t.x1,s=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=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,i){var n=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random()*Math.PI*2,s=Math.sqrt(Math.random());return e.x=t.x+s*Math.cos(i)*t.width/2,e.y=t.y+s*Math.sin(i)*t.height/2,e}},function(t,e,i){var n=i(63);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n=i(63);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(6);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(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},function(t,e,i){var n=i(64),s=i(6);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)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(24),s=i(0),r=i(9),o=i(146),a=i(472),h=i(471),l=i(4),u=new s({Extends:r,initialize:function(t,e,i){r.call(this),this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,l(i,"frames",[]),l(i,"defaultTextureKey",null)),this.frameRate=l(i,"frameRate",null),this.duration=l(i,"duration",null),null===this.duration&&null===this.frameRate?(this.frameRate=24,this.duration=this.frameRate/this.frames.length*1e3):this.duration&&null===this.frameRate?this.frameRate=this.frames.length/(this.duration/1e3):this.duration=this.frames.length/this.frameRate*1e3,this.msPerFrame=1e3/this.frameRate,this.skipMissedFrames=l(i,"skipMissedFrames",!0),this.delay=l(i,"delay",0),this.repeat=l(i,"repeat",0),this.repeatDelay=l(i,"repeatDelay",0),this.yoyo=l(i,"yoyo",!1),this.showOnStart=l(i,"showOnStart",!1),this.hideOnComplete=l(i,"hideOnComplete",!1),this.paused=!1,this.manager.on(o.PAUSE_ALL,this.pause,this),this.manager.on(o.RESUME_ALL,this.resume,this)},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){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 t>=0&&t0){s.isLast=!0,s.nextFrame=a[0],a[0].prevFrame=s;var v=1/(a.length-1);for(r=0;r=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,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);var i=this.frames[e];0!==e||t.forward||(i=this.getLastFrame()),t.updateFrame(i)},getFrameByProgress:function(t){return t=n(t,0,1),a(t,this.frames,"progress")},nextFrame:function(t){var e=t.currentFrame;e.isLast?t._yoyo?this.handleYoyoFrame(t,!1):t.repeatCounter>0?t._reverse&&t.forward?t.forward=!1:this.repeatAnimation(t):this.completeAnimation(t):this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t._reverse===!e&&t.repeatCounter>0)return t.forward=e,void this.repeatAnimation(t);if(t._reverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else this.completeAnimation(t)},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t._yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?t._reverse&&!t.forward?(t.currentFrame=this.getLastFrame(),this.repeatAnimation(t)):(t.forward=!0,this.repeatAnimation(t)):this.completeAnimation(t):this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.updateFrame(e),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){if(2===t._pendingStop)return this.completeAnimation(t);if(t._repeatDelay>0&&!1===t.pendingRepeat)t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t._repeatDelay;else if(t.repeatCounter--,t.updateFrame(t.currentFrame[t.forward?"nextFrame":"prevFrame"]),t.isPlaying){this.getNextTick(t),t.pendingRepeat=!1;var e=t.currentFrame,i=t.parent;this.emit(o.ANIMATION_REPEAT,this,e),i.emit(o.SPRITE_ANIMATION_KEY_REPEAT+this.key,this,e,t.repeatCounter,i),i.emit(o.SPRITE_ANIMATION_REPEAT,this,e,t.repeatCounter,i)}},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(){this.removeAllListeners(),this.manager.off(o.PAUSE_ALL,this.pause,this),this.manager.off(o.RESUME_ALL,this.resume,this),this.manager.remove(this.key);for(var t=0;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(6);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){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){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,i){t.exports={TIMELINE_COMPLETE:i(504),TIMELINE_LOOP:i(503),TIMELINE_PAUSE:i(502),TIMELINE_RESUME:i(501),TIMELINE_START:i(500),TIMELINE_UPDATE:i(499)}},function(t,e,i){var n=i(0),s=i(9),r=i(231),o=i(112),a=i(99),h=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.isTimeline=!0,this.data=[],this.totalData=0,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=a.PENDING_ADD,this._pausedState=a.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===a.ACTIVE},add:function(t){return this.queue(o(this,t))},queue:function(t){return this.isPlaying()||(t.parent=this,t.parentIsTimeline=!0,this.data.push(t),this.totalData=this.data.length),this},hasOffset:function(t){return null!==t.offset},isOffsetAbsolute:function(t){return"number"==typeof t},isOffsetRelative:function(t){if("string"===typeof t){var e=t[0];if("-"===e||"+"===e)return!0}return!1},getRelativeOffset:function(t,e){var i=t[0],n=parseFloat(t.substr(2)),s=e;switch(i){case"+":s+=n;break;case"-":s-=n}return Math.max(0,s)},calcDuration:function(){for(var t=0,e=0,i=0,n=0;n0?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=a.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(r.TIMELINE_LOOP,this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=a.LOOP_DELAY):this.state=a.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=a.COMPLETE_DELAY;else{this.state=a.PENDING_REMOVE;var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit(r.TIMELINE_COMPLETE,this)}},update:function(t,e){if(this.state!==a.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 a.ACTIVE:for(var n=this.totalData,s=0;s0?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){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(0),s=i(14),r=i(30),o=i(18),a=i(514),h=i(118),l=i(46),u=i(10),c=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,a){o.call(this,t,"StaticTilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.culledTiles=[],this.skipCull=!1,this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=h.CullTiles,this.renderer=t.sys.game.renderer,this.vertexBuffer=[],this.bufferData=[],this.vertexViewF32=[],this.vertexViewU32=[],this.dirty=[],this.vertexCount=[],this._renderOrder=0,this._tempMatrix=new l,this.gidMap=[],this.setTilesets(n),this.setAlpha(this.layer.alpha),this.setPosition(s,a),this.setOrigin(),this.setSize(e.tileWidth*this.layer.width,e.tileHeight*this.layer.height),this.updateVBOData(),this.initPipeline("TextureTintPipeline"),t.sys.game.config.renderType===r.WEBGL&&t.sys.game.renderer.onContextRestored(function(){this.updateVBOData()},this)},setTilesets:function(t){var e=[],i=[],n=this.tilemap;Array.isArray(t)||(t=[t]);for(var s=0;sv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(1===p)for(o=0;o=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(2===p)for(o=u-1;o>=0;o--)for(a=0;av||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(3===p)for(o=u-1;o>=0;o--)for(a=l-1;a>=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));this.dirty[e]=!1,null===y?(y=i.createVertexBuffer(m,n.STATIC_DRAW),this.vertexBuffer[e]=y):(i.setVertexBuffer(y),n.bufferSubData(n.ARRAY_BUFFER,0,m))}return this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=i.tileWidth,l=i.tileHeight,c=h/2,d=l/2,f=a.x/n,p=a.y/s,g=(a.x+h)/n,v=(a.y+l)/s,y=this._tempMatrix,m=-c,x=-d;e.flipX&&(h*=-1,m+=i.tileWidth),e.flipY&&(l*=-1,x+=i.tileHeight);var T=m+h,w=x+l;y.applyITRS(c+e.pixelX,d+e.pixelY,e.rotation,1,1);var b=u.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),S=y.getX(m,x),A=y.getY(m,x),_=y.getX(m,w),E=y.getY(m,w),C=y.getX(T,w),M=y.getY(T,w),P=y.getX(T,x),O=y.getY(T,x);r.roundPixels&&(S=Math.round(S),A=Math.round(A),_=Math.round(_),E=Math.round(E),C=Math.round(C),M=Math.round(M),P=Math.round(P),O=Math.round(O));var R=this.vertexViewF32[o],L=this.vertexViewU32[o];return R[++t]=S,R[++t]=A,R[++t]=f,R[++t]=p,R[++t]=0,L[++t]=b,R[++t]=_,R[++t]=E,R[++t]=f,R[++t]=v,R[++t]=0,L[++t]=b,R[++t]=C,R[++t]=M,R[++t]=g,R[++t]=v,R[++t]=0,L[++t]=b,R[++t]=S,R[++t]=A,R[++t]=f,R[++t]=p,R[++t]=0,L[++t]=b,R[++t]=C,R[++t]=M,R[++t]=g,R[++t]=v,R[++t]=0,L[++t]=b,R[++t]=P,R[++t]=O,R[++t]=g,R[++t]=p,R[++t]=0,L[++t]=b,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),t>=0&&t<4){this._renderOrder=t;for(var e=0;e=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return a.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,s){return a.CreateFromTiles(t,e,i,n,s,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,s,r,o){return a.Copy(t,e,i,n,s,r,o,this.layer),this},destroy:function(){this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this)},fill:function(t,e,i,n,s,r){return a.Fill(t,e,i,n,s,r,this.layer),this},filterTiles:function(t,e,i,n,s,r,o){return a.FilterTiles(t,e,i,n,s,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,s,r,o){return a.FindTile(t,e,i,n,s,r,o,this.layer)},forEachTile:function(t,e,i,n,s,r,o){return a.ForEachTile(t,e,i,n,s,r,o,this.layer),this},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return a.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,s){return a.GetTilesWithin(t,e,i,n,s,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,s,r){return a.GetTilesWithinWorldXY(t,e,i,n,s,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return a.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,s){return a.PutTileAtWorldXY(t,e,i,n,s,this.layer)},putTilesAt:function(t,e,i,n){return a.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,s){return a.Randomize(t,e,i,n,s,this.layer),this},removeTileAt:function(t,e,i,n){return a.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,s){return a.RemoveTileAtWorldXY(t,e,i,n,s,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,s,r){return a.ReplaceByIndex(t,e,i,n,s,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i){return a.SetCollision(t,e,i,this.layer),this},setCollisionBetween:function(t,e,i,n){return a.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,s,r){return a.SetTileLocationCallback(t,e,i,n,s,r,this.layer),this},shuffle:function(t,e,i,n){return a.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,s,r){return a.SwapByIndex(t,e,i,n,s,r,this.layer),this},tileToWorldX:function(t,e){return a.TileToWorldX(t,e,this.layer)},tileToWorldY:function(t,e){return a.TileToWorldY(t,e,this.layer)},tileToWorldXY:function(t,e,i,n){return a.TileToWorldXY(t,e,i,n,this.layer)},weightedRandomize:function(t,e,i,n,s){return a.WeightedRandomize(t,e,i,n,s,this.layer),this},worldToTileX:function(t,e,i){return a.WorldToTileX(t,e,i,this.layer)},worldToTileY:function(t,e,i){return a.WorldToTileY(t,e,i,this.layer)},worldToTileXY:function(t,e,i,n,s){return a.WorldToTileXY(t,e,i,n,s,this.layer)}});t.exports=h},function(t,e,i){var n=i(0),s=i(39),r=i(239),o=i(21),a=i(32),h=i(93),l=i(411),u=i(238),c=i(67),d=i(118),f=i(114),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.renderOrder=e.renderOrder,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},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},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 Tileset Image: "+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 for Tileset: "+t),null;var u=this.tilesets[l];return u?(u.setTileSize(i,n),u.setSpacing(s,r),u.setImage(h),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),(u=new f(t,o,i,n,s,r)).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("Invalid Tilemap Layer ID: "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;fa&&(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(1),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","object layer"),this.opacity=s(t,"opacity",1),this.properties=s(t,"properties",{}),this.propertyTypes=s(t,"propertytypes",{}),this.type=s(t,"type","objectgroup"),this.visible=s(t,"visible",!0),this.objects=s(t,"objects",[])}});t.exports=r},function(t,e,i){var n=i(523),s=i(245),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=n(t,o);if(a.x+=e,a.y+=i,t.gid){var h=s(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?(a.ellipse=t.ellipse,a.width=t.width,a.height=t.height):t.text?(a.width=t.width,a.height=t.height,a.text=t.text):(a.rectangle=!0,a.width=t.width,a.height=t.height);return a}},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&&t-1}return!1}},function(t,e,i){var n=i(22);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit(l.COLLISION_START,e,i,n)}),f.on(e,"collisionActive",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit(l.COLLISION_ACTIVE,e,i,n)}),f.on(e,"collisionEnd",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit(l.COLLISION_END,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.scale.width),void 0===n&&(n=this.scene.sys.scale.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,s,n+2*s),this.updateWall(o,"right",t+i,e-s,s,n+2*s),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&&g.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&&g.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(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 g.add(this.localWorld,o),o},add:function(t){return g.add(this.localWorld,t),this},remove:function(t,e){var i=t.body?t.body:t;return o.remove(this.localWorld,i,e),this},removeConstraint:function(t,e){return o.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;i1?1:0;r1?1:0;s0&&u.trigger(t,"collisionStart",{pairs:T.collisionStart}),o.preSolvePosition(T.list),s=0;s0&&u.trigger(t,"collisionActive",{pairs:T.collisionActive}),T.collisionEnd.length>0&&u.trigger(t,"collisionEnd",{pairs:T.collisionEnd}),h.update(t.metrics,t),n._bodiesClearForces(y),u.trigger(t,"afterUpdate",v),t},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;sf.friction*f.frictionStatic*F*i&&(k=R,I=o.clamp(f.friction*L*i,-k,k));var B=r.cross(A,y),N=r.cross(_,y),Y=T/(g.inverseMass+v.inverseMass+g.inverseInertia*B*B+v.inverseInertia*N*N);if(D*=Y,I*=Y,P<0&&P*P>n._restingThresh*i)b.normalImpulse=0;else{var X=b.normalImpulse;b.normalImpulse=Math.min(b.normalImpulse+D,0),D=b.normalImpulse-X}if(O*O>n._restingThreshTangent*i)b.tangentImpulse=0;else{var z=b.tangentImpulse;b.tangentImpulse=o.clamp(b.tangentImpulse+I,-k,k),I=b.tangentImpulse-z}s.x=y.x*D+m.x*I,s.y=y.y*D+m.y*I,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(_,s)*v.inverseInertia)}}}}},function(t,e,i){var n={};t.exports=n;var s=i(119),r=i(12);n._pairMaxIdleLife=1e3,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;an._pairMaxIdleLife&&l.push(o);for(o=0;ou.bounds.max.x||p.bounds.max.yu.bounds.max.y)){var g=n._getRegion(t,p);if(!p.region||g.id!==p.region.id||s){f.broadphaseTests+=1,p.region&&!s||(p.region=g);var v=n._regionUnion(g,p.region);for(o=v.startCol;o<=v.endCol;o++)for(a=v.startRow;a<=v.endRow;a++){h=c[l=n._getBucketId(o,a)];var y=o>=g.startCol&&o<=g.endCol&&a>=g.startRow&&a<=g.endRow,m=o>=p.region.startCol&&o<=p.region.endCol&&a>=p.region.startRow&&a<=p.region.endRow;!y&&m&&m&&h&&n._bucketRemoveBody(t,h,p),(p.region===g||y&&!m||s)&&(h||(h=n._createBucket(c,l)),n._bucketAddBody(t,h,p))}p.region=g,d=!0}}}d&&(t.pairsList=n._createActivePairsList(t))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},n._regionUnion=function(t,e){var i=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 n._createRegion(i,s,r,o)},n._getRegion=function(t,e){var i=e.bounds,s=Math.floor(i.min.x/t.bucketWidth),r=Math.floor(i.max.x/t.bucketWidth),o=Math.floor(i.min.y/t.bucketHeight),a=Math.floor(i.max.y/t.bucketHeight);return n._createRegion(s,r,o,a)},n._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},n._getBucketId=function(t,e){return"C"+t+"R"+e},n._createBucket=function(t,e){return t[e]=[]},n._bucketAddBody=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(159),r=i(12);n.name="matter-js",n.version="0.14.2",n.uses=[],n.used=[],n.use=function(){s.use(n,Array.prototype.slice.call(arguments))},n.before=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathBefore(n,t,e)},n.after=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathAfter(n,t,e)}},function(t,e,i){var n=i(473),s=i(0),r=i(120),o=i(18),a=i(1),h=i(144),l=i(61),u=i(3),c=new s({Extends:l,Mixins:[r.Bounce,r.Collision,r.Force,r.Friction,r.Gravity,r.Mass,r.Sensor,r.SetBody,r.Sleep,r.Static,r.Transform,r.Velocity,h],initialize:function(t,e,i,s,r,h){o.call(this,t.scene,"Sprite"),this.anims=new n(this),this.setTexture(s,r),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new u(e,i);var l=a(h,"shape",null);l?this.setBody(l,h):this.setRectangle(this.width,this.height,h),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=c},function(t,e,i){var n=i(0),s=i(120),r=i(18),o=i(1),a=i(83),h=i(144),l=i(3),u=new n({Extends:a,Mixins:[s.Bounce,s.Collision,s.Force,s.Friction,s.Gravity,s.Mass,s.Sensor,s.SetBody,s.Sleep,s.Static,s.Transform,s.Velocity,h],initialize:function(t,e,i,n,s,a){r.call(this,t.scene,"Image"),this.setTexture(n,s),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new l(e,i);var h=o(a,"shape",null);h?this.setBody(h,a):this.setRectangle(this.width,this.height,a),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=u},function(t,e,i){var n={};t.exports=n;var s=i(69),r=i(78),o=i(12),a=i(27),h=i(59);n.stack=function(t,e,i,n,r,o,h){for(var l,u=s.create({label:"Stack"}),c=t,d=e,f=0,p=0;pg&&(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;l=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 L=0;L_&&(_+=e.length),A=Number.MAX_VALUE,_3&&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},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var n=t[i],s=i-1;s>=0;--s)S(n,t[s],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);return!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),!0)}};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))r.ACTIVE&&d(this,t,e))},setCollidesNever:function(t){for(var e=0;e1)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 T=Math.floor((e+v)/f);if((l>0||u===T||T<0||T>=p)&&(T=-1),u>=0&&u1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,T,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,b=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 _=Math.floor((i+w)/f);if((l>0||c===_||_<0||_>=g)&&(_=-1),c>=0&&c1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,u,_));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+b;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),T=g/x,w=-p/x,b=y*T+m*w,S=T*b,A=w*b;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:T,ny:w},!0)}return!1}});t.exports=r},function(t,e,i){var n=i(0),s=i(97),r=i(628),o=i(96),a=i(627),h=new n({initialize:function(t,e,i,n,r){void 0===n&&(n=16),void 0===r&&(r=n),this.world=t,this.gameObject=null,this.enabled=!0,this.parent,this.id=t.getNextID(),this.name="",this.size={x:n,y:r},this.offset={x:0,y:0},this.pos={x:e,y:i},this.last={x:e,y:i},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:t.defaults.maxVelocityX,y:t.defaults.maxVelocityY},this.standing=!1,this.gravityFactor=t.defaults.gravityFactor,this.bounciness=t.defaults.bounciness,this.minBounceVelocity=t.defaults.minBounceVelocity,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER,this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.updateCallback,this.slopeStanding={min:.767944870877505,max:2.3736477827122884}},reset:function(t,e){this.pos={x:t,y:e},this.last={x:t,y:e},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:100,y:100},this.standing=!1,this.gravityFactor=1,this.bounciness=0,this.minBounceVelocity=40,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER},update:function(t){var e=this.pos;this.last.x=e.x,this.last.y=e.y,this.vel.y+=this.world.gravity*t*this.gravityFactor,this.vel.x=r(t,this.vel.x,this.accel.x,this.friction.x,this.maxVel.x),this.vel.y=r(t,this.vel.y,this.accel.y,this.friction.y,this.maxVel.y);var i=this.vel.x*t,n=this.vel.y*t,s=this.world.collisionMap.trace(e.x,e.y,i,n,this.size.x,this.size.y);this.handleMovementTrace(s)&&a(this,s);var o=this.gameObject;o&&(o.x=e.x-this.offset.x+o.displayOriginX*o.scaleX,o.y=e.y-this.offset.y+o.displayOriginY*o.scaleY),this.updateCallback&&this.updateCallback(this)},drawDebug:function(t){var e=this.pos;if(this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.size.x,this.size.y)),this.debugShowVelocity){var i=e.x+this.size.x/2,n=e.y+this.size.y/2;t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.vel.x,n+this.vel.y)}},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},skipHash:function(){return!this.enabled||0===this.type&&0===this.checkAgainst&&0===this.collides},touches:function(t){return!(this.pos.x>=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(48),s=i(0),r=i(42),o=i(47),a=i(3),h=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;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=i,this.height=n,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,this._dx=0,this._dy=0},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},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y);var s=this.gameObject;return!t&&s.frame&&(t=s.frame.realWidth),!e&&s.frame&&(e=s.frame.realHeight),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.setPosition(t,e),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)},postUpdate:function(){},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,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),this.isCircle?t.strokeCircle(i,n,this.width/2):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=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(347);function s(t){if(!(this instanceof s))return new s(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=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)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=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;te._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.up=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},function(t,e,i){var n=i(42);t.exports=function(t,e,i,s){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.left=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},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,i){t.exports={COLLIDE:i(644),OVERLAP:i(643),PAUSE:i(642),RESUME:i(641),TILE_COLLIDE:i(640),TILE_OVERLAP:i(639),WORLD_BOUNDS:i(638)}},function(t,e,i){var n=i(48),s=i(0),r=i(42),o=i(278),a=i(203),h=i(11),l=i(47),u=i(3),c=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;this.world=t,this.gameObject=e,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new u,this.position=new u(e.x,e.y),this.prev=new u(e.x,e.y),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=n,this.sourceWidth=i,this.sourceHeight=n,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(n/2),this.center=new u(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new u,this.newVelocity=new u,this.deltaMax=new u,this.acceleration=new u,this.allowDrag=!0,this.drag=new u,this.allowGravity=!0,this.gravity=new u,this.bounce=new u,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new u(1e4,1e4),this.maxSpeed=-1,this.friction=new u(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.moves=!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.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.physicsType=r.DYNAMIC_BODY,this._reset=!0,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._bounds=new h},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=a(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var n=!1;if(this.syncBounds){var s=t.getBounds(this._bounds);this.width=s.width,this.height=s.height,n=!0}else{var r=Math.abs(e.scaleX),o=Math.abs(e.scaleY);this._sx===r&&this._sy===o||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*o,this._sx=r,this._sy=o,n=!0)}n&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},update:function(t){this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds();var e=this.transform;if(this.position.x=e.x+e.scaleX*(this.offset.x-e.displayOriginX),this.position.y=e.y+e.scaleY*(this.offset.y-e.displayOriginY),this.updateCenter(),this.rotation=e.rotation,this.preRotation=this.rotation,this._reset&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves){this.world.updateMotion(this,t);var i=this.velocity.x,n=this.velocity.y;this.newVelocity.set(i*t,n*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(n,i),this.speed=Math.sqrt(i*i+n*n),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit(o.WORLD_BOUNDS,this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y},postUpdate:function(){this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y,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._dx<0?this.facing=r.FACING_LEFT:this._dx>0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),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(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),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):l(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._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&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(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.width/2):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,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 void 0===t&&(t=!0),this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),this},setMaxSpeed:function(t){return this.maxSpeed=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},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=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 void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=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=c},function(t,e,i){var n=i(279),s=i(24),r=i(0),o=i(277),a=i(42),h=i(62),l=i(9),u=i(278),c=i(206),d=i(421),f=i(420),p=i(276),g=i(275),v=i(4),y=i(274),m=i(637),x=i(11),T=i(273),w=i(636),b=i(631),S=i(630),A=i(102),_=i(271),E=i(272),C=i(46),M=i(3),P=i(63),O=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.bodies=new A,this.staticBodies=new A,this.pendingDestroy=new A,this.late=new A,this._late=!1,this.colliders=new y,this.gravity=new M(v(e,"gravity.x",0),v(e,"gravity.y",0)),this.bounds=new x(v(e,"x",0),v(e,"y",0),v(e,"width",t.sys.scale.width),v(e,"height",t.sys.scale.height)),this.checkCollision={up:v(e,"checkCollision.up",!0),down:v(e,"checkCollision.down",!0),left:v(e,"checkCollision.left",!0),right:v(e,"checkCollision.right",!0)},this.fps=v(e,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=v(e,"timeScale",1),this.OVERLAP_BIAS=v(e,"overlapBias",4),this.TILE_BIAS=v(e,"tileBias",16),this.forceX=v(e,"forceX",!1),this.isPaused=v(e,"isPaused",!1),this._total=0,this.drawDebug=v(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:v(e,"debugShowBody",!0),debugShowStaticBody:v(e,"debugShowStaticBody",!0),debugShowVelocity:v(e,"debugShowVelocity",!0),bodyDebugColor:v(e,"debugBodyColor",16711935),staticBodyDebugColor:v(e,"debugStaticBodyColor",255),velocityDebugColor:v(e,"debugVelocityColor",65280)},this.maxEntries=v(e,"maxEntries",16),this.useTree=v(e,"useTree",!0),this.tree=new T(this.maxEntries),this.staticTree=new T(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new C,this._tempMatrix2=new C,this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=a.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=s;)this._elapsed-=s,i++,this.step(n);this.stepsLastFrame=i,this._late=!0}},step:function(t){var e,i,n=this.bodies.entries,s=n.length;for(e=0;e0){for(n=(e=h.entries).length,t=0;t0){var u=this.tree,c=this.staticTree;for(n=(e=o.entries).length,t=0;t-1&&t.velocity.length()>g&&t.velocity.normalize().scale(g)},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,c=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)l.right&&(a=h(c.x,c.y,l.right,l.y)-c.radius):c.y>l.bottom&&(c.xl.right&&(a=h(c.x,c.y,l.right,l.bottom)-c.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(u.OVERLAP,t.gameObject,e.gameObject,t,e),0!==a;var d=t.velocity.x,f=t.velocity.y,v=t.mass,y=e.velocity.x,m=e.velocity.y,x=e.mass,T=d*Math.cos(o)+f*Math.sin(o),w=d*Math.sin(o)-f*Math.cos(o),b=y*Math.cos(o)+m*Math.sin(o),S=y*Math.sin(o)-m*Math.cos(o),A=((v-x)*T+2*x*b)/(v+x),_=(2*v*T+(x-v)*b)/(v+x);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,d=t.velocity.x,f=t.velocity.y),e.immovable||(e.velocity.x=(_*Math.cos(o)-S*Math.sin(o))*e.bounce.x,e.velocity.y=(S*Math.cos(o)+_*Math.sin(o))*e.bounce.y,y=e.velocity.x,m=e.velocity.y),Math.abs(o)0&&!t.immovable&&y>d?t.velocity.x*=-1:y<0&&!e.immovable&&d0&&!t.immovable&&m>f?t.velocity.y*=-1:m<0&&!e.immovable&&fMath.PI/2&&(d<0&&!t.immovable&&y0&&!e.immovable&&d>y?e.velocity.x*=-1:f<0&&!t.immovable&&m0&&!e.immovable&&d>m&&(e.velocity.y*=-1));var E=this._frameTime;return t.immovable||(t.x+=t.velocity.x*E-a*Math.cos(o),t.y+=t.velocity.y*E-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*E+a*Math.cos(o),e.y+=e.velocity.y*E+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit(u.COLLIDE,t.gameObject,e.gameObject,t,e),t.postUpdate(),e.postUpdate(),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?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):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.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);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,h,l,u=t.body;if(0!==e.length&&u&&u.enable)if(this.useTree){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===a.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(h=d.length,o=0;od.baseTileWidth){var f=(d.tileWidth-d.baseTileWidth)*e.scaleX;a-=f,l+=f}d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var p,g=e.getTilesWithinWorldXY(a,h,l,c);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},y=0;y=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),s>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},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=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=0&&u<=1){var c=((s-h)*(r-n)-(n-a)*(o-s))/l;return Math.abs(c)*Math.sqrt(l)<=i}return Math.sqrt((r-a)*(r-a)+(o-h)*(o-h))<=i}},function(t,e,i){var n=i(48),s=new(i(6));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,i){t.exports={CircleToCircle:i(807),CircleToRectangle:i(806),GetRectangleIntersection:i(805),LineToCircle:i(307),LineToLine:i(125),LineToRectangle:i(804),PointToLine:i(306),PointToLineSegment:i(803),RectangleToRectangle:i(176),RectangleToTriangle:i(802),RectangleToValues:i(801),TriangleToCircle:i(800),TriangleToLine:i(799),TriangleToTriangle:i(798)}},function(t,e,i){t.exports={Circle:i(827),Ellipse:i(817),Intersects:i(308),Line:i(797),Point:i(776),Polygon:i(762),Rectangle:i(300),Triangle:i(732)}},function(t,e,i){var n=i(0),s=i(311),r=i(10),o=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1,this.maxLights=-1},enable:function(){return-1===this.maxLights&&(this.maxLights=this.scene.sys.game.renderer.config.maxLights),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,r=t.y+t.height/2,o=(t.width+t.height)/2,a={x:0,y:0},h=t.matrix,l=this.systems.game.config.height;i.length=0;for(var u=0;u0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],o):h=new s(t,e,i,a[0],a[1],a[2],o),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=o},function(t,e,i){var n=i(0),s=i(10),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(64),s=i(6);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(6),s=i(64);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=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(0),s=i(33),r=i(72),o=i(877),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),s.call(this,t,"Triangle",new r(n,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,n,s,r){return this.geom.setTo(t,e,i,n,s,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(880),s=i(0),r=i(77),o=i(33),a=new s({Extends:o,Mixins:[n],initialize:function(t,e,i,n,s,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===s&&(s=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=s,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,s=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var l=0;l0&&r.push(i([0,0],n[0])),e=0;e1&&r.push(i([0,0],n[n.length-1])),t.setTo(r)}},function(t,e,i){var n=i(64),s=i(65);t.exports=function(t){for(var e=t.points,i=0,r=0;rc+v)){var y=g.getPoint((u-c)/v);o.push(y);break}c+=v}return o}},function(t,e,i){var n=i(11);t.exports=function(t,e){void 0===e&&(e=new n);for(var i,s=1/0,r=1/0,o=-s,a=-r,h=0;h0&&(s=-h.PI2+s%h.PI2):s>h.PI2?s=h.PI2:s<0&&(s=h.PI2+s%h.PI2);for(var u,c=[a+Math.cos(n)*i,l+Math.sin(n)*i];e<1;)u=s*e+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=s+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(n)*i,l+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},function(t,e){t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}},function(t,e,i){var n=i(0),s=i(39),r=i(100),o=i(4),a=i(61),h=i(99),l=i(3),u=new n({Extends:a,initialize:function(t,e,i,n,s,r){a.call(this,t,i,n,s,r),this.path=e,this.rotateToPath=!1,this.pathRotationOffset=0,this.pathOffset=new l(i,n),this.pathVector=new l,this.pathTween,this.pathConfig=null,this._prevDirection=h.PLAYING_FORWARD},setPath:function(t,e){void 0===e&&(e=this.pathConfig);var i=this.pathTween;return i&&i.isPlaying()&&i.stop(),this.path=t,e&&this.startFollow(e),this},setRotateToPath:function(t,e){return void 0===e&&(e=0),this.rotateToPath=t,this.pathRotationOffset=e,this},isFollowing:function(){var t=this.pathTween;return t&&t.isPlaying()},startFollow:function(t,e){void 0===t&&(t={}),void 0===e&&(e=0);var i=this.pathTween;i&&i.isPlaying()&&i.stop(),"number"==typeof t&&(t={duration:t}),t.from=0,t.to=1;var n=r(t,"positionOnPath",!1);this.rotateToPath=r(t,"rotateToPath",!1),this.pathRotationOffset=o(t,"rotationOffset",0);var a=o(t,"startAt",e);if(a&&(t.onStart=function(t){var e=t.data[0];e.progress=a,e.elapsed=e.duration*a;var i=e.ease(e.progress);e.current=e.start+(e.end-e.start)*i,e.target[e.key]=e.current}),this.pathTween=this.scene.sys.tweens.addCounter(t),this.path.getStartPoint(this.pathOffset),n&&(this.x=this.pathOffset.x,this.y=this.pathOffset.y),this.pathOffset.x=this.x-this.pathOffset.x,this.pathOffset.y=this.y-this.pathOffset.y,this._prevDirection=h.PLAYING_FORWARD,this.rotateToPath){var l=this.path.getPoint(.1);this.rotation=Math.atan2(l.y-this.y,l.x-this.x)+s(this.pathRotationOffset)}return this.pathConfig=t,this},pauseFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.pause(),this},resumeFollow:function(){var t=this.pathTween;return t&&t.isPaused()&&t.resume(),this},stopFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.stop(),this},preUpdate:function(t,e){this.anims.update(t,e);var i=this.pathTween;if(i){var n=i.data[0];if(n.state!==h.PLAYING_FORWARD&&n.state!==h.PLAYING_BACKWARD)return;var r=this.pathVector;this.path.getPoint(i.getValue(),r),r.add(this.pathOffset);var o=this.x,a=this.y;this.setPosition(r.x,r.y);var l=this.x-o,u=this.y-a;if(0===l&&0===u)return;if(n.state!==this._prevDirection)return void(this._prevDirection=n.state);this.rotateToPath&&(this.rotation=Math.atan2(u,l)+s(this.pathRotationOffset))}}});t.exports=u},function(t,e,i){var n=i(0),s=i(3),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){t.exports=function(t,e){for(var i=0;ithis._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=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=i(66),s=i(0),r=i(14),o=i(334),a=i(333),h=i(927),l=i(1),u=i(190),c=i(332),d=i(82),f=i(336),p=i(331),g=i(11),v=i(128),y=i(3),m=i(63),x=new s({Mixins:[r.BlendMode,r.Mask,r.ScrollFactor,r.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=f,this.x=new h(e,"x",0),this.y=new h(e,"y",0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",4294967295),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3),this.angle=new h(e,"angle",{min:0,max:360}),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new y,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&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){var u=this.deathCallback,c=this.deathCallbackScope;for(o=h-1;o>=0;o--){var d=a[o];s.splice(d.index,1),r.push(d.particle),u&&u.call(c,d.particle),d.particle.resetPosition()}}this.on&&(0===this.frequency?this.emitParticle():this.frequency>0&&(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}});t.exports=x},function(t,e,i){var n=i(0),s=i(39),r=i(62),o=new n({initialize:function(t){this.emitter=t,this.frame=null,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.tint=16777215,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},resetPosition:function(){this.x=0,this.y=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")},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.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(0),s=i(1),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);s>>16,m=(65280&p)>>>8,x=255&p,c.strokeStyle="rgba("+y+","+m+","+x+","+d+")",c.lineWidth=v,T+=3;break;case n.FILL_STYLE:g=l[T+1],f=l[T+2],y=(16711680&g)>>>16,m=(65280&g)>>>8,x=255&g,c.fillStyle="rgba("+y+","+m+","+x+","+f+")",T+=2;break;case n.BEGIN_PATH:c.beginPath();break;case n.CLOSE_PATH:c.closePath();break;case n.FILL_PATH:h||c.fill();break;case n.STROKE_PATH:h||c.stroke();break;case n.FILL_RECT:h?c.rect(l[T+1],l[T+2],l[T+3],l[T+4]):c.fillRect(l[T+1],l[T+2],l[T+3],l[T+4]),T+=4;break;case n.FILL_TRIANGLE:c.beginPath(),c.moveTo(l[T+1],l[T+2]),c.lineTo(l[T+3],l[T+4]),c.lineTo(l[T+5],l[T+6]),c.closePath(),h||c.fill(),T+=6;break;case n.STROKE_TRIANGLE:c.beginPath(),c.moveTo(l[T+1],l[T+2]),c.lineTo(l[T+3],l[T+4]),c.lineTo(l[T+5],l[T+6]),c.closePath(),h||c.stroke(),T+=6;break;case n.LINE_TO:c.lineTo(l[T+1],l[T+2]),T+=2;break;case n.MOVE_TO:c.moveTo(l[T+1],l[T+2]),T+=2;break;case n.LINE_FX_TO:c.lineTo(l[T+1],l[T+2]),T+=5;break;case n.MOVE_FX_TO:c.moveTo(l[T+1],l[T+2]),T+=5;break;case n.SAVE:c.save();break;case n.RESTORE:c.restore();break;case n.TRANSLATE:c.translate(l[T+1],l[T+2]),T+=2;break;case n.SCALE:c.scale(l[T+1],l[T+2]),T+=2;break;case n.ROTATE:c.rotate(l[T+1]),T+=1;break;case n.GRADIENT_FILL_STYLE:T+=5;break;case n.GRADIENT_LINE_STYLE:T+=6;break;case n.SET_TEXTURE:T+=2}c.restore()}}},function(t,e){t.exports=function(t){var e=t.width/2,i=t.height/2,n=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*n/(10+Math.sqrt(4-3*n)))}},function(t,e,i){var n=i(339),s=i(184),r=i(110),o=i(20);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(4),s=i(142),r=function(t,e,i){for(var n=[],s=0;se?1:0}var s=function(t,e,r,o,a){for(void 0===r&&(r=0),void 0===o&&(o=t.length-1),void 0===a&&(a=n);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));s(t,e,f,p,a)}var g=t[e],v=r,y=o;for(i(t,r,e),a(t[o],g)>0&&i(t,r,o);v0;)y--}0===a(t[r],g)?i(t,r,y):i(t,++y,o),y<=e&&(r=y+1),e<=y&&(o=y-1)}};t.exports=s},function(t,e){t.exports=function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n}},function(t,e,i){var n=i(989),s=i(0),r=i(109),o=i(9),a=i(988),h=i(986),l=i(985),u=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.data=new r(this),this.on("setdata",this.setDataHandler,this),this.on("changedata",this.changeDataHandler,this),this.hasLoaded=!1,this.dataLocked=!1,this.supportedAPIs=[],this.entryPoint="",this.entryPointData=null,this.contextID=null,this.contextType=null,this.locale=null,this.platform=null,this.version=null,this.playerID=null,this.playerName=null,this.playerPhotoURL=null,this.playerCanSubscribeBot=!1,this.paymentsReady=!1,this.catalog=[],this.purchases=[],this.leaderboards={},this.ads=[]},setDataHandler:function(t,e,i){if(!this.dataLocked){var n={};n[e]=i;var s=this;FBInstant.player.setDataAsync(n).then(function(){s.emit("savedata",n)})}},changeDataHandler:function(t,e,i){if(!this.dataLocked){var n={};n[e]=i;var s=this;FBInstant.player.setDataAsync(n).then(function(){s.emit("savedata",n)})}},showLoadProgress:function(t){return t.load.on("progress",function(t){this.hasLoaded||FBInstant.setLoadingProgress(100*t)},this),t.load.on("complete",function(){this.hasLoaded||(this.hasLoaded=!0,FBInstant.startGameAsync().then(this.gameStarted.bind(this)))},this),this},gameStarted:function(){var t={},e=function(t){return t[1].toUpperCase()};FBInstant.getSupportedAPIs().forEach(function(i){i=i.replace(/\../g,e),t[i]=!0}),this.supportedAPIs=t,this.getID(),this.getType(),this.getLocale(),this.getPlatform(),this.getSDKVersion(),this.getPlayerID(),this.getPlayerName(),this.getPlayerPhotoURL();var i=this;FBInstant.onPause(function(){i.emit("pause")}),FBInstant.getEntryPointAsync().then(function(t){i.entryPoint=t,i.entryPointData=FBInstant.getEntryPointData(),i.emit("startgame")}).catch(function(t){console.warn(t)}),this.supportedAPIs.paymentsPurchaseAsync&&FBInstant.payments.onReady(function(){i.paymentsReady=!0}).catch(function(t){console.warn(t)})},checkAPI:function(t){return!!this.supportedAPIs[t]},getID:function(){return!this.contextID&&this.supportedAPIs.contextGetID&&(this.contextID=FBInstant.context.getID()),this.contextID},getType:function(){return!this.contextType&&this.supportedAPIs.contextGetType&&(this.contextType=FBInstant.context.getType()),this.contextType},getLocale:function(){return!this.locale&&this.supportedAPIs.getLocale&&(this.locale=FBInstant.getLocale()),this.locale},getPlatform:function(){return!this.platform&&this.supportedAPIs.getPlatform&&(this.platform=FBInstant.getPlatform()),this.platform},getSDKVersion:function(){return!this.version&&this.supportedAPIs.getSDKVersion&&(this.version=FBInstant.getSDKVersion()),this.version},getPlayerID:function(){return!this.playerID&&this.supportedAPIs.playerGetID&&(this.playerID=FBInstant.player.getID()),this.playerID},getPlayerName:function(){return!this.playerName&&this.supportedAPIs.playerGetName&&(this.playerName=FBInstant.player.getName()),this.playerName},getPlayerPhotoURL:function(){return!this.playerPhotoURL&&this.supportedAPIs.playerGetPhoto&&(this.playerPhotoURL=FBInstant.player.getPhoto()),this.playerPhotoURL},loadPlayerPhoto:function(t,e){return this.playerPhotoURL&&(t.load.setCORS("anonymous"),t.load.image(e,this.playerPhotoURL),t.load.once("filecomplete-image-"+e,function(){this.emit("photocomplete",e)},this),t.load.start()),this},canSubscribeBot:function(){if(this.supportedAPIs.playerCanSubscribeBotAsync){var t=this;FBInstant.player.canSubscribeBotAsync().then(function(){t.playerCanSubscribeBot=!0,t.emit("cansubscribebot")}).catch(function(e){t.emit("cansubscribebotfail",e)})}else this.emit("cansubscribebotfail");return this},subscribeBot:function(){if(this.playerCanSubscribeBot){var t=this;FBInstant.player.subscribeBotAsync().then(function(){t.emit("subscribebot")}).catch(function(e){t.emit("subscribebotfail",e)})}else this.emit("subscribebotfail");return this},getData:function(t){if(!this.checkAPI("playerGetDataAsync"))return this;Array.isArray(t)||(t=[t]);var e=this;return FBInstant.player.getDataAsync(t).then(function(t){for(var i in e.dataLocked=!0,t)e.data.set(i,t[i]);e.dataLocked=!1,e.emit("getdata",t)}),this},saveData:function(t){if(!this.checkAPI("playerSetDataAsync"))return this;var e=this;return FBInstant.player.setDataAsync(t).then(function(){e.emit("savedata",t)}).catch(function(t){e.emit("savedatafail",t)}),this},flushData:function(){if(!this.checkAPI("playerFlushDataAsync"))return this;var t=this;return FBInstant.player.flushDataAsync().then(function(){t.emit("flushdata")}).catch(function(e){t.emit("flushdatafail",e)}),this},getStats:function(t){if(!this.checkAPI("playerGetStatsAsync"))return this;var e=this;return FBInstant.player.getStatsAsync(t).then(function(t){e.emit("getstats",t)}).catch(function(t){e.emit("getstatsfail",t)}),this},saveStats:function(t){if(!this.checkAPI("playerSetStatsAsync"))return this;var e={};for(var i in t)"number"==typeof t[i]&&(e[i]=t[i]);var n=this;return FBInstant.player.setStatsAsync(e).then(function(){n.emit("savestats",e)}).catch(function(t){n.emit("savestatsfail",t)}),this},incStats:function(t){if(!this.checkAPI("playerIncrementStatsAsync"))return this;var e={};for(var i in t)"number"==typeof t[i]&&(e[i]=t[i]);var n=this;return FBInstant.player.incrementStatsAsync(e).then(function(t){n.emit("incstats",t)}).catch(function(t){n.emit("incstatsfail",t)}),this},saveSession:function(t){return this.checkAPI("setSessionData")?(JSON.stringify(t).length<=1e3?FBInstant.setSessionData(t):console.warn("Session data too long. Max 1000 chars."),this):this},openShare:function(t,e,i,n){return this._share("SHARE",t,e,i,n)},openInvite:function(t,e,i,n){return this._share("INVITE",t,e,i,n)},openRequest:function(t,e,i,n){return this._share("REQUEST",t,e,i,n)},openChallenge:function(t,e,i,n){return this._share("CHALLENGE",t,e,i,n)},_share:function(t,e,i,n,s){if(!this.checkAPI("shareAsync"))return this;if(void 0===s&&(s={}),i)var r=this.game.textures.getBase64(i,n);var o={intent:t,image:r,text:e,data:s},a=this;return FBInstant.shareAsync(o).then(function(){a.emit("resume")}),this},isSizeBetween:function(t,e){return this.checkAPI("contextIsSizeBetween")?FBInstant.context.isSizeBetween(t,e):this},switchContext:function(t){if(!this.checkAPI("contextSwitchAsync"))return this;if(t!==this.contextID){var e=this;FBInstant.context.switchAsync(t).then(function(){e.contextID=FBInstant.context.getID(),e.emit("switch",e.contextID)}).catch(function(t){e.emit("switchfail",t)})}return this},chooseContext:function(t){if(!this.checkAPI("contextChooseAsync"))return this;var e=this;return FBInstant.context.chooseAsync(t).then(function(){e.contextID=FBInstant.context.getID(),e.emit("choose",e.contextID)}).catch(function(t){e.emit("choosefail",t)}),this},createContext:function(t){if(!this.checkAPI("contextCreateAsync"))return this;var e=this;return FBInstant.context.createAsync(t).then(function(){e.contextID=FBInstant.context.getID(),e.emit("create",e.contextID)}).catch(function(t){e.emit("createfail",t)}),this},getPlayers:function(){if(!this.checkAPI("playerGetConnectedPlayersAsync"))return this;var t=this;return FBInstant.player.getConnectedPlayersAsync().then(function(e){t.emit("players",e)}).catch(function(e){t.emit("playersfail",e)}),this},getCatalog:function(){if(!this.paymentsReady)return this;var t=this,e=this.catalog;return FBInstant.payments.getCatalogAsync().then(function(i){e=[],i.forEach(function(t){e.push(h(t))}),t.emit("getcatalog",e)}).catch(function(e){t.emit("getcatalogfail",e)}),this},purchase:function(t,e){if(!this.paymentsReady)return this;var i={productID:t};e&&(i.developerPayload=e);var n=this;return FBInstant.payments.purchaseAsync(i).then(function(t){var e=l(t);n.emit("purchase",e)}).catch(function(t){n.emit("purchasefail",t)}),this},getPurchases:function(){if(!this.paymentsReady)return this;var t=this,e=this.purchases;return FBInstant.payments.getPurchasesAsync().then(function(i){e=[],i.forEach(function(t){e.push(l(t))}),t.emit("getpurchases",e)}).catch(function(e){t.emit("getpurchasesfail",e)}),this},consumePurchases:function(t){if(!this.paymentsReady)return this;var e=this;return FBInstant.payments.consumePurchaseAsync(t).then(function(){e.emit("consumepurchase",t)}).catch(function(t){e.emit("consumepurchasefail",t)}),this},update:function(t,e,i,n,s,r){return this._update("CUSTOM",t,e,i,n,s,r)},updateLeaderboard:function(t,e,i,n,s,r){return this._update("LEADERBOARD",t,e,i,n,s,r)},_update:function(t,e,i,n,s,r,o){if(!this.checkAPI("shareAsync"))return this;if(void 0===e&&(e=""),"string"==typeof i&&(i={default:i}),void 0===o&&(o={}),n)var a=this.game.textures.getBase64(n,s);var h={action:t,cta:e,image:a,text:i,template:r,data:o,strategy:"IMMEDIATE",notification:"NO_PUSH"},l=this;return FBInstant.updateAsync(h).then(function(){l.emit("update")}).catch(function(t){l.emit("updatefail",t)}),this},switchGame:function(t,e){if(!this.checkAPI("switchGameAsync"))return this;if(e&&JSON.stringify(e).length>1e3)return console.warn("Switch Game data too long. Max 1000 chars."),this;var i=this;return FBInstant.switchGameAsync(t,e).then(function(){i.emit("switchgame",t)}).catch(function(t){i.emit("switchgamefail",t)}),this},createShortcut:function(){var t=this;return FBInstant.canCreateShortcutAsync().then(function(e){e&&FBInstant.createShortcutAsync().then(function(){t.emit("shortcutcreated")}).catch(function(e){t.emit("shortcutfailed",e)})}),this},quit:function(){FBInstant.quit()},log:function(t,e,i){return this.checkAPI("logEvent")?(void 0===i&&(i={}),t.length>=2&&t.length<=40&&FBInstant.logEvent(t,parseFloat(e),i),this):this},preloadAds:function(t){if(!this.checkAPI("getInterstitialAdAsync"))return this;var e;Array.isArray(t)||(t=[t]);var i=this,s=0;for(e=0;e=3)return console.warn("Too many AdInstances. Show an ad before loading more"),this;for(e=0;e=3)return console.warn("Too many AdInstances. Show an ad before loading more"),this;for(e=0;e=r.x&&t=r.y&&e=r.x&&t=r.y&&e0)&&(!!n.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit(r.PAUSE,this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!n.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit(r.RESUME,this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!n.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit(r.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(r.COMPLETE,this);this.previousTime=s}},destroy:function(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.updateMute(),this.emit(r.MUTE,this,t))}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.updateVolume(),this.emit(r.VOLUME,this,t))}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,r.RATE,t)||(this.calculateRate(),this.emit(r.RATE,this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,r.DETUNE,t)||(this.calculateRate(),this.emit(r.DETUNE,this,t))}},setDetune:function(t){return this.detune=t,this},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(r.SEEK,this,t))}},setSeek:function(t){return this.seek=t,this},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(r.LOOP,this,t))}},setLoop:function(t){return this.loop=t,this}});t.exports=o},function(t,e,i){var n=i(133),s=i(0),r=i(75),o=i(357),a=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 o(this,t,e);return this.sounds.push(i),i},unlock:function(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each(function(e,i){for(var n=0;n-1&&(delete this.keys[n],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,i=t.sys,n=i.settings;t.init&&(t.init.call(t,n.data),n.status=s.INIT,n.isTransition&&i.events.emit(r.TRANSITION_INIT,n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=s.LOADING,e.once(h.COMPLETE,this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>s.START&&n.settings.status<=s.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=s.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)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.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(ethis._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatio0&&(t=(e=r(e,n.y))*this.aspectRatio)):(i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,n.x>0&&(e=(t=r(t,n.x))*(1/this.aspectRatio))),this._width=t,this._height=e,this},fitTo:function(t,e){return this.constrain(t,e,!0)},envelop:function(t,e){return this.constrain(t,e,!1)},setWidth:function(t){return this.setSize(t,this._height)},setHeight:function(t){return this.setSize(this._width,t)},toString:function(){return"[{ Size (width="+this._width+" height="+this._height+" aspectRatio="+this.aspectRatio+" aspectMode="+this.aspectMode+") }]"},copy:function(t){return t.setAspectMode(this.aspectMode),t.aspectRatio=this.aspectRatio,t.setSize(this.width,this.height)},destroy:function(){this._parent=null,this.snapTo=null},width:{get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},height:{get:function(){return this._height},set:function(t){this.setSize(this._width,t)}}});a.NONE=0,a.WIDTH_CONTROLS_HEIGHT=1,a.HEIGHT_CONTROLS_WIDTH=2,a.FIT=3,a.ENVELOP=4,t.exports=a},function(t,e,i){t.exports={ENTER_FULLSCREEN:i(1038),FULLSCREEN_UNSUPPORTED:i(1037),LEAVE_FULLSCREEN:i(1036),ORIENTATION_CHANGE:i(1035),RESIZE:i(1034)}},function(t,e,i){var n=i(196),s=i(0),r=i(9),o=i(365),a=i(28),h=i(1033),l=i(376),u=i(381),c=i(2),d=i(11),f=i(364),p=i(107),g=i(3),v=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.canvas,this.canvasBounds=new d,this.parent=null,this.parentIsWindow=!1,this.parentSize=new f,this.gameSize=new f,this.baseSize=new f,this.displaySize=new f,this.scaleMode=n.SCALE_MODE.NONE,this.resolution=1,this.zoom=1,this.displayScale=new g(1,1),this.autoRound=!1,this.autoCenter=n.CENTER.NO_CENTER,this.orientation=n.ORIENTATION.LANDSCAPE,this.fullscreen,this.fullscreenTarget=null,this._createdFullscreenTarget=!1,this._requestedFullscreenChange=!1,this.dirty=!1,this.resizeInterval=500,this._lastCheck=0,this._checkOrientation=!1,this.listeners={orientationChange:c,windowResize:c,fullScreenChange:c,fullScreenError:c}},preBoot:function(){this.parseConfig(this.game.config),this.game.events.once("boot",this.boot,this)},boot:function(){var t=this.game;this.canvas=t.canvas,this.fullscreen=t.device.fullscreen,this.scaleMode!==n.SCALE_MODE.RESIZE&&this.displaySize.setAspectMode(this.scaleMode),this.scaleMode===n.SCALE_MODE.NONE?this.resize(this.width,this.height):(this.getParentBounds(),this.parentSize.width>0&&this.parentSize.height>0&&this.displaySize.setParent(this.parentSize),this.refresh()),t.events.on(a.PRE_STEP,this.step,this),this.startListeners()},parseConfig:function(t){this.getParent(t),this.getParentBounds();var e=t.width,i=t.height,s=t.scaleMode,r=t.resolution,o=t.zoom,a=t.autoRound;if("string"==typeof e){var h=this.parentSize.width;0===h&&(h=window.innerWidth);var l=parseInt(e,10)/100;e=Math.floor(h*l)}if("string"==typeof i){var c=this.parentSize.height;0===c&&(c=window.innerHeight);var d=parseInt(i,10)/100;i=Math.floor(c*d)}this.resolution=1,this.scaleMode=s,this.autoRound=a,this.autoCenter=t.autoCenter,this.resizeInterval=t.resizeInterval,a&&(e=Math.floor(e),i=Math.floor(i)),this.gameSize.setSize(e,i),o===n.ZOOM.MAX_ZOOM&&(o=this.getMaxZoom()),this.zoom=o,this.baseSize.setSize(e*r,i*r),a&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),t.minWidth>0&&this.displaySize.setMin(t.minWidth*o,t.minHeight*o),t.maxWidth>0&&this.displaySize.setMax(t.maxWidth*o,t.maxHeight*o),this.displaySize.setSize(e,i),this.orientation=u(e,i)},getParent:function(t){var e=t.parent;if(null!==e){if(this.parent=l(e),this.parentIsWindow=this.parent===document.body,t.expandParent&&t.scaleMode!==n.SCALE_MODE.NONE){var i=this.parent.getBoundingClientRect();(this.parentIsWindow||0===i.height)&&(document.documentElement.style.height="100%",document.body.style.height="100%",i=this.parent.getBoundingClientRect(),this.parentIsWindow||0!==i.height||(this.parent.style.overflow="hidden",this.parent.style.width="100%",this.parent.style.height="100%"))}t.fullscreenTarget&&!this.fullscreenTarget&&(this.fullscreenTarget=l(t.fullscreenTarget))}},getParentBounds:function(){if(!this.parent)return!1;var t=this.parentSize,e=this.parent.getBoundingClientRect();this.parentIsWindow&&this.game.device.os.iOS&&(e.height=h(!0));var i=this.resolution,n=e.width*i,s=e.height*i;return(t.width!==n||t.height!==s)&&(t.setSize(n,s),!0)},lockOrientation:function(t){var e=screen.lockOrientation||screen.mozLockOrientation||screen.msLockOrientation;return!!e&&e(t)},setParentSize:function(t,e){return this.parentSize.setSize(t,e),this.refresh()},setGameSize:function(t,e){var i=this.autoRound,n=this.resolution;return i&&(t=Math.floor(t),e=Math.floor(e)),this.gameSize.resize(t,e),this.baseSize.resize(t*n,e*n),this.updateBounds(),this.displayScale.set(t/this.canvasBounds.width,e/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this.updateOrientation(),this.refresh()},resize:function(t,e){var i=this.zoom,n=this.resolution,s=this.autoRound;s&&(t=Math.floor(t),e=Math.floor(e)),this.gameSize.resize(t,e),this.baseSize.resize(t*n,e*n),this.displaySize.setSize(t*i*n,e*i*n),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height;var r=this.canvas.style,a=t*i,h=e*i;return s&&(a=Math.floor(a),h=Math.floor(h)),a===t&&h===e||(r.width=a+"px",r.height=h+"px"),this.getParentBounds(),this.updateCenter(),this.updateBounds(),this.displayScale.set(t/this.canvasBounds.width,e/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this.updateOrientation(),this},setZoom:function(t){return this.zoom=t,this.refresh()},setMaxZoom:function(){return this.zoom=this.getMaxZoom(),this.refresh()},refresh:function(){return this.updateScale(),this.updateBounds(),this.updateOrientation(),this.displayScale.set(this.baseSize.width/this.canvasBounds.width,this.baseSize.height/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this},updateOrientation:function(){if(this._checkOrientation){this._checkOrientation=!1;var t=u(this.width,this.height);t!==this.orientation&&(this.orientation=t,this.emit(o.ORIENTATION_CHANGE,t))}},updateScale:function(){var t,e,i=this.canvas.style,s=this.gameSize.width,r=this.gameSize.height,o=this.zoom,a=this.autoRound;this.scaleMode===n.SCALE_MODE.NONE?(this.displaySize.setSize(s*o*1,r*o*1),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),o>1&&(i.width=t+"px",i.height=e+"px")):this.scaleMode===n.SCALE_MODE.RESIZE?(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),this.gameSize.setSize(this.displaySize.width,this.displaySize.height),this.baseSize.setSize(1*this.displaySize.width,1*this.displaySize.height),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),this.canvas.width=t,this.canvas.height=e):(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),i.width=t+"px",i.height=e+"px"),this.getParentBounds(),this.updateCenter()},getMaxZoom:function(){var t=p(this.parentSize.width,this.gameSize.width,0,!0),e=p(this.parentSize.height,this.gameSize.height,0,!0);return Math.max(Math.min(t,e),1)},updateCenter:function(){var t=this.autoCenter;if(t!==n.CENTER.NO_CENTER){var e=this.canvas,i=e.style,s=e.getBoundingClientRect(),r=s.width,o=s.height,a=Math.floor((this.parentSize.width-r)/2),h=Math.floor((this.parentSize.height-o)/2);t===n.CENTER.CENTER_HORIZONTALLY?h=0:t===n.CENTER.CENTER_VERTICALLY&&(a=0),i.marginLeft=a+"px",i.marginTop=h+"px"}},updateBounds:function(){var t=this.canvasBounds,e=this.canvas.getBoundingClientRect();t.x=e.left+(window.pageXOffset||0)-(document.documentElement.clientLeft||0),t.y=e.top+(window.pageYOffset||0)-(document.documentElement.clientTop||0),t.width=e.width,t.height=e.height},transformX:function(t){return(t-this.canvasBounds.left)*this.displayScale.x},transformY:function(t){return(t-this.canvasBounds.top)*this.displayScale.y},startFullscreen:function(t){void 0===t&&(t={navigationUI:"hide"});var e=this.fullscreen;if(e.available){if(!e.active){var i=this.getFullscreenTarget();this._requestedFullscreenChange=!0,e.keyboard?i[e.request](Element.ALLOW_KEYBOARD_INPUT):i[e.request](t),this.getParentBounds(),this.refresh(),this.emit(o.ENTER_FULLSCREEN)}}else this.emit(o.FULLSCREEN_UNSUPPORTED)},getFullscreenTarget:function(){if(!this.fullscreenTarget){var t=document.createElement("div");t.style.margin="0",t.style.padding="0",t.style.width="100%",t.style.height="100%",this.fullscreenTarget=t,this._createdFullscreenTarget=!0}this._createdFullscreenTarget&&(this.canvas.parentNode.insertBefore(this.fullscreenTarget,this.canvas),this.fullscreenTarget.appendChild(this.canvas));return this.fullscreenTarget},stopFullscreen:function(){var t=this.fullscreen;if(!t.available)return this.emit(o.FULLSCREEN_UNSUPPORTED),!1;if(t.active&&(this._requestedFullscreenChange=!0,document[t.cancel]()),this._createdFullscreenTarget){var e=this.fullscreenTarget;if(e&&e.parentNode){var i=e.parentNode;i.insertBefore(this.canvas,e),i.removeChild(e)}}this.emit(o.LEAVE_FULLSCREEN),this.refresh()},toggleFullscreen:function(t){this.fullscreen.active?this.stopFullscreen():this.startFullscreen(t)},startListeners:function(){var t=this,e=this.listeners;if(e.orientationChange=function(){t._checkOrientation=!0,t.dirty=!0},e.windowResize=function(){t.dirty=!0},window.addEventListener("orientationchange",e.orientationChange,!1),window.addEventListener("resize",e.windowResize,!1),this.fullscreen.available){e.fullScreenChange=function(e){return t.onFullScreenChange(e)},e.fullScreenError=function(e){return t.onFullScreenError(e)};["webkit","moz",""].forEach(function(t){document.addEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.addEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.addEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.addEventListener("MSFullscreenError",e.fullScreenError,!1)}},onFullScreenChange:function(){this._requestedFullscreenChange||this.stopFullscreen(),this._requestedFullscreenChange=!1},onFullScreenError:function(){},step:function(t,e){this.parent&&(this._lastCheck+=e,(this.dirty||this._lastCheck>this.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var t=this.listeners;window.removeEventListener("orientationchange",t.orientationChange,!1),window.removeEventListener("resize",t.windowResize,!1);["webkit","moz",""].forEach(function(e){document.removeEventListener(e+"fullscreenchange",t.fullScreenChange,!1),document.removeEventListener(e+"fullscreenerror",t.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",t.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",t.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy(),this.fullscreenTarget=null},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===n.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===n.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(0),s=i(28),r=i(9),o=i(7),a=i(15),h=i(5),l=i(1),u=i(17),c=i(195),d=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once(s.BOOT,this.boot,this)},boot:function(){var t,e,i,n,r,o,a,h=this.game.config,u=h.installGlobalPlugins;for(u=u.concat(this._pendingGlobal),t=0;t-1&&e.preventDefault()}},this.onKeyUp=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.useQueue||t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}};var e=this.target;e&&(e.addEventListener("keydown",this.onKeyDown,!1),e.addEventListener("keyup",this.onKeyUp,!1),this.enabled=!0)},stopListeners:function(){var t=this.target;t.removeEventListener("keydown",this.onKeyDown,!1),t.removeEventListener("keyup",this.onKeyUp,!1),this.enabled=!1},postUpdate:function(){this.queue=[]},addCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},removeCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},clearCaptures:function(){this.captures=[],this.preventDefault=!1},destroy:function(){this.stopListeners(),this.clearCaptures(),this.queue=[],this.manager.game.events.off(r.POST_RENDER,this.postUpdate,this),this.target=null,this.enabled=!1,this.manager=null}});t.exports=l},function(t,e){t.exports={MOUSE_DOWN:0,MOUSE_MOVE:1,MOUSE_UP:2,TOUCH_START:3,TOUCH_MOVE:4,TOUCH_END:5,TOUCH_CANCEL:7,POINTER_LOCK_CHANGE:6}},function(t,e,i){var n=i(0),s=i(372),r=i(9),o=i(44),a=i(28),h=i(371),l=i(370),u=i(369),c=i(368),d=i(46),f=i(409),p=new n({initialize:function(t,e){this.game=t,this.scaleManager,this.canvas,this.config=e,this.enabled=!0,this.events=new r,this.queue=[],this.domCallbacks={up:[],down:[],move:[],upOnce:[],downOnce:[],moveOnce:[]},this.isOver=!0,this._hasUpCallback=!1,this._hasDownCallback=!1,this._hasMoveCallback=!1,this._customCursor="",this._setCursor=0,this.defaultCursor="",this.keyboard=e.inputKeyboard?new h(this):null,this.mouse=e.inputMouse?new l(this):null,this.touch=e.inputTouch?new c(this):null,this.pointers=[],this.pointersTotal=e.inputActivePointers,e.inputTouch&&1===this.pointersTotal&&(this.pointersTotal=2);for(var i=0;i<=this.pointersTotal;i++){var n=new u(this,i);n.smoothFactor=e.inputSmoothFactor,this.pointers.push(n)}this.mousePointer=e.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.dirty=!1,this.globalTopOnly=!0,this.ignoreEvents=!1,this.useQueue=e.inputQueue,this.time=0,this._updatedThisFrame=!1,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new d,this._tempMatrix2=new d,t.events.once(a.BOOT,this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.scaleManager=this.game.scale,this.events.emit(o.MANAGER_BOOT),this.useQueue?this.game.events.on(a.PRE_STEP,this.legacyUpdate,this):this.game.events.on(a.PRE_STEP,this.preStep,this),this.game.events.on(a.POST_STEP,this.postUpdate,this),this.game.events.once(a.DESTROY,this.destroy,this)},setCanvasOver:function(t){this.isOver=!0,this.events.emit(o.GAME_OVER,t)},setCanvasOut:function(t){this.isOver=!1,this.events.emit(o.GAME_OUT,t)},update:function(t){this._updatedThisFrame||(this._setCursor=0,this._updatedThisFrame=!0),this.events.emit(o.MANAGER_UPDATE),this.ignoreEvents=!1,this.dirty=!0;for(var e=this.pointers,i=0;i10&&(t=10-this.pointersTotal);for(var i=0;i0},updateInputPlugins:function(t,e){for(var i=this.game.scene.getScenes(!0,!0),n=0;ni.width?n.PORTRAIT:n.LANDSCAPE;if("number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?n.PORTRAIT:n.LANDSCAPE;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return n.PORTRAIT;if(window.matchMedia("(orientation: landscape)").matches)return n.LANDSCAPE}return e>t?n.PORTRAIT:n.LANDSCAPE}},function(t,e,i){var n=i(108);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,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e){t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},function(t,e,i){var n=i(37);n.ColorToRGBA=i(1092),n.ComponentToHex=i(384),n.GetColor=i(211),n.GetColor32=i(447),n.HexStringToColor=i(448),n.HSLToColor=i(1091),n.HSVColorWheel=i(1090),n.HSVToRGB=i(210),n.HueToComponent=i(383),n.IntegerToColor=i(445),n.IntegerToRGB=i(444),n.Interpolate=i(1089),n.ObjectToColor=i(443),n.RandomRGB=i(1088),n.RGBStringToColor=i(442),n.RGBToHSV=i(446),n.RGBToString=i(1087),n.ValueToColor=i(212),t.exports=n},function(t,e,i){var n=i(205),s=i(0),r=i(86),o=i(3),a=new s({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.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;ei;)n-=i;n0||!this.inFocus)&&(this._coolDown--,r=Math.min(r,this._target)),r>this._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var o=0,a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},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,i){var n=i(30);t.exports=function(t){var e=t.config;if(!e.hideBanner){var i="WebGL";e.renderType===n.CANVAS?i="Canvas":e.renderType===n.HEADLESS&&(i="Headless");var s,r=e.audio,o=t.device.audio;if(s=!o.webAudio||r&&r.disableWebAudio?r&&r.noAudio||!o.webAudio&&!o.audioData?"No Audio":"HTML5 Audio":"Web Audio",t.device.browser.ie)window.console&&console.log("Phaser v"+n.VERSION+" / https://phaser.io");else{var a,h="",l=[h];Array.isArray(e.bannerBackgroundColor)?(e.bannerBackgroundColor.forEach(function(t){h=h.concat("%c "),l.push("background: "+t),a=t}),l[l.length-1]="color: "+e.bannerTextColor+"; background: "+a):(h=h.concat("%c "),l.push("color: "+e.bannerTextColor+"; background: "+e.bannerBackgroundColor)),l.push("background: #fff"),e.gameTitle&&(h=h.concat(e.gameTitle),e.gameVersion&&(h=h.concat(" v"+e.gameVersion)),e.hidePhaser||(h=h.concat(" / "))),e.hidePhaser||(h=h.concat("Phaser v"+n.VERSION+"-FB ("+i+" | "+s+")")),h=h.concat(" %c "+e.gameURL),l[0]=h,console.log.apply(console,l)}}}},function(t,e,i){var n=i(0),s=i(1129),r=i(199),o=10,a=new n({Extends:r,initialize:function(t){o=t.maxLights,t.fragShader=s.replace("%LIGHT_COUNT%",o.toString()),r.call(this,t),this.defaultNormalMap,this.inverseRotationMatrix=new Float32Array([1,0,0,0,1,0,0,0,1])},boot:function(){this.defaultNormalMap=this.game.textures.getFrame("__DEFAULT")},onBind:function(t){r.prototype.onBind.call(this);var e=this.renderer,i=this.program;return this.mvpUpdate(),e.setInt1(i,"uNormSampler",1),e.setFloat2(i,"uResolution",this.width,this.height),t&&this.setNormalMap(t),this},onRender:function(t,e){this.active=!1;var i=t.sys.lights;if(!i||i.lights.length<=0||!i.active)return this;var n=i.cull(e),s=Math.min(n.length,o);if(0===s)return this;this.active=!0;var r,a=this.renderer,h=this.program,l=e.matrix,u={x:0,y:0},c=a.height;for(r=0;r0&&n>0;if(o&&a){var h=o[0],l=o[1],u=o[2],c=o[3];a=h!==t||l!==e||u!==i||c!==n}a&&(this.flush(),r.scissor(t,s-e-n,i,n))},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},setPipeline:function(t,e){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(e),this.currentPipeline},rebindPipeline:function(t){var e=this.gl;e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.disable(e.STENCIL_TEST),e.clear(e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),e.viewport(0,0,this.width,this.height),this.setBlendMode(0,!0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.blankTexture.glTexture),this.currentActiveTextureUnit=0,this.currentTextures[0]=this.blankTexture.glTexture,this.currentPipeline=t,this.currentPipeline.bind(),this.currentPipeline.onBind()},clearPipeline:function(){this.flush(),this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.setBlendMode(0,!0)},setBlendMode:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.blendModes[t];return!!(e||t!==o.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t)&&(this.flush(),i.enable(i.BLEND),i.blendEquation(n.equation),n.func.length>2?i.blendFuncSeparate(n.func[0],n.func[1],n.func[2],n.func[3]):i.blendFunc(n.func[0],n.func[1]),this.currentBlendMode=t,!0)},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>17&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setBlankTexture:function(t){void 0===t&&(t=!1),!t&&0===this.currentActiveTextureUnit&&this.currentTextures[0]||this.setTexture2D(this.blankTexture.glTexture,0)},setTexture2D:function(t,e,i){void 0===i&&(i=!0);var n=this.gl;return t!==this.currentTextures[e]&&(i&&this.flush(),this.currentActiveTextureUnit!==e&&(n.activeTexture(n.TEXTURE0+e),this.currentActiveTextureUnit=e),n.bindTexture(n.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.width,s=this.height;return t!==this.currentFramebuffer&&(t&&t.renderTexture?(n=t.renderTexture.width,s=t.renderTexture.height):this.flush(),i.bindFramebuffer(i.FRAMEBUFFER,t),i.viewport(0,0,n,s),e&&(t?(this.drawingBufferHeight=s,this.pushScissor(0,0,n,s)):(this.drawingBufferHeight=this.height,this.popScissor())),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 s=this.gl,r=s.NEAREST,h=s.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,a(e,i)&&(h=s.REPEAT),n===o.ScaleModes.LINEAR&&this.config.antialias&&(r=s.LINEAR),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,r,r,h,h,s.RGBA,t):this.createTexture2D(0,r,r,h,h,s.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){l=void 0===l||null===l||l;var u=this.gl,c=u.createTexture();return 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){var e=this.nativeTextures.indexOf(t);return-1!==e&&h(this.nativeTextures,e),this.gl.deleteTexture(t),this.currentTextures[0]!==t||this.game.pendingDestroy||this.setBlankTexture(!0),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=t._cx,i=t._cy,n=t._cw,r=t._ch,o=this.pipelines.TextureTintPipeline,a=t.backgroundColor;if(t.renderToTexture){this.flush(),this.pushScissor(e,i,n,-r),this.setFramebuffer(t.framebuffer);var h=this.gl;h.clearColor(0,0,0,0),h.clear(h.COLOR_BUFFER_BIT),o.projOrtho(e,n+e,i,r+i,-1e3,1e3),a.alphaGL>0&&o.drawFillRect(e,i,n+e,r+i,c.getTintFromFloats(a.redGL,a.greenGL,a.blueGL,1),a.alphaGL),t.emit(s.PRE_RENDER,t)}else this.pushScissor(e,i,n,r),a.alphaGL>0&&o.drawFillRect(e,i,n,r,c.getTintFromFloats(a.redGL,a.greenGL,a.blueGL,1),a.alphaGL)},postRenderCamera:function(t){var e=this.pipelines.TextureTintPipeline;if(t.flashEffect.postRenderWebGL(e,c.getTintFromFloats),t.fadeEffect.postRenderWebGL(e,c.getTintFromFloats),t.dirty=!1,this.popScissor(),t.renderToTexture){e.flush(),this.setFramebuffer(null),t.emit(s.POST_RENDER,t),e.projOrtho(0,e.width,e.height,0,-1e3,1e3);var i=c.getTintAppendFloatAlpha;(t.pipeline?t.pipeline:e).batchTexture(t,t.glTexture,t.width,t.height,t.x,t.y,t.width,t.height,t.zoom,t.zoom,t.rotation,t.flipX,!t.flipY,1,1,0,0,0,0,t.width,t.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),t._isTinted&&t.tintFill,0,0,this.defaultCamera,null),this.setBlankTexture(!0)}},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.pipelines;if(t.bindFramebuffer(t.FRAMEBUFFER,null),this.config.clearBeforeRender){var i=this.config.backgroundColor;t.clearColor(i.redGL,i.greenGL,i.blueGL,i.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}for(var n in t.enable(t.SCISSOR_TEST),e)e[n].onPreRender();this.currentScissor=[0,0,this.width,this.height],this.scissorStack=[this.currentScissor],this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.setPipeline(this.pipelines.TextureTintPipeline)}},render:function(t,e,i,n){if(!this.contextLost){var s=e.list,r=s.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;l=0?g=-(g+d):g<0&&(g=Math.abs(g)-d)),-1===m&&(v>=0?v=-(v+f):v<0&&(v=Math.abs(v)-f))}a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y,o.multiply(a,h)):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY,o.multiply(a,h)),r.save(),h.setToContext(r),r.scale(y,m),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=s,r.drawImage(e.source.image,u,c,d,f,g,v,d/p,f/p),r.restore()}},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","crisp-edges","-moz-crisp-edges","-webkit-optimize-contrast","optimize-contrast","pixelated"].forEach(function(e){t.style["image-rendering"]=e}),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(404),s=i(26),r=i(30),o=i(207);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===r.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==r.HEADLESS)if(e.renderType===r.CANVAS||e.renderType!==r.CANVAS&&!o.webGL){if(!o.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=r.CANVAS}else e.renderType=r.WEBGL;e.antialias||s.disableSmoothing();var a,h,l=t.scale.baseSize,u=l.width,c=l.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=u,t.canvas.height=c):t.canvas=s.create(t,u,c,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||n.setCrisp(t.canvas),e.renderType!==r.HEADLESS&&(a=i(403),h=i(400),e.renderType===r.WEBGL?t.renderer=new h(t):(t.renderer=new a(t),t.context=t.renderer.gameContext))}},function(t,e,i){var n=i(0),s=i(202),r=i(408),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(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(16),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],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],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],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},zero:function(){var t=this.val;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=0,this},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){var t=this.val;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},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],s=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=s,t[11]=t[14],t[12]=n,t[13]=r,t[14]=o,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=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15],y=e*o-i*r,m=e*a-n*r,x=e*h-s*r,T=i*a-n*o,w=i*h-s*o,b=n*h-s*a,S=l*p-u*f,A=l*g-c*f,_=l*v-d*f,E=u*g-c*p,C=u*v-d*p,M=c*v-d*g,P=y*M-m*C+x*E+T*_-w*A+b*S;return P?(P=1/P,t[0]=(o*M-a*C+h*E)*P,t[1]=(n*C-i*M-s*E)*P,t[2]=(p*b-g*w+v*T)*P,t[3]=(c*w-u*b-d*T)*P,t[4]=(a*_-r*M-h*A)*P,t[5]=(e*M-n*_+s*A)*P,t[6]=(g*x-f*b-v*m)*P,t[7]=(l*b-c*x+d*m)*P,t[8]=(r*C-o*_+h*S)*P,t[9]=(i*_-e*C-s*S)*P,t[10]=(f*w-p*x+v*y)*P,t[11]=(u*x-l*w-d*y)*P,t[12]=(o*A-r*E-a*S)*P,t[13]=(e*E-i*A+n*S)*P,t[14]=(p*m-f*T-g*y)*P,t[15]=(l*T-u*m+c*y)*P,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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return t[0]=o*(c*v-d*g)-u*(a*v-h*g)+p*(a*d-h*c),t[1]=-(i*(c*v-d*g)-u*(n*v-s*g)+p*(n*d-s*c)),t[2]=i*(a*v-h*g)-o*(n*v-s*g)+p*(n*h-s*a),t[3]=-(i*(a*d-h*c)-o*(n*d-s*c)+u*(n*h-s*a)),t[4]=-(r*(c*v-d*g)-l*(a*v-h*g)+f*(a*d-h*c)),t[5]=e*(c*v-d*g)-l*(n*v-s*g)+f*(n*d-s*c),t[6]=-(e*(a*v-h*g)-r*(n*v-s*g)+f*(n*h-s*a)),t[7]=e*(a*d-h*c)-r*(n*d-s*c)+l*(n*h-s*a),t[8]=r*(u*v-d*p)-l*(o*v-h*p)+f*(o*d-h*u),t[9]=-(e*(u*v-d*p)-l*(i*v-s*p)+f*(i*d-s*u)),t[10]=e*(o*v-h*p)-r*(i*v-s*p)+f*(i*h-s*o),t[11]=-(e*(o*d-h*u)-r*(i*d-s*u)+l*(i*h-s*o)),t[12]=-(r*(u*g-c*p)-l*(o*g-a*p)+f*(o*c-a*u)),t[13]=e*(u*g-c*p)-l*(i*g-n*p)+f*(i*c-n*u),t[14]=-(e*(o*g-a*p)-r*(i*g-n*p)+f*(i*a-n*o)),t[15]=e*(o*c-a*u)-r*(i*c-n*u)+l*(i*a-n*o),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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return(e*o-i*r)*(c*v-d*g)-(e*a-n*r)*(u*v-d*p)+(e*h-s*r)*(u*g-c*p)+(i*a-n*o)*(l*v-d*f)-(i*h-s*o)*(l*g-c*f)+(n*h-s*a)*(l*p-u*f)},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=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],y=e[15],m=t.val,x=m[0],T=m[1],w=m[2],b=m[3];return e[0]=x*i+T*o+w*u+b*p,e[1]=x*n+T*a+w*c+b*g,e[2]=x*s+T*h+w*d+b*v,e[3]=x*r+T*l+w*f+b*y,x=m[4],T=m[5],w=m[6],b=m[7],e[4]=x*i+T*o+w*u+b*p,e[5]=x*n+T*a+w*c+b*g,e[6]=x*s+T*h+w*d+b*v,e[7]=x*r+T*l+w*f+b*y,x=m[8],T=m[9],w=m[10],b=m[11],e[8]=x*i+T*o+w*u+b*p,e[9]=x*n+T*a+w*c+b*g,e[10]=x*s+T*h+w*d+b*v,e[11]=x*r+T*l+w*f+b*y,x=m[12],T=m[13],w=m[14],b=m[15],e[12]=x*i+T*o+w*u+b*p,e[13]=x*n+T*a+w*c+b*g,e[14]=x*s+T*h+w*d+b*v,e[15]=x*r+T*l+w*f+b*y,this},multiplyLocal:function(t){var e=[],i=this.val,n=t.val;return e[0]=i[0]*n[0]+i[1]*n[4]+i[2]*n[8]+i[3]*n[12],e[1]=i[0]*n[1]+i[1]*n[5]+i[2]*n[9]+i[3]*n[13],e[2]=i[0]*n[2]+i[1]*n[6]+i[2]*n[10]+i[3]*n[14],e[3]=i[0]*n[3]+i[1]*n[7]+i[2]*n[11]+i[3]*n[15],e[4]=i[4]*n[0]+i[5]*n[4]+i[6]*n[8]+i[7]*n[12],e[5]=i[4]*n[1]+i[5]*n[5]+i[6]*n[9]+i[7]*n[13],e[6]=i[4]*n[2]+i[5]*n[6]+i[6]*n[10]+i[7]*n[14],e[7]=i[4]*n[3]+i[5]*n[7]+i[6]*n[11]+i[7]*n[15],e[8]=i[8]*n[0]+i[9]*n[4]+i[10]*n[8]+i[11]*n[12],e[9]=i[8]*n[1]+i[9]*n[5]+i[10]*n[9]+i[11]*n[13],e[10]=i[8]*n[2]+i[9]*n[6]+i[10]*n[10]+i[11]*n[14],e[11]=i[8]*n[3]+i[9]*n[7]+i[10]*n[11]+i[11]*n[15],e[12]=i[12]*n[0]+i[13]*n[4]+i[14]*n[8]+i[15]*n[12],e[13]=i[12]*n[1]+i[13]*n[5]+i[14]*n[9]+i[15]*n[13],e[14]=i[12]*n[2]+i[13]*n[6]+i[14]*n[10]+i[15]*n[14],e[15]=i[12]*n[3]+i[13]*n[7]+i[14]*n[11]+i[15]*n[15],this.fromArray(e)},translate:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[12]=s[0]*e+s[4]*i+s[8]*n+s[12],s[13]=s[1]*e+s[5]*i+s[9]*n+s[13],s[14]=s[2]*e+s[6]*i+s[10]*n+s[14],s[15]=s[3]*e+s[7]*i+s[11]*n+s[15],this},translateXYZ:function(t,e,i){var n=this.val;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},scale:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[0]=s[0]*e,s[1]=s[1]*e,s[2]=s[2]*e,s[3]=s[3]*e,s[4]=s[4]*i,s[5]=s[5]*i,s[6]=s[6]*i,s[7]=s[7]*i,s[8]=s[8]*n,s[9]=s[9]*n,s[10]=s[10]*n,s[11]=s[11]*n,this},scaleXYZ:function(t,e,i){var n=this.val;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},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,o=t.y,a=t.z,h=s*r,l=s*o;return this.fromArray([h*r+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*r,0,h*a-n*o,l*a+n*r,s*a*a+i,0,0,0,0,1]),this},rotate:function(t,e){var i=this.val,n=e.x,s=e.y,r=e.z,o=Math.sqrt(n*n+s*s+r*r);if(Math.abs(o)<1e-6)return null;n*=o=1/o,s*=o,r*=o;var a=Math.sin(t),h=Math.cos(t),l=1-h,u=i[0],c=i[1],d=i[2],f=i[3],p=i[4],g=i[5],v=i[6],y=i[7],m=i[8],x=i[9],T=i[10],w=i[11],b=n*n*l+h,S=s*n*l+r*a,A=r*n*l-s*a,_=n*s*l-r*a,E=s*s*l+h,C=r*s*l+n*a,M=n*r*l+s*a,P=s*r*l-n*a,O=r*r*l+h;return i[0]=u*b+p*S+m*A,i[1]=c*b+g*S+x*A,i[2]=d*b+v*S+T*A,i[3]=f*b+y*S+w*A,i[4]=u*_+p*E+m*C,i[5]=c*_+g*E+x*C,i[6]=d*_+v*E+T*C,i[7]=f*_+y*E+w*C,i[8]=u*M+p*P+m*O,i[9]=c*M+g*P+x*O,i[10]=d*M+v*P+T*O,i[11]=f*M+y*P+w*O,this},rotateX:function(t){var e=this.val,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},rotateY:function(t){var e=this.val,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},rotateZ:function(t){var e=this.val,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},fromRotationTranslation:function(t,e){var i=this.val,n=t.x,s=t.y,r=t.z,o=t.w,a=n+n,h=s+s,l=r+r,u=n*a,c=n*h,d=n*l,f=s*h,p=s*l,g=r*l,v=o*a,y=o*h,m=o*l;return i[0]=1-(f+g),i[1]=c+m,i[2]=d-y,i[3]=0,i[4]=c-m,i[5]=1-(u+g),i[6]=p+v,i[7]=0,i[8]=d+y,i[9]=p-v,i[10]=1-(u+f),i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},fromQuat:function(t){var e=this.val,i=t.x,n=t.y,s=t.z,r=t.w,o=i+i,a=n+n,h=s+s,l=i*o,u=i*a,c=i*h,d=n*a,f=n*h,p=s*h,g=r*o,v=r*a,y=r*h;return e[0]=1-(d+p),e[1]=u+y,e[2]=c-v,e[3]=0,e[4]=u-y,e[5]=1-(l+p),e[6]=f+g,e[7]=0,e[8]=c+v,e[9]=f-g,e[10]=1-(l+d),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},frustum:function(t,e,i,n,s,r){var o=this.val,a=1/(e-t),h=1/(n-i),l=1/(s-r);return o[0]=2*s*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*s*h,o[6]=0,o[7]=0,o[8]=(e+t)*a,o[9]=(n+i)*h,o[10]=(r+s)*l,o[11]=-1,o[12]=0,o[13]=0,o[14]=r*s*2*l,o[15]=0,this},perspective:function(t,e,i,n){var s=this.val,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},perspectiveLH:function(t,e,i,n){var s=this.val;return s[0]=2*i/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/e,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=-n/(i-n),s[11]=1,s[12]=0,s[13]=0,s[14]=i*n/(i-n),s[15]=0,this},ortho:function(t,e,i,n,s,r){var o=this.val,a=t-e,h=i-n,l=s-r;return a=0===a?a:1/a,h=0===h?h:1/h,l=0===l?l:1/l,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},lookAt:function(t,e,i){var n=this.val,s=t.x,r=t.y,o=t.z,a=i.x,h=i.y,l=i.z,u=e.x,c=e.y,d=e.z;if(Math.abs(s-u)<1e-6&&Math.abs(r-c)<1e-6&&Math.abs(o-d)<1e-6)return this.identity();var f=s-u,p=r-c,g=o-d,v=1/Math.sqrt(f*f+p*p+g*g),y=h*(g*=v)-l*(p*=v),m=l*(f*=v)-a*g,x=a*p-h*f;(v=Math.sqrt(y*y+m*m+x*x))?(y*=v=1/v,m*=v,x*=v):(y=0,m=0,x=0);var T=p*x-g*m,w=g*y-f*x,b=f*m-p*y;return(v=Math.sqrt(T*T+w*w+b*b))?(T*=v=1/v,w*=v,b*=v):(T=0,w=0,b=0),n[0]=y,n[1]=T,n[2]=f,n[3]=0,n[4]=m,n[5]=w,n[6]=p,n[7]=0,n[8]=x,n[9]=b,n[10]=g,n[11]=0,n[12]=-(y*s+m*r+x*o),n[13]=-(T*s+w*r+b*o),n[14]=-(f*s+p*r+g*o),n[15]=1,this},yawPitchRoll:function(t,e,i){this.zero(),s.zero(),r.zero();var n=this.val,o=s.val,a=r.val,h=Math.sin(i),l=Math.cos(i);return n[10]=1,n[15]=1,n[0]=l,n[1]=h,n[4]=-h,n[5]=l,h=Math.sin(e),l=Math.cos(e),o[0]=1,o[15]=1,o[5]=l,o[10]=l,o[9]=-h,o[6]=h,h=Math.sin(t),l=Math.cos(t),a[5]=1,a[15]=1,a[0]=l,a[2]=-h,a[8]=h,a[10]=l,this.multiplyLocal(s),this.multiplyLocal(r),this},setWorldMatrix:function(t,e,i,n,o){return this.yawPitchRoll(t.y,t.x,t.z),s.scaling(i.x,i.y,i.z),r.xyz(e.x,e.y,e.z),this.multiplyLocal(s),this.multiplyLocal(r),void 0!==n&&this.multiplyLocal(n),void 0!==o&&this.multiplyLocal(o),this}}),s=new n,r=new n;t.exports=n},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],T=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+T*h,e[7]=m*n+x*o+T*l,e[8]=m*s+x*a+T*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,T=n*l-r*a,w=n*u-o*a,b=s*l-r*h,S=s*u-o*h,A=r*u-o*l,_=c*v-d*g,E=c*y-f*g,C=c*m-p*g,M=d*y-f*v,P=d*m-p*v,O=f*m-p*y,R=x*O-T*P+w*M+b*C-S*E+A*_;return R?(R=1/R,i[0]=(h*O-l*P+u*M)*R,i[1]=(l*C-a*O-u*E)*R,i[2]=(a*P-h*C+u*_)*R,i[3]=(r*P-s*O-o*M)*R,i[4]=(n*O-r*C+o*E)*R,i[5]=(s*C-n*P-o*_)*R,i[6]=(v*A-y*S+m*b)*R,i[7]=(y*w-g*A-m*T)*R,i[8]=(g*S-v*w+m*x)*R,this):null}});t.exports=n},function(t,e,i){var n=i(3);t.exports=function(t,e,i,s,r,o,a,h){void 0===h&&(h=new n);var l=Math.sin(r),u=Math.cos(r),c=u*o,d=l*o,f=-l*a,p=u*a,g=1/(c*p+f*-d);return h.x=p*g*t+-f*g*e+(s*f-i*p)*g,h.y=c*g*e+-d*g*t+(-s*c+i*d)*g,h}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},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,e){return Math.random()*(e-t)+t}},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e){t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<e-i}},function(t,e){t.exports=function(t,e,i,n){var s=t-i,r=e-n;return s*s+r*r}},function(t,e){t.exports=function(t){return(t%=2*Math.PI)>=0?t:t+2*Math.PI}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e,i){var n=i(20),s=i(21),r={Angle:i(1178),Distance:i(1170),Easing:i(1168),Fuzzy:i(1167),Interpolation:i(1164),Pow2:i(1159),Snap:i(1157),RandomDataGenerator:i(1155),Average:i(1154),Bernstein:i(419),Between:i(204),CatmullRom:i(205),CeilTo:i(1153),Clamp:i(24),DegToRad:i(39),Difference:i(1152),Factorial:i(418),FloatBetween:i(412),FloorTo:i(1151),FromPercent:i(110),GetSpeed:i(1150),IsEven:i(1149),IsEvenStrict:i(1148),Linear:i(139),MaxAdd:i(1147),MinSub:i(1146),Percent:i(1145),RadToDeg:i(203),RandomXY:i(1144),RandomXYZ:i(1143),RandomXYZW:i(1142),Rotate:i(411),RotateAround:i(466),RotateAroundDistance:i(217),RoundAwayFromZero:i(410),RoundTo:i(1141),SinCosTableGenerator:i(1140),SmootherStep:i(216),SmoothStep:i(215),TransformXY:i(409),Within:i(1139),Wrap:i(63),Vector2:i(3),Vector3:i(202),Vector4:i(1138),Matrix3:i(408),Matrix4:i(407),Quaternion:i(406),RotateVec3:i(1137)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n,s,r,o=i(26),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){t.exports={os:i(108),browser:i(138),features:i(207),input:i(1182),audio:i(1181),video:i(1180),fullscreen:i(1179),canvasFeatures:i(426)}},function(t,e,i){var n=i(0),s=i(30),r=i(427),o=i(1),a=i(4),h=i(8),l=i(425),u=i(2),c=i(201),d=i(212),f=new n({initialize:function(t){void 0===t&&(t={});this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.resolution=a(t,"resolution",1),this.parent=a(t,"parent",void 0),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!0),this.autoRound=a(t,"autoRound",!1),this.autoCenter=a(t,"autoCenter",0),this.resizeInterval=a(t,"resizeInterval",500),this.fullscreenTarget=a(t,"fullscreenTarget",null),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.resolution=a(e,"resolution",this.resolution),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"expandParent",this.expandParent),this.autoRound=a(e,"autoRound",this.autoRound),this.autoCenter=a(e,"autoCenter",this.autoCenter),this.resizeInterval=a(e,"resizeInterval",this.resizeInterval),this.fullscreenTarget=a(e,"fullscreenTarget",this.fullscreenTarget),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",s.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.customEnvironment=a(t,"customEnvironment",!1),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),l.RND=new l.RandomDataGenerator(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputKeyboardCapture=a(t,"input.keyboard.capture",[]),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMouseCapture=a(t,"input.mouse.capture",!0),this.inputTouch=a(t,"input.touch",r.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputSmoothFactor=a(t,"input.smoothFactor",0),this.inputQueue=a(t,"input.queue",!1),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio"),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.antialias=a(i,"antialias",!0),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",1!==this.zoom),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",2e3),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",u),this.postBoot=a(t,"callbacks.postBoot",u),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path",""),this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),p=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?p=f.default:Array.isArray(f.defaultMerge)&&(p=p.concat(f.defaultMerge)))),this.defaultPlugins=p;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=s.WEBGL:window.FORCE_CANVAS&&(this.renderType=s.CANVAS))}});t.exports=f},function(t,e,i){t.exports=i(1206)},function(t,e,i){t.exports={In:i(1209),Out:i(1208),InOut:i(1207)}},function(t,e,i){t.exports={In:i(1212),Out:i(1211),InOut:i(1210)}},function(t,e,i){t.exports={In:i(1215),Out:i(1214),InOut:i(1213)}},function(t,e,i){t.exports={In:i(1218),Out:i(1217),InOut:i(1216)}},function(t,e,i){t.exports=i(1219)},function(t,e,i){t.exports={In:i(1222),Out:i(1221),InOut:i(1220)}},function(t,e,i){t.exports={In:i(1225),Out:i(1224),InOut:i(1223)}},function(t,e,i){t.exports={In:i(1228),Out:i(1227),InOut:i(1226)}},function(t,e,i){t.exports={In:i(1231),Out:i(1230),InOut:i(1229)}},function(t,e,i){t.exports={In:i(1234),Out:i(1233),InOut:i(1232)}},function(t,e,i){t.exports={In:i(1237),Out:i(1236),InOut:i(1235)}},function(t,e,i){t.exports={Fade:i(1240),Flash:i(1239),Pan:i(1238),Shake:i(1205),Zoom:i(1204)}},function(t,e,i){var n=i(37);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,i){var n=i(37);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e){t.exports=function(t){return t>16777215?{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(37),s=i(444);t.exports=function(t){var e=s(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(ed.right&&(f=u(f,f+(g-d.right),this.lerp.x)),vd.bottom&&(p=u(p,p+(v-d.bottom),this.lerp.y))):(f=u(f,g-h,this.lerp.x),p=u(p,v-l,this.lerp.y))}this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.roundPixels&&(h=Math.round(h),l=Math.round(l)),this.scrollX=f,this.scrollY=p;var y=f+n,m=p+s;this.midPoint.set(y,m);var x=e/o,T=i/o;this.worldView.setTo(y-x/2,m-T/2,x,T),a.applyITRS(this.x+h,this.y+l,this.rotation,o,o),a.translate(-h,-l),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=o(i,0,1),n=o(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var a=this.width/2,h=this.height/2,l=t.x-s,u=t.y-r;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},function(t,e,i){var n=i(452),s=i(0),r=i(28),o=new s({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.html=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once(r.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","html","obj","tilemap","xml"],e=0;e-h&&(c-=h,n+=l),f=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,i){t.exports={CHANGE_DATA:i(1325),CHANGE_DATA_KEY:i(1324),REMOVE_DATA:i(1323),SET_DATA:i(1322)}},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,i){var n=i(20),s=i(46),r=i(221),o=i(220),a={_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 o(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=r(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},setRandomPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===n&&(n=this.scene.sys.scale.height),this.x=t+Math.random()*i,this.y=e+Math.random()*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},getLocalTransformMatrix:function(t){return void 0===t&&(t=new s),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new s),void 0===e&&(e=new s);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t}};t.exports=a},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){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,i){var n=new(i(0))({initialize:function(t,e){this.geometryMask=e,this.invertAlpha=!1},setShape:function(t){this.geometryMask=t},preRenderWebGL:function(t,e,i){var n=t.gl,s=this.geometryMask;t.flush(),n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.NOTEQUAL,1,1),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),s.renderWebGL(t,s,0,i),t.flush(),n.colorMask(!0,!0,!0,!0),this.invertAlpha?n.stencilFunc(n.NOTEQUAL,1,1):n.stencilFunc(n.EQUAL,1,1),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)},postRenderWebGL:function(t){var e=t.gl;t.flush(),e.disable(e.STENCIL_TEST)},preRenderCanvas:function(t,e,i){var n=this.geometryMask;t.currentContext.save(),n.renderCanvas(t,n,0,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){var i=t.sys.game.renderer;if(this.renderer=i,this.bitmapMask=e,this.maskTexture=null,this.mainTexture=null,this.dirty=!0,this.mainFramebuffer=null,this.maskFramebuffer=null,this.invertAlpha=!1,i&&i.gl){var n=i.width,s=i.height,r=0==(n&n-1)&&0==(s&s-1),o=i.gl,a=r?o.REPEAT:o.CLAMP_TO_EDGE,h=o.LINEAR;this.mainTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.maskTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.mainFramebuffer=i.createFramebuffer(n,s,this.mainTexture,!1),this.maskFramebuffer=i.createFramebuffer(n,s,this.maskTexture,!1),i.onContextRestored(function(t){var e=t.width,i=t.height,n=0==(e&e-1)&&0==(i&i-1),s=t.gl,r=n?s.REPEAT:s.CLAMP_TO_EDGE,o=s.LINEAR;this.mainTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.maskTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.mainFramebuffer=t.createFramebuffer(e,i,this.mainTexture,!1),this.maskFramebuffer=t.createFramebuffer(e,i,this.maskTexture,!1)},this)}},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BitmapMaskPipeline.beginMask(this,e,i)},postRenderWebGL:function(t){t.pipelines.BitmapMaskPipeline.endMask(this)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null;var t=this.renderer;t&&t.gl&&(t.deleteTexture(this.mainTexture),t.deleteTexture(this.maskTexture),t.deleteFramebuffer(this.mainFramebuffer),t.deleteFramebuffer(this.maskFramebuffer)),this.mainTexture=null,this.maskTexture=null,this.mainFramebuffer=null,this.maskFramebuffer=null,this.renderer=null}});t.exports=n},function(t,e,i){var n=i(464),s=i(463),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t){return void 0===t&&this.texture&&(t=this),new n(this.scene,t)},createGeometryMask:function(t){return void 0===t&&"Graphics"===this.type&&(t=this),new s(this.scene,t)}};t.exports=r},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x-e,a=t.y-i;return t.x=o*s-a*r+e,t.y=o*r+a*s+i,t}},function(t,e,i){var n=i(6);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(225),s=i(145);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=s(t)/i);for(var o=0;o=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},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},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t,e,i){if(!e.length)return NaN;if(1===e.length)return e[0];var n,s,r=1;if(i){if(te.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=i(226),s=i(0),r=i(146),o=new s({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.once(r.REMOVE_ANIMATION,this.remove,this),this.isPlaying=!1,this.currentAnim=null,this.currentFrame=null,this.nextAnim=null,this._timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this._delay=0,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this.forward=!0,this._reverse=!1,this.accumulator=0,this.nextTick=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},chain:function(t){return t instanceof n&&(t=t.key),this.nextAnim=t,this.parent},setDelay:function(t){return void 0===t&&(t=0),this._delay=t,this.parent},getDelay:function(){return this._delay},delayedPlay:function(t,e,i){return this.play(e,!0,i),this.nextTick+=t,this.parent},getCurrentKey:function(){if(this.currentAnim)return this.currentAnim.key},load:function(t,e){return void 0===e&&(e=0),this.isPlaying&&this.stop(),this.animationManager.load(this,t,e),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.updateFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.updateFrame(t),this.parent},isPaused:{get:function(){return this._paused}},play:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),t instanceof n&&(t=t.key),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!0,this._reverse=!1,this._startAnimation(t,i))},playReverse:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),t instanceof n&&(t=t.key),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!1,this._reverse=!0,this._startAnimation(t,i))},_startAnimation:function(t,e){this.load(t,e);var i=this.currentAnim,n=this.parent;this.repeatCounter=-1===this._repeat?Number.MAX_VALUE:this._repeat,i.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,i.showOnStart&&(n.visible=!0);var s=this.currentFrame;return i.emit(r.ANIMATION_START,i,s,n),n.emit(r.SPRITE_ANIMATION_KEY_START+t,i,s,n),n.emit(r.SPRITE_ANIMATION_START,i,s,n),n},reverse:function(){return this.isPlaying&&(this._reverse=!this._reverse,this.forward=!this.forward),this.parent},getProgress:function(){var t=this.currentFrame.progress;return this.forward||(t=1-t),t},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},remove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},getRepeat:function(){return this._repeat},setRepeat:function(t){return this._repeat=t,this.repeatCounter=0,this.parent},getRepeatDelay:function(){return this._repeatDelay},setRepeatDelay:function(t){return this._repeatDelay=t,this.parent},restart:function(t){void 0===t&&(t=!1);var e=this.currentAnim;e.getFirstTick(this,t),this.forward=!0,this.isPlaying=!0,this.pendingRepeat=!1,this._paused=!1,this.updateFrame(e.frames[0]);var i=this.parent,n=this.currentFrame;return e.emit(r.ANIMATION_RESTART,e,n,i),i.emit(r.SPRITE_ANIMATION_KEY_RESTART+e.key,e,n,i),i.emit(r.SPRITE_ANIMATION_RESTART,e,n,i),this.parent},stop:function(){this._pendingStop=0,this.isPlaying=!1;var t=this.parent,e=this.currentAnim,i=this.currentFrame;if(e&&(e.emit(r.ANIMATION_COMPLETE,e,i,t),t.emit(r.SPRITE_ANIMATION_KEY_COMPLETE+e.key,e,i,t),t.emit(r.SPRITE_ANIMATION_COMPLETE,e,i,t)),this.nextAnim){var n=this.nextAnim;this.nextAnim=null,this.play(n)}return t},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopOnRepeat:function(){return this._pendingStop=2,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},setTimeScale:function(t){return void 0===t&&(t=1),this._timeScale=t,this.parent},getTimeScale:function(){return this._timeScale},getTotalFrames:function(){return this.currentAnim.frames.length},update:function(t,e){if(this.currentAnim&&this.isPlaying&&!this.currentAnim.paused){if(this.accumulator+=e*this._timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.currentAnim.completeAnimation(this);this.accumulator>=this.nextTick&&this.currentAnim.setFrame(this)}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),e.setSizeToFrame(),t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin(),e},updateFrame:function(t){var e=this.setCurrentFrame(t);if(this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;e.emit(r.SPRITE_ANIMATION_KEY_UPDATE+i.key,i,t,e),e.emit(r.SPRITE_ANIMATION_UPDATE,i,t,e),3===this._pendingStop&&this._pendingStopValue===t&&this.currentAnim.completeAnimation(this)}},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},setYoyo:function(t){return void 0===t&&(t=!1),this._yoyo=t,this.parent},getYoyo:function(){return this._yoyo},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.remove,this),this.animationManager=null,this.parent=null,this.currentAnim=null,this.currentFrame=null}});t.exports=o},function(t,e,i){var n=i(24),s={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,s){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=n(t,0,1),this._alphaTR=n(e,0,1),this._alphaBL=n(i,0,1),this._alphaBR=n(s,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=n(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=n(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=n(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=n(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=n(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=s},function(t,e){t.exports=function(t){return Math.PI*t.radius*2}},function(t,e,i){var n=i(475),s=i(228),r=i(110),o=i(20);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h-1&&(e.state=h.REMOVED,s.splice(r,1)):(e.state=h.REMOVED,n.splice(r,1))}for(i.length=0,i=this._add,t=0;t-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&&(t.currentPipeline&&t.currentPipeline.vertexCount>0&&t.flush(),r.vertexBuffer=e.vertexBuffer[a],t.setPipeline(r),t.setTexture2D(s[a].glTexture,0),t.gl.drawArrays(r.topology,0,e.vertexCount[a]));r.vertexBuffer=o,r.viewIdentity(),r.modelIdentity()}},function(t,e,i){var n=i(2),s=i(2);n=i(513),s=i(512),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){t.exports=function(t,e,i,n,s){e.cull(n);var r=e.culledTiles,o=r.length;if(0!==o){var a=t._tempMatrix1,h=t._tempMatrix2,l=t._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(n.matrix);var u=t.currentContext,c=e.gidMap;u.save(),s?(a.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l),l.copyToContext(u)):(h.e-=n.scrollX*e.scrollFactorX,h.f-=n.scrollY*e.scrollFactorY,h.copyToContext(u));for(var d=n.alpha*e.alpha,f=0;f-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(21);t.exports=function(t){for(var e,i,s,r,o,a=0;a1){if(Array.isArray(l.tiles)){for(var c={},d={},f=0;f>>0;return n}},function(t,e,i){var n=i(526),s=i(1),r=i(93),o=i(245),a=i(67);t.exports=function(t,e){for(var i=[],h=0;h0){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,i){t.exports={Parse:i(248),Parse2DArray:i(154),ParseCSV:i(247),Impact:i(241),Tiled:i(246)}},function(t,e,i){var n=i(58),s=i(57),r=i(3);t.exports=function(t,e,i,o,a,h){return void 0===o&&(o=new r(0,0)),o.x=n(t,i,a,h),o.y=s(e,i,a,h),o}},function(t,e,i){var n=i(22);t.exports=function(t,e,i,s,r,o){if(void 0!==r){var a,h=n(t,e,i,s,null,o),l=0;for(a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e,i){var n=i(68),s=i(41),r=i(82);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;ae)){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(68),s=i(41),r=i(155);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;a=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;r=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);else if(2===r)for(a=x;a>=m;a--)for(o=v;c[a]&&o=m;a--)for(o=y;c[a]&&o>=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);return u.tilesDrawn=i.length,u.tilesTotal=d*f,i}},function(t,e,i){var n=i(116),s=i(115),r=i(22),o=i(251);t.exports=function(t,e,i,a,h,l){void 0===i&&(i={}),Array.isArray(t)||(t=[t]);var u=l.tilemapLayer;void 0===a&&(a=u.scene),void 0===h&&(h=a.cameras.main);var c,d=r(0,0,l.width,l.height,null,l),f=[];for(c=0;c=0&&p=0&&g=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(r.UPDATE,this.step,this),t.events.emit(r.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n),this},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(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)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(r.SHUTDOWN,this.shutdown,this),t.off(r.POST_UPDATE,this.step,this),t.off(r.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});a.register("ScenePlugin",h,"scenePlugin"),t.exports=h},function(t,e,i){var n=i(134),s=i(21),r={Events:i(16),SceneManager:i(363),ScenePlugin:i(563),Settings:i(360),Systems:i(194)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(21),s=i(196),r={Center:i(380),Events:i(365),Orientation:i(379),ScaleManager:i(366),ScaleModes:i(378),Zoom:i(377)};r=n(!1,r=n(!1,r=n(!1,r=n(!1,r,s.CENTER),s.ORIENTATION),s.SCALE_MODE),s.ZOOM),t.exports=r},function(t,e,i){t.exports={BitmapMaskPipeline:i(398),ForwardDiffuseLightPipeline:i(397),TextureTintPipeline:i(199)}},function(t,e,i){t.exports={Utils:i(10),WebGLPipeline:i(200),WebGLRenderer:i(400),Pipelines:i(566),BYTE:0,SHORT:1,UNSIGNED_BYTE:2,UNSIGNED_SHORT:3,FLOAT:4}},function(t,e,i){t.exports={Canvas:i(402),WebGL:i(399)}},function(t,e,i){t.exports={CanvasRenderer:i(403),GetBlendModes:i(401),SetTransform:i(25)}},function(t,e,i){t.exports={Canvas:i(569),Snapshot:i(568),WebGL:i(567)}},function(t,e,i){var n=i(252),s=i(0),r=i(16),o=new s({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){}});t.exports=o},function(t,e,i){t.exports={BasePlugin:i(252),DefaultPlugins:i(201),PluginCache:i(17),PluginManager:i(367),ScenePlugin:i(571)}},function(t,e,i){var n=i(160),s={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.13.1",silent:!0,install:function(t){t.after("Engine.update",function(){s.Engine.update(this)})},Engine:{update:function(t){for(var e=t.world,i=n.Composite.allBodies(e),r=n.Composite.allComposites(e),o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y0)for(var a=s+1;a1;if(!d||t!=d.x||e!=d.y){d&&n?(f=d.x,p=d.y):(f=0,p=0);var s={x:f+t,y:p+e};!n&&d||(d=s),g.push(s),y=f+t,m=p+e}},T=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":y=t.x,m=t.y;break;case"H":y=t.x;break;case"V":m=t.y}x(y,m,t.pathSegType)}};for(n._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i1?1:0;n0))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){t.exports=function(t,e,i,n){var s=e.pos.x+e.size.x-i.pos.x;if(n){var r=e===n?i:e;n.vel.x=-n.vel.x*n.bounciness+r.vel.x;var o=t.collisionMap.trace(n.pos.x,n.pos.y,n===e?-s:s,0,n.size.x,n.size.y);n.pos.x=o.pos.x}else{var a=(e.vel.x-i.vel.x)/2;e.vel.x=-a,i.vel.x=a;var h=t.collisionMap.trace(e.pos.x,e.pos.y,-s/2,0,e.size.x,e.size.y);e.pos.x=Math.floor(h.pos.x);var l=t.collisionMap.trace(i.pos.x,i.pos.y,s/2,0,i.size.x,i.size.y);i.pos.x=Math.ceil(l.pos.x)}}},function(t,e,i){var n=i(97),s=i(167),r=i(608),o=i(607);t.exports=function(t,e,i){var a=null;e.collides===n.LITE||i.collides===n.FIXED?a=e:i.collides!==n.LITE&&e.collides!==n.FIXED||(a=i),e.last.x+e.size.x>i.last.x&&e.last.xi.last.y&&e.last.y0&&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&&o0?e-o:e+o<0?e+o:0}return n(e,-r,r)}},function(t,e,i){t.exports={Body:i(270),Events:i(167),COLLIDES:i(97),CollisionMap:i(269),Factory:i(268),Image:i(266),ImpactBody:i(267),ImpactPhysics:i(610),Sprite:i(265),TYPE:i(96),World:i(264)}},function(t,e,i){var n=i(275);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){var n=i(276);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){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,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(632);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.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,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(634);t.exports=function(t,e,i,s,r){var o=0;return t.deltaX()<0&&!t.blocked.left&&e.collideRight&&t.checkCollision.left?e.faceRight&&t.x0&&!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,i){var n=i(635),s=i(633),r=i(272);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;a--){var h=e[a],l=o(s,r,h.x,h.y);l=0;a--){var h=e[a],l=o(s,r,h.x,h.y);l>i&&(n=h,i=l)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var o=Math.atan2(i-t.y,e-t.x);return s>0&&(n=r(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(o,n),o},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),void 0===i&&(i=new d),i.setToPolar(s(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new d),i.setToPolar(t,e)},shutdown:function(){if(this.world){var t=this.systems.events;t.off(c.UPDATE,this.world.update,this.world),t.off(c.POST_UPDATE,this.world.postUpdate,this.world),t.off(c.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off(c.START,this.start,this),this.scene=null,this.systems=null}});u.register("ArcadePhysics",p,"arcadePhysics"),t.exports=p},function(t,e,i){var n=i(42),s=i(21),r={ArcadePhysics:i(657),Body:i(279),Collider:i(277),Factory:i(285),Group:i(282),Image:i(284),Sprite:i(121),StaticBody:i(271),StaticGroup:i(281),World:i(280)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Arcade:i(658),Impact:i(629),Matter:i(606)}},function(t,e,i){var n=i(0),s=i(19),r=i(102),o=i(9),a=i(85),h=i(7),l=i(1),u=i(17),c=i(16),d=i(122),f=new n({Extends:o,initialize:function(t){o.call(this);var e=t.sys.game.config,i=t.sys.settings.loader;this.scene=t,this.systems=t.sys,this.cacheManager=t.sys.cache,this.textureManager=t.sys.textures,this.sceneManager=t.sys.game.scene,h.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(l(i,"baseURL",e.loaderBaseURL)),this.setPath(l(i,"path",e.loaderPath)),this.setPrefix(l(i,"prefix",e.loaderPrefix)),this.maxParallelDownloads=l(i,"maxParallelDownloads",e.loaderMaxParallelDownloads),this.xhr=d(l(i,"responseType",e.loaderResponseType),l(i,"async",e.loaderAsync),l(i,"user",e.loaderUser),l(i,"password",e.loaderPassword),l(i,"timeout",e.loaderTimeout)),this.crossOrigin=l(i,"crossOrigin",e.loaderCrossOrigin),this.totalToLoad=0,this.progress=0,this.list=new r,this.inflight=new r,this.queue=new r,this._deleteQueue=new r,this.totalFailed=0,this.totalComplete=0,this.state=s.LOADER_IDLE,t.sys.events.once(c.BOOT,this.boot,this),t.sys.events.on(c.START,this.pluginStart,this)},boot:function(){this.systems.events.once(c.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(c.SHUTDOWN,this.shutdown,this)},setBaseURL:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.baseURL=t,this},setPath:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.path=t,this},setPrefix:function(t){return void 0===t&&(t=""),this.prefix=t,this},setCORS:function(t){return this.crossOrigin=t,this},addFile:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(a.START,this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(c.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(a.PROGRESS,this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=s.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0&&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,i){var n=i(0),s=i(9),r=i(123),o=i(28),a=i(4),h=i(44),l=i(124),u=i(291),c=i(135),d=i(290),f=i(690),p=i(107),g=new n({Extends:s,initialize:function(t){s.call(this),this.game=t.systems.game,this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.manager=t.manager.keyboard,this.enabled=!0,this.keys=[],this.combos=[],t.pluginEvents.once(h.BOOT,this.boot,this),t.pluginEvents.on(h.START,this.start,this)},boot:function(){var t=this.settings.input;this.enabled=a(t,"keyboard",!0);var e=a(t,"keyboard.capture",null);e&&this.addCaptures(e),this.sceneInputPlugin.pluginEvents.once(h.DESTROY,this.destroy,this)},start:function(){this.sceneInputPlugin.manager.useQueue?this.sceneInputPlugin.pluginEvents.on(h.UPDATE,this.update,this):this.sceneInputPlugin.manager.events.on(h.MANAGER_PROCESS,this.update,this),this.sceneInputPlugin.pluginEvents.once(h.SHUTDOWN,this.shutdown,this),this.game.events.on(o.BLUR,this.resetKeys,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},addCapture:function(t){return this.manager.addCapture(t),this},removeCapture:function(t){return this.manager.removeCapture(t),this},getCaptures:function(){return this.manager.captures},enableGlobalCapture:function(){return this.manager.preventDefault=!0,this},disableGlobalCapture:function(){return this.manager.preventDefault=!1,this},clearCaptures:function(){return this.manager.clearCaptures(),this},createCursorKeys:function(){return this.addKeys({up:c.UP,down:c.DOWN,left:c.LEFT,right:c.RIGHT,space:c.SPACE,shift:c.SHIFT})},addKeys:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1);var n={};if("string"==typeof t){t=t.split(",");for(var s=0;s-1?n[s]=t:n[t.keyCode]=t,e&&this.addCapture(t.keyCode),t.setEmitOnRepeat(i),t}return"string"==typeof t&&(t=c[t.toUpperCase()]),n[t]||(n[t]=new u(t),e&&this.addCapture(t),n[t].setEmitOnRepeat(i)),n[t]},removeKey:function(t){var e=this.keys;if(t instanceof u){var i=e.indexOf(t);i>-1&&(this.keys[i]=void 0)}else"string"==typeof t&&(t=c[t.toUpperCase()]);return e[t]&&(e[t]=void 0),this},createCombo:function(t,e){return new d(this,t,e)},checkDown:function(t,e){if(this.enabled&&t.isDown){var i=p(this.time-t.timeDown,e);if(i>t._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n=e}}},function(t,e,i){var n=i(87),s=i(48),r=i(0),o=i(295),a=i(703),h=i(62),l=i(105),u=i(104),c=i(44),d=i(9),f=i(1),p=i(124),g=i(8),v=i(17),y=i(11),m=i(47),x=i(16),T=i(72),w=i(81),b=new r({Extends:d,initialize:function(t){d.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new d,this.enabled=!0,this.displayList,this.cameras,p.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],t.sys.events.once(x.BOOT,this.boot,this),t.sys.events.on(x.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(x.DESTROY,this.destroy,this),this.pluginEvents.emit(c.BOOT)},start:function(){var t=this.systems.events;t.on(x.TRANSITION_START,this.transitionIn,this),t.on(x.TRANSITION_OUT,this.transitionOut,this),t.on(x.TRANSITION_COMPLETE,this.transitionComplete,this),t.on(x.PRE_UPDATE,this.preUpdate,this),this.manager.useQueue&&t.on(x.UPDATE,this.update,this),t.once(x.SHUTDOWN,this.shutdown,this),this.manager.events.on(c.GAME_OUT,this.onGameOut,this),this.manager.events.on(c.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(c.START)},onGameOver:function(t){this.isActive()&&this.emit(c.GAME_OVER,t.timeStamp,t)},onGameOut:function(t){this.isActive()&&this.emit(c.GAME_OUT,t.timeStamp,t)},preUpdate:function(){this.pluginEvents.emit(c.PRE_UPDATE);var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,n=e.length;if(0!==i||0!==n){for(var s=this._list,r=0;r-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._pendingRemoval.length=0,this._list=s.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},update:function(t,e){if(this.isActive()){var i=this.manager;if(this.pluginEvents.emit(c.UPDATE,t,e),!i.globalTopOnly||!i.ignoreEvents){var n=i.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(n=!0,this._pollTimer=this.pollRate)),n)for(var s=this.manager.pointers,r=this.manager.pointersTotal,o=0;o0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}}},clear:function(t){var e=t.input;if(e){this.queueForRemoval(t),e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,this.manager.resetCursor(e),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&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,s}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,s=this._eventContainer;n.cancelled=!1;for(var r=!1,o=0;o0?this.setDragState(t,1):this.getDragState(t)>0&&!t.primaryDown&&t.justUp&&this.setDragState(t,5),1===this.getDragState(t)){var a=[];for(i=0;i1&&(this.sortGameObjects(a),this.topOnly&&a.splice(1)),this._drag[t.id]=a,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?this.setDragState(t,3):this.setDragState(t,2)}if(2===this.getDragState(t)&&(this.dragDistanceThreshold>0&&h(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&this.setDragState(t,3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&this.setDragState(t,3)),3===this.getDragState(t)){for(s=this._drag[t.id],i=0;i0?(n.emit(c.GAMEOBJECT_DRAG_LEAVE,t,r.target),this.emit(c.DRAG_LEAVE,t,n,r.target),r.target=l[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target)):(n.emit(c.GAMEOBJECT_DRAG_LEAVE,t,r.target),this.emit(c.DRAG_LEAVE,t,n,r.target),l[0]?(r.target=l[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target)):r.target=null)}else!r.target&&l[0]&&(r.target=l[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target));var d=t.x-n.input.dragX,f=t.y-n.input.dragY;n.emit(c.GAMEOBJECT_DRAG,t,d,f),this.emit(c.DRAG,t,n,d,f)}return s.length}if(5===this.getDragState(t)){for(s=this._drag[t.id],i=0;i0){for(this.sortGameObjects(s),e=0;e0){for(this.sortGameObjects(r),e=0;e-1&&this._draggable.splice(s,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return a(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,s=!1,r=!1,a=!1;if(g(e)){var h=e;e=f(h,"hitArea",null),i=f(h,"hitAreaCallback",null),n=f(h,"draggable",!1),s=f(h,"dropZone",!1),r=f(h,"cursor",!1),a=f(h,"useHandCursor",!1);var l=f(h,"pixelPerfect",!1),u=f(h,"alphaTolerance",1);l&&(e={},i=this.makePixelPerfect(u)),e&&i||this.setHitAreaFromTexture(t)}else"function"!=typeof e||i||(i=e,e={});for(var c=0;c0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)e.x&&t.ye.y}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},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,i){var n=Math.min(t.x,e),s=Math.max(t.right,e);t.x=n,t.width=s-n;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},function(t,e){t.exports=function(t,e){var i=Math.min(t.x,e.x),n=Math.max(t.right,e.right);t.x=i,t.width=n-i;var s=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=s,t.height=r-s,t}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;on(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,i){var n=i(173);t.exports=function(t,e){var i=n(t);return ii&&(i=h.x),h.xr&&(r=h.y),h.ye.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(81),s=i(125);t.exports=function(t,e){return!!(n(t,e.getPointA())||n(t,e.getPointB())||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},function(t,e,i){var n=i(307),s=i(81);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottomt.right+r||it.bottom+r||st.right||e.rightt.bottom||e.bottom0}},function(t,e,i){var n=i(306);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){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(11),s=i(176);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=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(62);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){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(11);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){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(104);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,i){var n=i(104);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(105);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(105);n.Area=i(816),n.Circumference=i(339),n.CircumferencePoint=i(184),n.Clone=i(815),n.Contains=i(104),n.ContainsPoint=i(814),n.ContainsRect=i(813),n.CopyFrom=i(812),n.Equals=i(811),n.GetBounds=i(810),n.GetPoint=i(341),n.GetPoints=i(340),n.Offset=i(809),n.OffsetPoint=i(808),n.Random=i(219),t.exports=n},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(11);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){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e,i){var n=i(48);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,i){var n=i(48);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(87);t.exports=function(t){return new n(t.x,t.y,t.radius)}},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(87);n.Area=i(826),n.Circumference=i(475),n.CircumferencePoint=i(228),n.Clone=i(825),n.Contains=i(48),n.ContainsPoint=i(824),n.ContainsRect=i(823),n.CopyFrom=i(822),n.Equals=i(821),n.GetBounds=i(820),n.GetPoint=i(477),n.GetPoints=i(476),n.Offset=i(819),n.OffsetPoint=i(818),n.Random=i(227),t.exports=n},function(t,e,i){var n=i(0),s=i(310),r=i(17),o=i(16),a=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once(o.BOOT,this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on(o.SHUTDOWN,this.shutdown,this),t.on(o.DESTROY,this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",a,"lights"),t.exports=a},function(t,e,i){var n=i(34),s=i(15),r=i(13),o=i(177);s.register("quad",function(t,e){void 0===t&&(t={});var i=r(t,"x",0),s=r(t,"y",0),a=r(t,"key",null),h=r(t,"frame",null),l=new o(this.scene,i,s,a,h);return void 0!==e&&(t.add=e),n(this.scene,l,t),l})},function(t,e,i){var n=i(34),s=i(15),r=i(13),o=i(4),a=i(126);s.register("mesh",function(t,e){void 0===t&&(t={});var i=r(t,"key",null),s=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"colors",[]),u=o(t,"alphas",[]),c=o(t,"uv",[]),d=new a(this.scene,0,0,h,c,l,u,i,s);return void 0!==e&&(t.add=e),n(this.scene,d,t),d})},function(t,e,i){var n=i(177);i(5).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(126);i(5).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){t.exports=function(){}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=this.pipeline;t.setPipeline(o,e);var a=o._tempMatrix1,h=o._tempMatrix2,l=o._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(s.matrix),r?(a.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l)):(h.e-=s.scrollX*e.scrollFactorX,h.f-=s.scrollY*e.scrollFactorY,a.multiply(h,l));var u=e.frame.glTexture,c=e.vertices,d=e.uv,f=e.colors,p=e.alphas,g=c.length,v=Math.floor(.5*g);o.vertexCount+v>o.vertexCapacity&&o.flush(),o.setTexture2D(u,0);for(var y=o.vertexViewF32,m=o.vertexViewU32,x=o.vertexCount*o.vertexComponentCount-1,T=0,w=e.tintFill,b=0;b0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.fillColor,e.fillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,C=0;C0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.altFillColor,e.altFillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,C=0;C0){var R=o.strokeTint,L=n.getTintAppendFloatAlphaAndSwap(e.outlineFillColor,e.outlineFillAlpha*d);for(R.TL=L,R.TR=L,R.BL=L,R.BR=L,E=1;Er;h--){for(l=0;l2?o[a++]:"",n=o[a++]||"16px",i=o[a++]||"Courier"}return i===this.fontFamily&&n===this.fontSize&&s===this.fontStyle||(this.fontFamily=i,this.fontSize=n,this.fontStyle=s,e&&this.update(!0)),this.parent},setFontFamily:function(t){return this.fontFamily!==t&&(this.fontFamily=t,this.update(!0)),this.parent},setFontStyle:function(t){return this.fontStyle!==t&&(this.fontStyle=t,this.update(!0)),this.parent},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize!==t&&(this.fontSize=t,this.update(!0)),this.parent},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.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)},setResolution:function(t){return this.resolution=t,this.update(!1)},setStroke:function(t,e){return void 0===e&&(e=this.strokeThickness),void 0===t&&0!==this.strokeThickness?(this.strokeThickness=0,this.update(!0)):this.stroke===t&&this.strokeThickness===e||(this.stroke=t,this.strokeThickness=e,this.update(!0)),this.parent},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){t.exports=function(t,e,i,n,s){""!==e.text&&t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){if(""!==e.text){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r)}}},function(t,e,i){var n=i(2),s=i(2);n=i(914),s=i(913),t.exports={renderWebGL:n,renderCanvas:s}},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.maxLines1&&(d+=f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(4);t.exports=function(t,e){var i=e.width,s=e.height,r=Math.floor(i/2),o=Math.floor(s/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),l=n(e,"offset.x",0),u=n(e,"offset.y",0),c=n(e,"spacing.x",0),d=n(e,"spacing.y",0),f=n(e,"lineSpacing",0),p=n(e,"charsPerRow",null);null===p&&(p=t.sys.textures.getFrame(h).width/i)>a.length&&(p=a.length);for(var g=l,v=u,y={retroFont:!0,font:h,size:i,lineHeight:s+f,chars:{}},m=0,x=0;x?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(918),s=i(21),r={Parse:i(917)};r=s(!1,r,n),t.exports=r},function(t,e){t.exports=function(t,e,i,n,s){t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a,h,e.scaleX,e.scaleY,e.rotation,e.flipX,!e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r),t.setBlankTexture(!0)}},function(t,e,i){var n=i(2),s=i(2);n=i(921),s=i(920),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){t.exports={DeathZone:i(334),EdgeZone:i(333),RandomZone:i(331)}},function(t,e){t.exports=function(t,e,i,n,s){var r=e.emitters.list,o=r.length;if(0!==o){var a=t._tempMatrix1.copyFrom(n.matrix),h=t._tempMatrix2,l=t._tempMatrix3,u=t._tempMatrix4.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);a.multiply(u);var c=n.roundPixels,d=t.currentContext;d.save();for(var f=0;f0&&(Y=Y%b-b):Y>b?Y=b:Y<0&&(Y=b+Y%b),null===E&&(E=new o(I+Math.cos(N)*B,k+Math.sin(N)*B,v),S.push(E),F+=.01);F<1+z;)w=Y*F+N,x=I+Math.cos(w)*B,T=k+Math.sin(w)*B,E.points.push(new r(x,T,v)),F+=.01;w=Y+N,x=I+Math.cos(w)*B,T=k+Math.sin(w)*B,E.points.push(new r(x,T,v));break;case n.FILL_RECT:u.setTexture2D(M),u.batchFillRect(p[++P],p[++P],p[++P],p[++P],f,c);break;case n.FILL_TRIANGLE:u.setTexture2D(M),u.batchFillTriangle(p[++P],p[++P],p[++P],p[++P],p[++P],p[++P],f,c);break;case n.STROKE_TRIANGLE:u.setTexture2D(M),u.batchStrokeTriangle(p[++P],p[++P],p[++P],p[++P],p[++P],p[++P],v,f,c);break;case n.LINE_TO:null!==E?E.points.push(new r(p[++P],p[++P],v)):(E=new o(p[++P],p[++P],v),S.push(E));break;case n.MOVE_TO:E=new o(p[++P],p[++P],v),S.push(E);break;case n.SAVE:a.push(f.copyToArray());break;case n.RESTORE:f.copyFromArray(a.pop());break;case n.TRANSLATE:I=p[++P],k=p[++P],f.translate(I,k);break;case n.SCALE:I=p[++P],k=p[++P],f.scale(I,k);break;case n.ROTATE:f.rotate(p[++P]);break;case n.SET_TEXTURE:var U=p[++P],G=p[++P];u.currentFrame=U,u.setTexture2D(U.glTexture,0),u.tintEffect=G,M=U.glTexture;break;case n.CLEAR_TEXTURE:u.currentFrame=t.blankTexture,u.tintEffect=2,M=t.blankTexture.glTexture}}}},function(t,e,i){var n=i(2),s=i(2);n=i(935),s=i(338),s=i(338),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){},function(t,e){t.exports=function(t,e,i,n,s){var r=t.currentPipeline;t.clearPipeline();var o=t._tempMatrix1,a=t._tempMatrix2,h=t._tempMatrix3;a.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),o.copyFrom(n.matrix),s?(o.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),a.e=e.x,a.f=e.y,o.multiply(a,h)):(a.e-=n.scrollX*e.scrollFactorX,a.f-=n.scrollY*e.scrollFactorY,o.multiply(a,h)),e.render.call(e,t,n,h),t.rebindPipeline(r)}},function(t,e,i){var n=i(2),s=i(2);n=i(938),s=i(937),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(25);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length,h=t.currentContext;if(0!==a&&n(t,h,e,s,r)){var l=e.frame,u=e.displayCallback,c=e.callbackData,d=s.scrollX*e.scrollFactorX,f=s.scrollY*e.scrollFactorY,p=e.fontData.chars,g=e.fontData.lineHeight,v=0,y=0,m=0,x=0,T=null,w=0,b=0,S=0,A=0,_=0,E=0,C=null,M=0,P=e.frame.source.image,O=l.cutX,R=l.cutY,L=0,D=e.fontSize/e.fontData.size;e.cropWidth>0&&e.cropHeight>0&&(h.beginPath(),h.rect(0,0,e.cropWidth,e.cropHeight),h.clip());for(var F=0;F0||e.cropHeight>0;l&&(h.flush(),t.pushScissor(e.x,e.y,e.cropWidth*e.scaleX,e.cropHeight*e.scaleY));var u=h._tempMatrix1,c=h._tempMatrix2,d=h._tempMatrix3,f=h._tempMatrix4;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(s.matrix),r?(u.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d)):(c.e-=s.scrollX*e.scrollFactorX,c.f-=s.scrollY*e.scrollFactorY,u.multiply(c,d));var p=e.frame,g=p.glTexture,v=p.cutX,y=p.cutY,m=g.width,x=g.height,T=e._isTinted&&e.tintFill,w=n.getTintAppendFloatAlpha(e._tintTL,s.alpha*e._alphaTL),b=n.getTintAppendFloatAlpha(e._tintTR,s.alpha*e._alphaTR),S=n.getTintAppendFloatAlpha(e._tintBL,s.alpha*e._alphaBL),A=n.getTintAppendFloatAlpha(e._tintBR,s.alpha*e._alphaBR);h.setTexture2D(g,0);var _,E,C=0,M=0,P=0,O=0,R=e.letterSpacing,L=0,D=0,F=0,I=0,k=e.scrollX,B=e.scrollY,N=e.fontData,Y=N.chars,X=N.lineHeight,z=e.fontSize/N.size,U=0,G=e._align,W=0,V=0;e.getTextBounds(!1);var H=e._bounds.lines;1===G?V=(H.longest-H.lengths[0])/2:2===G&&(V=H.longest-H.lengths[0]);for(var j=s.roundPixels,q=e.displayCallback,K=e.callbackData,J=0;Jv&&(r=v),o>y&&(o=y);var O=v+g.xAdvance,R=y+u;a_&&(_=C),C_&&(_=C),C-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;i0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e),s=t.indexOf(i);return-1!==n&&-1===s&&(t[n]=i,!0)}},function(t,e,i){var n=i(106);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return n(t,s)}},function(t,e,i){var n=i(74);t.exports=function(t,e,i,s,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(s)for(var h=0;ht.length-1)throw new Error("Index out of bounds");var r=n(t,e);return i&&i.call(s,r),r}},function(t,e,i){var n=i(410);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var s=[],r=Math.max(n((e-t)/(i||1)),0),o=0;o=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var n=t[i-1],s=t.indexOf(n);t[i]=n,t[s]=e}return t}},function(t,e,i){var n=i(74);t.exports=function(t,e,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=t.length),n(t,s,r))for(var o=s;o0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),s&&s.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),s&&s.call(r,l)}return e}},function(t,e){t.exports=function(t,e,i,n,s){if(void 0===s&&(s=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(s,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.pop(),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;ax||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var E=l,C=l,M=0,P=e.sourceIndex,O=0;Og||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,T=0;Tr&&(m=w-r),b>o&&(x=b-o),t.add(T,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(76);t.exports=function(t,e,i){if(i.frames){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);var r,o=i.frames;for(var a in o){var h=o[a];r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h),h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted()),r.customData=n(h)}for(var l in i)"frames"!==l&&(Array.isArray(i[l])?t.customData[l]=i[l].slice(0):t.customData[l]=i[l]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},function(t,e,i){var n=i(76);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;a-1){var o=this.context.getImageData(t,e,1,1);o.data[0]=i,o.data[1]=n,o.data[2]=s,o.data[3]=r,this.context.putImageData(o,t,e)}return this},putData:function(t,e,i,n,s,r,o){return void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=t.width),void 0===o&&(o=t.height),this.context.putImageData(t,e,i,n,s,r,o),this},getData:function(t,e,i,n){return t=s(Math.floor(t),0,this.width-1),e=s(Math.floor(e),0,this.height-1),i=s(i,1,this.width-t),n=s(n,1,this.height-e),this.context.getImageData(t,e,i,n)},getPixel:function(t,e,i){i||(i=new r);var n=this.getIndex(t,e);if(n>-1){var s=this.data,o=s[n+0],a=s[n+1],h=s[n+2],l=s[n+3];i.setTo(o,a,h,l)}return i},getPixels:function(t,e,i,n){void 0===n&&(n=i),t=Math.abs(Math.round(t)),e=Math.abs(Math.round(e));for(var o=s(t,0,this.width),a=s(t+i,0,this.width),h=s(e,0,this.height),l=s(e+n,0,this.height),u=new r,c=[],d=h;d>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e){t.exports=function(t,e){void 0===e&&(e="none");return["-webkit-","-khtml-","-moz-","-ms-",""].forEach(function(i){t.style[i+"user-select"]=e}),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},function(t,e,i){t.exports={CanvasInterpolation:i(404),CanvasPool:i(26),Smoothing:i(140),TouchAction:i(1094),UserSelect:i(1093)}},function(t,e){t.exports=function(t){return t.height*t.originY}},function(t,e){t.exports=function(t){return t.width*t.originX}},function(t,e,i){t.exports={CenterOn:i(483),GetBottom:i(56),GetCenterX:i(91),GetCenterY:i(88),GetLeft:i(54),GetOffsetX:i(1097),GetOffsetY:i(1096),GetRight:i(52),GetTop:i(50),SetBottom:i(55),SetCenterX:i(90),SetCenterY:i(89),SetLeft:i(53),SetRight:i(51),SetTop:i(49)}},function(t,e,i){var n=i(52),s=i(50),r=i(55),o=i(51);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(54),s=i(50),r=i(55),o=i(53);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)-a),t}},function(t,e,i){var n=i(91),s=i(50),r=i(55),o=i(90);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(52),s=i(50),r=i(53),o=i(49);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(88),s=i(52),r=i(89),o=i(53);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(56),s=i(52),r=i(55),o=i(53);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(54),s=i(50),r=i(51),o=i(49);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(88),s=i(54),r=i(89),o=i(51);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(56),s=i(54),r=i(55),o=i(51);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(56),s=i(52),r=i(51),o=i(49);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){var n=i(56),s=i(54),r=i(53),o=i(49);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)+a),t}},function(t,e,i){var n=i(56),s=i(91),r=i(90),o=i(49);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){t.exports={BottomCenter:i(1110),BottomLeft:i(1109),BottomRight:i(1108),LeftBottom:i(1107),LeftCenter:i(1106),LeftTop:i(1105),RightBottom:i(1104),RightCenter:i(1103),RightTop:i(1102),TopCenter:i(1101),TopLeft:i(1100),TopRight:i(1099)}},function(t,e,i){t.exports={BottomCenter:i(487),BottomLeft:i(486),BottomRight:i(485),Center:i(484),LeftCenter:i(482),QuickSet:i(488),RightCenter:i(481),TopCenter:i(480),TopLeft:i(479),TopRight:i(478)}},function(t,e,i){var n=i(229),s=i(21),r={In:i(1112),To:i(1111)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Align:i(1113),Bounds:i(1098),Canvas:i(1095),Color:i(385),Masks:i(1086)}},function(t,e,i){var n=i(0),s=i(109),r=i(17),o=i(16),a=new n({Extends:s,initialize:function(t){s.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.events=this.systems.events,this.events.once(o.DESTROY,this.destroy,this)},start:function(){this.events.once(o.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.systems.events.off(o.SHUTDOWN,this.shutdown,this)},destroy:function(){s.prototype.destroy.call(this),this.events.off(o.START,this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",a,"data"),t.exports=a},function(t,e,i){t.exports={DataManager:i(109),DataManagerPlugin:i(1115),Events:i(458)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e){this.active=!1,this.p0=new s(t,e)},getPoint:function(t,e){return void 0===e&&(e=new s),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},function(t,e,i){var n=i(0),s=i(390),r=i(389),o=i(5),a=i(388),h=i(1117),l=i(387),u=i(11),c=i(386),d=i(3),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,n),h=new d(r,o),l=new d(t,e)),this.add(new s(u,a,h,l))},quadraticBezierTo:function(t,e,i,n){var s,r,o=this.getEndPoint();return t instanceof d?(s=t,r=e):(s=new d(i,n),r=new d(t,e)),this.add(new l(o,s,r))},draw:function(t,e){for(var i=0;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;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){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},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;o1?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,i){return Math.max(t-e,i)}},function(t,e){t.exports=function(t,e,i){return Math.min(t+e,i)}},function(t,e){t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t,e){return t/e/1e3}},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.floor(t*n)/n}},function(t,e){t.exports=function(t,e){return Math.abs(t-e)}},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.ceil(t*n)/n}},function(t,e){t.exports=function(t){for(var e=0,i=0;i>>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;e0;e--){var i=Math.floor(this.frac()*(e+1)),n=t[i];t[i]=t[e],t[e]=n}return t}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.round(t/e),n?(i+t)/e:i+t)}},function(t,e,i){t.exports={Ceil:i(413),Floor:i(107),To:i(1156)}},function(t,e){t.exports=function(t){return t>0&&0==(t&t-1)}},function(t,e,i){t.exports={GetNext:i(414),IsSize:i(137),IsValue:i(1158)}},function(t,e,i){var n=i(216);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){var n=i(139);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,i){var n=i(205);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return t[0]===t[i]?(e<0&&(r=Math.floor(s=i*(1+e))),n(s-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(n(-s,t[0],t[0],t[1],t[1])-t[0]):e>1?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[i=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e=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,i){var n=i(108),s=i(138),r={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=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){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,l=[],u=!1,c=-1;function d(){u&&h&&(u=!1,h.length?l=h.concat(l):c=-1,l.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=l.length;e;){for(h=l,l=[];++c1)for(var i=1;i0&&(o.preRender(1),t.render(n,e,i,o))}},resetAll:function(){for(var t=0;t=1?1:1/e*(1+(e*t|0))}},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){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:1-Math.cos(t*Math.PI/2)}},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--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return t*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 1- --t*t*t*t}},function(t,e){t.exports=function(t){return t*t*t*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*(2-t)}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return 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 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},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,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),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},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){return--t*t*t+1}},function(t,e){t.exports=function(t){return t*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 Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},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 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){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,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,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e,i){var n=i(24),s=i(0),r=i(208),o=i(45),a=i(3),h=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new a,this.current=new a,this.destination=new a,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,a,h){void 0===i&&(i=1e3),void 0===n&&(n=r.Linear),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene);var l=this.camera;return!s&&this.isRunning?l:(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(l.scrollX,l.scrollY),this.destination.set(t,e),l.getScroll(t,e,this.current),"string"==typeof n&&r.hasOwnProperty(n)?this.ease=r[n]:"function"==typeof n&&(this.ease=n),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.camera.emit(o.PAN_START,this.camera,this,i,t,e),l)},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var s=this.camera;if(this._elapsed0?(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){var n=i(0),s=i(4),r=new n({initialize:function(t){this.camera=s(t,"camera",null),this.left=s(t,"left",null),this.right=s(t,"right",null),this.up=s(t,"up",null),this.down=s(t,"down",null),this.zoomIn=s(t,"zoomIn",null),this.zoomOut=s(t,"zoomOut",null),this.zoomSpeed=s(t,"zoomSpeed",.01),this.speedX=0,this.speedY=0;var e=s(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=s(t,"speed.x",0),this.speedY=s(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoom<.1&&(e.zoom=.1)):this.zoomOut&&this.zoomOut.isDown&&(e.zoom+=this.zoomSpeed)}},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={FixedKeyControl:i(1258),SmoothedKeyControl:i(1257)}},function(t,e,i){t.exports={Controls:i(1259),Scene2D:i(1256)}},function(t,e){t.exports="remove"},function(t,e){t.exports="add"},function(t,e,i){t.exports={BaseCache:i(452),CacheManager:i(450),Events:i(451)}},function(t,e){t.exports="visible"},function(t,e){t.exports="step"},function(t,e){t.exports="resume"},function(t,e){t.exports="ready"},function(t,e){t.exports="prestep"},function(t,e){t.exports="prerender"},function(t,e){t.exports="poststep"},function(t,e){t.exports="postrender"},function(t,e){t.exports="pause"},function(t,e){t.exports="hidden"},function(t,e){t.exports="focus"},function(t,e){t.exports="destroy"},function(t,e){t.exports="boot"},function(t,e){t.exports="blur"},function(t,e,i){t.exports={Animation:i(226),AnimationFrame:i(471),AnimationManager:i(453),Events:i(146)}},function(t,e,i){var n=i(63);t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=0;s1)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?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,_isTinted:!1,tintFill:!1,clearTint:function(){return this.setTint(16777215),this._isTinted=!1,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._isTinted=!0,this.tintFill=!1,this},setTintFill:function(t,e,i,n){return this.setTint(t,e,i,n),this.tintFill=!0,this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t),this._isTinted=!0}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t),this._isTinted=!0}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t),this._isTinted=!0}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t),this._isTinted=!0}},tint:{set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){return this._isTinted}}};t.exports=n},function(t,e){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},function(t,e){var i={texture:null,frame:null,isCropped:!1,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),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,i){var n=i(111),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={_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(11),s=i(466),r=i(3),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,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getTopRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomLeft:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBounds:function(t){var e,i,s,r,o,a,h,l;if(void 0===t&&(t=new n),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),s=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),s=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),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){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){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},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}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},function(t,e){t.exports="animationupdate"},function(t,e){t.exports="animationstart"},function(t,e){t.exports="animationrestart"},function(t,e){t.exports="animationrepeat"},function(t,e){t.exports="animationupdate-"},function(t,e){t.exports="animationstart-"},function(t,e){t.exports="animationrestart-"},function(t,e){t.exports="animationrepeat-"},function(t,e){t.exports="animationcomplete-"},function(t,e){t.exports="animationcomplete"},function(t,e){t.exports="resumeall"},function(t,e){t.exports="remove"},function(t,e){t.exports="pauseall"},function(t,e){t.exports="start"},function(t,e){t.exports="restart"},function(t,e){t.exports="repeat"},function(t,e){t.exports="complete"},function(t,e){t.exports="add"},function(t,e,i){var n=i(488),s=i(229),r=i(1),o=i(2),a=new(i(147))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1);t.exports=function(t,e){void 0===e&&(e={});var i=r(e,"width",-1),o=r(e,"height",-1),h=r(e,"cellWidth",1),l=r(e,"cellHeight",h),u=r(e,"position",s.TOP_LEFT),c=r(e,"x",0),d=r(e,"y",0),f=0,p=0,g=i*h,v=o*l;a.setPosition(c,d),a.setSize(h,l);for(var y=0;y>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -323,7 +338,7 @@ module.exports = Class; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -350,7 +365,7 @@ module.exports = NOOP; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -393,7 +408,7 @@ module.exports = GetFastValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -856,14 +871,14 @@ var Vector2 = new Class({ }, /** - * [description] + * Calculate the cross product of this Vector and the given Vector. * * @method Phaser.Math.Vector2#cross * @since 3.0.0 * - * @param {Phaser.Math.Vector2} src - [description] + * @param {Phaser.Math.Vector2} src - The Vector2 to cross with this Vector2. * - * @return {number} [description] + * @return {number} The cross product of this Vector and the given Vector. */ cross: function (src) { @@ -960,14 +975,76 @@ var Vector2 = new Class({ /** * A static zero Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. * * @constant * @name Phaser.Math.Vector2.ZERO - * @type {Vector2} + * @type {Phaser.Math.Vector2} * @since 3.1.0 */ Vector2.ZERO = new Vector2(); +/** + * A static right Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.RIGHT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.RIGHT = new Vector2(1, 0); + +/** + * A static left Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.LEFT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.LEFT = new Vector2(-1, 0); + +/** + * A static up Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.UP + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.UP = new Vector2(0, -1); + +/** + * A static down Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.DOWN + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.DOWN = new Vector2(0, 1); + +/** + * A static one Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.ONE + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.ONE = new Vector2(1, 1); + module.exports = Vector2; @@ -977,7 +1054,7 @@ module.exports = Vector2; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1007,7 +1084,7 @@ var GetValue = function (source, key, defaultValue) { return source[key]; } - else if (key.indexOf('.')) + else if (key.indexOf('.') !== -1) { var keys = key.split('.'); var parent = source; @@ -1048,12 +1125,13 @@ module.exports = GetValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -1116,8 +1194,8 @@ var GameObjectFactory = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -1133,7 +1211,7 @@ var GameObjectFactory = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -1147,7 +1225,7 @@ var GameObjectFactory = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1188,7 +1266,7 @@ var GameObjectFactory = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1203,7 +1281,7 @@ var GameObjectFactory = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -1235,7 +1313,7 @@ module.exports = GameObjectFactory; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1316,12 +1394,16 @@ module.exports = Point; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var types = {}; +/** + * @namespace Phaser.Loader.FileTypesManager + */ + var FileTypesManager = { /** @@ -1330,7 +1412,7 @@ var FileTypesManager = { * Loops through the local types object and injects all of them as * properties into the LoaderPlugin instance. * - * @method Phaser.Loader.FileTypesManager.register + * @method Phaser.Loader.FileTypesManager.install * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. @@ -1381,7 +1463,7 @@ module.exports = FileTypesManager; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -1433,20 +1515,155 @@ module.exports = IsPlainObject; /***/ }), /* 9 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.WebGL.Utils + * @since 3.0.0 + */ +module.exports = { + + /** + * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats + * @since 3.0.0 + * + * @param {number} r - Red component in a range from 0.0 to 1.0 + * @param {number} g - Green component in a range from 0.0 to 1.0 + * @param {number} b - Blue component in a range from 0.0 to 1.0 + * @param {number} a - Alpha component in a range from 0.0 to 1.0 + * + * @return {number} [description] + */ + getTintFromFloats: function (r, g, b, a) + { + var ur = ((r * 255.0)|0) & 0xFF; + var ug = ((g * 255.0)|0) & 0xFF; + var ub = ((b * 255.0)|0) & 0xFF; + var ua = ((a * 255.0)|0) & 0xFF; + + return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlpha: function (rgb, a) + { + var ua = ((a * 255.0)|0) & 0xFF; + return ((ua << 24) | rgb) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a + * swizzled Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlphaAndSwap: function (rgb, a) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + var ua = ((a * 255.0)|0) & 0xFF; + + return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; + }, + + /** + * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 + * + * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB + * @since 3.0.0 + * + * @param {number} rgb - RGB packed as a Uint24 + * + * @return {array} Array of floats representing each component as a float + */ + getFloatsFromUintRGB: function (rgb) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + + return [ ur / 255.0, ug / 255.0, ub / 255.0 ]; + }, + + /** + * Counts how many attributes of 32 bits a vertex has + * + * @function Phaser.Renderer.WebGL.Utils.getComponentCount + * @since 3.0.0 + * + * @param {array} attributes - Array of attributes + * @param {WebGLRenderingContext} glContext - WebGLContext used for check types + * + * @return {number} Count of 32 bit attributes in vertex + */ + getComponentCount: function (attributes, glContext) + { + var count = 0; + + for (var index = 0; index < attributes.length; ++index) + { + var element = attributes[index]; + + if (element.type === glContext.FLOAT) + { + count += element.size; + } + else + { + count += 1; // We'll force any other type to be 32 bit. for now + } + } + + return count; + } + +}; + + +/***/ }), +/* 10 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(39); -var GetPoint = __webpack_require__(190); -var GetPoints = __webpack_require__(398); -var Line = __webpack_require__(54); -var Random = __webpack_require__(187); +var Contains = __webpack_require__(42); +var GetPoint = __webpack_require__(204); +var GetPoints = __webpack_require__(430); +var Line = __webpack_require__(59); +var Random = __webpack_require__(201); /** * @classdesc @@ -1930,141 +2147,6 @@ var Rectangle = new Class({ module.exports = Rectangle; -/***/ }), -/* 10 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.Renderer.WebGL.Utils - * @since 3.0.0 - */ -module.exports = { - - /** - * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats - * @since 3.0.0 - * - * @param {number} r - Red component in a range from 0.0 to 1.0 - * @param {number} g - [description] - * @param {number} b - [description] - * @param {number} a - Alpha component in a range from 0.0 to 1.0 - * - * @return {number} [description] - */ - getTintFromFloats: function (r, g, b, a) - { - var ur = ((r * 255.0)|0) & 0xFF; - var ug = ((g * 255.0)|0) & 0xFF; - var ub = ((b * 255.0)|0) & 0xFF; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlpha: function (rgb, a) - { - var ua = ((a * 255.0)|0) & 0xFF; - return ((ua << 24) | rgb) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a - * swizzled Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlphaAndSwap: function (rgb, a) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; - }, - - /** - * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 - * - * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB - * @since 3.0.0 - * - * @param {number} rgb - RGB packed as a Uint24 - * - * @return {array} Array of floats representing each component as a float - */ - getFloatsFromUintRGB: function (rgb) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - - return [ ur / 255.0, ug / 255.0, ub / 255.0 ]; - }, - - /** - * Counts how many attributes of 32 bits a vertex has - * - * @function Phaser.Renderer.WebGL.Utils.getComponentCount - * @since 3.0.0 - * - * @param {array} attributes - Array of attributes - * @param {WebGLRenderingContext} glContext - WebGLContext used for check types - * - * @return {number} Count of 32 bit attributes in vertex - */ - getComponentCount: function (attributes, glContext) - { - var count = 0; - - for (var index = 0; index < attributes.length; ++index) - { - var element = attributes[index]; - - if (element.type === glContext.FLOAT) - { - count += element.size; - } - else - { - count += 1; // We'll force any other type to be 32 bit. for now - } - } - - return count; - } - -}; - - /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { @@ -2414,51 +2496,52 @@ if (true) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH = __webpack_require__(16); +var MATH = __webpack_require__(20); var GetValue = __webpack_require__(4); -// Allowed types: - -// Implicit -// { -// x: 4 -// } -// -// From function -// { -// x: function () -// } -// -// Randomly pick one element from the array -// { -// x: [a, b, c, d, e, f] -// } -// -// Random integer between min and max: -// { -// x: { randInt: [min, max] } -// } -// -// Random float between min and max: -// { -// x: { randFloat: [min, max] } -// } - /** - * [description] + * Retrieves a value from an object. Allows for more advanced selection options, including: + * + * Allowed types: + * + * Implicit + * { + * x: 4 + * } + * + * From function + * { + * x: function () + * } + * + * Randomly pick one element from the array + * { + * x: [a, b, c, d, e, f] + * } + * + * Random integer between min and max: + * { + * x: { randInt: [min, max] } + * } + * + * Random float between min and max: + * { + * x: { randFloat: [min, max] } + * } + * * * @function Phaser.Utils.Objects.GetAdvancedValue * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] - * @param {*} defaultValue - [description] + * @param {object} source - The object to retrieve the value from. + * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. + * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. * - * @return {*} [description] + * @return {*} The value of the requested key. */ var GetAdvancedValue = function (source, key, defaultValue) { @@ -2500,12 +2583,54 @@ module.exports = GetAdvancedValue; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Components + */ + +module.exports = { + + Alpha: __webpack_require__(435), + Animation: __webpack_require__(460), + BlendMode: __webpack_require__(432), + ComputedSize: __webpack_require__(1248), + Crop: __webpack_require__(1247), + Depth: __webpack_require__(431), + Flip: __webpack_require__(1246), + GetBounds: __webpack_require__(1245), + Mask: __webpack_require__(427), + Origin: __webpack_require__(1244), + Pipeline: __webpack_require__(200), + ScaleMode: __webpack_require__(1243), + ScrollFactor: __webpack_require__(424), + Size: __webpack_require__(1242), + Texture: __webpack_require__(1241), + TextureCrop: __webpack_require__(1240), + Tint: __webpack_require__(1239), + ToJSON: __webpack_require__(423), + Transform: __webpack_require__(422), + TransformMatrix: __webpack_require__(41), + Visible: __webpack_require__(421) + +}; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -2569,8 +2694,8 @@ var GameObjectCreator = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -2586,7 +2711,7 @@ var GameObjectCreator = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -2600,7 +2725,7 @@ var GameObjectCreator = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -2613,7 +2738,7 @@ var GameObjectCreator = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -2628,7 +2753,7 @@ var GameObjectCreator = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -2653,54 +2778,203 @@ PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); module.exports = GameObjectCreator; -/***/ }), -/* 14 */ -/***/ (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.GameObjects.Components - */ - -module.exports = { - - Alpha: __webpack_require__(401), - Animation: __webpack_require__(427), - BlendMode: __webpack_require__(400), - ComputedSize: __webpack_require__(1045), - Crop: __webpack_require__(1044), - Depth: __webpack_require__(399), - Flip: __webpack_require__(1043), - GetBounds: __webpack_require__(1042), - Mask: __webpack_require__(395), - Origin: __webpack_require__(1041), - Pipeline: __webpack_require__(186), - ScaleMode: __webpack_require__(1040), - ScrollFactor: __webpack_require__(392), - Size: __webpack_require__(1039), - Texture: __webpack_require__(1038), - TextureCrop: __webpack_require__(1037), - Tint: __webpack_require__(1036), - ToJSON: __webpack_require__(391), - Transform: __webpack_require__(390), - TransformMatrix: __webpack_require__(38), - Visible: __webpack_require__(389) - -}; - - /***/ }), /* 15 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var FILE_CONST = { + + /** + * The Loader is idle. + * + * @name Phaser.Loader.LOADER_IDLE + * @type {integer} + * @since 3.0.0 + */ + LOADER_IDLE: 0, + + /** + * The Loader is actively loading. + * + * @name Phaser.Loader.LOADER_LOADING + * @type {integer} + * @since 3.0.0 + */ + LOADER_LOADING: 1, + + /** + * The Loader is processing files is has loaded. + * + * @name Phaser.Loader.LOADER_PROCESSING + * @type {integer} + * @since 3.0.0 + */ + LOADER_PROCESSING: 2, + + /** + * The Loader has completed loading and processing. + * + * @name Phaser.Loader.LOADER_COMPLETE + * @type {integer} + * @since 3.0.0 + */ + LOADER_COMPLETE: 3, + + /** + * The Loader is shutting down. + * + * @name Phaser.Loader.LOADER_SHUTDOWN + * @type {integer} + * @since 3.0.0 + */ + LOADER_SHUTDOWN: 4, + + /** + * The Loader has been destroyed. + * + * @name Phaser.Loader.LOADER_DESTROYED + * @type {integer} + * @since 3.0.0 + */ + LOADER_DESTROYED: 5, + + /** + * File is in the load queue but not yet started + * + * @name Phaser.Loader.FILE_PENDING + * @type {integer} + * @since 3.0.0 + */ + FILE_PENDING: 10, + + /** + * File has been started to load by the loader (onLoad called) + * + * @name Phaser.Loader.FILE_LOADING + * @type {integer} + * @since 3.0.0 + */ + FILE_LOADING: 11, + + /** + * File has loaded successfully, awaiting processing + * + * @name Phaser.Loader.FILE_LOADED + * @type {integer} + * @since 3.0.0 + */ + FILE_LOADED: 12, + + /** + * File failed to load + * + * @name Phaser.Loader.FILE_FAILED + * @type {integer} + * @since 3.0.0 + */ + FILE_FAILED: 13, + + /** + * File is being processed (onProcess callback) + * + * @name Phaser.Loader.FILE_PROCESSING + * @type {integer} + * @since 3.0.0 + */ + FILE_PROCESSING: 14, + + /** + * The File has errored somehow during processing. + * + * @name Phaser.Loader.FILE_ERRORED + * @type {integer} + * @since 3.0.0 + */ + FILE_ERRORED: 16, + + /** + * File has finished processing. + * + * @name Phaser.Loader.FILE_COMPLETE + * @type {integer} + * @since 3.0.0 + */ + FILE_COMPLETE: 17, + + /** + * File has been destroyed + * + * @name Phaser.Loader.FILE_DESTROYED + * @type {integer} + * @since 3.0.0 + */ + FILE_DESTROYED: 18, + + /** + * File was populated from local data and doesn't need an HTTP request + * + * @name Phaser.Loader.FILE_POPULATED + * @type {integer} + * @since 3.0.0 + */ + FILE_POPULATED: 19 + +}; + +module.exports = FILE_CONST; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scenes.Events + */ + +module.exports = { + + BOOT: __webpack_require__(1115), + DESTROY: __webpack_require__(1114), + PAUSE: __webpack_require__(1113), + POST_UPDATE: __webpack_require__(1112), + PRE_UPDATE: __webpack_require__(1111), + READY: __webpack_require__(1110), + RENDER: __webpack_require__(1109), + RESUME: __webpack_require__(1108), + SHUTDOWN: __webpack_require__(1107), + SLEEP: __webpack_require__(1106), + START: __webpack_require__(1105), + TRANSITION_COMPLETE: __webpack_require__(1104), + TRANSITION_INIT: __webpack_require__(1103), + TRANSITION_OUT: __webpack_require__(1102), + TRANSITION_START: __webpack_require__(1101), + TRANSITION_WAKE: __webpack_require__(1100), + UPDATE: __webpack_require__(1099), + WAKE: __webpack_require__(1098) + +}; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -2730,6 +3004,10 @@ var customPlugins = {}; var PluginCache = {}; +/** + * @namespace Phaser.Plugins.PluginCache + */ + /** * Static method called directly by the Core internal Plugins. * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) @@ -2915,337 +3193,21 @@ PluginCache.destroyCustomPlugins = function () module.exports = PluginCache; -/***/ }), -/* 16 */ -/***/ (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 RND = __webpack_require__(404); - -var MATH_CONST = { - - /** - * The value of PI * 2. - * - * @name Phaser.Math.PI2 - * @type {number} - * @since 3.0.0 - */ - PI2: Math.PI * 2, - - /** - * The value of PI * 0.5. - * - * @name Phaser.Math.TAU - * @type {number} - * @since 3.0.0 - */ - TAU: Math.PI * 0.5, - - /** - * An epsilon value (1.0e-6) - * - * @name Phaser.Math.EPSILON - * @type {number} - * @since 3.0.0 - */ - EPSILON: 1.0e-6, - - /** - * For converting degrees to radians (PI / 180) - * - * @name Phaser.Math.DEG_TO_RAD - * @type {number} - * @since 3.0.0 - */ - DEG_TO_RAD: Math.PI / 180, - - /** - * For converting radians to degrees (180 / PI) - * - * @name Phaser.Math.RAD_TO_DEG - * @type {number} - * @since 3.0.0 - */ - RAD_TO_DEG: 180 / Math.PI, - - /** - * An instance of the Random Number Generator. - * - * @name Phaser.Math.RND - * @type {Phaser.Math.RandomDataGenerator} - * @since 3.0.0 - */ - RND: new RND() - -}; - -module.exports = MATH_CONST; - - -/***/ }), -/* 17 */ -/***/ (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 GetFastValue = __webpack_require__(2); - -/** - * @typedef {object} GetTilesWithinFilteringOptions - * - * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. - * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - */ - -/** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @function Phaser.Tilemaps.Components.GetTilesWithin - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. - */ -var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) -{ - if (tileX === undefined) { tileX = 0; } - if (tileY === undefined) { tileY = 0; } - if (width === undefined) { width = layer.width; } - if (height === undefined) { height = layer.height; } - - var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); - var isColliding = GetFastValue(filteringOptions, 'isColliding', false); - var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - - // Clip x, y to top left of map, while shrinking width/height to match. - if (tileX < 0) - { - width += tileX; - tileX = 0; - } - if (tileY < 0) - { - height += tileY; - tileY = 0; - } - - // Clip width and height to bottom right of map. - if (tileX + width > layer.width) - { - width = Math.max(layer.width - tileX, 0); - } - if (tileY + height > layer.height) - { - height = Math.max(layer.height - tileY, 0); - } - - var results = []; - - for (var ty = tileY; ty < tileY + height; ty++) - { - for (var tx = tileX; tx < tileX + width; tx++) - { - var tile = layer.data[ty][tx]; - if (tile !== null) - { - if (isNotEmpty && tile.index === -1) { continue; } - if (isColliding && !tile.collides) { continue; } - if (hasInterestingFace && !tile.hasInterestingFace) { continue; } - results.push(tile); - } - } - } - - return results; -}; - -module.exports = GetTilesWithin; - - /***/ }), /* 18 */ -/***/ (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 FILE_CONST = { - - /** - * The Loader is idle. - * - * @name Phaser.Loader.LOADER_IDLE - * @type {integer} - * @since 3.0.0 - */ - LOADER_IDLE: 0, - - /** - * The Loader is actively loading. - * - * @name Phaser.Loader.LOADER_LOADING - * @type {integer} - * @since 3.0.0 - */ - LOADER_LOADING: 1, - - /** - * The Loader is processing files is has loaded. - * - * @name Phaser.Loader.LOADER_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - LOADER_PROCESSING: 2, - - /** - * The Loader has completed loading and processing. - * - * @name Phaser.Loader.LOADER_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - LOADER_COMPLETE: 3, - - /** - * The Loader is shutting down. - * - * @name Phaser.Loader.LOADER_SHUTDOWN - * @type {integer} - * @since 3.0.0 - */ - LOADER_SHUTDOWN: 4, - - /** - * The Loader has been destroyed. - * - * @name Phaser.Loader.LOADER_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - LOADER_DESTROYED: 5, - - /** - * File is in the load queue but not yet started - * - * @name Phaser.Loader.FILE_PENDING - * @type {integer} - * @since 3.0.0 - */ - FILE_PENDING: 10, - - /** - * File has been started to load by the loader (onLoad called) - * - * @name Phaser.Loader.FILE_LOADING - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADING: 11, - - /** - * File has loaded successfully, awaiting processing - * - * @name Phaser.Loader.FILE_LOADED - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADED: 12, - - /** - * File failed to load - * - * @name Phaser.Loader.FILE_FAILED - * @type {integer} - * @since 3.0.0 - */ - FILE_FAILED: 13, - - /** - * File is being processed (onProcess callback) - * - * @name Phaser.Loader.FILE_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - FILE_PROCESSING: 14, - - /** - * The File has errored somehow during processing. - * - * @name Phaser.Loader.FILE_ERRORED - * @type {integer} - * @since 3.0.0 - */ - FILE_ERRORED: 16, - - /** - * File has finished processing. - * - * @name Phaser.Loader.FILE_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - FILE_COMPLETE: 17, - - /** - * File has been destroyed - * - * @name Phaser.Loader.FILE_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - FILE_DESTROYED: 18, - - /** - * File was populated from local data and doesn't need an HTTP request - * - * @name Phaser.Loader.FILE_POPULATED - * @type {integer} - * @since 3.0.0 - */ - FILE_POPULATED: 19 - -}; - -module.exports = FILE_CONST; - - -/***/ }), -/* 19 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var ComponentsToJSON = __webpack_require__(391); -var DataManager = __webpack_require__(123); +var ComponentsToJSON = __webpack_require__(423); +var DataManager = __webpack_require__(134); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(133); /** * @classdesc @@ -3293,6 +3255,22 @@ var GameObject = new Class({ */ this.type = type; + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could move from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.GameObject#state + * @type {(integer|string)} + * @since 3.16.0 + */ + this.state = 0; + /** * The parent Container of this Game Object, if it has one. * @@ -3449,6 +3427,30 @@ var GameObject = new Class({ return this; }, + /** + * Sets the current state of this Game Object. + * + * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @method Phaser.GameObjects.GameObject#setState + * @since 3.16.0 + * + * @param {(integer|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. + */ + setState: function (value) + { + this.state = value; + + return this; + }, + /** * Adds a Data Manager component to this Game Object. * @@ -3501,7 +3503,7 @@ var GameObject = new Class({ * When the value is first set, a `setdata` event is emitted from this Game Object. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. @@ -3692,7 +3694,7 @@ var GameObject = new Class({ */ willRender: function (camera) { - return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id))); + return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); }, /** @@ -3753,8 +3755,9 @@ var GameObject = new Class({ * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. * * @method Phaser.GameObjects.GameObject#destroy + * @fires Phaser.GameObjects.Events#DESTROY * @since 3.0.0 - * + * * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown? */ destroy: function (fromScene) @@ -3772,7 +3775,7 @@ var GameObject = new Class({ this.preDestroy.call(this); } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); var sys = this.scene.sys; @@ -3832,12 +3835,12 @@ module.exports = GameObject; /***/ }), -/* 20 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -3853,7 +3856,7 @@ var IsPlainObject = __webpack_require__(8); * @function Phaser.Utils.Objects.Extend * @since 3.0.0 * - * @return {object} [description] + * @return {object} The extended object. */ var Extend = function () { @@ -3930,23 +3933,188 @@ var Extend = function () module.exports = Extend; +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var MATH_CONST = { + + /** + * The value of PI * 2. + * + * @name Phaser.Math.PI2 + * @type {number} + * @since 3.0.0 + */ + PI2: Math.PI * 2, + + /** + * The value of PI * 0.5. + * + * @name Phaser.Math.TAU + * @type {number} + * @since 3.0.0 + */ + TAU: Math.PI * 0.5, + + /** + * An epsilon value (1.0e-6) + * + * @name Phaser.Math.EPSILON + * @type {number} + * @since 3.0.0 + */ + EPSILON: 1.0e-6, + + /** + * For converting degrees to radians (PI / 180) + * + * @name Phaser.Math.DEG_TO_RAD + * @type {number} + * @since 3.0.0 + */ + DEG_TO_RAD: Math.PI / 180, + + /** + * For converting radians to degrees (180 / PI) + * + * @name Phaser.Math.RAD_TO_DEG + * @type {number} + * @since 3.0.0 + */ + RAD_TO_DEG: 180 / Math.PI, + + /** + * An instance of the Random Number Generator. + * This is not set until the Game boots. + * + * @name Phaser.Math.RND + * @type {Phaser.Math.RandomDataGenerator} + * @since 3.0.0 + */ + RND: null + +}; + +module.exports = MATH_CONST; + + /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetFastValue = __webpack_require__(2); + +/** + * @typedef {object} GetTilesWithinFilteringOptions + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ + +/** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithin + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) +{ + if (tileX === undefined) { tileX = 0; } + if (tileY === undefined) { tileY = 0; } + if (width === undefined) { width = layer.width; } + if (height === undefined) { height = layer.height; } + + var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); + var isColliding = GetFastValue(filteringOptions, 'isColliding', false); + var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); + + // Clip x, y to top left of map, while shrinking width/height to match. + if (tileX < 0) + { + width += tileX; + tileX = 0; + } + if (tileY < 0) + { + height += tileY; + tileY = 0; + } + + // Clip width and height to bottom right of map. + if (tileX + width > layer.width) + { + width = Math.max(layer.width - tileX, 0); + } + if (tileY + height > layer.height) + { + height = Math.max(layer.height - tileY, 0); + } + + var results = []; + + for (var ty = tileY; ty < tileY + height; ty++) + { + for (var tx = tileX; tx < tileX + width; tx++) + { + var tile = layer.data[ty][tx]; + if (tile !== null) + { + if (isNotEmpty && tile.index === -1) { continue; } + if (isColliding && !tile.collides) { continue; } + if (hasInterestingFace && !tile.hasInterestingFace) { continue; } + results.push(tile); + } + } + } + + return results; +}; + +module.exports = GetTilesWithin; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(18); +var CONST = __webpack_require__(15); +var Events = __webpack_require__(75); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(141); -var MergeXHRSettings = __webpack_require__(140); -var XHRLoader = __webpack_require__(254); -var XHRSettings = __webpack_require__(105); +var GetURL = __webpack_require__(152); +var MergeXHRSettings = __webpack_require__(151); +var XHRLoader = __webpack_require__(259); +var XHRSettings = __webpack_require__(112); /** * @typedef {object} FileConfig @@ -4251,7 +4419,9 @@ var File = new Class({ */ onLoad: function (xhr, event) { - var success = !(event.target && event.target.status !== 200); + var localFileOk = ((xhr.responseURL && xhr.responseURL.indexOf('file://') === 0 && event.target.status === 0)); + + var success = !(event.target && event.target.status !== 200) || localFileOk; // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) @@ -4270,6 +4440,7 @@ var File = new Class({ * @method Phaser.Loader.File#onError * @since 3.0.0 * + * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error. */ onError: function () @@ -4283,6 +4454,7 @@ var File = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.File#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 * * @param {ProgressEvent} event - The DOM ProgressEvent. @@ -4296,7 +4468,7 @@ var File = new Class({ this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); } }, @@ -4384,65 +4556,13 @@ var File = new Class({ this.pendingDestroy(); }, - /** - * You can listen for this event from the LoaderPlugin. It is dispatched _every time_ - * a file loads and is sent 3 arguments, which allow you to identify the file: - * - * ```javascript - * this.load.on('filecomplete', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#fileCompleteEvent - * @param {string} key - The key of the file that just loaded and finished processing. - * @param {string} type - The type of the file that just loaded and finished processing. - * @param {any} data - The data of the file. - */ - - /** - * You can listen for this event from the LoaderPlugin. It is dispatched only once per - * file and you have to use a special listener handle to pick it up. - * - * The string of the event is based on the file type and the key you gave it, split up - * using hyphens. - * - * For example, if you have loaded an image with a key of `monster`, you can listen for it - * using the following: - * - * ```javascript - * this.load.on('filecomplete-image-monster', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a texture atlas with a key of `Level1`: - * - * ```javascript - * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: - * - * ```javascript - * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#singleFileCompleteEvent - * @param {any} data - The data of the file. - */ - /** * Called once the file has been added to its cache and is now ready for deletion from the Loader. * It will emit a `filecomplete` event from the LoaderPlugin. * * @method Phaser.Loader.File#pendingDestroy - * @fires Phaser.Loader.File#fileCompleteEvent - * @fires Phaser.Loader.File#singleFileCompleteEvent + * @fires Phaser.Loader.Events#FILE_COMPLETE + * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE * @since 3.7.0 */ pendingDestroy: function (data) @@ -4452,8 +4572,8 @@ var File = new Class({ var key = this.key; var type = this.type; - this.loader.emit('filecomplete', key, type, data); - this.loader.emit('filecomplete-' + type + '-' + key, key, type, data); + this.loader.emit(Events.FILE_COMPLETE, key, type, data); + this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data); this.loader.flagForRemoval(this); }, @@ -4528,12 +4648,303 @@ module.exports = File; /***/ }), -/* 22 */ +/* 23 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(28); +var Smoothing = __webpack_require__(130); + +// The pool into which the canvas elements are placed. +var pool = []; + +// Automatically apply smoothing(false) to created Canvas elements +var _disableContextSmoothing = false; + +/** + * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. + * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, + * which is useless for some of the Phaser pipelines / renderer. + * + * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. + * Which means all instances of Phaser Games on the same page can share the one single pool. + * + * @namespace Phaser.Display.Canvas.CanvasPool + * @since 3.0.0 + */ +var CanvasPool = function () +{ + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? + * + * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool + */ + var create = function (parent, width, height, canvasType, selfParent) + { + if (width === undefined) { width = 1; } + if (height === undefined) { height = 1; } + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } + + var canvas; + var container = first(canvasType); + + if (container === null) + { + container = { + parent: parent, + canvas: document.createElement('canvas'), + type: canvasType + }; + + if (canvasType === CONST.CANVAS) + { + pool.push(container); + } + + canvas = container.canvas; + } + else + { + container.parent = parent; + + canvas = container.canvas; + } + + if (selfParent) + { + container.parent = canvas; + } + + canvas.width = width; + canvas.height = height; + + if (_disableContextSmoothing && canvasType === CONST.CANVAS) + { + Smoothing.disable(canvas.getContext('2d')); + } + + return canvas; + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create2D + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created canvas. + */ + var create2D = function (parent, width, height) + { + return create(parent, width, height, CONST.CANVAS); + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.createWebGL + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {integer} [width=1] - The width of the Canvas. + * @param {integer} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created WebGL canvas. + */ + var createWebGL = function (parent, width, height) + { + return create(parent, width, height, CONST.WEBGL); + }; + + /** + * Gets the first free canvas index from the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.first + * @since 3.0.0 + * + * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * + * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + */ + var first = function (canvasType) + { + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + + if (canvasType === CONST.WEBGL) + { + return null; + } + + for (var i = 0; i < pool.length; i++) + { + var container = pool[i]; + + if (!container.parent && container.type === canvasType) + { + return container; + } + } + + return null; + }; + + /** + * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. + * The canvas has its width and height set to 1, and its parent attribute nulled. + * + * @function Phaser.Display.Canvas.CanvasPool.remove + * @since 3.0.0 + * + * @param {*} parent - The canvas or the parent of the canvas to free. + */ + var remove = function (parent) + { + // Check to see if the parent is a canvas object + var isCanvas = parent instanceof HTMLCanvasElement; + + pool.forEach(function (container) + { + if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) + { + container.parent = null; + container.canvas.width = 1; + container.canvas.height = 1; + } + }); + }; + + /** + * Gets the total number of used canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.total + * @since 3.0.0 + * + * @return {integer} The number of used canvases. + */ + var total = function () + { + var c = 0; + + pool.forEach(function (container) + { + if (container.parent) + { + c++; + } + }); + + return c; + }; + + /** + * Gets the total number of free canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.free + * @since 3.0.0 + * + * @return {integer} The number of free canvases. + */ + var free = function () + { + return pool.length - total(); + }; + + /** + * Disable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing + * @since 3.0.0 + */ + var disableSmoothing = function () + { + _disableContextSmoothing = true; + }; + + /** + * Enable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing + * @since 3.0.0 + */ + var enableSmoothing = function () + { + _disableContextSmoothing = false; + }; + + return { + create2D: create2D, + create: create, + createWebGL: createWebGL, + disableSmoothing: disableSmoothing, + enableSmoothing: enableSmoothing, + first: first, + free: free, + pool: pool, + remove: remove, + total: total + }; +}; + +// If we export the called function here, it'll only be invoked once (not every time it's required). +module.exports = CanvasPool(); + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4541,12 +4952,12 @@ module.exports = File; * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix * and then performs the following steps: * - * 1) Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2) Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3) Sets the blend mode of the context to be that used by the Game Object. - * 4) Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5) Saves the context state. - * 6) Sets the final matrix values into the context via setTransform. + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. * * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. * @@ -4613,303 +5024,46 @@ module.exports = SetTransform; /***/ }), -/* 23 */ -/***/ (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; - - -/***/ }), -/* 24 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(26); -var Smoothing = __webpack_require__(120); - -// The pool into which the canvas elements are placed. -var pool = []; - -// Automatically apply smoothing(false) to created Canvas elements -var _disableContextSmoothing = false; - /** - * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. - * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, - * which is useless for some of the Phaser pipelines / renderer. - * - * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. - * Which means all instances of Phaser Games on the same page can share the one single pool. - * - * @namespace Phaser.Display.Canvas.CanvasPool - * @since 3.0.0 + * @namespace Phaser.Core.Events */ -var CanvasPool = function () -{ - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? - * - * @return {HTMLCanvasElement} [description] - */ - var create = function (parent, width, height, canvasType, selfParent) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = 1; } - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (selfParent === undefined) { selfParent = false; } - var canvas; - var container = first(canvasType); +module.exports = { - if (container === null) - { - container = { - parent: parent, - canvas: document.createElement('canvas'), - type: canvasType - }; + BLUR: __webpack_require__(1190), + BOOT: __webpack_require__(1189), + DESTROY: __webpack_require__(1188), + FOCUS: __webpack_require__(1187), + HIDDEN: __webpack_require__(1186), + PAUSE: __webpack_require__(1185), + POST_RENDER: __webpack_require__(1184), + POST_STEP: __webpack_require__(1183), + PRE_RENDER: __webpack_require__(1182), + PRE_STEP: __webpack_require__(1181), + READY: __webpack_require__(1180), + RESUME: __webpack_require__(1179), + STEP: __webpack_require__(1178), + VISIBLE: __webpack_require__(1177) - if (canvasType === CONST.CANVAS) - { - pool.push(container); - } - - canvas = container.canvas; - } - else - { - container.parent = parent; - - canvas = container.canvas; - } - - if (selfParent) - { - container.parent = canvas; - } - - canvas.width = width; - canvas.height = height; - - if (_disableContextSmoothing && canvasType === CONST.CANVAS) - { - Smoothing.disable(canvas.getContext('2d')); - } - - return canvas; - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create2D - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} [description] - */ - var create2D = function (parent, width, height) - { - return create(parent, width, height, CONST.CANVAS); - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.createWebGL - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} [description] - */ - var createWebGL = function (parent, width, height) - { - return create(parent, width, height, CONST.WEBGL); - }; - - /** - * Gets the first free canvas index from the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.first - * @since 3.0.0 - * - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * - * @return {HTMLCanvasElement} [description] - */ - var first = function (canvasType) - { - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - - if (canvasType === CONST.WEBGL) - { - return null; - } - - for (var i = 0; i < pool.length; i++) - { - var container = pool[i]; - - if (!container.parent && container.type === canvasType) - { - return container; - } - } - - return null; - }; - - /** - * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. - * The canvas has its width and height set to 1, and its parent attribute nulled. - * - * @function Phaser.Display.Canvas.CanvasPool.remove - * @since 3.0.0 - * - * @param {*} parent - [description] - */ - var remove = function (parent) - { - // Check to see if the parent is a canvas object - var isCanvas = parent instanceof HTMLCanvasElement; - - pool.forEach(function (container) - { - if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) - { - container.parent = null; - container.canvas.width = 1; - container.canvas.height = 1; - } - }); - }; - - /** - * Gets the total number of used canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.total - * @since 3.0.0 - * - * @return {integer} [description] - */ - var total = function () - { - var c = 0; - - pool.forEach(function (container) - { - if (container.parent) - { - c++; - } - }); - - return c; - }; - - /** - * Gets the total number of free canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.free - * @since 3.0.0 - * - * @return {integer} [description] - */ - var free = function () - { - return pool.length - total(); - }; - - /** - * Disable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing - * @since 3.0.0 - */ - var disableSmoothing = function () - { - _disableContextSmoothing = true; - }; - - /** - * Enable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing - * @since 3.0.0 - */ - var enableSmoothing = function () - { - _disableContextSmoothing = false; - }; - - return { - create2D: create2D, - create: create, - createWebGL: createWebGL, - disableSmoothing: disableSmoothing, - enableSmoothing: enableSmoothing, - first: first, - free: free, - pool: pool, - remove: remove, - total: total - }; }; -// If we export the called function here, it'll only be invoked once (not every time it's required). -module.exports = CanvasPool(); - /***/ }), -/* 25 */ +/* 27 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4971,12 +5125,12 @@ module.exports = PropertyValueSet; /***/ }), -/* 26 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -4996,11 +5150,11 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.15.1', + VERSION: '3.16.2', - BlendModes: __webpack_require__(66), + BlendModes: __webpack_require__(60), - ScaleModes: __webpack_require__(94), + ScaleModes: __webpack_require__(101), /** * AUTO Detect Renderer. @@ -5109,19 +5263,19 @@ module.exports = CONST; /***/ }), -/* 27 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var Line = __webpack_require__(54); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var Line = __webpack_require__(59); /** * @classdesc @@ -5345,6 +5499,7 @@ var Shape = new Class({ * @method Phaser.GameObjects.Shape#setStrokeStyle * @since 3.13.0 * + * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. * @@ -5410,18 +5565,18 @@ module.exports = Shape; /***/ }), -/* 28 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); +var BlendModes = __webpack_require__(60); var GetAdvancedValue = __webpack_require__(12); -var ScaleModes = __webpack_require__(94); +var ScaleModes = __webpack_require__(101); /** * @typedef {object} GameObjectConfig @@ -5563,12 +5718,12 @@ module.exports = BuildGameObject; /***/ }), -/* 29 */ +/* 31 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -5617,948 +5772,25 @@ module.exports = { }; -/***/ }), -/* 30 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Sets the fillStyle on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#FillStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. - */ -var FillStyleCanvas = function (ctx, src, altColor) -{ - var fillColor = (altColor) ? altColor : src.fillColor; - var fillAlpha = src.fillAlpha; - - var red = ((fillColor & 0xFF0000) >>> 16); - var green = ((fillColor & 0xFF00) >>> 8); - var blue = (fillColor & 0xFF); - - ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; -}; - -module.exports = FillStyleCanvas; - - -/***/ }), -/* 31 */ -/***/ (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 CONST = __webpack_require__(16); - -/** - * Convert the given angle from degrees, to the equivalent angle in radians. - * - * @function Phaser.Math.DegToRad - * @since 3.0.0 - * - * @param {integer} degrees - The angle (in degrees) to convert to radians. - * - * @return {number} The given angle converted to radians. - */ -var DegToRad = function (degrees) -{ - return degrees * CONST.DEG_TO_RAD; -}; - -module.exports = DegToRad; - - /***/ }), /* 32 */ -/***/ (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 an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then adds the given value to it. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` - * - * @function Phaser.Actions.PropertyValueInc - * @since 3.3.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to be added to the property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var PropertyValueInc = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } - - var i; - var t = 0; - var end = items.length; - - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] += value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) - { - items[i][key] += value + (t * step); - t++; - } - } - - return items; -}; - -module.exports = PropertyValueInc; - - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global) {/** -* The `Matter.Common` module contains utility functions that are common to all modules. -* -* @class Common -*/ - -var Common = {}; - -module.exports = Common; - -(function() { - - Common._nextId = 0; - Common._seed = 0; - Common._nowStartTime = +(new Date()); - - /** - * Extends the object in the first argument using the object in the second argument. - * @method extend - * @param {} obj - * @param {boolean} deep - * @return {} obj extended - */ - Common.extend = function(obj, deep) { - var argsStart, - args, - deepClone; - - if (typeof deep === 'boolean') { - argsStart = 2; - deepClone = deep; - } else { - argsStart = 1; - deepClone = true; - } - - for (var i = argsStart; i < arguments.length; i++) { - var source = arguments[i]; - - if (source) { - for (var prop in source) { - if (deepClone && source[prop] && source[prop].constructor === Object) { - if (!obj[prop] || obj[prop].constructor === Object) { - obj[prop] = obj[prop] || {}; - Common.extend(obj[prop], deepClone, source[prop]); - } else { - obj[prop] = source[prop]; - } - } else { - obj[prop] = source[prop]; - } - } - } - } - - return obj; - }; - - /** - * Creates a new clone of the object, if deep is true references will also be cloned. - * @method clone - * @param {} obj - * @param {bool} deep - * @return {} obj cloned - */ - Common.clone = function(obj, deep) { - return Common.extend({}, deep, obj); - }; - - /** - * Returns the list of keys for the given object. - * @method keys - * @param {} obj - * @return {string[]} keys - */ - Common.keys = function(obj) { - if (Object.keys) - return Object.keys(obj); - - // avoid hasOwnProperty for performance - var keys = []; - for (var key in obj) - keys.push(key); - return keys; - }; - - /** - * Returns the list of values for the given object. - * @method values - * @param {} obj - * @return {array} Array of the objects property values - */ - Common.values = function(obj) { - var values = []; - - if (Object.keys) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - values.push(obj[keys[i]]); - } - return values; - } - - // avoid hasOwnProperty for performance - for (var key in obj) - values.push(obj[key]); - return values; - }; - - /** - * Gets a value from `base` relative to the `path` string. - * @method get - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} The object at the given path - */ - Common.get = function(obj, path, begin, end) { - path = path.split('.').slice(begin, end); - - for (var i = 0; i < path.length; i += 1) { - obj = obj[path[i]]; - } - - return obj; - }; - - /** - * Sets a value on `base` relative to the given `path` string. - * @method set - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {} val The value to set - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} Pass through `val` for chaining - */ - Common.set = function(obj, path, val, begin, end) { - var parts = path.split('.').slice(begin, end); - Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val; - return val; - }; - - /** - * Shuffles the given array in-place. - * The function uses a seeded random generator. - * @method shuffle - * @param {array} array - * @return {array} array shuffled randomly - */ - Common.shuffle = function(array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Common.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - return array; - }; - - /** - * Randomly chooses a value from a list with equal probability. - * The function uses a seeded random generator. - * @method choose - * @param {array} choices - * @return {object} A random choice object from the array - */ - Common.choose = function(choices) { - return choices[Math.floor(Common.random() * choices.length)]; - }; - - /** - * Returns true if the object is a HTMLElement, otherwise false. - * @method isElement - * @param {object} obj - * @return {boolean} True if the object is a HTMLElement, otherwise false - */ - Common.isElement = function(obj) { - if (typeof HTMLElement !== 'undefined') { - return obj instanceof HTMLElement; - } - - return !!(obj && obj.nodeType && obj.nodeName); - }; - - /** - * Returns true if the object is an array. - * @method isArray - * @param {object} obj - * @return {boolean} True if the object is an array, otherwise false - */ - Common.isArray = function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - /** - * Returns true if the object is a function. - * @method isFunction - * @param {object} obj - * @return {boolean} True if the object is a function, otherwise false - */ - Common.isFunction = function(obj) { - return typeof obj === "function"; - }; - - /** - * Returns true if the object is a plain object. - * @method isPlainObject - * @param {object} obj - * @return {boolean} True if the object is a plain object, otherwise false - */ - Common.isPlainObject = function(obj) { - return typeof obj === 'object' && obj.constructor === Object; - }; - - /** - * Returns true if the object is a string. - * @method isString - * @param {object} obj - * @return {boolean} True if the object is a string, otherwise false - */ - Common.isString = function(obj) { - return toString.call(obj) === '[object String]'; - }; - - /** - * Returns the given value clamped between a minimum and maximum value. - * @method clamp - * @param {number} value - * @param {number} min - * @param {number} max - * @return {number} The value clamped between min and max inclusive - */ - Common.clamp = function(value, min, max) { - if (value < min) - return min; - if (value > max) - return max; - return value; - }; - - /** - * Returns the sign of the given value. - * @method sign - * @param {number} value - * @return {number} -1 if negative, +1 if 0 or positive - */ - Common.sign = function(value) { - return value < 0 ? -1 : 1; - }; - - /** - * Returns the current timestamp since the time origin (e.g. from page load). - * The result will be high-resolution including decimal places if available. - * @method now - * @return {number} the current timestamp - */ - Common.now = function() { - if (window.performance) { - if (window.performance.now) { - return window.performance.now(); - } else if (window.performance.webkitNow) { - return window.performance.webkitNow(); - } - } - - return (new Date()) - Common._nowStartTime; - }; - - /** - * Returns a random value between a minimum and a maximum value inclusive. - * The function uses a seeded random generator. - * @method random - * @param {number} min - * @param {number} max - * @return {number} A random number between min and max inclusive - */ - Common.random = function(min, max) { - min = (typeof min !== "undefined") ? min : 0; - max = (typeof max !== "undefined") ? max : 1; - return min + _seededRandom() * (max - min); - }; - - var _seededRandom = function() { - // https://en.wikipedia.org/wiki/Linear_congruential_generator - Common._seed = (Common._seed * 9301 + 49297) % 233280; - return Common._seed / 233280; - }; - - /** - * Converts a CSS hex colour string into an integer. - * @method colorToNumber - * @param {string} colorString - * @return {number} An integer representing the CSS hex string - */ - Common.colorToNumber = function(colorString) { - colorString = colorString.replace('#',''); - - if (colorString.length == 3) { - colorString = colorString.charAt(0) + colorString.charAt(0) - + colorString.charAt(1) + colorString.charAt(1) - + colorString.charAt(2) + colorString.charAt(2); - } - - return parseInt(colorString, 16); - }; - - /** - * The console logging level to use, where each level includes all levels above and excludes the levels below. - * The default level is 'debug' which shows all console messages. - * - * Possible level values are: - * - 0 = None - * - 1 = Debug - * - 2 = Info - * - 3 = Warn - * - 4 = Error - * @property Common.logLevel - * @type {Number} - * @default 1 - */ - Common.logLevel = 1; - - /** - * Shows a `console.log` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method log - * @param ...objs {} The objects to log. - */ - Common.log = function() { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.info` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method info - * @param ...objs {} The objects to log. - */ - Common.info = function() { - if (console && Common.logLevel > 0 && Common.logLevel <= 2) { - console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.warn` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method warn - * @param ...objs {} The objects to log. - */ - Common.warn = function() { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Returns the next unique sequential ID. - * @method nextId - * @return {Number} Unique sequential ID - */ - Common.nextId = function() { - return Common._nextId++; - }; - - /** - * A cross browser compatible indexOf implementation. - * @method indexOf - * @param {array} haystack - * @param {object} needle - * @return {number} The position of needle in haystack, otherwise -1. - */ - Common.indexOf = function(haystack, needle) { - if (haystack.indexOf) - return haystack.indexOf(needle); - - for (var i = 0; i < haystack.length; i++) { - if (haystack[i] === needle) - return i; - } - - return -1; - }; - - /** - * A cross browser compatible array map implementation. - * @method map - * @param {array} list - * @param {function} func - * @return {array} Values from list transformed by func. - */ - Common.map = function(list, func) { - if (list.map) { - return list.map(func); - } - - var mapped = []; - - for (var i = 0; i < list.length; i += 1) { - mapped.push(func(list[i])); - } - - return mapped; - }; - - /** - * Takes a directed graph and returns the partially ordered set of vertices in topological order. - * Circular dependencies are allowed. - * @method topologicalSort - * @param {object} graph - * @return {array} Partially ordered set of vertices in topological order. - */ - Common.topologicalSort = function(graph) { - // https://github.com/mgechev/javascript-algorithms - // Copyright (c) Minko Gechev (MIT license) - // Modifications: tidy formatting and naming - var result = [], - visited = [], - temp = []; - - for (var node in graph) { - if (!visited[node] && !temp[node]) { - Common._topologicalSort(node, visited, temp, graph, result); - } - } - - return result; - }; - - Common._topologicalSort = function(node, visited, temp, graph, result) { - var neighbors = graph[node] || []; - temp[node] = true; - - for (var i = 0; i < neighbors.length; i += 1) { - var neighbor = neighbors[i]; - - if (temp[neighbor]) { - // skip circular dependencies - continue; - } - - if (!visited[neighbor]) { - Common._topologicalSort(neighbor, visited, temp, graph, result); - } - } - - temp[node] = false; - visited[node] = true; - - result.push(node); - }; - - /** - * Takes _n_ functions as arguments and returns a new function that calls them in order. - * The arguments applied when calling the new function will also be applied to every function passed. - * The value of `this` refers to the last value returned in the chain that was not `undefined`. - * Therefore if a passed function does not return a value, the previously returned value is maintained. - * After all passed functions have been called the new function returns the last returned value (if any). - * If any of the passed functions are a chain, then the chain will be flattened. - * @method chain - * @param ...funcs {function} The functions to chain. - * @return {function} A new function that calls the passed functions in order. - */ - Common.chain = function() { - var funcs = []; - - for (var i = 0; i < arguments.length; i += 1) { - var func = arguments[i]; - - if (func._chained) { - // flatten already chained functions - funcs.push.apply(funcs, func._chained); - } else { - funcs.push(func); - } - } - - var chain = function() { - // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358 - var lastResult, - args = new Array(arguments.length); - - for (var i = 0, l = arguments.length; i < l; i++) { - args[i] = arguments[i]; - } - - for (i = 0; i < funcs.length; i += 1) { - var result = funcs[i].apply(lastResult, args); - - if (typeof result !== 'undefined') { - lastResult = result; - } - } - - return lastResult; - }; - - chain._chained = funcs; - - return chain; - }; - - /** - * Chains a function to excute before the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathBefore - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathBefore = function(base, path, func) { - return Common.set(base, path, Common.chain( - func, - Common.get(base, path) - )); - }; - - /** - * Chains a function to excute after the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathAfter - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathAfter = function(base, path, func) { - return Common.set(base, path, Common.chain( - Common.get(base, path), - func - )); - }; - - /** - * Used to require external libraries outside of the bundle. - * It first looks for the `globalName` on the environment's global namespace. - * If the global is not found, it will fall back to using the standard `require` using the `moduleName`. - * @private - * @method _requireGlobal - * @param {string} globalName The global module name - * @param {string} moduleName The fallback CommonJS module name - * @return {} The loaded module - */ - Common._requireGlobal = function(globalName, moduleName) { - var obj = (typeof window !== 'undefined' ? window[globalName] : typeof global !== 'undefined' ? global[globalName] : null); - - // Breaks webpack :( - // return obj || require(moduleName); - - return obj; - }; -})(); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(200))) - -/***/ }), -/* 34 */ /***/ (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 GetTileAt = __webpack_require__(102); -var GetTilesWithin = __webpack_require__(17); - -/** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. - * - * @function Phaser.Tilemaps.Components.CalculateFacesWithin - * @private - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var CalculateFacesWithin = function (tileX, tileY, width, height, layer) -{ - var above = null; - var below = null; - var left = null; - var right = null; - - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - - for (var i = 0; i < tiles.length; i++) - { - var tile = tiles[i]; - - if (tile) - { - if (tile.collides) - { - above = GetTileAt(tile.x, tile.y - 1, true, layer); - below = GetTileAt(tile.x, tile.y + 1, true, layer); - left = GetTileAt(tile.x - 1, tile.y, true, layer); - right = GetTileAt(tile.x + 1, tile.y, true, layer); - - tile.faceTop = (above && above.collides) ? false : true; - tile.faceBottom = (below && below.collides) ? false : true; - tile.faceLeft = (left && left.collides) ? false : true; - tile.faceRight = (right && right.collides) ? false : true; - } - else - { - tile.resetFaces(); - } - } - } -}; - -module.exports = CalculateFacesWithin; - - -/***/ }), -/* 35 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Arcade Physics consts. - * - * @ignore - */ - -var CONST = { - - /** - * Dynamic Body. - * - * @name Phaser.Physics.Arcade.DYNAMIC_BODY - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.Group#physicsType - */ - DYNAMIC_BODY: 0, - - /** - * Static Body. - * - * @name Phaser.Physics.Arcade.STATIC_BODY - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.StaticBody#physicsType - */ - STATIC_BODY: 1, - - /** - * [description] - * - * @name Phaser.Physics.Arcade.GROUP - * @readonly - * @type {number} - * @since 3.0.0 - */ - GROUP: 2, - - /** - * [description] - * - * @name Phaser.Physics.Arcade.TILEMAPLAYER - * @readonly - * @type {number} - * @since 3.0.0 - */ - TILEMAPLAYER: 3, - - /** - * Facing no direction (initial value). - * - * @name Phaser.Physics.Arcade.FACING_NONE - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_NONE: 10, - - /** - * Facing up. - * - * @name Phaser.Physics.Arcade.FACING_UP - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_UP: 11, - - /** - * Facing down. - * - * @name Phaser.Physics.Arcade.FACING_DOWN - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_DOWN: 12, - - /** - * Facing left. - * - * @name Phaser.Physics.Arcade.FACING_LEFT - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_LEFT: 13, - - /** - * Facing right. - * - * @name Phaser.Physics.Arcade.FACING_RIGHT - * @readonly - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing - */ - FACING_RIGHT: 14 - -}; - -module.exports = CONST; - - -/***/ }), -/* 36 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Sets the strokeStyle and lineWidth on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#LineStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. - */ -var LineStyleCanvas = function (ctx, src) -{ - var strokeColor = src.strokeColor; - var strokeAlpha = src.strokeAlpha; - - var red = ((strokeColor & 0xFF0000) >>> 16); - var green = ((strokeColor & 0xFF00) >>> 8); - var blue = (strokeColor & 0xFF); - - ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; - ctx.lineWidth = src.lineWidth; -}; - -module.exports = LineStyleCanvas; - - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(177); -var GetColor32 = __webpack_require__(376); -var HSVToRGB = __webpack_require__(176); -var RGBToHSV = __webpack_require__(375); +var GetColor = __webpack_require__(191); +var GetColor32 = __webpack_require__(409); +var HSVToRGB = __webpack_require__(190); +var RGBToHSV = __webpack_require__(408); + +/** + * @namespace Phaser.Display.Color + */ /** * @classdesc @@ -7404,12 +6636,974 @@ module.exports = Color; /***/ }), -/* 38 */ +/* 33 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Sets the fillStyle on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#FillStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. + */ +var FillStyleCanvas = function (ctx, src, altColor) +{ + var fillColor = (altColor) ? altColor : src.fillColor; + var fillAlpha = src.fillAlpha; + + var red = ((fillColor & 0xFF0000) >>> 16); + var green = ((fillColor & 0xFF00) >>> 8); + var blue = (fillColor & 0xFF); + + ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; +}; + +module.exports = FillStyleCanvas; + + +/***/ }), +/* 34 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Convert the given angle from degrees, to the equivalent angle in radians. + * + * @function Phaser.Math.DegToRad + * @since 3.0.0 + * + * @param {integer} degrees - The angle (in degrees) to convert to radians. + * + * @return {number} The given angle converted to radians. + */ +var DegToRad = function (degrees) +{ + return degrees * CONST.DEG_TO_RAD; +}; + +module.exports = DegToRad; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then adds the given value to it. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueInc + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to be added to the property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var PropertyValueInc = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } + + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] += value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] += value + (t * step); + t++; + } + } + + return items; +}; + +module.exports = PropertyValueInc; + + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {/** +* The `Matter.Common` module contains utility functions that are common to all modules. +* +* @class Common +*/ + +var Common = {}; + +module.exports = Common; + +(function() { + + Common._nextId = 0; + Common._seed = 0; + Common._nowStartTime = +(new Date()); + + /** + * Extends the object in the first argument using the object in the second argument. + * @method extend + * @param {} obj + * @param {boolean} deep + * @return {} obj extended + */ + Common.extend = function(obj, deep) { + var argsStart, + args, + deepClone; + + if (typeof deep === 'boolean') { + argsStart = 2; + deepClone = deep; + } else { + argsStart = 1; + deepClone = true; + } + + for (var i = argsStart; i < arguments.length; i++) { + var source = arguments[i]; + + if (source) { + for (var prop in source) { + if (deepClone && source[prop] && source[prop].constructor === Object) { + if (!obj[prop] || obj[prop].constructor === Object) { + obj[prop] = obj[prop] || {}; + Common.extend(obj[prop], deepClone, source[prop]); + } else { + obj[prop] = source[prop]; + } + } else { + obj[prop] = source[prop]; + } + } + } + } + + return obj; + }; + + /** + * Creates a new clone of the object, if deep is true references will also be cloned. + * @method clone + * @param {} obj + * @param {bool} deep + * @return {} obj cloned + */ + Common.clone = function(obj, deep) { + return Common.extend({}, deep, obj); + }; + + /** + * Returns the list of keys for the given object. + * @method keys + * @param {} obj + * @return {string[]} keys + */ + Common.keys = function(obj) { + if (Object.keys) + return Object.keys(obj); + + // avoid hasOwnProperty for performance + var keys = []; + for (var key in obj) + keys.push(key); + return keys; + }; + + /** + * Returns the list of values for the given object. + * @method values + * @param {} obj + * @return {array} Array of the objects property values + */ + Common.values = function(obj) { + var values = []; + + if (Object.keys) { + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + values.push(obj[keys[i]]); + } + return values; + } + + // avoid hasOwnProperty for performance + for (var key in obj) + values.push(obj[key]); + return values; + }; + + /** + * Gets a value from `base` relative to the `path` string. + * @method get + * @param {} obj The base object + * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' + * @param {number} [begin] Path slice begin + * @param {number} [end] Path slice end + * @return {} The object at the given path + */ + Common.get = function(obj, path, begin, end) { + path = path.split('.').slice(begin, end); + + for (var i = 0; i < path.length; i += 1) { + obj = obj[path[i]]; + } + + return obj; + }; + + /** + * Sets a value on `base` relative to the given `path` string. + * @method set + * @param {} obj The base object + * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' + * @param {} val The value to set + * @param {number} [begin] Path slice begin + * @param {number} [end] Path slice end + * @return {} Pass through `val` for chaining + */ + Common.set = function(obj, path, val, begin, end) { + var parts = path.split('.').slice(begin, end); + Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val; + return val; + }; + + /** + * Shuffles the given array in-place. + * The function uses a seeded random generator. + * @method shuffle + * @param {array} array + * @return {array} array shuffled randomly + */ + Common.shuffle = function(array) { + for (var i = array.length - 1; i > 0; i--) { + var j = Math.floor(Common.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + return array; + }; + + /** + * Randomly chooses a value from a list with equal probability. + * The function uses a seeded random generator. + * @method choose + * @param {array} choices + * @return {object} A random choice object from the array + */ + Common.choose = function(choices) { + return choices[Math.floor(Common.random() * choices.length)]; + }; + + /** + * Returns true if the object is a HTMLElement, otherwise false. + * @method isElement + * @param {object} obj + * @return {boolean} True if the object is a HTMLElement, otherwise false + */ + Common.isElement = function(obj) { + if (typeof HTMLElement !== 'undefined') { + return obj instanceof HTMLElement; + } + + return !!(obj && obj.nodeType && obj.nodeName); + }; + + /** + * Returns true if the object is an array. + * @method isArray + * @param {object} obj + * @return {boolean} True if the object is an array, otherwise false + */ + Common.isArray = function(obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + + /** + * Returns true if the object is a function. + * @method isFunction + * @param {object} obj + * @return {boolean} True if the object is a function, otherwise false + */ + Common.isFunction = function(obj) { + return typeof obj === "function"; + }; + + /** + * Returns true if the object is a plain object. + * @method isPlainObject + * @param {object} obj + * @return {boolean} True if the object is a plain object, otherwise false + */ + Common.isPlainObject = function(obj) { + return typeof obj === 'object' && obj.constructor === Object; + }; + + /** + * Returns true if the object is a string. + * @method isString + * @param {object} obj + * @return {boolean} True if the object is a string, otherwise false + */ + Common.isString = function(obj) { + return toString.call(obj) === '[object String]'; + }; + + /** + * Returns the given value clamped between a minimum and maximum value. + * @method clamp + * @param {number} value + * @param {number} min + * @param {number} max + * @return {number} The value clamped between min and max inclusive + */ + Common.clamp = function(value, min, max) { + if (value < min) + return min; + if (value > max) + return max; + return value; + }; + + /** + * Returns the sign of the given value. + * @method sign + * @param {number} value + * @return {number} -1 if negative, +1 if 0 or positive + */ + Common.sign = function(value) { + return value < 0 ? -1 : 1; + }; + + /** + * Returns the current timestamp since the time origin (e.g. from page load). + * The result will be high-resolution including decimal places if available. + * @method now + * @return {number} the current timestamp + */ + Common.now = function() { + if (window.performance) { + if (window.performance.now) { + return window.performance.now(); + } else if (window.performance.webkitNow) { + return window.performance.webkitNow(); + } + } + + return (new Date()) - Common._nowStartTime; + }; + + /** + * Returns a random value between a minimum and a maximum value inclusive. + * The function uses a seeded random generator. + * @method random + * @param {number} min + * @param {number} max + * @return {number} A random number between min and max inclusive + */ + Common.random = function(min, max) { + min = (typeof min !== "undefined") ? min : 0; + max = (typeof max !== "undefined") ? max : 1; + return min + _seededRandom() * (max - min); + }; + + var _seededRandom = function() { + // https://en.wikipedia.org/wiki/Linear_congruential_generator + Common._seed = (Common._seed * 9301 + 49297) % 233280; + return Common._seed / 233280; + }; + + /** + * Converts a CSS hex colour string into an integer. + * @method colorToNumber + * @param {string} colorString + * @return {number} An integer representing the CSS hex string + */ + Common.colorToNumber = function(colorString) { + colorString = colorString.replace('#',''); + + if (colorString.length == 3) { + colorString = colorString.charAt(0) + colorString.charAt(0) + + colorString.charAt(1) + colorString.charAt(1) + + colorString.charAt(2) + colorString.charAt(2); + } + + return parseInt(colorString, 16); + }; + + /** + * The console logging level to use, where each level includes all levels above and excludes the levels below. + * The default level is 'debug' which shows all console messages. + * + * Possible level values are: + * - 0 = None + * - 1 = Debug + * - 2 = Info + * - 3 = Warn + * - 4 = Error + * @property Common.logLevel + * @type {Number} + * @default 1 + */ + Common.logLevel = 1; + + /** + * Shows a `console.log` message only if the current `Common.logLevel` allows it. + * The message will be prefixed with 'matter-js' to make it easily identifiable. + * @method log + * @param ...objs {} The objects to log. + */ + Common.log = function() { + if (console && Common.logLevel > 0 && Common.logLevel <= 3) { + console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); + } + }; + + /** + * Shows a `console.info` message only if the current `Common.logLevel` allows it. + * The message will be prefixed with 'matter-js' to make it easily identifiable. + * @method info + * @param ...objs {} The objects to log. + */ + Common.info = function() { + if (console && Common.logLevel > 0 && Common.logLevel <= 2) { + console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); + } + }; + + /** + * Shows a `console.warn` message only if the current `Common.logLevel` allows it. + * The message will be prefixed with 'matter-js' to make it easily identifiable. + * @method warn + * @param ...objs {} The objects to log. + */ + Common.warn = function() { + if (console && Common.logLevel > 0 && Common.logLevel <= 3) { + console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); + } + }; + + /** + * Returns the next unique sequential ID. + * @method nextId + * @return {Number} Unique sequential ID + */ + Common.nextId = function() { + return Common._nextId++; + }; + + /** + * A cross browser compatible indexOf implementation. + * @method indexOf + * @param {array} haystack + * @param {object} needle + * @return {number} The position of needle in haystack, otherwise -1. + */ + Common.indexOf = function(haystack, needle) { + if (haystack.indexOf) + return haystack.indexOf(needle); + + for (var i = 0; i < haystack.length; i++) { + if (haystack[i] === needle) + return i; + } + + return -1; + }; + + /** + * A cross browser compatible array map implementation. + * @method map + * @param {array} list + * @param {function} func + * @return {array} Values from list transformed by func. + */ + Common.map = function(list, func) { + if (list.map) { + return list.map(func); + } + + var mapped = []; + + for (var i = 0; i < list.length; i += 1) { + mapped.push(func(list[i])); + } + + return mapped; + }; + + /** + * Takes a directed graph and returns the partially ordered set of vertices in topological order. + * Circular dependencies are allowed. + * @method topologicalSort + * @param {object} graph + * @return {array} Partially ordered set of vertices in topological order. + */ + Common.topologicalSort = function(graph) { + // https://github.com/mgechev/javascript-algorithms + // Copyright (c) Minko Gechev (MIT license) + // Modifications: tidy formatting and naming + var result = [], + visited = [], + temp = []; + + for (var node in graph) { + if (!visited[node] && !temp[node]) { + Common._topologicalSort(node, visited, temp, graph, result); + } + } + + return result; + }; + + Common._topologicalSort = function(node, visited, temp, graph, result) { + var neighbors = graph[node] || []; + temp[node] = true; + + for (var i = 0; i < neighbors.length; i += 1) { + var neighbor = neighbors[i]; + + if (temp[neighbor]) { + // skip circular dependencies + continue; + } + + if (!visited[neighbor]) { + Common._topologicalSort(neighbor, visited, temp, graph, result); + } + } + + temp[node] = false; + visited[node] = true; + + result.push(node); + }; + + /** + * Takes _n_ functions as arguments and returns a new function that calls them in order. + * The arguments applied when calling the new function will also be applied to every function passed. + * The value of `this` refers to the last value returned in the chain that was not `undefined`. + * Therefore if a passed function does not return a value, the previously returned value is maintained. + * After all passed functions have been called the new function returns the last returned value (if any). + * If any of the passed functions are a chain, then the chain will be flattened. + * @method chain + * @param ...funcs {function} The functions to chain. + * @return {function} A new function that calls the passed functions in order. + */ + Common.chain = function() { + var funcs = []; + + for (var i = 0; i < arguments.length; i += 1) { + var func = arguments[i]; + + if (func._chained) { + // flatten already chained functions + funcs.push.apply(funcs, func._chained); + } else { + funcs.push(func); + } + } + + var chain = function() { + // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358 + var lastResult, + args = new Array(arguments.length); + + for (var i = 0, l = arguments.length; i < l; i++) { + args[i] = arguments[i]; + } + + for (i = 0; i < funcs.length; i += 1) { + var result = funcs[i].apply(lastResult, args); + + if (typeof result !== 'undefined') { + lastResult = result; + } + } + + return lastResult; + }; + + chain._chained = funcs; + + return chain; + }; + + /** + * Chains a function to excute before the original function on the given `path` relative to `base`. + * See also docs for `Common.chain`. + * @method chainPathBefore + * @param {} base The base object + * @param {string} path The path relative to `base` + * @param {function} func The function to chain before the original + * @return {function} The chained function that replaced the original + */ + Common.chainPathBefore = function(base, path, func) { + return Common.set(base, path, Common.chain( + func, + Common.get(base, path) + )); + }; + + /** + * Chains a function to excute after the original function on the given `path` relative to `base`. + * See also docs for `Common.chain`. + * @method chainPathAfter + * @param {} base The base object + * @param {string} path The path relative to `base` + * @param {function} func The function to chain after the original + * @return {function} The chained function that replaced the original + */ + Common.chainPathAfter = function(base, path, func) { + return Common.set(base, path, Common.chain( + Common.get(base, path), + func + )); + }; + + /** + * Used to require external libraries outside of the bundle. + * It first looks for the `globalName` on the environment's global namespace. + * If the global is not found, it will fall back to using the standard `require` using the `moduleName`. + * @private + * @method _requireGlobal + * @param {string} globalName The global module name + * @param {string} moduleName The fallback CommonJS module name + * @return {} The loaded module + */ + Common._requireGlobal = function(globalName, moduleName) { + var obj = (typeof window !== 'undefined' ? window[globalName] : typeof global !== 'undefined' ? global[globalName] : null); + + // Breaks webpack :( + // return obj || require(moduleName); + + return obj; + }; +})(); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(215))) + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetTileAt = __webpack_require__(109); +var GetTilesWithin = __webpack_require__(21); + +/** + * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the + * layer. Interesting faces are used internally for optimizing collisions against tiles. This method + * is mostly used internally. + * + * @function Phaser.Tilemaps.Components.CalculateFacesWithin + * @private + * @since 3.0.0 + * + * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesWithin = function (tileX, tileY, width, height, layer) +{ + var above = null; + var below = null; + var left = null; + var right = null; + + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + + for (var i = 0; i < tiles.length; i++) + { + var tile = tiles[i]; + + if (tile) + { + if (tile.collides) + { + above = GetTileAt(tile.x, tile.y - 1, true, layer); + below = GetTileAt(tile.x, tile.y + 1, true, layer); + left = GetTileAt(tile.x - 1, tile.y, true, layer); + right = GetTileAt(tile.x + 1, tile.y, true, layer); + + tile.faceTop = (above && above.collides) ? false : true; + tile.faceBottom = (below && below.collides) ? false : true; + tile.faceLeft = (left && left.collides) ? false : true; + tile.faceRight = (right && right.collides) ? false : true; + } + else + { + tile.resetFaces(); + } + } + } +}; + +module.exports = CalculateFacesWithin; + + +/***/ }), +/* 38 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Arcade Physics consts. + * + * @ignore + */ + +var CONST = { + + /** + * Dynamic Body. + * + * @name Phaser.Physics.Arcade.DYNAMIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.Group#physicsType + */ + DYNAMIC_BODY: 0, + + /** + * Static Body. + * + * @name Phaser.Physics.Arcade.STATIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.StaticBody#physicsType + */ + STATIC_BODY: 1, + + /** + * Arcade Physics Group containing Dynamic Bodies. + * + * @name Phaser.Physics.Arcade.GROUP + * @readonly + * @type {number} + * @since 3.0.0 + */ + GROUP: 2, + + /** + * A Tilemap Layer. + * + * @name Phaser.Physics.Arcade.TILEMAPLAYER + * @readonly + * @type {number} + * @since 3.0.0 + */ + TILEMAPLAYER: 3, + + /** + * Facing no direction (initial value). + * + * @name Phaser.Physics.Arcade.FACING_NONE + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_NONE: 10, + + /** + * Facing up. + * + * @name Phaser.Physics.Arcade.FACING_UP + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_UP: 11, + + /** + * Facing down. + * + * @name Phaser.Physics.Arcade.FACING_DOWN + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_DOWN: 12, + + /** + * Facing left. + * + * @name Phaser.Physics.Arcade.FACING_LEFT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_LEFT: 13, + + /** + * Facing right. + * + * @name Phaser.Physics.Arcade.FACING_RIGHT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_RIGHT: 14 + +}; + +module.exports = CONST; + + +/***/ }), +/* 39 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Sets the strokeStyle and lineWidth on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#LineStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. + */ +var LineStyleCanvas = function (ctx, src) +{ + var strokeColor = src.strokeColor; + var strokeAlpha = src.strokeAlpha; + + var red = ((strokeColor & 0xFF0000) >>> 16); + var green = ((strokeColor & 0xFF00) >>> 8); + var blue = (strokeColor & 0xFF); + + ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; + ctx.lineWidth = src.lineWidth; +}; + +module.exports = LineStyleCanvas; + + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ + +module.exports = { + + DESTROY: __webpack_require__(1168), + FADE_IN_COMPLETE: __webpack_require__(1167), + FADE_IN_START: __webpack_require__(1166), + FADE_OUT_COMPLETE: __webpack_require__(1165), + FADE_OUT_START: __webpack_require__(1164), + FLASH_COMPLETE: __webpack_require__(1163), + FLASH_START: __webpack_require__(1162), + PAN_COMPLETE: __webpack_require__(1161), + PAN_START: __webpack_require__(1160), + POST_RENDER: __webpack_require__(1159), + PRE_RENDER: __webpack_require__(1158), + SHAKE_COMPLETE: __webpack_require__(1157), + SHAKE_START: __webpack_require__(1156), + ZOOM_COMPLETE: __webpack_require__(1155), + ZOOM_START: __webpack_require__(1154) + +}; + + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8136,7 +8330,11 @@ var TransformMatrix = new Class({ }, /** - * Decompose this Matrix into its translation, scale and rotation values. + * Decompose this Matrix into its translation, scale and rotation values using QR decomposition. + * + * The result must be applied in the following order to reproduce the current matrix: + * + * translate -> rotate -> scale * * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix * @since 3.0.0 @@ -8159,21 +8357,33 @@ var TransformMatrix = new Class({ var c = matrix[2]; var d = matrix[3]; - var a2 = a * a; - var b2 = b * b; - var c2 = c * c; - var d2 = d * d; - - var sx = Math.sqrt(a2 + c2); - var sy = Math.sqrt(b2 + d2); + var determ = a * d - b * c; decomposedMatrix.translateX = matrix[4]; decomposedMatrix.translateY = matrix[5]; - decomposedMatrix.scaleX = sx; - decomposedMatrix.scaleY = sy; + if (a || b) + { + var r = Math.sqrt(a * a + b * b); - decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); + decomposedMatrix.rotation = (b > 0) ? Math.acos(a / r) : -Math.acos(a / r); + decomposedMatrix.scaleX = r; + decomposedMatrix.scaleY = determ / r; + } + else if (c || d) + { + var s = Math.sqrt(c * c + d * d); + + decomposedMatrix.rotation = Math.PI * 0.5 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); + decomposedMatrix.scaleX = determ / s; + decomposedMatrix.scaleY = s; + } + else + { + decomposedMatrix.rotation = 0; + decomposedMatrix.scaleX = 0; + decomposedMatrix.scaleY = 0; + } return decomposedMatrix; }, @@ -8315,26 +8525,26 @@ module.exports = TransformMatrix; /***/ }), -/* 39 */ +/* 42 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if a given point is inside a Rectangle's bounds. * * @function Phaser.Geom.Rectangle.Contains * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. */ var Contains = function (rect, x, y) { @@ -8350,12 +8560,12 @@ module.exports = Contains; /***/ }), -/* 40 */ +/* 43 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8391,12 +8601,12 @@ module.exports = Contains; /***/ }), -/* 41 */ +/* 44 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8424,12 +8634,12 @@ module.exports = SetTop; /***/ }), -/* 42 */ +/* 45 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8452,12 +8662,12 @@ module.exports = GetTop; /***/ }), -/* 43 */ +/* 46 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8485,12 +8695,12 @@ module.exports = SetRight; /***/ }), -/* 44 */ +/* 47 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8513,12 +8723,12 @@ module.exports = GetRight; /***/ }), -/* 45 */ +/* 48 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8546,12 +8756,12 @@ module.exports = SetLeft; /***/ }), -/* 46 */ +/* 49 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8574,12 +8784,12 @@ module.exports = GetLeft; /***/ }), -/* 47 */ +/* 50 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8607,12 +8817,12 @@ module.exports = SetBottom; /***/ }), -/* 48 */ +/* 51 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8635,12 +8845,75 @@ module.exports = GetBottom; /***/ }), -/* 49 */ +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: __webpack_require__(994), + DESTROY: __webpack_require__(993), + DRAG_END: __webpack_require__(992), + DRAG_ENTER: __webpack_require__(991), + DRAG: __webpack_require__(990), + DRAG_LEAVE: __webpack_require__(989), + DRAG_OVER: __webpack_require__(988), + DRAG_START: __webpack_require__(987), + DROP: __webpack_require__(986), + GAME_OUT: __webpack_require__(985), + GAME_OVER: __webpack_require__(984), + GAMEOBJECT_DOWN: __webpack_require__(983), + GAMEOBJECT_DRAG_END: __webpack_require__(982), + GAMEOBJECT_DRAG_ENTER: __webpack_require__(981), + GAMEOBJECT_DRAG: __webpack_require__(980), + GAMEOBJECT_DRAG_LEAVE: __webpack_require__(979), + GAMEOBJECT_DRAG_OVER: __webpack_require__(978), + GAMEOBJECT_DRAG_START: __webpack_require__(977), + GAMEOBJECT_DROP: __webpack_require__(976), + GAMEOBJECT_MOVE: __webpack_require__(975), + GAMEOBJECT_OUT: __webpack_require__(974), + GAMEOBJECT_OVER: __webpack_require__(973), + GAMEOBJECT_POINTER_DOWN: __webpack_require__(972), + GAMEOBJECT_POINTER_MOVE: __webpack_require__(971), + GAMEOBJECT_POINTER_OUT: __webpack_require__(970), + GAMEOBJECT_POINTER_OVER: __webpack_require__(969), + GAMEOBJECT_POINTER_UP: __webpack_require__(968), + GAMEOBJECT_UP: __webpack_require__(967), + MANAGER_BOOT: __webpack_require__(966), + MANAGER_PROCESS: __webpack_require__(965), + MANAGER_UPDATE: __webpack_require__(964), + POINTER_DOWN: __webpack_require__(963), + POINTER_DOWN_OUTSIDE: __webpack_require__(962), + POINTER_MOVE: __webpack_require__(961), + POINTER_OUT: __webpack_require__(960), + POINTER_OVER: __webpack_require__(959), + POINTER_UP: __webpack_require__(958), + POINTER_UP_OUTSIDE: __webpack_require__(957), + POINTERLOCK_CHANGE: __webpack_require__(956), + PRE_UPDATE: __webpack_require__(955), + SHUTDOWN: __webpack_require__(954), + START: __webpack_require__(953), + UPDATE: __webpack_require__(952) + +}; + + +/***/ }), +/* 53 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8686,12 +8959,12 @@ module.exports = WorldToTileY; /***/ }), -/* 50 */ +/* 54 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8737,18 +9010,18 @@ module.exports = WorldToTileX; /***/ }), -/* 51 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); @@ -8977,12 +9250,12 @@ module.exports = JSONFile; /***/ }), -/* 52 */ +/* 56 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9011,12 +9284,12 @@ module.exports = DistanceBetween; /***/ }), -/* 53 */ +/* 57 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9043,19 +9316,47 @@ module.exports = Wrap; /***/ }), -/* 54 */ +/* 58 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the length of the given line. + * + * @function Phaser.Geom.Line.Length + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the length of. + * + * @return {number} The length of the line. + */ +var Length = function (line) +{ + return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); +}; + +module.exports = Length; + + +/***/ }), +/* 59 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(397); -var GetPoints = __webpack_require__(189); -var Random = __webpack_require__(188); +var GetPoint = __webpack_require__(429); +var GetPoints = __webpack_require__(203); +var Random = __webpack_require__(202); var Vector2 = __webpack_require__(3); /** @@ -9368,18 +9669,273 @@ module.exports = Line; /***/ }), -/* 55 */ +/* 60 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Blend Modes. + * + * @name Phaser.BlendModes + * @enum {integer} + * @memberof Phaser + * @readonly + * @since 3.0.0 + */ + +module.exports = { + + /** + * Skips the Blend Mode check in the renderer. + * + * @name Phaser.BlendModes.SKIP_CHECK + */ + SKIP_CHECK: -1, + + /** + * Normal blend mode. For Canvas and WebGL. + * This is the default setting and draws new shapes on top of the existing canvas content. + * + * @name Phaser.BlendModes.NORMAL + */ + NORMAL: 0, + + /** + * Add blend mode. For Canvas and WebGL. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.ADD + */ + ADD: 1, + + /** + * Multiply blend mode. For Canvas and WebGL. + * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. + * + * @name Phaser.BlendModes.MULTIPLY + */ + MULTIPLY: 2, + + /** + * Screen blend mode. For Canvas and WebGL. + * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) + * + * @name Phaser.BlendModes.SCREEN + */ + SCREEN: 3, + + /** + * Overlay blend mode. For Canvas only. + * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. + * + * @name Phaser.BlendModes.OVERLAY + */ + OVERLAY: 4, + + /** + * Darken blend mode. For Canvas only. + * Retains the darkest pixels of both layers. + * + * @name Phaser.BlendModes.DARKEN + */ + DARKEN: 5, + + /** + * Lighten blend mode. For Canvas only. + * Retains the lightest pixels of both layers. + * + * @name Phaser.BlendModes.LIGHTEN + */ + LIGHTEN: 6, + + /** + * Color Dodge blend mode. For Canvas only. + * Divides the bottom layer by the inverted top layer. + * + * @name Phaser.BlendModes.COLOR_DODGE + */ + COLOR_DODGE: 7, + + /** + * Color Burn blend mode. For Canvas only. + * Divides the inverted bottom layer by the top layer, and then inverts the result. + * + * @name Phaser.BlendModes.COLOR_BURN + */ + COLOR_BURN: 8, + + /** + * Hard Light blend mode. For Canvas only. + * A combination of multiply and screen like overlay, but with top and bottom layer swapped. + * + * @name Phaser.BlendModes.HARD_LIGHT + */ + HARD_LIGHT: 9, + + /** + * Soft Light blend mode. For Canvas only. + * A softer version of hard-light. Pure black or white does not result in pure black or white. + * + * @name Phaser.BlendModes.SOFT_LIGHT + */ + SOFT_LIGHT: 10, + + /** + * Difference blend mode. For Canvas only. + * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. + * + * @name Phaser.BlendModes.DIFFERENCE + */ + DIFFERENCE: 11, + + /** + * Exclusion blend mode. For Canvas only. + * Like difference, but with lower contrast. + * + * @name Phaser.BlendModes.EXCLUSION + */ + EXCLUSION: 12, + + /** + * Hue blend mode. For Canvas only. + * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. + * + * @name Phaser.BlendModes.HUE + */ + HUE: 13, + + /** + * Saturation blend mode. For Canvas only. + * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. + * + * @name Phaser.BlendModes.SATURATION + */ + SATURATION: 14, + + /** + * Color blend mode. For Canvas only. + * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. + * + * @name Phaser.BlendModes.COLOR + */ + COLOR: 15, + + /** + * Luminosity blend mode. For Canvas only. + * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. + * + * @name Phaser.BlendModes.LUMINOSITY + */ + LUMINOSITY: 16, + + /** + * Alpha erase blend mode. For Canvas and WebGL. + * + * @name Phaser.BlendModes.ERASE + */ + ERASE: 17, + + /** + * Source-in blend mode. For Canvas only. + * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.SOURCE_IN + */ + SOURCE_IN: 18, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is drawn where it doesn't overlap the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_OUT + */ + SOURCE_OUT: 19, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is only drawn where it overlaps the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_ATOP + */ + SOURCE_ATOP: 20, + + /** + * Destination-over blend mode. For Canvas only. + * New shapes are drawn behind the existing canvas content. + * + * @name Phaser.BlendModes.DESTINATION_OVER + */ + DESTINATION_OVER: 21, + + /** + * Destination-in blend mode. For Canvas only. + * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.DESTINATION_IN + */ + DESTINATION_IN: 22, + + /** + * Destination-out blend mode. For Canvas only. + * The existing content is kept where it doesn't overlap the new shape. + * + * @name Phaser.BlendModes.DESTINATION_OUT + */ + DESTINATION_OUT: 23, + + /** + * Destination-out blend mode. For Canvas only. + * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. + * + * @name Phaser.BlendModes.DESTINATION_ATOP + */ + DESTINATION_ATOP: 24, + + /** + * Lighten blend mode. For Canvas only. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.LIGHTER + */ + LIGHTER: 25, + + /** + * Copy blend mode. For Canvas only. + * Only the new shape is shown. + * + * @name Phaser.BlendModes.COPY + */ + COPY: 26, + + /** + * xor blend mode. For Canvas only. + * Shapes are made transparent where both overlap and drawn normal everywhere else. + * + * @name Phaser.BlendModes.XOR + */ + XOR: 27 + +}; + + +/***/ }), +/* 61 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var Rectangle = __webpack_require__(265); +var Components = __webpack_require__(13); +var Rectangle = __webpack_require__(270); /** * @classdesc @@ -10083,7 +10639,9 @@ var Tile = new Class({ // bottom left, while the Phaser renderer assumes the origin is the top left. The y // coordinate needs to be adjusted by the difference. this.pixelX = this.x * this.baseWidth; - this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); + this.pixelY = this.y * this.baseHeight; + + // this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); return this; }, @@ -10134,8 +10692,9 @@ var Tile = new Class({ }, /** - * The tileset that contains this Tile. This will only return null if accessed from a LayerData - * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer. + * The tileset that contains this Tile. This is null if accessed from a LayerData instance + * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has + * an index that doesn't correspond to any of the map's tilesets. * * @name Phaser.Tilemaps.Tile#tileset * @type {?Phaser.Tilemaps.Tileset} @@ -10143,11 +10702,24 @@ var Tile = new Class({ * @since 3.0.0 */ tileset: { + get: function () { - var tilemapLayer = this.tilemapLayer; - return tilemapLayer ? tilemapLayer.tileset : null; + var tilemapLayer = this.layer.tilemapLayer; + + if (tilemapLayer) + { + var tileset = tilemapLayer.gidMap[this.index]; + + if (tileset) + { + return tileset; + } + } + + return null; } + }, /** @@ -10190,12 +10762,12 @@ module.exports = Tile; /***/ }), -/* 56 */ +/* 62 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10226,12 +10798,12 @@ module.exports = SetTileCollision; /***/ }), -/* 57 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10420,18 +10992,18 @@ module.exports = MultiFile; /***/ }), -/* 58 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -10716,21 +11288,21 @@ module.exports = ImageFile; /***/ }), -/* 59 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(69); -var GetPoint = __webpack_require__(278); -var GetPoints = __webpack_require__(277); -var Line = __webpack_require__(54); -var Random = __webpack_require__(184); +var Contains = __webpack_require__(74); +var GetPoint = __webpack_require__(283); +var GetPoints = __webpack_require__(282); +var Line = __webpack_require__(59); +var Random = __webpack_require__(198); /** * @classdesc @@ -11151,16 +11723,16 @@ module.exports = Triangle; /***/ }), -/* 60 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders a stroke outline around the given Shape. @@ -11226,19 +11798,19 @@ module.exports = StrokePathWebGL; /***/ }), -/* 61 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var SpriteRender = __webpack_require__(829); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var SpriteRender = __webpack_require__(852); /** * @classdesc @@ -11406,12 +11978,12 @@ module.exports = Sprite; /***/ }), -/* 62 */ +/* 68 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11455,12 +12027,53 @@ module.exports = SafeRange; /***/ }), -/* 63 */ +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Sound.Events + */ + +module.exports = { + + COMPLETE: __webpack_require__(932), + DESTROY: __webpack_require__(931), + DETUNE: __webpack_require__(930), + GLOBAL_DETUNE: __webpack_require__(929), + GLOBAL_MUTE: __webpack_require__(928), + GLOBAL_RATE: __webpack_require__(927), + GLOBAL_VOLUME: __webpack_require__(926), + LOOP: __webpack_require__(925), + LOOPED: __webpack_require__(924), + MUTE: __webpack_require__(923), + PAUSE_ALL: __webpack_require__(922), + PAUSE: __webpack_require__(921), + PLAY: __webpack_require__(920), + RATE: __webpack_require__(919), + RESUME_ALL: __webpack_require__(918), + RESUME: __webpack_require__(917), + SEEK: __webpack_require__(916), + STOP_ALL: __webpack_require__(915), + STOP: __webpack_require__(914), + UNLOCKED: __webpack_require__(913), + VOLUME: __webpack_require__(912) + +}; + + +/***/ }), +/* 70 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11497,47 +12110,40 @@ module.exports = Clone; /***/ }), -/* 64 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// 2.1.1 (Mar 17, 2016) +// Earcut 2.1.4 (December 4th 2018) /* -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. - -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. + * 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. + * + * 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. */ module.exports = earcut; -/* -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. - */ - function earcut(data, holeIndices, dim) { dim = dim || 2; @@ -11547,9 +12153,9 @@ function earcut(data, holeIndices, dim) { outerNode = linkedList(data, 0, outerLen, dim, true), triangles = []; - if (!outerNode) return triangles; + if (!outerNode || outerNode.next === outerNode.prev) return triangles; - var minX, minY, maxX, maxY, x, y, size; + var minX, minY, maxX, maxY, x, y, invSize; if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); @@ -11567,11 +12173,12 @@ function earcut(data, holeIndices, dim) { if (y > maxY) maxY = y; } - // minX, minY and size are later used to transform coords into integers for z-order calculation - size = Math.max(maxX - minX, maxY - minY); + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 1 / invSize : 0; } - earcutLinked(outerNode, triangles, dim, minX, minY, size); + earcutLinked(outerNode, triangles, dim, minX, minY, invSize); return triangles; } @@ -11607,7 +12214,7 @@ function filterPoints(start, end) { 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; + if (p === p.next) break; again = true; } else { @@ -11619,11 +12226,11 @@ function filterPoints(start, end) { } // main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { +function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { if (!ear) return; // interlink polygon nodes in z-order - if (!pass && size) indexCurve(ear, minX, minY, size); + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); var stop = ear, prev, next; @@ -11633,7 +12240,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { prev = ear.prev; next = ear.next; - if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { // cut off the triangle triangles.push(prev.i / dim); triangles.push(ear.i / dim); @@ -11641,7 +12248,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { removeNode(ear); - // skipping the next vertice leads to less sliver triangles + // skipping the next vertex leads to less sliver triangles ear = next.next; stop = next.next; @@ -11654,16 +12261,16 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { if (ear === stop) { // try filtering points and slicing again if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 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); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, size); + splitEarcut(ear, triangles, dim, minX, minY, invSize); } break; @@ -11691,7 +12298,7 @@ function isEar(ear) { return true; } -function isEarHashed(ear, minX, minY, size) { +function isEarHashed(ear, minX, minY, invSize) { var a = ear.prev, b = ear, c = ear.next; @@ -11705,22 +12312,26 @@ function isEarHashed(ear, minX, minY, size) { 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); + var minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - // first look for points inside the triangle in increasing z-order - var p = ear.nextZ; + var p = ear.prevZ, + n = ear.nextZ; - while (p && p.z <= maxZ) { + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.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; + p = p.prevZ; + + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; } - // then look for points in decreasing z-order - p = ear.prevZ; - + // look for remaining points in decreasing z-order 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) && @@ -11728,6 +12339,14 @@ function isEarHashed(ear, minX, minY, size) { p = p.prevZ; } + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + return true; } @@ -11757,7 +12376,7 @@ function cureLocalIntersections(start, triangles, dim) { } // try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, size) { +function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two var a = start; do { @@ -11772,8 +12391,8 @@ function splitEarcut(start, triangles, dim, minX, minY, size) { c = filterPoints(c, c.next); // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, size); - earcutLinked(c, triangles, dim, minX, minY, size); + earcutLinked(a, triangles, dim, minX, minY, invSize); + earcutLinked(c, triangles, dim, minX, minY, invSize); return; } b = b.next; @@ -11879,10 +12498,10 @@ function findHoleBridge(hole, outerNode) { } // interlink polygon nodes in z-order -function indexCurve(start, minX, minY, size) { +function indexCurve(start, minX, minY, invSize) { var p = start; do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); p.prevZ = p.prev; p.nextZ = p.next; p = p.next; @@ -11947,11 +12566,11 @@ function sortLinked(list) { return list; } -// z-order of a point given coords and size of the data bounding box -function zOrder(x, y, minX, minY, size) { +// z-order of a point given coords and inverse of the longer side of data bbox +function zOrder(x, y, minX, minY, invSize) { // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) / size; - y = 32767 * (y - minY) / size; + x = 32767 * (x - minX) * invSize; + y = 32767 * (y - minY) * invSize; x = (x | (x << 8)) & 0x00FF00FF; x = (x | (x << 4)) & 0x0F0F0F0F; @@ -12093,14 +12712,14 @@ function removeNode(p) { } function Node(i, x, y) { - // vertice index in coordinates array + // vertex index in coordinates array this.i = i; // vertex coordinates this.x = x; this.y = y; - // previous and next vertice nodes in a polygon ring + // previous and next vertex nodes in a polygon ring this.prev = null; this.next = null; @@ -12171,187 +12790,9 @@ earcut.flatten = function (data) { return result; }; -/***/ }), -/* 65 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the length of the given line. - * - * @function Phaser.Geom.Line.Length - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the length of. - * - * @return {number} The length of the line. - */ -var Length = function (line) -{ - return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); -}; - -module.exports = Length; - /***/ }), -/* 66 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Phaser Blend Modes. - * - * @name Phaser.BlendModes - * @enum {integer} - * @memberof Phaser - * @readonly - * @since 3.0.0 - */ - -module.exports = { - - /** - * Skips the Blend Mode check in the renderer. - * - * @name Phaser.BlendModes.SKIP_CHECK - */ - SKIP_CHECK: -1, - - /** - * Normal blend mode. - * - * @name Phaser.BlendModes.NORMAL - */ - NORMAL: 0, - - /** - * Add blend mode. - * - * @name Phaser.BlendModes.ADD - */ - ADD: 1, - - /** - * Multiply blend mode. - * - * @name Phaser.BlendModes.MULTIPLY - */ - MULTIPLY: 2, - - /** - * Screen blend mode. - * - * @name Phaser.BlendModes.SCREEN - */ - SCREEN: 3, - - /** - * Overlay blend mode. - * - * @name Phaser.BlendModes.OVERLAY - */ - OVERLAY: 4, - - /** - * Darken blend mode. - * - * @name Phaser.BlendModes.DARKEN - */ - DARKEN: 5, - - /** - * Lighten blend mode. - * - * @name Phaser.BlendModes.LIGHTEN - */ - LIGHTEN: 6, - - /** - * Color Dodge blend mode. - * - * @name Phaser.BlendModes.COLOR_DODGE - */ - COLOR_DODGE: 7, - - /** - * Color Burn blend mode. - * - * @name Phaser.BlendModes.COLOR_BURN - */ - COLOR_BURN: 8, - - /** - * Hard Light blend mode. - * - * @name Phaser.BlendModes.HARD_LIGHT - */ - HARD_LIGHT: 9, - - /** - * Soft Light blend mode. - * - * @name Phaser.BlendModes.SOFT_LIGHT - */ - SOFT_LIGHT: 10, - - /** - * Difference blend mode. - * - * @name Phaser.BlendModes.DIFFERENCE - */ - DIFFERENCE: 11, - - /** - * Exclusion blend mode. - * - * @name Phaser.BlendModes.EXCLUSION - */ - EXCLUSION: 12, - - /** - * Hue blend mode. - * - * @name Phaser.BlendModes.HUE - */ - HUE: 13, - - /** - * Saturation blend mode. - * - * @name Phaser.BlendModes.SATURATION - */ - SATURATION: 14, - - /** - * Color blend mode. - * - * @name Phaser.BlendModes.COLOR - */ - COLOR: 15, - - /** - * Luminosity blend mode. - * - * @name Phaser.BlendModes.LUMINOSITY - */ - LUMINOSITY: 16 - -}; - - -/***/ }), -/* 67 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -12368,12 +12809,12 @@ var Body = {}; module.exports = Body; -var Vertices = __webpack_require__(76); -var Vector = __webpack_require__(81); -var Sleeping = __webpack_require__(222); -var Common = __webpack_require__(33); -var Bounds = __webpack_require__(80); -var Axes = __webpack_require__(505); +var Vertices = __webpack_require__(82); +var Vector = __webpack_require__(87); +var Sleeping = __webpack_require__(238); +var Common = __webpack_require__(36); +var Bounds = __webpack_require__(86); +var Axes = __webpack_require__(546); (function() { @@ -13567,12 +14008,12 @@ var Axes = __webpack_require__(505); /***/ }), -/* 68 */ +/* 73 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13595,28 +14036,28 @@ module.exports = Angle; /***/ }), -/* 69 */ +/* 74 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // http://www.blackpawn.com/texts/pointinpoly/ /** - * [description] + * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. * * @function Phaser.Geom.Triangle.Contains * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. */ var Contains = function (triangle, x, y) { @@ -13648,18 +14089,48 @@ module.exports = Contains; /***/ }), -/* 70 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Loader.Events + */ + +module.exports = { + + ADD: __webpack_require__(945), + COMPLETE: __webpack_require__(944), + FILE_COMPLETE: __webpack_require__(943), + FILE_KEY_COMPLETE: __webpack_require__(942), + FILE_LOAD_ERROR: __webpack_require__(941), + FILE_LOAD: __webpack_require__(940), + FILE_PROGRESS: __webpack_require__(939), + POST_PROCESS: __webpack_require__(938), + PROGRESS: __webpack_require__(937), + START: __webpack_require__(936) + +}; + + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(173); -var Rectangle = __webpack_require__(9); +var FromPoints = __webpack_require__(180); +var Rectangle = __webpack_require__(10); var Vector2 = __webpack_require__(3); /** @@ -14223,20 +14694,20 @@ module.exports = Curve; /***/ }), -/* 71 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(40); -var GetPoint = __webpack_require__(405); -var GetPoints = __webpack_require__(403); -var Random = __webpack_require__(191); +var Contains = __webpack_require__(43); +var GetPoint = __webpack_require__(438); +var GetPoints = __webpack_require__(437); +var Random = __webpack_require__(206); /** * @classdesc @@ -14586,12 +15057,12 @@ module.exports = Circle; /***/ }), -/* 72 */ +/* 78 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14614,12 +15085,12 @@ module.exports = GetCenterY; /***/ }), -/* 73 */ +/* 79 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14649,12 +15120,12 @@ module.exports = SetCenterY; /***/ }), -/* 74 */ +/* 80 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14684,12 +15155,12 @@ module.exports = SetCenterX; /***/ }), -/* 75 */ +/* 81 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14712,7 +15183,7 @@ module.exports = GetCenterX; /***/ }), -/* 76 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -14729,8 +15200,8 @@ var Vertices = {}; module.exports = Vertices; -var Vector = __webpack_require__(81); -var Common = __webpack_require__(33); +var Vector = __webpack_require__(87); +var Common = __webpack_require__(36); (function() { @@ -15172,18 +15643,41 @@ var Common = __webpack_require__(33); /***/ }), -/* 77 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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); +/** + * @typedef {object} MapDataConfig + * @property {string} [name] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @property {number} [width=0] - The width of the entire tilemap. + * @property {number} [height=0] - The height of the entire tilemap. + * @property {number} [tileWidth=0] - The width of the tiles. + * @property {number} [tileHeight=0] - The height of the tiles. + * @property {number} [widthInPixels] - The width in pixels of the entire tilemap. + * @property {number} [heightInPixels] - The height in pixels of the entire tilemap. + * @property {integer} [format] - The format of the Tilemap, as defined in Tiled. + * @property {string} [orientation] - The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. + * @property {string} [renderOrder] - Determines the draw order of tilemap. Default is right-down. + * @property {number} [version] - The version of Tiled the map uses. + * @property {number} [properties] - Map specific properties (can be specified in Tiled). + * @property {Phaser.Tilemaps.LayerData[]} [layers] - The layers of the tilemap. + * @property {array} [images] - An array with all the layers configured to the MapData. + * @property {object} [objects] - An array of Tiled Image Layers. + * @property {object} [collision] - An object of Tiled Object Layers. + * @property {Phaser.Tilemaps.Tileset[]} [tilesets] - The tilesets the map uses. + * @property {array} [imageCollections] - The collection of images the map uses(specified in Tiled). + * @property {array} [tiles] - [description] + */ + /** * @classdesc * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this @@ -15195,7 +15689,7 @@ var GetFastValue = __webpack_require__(2); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {MapDataConfig} [config] - [description] */ var MapData = new Class({ @@ -15206,7 +15700,7 @@ var MapData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The key in the Phaser cache that corresponds to the loaded tilemap data. * * @name Phaser.Tilemaps.MapData#name * @type {string} @@ -15215,7 +15709,7 @@ var MapData = new Class({ this.name = GetFastValue(config, 'name', 'map'); /** - * [description] + * The width of the entire tilemap. * * @name Phaser.Tilemaps.MapData#width * @type {number} @@ -15224,7 +15718,7 @@ var MapData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height of the entire tilemap. * * @name Phaser.Tilemaps.MapData#height * @type {number} @@ -15233,7 +15727,7 @@ var MapData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The width of the tiles. * * @name Phaser.Tilemaps.MapData#tileWidth * @type {number} @@ -15242,7 +15736,7 @@ var MapData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The height of the tiles. * * @name Phaser.Tilemaps.MapData#tileHeight * @type {number} @@ -15251,7 +15745,7 @@ var MapData = new Class({ this.tileHeight = GetFastValue(config, 'tileHeight', 0); /** - * [description] + * The width in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#widthInPixels * @type {number} @@ -15260,7 +15754,7 @@ var MapData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); /** - * [description] + * The height in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#heightInPixels * @type {number} @@ -15278,7 +15772,7 @@ var MapData = new Class({ this.format = GetFastValue(config, 'format', null); /** - * [description] + * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. * * @name Phaser.Tilemaps.MapData#orientation * @type {string} @@ -15287,7 +15781,12 @@ var MapData = new Class({ this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); /** - * [description] + * Determines the draw order of tilemap. Default is right-down + * + * 0, or 'right-down' + * 1, or 'left-down' + * 2, or 'right-up' + * 3, or 'left-up' * * @name Phaser.Tilemaps.MapData#renderOrder * @type {string} @@ -15296,7 +15795,7 @@ var MapData = new Class({ this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); /** - * [description] + * The version of the map data (as specified in Tiled). * * @name Phaser.Tilemaps.MapData#version * @type {string} @@ -15305,7 +15804,7 @@ var MapData = new Class({ this.version = GetFastValue(config, 'version', '1'); /** - * [description] + * Map specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.MapData#properties * @type {object} @@ -15314,16 +15813,16 @@ var MapData = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * [description] + * An array with all the layers configured to the MapData. * * @name Phaser.Tilemaps.MapData#layers - * @type {array} + * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} * @since 3.0.0 */ this.layers = GetFastValue(config, 'layers', []); /** - * [description] + * An array of Tiled Image Layers. * * @name Phaser.Tilemaps.MapData#images * @type {array} @@ -15332,7 +15831,7 @@ var MapData = new Class({ this.images = GetFastValue(config, 'images', []); /** - * [description] + * An object of Tiled Object Layers. * * @name Phaser.Tilemaps.MapData#objects * @type {object} @@ -15341,7 +15840,7 @@ var MapData = new Class({ this.objects = GetFastValue(config, 'objects', {}); /** - * [description] + * An object of collision data. Must be created as physics object or will return undefined. * * @name Phaser.Tilemaps.MapData#collision * @type {object} @@ -15350,16 +15849,16 @@ var MapData = new Class({ this.collision = GetFastValue(config, 'collision', {}); /** - * [description] + * An array of Tilesets. * * @name Phaser.Tilemaps.MapData#tilesets - * @type {array} + * @type {Phaser.Tilemaps.Tileset[]} * @since 3.0.0 */ this.tilesets = GetFastValue(config, 'tilesets', []); /** - * [description] + * The collection of images the map uses(specified in Tiled) * * @name Phaser.Tilemaps.MapData#imageCollections * @type {array} @@ -15383,12 +15882,12 @@ module.exports = MapData; /***/ }), -/* 78 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15417,7 +15916,7 @@ var LayerData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the layer, if specified in Tiled. * * @name Phaser.Tilemaps.LayerData#name * @type {string} @@ -15426,7 +15925,7 @@ var LayerData = new Class({ this.name = GetFastValue(config, 'name', 'layer'); /** - * [description] + * The x offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#x * @type {number} @@ -15435,7 +15934,7 @@ var LayerData = new Class({ this.x = GetFastValue(config, 'x', 0); /** - * [description] + * The y offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#y * @type {number} @@ -15444,7 +15943,7 @@ var LayerData = new Class({ this.y = GetFastValue(config, 'y', 0); /** - * [description] + * The width in tile of the layer. * * @name Phaser.Tilemaps.LayerData#width * @type {number} @@ -15453,7 +15952,7 @@ var LayerData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height in tiles of the layer. * * @name Phaser.Tilemaps.LayerData#height * @type {number} @@ -15462,7 +15961,7 @@ var LayerData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The pixel width of the tiles. * * @name Phaser.Tilemaps.LayerData#tileWidth * @type {number} @@ -15471,7 +15970,7 @@ var LayerData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The pixel height of the tiles. * * @name Phaser.Tilemaps.LayerData#tileHeight * @type {number} @@ -15498,7 +15997,7 @@ var LayerData = new Class({ this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); /** - * [description] + * The width in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#widthInPixels * @type {number} @@ -15507,7 +16006,7 @@ var LayerData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); /** - * [description] + * The height in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#heightInPixels * @type {number} @@ -15534,7 +16033,7 @@ var LayerData = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * Layer specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.LayerData#properties * @type {object} @@ -15579,10 +16078,10 @@ var LayerData = new Class({ this.bodies = GetFastValue(config, 'bodies', []); /** - * [description] + * An array of the tile indexes * * @name Phaser.Tilemaps.LayerData#data - * @type {array} + * @type {(number[])} * @since 3.0.0 */ this.data = GetFastValue(config, 'data', []); @@ -15603,12 +16102,12 @@ module.exports = LayerData; /***/ }), -/* 79 */ +/* 85 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15634,7 +16133,7 @@ module.exports = IsInLayerBounds; /***/ }), -/* 80 */ +/* 86 */ /***/ (function(module, exports) { /** @@ -15760,7 +16259,7 @@ module.exports = Bounds; /***/ }), -/* 81 */ +/* 87 */ /***/ (function(module, exports) { /** @@ -16004,16 +16503,16 @@ module.exports = Vector; })(); /***/ }), -/* 82 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders a filled path for the given Shape. @@ -16068,12 +16567,12 @@ module.exports = FillPathWebGL; /***/ }), -/* 83 */ +/* 89 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16240,12 +16739,12 @@ module.exports = TWEEN_CONST; /***/ }), -/* 84 */ +/* 90 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16281,25 +16780,25 @@ module.exports = GetBoolean; /***/ }), -/* 85 */ +/* 91 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Determine whether the source object has a property with the specified key. * * @function Phaser.Utils.Objects.HasValue * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] + * @param {object} source - The source object to be checked. + * @param {string} key - The property to check for within the object * - * @return {boolean} [description] + * @return {boolean} `true` if the provided `key` exists on the `source` object, otherwise `false`. */ var HasValue = function (source, key) { @@ -16310,16 +16809,16 @@ module.exports = HasValue; /***/ }), -/* 86 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EaseMap = __webpack_require__(174); +var EaseMap = __webpack_require__(188); /** * [description] @@ -16372,19 +16871,19 @@ module.exports = GetEaseFunction; /***/ }), -/* 87 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var ImageRender = __webpack_require__(826); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var ImageRender = __webpack_require__(849); /** * @classdesc @@ -16475,23 +16974,24 @@ module.exports = Image; /***/ }), -/* 88 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Actions = __webpack_require__(417); +var Actions = __webpack_require__(450); var Class = __webpack_require__(0); +var Events = __webpack_require__(133); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); var IsPlainObject = __webpack_require__(8); -var Range = __webpack_require__(312); -var Set = __webpack_require__(95); -var Sprite = __webpack_require__(61); +var Range = __webpack_require__(316); +var Set = __webpack_require__(102); +var Sprite = __webpack_require__(67); /** * @callback GroupCallback @@ -16508,7 +17008,7 @@ var Sprite = __webpack_require__(61); /** * @typedef {object} GroupConfig * - * @property {?object} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. + * @property {?GroupClassTypeConstructor} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. * @property {?boolean} [active=true] - Sets {@link Phaser.GameObjects.Group#active}. * @property {?number} [maxSize=-1] - Sets {@link Phaser.GameObjects.Group#maxSize}. * @property {?string} [defaultKey=null] - Sets {@link Phaser.GameObjects.Group#defaultKey}. @@ -16532,7 +17032,7 @@ var Sprite = __webpack_require__(61); * * `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used. * - * @property {?object} [classType] - The class of each new Game Object. + * @property {?GroupClassTypeConstructor} [classType] - The class of each new Game Object. * @property {string} [key] - The texture key of each new Game Object. * @property {?(string|integer)} [frame=null] - The texture frame of each new Game Object. * @property {?boolean} [visible=true] - The visible state of each new Game Object. @@ -16573,6 +17073,18 @@ var Sprite = __webpack_require__(61); * @see Phaser.Utils.Array.Range */ +/** + * A constructor function (class) that can be assigned to `classType`. + * @callback GroupClassTypeConstructor + * @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. + * + * @see Phaser.GameObjects.Group#classType + */ + /** * @classdesc A Group is a way for you to create, manipulate, or recycle similar Game Objects. * @@ -16665,7 +17177,7 @@ var Group = new Class({ * The class to create new group members from. * * @name Phaser.GameObjects.Group#classType - * @type {object} + * @type {GroupClassTypeConstructor} * @since 3.0.0 * @default Phaser.GameObjects.Sprite */ @@ -17040,7 +17552,7 @@ var Group = new Class({ } } - child.on('destroy', this.remove, this); + child.on(Events.DESTROY, this.remove, this); return this; }, @@ -17104,7 +17616,7 @@ var Group = new Class({ this.removeCallback.call(this, child); } - child.off('destroy', this.remove, this); + child.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -17147,7 +17659,7 @@ var Group = new Class({ { var gameObject = children.entries[i]; - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -17679,7 +18191,7 @@ var Group = new Class({ var gameObject = children.entries[i]; // Remove the event hook first or it'll go all recursive hell on us - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); gameObject.destroy(); } @@ -17697,12 +18209,12 @@ module.exports = Group; /***/ }), -/* 89 */ +/* 95 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17739,20 +18251,20 @@ module.exports = Contains; /***/ }), -/* 90 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(89); -var GetPoint = __webpack_require__(308); -var GetPoints = __webpack_require__(307); -var Random = __webpack_require__(185); +var Contains = __webpack_require__(95); +var GetPoint = __webpack_require__(311); +var GetPoints = __webpack_require__(310); +var Random = __webpack_require__(199); /** * @classdesc @@ -18107,12 +18619,12 @@ module.exports = Ellipse; /***/ }), -/* 91 */ +/* 97 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18123,10 +18635,10 @@ module.exports = Ellipse; * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 * - * @param {array} array - [description] - * @param {integer} index - [description] + * @param {array} array - The array to splice from. + * @param {integer} index - The index of the item which should be spliced. * - * @return {*} [description] + * @return {*} The item which was spliced (removed). */ var SpliceOne = function (array, index) { @@ -18153,12 +18665,56 @@ module.exports = SpliceOne; /***/ }), -/* 92 */ +/* 98 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using floor. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. + * As will `14` snap to `10`... but `16` will snap to `15`. + * + * @function Phaser.Math.Snap.Floor + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapFloor = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.floor(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapFloor; + + +/***/ }), +/* 99 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18340,15 +18896,15 @@ function init () module.exports = init(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(907))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1096))) /***/ }), -/* 93 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18377,12 +18933,12 @@ module.exports = FromPercent; /***/ }), -/* 94 */ +/* 101 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18423,25 +18979,24 @@ module.exports = { /***/ }), -/* 95 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * @callback EachSetCallback - * @generic E - [entry] + * @callback EachSetCallback * - * @param {*} entry - [description] - * @param {number} index - [description] + * @param {E} entry - The Set entry. + * @param {number} index - The index of the entry within the Set. * - * @return {?boolean} [description] + * @return {?boolean} The callback result. */ /** @@ -18607,7 +19162,7 @@ var Set = new Class({ * @genericUse {Phaser.Structs.Set.} - [$return] * * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} callbackScope - The scope of the callback. + * @param {*} [callbackScope] - The scope of the callback. * * @return {Phaser.Structs.Set} This Set object. */ @@ -18652,7 +19207,7 @@ var Set = new Class({ * @genericUse {Phaser.Structs.Set.} - [$return] * * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} callbackScope - The scope of the callback. + * @param {*} [callbackScope] - The scope of the callback. * * @return {Phaser.Structs.Set} This Set object. */ @@ -18873,16 +19428,16 @@ module.exports = Set; /***/ }), -/* 96 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Creates a new Object using all values from obj1 and obj2. @@ -18891,10 +19446,10 @@ var Clone = __webpack_require__(63); * @function Phaser.Utils.Objects.Merge * @since 3.0.0 * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] + * @param {object} obj1 - The first object. + * @param {object} obj2 - The second object. * - * @return {object} [description] + * @return {object} A new object containing the union of obj1's and obj2's properties. */ var Merge = function (obj1, obj2) { @@ -18915,26 +19470,26 @@ module.exports = Merge; /***/ }), -/* 97 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(129); +var Defaults = __webpack_require__(141); var GetAdvancedValue = __webpack_require__(12); -var GetBoolean = __webpack_require__(84); -var GetEaseFunction = __webpack_require__(86); -var GetNewValue = __webpack_require__(98); -var GetProps = __webpack_require__(205); -var GetTargets = __webpack_require__(131); +var GetBoolean = __webpack_require__(90); +var GetEaseFunction = __webpack_require__(92); +var GetNewValue = __webpack_require__(105); +var GetProps = __webpack_require__(221); +var GetTargets = __webpack_require__(143); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(130); -var Tween = __webpack_require__(128); -var TweenData = __webpack_require__(127); +var GetValueOp = __webpack_require__(142); +var Tween = __webpack_require__(140); +var TweenData = __webpack_require__(139); /** * [description] @@ -18944,7 +19499,33 @@ var TweenData = __webpack_require__(127); * * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] * @param {object} config - [description] - * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description] + * @param {Phaser.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. +` + * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. + * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. + * @property {number} [duration=1000] - The duration of the tween in milliseconds. + * @property {string} [ease='Power0'] - The easing equation to use for the tween. + * @property {array} [easeParams] - Optional easing parameters. + * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. + * @property {number} [repeat=0] - The number of times to repeat the tween. + * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. + * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. + * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. + * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. +` +{ + targets: null, + delay: 0, + duration: 1000, + ease: 'Power0', + easeParams: null, + hold: 0, + repeat: 0, + repeatDelay: 0, + yoyo: false, + flipX: false, + flipY: false +}; * * @return {Phaser.Tweens.Tween} [description] */ @@ -19046,12 +19627,12 @@ module.exports = TweenBuilder; /***/ }), -/* 98 */ +/* 105 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19109,12 +19690,12 @@ module.exports = GetNewValue; /***/ }), -/* 99 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19513,12 +20094,12 @@ module.exports = Tileset; /***/ }), -/* 100 */ +/* 107 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19558,12 +20139,12 @@ module.exports = TileToWorldY; /***/ }), -/* 101 */ +/* 108 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19603,16 +20184,16 @@ module.exports = TileToWorldX; /***/ }), -/* 102 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(79); +var IsInLayerBounds = __webpack_require__(85); /** * Gets a tile at the given tile coordinates from the given layer. @@ -19635,7 +20216,7 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) if (IsInLayerBounds(tileX, tileY, layer)) { - var tile = layer.data[tileY][tileX]; + var tile = layer.data[tileY][tileX] || null; if (tile === null) { return null; @@ -19659,12 +20240,12 @@ module.exports = GetTileAt; /***/ }), -/* 103 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19674,77 +20255,73 @@ module.exports = GetTileAt; module.exports = { - CalculateFacesAt: __webpack_require__(136), - CalculateFacesWithin: __webpack_require__(34), - Copy: __webpack_require__(489), - CreateFromTiles: __webpack_require__(488), - CullTiles: __webpack_require__(487), - Fill: __webpack_require__(486), - FilterTiles: __webpack_require__(485), - FindByIndex: __webpack_require__(484), - FindTile: __webpack_require__(483), - ForEachTile: __webpack_require__(482), - GetTileAt: __webpack_require__(102), - GetTileAtWorldXY: __webpack_require__(481), - GetTilesWithin: __webpack_require__(17), - GetTilesWithinShape: __webpack_require__(480), - GetTilesWithinWorldXY: __webpack_require__(479), - HasTileAt: __webpack_require__(219), - HasTileAtWorldXY: __webpack_require__(478), - IsInLayerBounds: __webpack_require__(79), - PutTileAt: __webpack_require__(135), - PutTileAtWorldXY: __webpack_require__(477), - PutTilesAt: __webpack_require__(476), - Randomize: __webpack_require__(475), - RemoveTileAt: __webpack_require__(218), - RemoveTileAtWorldXY: __webpack_require__(474), - RenderDebug: __webpack_require__(473), - ReplaceByIndex: __webpack_require__(220), - SetCollision: __webpack_require__(472), - SetCollisionBetween: __webpack_require__(471), - SetCollisionByExclusion: __webpack_require__(470), - SetCollisionByProperty: __webpack_require__(469), - SetCollisionFromCollisionGroup: __webpack_require__(468), - SetTileIndexCallback: __webpack_require__(467), - SetTileLocationCallback: __webpack_require__(466), - Shuffle: __webpack_require__(465), - SwapByIndex: __webpack_require__(464), - TileToWorldX: __webpack_require__(101), - TileToWorldXY: __webpack_require__(463), - TileToWorldY: __webpack_require__(100), - WeightedRandomize: __webpack_require__(462), - WorldToTileX: __webpack_require__(50), - WorldToTileXY: __webpack_require__(461), - WorldToTileY: __webpack_require__(49) + CalculateFacesAt: __webpack_require__(148), + CalculateFacesWithin: __webpack_require__(37), + Copy: __webpack_require__(528), + CreateFromTiles: __webpack_require__(527), + CullTiles: __webpack_require__(526), + Fill: __webpack_require__(525), + FilterTiles: __webpack_require__(524), + FindByIndex: __webpack_require__(523), + FindTile: __webpack_require__(522), + ForEachTile: __webpack_require__(521), + GetTileAt: __webpack_require__(109), + GetTileAtWorldXY: __webpack_require__(520), + GetTilesWithin: __webpack_require__(21), + GetTilesWithinShape: __webpack_require__(519), + GetTilesWithinWorldXY: __webpack_require__(518), + HasTileAt: __webpack_require__(235), + HasTileAtWorldXY: __webpack_require__(517), + IsInLayerBounds: __webpack_require__(85), + PutTileAt: __webpack_require__(147), + PutTileAtWorldXY: __webpack_require__(516), + PutTilesAt: __webpack_require__(515), + Randomize: __webpack_require__(514), + RemoveTileAt: __webpack_require__(234), + RemoveTileAtWorldXY: __webpack_require__(513), + RenderDebug: __webpack_require__(512), + ReplaceByIndex: __webpack_require__(236), + SetCollision: __webpack_require__(511), + SetCollisionBetween: __webpack_require__(510), + SetCollisionByExclusion: __webpack_require__(509), + SetCollisionByProperty: __webpack_require__(508), + SetCollisionFromCollisionGroup: __webpack_require__(507), + SetTileIndexCallback: __webpack_require__(506), + SetTileLocationCallback: __webpack_require__(505), + Shuffle: __webpack_require__(504), + SwapByIndex: __webpack_require__(503), + TileToWorldX: __webpack_require__(108), + TileToWorldXY: __webpack_require__(502), + TileToWorldY: __webpack_require__(107), + WeightedRandomize: __webpack_require__(501), + WorldToTileX: __webpack_require__(54), + WorldToTileXY: __webpack_require__(500), + WorldToTileY: __webpack_require__(53) }; /***/ }), -/* 104 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(236); -var Sprite = __webpack_require__(61); +var Components = __webpack_require__(253); +var Sprite = __webpack_require__(67); /** * @classdesc - * An Arcade Physics Sprite Game Object. + * An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * 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. + * The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image. + * If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites. * * @class Sprite * @extends Phaser.GameObjects.Sprite @@ -19827,12 +20404,12 @@ module.exports = ArcadeSprite; /***/ }), -/* 105 */ +/* 112 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19905,12 +20482,39 @@ module.exports = XHRSettings; /***/ }), -/* 106 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Keyboard.Events + */ + +module.exports = { + + ANY_KEY_DOWN: __webpack_require__(619), + ANY_KEY_UP: __webpack_require__(618), + COMBO_MATCH: __webpack_require__(617), + DOWN: __webpack_require__(616), + KEY_DOWN: __webpack_require__(615), + KEY_UP: __webpack_require__(614), + UP: __webpack_require__(613) + +}; + + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19928,6 +20532,10 @@ var inputPlugins = {}; * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used. */ +/** + * @namespace Phaser.Input.InputPluginCache + */ + var InputPluginCache = {}; /** @@ -19936,7 +20544,9 @@ var InputPluginCache = {}; * Plugin is the object to instantiate to create the plugin * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) * - * @method Phaser.Input.InputPluginCache.register + * @name Phaser.Input.InputPluginCache.register + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - A reference used to get this plugin from the plugin cache. @@ -19953,7 +20563,9 @@ InputPluginCache.register = function (key, plugin, mapping, settingsKey, configK /** * Returns the input plugin object from the cache based on the given key. * - * @method Phaser.Input.InputPluginCache.getCore + * @name Phaser.Input.InputPluginCache.getCore + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to get. @@ -19968,7 +20580,9 @@ InputPluginCache.getPlugin = function (key) /** * Installs all of the registered Input Plugins into the given target. * - * @method Phaser.Input.InputPluginCache.install + * @name Phaser.Input.InputPluginCache.install + * @type {function} + * @static * @since 3.10.0 * * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into. @@ -19996,7 +20610,9 @@ InputPluginCache.install = function (target) /** * Removes an input plugin based on the given key. * - * @method Phaser.Input.InputPluginCache.remove + * @name Phaser.Input.InputPluginCache.remove + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to remove. @@ -20013,12 +20629,12 @@ module.exports = InputPluginCache; /***/ }), -/* 107 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -20089,19 +20705,20 @@ module.exports = LineToLine; /***/ }), -/* 108 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var MeshRender = __webpack_require__(731); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var MeshRender = __webpack_require__(753); +var NOOP = __webpack_require__(1); /** * @classdesc @@ -20114,13 +20731,10 @@ var MeshRender = __webpack_require__(731); * @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.Mask - * @extends Phaser.GameObjects.Components.Origin * @extends Phaser.GameObjects.Components.Pipeline * @extends Phaser.GameObjects.Components.ScaleMode * @extends Phaser.GameObjects.Components.Size @@ -20144,13 +20758,10 @@ var Mesh = new Class({ Extends: GameObject, Mixins: [ - Components.Alpha, Components.BlendMode, Components.Depth, - Components.Flip, Components.GetBounds, Components.Mask, - Components.Origin, Components.Pipeline, Components.ScaleMode, Components.Size, @@ -20251,9 +20862,17 @@ var Mesh = new Class({ this.setTexture(texture, frame); this.setPosition(x, y); this.setSizeToFrame(); - this.setOrigin(); this.initPipeline(); - } + }, + + /** + * This method is left intentionally empty and does not do anything. + * It is retained to allow a Mesh or Quad to be added to a Container. + * + * @method Phaser.GameObjects.Mesh#setAlpha + * @since 3.17.0 + */ + setAlpha: NOOP }); @@ -20261,21 +20880,21 @@ module.exports = Mesh; /***/ }), -/* 109 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var GetBitmapTextSize = __webpack_require__(846); -var ParseFromAtlas = __webpack_require__(845); -var Render = __webpack_require__(844); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var GetBitmapTextSize = __webpack_require__(872); +var ParseFromAtlas = __webpack_require__(871); +var Render = __webpack_require__(870); /** * The font data for an individual character of a Bitmap Font. @@ -20334,12 +20953,12 @@ var Render = __webpack_require__(844); * * To create a BitmapText data files you need a 3rd party app such as: * - * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ - * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner - * Littera (Web-based, free): http://kvazars.com/littera/ + * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/} + * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner} + * Littera (Web-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} * * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of - * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson + * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson} * * @class BitmapText * @extends Phaser.GameObjects.GameObject @@ -20905,33 +21524,76 @@ BitmapText.ALIGN_CENTER = 1; */ BitmapText.ALIGN_RIGHT = 2; +/** + * Parse an XML Bitmap Font from an Atlas. + * + * Adds the parsed Bitmap Font data to the cache with the `fontName` key. + * + * @name Phaser.GameObjects.BitmapText.ParseFromAtlas + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for. + * @param {string} fontName - The key of the font to add to the Bitmap Font cache. + * @param {string} textureKey - The key of the BitmapFont's texture. + * @param {string} frameKey - The key of the BitmapFont texture's frame. + * @param {string} xmlKey - The key of the XML data of the font to parse. + * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. + * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * + * @return {boolean} Whether the parsing was successful or not. + */ BitmapText.ParseFromAtlas = ParseFromAtlas; module.exports = BitmapText; /***/ }), -/* 110 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ //! stable.js 0.1.6, https://github.com/Two-Screen/stable //! © 2017 Angry Bytes and contributors. MIT licensed. +/** + * @namespace Phaser.Utils.Array.StableSortFunctions + */ + (function() { -// A stable array sort, because `Array#sort()` is not guaranteed stable. -// This is an implementation of merge sort, without recursion. - + /** + * A stable array sort, because `Array#sort()` is not guaranteed stable. + * This is an implementation of merge sort, without recursion. + * + * @function Phaser.Utils.Array.StableSort + * @since 3.0.0 + * + * @param {array} arr - The input array to be sorted. + * @param {function} comp - The comparison handler. + * + * @return {array} The sorted result. + */ var stable = function(arr, comp) { return exec(arr.slice(), comp); }; + /** + * Sort the input array and simply copy it back if the result isn't in the original array, which happens on an odd number of passes. + * + * @function Phaser.Utils.Array.StableSortFunctions.inplace + * @memberof Phaser.Utils.Array.StableSortFunctions + * @since 3.0.0 + * + * @param {array} arr - The input array. + * @param {function} comp - The comparison handler. + * + * @return {array} The sorted array. + */ stable.inplace = function(arr, comp) { var result = exec(arr, comp); @@ -21031,28 +21693,31 @@ else {} })(); /***/ }), -/* 111 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. - -var CheckMatrix = __webpack_require__(163); -var TransposeMatrix = __webpack_require__(315); +var CheckMatrix = __webpack_require__(173); +var TransposeMatrix = __webpack_require__(318); /** - * [description] + * Rotates the array matrix based on the given rotation value. + * + * The value can be given in degrees: 90, -90, 270, -270 or 180, + * or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * + * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. * * @function Phaser.Utils.Array.Matrix.RotateMatrix * @since 3.0.0 * * @param {array} matrix - The array to rotate. - * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. The value can be given in degrees: 90, -90, 270, -270 or 180, or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. * * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ @@ -21097,25 +21762,24 @@ module.exports = RotateMatrix; /***/ }), -/* 112 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayUtils = __webpack_require__(164); +var ArrayUtils = __webpack_require__(174); var Class = __webpack_require__(0); var NOOP = __webpack_require__(1); -var StableSort = __webpack_require__(110); +var StableSort = __webpack_require__(118); /** - * @callback EachListCallback - * @generic I - [item] + * @callback EachListCallback * - * @param {*} item - The item which is currently being processed. + * @param {I} item - The item which is currently being processed. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ @@ -21286,9 +21950,8 @@ var List = new Class({ }, /** - * Sort the contents of this List so the items are in order based - * on the given property. For example, `sort('alpha')` would sort the List - * contents based on the value of their `alpha` property. + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. * * @method Phaser.Structs.List#sort * @since 3.0.0 @@ -21296,38 +21959,28 @@ var List = new Class({ * @genericUse {T[]} - [children,$return] * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.Structs.List} This List object. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal handler for the {@link #sort} method which compares two items. - * - * @method Phaser.Structs.List#sortHandler - * @private - * @since 3.4.0 - * - * @genericUse {T} - [childA,childB] - * - * @param {*} childA - The first item to compare. - * @param {*} childB - The second item to compare. - * - * @return {integer} The result of the comparison, which will be negative if the first item is smaller then second, positive if the first item is larger than the second, or 0 if they're equal. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + StableSort.inplace(this.list, handler); + + return this; }, /** @@ -21373,7 +22026,6 @@ var List = new Class({ * @method Phaser.Structs.List#getFirst * @since 3.0.0 * - * @genericUse {T} - [value] * @genericUse {T | null} - [$return] * * @param {string} property - The name of the property to test or a falsey value to have no criterion. @@ -21385,7 +22037,7 @@ var List = new Class({ */ getFirst: function (property, value, startIndex, endIndex) { - return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex); + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); }, /** @@ -21535,7 +22187,7 @@ var List = new Class({ * @param {integer} [endIndex] - The position to stop removing at. The item at this position won't be removed. * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. * - * @return {Array.<*>} An array of the items which were removed.[description] + * @return {Array.<*>} An array of the items which were removed. */ removeBetween: function (startIndex, endIndex, skipCallback) { @@ -21812,7 +22464,8 @@ var List = new Class({ * The first item in the List or `null` for an empty List. * * @name Phaser.Structs.List#first - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -21838,7 +22491,8 @@ var List = new Class({ * The last item in the List, or `null` for an empty List. * * @name Phaser.Structs.List#last - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -21866,7 +22520,8 @@ var List = new Class({ * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. * * @name Phaser.Structs.List#next - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -21894,7 +22549,8 @@ var List = new Class({ * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. * * @name Phaser.Structs.List#previous - * @type {integer} + * @genericUse {T} - [$type] + * @type {*} * @readonly * @since 3.0.0 */ @@ -21922,18 +22578,18 @@ module.exports = List; /***/ }), -/* 113 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var Clamp = __webpack_require__(23); -var Extend = __webpack_require__(20); +var Extend = __webpack_require__(19); /** * @classdesc @@ -22739,19 +23395,20 @@ module.exports = Frame; /***/ }), -/* 114 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); -var Extend = __webpack_require__(20); +var Events = __webpack_require__(69); +var Extend = __webpack_require__(19); var NOOP = __webpack_require__(1); /** @@ -23209,6 +23866,7 @@ var BaseSound = new Class({ * Destroys this sound and all associated events and marks it for removal from the sound manager. * * @method Phaser.Sound.BaseSound#destroy + * @fires Phaser.Sound.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -23218,7 +23876,7 @@ var BaseSound = new Class({ return; } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); this.pendingRemove = true; this.manager = null; this.key = ''; @@ -23237,19 +23895,21 @@ module.exports = BaseSound; /***/ }), -/* 115 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(69); +var GameEvents = __webpack_require__(26); var NOOP = __webpack_require__(1); /** @@ -23264,7 +23924,7 @@ var NOOP = __webpack_require__(1); /** * Audio sprite sound type. * - * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound + * @typedef {object} AudioSpriteSound * * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. */ @@ -23404,7 +24064,7 @@ var BaseSoundManager = new Class({ */ this.unlocked = false; - game.events.on('blur', function () + game.events.on(GameEvents.BLUR, function () { if (this.pauseOnBlur) { @@ -23412,7 +24072,7 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('focus', function () + game.events.on(GameEvents.FOCUS, function () { if (this.pauseOnBlur) { @@ -23420,8 +24080,8 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('prestep', this.update, this); - game.events.once('destroy', this.destroy, this); + game.events.on(GameEvents.PRE_STEP, this.update, this); + game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -23449,7 +24109,7 @@ var BaseSoundManager = new Class({ * @param {string} key - Asset key for the sound. * @param {SoundConfig} [config] - An optional config object containing default sound settings. * - * @return {Phaser.Sound.BaseSound.AudioSpriteSound} The new audio sprite sound instance. + * @return {AudioSpriteSound} The new audio sprite sound instance. */ addAudioSprite: function (key, config) { @@ -23488,6 +24148,7 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#play + * @listens Phaser.Sound.Events#COMPLETE * @since 3.0.0 * * @param {string} key - Asset key for the sound. @@ -23499,7 +24160,7 @@ var BaseSoundManager = new Class({ { var sound = this.add(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); if (extra) { @@ -23525,6 +24186,7 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#playAudioSprite + * @listens Phaser.Sound.Events#COMPLETE * @since 3.0.0 * * @param {string} key - Asset key for the sound. @@ -23537,7 +24199,7 @@ var BaseSoundManager = new Class({ { var sound = this.addAudioSprite(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); return sound.play(spriteName, config); }, @@ -23601,16 +24263,11 @@ var BaseSoundManager = new Class({ return removed; }, - /** - * @event Phaser.Sound.BaseSoundManager#pauseall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Pauses all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#pauseAll - * @fires Phaser.Sound.BaseSoundManager#pauseall + * @fires Phaser.Sound.Events#PAUSE_ALL * @since 3.0.0 */ pauseAll: function () @@ -23620,19 +24277,14 @@ var BaseSoundManager = new Class({ sound.pause(); }); - this.emit('pauseall', this); + this.emit(Events.PAUSE_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#resumeall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Resumes all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#resumeAll - * @fires Phaser.Sound.BaseSoundManager#resumeall + * @fires Phaser.Sound.Events#RESUME_ALL * @since 3.0.0 */ resumeAll: function () @@ -23642,19 +24294,14 @@ var BaseSoundManager = new Class({ sound.resume(); }); - this.emit('resumeall', this); + this.emit(Events.RESUME_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#stopall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Stops all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#stopAll - * @fires Phaser.Sound.BaseSoundManager#stopall + * @fires Phaser.Sound.Events#STOP_ALL * @since 3.0.0 */ stopAll: function () @@ -23664,7 +24311,7 @@ var BaseSoundManager = new Class({ sound.stop(); }); - this.emit('stopall', this); + this.emit(Events.STOP_ALL, this); }, /** @@ -23708,6 +24355,7 @@ var BaseSoundManager = new Class({ * * @method Phaser.Sound.BaseSoundManager#update * @protected + * @fires Phaser.Sound.Events#UNLOCKED * @since 3.0.0 * * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. @@ -23720,11 +24368,7 @@ var BaseSoundManager = new Class({ 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); + this.emit(Events.UNLOCKED, this); } for (var i = this.sounds.length - 1; i >= 0; i--) @@ -23785,12 +24429,6 @@ var BaseSoundManager = new Class({ }); }, - /** - * @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. - */ - /** * Sets the global playback rate at which all the sounds will be played. * @@ -23798,7 +24436,7 @@ var BaseSoundManager = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.BaseSoundManager#setRate - * @fires Phaser.Sound.BaseSoundManager#rate + * @fires Phaser.Sound.Events#GLOBAL_RATE * @since 3.3.0 * * @param {number} value - Global playback rate at which all the sounds will be played. @@ -23838,7 +24476,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('rate', this, value); + this.emit(Events.GLOBAL_RATE, this, value); } }, @@ -23848,7 +24486,7 @@ var BaseSoundManager = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.BaseSoundManager#setDetune - * @fires Phaser.Sound.BaseSoundManager#detune + * @fires Phaser.Sound.Events#GLOBAL_DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -23862,12 +24500,6 @@ var BaseSoundManager = new Class({ return this; }, - /** - * @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. - */ - /** * 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). @@ -23893,7 +24525,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('detune', this, value); + this.emit(Events.GLOBAL_DETUNE, this, value); } } @@ -23904,12 +24536,12 @@ module.exports = BaseSoundManager; /***/ }), -/* 116 */ +/* 124 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -24027,12 +24659,543 @@ module.exports = CONST; /***/ }), -/* 117 */ +/* 125 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Keyboard Codes. + * + * @name Phaser.Input.Keyboard.KeyCodes + * @enum {integer} + * @memberof Phaser.Input.Keyboard + * @readonly + * @since 3.0.0 + */ + +var KeyCodes = { + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE + */ + BACKSPACE: 8, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.TAB + */ + TAB: 9, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.ENTER + */ + ENTER: 13, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.SHIFT + */ + SHIFT: 16, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.CTRL + */ + CTRL: 17, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.ALT + */ + ALT: 18, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PAUSE + */ + PAUSE: 19, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK + */ + CAPS_LOCK: 20, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.ESC + */ + ESC: 27, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.SPACE + */ + SPACE: 32, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP + */ + PAGE_UP: 33, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN + */ + PAGE_DOWN: 34, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.END + */ + END: 35, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.HOME + */ + HOME: 36, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.LEFT + */ + LEFT: 37, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.UP + */ + UP: 38, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.RIGHT + */ + RIGHT: 39, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.DOWN + */ + DOWN: 40, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN + */ + PRINT_SCREEN: 42, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.INSERT + */ + INSERT: 45, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.DELETE + */ + DELETE: 46, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.ZERO + */ + ZERO: 48, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.ONE + */ + ONE: 49, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.TWO + */ + TWO: 50, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.THREE + */ + THREE: 51, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.FOUR + */ + FOUR: 52, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.FIVE + */ + FIVE: 53, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.SIX + */ + SIX: 54, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEVEN + */ + SEVEN: 55, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.EIGHT + */ + EIGHT: 56, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NINE + */ + NINE: 57, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO + */ + NUMPAD_ZERO: 96, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE + */ + NUMPAD_ONE: 97, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO + */ + NUMPAD_TWO: 98, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE + */ + NUMPAD_THREE: 99, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR + */ + NUMPAD_FOUR: 100, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE + */ + NUMPAD_FIVE: 101, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX + */ + NUMPAD_SIX: 102, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN + */ + NUMPAD_SEVEN: 103, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT + */ + NUMPAD_EIGHT: 104, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE + */ + NUMPAD_NINE: 105, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.A + */ + A: 65, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.B + */ + B: 66, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.C + */ + C: 67, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.D + */ + D: 68, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.E + */ + E: 69, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F + */ + F: 70, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.G + */ + G: 71, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.H + */ + H: 72, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.I + */ + I: 73, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.J + */ + J: 74, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.K + */ + K: 75, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.L + */ + L: 76, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.M + */ + M: 77, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.N + */ + N: 78, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.O + */ + O: 79, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.P + */ + P: 80, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.Q + */ + Q: 81, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.R + */ + R: 82, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.S + */ + S: 83, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.T + */ + T: 84, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.U + */ + U: 85, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.V + */ + V: 86, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.W + */ + W: 87, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.X + */ + X: 88, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.Y + */ + Y: 89, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.Z + */ + Z: 90, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F1 + */ + F1: 112, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F2 + */ + F2: 113, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F3 + */ + F3: 114, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F4 + */ + F4: 115, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F5 + */ + F5: 116, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F6 + */ + F6: 117, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F7 + */ + F7: 118, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F8 + */ + F8: 119, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F9 + */ + F9: 120, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F10 + */ + F10: 121, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F11 + */ + F11: 122, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.F12 + */ + F12: 123, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON + */ + SEMICOLON: 186, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PLUS + */ + PLUS: 187, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA + */ + COMMA: 188, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.MINUS + */ + MINUS: 189, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PERIOD + */ + PERIOD: 190, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH + */ + FORWARD_SLASH: 191, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH + */ + BACK_SLASH: 220, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.QUOTES + */ + QUOTES: 222, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK + */ + BACKTICK: 192, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET + */ + OPEN_BRACKET: 219, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET + */ + CLOSED_BRACKET: 221, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX + */ + SEMICOLON_FIREFOX: 59, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COLON + */ + COLON: 58, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS + */ + COMMA_FIREFOX_WINDOWS: 60, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX + */ + COMMA_FIREFOX: 62, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX + */ + BRACKET_RIGHT_FIREFOX: 174, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX + */ + BRACKET_LEFT_FIREFOX: 175 +}; + +module.exports = KeyCodes; + + +/***/ }), +/* 126 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Textures.Events + */ + +module.exports = { + + ADD: __webpack_require__(1049), + ERROR: __webpack_require__(1048), + LOAD: __webpack_require__(1047), + READY: __webpack_require__(1046), + REMOVE: __webpack_require__(1045) + +}; + + +/***/ }), +/* 127 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -24057,16 +25220,16 @@ module.exports = IsSizePowerOfTwo; /***/ }), -/* 118 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); +var OS = __webpack_require__(99); /** * Determines the browser type and version running this Phaser Game instance. @@ -24167,12 +25330,12 @@ module.exports = init(); /***/ }), -/* 119 */ +/* 129 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -24197,12 +25360,12 @@ module.exports = Linear; /***/ }), -/* 120 */ +/* 130 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -24221,9 +25384,9 @@ var Smoothing = function () * @function Phaser.Display.Canvas.Smoothing.getPrefix * @since 3.0.0 * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. * - * @return {string} [description] + * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. */ var getPrefix = function (context) { @@ -24252,9 +25415,9 @@ var Smoothing = function () * @function Phaser.Display.Canvas.Smoothing.enable * @since 3.0.0 * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description] + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. */ var enable = function (context) { @@ -24281,9 +25444,9 @@ var Smoothing = function () * @function Phaser.Display.Canvas.Smoothing.disable * @since 3.0.0 * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description] + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. */ var disable = function (context) { @@ -24307,9 +25470,9 @@ var Smoothing = function () * @function Phaser.Display.Canvas.Smoothing.isEnabled * @since 3.0.0 * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description] + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. * - * @return {?boolean} [description] + * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. */ var isEnabled = function (context) { @@ -24329,22 +25492,23 @@ module.exports = Smoothing(); /***/ }), -/* 121 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var DegToRad = __webpack_require__(31); +var Components = __webpack_require__(13); +var DegToRad = __webpack_require__(34); var EventEmitter = __webpack_require__(11); -var Rectangle = __webpack_require__(9); -var TransformMatrix = __webpack_require__(38); -var ValueToColor = __webpack_require__(178); +var Events = __webpack_require__(40); +var Rectangle = __webpack_require__(10); +var TransformMatrix = __webpack_require__(41); +var ValueToColor = __webpack_require__(192); var Vector2 = __webpack_require__(3); /** @@ -24453,14 +25617,13 @@ var BaseCamera = new Class({ this.sceneManager; /** - * A reference to the Game Config. + * A reference to the Game Scale Manager. * - * @name Phaser.Cameras.Scene2D.BaseCamera#config - * @type {object} - * @readonly - * @since 3.12.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 */ - this.config; + this.scaleManager; /** * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. @@ -24484,11 +25647,14 @@ var BaseCamera = new Class({ this.name = ''; /** + * This property is un-used in v3.16. + * * The resolution of the Game, used in most Camera calculations. * * @name Phaser.Cameras.Scene2D.BaseCamera#resolution * @type {number} * @readonly + * @deprecated * @since 3.12.0 */ this.resolution = 1; @@ -24902,7 +26068,7 @@ var BaseCamera = new Class({ * @param {number} y - The vertical coordinate to center on. * @param {Phaser.Math.Vector2} [out] - A Vec2 to store the values in. If not given a new Vec2 is created. * - * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` abd `y` properties. + * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` and `y` properties. */ getScroll: function (x, y, out) { @@ -24923,6 +26089,60 @@ var BaseCamera = new Class({ return out; }, + /** + * Moves the Camera horizontally so that it is centered on the given x coordinate, bounds allowing. + * Calling this does not change the scrollY value. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX + * @since 3.16.0 + * + * @param {number} x - The horizontal coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOnX: function (x) + { + var originX = this.width * 0.5; + + this.midPoint.x = x; + + this.scrollX = x - originX; + + if (this.useBounds) + { + this.scrollX = this.clampX(this.scrollX); + } + + return this; + }, + + /** + * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing. + * Calling this does not change the scrollX value. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY + * @since 3.16.0 + * + * @param {number} y - The vertical coordinate to center on. + * + * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. + */ + centerOnY: function (y) + { + var originY = this.height * 0.5; + + this.midPoint.y = y; + + this.scrollY = y - originY; + + if (this.useBounds) + { + this.scrollY = this.clampY(this.scrollY); + } + + return this; + }, + /** * Moves the Camera so that it is centered on the given coordinates, bounds allowing. * @@ -24936,19 +26156,8 @@ var BaseCamera = new Class({ */ centerOn: function (x, y) { - var originX = this.width * 0.5; - var originY = this.height * 0.5; - - this.midPoint.set(x, y); - - this.scrollX = x - originX; - this.scrollY = y - originY; - - if (this.useBounds) - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } + this.centerOnX(x); + this.centerOnY(y); return this; }, @@ -25061,11 +26270,12 @@ var BaseCamera = new Class({ 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 cullTop = this.y; + var cullBottom = cullTop + cameraH; + var cullLeft = this.x; + var cullRight = cullLeft + cameraW; - if (tx > -objectW && ty > -objectH && tx < cullW && ty < cullH && - tw > -objectW && th > -objectH && tw < cullW && th < cullH) + if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom)) { culledObjects.push(object); } @@ -25190,10 +26400,9 @@ var BaseCamera = new Class({ * @protected * @since 3.0.0 * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. + * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (baseScale, resolution) + preRender: function (resolution) { var width = this.width; var height = this.height; @@ -25201,7 +26410,7 @@ var BaseCamera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * baseScale; + var zoom = this.zoom * resolution; var matrix = this.matrix; var originX = width * this.originX; @@ -25243,11 +26452,7 @@ var BaseCamera = new Class({ displayHeight ); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); }, @@ -25412,12 +26617,14 @@ var BaseCamera = new Class({ * @param {integer} y - The top-left y coordinate of the bounds. * @param {integer} width - The width of the bounds, in pixels. * @param {integer} height - The height of the bounds, in pixels. - * @param {boolean} [centerOn] - If `true` the Camera will automatically be centered on the new bounds. + * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. * * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. */ setBounds: function (x, y, width, height, centerOn) { + if (centerOn === undefined) { centerOn = false; } + this._bounds.setTo(x, y, width, height); this.dirty = true; @@ -25436,6 +26643,31 @@ var BaseCamera = new Class({ return this; }, + /** + * Returns a rectangle containing the bounds of the Camera. + * + * If the Camera does not have any bounds the rectangle will be empty. + * + * The rectangle is a copy of the bounds, so is safe to modify. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds + * @since 3.16.0 + * + * @param {Phaser.Geom.Rectangle} [out] - An optional Rectangle to store the bounds in. If not given, a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the bounds of this Camera. + */ + getBounds: function (out) + { + if (out === undefined) { out = new Rectangle(); } + + var source = this._bounds; + + out.setTo(source.x, source.y, source.width, source.height); + + return out; + }, + /** * Sets the name of this Camera. * This value is for your own use and isn't used internally. @@ -25540,10 +26772,10 @@ var BaseCamera = new Class({ this.scene = scene; - this.config = scene.sys.game.config; this.sceneManager = scene.sys.game.scene; + this.scaleManager = scene.sys.scale; - var res = this.config.resolution; + var res = this.scaleManager.resolution; this.resolution = res; @@ -25743,12 +26975,12 @@ var BaseCamera = new Class({ */ updateSystem: function () { - if (!this.config) + if (!this.scaleManager) { return; } - var custom = (this._x !== 0 || this._y !== 0 || this.config.width !== this._width || this.config.height !== this._height); + var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.height !== this._height); var sceneManager = this.sceneManager; @@ -25767,13 +26999,6 @@ var BaseCamera = new Class({ this._customViewport = custom; }, - /** - * This event is fired when a camera is destroyed by the Camera Manager. - * - * @event CameraDestroyEvent - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. - */ - /** * Destroys this Camera instance and its internal properties and references. * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. @@ -25784,12 +27009,12 @@ var BaseCamera = new Class({ * rather than calling this method directly. * * @method Phaser.Cameras.Scene2D.BaseCamera#destroy - * @fires CameraDestroyEvent + * @fires Phaser.Cameras.Scene2D.Events#DESTROY * @since 3.0.0 */ destroy: function () { - this.emit('cameradestroy', this); + this.emit(Events.DESTROY, this); this.removeAllListeners(); @@ -25806,7 +27031,7 @@ var BaseCamera = new Class({ this._bounds = null; this.scene = null; - this.config = null; + this.scaleManager = null; this.sceneManager = null; }, @@ -26034,7 +27259,7 @@ var BaseCamera = new Class({ }, /** - * The x position of the center of the Camera's viewport, relative to the top-left of the game canvas. + * The horizontal position of the center of the Camera's viewport, relative to the left of the game canvas. * * @name Phaser.Cameras.Scene2D.BaseCamera#centerX * @type {number} @@ -26051,7 +27276,7 @@ var BaseCamera = new Class({ }, /** - * The y position of the center of the Camera's viewport, relative to the top-left of the game canvas. + * The vertical position of the center of the Camera's viewport, relative to the top of the game canvas. * * @name Phaser.Cameras.Scene2D.BaseCamera#centerY * @type {number} @@ -26119,12 +27344,12 @@ module.exports = BaseCamera; /***/ }), -/* 122 */ +/* 132 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -26157,16 +27382,34 @@ module.exports = Shuffle; /***/ }), -/* 123 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { DESTROY: __webpack_require__(1234) }; + + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(420); /** * @callback DataEachCallback @@ -26179,7 +27422,7 @@ 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. + * The Data Manager 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. * @@ -26401,13 +27644,16 @@ var DataManager = new Class({ * When the value is first set, a `setdata` event is emitted. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. * * @method Phaser.Data.DataManager#set + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. @@ -26441,6 +27687,9 @@ var DataManager = new Class({ * Internal value setter, called automatically by the `set` method. * * @method Phaser.Data.DataManager#setValue + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @private * @since 3.10.0 * @@ -26486,8 +27735,8 @@ var DataManager = new Class({ var previousValue = list[key]; list[key] = value; - events.emit('changedata', parent, key, value, previousValue); - events.emit('changedata_' + key, parent, value, previousValue); + events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); + events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); } } @@ -26495,7 +27744,7 @@ var DataManager = new Class({ list[key] = data; - events.emit('setdata', parent, key, data); + events.emit(Events.SET_DATA, parent, key, data); } return this; @@ -26540,6 +27789,9 @@ var DataManager = new Class({ * will emit a `changedata` event. * * @method Phaser.Data.DataManager#merge + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * * @param {Object.} data - The data to merge. @@ -26576,6 +27828,7 @@ var DataManager = new Class({ * ``` * * @method Phaser.Data.DataManager#remove + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.0.0 * * @param {(string|string[])} key - The key to remove, or an array of keys to remove. @@ -26609,6 +27862,7 @@ var DataManager = new Class({ * * @method Phaser.Data.DataManager#removeValue * @private + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.10.0 * * @param {string} key - The key to set the value for. @@ -26624,7 +27878,7 @@ var DataManager = new Class({ delete this.list[key]; delete this.values[key]; - this.events.emit('removedata', this.parent, key, data); + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); } return this; @@ -26634,6 +27888,7 @@ var DataManager = new Class({ * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. * * @method Phaser.Data.DataManager#pop + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.0.0 * * @param {string} key - The key of the value to retrieve and delete. @@ -26651,7 +27906,7 @@ var DataManager = new Class({ delete this.list[key]; delete this.values[key]; - this.events.emit('removedata', this, key, data); + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); } return data; @@ -26724,9 +27979,9 @@ var DataManager = new Class({ { this.reset(); - this.events.off('changedata'); - this.events.off('setdata'); - this.events.off('removedata'); + this.events.off(Events.CHANGE_DATA); + this.events.off(Events.SET_DATA); + this.events.off(Events.REMOVE_DATA); this.parent = null; }, @@ -26785,24 +28040,24 @@ module.exports = DataManager; /***/ }), -/* 124 */ +/* 135 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the perimeter of a Rectangle. * * @function Phaser.Geom.Rectangle.Perimeter * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to use. * - * @return {number} [description] + * @return {number} The perimeter of the Rectangle, equal to `(width * 2) + (height * 2)`. */ var Perimeter = function (rect) { @@ -26813,23 +28068,61 @@ module.exports = Perimeter; /***/ }), -/* 125 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); -var Circle = __webpack_require__(71); -var CircleContains = __webpack_require__(40); +/** + * @namespace Phaser.Animations.Events + */ + +module.exports = { + + ADD_ANIMATION: __webpack_require__(1266), + ANIMATION_COMPLETE: __webpack_require__(1265), + ANIMATION_REPEAT: __webpack_require__(1264), + ANIMATION_RESTART: __webpack_require__(1263), + ANIMATION_START: __webpack_require__(1262), + PAUSE_ALL: __webpack_require__(1261), + REMOVE_ANIMATION: __webpack_require__(1260), + RESUME_ALL: __webpack_require__(1259), + SPRITE_ANIMATION_COMPLETE: __webpack_require__(1258), + SPRITE_ANIMATION_KEY_COMPLETE: __webpack_require__(1257), + SPRITE_ANIMATION_KEY_REPEAT: __webpack_require__(1256), + SPRITE_ANIMATION_KEY_RESTART: __webpack_require__(1255), + SPRITE_ANIMATION_KEY_START: __webpack_require__(1254), + SPRITE_ANIMATION_KEY_UPDATE: __webpack_require__(1253), + SPRITE_ANIMATION_REPEAT: __webpack_require__(1252), + SPRITE_ANIMATION_RESTART: __webpack_require__(1251), + SPRITE_ANIMATION_START: __webpack_require__(1250), + SPRITE_ANIMATION_UPDATE: __webpack_require__(1249) + +}; + + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BlendModes = __webpack_require__(60); +var Circle = __webpack_require__(77); +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var GameObject = __webpack_require__(19); -var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(39); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var Rectangle = __webpack_require__(10); +var RectangleContains = __webpack_require__(42); /** * @classdesc @@ -27084,6 +28377,18 @@ var Zone = new Class({ { }, + /** + * A NOOP method so you can pass a Zone to a Container in Canvas. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setBlendMode + * @private + * @since 3.16.2 + */ + setBlendMode: function () + { + }, + /** * A Zone does not render. * @@ -27112,7 +28417,7 @@ module.exports = Zone; /***/ }), -/* 126 */ +/* 138 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -27130,12 +28435,12 @@ var Bodies = {}; module.exports = Bodies; -var Vertices = __webpack_require__(76); -var Common = __webpack_require__(33); -var Body = __webpack_require__(67); -var Bounds = __webpack_require__(80); -var Vector = __webpack_require__(81); -var decomp = __webpack_require__(1069); +var Vertices = __webpack_require__(82); +var Common = __webpack_require__(36); +var Body = __webpack_require__(72); +var Bounds = __webpack_require__(86); +var Vector = __webpack_require__(87); +var decomp = __webpack_require__(1290); (function() { @@ -27449,23 +28754,23 @@ var decomp = __webpack_require__(1069); /***/ }), -/* 127 */ +/* 139 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * @typedef {object} TweenDataGenConfig * - * @property {function} delay - [description] - * @property {function} duration - [description] - * @property {function} hold - [description] - * @property {function} repeat - [description] - * @property {function} repeatDelay - [description] + * @property {function} delay - Time in ms/frames before tween will start. + * @property {function} duration - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {function} hold - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {function} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {function} repeatDelay - Time in ms/frames before the repeat will start. */ /** @@ -27498,26 +28803,28 @@ var decomp = __webpack_require__(1069); */ /** - * [description] + * Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween. + * + * This is an internal function used by the TweenBuilder and should not be accessed directly, instead, Tweens should be created using the GameObjectFactory or GameObjectCreator. * * @function Phaser.Tweens.TweenData * @since 3.0.0 * - * @param {object} target - [description] - * @param {string} key - [description] - * @param {function} getEnd - [description] - * @param {function} getStart - [description] - * @param {function} ease - [description] - * @param {number} delay - [description] - * @param {number} duration - [description] - * @param {boolean} yoyo - [description] - * @param {number} hold - [description] - * @param {number} repeat - [description] - * @param {number} repeatDelay - [description] - * @param {boolean} flipX - [description] - * @param {boolean} flipY - [description] + * @param {object} target - The target to tween. + * @param {string} key - The property of the target to tween. + * @param {function} getEnd - What the property will be at the END of the Tween. + * @param {function} getStart - What the property will be at the START of the Tween. + * @param {function} ease - The ease function this tween uses. + * @param {number} delay - Time in ms/frames before tween will start. + * @param {number} duration - Duration of the tween in ms/frames. + * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. + * @param {number} hold - Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Time in ms/frames before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? * - * @return {TweenDataConfig} [description] + * @return {TweenDataConfig} The config object describing this TweenData. */ var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) { @@ -27602,32 +28909,34 @@ module.exports = TweenData; /***/ }), -/* 128 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GameObjectFactory = __webpack_require__(5); -var TWEEN_CONST = __webpack_require__(83); +var TWEEN_CONST = __webpack_require__(89); /** * @classdesc - * [description] + * A Tween is able to manipulate the properties of one or more objects to any given value, based + * on a duration and type of ease. They are rarely instantiated directly and instead should be + * created via the TweenManager. * * @class Tween * @memberof Phaser.Tweens * @constructor * @since 3.0.0 * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] - * @param {Phaser.Tweens.TweenDataConfig[]} data - [description] - * @param {array} targets - [description] + * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - A reference to the parent of this Tween. Either the Tween Manager or a Tween Timeline instance. + * @param {Phaser.Tweens.TweenDataConfig[]} data - An array of TweenData objects, each containing a unique property to be tweened. + * @param {array} targets - An array of targets to be tweened. */ var Tween = new Class({ @@ -27636,7 +28945,8 @@ var Tween = new Class({ function Tween (parent, data, targets) { /** - * [description] + * A reference to the parent of this Tween. + * Either the Tween Manager or a Tween Timeline instance. * * @name Phaser.Tweens.Tween#parent * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} @@ -27663,7 +28973,7 @@ var Tween = new Class({ this.data = data; /** - * data array doesn't change, so we can cache the length + * The cached length of the data array. * * @name Phaser.Tweens.Tween#totalData * @type {integer} @@ -27672,7 +28982,7 @@ var Tween = new Class({ this.totalData = data.length; /** - * An array of references to the target/s this Tween is operating on + * An array of references to the target/s this Tween is operating on. * * @name Phaser.Tweens.Tween#targets * @type {object[]} @@ -27690,7 +29000,7 @@ var Tween = new Class({ this.totalTargets = targets.length; /** - * If true then duration, delay, etc values are all frame totals. + * If `true` then duration, delay, etc values are all frame totals. * * @name Phaser.Tweens.Tween#useFrames * @type {boolean} @@ -27712,7 +29022,7 @@ var Tween = new Class({ /** * 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) + * When enabled it will play through ALL TweenDatas again. Use TweenData.repeat to loop a single element. * * @name Phaser.Tweens.Tween#loop * @type {number} @@ -27891,12 +29201,12 @@ var Tween = new Class({ }, /** - * [description] + * Returns the current value of the Tween. * * @method Phaser.Tweens.Tween#getValue * @since 3.0.0 * - * @return {number} [description] + * @return {number} The value of the Tween. */ getValue: function () { @@ -27904,14 +29214,14 @@ var Tween = new Class({ }, /** - * [description] + * Set the scale 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. * * @method Phaser.Tweens.Tween#setTimeScale * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The scale factor for timescale. * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ setTimeScale: function (value) { @@ -27921,12 +29231,12 @@ var Tween = new Class({ }, /** - * [description] + * Returns the scale of the time applied to this Tween. * * @method Phaser.Tweens.Tween#getTimeScale * @since 3.0.0 * - * @return {number} [description] + * @return {number} The timescale of this tween (between 0 and 1) */ getTimeScale: function () { @@ -27960,14 +29270,14 @@ var Tween = new Class({ }, /** - * [description] + * See if this Tween is currently acting upon the given target. * * @method Phaser.Tweens.Tween#hasTarget * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - The target to check against this Tween. * - * @return {boolean} [description] + * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`. */ hasTarget: function (target) { @@ -27975,19 +29285,24 @@ var Tween = new Class({ }, /** - * [description] + * Updates the value of a property of this Tween to a new value, without adjusting the + * Tween duration or current progress. + * + * You can optionally tell it to set the 'start' value to be the current value (before the change). * * @method Phaser.Tweens.Tween#updateTo * @since 3.0.0 * - * @param {string} key - [description] - * @param {*} value - [description] - * @param {boolean} startToCurrent - [description] + * @param {string} key - The property to set the new value for. + * @param {*} value - The new value of the property. + * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value? * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ updateTo: function (key, value, startToCurrent) { + if (startToCurrent === undefined) { startToCurrent = false; } + for (var i = 0; i < this.totalData; i++) { var tweenData = this.data[i]; @@ -28009,10 +29324,12 @@ var Tween = new Class({ }, /** - * [description] + * Restarts the tween from the beginning. * * @method Phaser.Tweens.Tween#restart * @since 3.0.0 + * + * @return {this} This Tween instance. */ restart: function () { @@ -28026,10 +29343,12 @@ var Tween = new Class({ this.stop(); this.play(); } + + return this; }, /** - * [description] + * Internal method that calculates the overall duration of the Tween. * * @method Phaser.Tweens.Tween#calcDuration * @since 3.0.0 @@ -28140,7 +29459,7 @@ var Tween = new Class({ }, /** - * [description] + * Internal method that advances to the next state of the Tween during playback. * * @method Phaser.Tweens.Tween#nextState * @since 3.0.0 @@ -28195,12 +29514,12 @@ var Tween = new Class({ }, /** - * [description] + * Pauses the Tween immediately. Use `resume` to continue playback. * * @method Phaser.Tweens.Tween#pause * @since 3.0.0 * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ pause: function () { @@ -28219,18 +29538,22 @@ var Tween = new Class({ }, /** - * [description] + * Starts a Tween playing. + * + * You only need to call this method if you have configured the tween to be paused on creation. * * @method Phaser.Tweens.Tween#play * @since 3.0.0 * - * @param {boolean} resetFromTimeline - [description] + * @param {boolean} resetFromTimeline - Is this Tween being played as part of a Timeline? + * + * @return {this} This Tween instance. */ play: function (resetFromTimeline) { if (this.state === TWEEN_CONST.ACTIVE) { - return; + return this; } else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED) { @@ -28284,15 +29607,17 @@ var Tween = new Class({ this.parent.makeActive(this); } + + return this; }, /** - * [description] + * Internal method that resets all of the Tween Data, including the progress and elapsed values. * * @method Phaser.Tweens.Tween#resetTweenData * @since 3.0.0 * - * @param {boolean} resetFromLoop - [description] + * @param {boolean} resetFromLoop - Has this method been called as part of a loop? */ resetTweenData: function (resetFromLoop) { @@ -28335,7 +29660,7 @@ var Tween = new Class({ * @method Phaser.Tweens.Tween#resume * @since 3.0.0 * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ resume: function () { @@ -28354,12 +29679,14 @@ var Tween = new Class({ }, /** - * [description] + * Attempts to seek to a specific position in a Tween. * * @method Phaser.Tweens.Tween#seek * @since 3.0.0 * - * @param {number} toPosition - A value between 0 and 1. + * @param {number} toPosition - A value between 0 and 1 which represents the progress point to seek to. + * + * @return {this} This Tween instance. */ seek: function (toPosition) { @@ -28418,29 +29745,24 @@ var Tween = new Class({ tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - // console.log(tweenData.key, 'Seek', tweenData.target[tweenData.key], 'to', tweenData.current, 'pro', tweenData.progress, 'marker', toPosition, progress); - - // if (tweenData.current === 0) - // { - // console.log('zero', tweenData.start, tweenData.end, v, 'progress', progress); - // } - tweenData.target[tweenData.key] = tweenData.current; } + + return this; }, /** - * [description] + * Sets an event based callback to be invoked during playback. * * @method Phaser.Tweens.Tween#setCallback * @since 3.0.0 * - * @param {string} type - [description] - * @param {function} callback - [description] - * @param {array} [params] - [description] - * @param {object} [scope] - [description] + * @param {string} type - Type of the callback. + * @param {function} callback - Callback function. + * @param {array} [params] - An array of parameters for specified callbacks types. + * @param {object} [scope] - The context the callback will be invoked in. * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} This Tween instance. */ setCallback: function (type, callback, params, scope) { @@ -28461,6 +29783,8 @@ var Tween = new Class({ * @since 3.2.0 * * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately. + * + * @return {this} This Tween instance. */ complete: function (delay) { @@ -28484,6 +29808,8 @@ var Tween = new Class({ this.state = TWEEN_CONST.PENDING_REMOVE; } + + return this; }, /** @@ -28493,6 +29819,8 @@ var Tween = new Class({ * @since 3.0.0 * * @param {number} [resetTo] - A value between 0 and 1. + * + * @return {this} This Tween instance. */ stop: function (resetTo) { @@ -28514,15 +29842,17 @@ var Tween = new Class({ this.state = TWEEN_CONST.PENDING_REMOVE; } + + return this; }, /** - * [description] + * Internal method that advances the Tween based on the time values. * * @method Phaser.Tweens.Tween#update * @since 3.0.0 * - * @param {number} timestamp - [description] + * @param {number} timestamp - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. * * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. @@ -28623,14 +29953,14 @@ var Tween = new Class({ }, /** - * [description] + * Internal method used as part of the playback process that sets a tween to play in reverse. * * @method Phaser.Tweens.Tween#setStateFromEnd * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * * @return {integer} The state of this Tween. */ @@ -28727,14 +30057,14 @@ var Tween = new Class({ }, /** - * Was PLAYING_BACKWARD and has hit the start. + * Internal method used as part of the playback process that sets a tween to play from the start. * * @method Phaser.Tweens.Tween#setStateFromStart * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * * @return {integer} The state of this Tween. */ @@ -28790,15 +30120,14 @@ var Tween = new Class({ return TWEEN_CONST.COMPLETE; }, - // /** - * [description] + * Internal method that advances the TweenData based on the time value given. * * @method Phaser.Tweens.Tween#updateTweenData * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update. * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true * * @return {boolean} [description] @@ -29003,12 +30332,12 @@ module.exports = Tween; /***/ }), -/* 129 */ +/* 141 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -29046,12 +30375,12 @@ module.exports = TWEEN_DEFAULTS; /***/ }), -/* 130 */ +/* 142 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -29071,15 +30400,17 @@ function hasGetters (def) } /** - * [description] + * Returns `getStart` and `getEnd` functions for a Tween's Data based on a target property and end value. + * + * If the end value is a number, it will be treated as an absolute value and the property will be tweened to it. A string can be provided to specify a relative end value which consists of an operation (`+=` to add to the current value, `-=` to subtract from the current value, `*=` to multiply the current value, or `/=` to divide the current value) followed by its operand. A function can be provided to allow greater control over the end value; it will receive the target object being tweened, the name of the property being tweened, and the current value of the property as its arguments. If both the starting and the ending values need to be controlled, an object with `getStart` and `getEnd` callbacks, which will receive the same arguments, can be provided instead. If an object with a `value` property is provided, the property will be used as the effective value under the same rules described here. * * @function Phaser.Tweens.Builders.GetValueOp * @since 3.0.0 * - * @param {string} key - [description] - * @param {*} propertyValue - [description] + * @param {string} key - The name of the property to modify. + * @param {*} propertyValue - The ending value of the property, as described above. * - * @return {function} [description] + * @return {function} An array of two functions, `getStart` and `getEnd`, which return the starting and the ending value of the property based on the provided value. */ var GetValueOp = function (key, propertyValue) { @@ -29219,26 +30550,28 @@ module.exports = GetValueOp; /***/ }), -/* 131 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); /** - * [description] + * Extracts an array of targets from a Tween configuration object. + * + * The targets will be looked for in a `targets` property. If it's a function, its return value will be used as the result. * * @function Phaser.Tweens.Builders.GetTargets * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object to use. * - * @return {array} [description] + * @return {array} An array of targets (may contain only one element), or `null` if no targets were specified. */ var GetTargets = function (config) { @@ -29266,19 +30599,19 @@ module.exports = GetTargets; /***/ }), -/* 132 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var MapData = __webpack_require__(77); -var Parse = __webpack_require__(217); -var Tilemap = __webpack_require__(209); +var Formats = __webpack_require__(31); +var MapData = __webpack_require__(83); +var Parse = __webpack_require__(233); +var Tilemap = __webpack_require__(225); /** * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When @@ -29352,19 +30685,19 @@ module.exports = ParseToTilemap; /***/ }), -/* 133 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var LayerData = __webpack_require__(78); -var MapData = __webpack_require__(77); -var Tile = __webpack_require__(55); +var Formats = __webpack_require__(31); +var LayerData = __webpack_require__(84); +var MapData = __webpack_require__(83); +var Tile = __webpack_require__(61); /** * Parses a 2D array of tile indexes into a new MapData object with a single layer. @@ -29444,12 +30777,12 @@ module.exports = Parse2DArray; /***/ }), -/* 134 */ +/* 146 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -29483,19 +30816,19 @@ module.exports = SetLayerCollisionIndex; /***/ }), -/* 135 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tile = __webpack_require__(55); -var IsInLayerBounds = __webpack_require__(79); -var CalculateFacesAt = __webpack_require__(136); -var SetTileCollision = __webpack_require__(56); +var Tile = __webpack_require__(61); +var IsInLayerBounds = __webpack_require__(85); +var CalculateFacesAt = __webpack_require__(148); +var SetTileCollision = __webpack_require__(62); /** * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index @@ -29563,16 +30896,16 @@ module.exports = PutTileAt; /***/ }), -/* 136 */ +/* 148 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTileAt = __webpack_require__(102); +var GetTileAt = __webpack_require__(109); /** * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting @@ -29639,7 +30972,7 @@ module.exports = CalculateFacesAt; /***/ }), -/* 137 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29657,10 +30990,10 @@ var Composite = {}; module.exports = Composite; -var Events = __webpack_require__(195); -var Common = __webpack_require__(33); -var Bounds = __webpack_require__(80); -var Body = __webpack_require__(67); +var Events = __webpack_require__(210); +var Common = __webpack_require__(36); +var Bounds = __webpack_require__(86); +var Body = __webpack_require__(72); (function() { @@ -30330,808 +31663,22 @@ var Body = __webpack_require__(67); /***/ }), -/* 138 */ +/* 150 */ /***/ (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 - * A representation of a vector in 3D space. - * - * A three-component vector. - * - * @class Vector3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - */ -var Vector3 = new Class({ - - initialize: - - function Vector3 (x, y, z) - { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector3#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector3#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector3#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - }, - - /** - * Set this Vector to point up. - * - * Sets the y component of the vector to 1, and the others to 0. - * - * @method Phaser.Math.Vector3#up - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - up: function () - { - this.x = 0; - this.y = 1; - this.z = 0; - - return this; - }, - - /** - * Make a clone of this Vector3. - * - * @method Phaser.Math.Vector3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. - */ - clone: function () - { - return new Vector3(this.x, this.y, this.z); - }, - - /** - * Calculate the cross (vector) product of two given Vectors. - * - * @method Phaser.Math.Vector3#crossVectors - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - The first Vector to multiply. - * @param {Phaser.Math.Vector3} b - The second Vector to multiply. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - crossVectors: function (a, b) - { - var ax = a.x; - var ay = a.y; - var az = a.z; - var bx = b.x; - var by = b.y; - var bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict equality check against each Vector's components. - * - * @method Phaser.Math.Vector3#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. - * - * @return {boolean} True if the two vectors strictly match, otherwise false. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector3#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - - return this; - }, - - /** - * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. - * - * @method Phaser.Math.Vector3#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. - * @param {number} [y] - The y value to set for this Vector. - * @param {number} [z] - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - set: function (x, y, z) - { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - - return this; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector3#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector3#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - - return this; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector3#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - scale: function (scale) - { - if (isFinite(scale)) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - } - else - { - this.x = 0; - this.y = 0; - this.z = 0; - } - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - - return this; - }, - - /** - * Negate the `x`, `y` and `z` components of this Vector. - * - * @method Phaser.Math.Vector3#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector3#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return dx * dx + dy * dy + dz * dz; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector3#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return Math.sqrt(x * x + y * y + z * z); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector3#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return x * x + y * y + z * z; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector3#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var len = x * x + y * y + z * z; - - if (len > 0) - { - len = 1 / Math.sqrt(len); - - this.x = x * len; - this.y = y * len; - this.z = z * len; - } - - return this; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. - * - * @return {number} The dot product of this Vector and `v`. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z; - }, - - /** - * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. - * - * @method Phaser.Math.Vector3#cross - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector to cross product with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - cross: function (v) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var bx = v.x; - var by = v.y; - var bz = v.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector3#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = x * m[0] + y * m[3] + z * m[6]; - this.y = x * m[1] + y * m[4] + z * m[7]; - this.z = x * m[2] + y * m[5] + z * m[8]; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Vector3#transformCoordinates - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformCoordinates: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; - - this.x = tx / tw; - this.y = ty / tw; - this.z = tz / tw; - - return this; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector3#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - 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; - - // 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; - - // 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; - }, - - /** - * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, - * e.g. unprojecting a 2D point into 3D space. - * - * @method Phaser.Math.Vector3#project - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - project: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var a00 = m[0]; - var a01 = m[1]; - var a02 = m[2]; - var a03 = m[3]; - var a10 = m[4]; - var a11 = m[5]; - var a12 = m[6]; - var a13 = m[7]; - var a20 = m[8]; - var a21 = m[9]; - var a22 = m[10]; - var a23 = m[11]; - var a30 = m[12]; - var a31 = m[13]; - var a32 = m[14]; - var a33 = m[15]; - - var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); - - this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; - this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; - this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; - - return this; - }, - - /** - * Unproject this point from 2D space to 3D space. - * The point should have its x and y properties set to - * 2D screen space, and the z either at 0 (near plane) - * or 1 (far plane). The provided matrix is assumed to already - * be combined, i.e. projection * view * model. - * - * After this operation, this vector's (x, y, z) components will - * represent the unprojected 3D coordinate. - * - * @method Phaser.Math.Vector3#unproject - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. - * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - unproject: function (viewport, invProjectionView) - { - var viewX = viewport.x; - var viewY = viewport.y; - var viewWidth = viewport.z; - var viewHeight = viewport.w; - - var x = this.x - viewX; - var y = (viewHeight - this.y - 1) - viewY; - var z = this.z; - - this.x = (2 * x) / viewWidth - 1; - this.y = (2 * y) / viewHeight - 1; - this.z = 2 * z - 1; - - return this.project(invProjectionView); - }, - - /** - * Make this Vector the zero vector (0, 0, 0). - * - * @method Phaser.Math.Vector3#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - - return this; - } - -}); - -/* -Vector3.Zero = function () -{ - return new Vector3(0, 0, 0); -}; - -Vector3.Up = function () -{ - return new Vector3(0, 1.0, 0); -}; - -Vector3.Copy = function (source) -{ - return new Vector3(source.x, source.y, source.z); -}; - -Vector3.TransformCoordinates = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]) + transformation.m[12]; - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]) + transformation.m[13]; - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]) + transformation.m[14]; - var w = (vector.x * transformation.m[3]) + (vector.y * transformation.m[7]) + (vector.z * transformation.m[11]) + transformation.m[15]; - - return new Vector3(x / w, y / w, z / w); -}; - -Vector3.TransformNormal = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]); - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]); - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]); - - return new Vector3(x, y, z); -}; - -Vector3.Dot = function (left, right) -{ - return (left.x * right.x + left.y * right.y + left.z * right.z); -}; - -Vector3.Cross = function (left, right) -{ - var x = left.y * right.z - left.z * right.y; - var y = left.z * right.x - left.x * right.z; - var z = left.x * right.y - left.y * right.x; - - return new Vector3(x, y, z); -}; - -Vector3.Normalize = function (vector) -{ - var newVector = Vector3.Copy(vector); - newVector.normalize(); - - return newVector; -}; - -Vector3.Distance = function (value1, value2) -{ - return Math.sqrt(Vector3.DistanceSquared(value1, value2)); -}; - -Vector3.DistanceSquared = function (value1, value2) -{ - var x = value1.x - value2.x; - var y = value1.y - value2.y; - var z = value1.z - value2.z; - - return (x * x) + (y * y) + (z * z); -}; -*/ - -module.exports = Vector3; - - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); -var ParseXML = __webpack_require__(343); +var ParseXML = __webpack_require__(344); /** * @typedef {object} Phaser.Loader.FileTypes.XMLFileConfig @@ -31310,17 +31857,17 @@ module.exports = XMLFile; /***/ }), -/* 140 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Extend = __webpack_require__(20); -var XHRSettings = __webpack_require__(105); +var Extend = __webpack_require__(19); +var XHRSettings = __webpack_require__(112); /** * Takes two XHRSettings Objects and creates a new XHRSettings object from them. @@ -31358,12 +31905,12 @@ module.exports = MergeXHRSettings; /***/ }), -/* 141 */ +/* 152 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -31399,550 +31946,55 @@ module.exports = GetURL; /***/ }), -/* 142 */ -/***/ (function(module, exports) { +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Snap a value to nearest grid slice, using floor. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. - * As will `14` snap to `10`... but `16` will snap to `15`. - * - * @function Phaser.Math.Snap.Floor - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapFloor = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.floor(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapFloor; - - -/***/ }), -/* 143 */ -/***/ (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.Input.Gamepad.Events */ -/** - * Keyboard Codes. - * - * @name Phaser.Input.Keyboard.KeyCodes - * @enum {integer} - * @memberof Phaser.Input.Keyboard - * @readonly - * @since 3.0.0 - */ - -var KeyCodes = { - - /** - * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE - */ - BACKSPACE: 8, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.TAB - */ - TAB: 9, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.ENTER - */ - ENTER: 13, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.SHIFT - */ - SHIFT: 16, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.CTRL - */ - CTRL: 17, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.ALT - */ - ALT: 18, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PAUSE - */ - PAUSE: 19, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK - */ - CAPS_LOCK: 20, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.ESC - */ - ESC: 27, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.SPACE - */ - SPACE: 32, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP - */ - PAGE_UP: 33, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN - */ - PAGE_DOWN: 34, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.END - */ - END: 35, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.HOME - */ - HOME: 36, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.LEFT - */ - LEFT: 37, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.UP - */ - UP: 38, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.RIGHT - */ - RIGHT: 39, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.DOWN - */ - DOWN: 40, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN - */ - PRINT_SCREEN: 42, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.INSERT - */ - INSERT: 45, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.DELETE - */ - DELETE: 46, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.ZERO - */ - ZERO: 48, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.ONE - */ - ONE: 49, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.TWO - */ - TWO: 50, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.THREE - */ - THREE: 51, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.FOUR - */ - FOUR: 52, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.FIVE - */ - FIVE: 53, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.SIX - */ - SIX: 54, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.SEVEN - */ - SEVEN: 55, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.EIGHT - */ - EIGHT: 56, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NINE - */ - NINE: 57, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO - */ - NUMPAD_ZERO: 96, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE - */ - NUMPAD_ONE: 97, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO - */ - NUMPAD_TWO: 98, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE - */ - NUMPAD_THREE: 99, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR - */ - NUMPAD_FOUR: 100, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE - */ - NUMPAD_FIVE: 101, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX - */ - NUMPAD_SIX: 102, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN - */ - NUMPAD_SEVEN: 103, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT - */ - NUMPAD_EIGHT: 104, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE - */ - NUMPAD_NINE: 105, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.A - */ - A: 65, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.B - */ - B: 66, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.C - */ - C: 67, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.D - */ - D: 68, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.E - */ - E: 69, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F - */ - F: 70, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.G - */ - G: 71, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.H - */ - H: 72, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.I - */ - I: 73, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.J - */ - J: 74, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.K - */ - K: 75, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.L - */ - L: 76, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.M - */ - M: 77, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.N - */ - N: 78, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.O - */ - O: 79, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.P - */ - P: 80, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.Q - */ - Q: 81, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.R - */ - R: 82, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.S - */ - S: 83, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.T - */ - T: 84, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.U - */ - U: 85, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.V - */ - V: 86, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.W - */ - W: 87, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.X - */ - X: 88, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.Y - */ - Y: 89, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.Z - */ - Z: 90, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F1 - */ - F1: 112, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F2 - */ - F2: 113, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F3 - */ - F3: 114, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F4 - */ - F4: 115, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F5 - */ - F5: 116, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F6 - */ - F6: 117, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F7 - */ - F7: 118, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F8 - */ - F8: 119, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F9 - */ - F9: 120, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F10 - */ - F10: 121, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F11 - */ - F11: 122, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F12 - */ - F12: 123, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON - */ - SEMICOLON: 186, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PLUS - */ - PLUS: 187, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.COMMA - */ - COMMA: 188, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.MINUS - */ - MINUS: 189, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PERIOD - */ - PERIOD: 190, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH - */ - FORWARD_SLASH: 191, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH - */ - BACK_SLASH: 220, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.QUOTES - */ - QUOTES: 222, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK - */ - BACKTICK: 192, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET - */ - OPEN_BRACKET: 219, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET - */ - CLOSED_BRACKET: 221 +module.exports = { + + BUTTON_DOWN: __webpack_require__(633), + BUTTON_UP: __webpack_require__(632), + CONNECTED: __webpack_require__(631), + DISCONNECTED: __webpack_require__(630), + GAMEPAD_BUTTON_DOWN: __webpack_require__(629), + GAMEPAD_BUTTON_UP: __webpack_require__(628) }; -module.exports = KeyCodes; - /***/ }), -/* 144 */ +/* 154 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rotates an entire Triangle at a given angle about a specific point. * * @function Phaser.Geom.Triangle.RotateAroundXY * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} x - The X coordinate of the point to rotate the Triangle about. + * @param {number} y - The Y coordinate of the point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var RotateAroundXY = function (triangle, x, y, angle) { @@ -31974,24 +32026,24 @@ module.exports = RotateAroundXY; /***/ }), -/* 145 */ +/* 155 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the width/height ratio of a rectangle. * * @function Phaser.Geom.Rectangle.GetAspectRatio * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle. * - * @return {number} [description] + * @return {number} The width/height ratio of the rectangle. */ var GetAspectRatio = function (rect) { @@ -32002,12 +32054,12 @@ module.exports = GetAspectRatio; /***/ }), -/* 146 */ +/* 156 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -32050,12 +32102,12 @@ module.exports = RotateAroundXY; /***/ }), -/* 147 */ +/* 157 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -32137,25 +32189,27 @@ module.exports = ContainsArray; /***/ }), -/* 148 */ +/* 158 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if two Rectangles intersect. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle. * * @function Phaser.Geom.Intersects.RectangleToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. */ var RectangleToRectangle = function (rectA, rectB) { @@ -32171,17 +32225,17 @@ module.exports = RectangleToRectangle; /***/ }), -/* 149 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Mesh = __webpack_require__(108); +var Mesh = __webpack_require__(116); /** * @classdesc @@ -32832,12 +32886,12 @@ module.exports = Quad; /***/ }), -/* 150 */ +/* 160 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -32881,29 +32935,41 @@ module.exports = Contains; /***/ }), -/* 151 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(150); -var GetPoints = __webpack_require__(284); +var Contains = __webpack_require__(160); +var GetPoints = __webpack_require__(289); /** * @classdesc - * [description] + * A Polygon object + * + + * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. + * Several formats are supported to define the list of points, check the setTo method for details. + * This is a geometry object allowing you to define and inspect the shape. + * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. + * To render a Polygon you should look at the capabilities of the Graphics class. * * @class Polygon * @memberof Phaser.Geom * @constructor * @since 3.0.0 * - * @param {Phaser.Geom.Point[]} [points] - [description] + * @param {Phaser.Geom.Point[]} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: + * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` + * - An array of objects with public x y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` */ var Polygon = new Class({ @@ -32968,7 +33034,7 @@ var Polygon = new Class({ * @method Phaser.Geom.Polygon#setTo * @since 3.0.0 * - * @param {array} points - [description] + * @param {array} points - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. * * @return {Phaser.Geom.Polygon} This Polygon object. */ @@ -33090,23 +33156,23 @@ module.exports = Polygon; /***/ }), -/* 152 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var CONST = __webpack_require__(26); -var GameObject = __webpack_require__(19); -var GetPowerOfTwo = __webpack_require__(294); -var Smoothing = __webpack_require__(120); -var TileSpriteRender = __webpack_require__(805); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var GameObject = __webpack_require__(18); +var GetPowerOfTwo = __webpack_require__(376); +var Smoothing = __webpack_require__(130); +var TileSpriteRender = __webpack_require__(828); var Vector2 = __webpack_require__(3); // bitmask flag for GameObject.renderMask @@ -33119,8 +33185,8 @@ var _FLAG = 8; // 1000 * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and * are designed so that you can create game backdrops using seamless textures as a source. * - * You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background - * that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition` + * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background + * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. @@ -33471,22 +33537,18 @@ var TileSprite = new Class({ * @method Phaser.GameObjects.TileSprite#setTileScale * @since 3.12.0 * - * @param {number} [x] - The horizontal scale of the tiling texture. - * @param {number} [y] - The vertical scale of the tiling texture. + * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value. + * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value. * * @return {this} This Tile Sprite instance. */ setTileScale: function (x, y) { - if (x !== undefined) - { - this.tileScaleX = x; - } + if (x === undefined) { x = this.tileScaleX; } + if (y === undefined) { y = x; } - if (y !== undefined) - { - this.tileScaleY = y; - } + this.tileScaleX = x; + this.tileScaleY = y; return this; }, @@ -33500,7 +33562,7 @@ var TileSprite = new Class({ */ updateTileTexture: function () { - if (!this.dirty) + if (!this.dirty || !this.renderer) { return; } @@ -33565,6 +33627,9 @@ var TileSprite = new Class({ canvas.height = this.height; this.frame.setSize(this.width, this.height); + this.updateDisplayOrigin(); + + this.dirty = true; } if (!this.dirty || this.renderer && this.renderer.gl) @@ -33730,26 +33795,26 @@ module.exports = TileSprite; /***/ }), -/* 153 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(169); +var AddToDOM = __webpack_require__(179); var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var CONST = __webpack_require__(26); -var GameObject = __webpack_require__(19); -var GetTextSize = __webpack_require__(811); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var GameObject = __webpack_require__(18); +var GetTextSize = __webpack_require__(834); var GetValue = __webpack_require__(4); -var RemoveFromDOM = __webpack_require__(342); -var TextRender = __webpack_require__(810); -var TextStyle = __webpack_require__(807); +var RemoveFromDOM = __webpack_require__(343); +var TextRender = __webpack_require__(833); +var TextStyle = __webpack_require__(830); /** * @classdesc @@ -33762,6 +33827,21 @@ var TextStyle = __webpack_require__(807); * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes, either + * when creating the Text object, or when setting the font via `setFont` or `setFontFamily`. I.e.: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: '"Roboto Condensed"' }); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: 'Verdana, "Times New Roman", Tahoma, serif' }); + * ``` * * You can only display fonts that are currently loaded and available to the browser: therefore fonts must * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, @@ -33873,7 +33953,7 @@ var Text = new Class({ * Manages the style of this Text object. * * @name Phaser.GameObjects.Text#style - * @type {Phaser.GameObjects.Text.TextStyle} + * @type {Phaser.GameObjects.TextStyle} * @since 3.0.0 */ this.style = new TextStyle(this, style); @@ -34364,6 +34444,20 @@ var Text = new Class({ * * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFont * @since 3.0.0 @@ -34379,6 +34473,20 @@ var Text = new Class({ /** * Set the font family. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFontFamily * @since 3.0.0 @@ -34456,18 +34564,23 @@ var Text = new Class({ }, /** - * Set the text fill color. + * Set the fill style to be used by the Text object. + * + * This can be any valid CanvasRenderingContext2D fillStyle value, such as + * a color (in hex, rgb, rgba, hsl or named values), a gradient or a pattern. + * + * See the [MDN fillStyle docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) for more details. * * @method Phaser.GameObjects.Text#setFill * @since 3.0.0 * - * @param {string} color - The text fill color. + * @param {(string|any)} color - The text fill style. Can be any valid CanvasRenderingContext `fillStyle` value. * * @return {Phaser.GameObjects.Text} This Text object. */ - setFill: function (color) + setFill: function (fillStyle) { - return this.style.setFill(color); + return this.style.setFill(fillStyle); }, /** @@ -35011,24 +35124,26 @@ module.exports = Text; /***/ }), -/* 154 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(121); +var BlendModes = __webpack_require__(60); +var Camera = __webpack_require__(131); var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var CONST = __webpack_require__(26); -var Frame = __webpack_require__(113); -var GameObject = __webpack_require__(19); -var Render = __webpack_require__(817); -var UUID = __webpack_require__(295); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var Frame = __webpack_require__(121); +var GameObject = __webpack_require__(18); +var Render = __webpack_require__(840); +var Utils = __webpack_require__(9); +var UUID = __webpack_require__(299); /** * @classdesc @@ -35037,6 +35152,11 @@ var UUID = __webpack_require__(295); * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads. + * + * Note that under WebGL a FrameBuffer, which is what the Render Texture uses internally, cannot be anti-aliased. This means + * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this + * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that + * to the Render Texture. * * @class RenderTexture * @extends Phaser.GameObjects.GameObject @@ -35138,8 +35258,7 @@ var RenderTexture = new Class({ this.globalAlpha = 1; /** - * The HTML Canvas Element that the Render Texture is drawing to. - * This is only populated if Phaser is running with the Canvas Renderer. + * The HTML Canvas Element that the Render Texture is drawing to when using the Canvas Renderer. * * @name Phaser.GameObjects.RenderTexture#canvas * @type {HTMLCanvasElement} @@ -35204,6 +35323,16 @@ var RenderTexture = new Class({ */ this._saved = false; + /** + * Internal erase mode flag. + * + * @name Phaser.GameObjects.RenderTexture#_eraseMode + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._eraseMode = false; + /** * An internal Camera that can be used to move around the Render Texture. * Control it just like you would any Scene Camera. The difference is that it only impacts the placement of what @@ -35260,7 +35389,7 @@ var RenderTexture = new Class({ /** * Sets the size of this Game Object. * - * @method Phaser.GameObjects.Components.Size#setSize + * @method Phaser.GameObjects.RenderTexture#setSize * @since 3.0.0 * * @param {number} width - The width of this Game Object. @@ -35415,25 +35544,31 @@ var RenderTexture = new Class({ { if (alpha === undefined) { alpha = 1; } - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; + var r = ((rgb >> 16) | 0) & 0xff; + var g = ((rgb >> 8) | 0) & 0xff; + var b = (rgb | 0) & 0xff; - if (this.gl) + var gl = this.gl; + + if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var renderer = this.renderer; - var gl = this.gl; - - gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, alpha); - - gl.clear(gl.COLOR_BUFFER_BIT); - - this.renderer.setFramebuffer(null); + var bounds = this.getBounds(); + + renderer.setFramebuffer(this.framebuffer, true); + + this.pipeline.drawFillRect( + bounds.x, bounds.y, bounds.right, bounds.bottom, + Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1), + alpha + ); + + renderer.setFramebuffer(null, true); } else { - this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')'; + this.context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'; this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); } @@ -35452,17 +35587,18 @@ var RenderTexture = new Class({ { if (this.dirty) { - if (this.gl) - { - this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + + if (gl) + { + var renderer = this.renderer; + + renderer.setFramebuffer(this.framebuffer, true); - var gl = this.gl; - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - this.renderer.setFramebuffer(null); + + renderer.setFramebuffer(null, true); } else { @@ -35480,6 +35616,70 @@ var RenderTexture = new Class({ return this; }, + /** + * Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE. + * This has the effect of erasing any filled pixels in the objects from this Render Texture. + * + * It can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Dynamic and Static Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. + * * Another Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up a texture from the Texture Manager. + * + * Note: You cannot erase a Render Texture from itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * @method Phaser.GameObjects.RenderTexture#erase + * @since 3.16.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. + * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object. + * + * @return {this} This Render Texture instance. + */ + erase: function (entries, x, y) + { + this._eraseMode = true; + + var blendMode = this.renderer.currentBlendMode; + + this.renderer.setBlendMode(BlendModes.ERASE); + + this.draw(entries, x, y, 1, 16777215); + + this.renderer.setBlendMode(blendMode); + + this._eraseMode = false; + + return this; + }, + /** * Draws the given object, or an array of objects, to this Render Texture. * @@ -35552,11 +35752,18 @@ var RenderTexture = new Class({ var gl = this.gl; - this.camera.preRender(1, 1, 1); + this.camera.preRender(1, 1); if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var cx = this.camera._cx; + var cy = this.camera._cy; + var cw = this.camera._cw; + var ch = this.camera._ch; + + this.renderer.setFramebuffer(this.framebuffer, false); + + this.renderer.pushScissor(cx, cy, cw, ch, ch); var pipeline = this.pipeline; @@ -35566,7 +35773,9 @@ var RenderTexture = new Class({ pipeline.flush(); - this.renderer.setFramebuffer(null); + this.renderer.setFramebuffer(null, false); + + this.renderer.popScissor(); pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); } @@ -35634,11 +35843,18 @@ var RenderTexture = new Class({ if (textureFrame) { - this.camera.preRender(1, 1, 1); + this.camera.preRender(1, 1); if (gl) { - this.renderer.setFramebuffer(this.framebuffer); + var cx = this.camera._cx; + var cy = this.camera._cy; + var cw = this.camera._cw; + var ch = this.camera._ch; + + this.renderer.setFramebuffer(this.framebuffer, false); + + this.renderer.pushScissor(cx, cy, cw, ch, ch); var pipeline = this.pipeline; @@ -35648,8 +35864,10 @@ var RenderTexture = new Class({ pipeline.flush(); - this.renderer.setFramebuffer(null); - + this.renderer.setFramebuffer(null, false); + + this.renderer.popScissor(); + pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); } else @@ -35764,7 +35982,10 @@ var RenderTexture = new Class({ var prevX = gameObject.x; var prevY = gameObject.y; - this.renderer.setBlendMode(gameObject.blendMode); + if (!this._eraseMode) + { + this.renderer.setBlendMode(gameObject.blendMode); + } gameObject.setPosition(x, y); @@ -35792,11 +36013,23 @@ var RenderTexture = new Class({ var prevX = gameObject.x; var prevY = gameObject.y; + if (this._eraseMode) + { + var blendMode = gameObject.blendMode; + + gameObject.blendMode = BlendModes.ERASE; + } + gameObject.setPosition(x, y); gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null); gameObject.setPosition(prevX, prevY); + + if (this._eraseMode) + { + gameObject.blendMode = blendMode; + } }, /** @@ -35881,6 +36114,12 @@ var RenderTexture = new Class({ } this.texture.destroy(); + this.camera.destroy(); + + this.canvas = null; + this.context = null; + this.framebuffer = null; + this.texture = null; } } @@ -35890,22 +36129,22 @@ module.exports = RenderTexture; /***/ }), -/* 155 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var GameObject = __webpack_require__(19); -var GravityWell = __webpack_require__(304); -var List = __webpack_require__(112); -var ParticleEmitter = __webpack_require__(302); -var Render = __webpack_require__(821); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var GravityWell = __webpack_require__(307); +var List = __webpack_require__(120); +var ParticleEmitter = __webpack_require__(305); +var Render = __webpack_require__(844); /** * @classdesc @@ -36362,12 +36601,12 @@ module.exports = ParticleEmitterManager; /***/ }), -/* 156 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -36404,19 +36643,15 @@ module.exports = CircumferencePoint; /***/ }), -/* 157 */ +/* 167 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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, @@ -36447,33 +36682,33 @@ module.exports = { /***/ }), -/* 158 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(121); +var BaseCamera = __webpack_require__(131); var Class = __webpack_require__(0); -var Commands = __webpack_require__(157); -var ComponentsAlpha = __webpack_require__(401); -var ComponentsBlendMode = __webpack_require__(400); -var ComponentsDepth = __webpack_require__(399); -var ComponentsMask = __webpack_require__(395); -var ComponentsPipeline = __webpack_require__(186); -var ComponentsTransform = __webpack_require__(390); -var ComponentsVisible = __webpack_require__(389); -var ComponentsScrollFactor = __webpack_require__(392); +var Commands = __webpack_require__(167); +var ComponentsAlpha = __webpack_require__(435); +var ComponentsBlendMode = __webpack_require__(432); +var ComponentsDepth = __webpack_require__(431); +var ComponentsMask = __webpack_require__(427); +var ComponentsPipeline = __webpack_require__(200); +var ComponentsTransform = __webpack_require__(422); +var ComponentsVisible = __webpack_require__(421); +var ComponentsScrollFactor = __webpack_require__(424); -var Ellipse = __webpack_require__(90); -var GameObject = __webpack_require__(19); +var Ellipse = __webpack_require__(96); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var MATH_CONST = __webpack_require__(16); -var Render = __webpack_require__(831); +var MATH_CONST = __webpack_require__(20); +var Render = __webpack_require__(854); /** * Graphics line style (or stroke style) settings. @@ -36958,6 +37193,26 @@ var Graphics = new Class({ return this; }, + /** + * Fill the current path. + * + * This is an alias for `Graphics.fillPath` and does the same thing. + * It was added to match the CanvasRenderingContext 2D API. + * + * @method Phaser.GameObjects.Graphics#fill + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Graphics} This Game Object. + */ + fill: function () + { + this.commandBuffer.push( + Commands.FILL_PATH + ); + + return this; + }, + /** * Stroke the current path. * @@ -36975,6 +37230,26 @@ var Graphics = new Class({ return this; }, + /** + * Stroke the current path. + * + * This is an alias for `Graphics.strokePath` and does the same thing. + * It was added to match the CanvasRenderingContext 2D API. + * + * @method Phaser.GameObjects.Graphics#stroke + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Graphics} This Game Object. + */ + stroke: function () + { + this.commandBuffer.push( + Commands.STROKE_PATH + ); + + return this; + }, + /** * Fill the given circle. * @@ -37142,6 +37417,15 @@ var Graphics = new Class({ return this; }, + /** + * @typedef {object} RoundedRectRadius + * + * @property {number} [tl=20] - Top left + * @property {number} [tr=20] - Top right + * @property {number} [br=20] - Bottom right + * @property {number} [bl=20] - Bottom left + */ + /** * Fill a rounded rectangle with the given position, size and radius. * @@ -37152,11 +37436,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -37202,11 +37482,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -37457,15 +37733,15 @@ var Graphics = new Class({ }, /** - * [description] + * Draw a line from the current drawing position to the given position with a specific width and color. * * @method Phaser.GameObjects.Graphics#lineFxTo * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} rgb - [description] + * @param {number} x - The x coordinate to draw the line to. + * @param {number} y - The y coordinate to draw the line to. + * @param {number} width - The width of the stroke. + * @param {number} rgb - The color of the stroke. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -37480,15 +37756,15 @@ var Graphics = new Class({ }, /** - * [description] + * Move the current drawing position to the given position and change the pen width and color. * * @method Phaser.GameObjects.Graphics#moveFxTo * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} rgb - [description] + * @param {number} x - The x coordinate to move to. + * @param {number} y - The y coordinate to move to. + * @param {number} width - The new stroke width. + * @param {number} rgb - The new stroke color. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -37898,8 +38174,8 @@ var Graphics = new Class({ var sys = this.scene.sys; var renderer = sys.game.renderer; - if (width === undefined) { width = sys.game.config.width; } - if (height === undefined) { height = sys.game.config.height; } + if (width === undefined) { width = sys.scale.width; } + if (height === undefined) { height = sys.scale.height; } Graphics.TargetCamera.setScene(this.scene); Graphics.TargetCamera.setViewport(0, 0, width, height); @@ -37981,23 +38257,24 @@ module.exports = Graphics; /***/ }), -/* 159 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(109); +var BitmapText = __webpack_require__(117); var Class = __webpack_require__(0); -var Render = __webpack_require__(834); +var Render = __webpack_require__(860); /** * @typedef {object} DisplayCallbackConfig * - * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. + * @property {Phaser.GameObjects.DynamicBitmapText} parent - The Dynamic Bitmap Text object that owns this character being rendered. + * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. Always zero in Canvas. * @property {number} index - The index of the character being rendered. * @property {number} charCode - The character code of the character being rendered. * @property {number} x - The x position of the character being rendered. @@ -38135,6 +38412,7 @@ var DynamicBitmapText = new Class({ * @since 3.11.0 */ this.callbackData = { + parent: this, color: 0, tint: { topLeft: 0, @@ -38234,24 +38512,25 @@ module.exports = DynamicBitmapText; /***/ }), -/* 160 */ +/* 170 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayUtils = __webpack_require__(164); -var BlendModes = __webpack_require__(66); +var ArrayUtils = __webpack_require__(174); +var BlendModes = __webpack_require__(60); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var GameObject = __webpack_require__(19); -var Rectangle = __webpack_require__(9); -var Render = __webpack_require__(837); -var Union = __webpack_require__(309); +var Components = __webpack_require__(13); +var Events = __webpack_require__(133); +var GameObject = __webpack_require__(18); +var Rectangle = __webpack_require__(10); +var Render = __webpack_require__(863); +var Union = __webpack_require__(313); var Vector2 = __webpack_require__(3); /** @@ -38602,7 +38881,7 @@ var Container = new Class({ */ addHandler: function (gameObject) { - gameObject.once('destroy', this.remove, this); + gameObject.once(Events.DESTROY, this.remove, this); if (this.exclusive) { @@ -38628,7 +38907,7 @@ var Container = new Class({ */ removeHandler: function (gameObject) { - gameObject.off('destroy', this.remove); + gameObject.off(Events.DESTROY, this.remove); if (this.exclusive) { @@ -38763,36 +39042,28 @@ var Container = new Class({ * @since 3.4.0 * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.GameObjects.Container} This Container instance. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - ArrayUtils.StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal sort handler method. - * - * @method Phaser.GameObjects.Container#sortHandler - * @private - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} childA - The first child to sort. - * @param {Phaser.GameObjects.GameObject} childB - The second child to sort. - * - * @return {integer} The sort results. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + ArrayUtils.StableSort.inplace(this.list, handler); + + return this; }, /** @@ -38840,8 +39111,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getFirst * @since 3.4.0 * - * @param {string} [property] - The property to test on each Game Object in the Container. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {string} property - The property to test on each Game Object in the Container. + * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. * @param {integer} [startIndex=0] - An optional start index to search from. * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) * @@ -38849,7 +39120,7 @@ var Container = new Class({ */ getFirst: function (property, value, startIndex, endIndex) { - return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex); + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); }, /** @@ -39471,27 +39742,27 @@ module.exports = Container; /***/ }), -/* 161 */ +/* 171 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlitterRender = __webpack_require__(841); -var Bob = __webpack_require__(838); +var BlitterRender = __webpack_require__(867); +var Bob = __webpack_require__(864); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var Frame = __webpack_require__(113); -var GameObject = __webpack_require__(19); -var List = __webpack_require__(112); +var Components = __webpack_require__(13); +var Frame = __webpack_require__(121); +var GameObject = __webpack_require__(18); +var List = __webpack_require__(120); /** - * @callback Phaser.GameObjects.Blitter.CreateCallback + * @callback CreateCallback * - * @param {Phaser.GameObjects.Blitter.Bob} bob - The Bob that was created by the Blitter. + * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. * @param {integer} index - The position of the Bob within the Blitter display list. */ @@ -39569,7 +39840,7 @@ var Blitter = new Class({ * This List contains all of the Bob objects created by the Blitter. * * @name Phaser.GameObjects.Blitter#children - * @type {Phaser.Structs.List.} + * @type {Phaser.Structs.List.} * @since 3.0.0 */ this.children = new List(); @@ -39579,7 +39850,7 @@ var Blitter = new Class({ * The array is re-populated whenever the dirty flag is set. * * @name Phaser.GameObjects.Blitter#renderList - * @type {Phaser.GameObjects.Blitter.Bob[]} + * @type {Phaser.GameObjects.Bob[]} * @default [] * @private * @since 3.0.0 @@ -39612,7 +39883,7 @@ var Blitter = new Class({ * @param {boolean} [visible=true] - Should the created Bob render or not? * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. * - * @return {Phaser.GameObjects.Blitter.Bob} The newly created Bob object. + * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ create: function (x, y, frame, visible, index) { @@ -39643,12 +39914,12 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#createFromCallback * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. + * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. * @param {integer} quantity - The quantity of Bob objects to create. * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createFromCallback: function (callback, quantity, frame, visible) { @@ -39679,7 +39950,7 @@ var Blitter = new Class({ * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createMultiple: function (quantity, frame, visible) { @@ -39711,7 +39982,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#childCanRender * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.Bob} child - The Bob to check for rendering. + * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering. * * @return {boolean} Returns `true` if the given child can render, otherwise `false`. */ @@ -39727,7 +39998,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#getRenderList * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that will be rendered this frame. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame. */ getRenderList: function () { @@ -39772,12 +40043,12 @@ module.exports = Blitter; /***/ }), -/* 162 */ +/* 172 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39807,37 +40078,37 @@ module.exports = GetRandom; /***/ }), -/* 163 */ +/* 173 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** -* A Matrix is simply an array of arrays, where each sub-array (the rows) have the same length: -* -* let matrix2 = [ -* [ 1, 1, 1, 1, 1, 1 ], -* [ 2, 0, 0, 0, 0, 4 ], -* [ 2, 0, 1, 2, 0, 4 ], -* [ 2, 0, 3, 4, 0, 4 ], -* [ 2, 0, 0, 0, 0, 4 ], -* [ 3, 3, 3, 3, 3, 3 ] -*]; -*/ - -/** - * [description] + * Checks if an array can be used as a matrix. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` * * @function Phaser.Utils.Array.Matrix.CheckMatrix * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the given `matrix` array is a valid matrix. */ var CheckMatrix = function (matrix) { @@ -39865,12 +40136,12 @@ module.exports = CheckMatrix; /***/ }), -/* 164 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -39880,56 +40151,56 @@ module.exports = CheckMatrix; module.exports = { - Matrix: __webpack_require__(874), + Matrix: __webpack_require__(900), - Add: __webpack_require__(867), - AddAt: __webpack_require__(866), - BringToTop: __webpack_require__(865), - CountAllMatching: __webpack_require__(864), - Each: __webpack_require__(863), - EachInRange: __webpack_require__(862), - FindClosestInSorted: __webpack_require__(383), - GetAll: __webpack_require__(861), - GetFirst: __webpack_require__(860), - GetRandom: __webpack_require__(162), - MoveDown: __webpack_require__(859), - MoveTo: __webpack_require__(858), - MoveUp: __webpack_require__(857), - NumberArray: __webpack_require__(856), - NumberArrayStep: __webpack_require__(855), - QuickSelect: __webpack_require__(313), - Range: __webpack_require__(312), - Remove: __webpack_require__(330), - RemoveAt: __webpack_require__(854), - RemoveBetween: __webpack_require__(853), - RemoveRandomElement: __webpack_require__(852), - Replace: __webpack_require__(851), - RotateLeft: __webpack_require__(387), - RotateRight: __webpack_require__(386), - SafeRange: __webpack_require__(62), - SendToBack: __webpack_require__(850), - SetAll: __webpack_require__(849), - Shuffle: __webpack_require__(122), - SpliceOne: __webpack_require__(91), - StableSort: __webpack_require__(110), - Swap: __webpack_require__(848) + Add: __webpack_require__(893), + AddAt: __webpack_require__(892), + BringToTop: __webpack_require__(891), + CountAllMatching: __webpack_require__(890), + Each: __webpack_require__(889), + EachInRange: __webpack_require__(888), + FindClosestInSorted: __webpack_require__(434), + GetAll: __webpack_require__(887), + GetFirst: __webpack_require__(886), + GetRandom: __webpack_require__(172), + MoveDown: __webpack_require__(885), + MoveTo: __webpack_require__(884), + MoveUp: __webpack_require__(883), + NumberArray: __webpack_require__(882), + NumberArrayStep: __webpack_require__(881), + QuickSelect: __webpack_require__(317), + Range: __webpack_require__(316), + Remove: __webpack_require__(177), + RemoveAt: __webpack_require__(880), + RemoveBetween: __webpack_require__(879), + RemoveRandomElement: __webpack_require__(878), + Replace: __webpack_require__(877), + RotateLeft: __webpack_require__(418), + RotateRight: __webpack_require__(417), + SafeRange: __webpack_require__(68), + SendToBack: __webpack_require__(876), + SetAll: __webpack_require__(875), + Shuffle: __webpack_require__(132), + SpliceOne: __webpack_require__(97), + StableSort: __webpack_require__(118), + Swap: __webpack_require__(874) }; /***/ }), -/* 165 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(113); -var TextureSource = __webpack_require__(317); +var Frame = __webpack_require__(121); +var TextureSource = __webpack_require__(320); var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; @@ -39952,7 +40223,7 @@ var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; * * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. * @param {string} key - The unique string-based key of this Texture. - * @param {(HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. * @param {number} [width] - The width of the Texture. This is optional and automatically derived from the source images. * @param {number} [height] - The height of the Texture. This is optional and automatically derived from the source images. */ @@ -40308,7 +40579,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#setDataSource * @since 3.0.0 * - * @param {(HTMLImageElement|HTMLCanvasElement)} data - The source image. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} data - The source image. */ setDataSource: function (data) { @@ -40393,22 +40664,23 @@ module.exports = Texture; /***/ }), -/* 166 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(116); -var DefaultPlugins = __webpack_require__(167); -var GetPhysicsPlugins = __webpack_require__(890); -var GetScenePlugins = __webpack_require__(889); +var CONST = __webpack_require__(124); +var DefaultPlugins = __webpack_require__(181); +var Events = __webpack_require__(16); +var GetPhysicsPlugins = __webpack_require__(935); +var GetScenePlugins = __webpack_require__(934); var NOOP = __webpack_require__(1); -var Settings = __webpack_require__(326); +var Settings = __webpack_require__(329); /** * @classdesc @@ -40537,6 +40809,17 @@ var Systems = new Class({ */ this.registry; + /** + * A reference to the global Scale Manager. + * + * In the default set-up you can access this from within a Scene via the `this.scale` property. + * + * @name Phaser.Scenes.Systems#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.15.0 + */ + this.scale; + /** * A reference to the global Sound Manager. * @@ -40679,6 +40962,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#init * @protected + * @fires Phaser.Scenes.Events#BOOT * @since 3.0.0 * * @param {Phaser.Game} game - A reference to the Phaser Game instance. @@ -40701,7 +40985,7 @@ var Systems = new Class({ pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]); - this.events.emit('boot', this); + this.events.emit(Events.BOOT, this); this.settings.isBooted = true; }, @@ -40730,6 +41014,9 @@ var Systems = new Class({ * Frame or Set Timeout call to the main Game instance. * * @method Phaser.Scenes.Systems#step + * @fires Phaser.Scenes.Events#PRE_UPDATE + * @fires Phaser.Scenes.Events#_UPDATE + * @fires Phaser.Scenes.Events#POST_UPDATE * @since 3.0.0 * * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). @@ -40737,13 +41024,13 @@ var Systems = new Class({ */ step: function (time, delta) { - this.events.emit('preupdate', time, delta); + this.events.emit(Events.PRE_UPDATE, time, delta); - this.events.emit('update', time, delta); + this.events.emit(Events.UPDATE, time, delta); this.sceneUpdate.call(this.scene, time, delta); - this.events.emit('postupdate', time, delta); + this.events.emit(Events.POST_UPDATE, time, delta); }, /** @@ -40751,6 +41038,7 @@ var Systems = new Class({ * Instructs the Scene to render itself via its Camera Manager to the renderer given. * * @method Phaser.Scenes.Systems#render + * @fires Phaser.Scenes.Events#RENDER * @since 3.0.0 * * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call. @@ -40763,7 +41051,7 @@ var Systems = new Class({ this.cameras.render(renderer, displayList); - this.events.emit('render', renderer); + this.events.emit(Events.RENDER, renderer); }, /** @@ -40793,6 +41081,7 @@ var Systems = new Class({ * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. * * @method Phaser.Scenes.Systems#pause + * @fires Phaser.Scenes.Events#PAUSE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'pause' event. @@ -40807,7 +41096,7 @@ var Systems = new Class({ this.settings.active = false; - this.events.emit('pause', this, data); + this.events.emit(Events.PAUSE, this, data); } return this; @@ -40817,6 +41106,7 @@ var Systems = new Class({ * Resume this Scene from a paused state. * * @method Phaser.Scenes.Systems#resume + * @fires Phaser.Scenes.Events#RESUME * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'resume' event. @@ -40831,7 +41121,7 @@ var Systems = new Class({ this.settings.active = true; - this.events.emit('resume', this, data); + this.events.emit(Events.RESUME, this, data); } return this; @@ -40846,6 +41136,7 @@ var Systems = new Class({ * from other Scenes may still invoke changes within it, so be careful what is left active. * * @method Phaser.Scenes.Systems#sleep + * @fires Phaser.Scenes.Events#SLEEP * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'sleep' event. @@ -40859,7 +41150,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('sleep', this, data); + this.events.emit(Events.SLEEP, this, data); return this; }, @@ -40868,6 +41159,7 @@ var Systems = new Class({ * Wake-up this Scene if it was previously asleep. * * @method Phaser.Scenes.Systems#wake + * @fires Phaser.Scenes.Events#WAKE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'wake' event. @@ -40883,11 +41175,11 @@ var Systems = new Class({ settings.active = true; settings.visible = true; - this.events.emit('wake', this, data); + this.events.emit(Events.WAKE, this, data); if (settings.isTransition) { - this.events.emit('transitionwake', settings.transitionFrom, settings.transitionDuration); + this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); } return this; @@ -41032,6 +41324,8 @@ var Systems = new Class({ * Called automatically by the SceneManager. * * @method Phaser.Scenes.Systems#start + * @fires Phaser.Scenes.Events#START + * @fires Phaser.Scenes.Events#READY * @since 3.0.0 * * @param {object} data - Optional data object that may have been passed to this Scene from another. @@ -41049,25 +41343,10 @@ var Systems = new Class({ this.settings.visible = true; // For plugins to listen out for - this.events.emit('start', this); + this.events.emit(Events.START, this); // For user-land code to listen out for - this.events.emit('ready', this, data); - }, - - /** - * 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); + this.events.emit(Events.READY, this, data); }, /** @@ -41078,23 +41357,24 @@ var Systems = new Class({ * to free-up resources. * * @method Phaser.Scenes.Systems#shutdown + * @fires Phaser.Scenes.Events#SHUTDOWN * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'shutdown' event. */ shutdown: function (data) { - this.events.off('transitioninit'); - this.events.off('transitionstart'); - this.events.off('transitioncomplete'); - this.events.off('transitionout'); + this.events.off(Events.TRANSITION_INIT); + this.events.off(Events.TRANSITION_START); + this.events.off(Events.TRANSITION_COMPLETE); + this.events.off(Events.TRANSITION_OUT); this.settings.status = CONST.SHUTDOWN; this.settings.active = false; this.settings.visible = false; - this.events.emit('shutdown', this, data); + this.events.emit(Events.SHUTDOWN, this, data); }, /** @@ -41104,6 +41384,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#destroy * @private + * @fires Phaser.Scenes.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -41113,7 +41394,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('destroy', this); + this.events.emit(Events.DESTROY, this); this.events.removeAllListeners(); @@ -41131,12 +41412,268 @@ module.exports = Systems; /***/ }), -/* 167 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SpliceOne = __webpack_require__(97); + +/** + * Removes the given item, or array of items, from the array. + * + * The array is modified in-place. + * + * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * + * @function Phaser.Utils.Array.Remove + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. + * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + */ +var Remove = function (array, item, callback, context) +{ + if (context === undefined) { context = array; } + + var index; + + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) + { + index = array.indexOf(item); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, item); + } + + return item; + } + else + { + return null; + } + } + + // If we got this far, we have an array of items to remove + + var itemLength = item.length - 1; + + while (itemLength >= 0) + { + var entry = item[itemLength]; + + index = array.indexOf(entry); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, entry); + } + } + else + { + // Item wasn't found in the array, so remove it from our return results + item.pop(); + } + + itemLength--; + } + + return item; +}; + +module.exports = Remove; + + +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = { + + CENTER: __webpack_require__(349), + ORIENTATION: __webpack_require__(348), + SCALE_MODE: __webpack_require__(347), + ZOOM: __webpack_require__(346) + +}; + +module.exports = CONST; + + +/***/ }), +/* 179 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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 it falls back to using `document.body`. + * + * @function Phaser.DOM.AddToDOM + * @since 3.0.0 + * + * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. + * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. + * + * @return {HTMLElement} The element that was added to the DOM. + */ +var AddToDOM = function (element, parent) +{ + var target; + + 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; + } + } + else if (element.parentElement) + { + return element; + } + + // Fallback, covers an invalid ID and a non HTMLElement object + if (!target) + { + target = document.body; + } + + target.appendChild(element); + + return element; +}; + +module.exports = AddToDOM; + + +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Rectangle = __webpack_require__(10); + +// 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 } +// ] + +/** + * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. + * + * @function Phaser.Geom.Rectangle.FromPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. + * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. + */ +var FromPoints = function (points, out) +{ + if (out === undefined) { out = new Rectangle(); } + + if (points.length === 0) + { + return out; + } + + var minX = Number.MAX_VALUE; + var minY = Number.MAX_VALUE; + + var maxX = Number.MIN_SAFE_INTEGER; + var maxY = Number.MIN_SAFE_INTEGER; + + var p; + var px; + var py; + + for (var i = 0; i < points.length; i++) + { + p = points[i]; + + if (Array.isArray(p)) + { + px = p[0]; + py = p[1]; + } + else + { + px = p.x; + py = p.y; + } + + minX = Math.min(minX, px); + minY = Math.min(minY, py); + + maxX = Math.max(maxX, px); + maxY = Math.max(maxY, py); + } + + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; + + return out; +}; + +module.exports = FromPoints; + + +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -41232,17 +41769,957 @@ module.exports = DefaultPlugins; /***/ }), -/* 168 */ +/* 182 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); -var Browser = __webpack_require__(118); +// 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 + * A representation of a vector in 3D space. + * + * A three-component vector. + * + * @class Vector3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Vector3 = new Class({ + + initialize: + + function Vector3 (x, y, z) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector3#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector3#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector3#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + }, + + /** + * Set this Vector to point up. + * + * Sets the y component of the vector to 1, and the others to 0. + * + * @method Phaser.Math.Vector3#up + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + up: function () + { + this.x = 0; + this.y = 1; + this.z = 0; + + return this; + }, + + /** + * Make a clone of this Vector3. + * + * @method Phaser.Math.Vector3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. + */ + clone: function () + { + return new Vector3(this.x, this.y, this.z); + }, + + /** + * Calculate the cross (vector) product of two given Vectors. + * + * @method Phaser.Math.Vector3#crossVectors + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to multiply. + * @param {Phaser.Math.Vector3} b - The second Vector to multiply. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + crossVectors: function (a, b) + { + var ax = a.x; + var ay = a.y; + var az = a.z; + var bx = b.x; + var by = b.y; + var bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict equality check against each Vector's components. + * + * @method Phaser.Math.Vector3#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. + * + * @return {boolean} True if the two vectors strictly match, otherwise false. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector3#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + + return this; + }, + + /** + * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. + * + * @method Phaser.Math.Vector3#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. + * @param {number} [y] - The y value to set for this Vector. + * @param {number} [z] - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + set: function (x, y, z) + { + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + + return this; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector3#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + + return this; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector3#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + scale: function (scale) + { + if (isFinite(scale)) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + } + else + { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + + return this; + }, + + /** + * Negate the `x`, `y` and `z` components of this Vector. + * + * @method Phaser.Math.Vector3#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + distance: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector3#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + distanceSq: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return dx * dx + dy * dy + dz * dz; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector3#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return Math.sqrt(x * x + y * y + z * z); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector3#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return x * x + y * y + z * z; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector3#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + normalize: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var len = x * x + y * y + z * z; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + } + + return this; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. + * + * @return {number} The dot product of this Vector and `v`. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + /** + * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. + * + * @method Phaser.Math.Vector3#cross + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector to cross product with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + cross: function (v) + { + var ax = this.x; + var ay = this.y; + var az = this.z; + var bx = v.x; + var by = v.y; + var bz = v.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector3#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + lerp: function (v, t) + { + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat3: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = x * m[0] + y * m[3] + z * m[6]; + this.y = x * m[1] + y * m[4] + z * m[7]; + this.z = x * m[2] + y * m[5] + z * m[8]; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; + + return this; + }, + + /** + * Transforms the coordinates of this Vector3 with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformCoordinates + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformCoordinates: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.x = tx / tw; + this.y = ty / tw; + this.z = tz / tw; + + return this; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector3#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + 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; + + // 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; + + // 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; + }, + + /** + * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, + * e.g. unprojecting a 2D point into 3D space. + * + * @method Phaser.Math.Vector3#project + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + project: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var a00 = m[0]; + var a01 = m[1]; + var a02 = m[2]; + var a03 = m[3]; + var a10 = m[4]; + var a11 = m[5]; + var a12 = m[6]; + var a13 = m[7]; + var a20 = m[8]; + var a21 = m[9]; + var a22 = m[10]; + var a23 = m[11]; + var a30 = m[12]; + var a31 = m[13]; + var a32 = m[14]; + var a33 = m[15]; + + var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + + this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; + this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; + this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + + return this; + }, + + /** + * Unproject this point from 2D space to 3D space. + * The point should have its x and y properties set to + * 2D screen space, and the z either at 0 (near plane) + * or 1 (far plane). The provided matrix is assumed to already + * be combined, i.e. projection * view * model. + * + * After this operation, this vector's (x, y, z) components will + * represent the unprojected 3D coordinate. + * + * @method Phaser.Math.Vector3#unproject + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. + * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unproject: function (viewport, invProjectionView) + { + var viewX = viewport.x; + var viewY = viewport.y; + var viewWidth = viewport.z; + var viewHeight = viewport.w; + + var x = this.x - viewX; + var y = (viewHeight - this.y - 1) - viewY; + var z = this.z; + + this.x = (2 * x) / viewWidth - 1; + this.y = (2 * y) / viewHeight - 1; + this.z = 2 * z - 1; + + return this.project(invProjectionView); + }, + + /** + * Make this Vector the zero vector (0, 0, 0). + * + * @method Phaser.Math.Vector3#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + + return this; + } + +}); + +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); + +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); + +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); + +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); + +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); + +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); + +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); + +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); + +module.exports = Vector3; + + +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Convert the given angle in radians, to the equivalent angle in degrees. + * + * @function Phaser.Math.RadToDeg + * @since 3.0.0 + * + * @param {number} radians - The angle in radians to convert ot degrees. + * + * @return {integer} The given angle converted to degrees. + */ +var RadToDeg = function (radians) +{ + return radians * CONST.RAD_TO_DEG; +}; + +module.exports = RadToDeg; + + +/***/ }), +/* 184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random integer between the `min` and `max` values, inclusive. + * + * @function Phaser.Math.Between + * @since 3.0.0 + * + * @param {integer} min - The minimum value. + * @param {integer} max - The maximum value. + * + * @return {integer} The random integer. + */ +var Between = function (min, max) +{ + return Math.floor(Math.random() * (max - min + 1) + min); +}; + +module.exports = Between; + + +/***/ }), +/* 185 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates a Catmull-Rom value. + * + * @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} The Catmull-Rom value. + */ +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; + + return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; +}; + +module.exports = CatmullRom; + + +/***/ }), +/* 186 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether the given values are fuzzily equal. + * + * Two numbers are fuzzily equal if their difference is less than `epsilon`. + * + * @function Phaser.Math.Fuzzy.Equal + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. + */ +var Equal = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.abs(a - b) < epsilon; +}; + +module.exports = Equal; + + +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(99); +var Browser = __webpack_require__(128); var CanvasPool = __webpack_require__(24); /** @@ -41429,274 +42906,27 @@ module.exports = init(); /***/ }), -/* 169 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * 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 it falls back to using `document.body`. - * - * @function Phaser.DOM.AddToDOM - * @since 3.0.0 - * - * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. - * @param {(string|HTMLElement)} [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] - Whether or not to hide overflowing content inside the parent. - * - * @return {HTMLElement} The element that was added to the DOM. - */ -var AddToDOM = function (element, parent, overflowHidden) -{ - if (overflowHidden === undefined) { overflowHidden = true; } - - var target; - - 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; - } - } - else if (element.parentElement) - { - return element; - } - - // Fallback, covers an invalid ID and a non HTMLElement object - if (!target) - { - target = document.body; - } - - if (overflowHidden && target.style) - { - target.style.overflow = 'hidden'; - } - - target.appendChild(element); - - return element; -}; - -module.exports = AddToDOM; - - -/***/ }), -/* 170 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random integer between the `min` and `max` values, inclusive. - * - * @function Phaser.Math.Between - * @since 3.0.0 - * - * @param {integer} min - The minimum value. - * @param {integer} max - The maximum value. - * - * @return {integer} The random integer. - */ -var Between = function (min, max) -{ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -module.exports = Between; - - -/***/ }), -/* 171 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates a Catmull-Rom value. - * - * @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} The Catmull-Rom value. - */ -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; - - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -}; - -module.exports = CatmullRom; - - -/***/ }), -/* 172 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(16); - -/** - * Convert the given angle in radians, to the equivalent angle in degrees. - * - * @function Phaser.Math.RadToDeg - * @since 3.0.0 - * - * @param {number} radians - The angle in radians to convert ot degrees. - * - * @return {integer} The given angle converted to degrees. - */ -var RadToDeg = function (radians) -{ - return radians * CONST.RAD_TO_DEG; -}; - -module.exports = RadToDeg; - - -/***/ }), -/* 173 */ -/***/ (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__(9); - -// 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 } -// ] - -/** - * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. - * - * @function Phaser.Geom.Rectangle.FromPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. - * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. - * - * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. - */ -var FromPoints = function (points, out) -{ - if (out === undefined) { out = new Rectangle(); } - - if (points.length === 0) - { - return out; - } - - var minX = Number.MAX_VALUE; - var minY = Number.MAX_VALUE; - - var maxX = Number.MIN_SAFE_INTEGER; - var maxY = Number.MIN_SAFE_INTEGER; - - var p; - var px; - var py; - - for (var i = 0; i < points.length; i++) - { - p = points[i]; - - if (Array.isArray(p)) - { - px = p[0]; - py = p[1]; - } - else - { - px = p.x; - py = p.y; - } - - minX = Math.min(minX, px); - minY = Math.min(minY, py); - - maxX = Math.max(maxX, px); - maxY = Math.max(maxY, py); - } - - out.x = minX; - out.y = minY; - out.width = maxX - minX; - out.height = maxY - minY; - - return out; -}; - -module.exports = FromPoints; - - -/***/ }), -/* 174 */ -/***/ (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 Back = __webpack_require__(369); -var Bounce = __webpack_require__(368); -var Circular = __webpack_require__(367); -var Cubic = __webpack_require__(366); -var Elastic = __webpack_require__(365); -var Expo = __webpack_require__(364); -var Linear = __webpack_require__(363); -var Quadratic = __webpack_require__(362); -var Quartic = __webpack_require__(361); -var Quintic = __webpack_require__(360); -var Sine = __webpack_require__(359); -var Stepped = __webpack_require__(358); +var Back = __webpack_require__(402); +var Bounce = __webpack_require__(401); +var Circular = __webpack_require__(400); +var Cubic = __webpack_require__(399); +var Elastic = __webpack_require__(398); +var Expo = __webpack_require__(397); +var Linear = __webpack_require__(396); +var Quadratic = __webpack_require__(395); +var Quartic = __webpack_require__(394); +var Quintic = __webpack_require__(393); +var Sine = __webpack_require__(392); +var Stepped = __webpack_require__(391); // EaseMap module.exports = { @@ -41757,12 +42987,12 @@ module.exports = { /***/ }), -/* 175 */ +/* 189 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -41794,16 +43024,16 @@ module.exports = CenterOn; /***/ }), -/* 176 */ +/* 190 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetColor = __webpack_require__(177); +var GetColor = __webpack_require__(191); /** * Converts an HSV (hue, saturation and value) color value to RGB. @@ -41895,12 +43125,12 @@ module.exports = HSVToRGB; /***/ }), -/* 177 */ +/* 191 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -41925,19 +43155,19 @@ module.exports = GetColor; /***/ }), -/* 178 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HexStringToColor = __webpack_require__(377); -var IntegerToColor = __webpack_require__(374); -var ObjectToColor = __webpack_require__(372); -var RGBStringToColor = __webpack_require__(371); +var HexStringToColor = __webpack_require__(410); +var IntegerToColor = __webpack_require__(407); +var ObjectToColor = __webpack_require__(405); +var RGBStringToColor = __webpack_require__(404); /** * Converts the given source color value into an instance of a Color class. @@ -41981,12 +43211,12 @@ module.exports = ValueToColor; /***/ }), -/* 179 */ +/* 193 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42057,25 +43287,24 @@ module.exports = Pad; /***/ }), -/* 180 */ +/* 194 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); /** - * @callback EachMapCallback - * @generic E - [entry] + * @callback EachMapCallback * - * @param {string} key - [description] - * @param {*} entry - [description] + * @param {string} key - The key of the Map entry. + * @param {E} entry - The value of the Map entry. * - * @return {?boolean} [description] + * @return {?boolean} The callback result. */ /** @@ -42140,6 +43369,7 @@ var Map = new Class({ /** * Adds an element with a specified `key` and `value` to this Map. + * If the `key` already exists, the value will be replaced. * * @method Phaser.Structs.Map#set * @since 3.0.0 @@ -42157,10 +43387,11 @@ var Map = new Class({ { if (!this.has(key)) { - this.entries[key] = value; this.size++; } + this.entries[key] = value; + return this; }, @@ -42429,12 +43660,12 @@ module.exports = Map; /***/ }), -/* 181 */ +/* 195 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42476,12 +43707,12 @@ module.exports = SmoothStep; /***/ }), -/* 182 */ +/* 196 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42515,17 +43746,17 @@ module.exports = SmootherStep; /***/ }), -/* 183 */ +/* 197 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rotate a `point` around `x` and `y` by the given `angle` and `distance`. * * @function Phaser.Math.RotateAroundDistance * @since 3.0.0 @@ -42534,7 +43765,7 @@ module.exports = SmootherStep; * @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] + * @param {number} distance - The distance from (x, y) to place the point at. * * @return {Phaser.Geom.Point} The given point. */ @@ -42552,12 +43783,12 @@ module.exports = RotateAroundDistance; /***/ }), -/* 184 */ +/* 198 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42608,12 +43839,12 @@ module.exports = Random; /***/ }), -/* 185 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42649,12 +43880,12 @@ module.exports = Random; /***/ }), -/* 186 */ +/* 200 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42778,12 +44009,12 @@ module.exports = Pipeline; /***/ }), -/* 187 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42816,12 +44047,12 @@ module.exports = Random; /***/ }), -/* 188 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42856,16 +44087,16 @@ module.exports = Random; /***/ }), -/* 189 */ +/* 203 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); var Point = __webpack_require__(6); /** @@ -42921,16 +44152,16 @@ module.exports = GetPoints; /***/ }), -/* 190 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(124); +var Perimeter = __webpack_require__(135); var Point = __webpack_require__(6); /** @@ -42998,12 +44229,953 @@ module.exports = GetPoint; /***/ }), -/* 191 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Clamp = __webpack_require__(23); +var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(136); +var FindClosestInSorted = __webpack_require__(434); +var Frame = __webpack_require__(433); +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. + * + * @class Animation + * @memberof Phaser.Animations + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationManager} manager - A reference to the global Animation Manager + * @param {string} key - The unique identifying string for this animation. + * @param {Phaser.Animations.Types.Animation} config - The Animation configuration. + */ +var Animation = new Class({ + + Extends: EventEmitter, + + initialize: + + function Animation (manager, key, config) + { + EventEmitter.call(this); + + /** + * A reference to the global Animation Manager. + * + * @name Phaser.Animations.Animation#manager + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.manager = manager; + + /** + * The unique identifying string for this animation. + * + * @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 {Phaser.Animations.AnimationFrame[]} + * @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, in milliseconds. + * If the `frameRate` property has been set then it overrides this value, + * otherwise the `frameRate` is derived from `duration`. + * + * @name Phaser.Animations.Animation#duration + * @type {integer} + * @since 3.0.0 + */ + 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) * 1000; + } + 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 = 4000 ms + // So frameRate is 12 / (4000 / 1000) = 3 fps + this.frameRate = this.frames.length / (this.duration / 1000); + } + 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 * 1000 (half a second, or 500ms) + this.duration = (this.frames.length / this.frameRate) * 1000; + } + + /** + * How many ms per frame, not including frame specific modifiers. + * + * @name Phaser.Animations.Animation#msPerFrame + * @type {integer} + * @since 3.0.0 + */ + this.msPerFrame = 1000 / this.frameRate; + + /** + * 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); + + /** + * The delay in ms before the playback will begin. + * + * @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. Set to -1 to repeat forever. + * + * @name Phaser.Animations.Animation#repeat + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeat = GetValue(config, 'repeat', 0); + + /** + * The delay in ms before the a repeat play starts. + * + * @name Phaser.Animations.Animation#repeatDelay + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeatDelay = GetValue(config, 'repeatDelay', 0); + + /** + * 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); + + /** + * Should the GameObject's `visible` property be set to `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); + + /** + * Should the GameObject's `visible` property be set to `false` when the animation finishes? + * + * @name Phaser.Animations.Animation#hideOnComplete + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.hideOnComplete = GetValue(config, 'hideOnComplete', false); + + /** + * Global pause. All Game Objects using this Animation instance are impacted by this property. + * + * @name Phaser.Animations.Animation#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + this.manager.on(Events.PAUSE_ALL, this.pause, this); + this.manager.on(Events.RESUME_ALL, this.resume, this); + }, + + /** + * Add frames to the end of the animation. + * + * @method Phaser.Animations.Animation#addFrame + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} config - [description] + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + addFrame: function (config) + { + return this.addFrameAt(this.frames.length, config); + }, + + /** + * Add frame/s into the animation. + * + * @method Phaser.Animations.Animation#addFrameAt + * @since 3.0.0 + * + * @param {integer} index - The index to insert the frame at within the animation. + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} 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); + } + + this.updateFrameSequence(); + } + + return this; + }, + + /** + * Check if the given frame index is valid. + * + * @method Phaser.Animations.Animation#checkFrame + * @since 3.0.0 + * + * @param {integer} index - The index to be checked. + * + * @return {boolean} `true` if the index is valid, otherwise `false`. + */ + checkFrame: function (index) + { + return (index >= 0 && index < this.frames.length); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#completeAnimation + * @protected + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + completeAnimation: function (component) + { + if (this.hideOnComplete) + { + component.parent.visible = false; + } + + component.stop(); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFirstTick + * @protected + * @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) + { + component.nextTick += component._delay; + } + }, + + /** + * Returns the AnimationFrame at the provided index + * + * @method Phaser.Animations.Animation#getFrameAt + * @protected + * @since 3.0.0 + * + * @param {integer} index - The index in the AnimationFrame array + * + * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence + */ + getFrameAt: function (index) + { + return this.frames[index]; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFrames + * @since 3.0.0 + * + * @param {Phaser.Textures.TextureManager} textureManager - [description] + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} frames - [description] + * @param {string} [defaultTextureKey] - [description] + * + * @return {Phaser.Animations.AnimationFrame[]} [description] + */ + getFrames: function (textureManager, frames, defaultTextureKey) + { + 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.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.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 + + // When is the next update due? + component.accumulator -= component.nextTick; + + component.nextTick = component.msPerFrame + component.currentFrame.duration; + }, + + /** + * Loads the Animation values into the Animation Component. + * + * @method Phaser.Animations.Animation#load + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to load values into. + * @param {integer} startFrame - The start frame of the animation to load. + */ + load: function (component, startFrame) + { + if (startFrame >= this.frames.length) + { + startFrame = 0; + } + + if (component.currentAnim !== this) + { + component.currentAnim = this; + + 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; + } + + var frame = this.frames[startFrame]; + + if (startFrame === 0 && !component.forward) + { + frame = this.getLastFrame(); + } + + component.updateFrame(frame); + }, + + /** + * Returns the frame closest to the given progress value between 0 and 1. + * + * @method Phaser.Animations.Animation#getFrameByProgress + * @since 3.4.0 + * + * @param {number} value - A value between 0 and 1. + * + * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. + */ + getFrameByProgress: function (value) + { + value = Clamp(value, 0, 1); + + return FindClosestInSorted(value, this.frames, 'progress'); + }, + + /** + * Advance the animation frame. + * + * @method Phaser.Animations.Animation#nextFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + */ + nextFrame: function (component) + { + var frame = component.currentFrame; + + // TODO: Add frame skip support + + if (frame.isLast) + { + // We're at the end of the animation + + // Yoyo? (happens before repeat) + if (component._yoyo) + { + this.handleYoyoFrame(component, false); + } + else if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + + if (component._reverse && component.forward) + { + component.forward = false; + } + else + { + this.repeatAnimation(component); + } + } + else + { + this.completeAnimation(component); + } + } + else + { + this.updateAndGetNextTick(component, frame.nextFrame); + } + }, + + /** + * Handle the yoyo functionality in nextFrame and previousFrame methods. + * + * @method Phaser.Animations.Animation#handleYoyoFrame + * @private + * @since 3.12.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) + */ + handleYoyoFrame: function (component, isReverse) + { + if (!isReverse) { isReverse = false; } + + if (component._reverse === !isReverse && component.repeatCounter > 0) + { + component.forward = isReverse; + + this.repeatAnimation(component); + + return; + } + + if (component._reverse !== isReverse && component.repeatCounter === 0) + { + this.completeAnimation(component); + + return; + } + + component.forward = isReverse; + + var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; + + this.updateAndGetNextTick(component, frame); + }, + + /** + * Returns the animation last frame. + * + * @method Phaser.Animations.Animation#getLastFrame + * @since 3.12.0 + * + * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. + */ + getLastFrame: function () + { + return this.frames[this.frames.length - 1]; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#previousFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + previousFrame: function (component) + { + var frame = component.currentFrame; + + // TODO: Add frame skip support + + if (frame.isFirst) + { + // We're at the start of the animation + + if (component._yoyo) + { + this.handleYoyoFrame(component, true); + } + else if (component.repeatCounter > 0) + { + if (component._reverse && !component.forward) + { + component.currentFrame = this.getLastFrame(); + this.repeatAnimation(component); + } + else + { + // Repeat (happens before complete) + component.forward = true; + this.repeatAnimation(component); + } + } + else + { + this.completeAnimation(component); + } + } + else + { + this.updateAndGetNextTick(component, frame.prevFrame); + } + }, + + /** + * Update Frame and Wait next tick. + * + * @method Phaser.Animations.Animation#updateAndGetNextTick + * @private + * @since 3.12.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. + */ + updateAndGetNextTick: function (component, frame) + { + component.updateFrame(frame); + + this.getNextTick(component); + }, + + /** + * [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); + } + + return this; + }, + + /** + * Removes a frame from the AnimationFrame array at the provided index + * and updates the animation accordingly. + * + * @method Phaser.Animations.Animation#removeFrameAt + * @since 3.0.0 + * + * @param {integer} index - The index in the AnimationFrame array + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + removeFrameAt: function (index) + { + this.frames.splice(index, 1); + + this.updateFrameSequence(); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#repeatAnimation + * @fires Phaser.Animations.Events#ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + repeatAnimation: function (component) + { + if (component._pendingStop === 2) + { + return this.completeAnimation(component); + } + + if (component._repeatDelay > 0 && component.pendingRepeat === false) + { + component.pendingRepeat = true; + component.accumulator -= component.nextTick; + component.nextTick += component._repeatDelay; + } + else + { + component.repeatCounter--; + + component.updateFrame(component.currentFrame[(component.forward) ? 'nextFrame' : 'prevFrame']); + + if (component.isPlaying) + { + this.getNextTick(component); + + component.pendingRepeat = false; + + var frame = component.currentFrame; + var parent = component.parent; + + this.emit(Events.ANIMATION_REPEAT, this, frame); + + parent.emit(Events.SPRITE_ANIMATION_KEY_REPEAT + this.key, this, frame, component.repeatCounter, parent); + + parent.emit(Events.SPRITE_ANIMATION_REPEAT, this, frame, component.repeatCounter, parent); + } + } + }, + + /** + * Sets the texture frame the animation uses for rendering. + * + * @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); + } + }, + + /** + * Converts the animation data to JSON. + * + * @method Phaser.Animations.Animation#toJSON + * @since 3.0.0 + * + * @return {Phaser.Animations.Types.JSONAnimation} [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; + }, + + /** + * [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); + + 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; + }, + + /** + * [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 () + { + this.removeAllListeners(); + + this.manager.off(Events.PAUSE_ALL, this.pause, this); + this.manager.off(Events.RESUME_ALL, this.resume, this); + + this.manager.remove(this.key); + + for (var i = 0; i < this.frames.length; i++) + { + this.frames[i].destroy(); + } + + this.frames = []; + + this.manager = null; + } + +}); + +module.exports = Animation; + + +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -43042,12 +45214,12 @@ module.exports = Random; /***/ }), -/* 192 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -43081,12 +45253,12 @@ module.exports = CircumferencePoint; /***/ }), -/* 193 */ +/* 208 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -43215,7 +45387,7 @@ module.exports = ALIGN_CONST; /***/ }), -/* 194 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43232,12 +45404,12 @@ var Constraint = {}; module.exports = Constraint; -var Vertices = __webpack_require__(76); -var Vector = __webpack_require__(81); -var Sleeping = __webpack_require__(222); -var Bounds = __webpack_require__(80); -var Axes = __webpack_require__(505); -var Common = __webpack_require__(33); +var Vertices = __webpack_require__(82); +var Vector = __webpack_require__(87); +var Sleeping = __webpack_require__(238); +var Bounds = __webpack_require__(86); +var Axes = __webpack_require__(546); +var Common = __webpack_require__(36); (function() { @@ -43674,7 +45846,7 @@ var Common = __webpack_require__(33); /***/ }), -/* 195 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43689,7 +45861,7 @@ var Events = {}; module.exports = Events; -var Common = __webpack_require__(33); +var Common = __webpack_require__(36); (function() { @@ -43792,25 +45964,25 @@ var Common = __webpack_require__(33); /***/ }), -/* 196 */ +/* 211 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); +var Earcut = __webpack_require__(71); var GetFastValue = __webpack_require__(2); -var ModelViewProjection = __webpack_require__(894); -var ShaderSourceFS = __webpack_require__(893); -var ShaderSourceVS = __webpack_require__(892); -var TransformMatrix = __webpack_require__(38); -var Utils = __webpack_require__(10); -var WebGLPipeline = __webpack_require__(197); +var ModelViewProjection = __webpack_require__(1041); +var ShaderSourceFS = __webpack_require__(1040); +var ShaderSourceVS = __webpack_require__(1039); +var TransformMatrix = __webpack_require__(41); +var Utils = __webpack_require__(9); +var WebGLPipeline = __webpack_require__(212); /** * @classdesc @@ -43832,7 +46004,7 @@ var WebGLPipeline = __webpack_require__(197); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration options for this Texture Tint Pipeline, as described above. */ var TextureTintPipeline = new Class({ @@ -44075,11 +46247,6 @@ var TextureTintPipeline = new Class({ this.mvpUpdate(); - if (this.batches.length === 0) - { - this.pushBatch(); - } - return this; }, @@ -44105,58 +46272,56 @@ var TextureTintPipeline = new Class({ }, /** - * Assigns a texture to the current batch. If a texture is already set it creates - * a new batch object. + * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. * * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#setTexture2D * @since 3.1.0 * - * @param {WebGLTexture} texture - WebGLTexture that will be assigned to the current batch. - * @param {integer} textureUnit - Texture unit to which the texture needs to be bound. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline} This pipeline instance. */ setTexture2D: function (texture, unit) { - if (!texture) + if (texture === undefined) { texture = this.renderer.blankTexture.glTexture; } + if (unit === undefined) { unit = 0; } + + if (this.requireTextureBatch(texture, unit)) { - texture = this.renderer.blankTexture.glTexture; - unit = 0; - } - - var batches = this.batches; - - if (batches.length === 0) - { - this.pushBatch(); - } - - var batch = batches[batches.length - 1]; - - if (unit > 0) - { - if (batch.textures[unit - 1] && - batch.textures[unit - 1] !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].textures[unit - 1] = texture; - } - else - { - if (batch.texture !== null && - batch.texture !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].texture = texture; + this.pushBatch(texture, unit); } return this; }, + /** + * Checks if the current batch has the same texture and texture unit, or if we need to create a new batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#requireTextureBatch + * @since 3.16.0 + * + * @param {WebGLTexture} texture - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {integer} unit - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if the pipeline needs to create a new batch, otherwise `false`. + */ + requireTextureBatch: function (texture, unit) + { + var batches = this.batches; + var batchLength = batches.length; + + if (batchLength > 0) + { + // If Texture Unit specified, we get the texture from the textures array, otherwise we use the texture property + var currentTexture = (unit > 0) ? batches[batchLength - 1].textures[unit - 1] : batches[batchLength - 1].texture; + + return !(currentTexture === texture); + } + + return true; + }, + /** * Creates a new batch object and pushes it to a batch array. * The batch object contains information relevant to the current @@ -44165,16 +46330,32 @@ var TextureTintPipeline = new Class({ * * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#pushBatch * @since 3.1.0 + * + * @param {WebGLTexture} texture - Optional WebGLTexture that will be assigned to the created batch. + * @param {integer} unit - Texture unit to which the texture needs to be bound. */ - pushBatch: function () + pushBatch: function (texture, unit) { - var batch = { - first: this.vertexCount, - texture: null, - textures: [] - }; + if (unit === 0) + { + this.batches.push({ + first: this.vertexCount, + texture: texture, + textures: [] + }); + } + else + { + var textures = []; - this.batches.push(batch); + textures[unit - 1] = texture; + + this.batches.push({ + first: this.vertexCount, + texture: null, + textures: textures + }); + } }, /** @@ -44217,11 +46398,14 @@ var TextureTintPipeline = new Class({ gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - for (var index = 0; index < batches.length - 1; index++) + // Process the TEXTURE BATCHES + + for (var index = 0; index < batchCount - 1; index++) { batch = batches[index]; batchNext = batches[index + 1]; + // Multi-texture check (for non-zero texture units) if (batch.textures.length > 0) { for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) @@ -44230,7 +46414,7 @@ var TextureTintPipeline = new Class({ if (nTexture) { - renderer.setTexture2D(nTexture, 1 + textureIndex); + renderer.setTexture2D(nTexture, 1 + textureIndex, false); } } @@ -44239,18 +46423,21 @@ var TextureTintPipeline = new Class({ batchVertexCount = batchNext.first - batch.first; + // Bail out if texture property is null (i.e. if a texture unit > 0) if (batch.texture === null || batchVertexCount <= 0) { continue; } - renderer.setTexture2D(batch.texture, 0); + renderer.setTexture2D(batch.texture, 0, false); gl.drawArrays(topology, batch.first, batchVertexCount); } // Left over data - batch = batches[batches.length - 1]; + batch = batches[batchCount - 1]; + + // Multi-texture check (for non-zero texture units) if (batch.textures.length > 0) { @@ -44260,7 +46447,7 @@ var TextureTintPipeline = new Class({ if (nTexture) { - renderer.setTexture2D(nTexture, 1 + textureIndex); + renderer.setTexture2D(nTexture, 1 + textureIndex, false); } } @@ -44271,7 +46458,7 @@ var TextureTintPipeline = new Class({ if (batch.texture && batchVertexCount > 0) { - renderer.setTexture2D(batch.texture, 0); + renderer.setTexture2D(batch.texture, 0, false); gl.drawArrays(topology, batch.first, batchVertexCount); } @@ -44280,8 +46467,6 @@ var TextureTintPipeline = new Class({ batches.length = 0; - this.pushBatch(); - this.flushLocked = false; return this; @@ -44299,6 +46484,7 @@ var TextureTintPipeline = new Class({ */ batchSprite: function (sprite, camera, parentTransformMatrix) { + // Will cause a flush if there are batchSize entries already this.renderer.setPipeline(this); var camMatrix = this._tempMatrix1; @@ -44403,24 +46589,24 @@ var TextureTintPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); var tintEffect = (sprite._isTinted && sprite.tintFill); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -44460,10 +46646,12 @@ var TextureTintPipeline = new Class({ * @param {number} tintBL - The bottom-left tint color value. * @param {number} tintBR - The bottom-right tint color value. * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect) + batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) { var hasFlushed = false; @@ -44472,6 +46660,8 @@ var TextureTintPipeline = new Class({ this.flush(); hasFlushed = true; + + this.setTexture2D(texture, unit); } var vertexViewF32 = this.vertexViewF32; @@ -44558,10 +46748,12 @@ var TextureTintPipeline = new Class({ * @param {number} tintTR - The top-right tint color value. * @param {number} tintBL - The bottom-left tint color value. * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. * * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect) + batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) { var hasFlushed = false; @@ -44569,6 +46761,8 @@ var TextureTintPipeline = new Class({ { this.flush(); + this.setTexture2D(texture, unit); + hasFlushed = true; } @@ -44768,22 +46962,22 @@ var TextureTintPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -44841,7 +47035,7 @@ var TextureTintPipeline = new Class({ tint = Utils.getTintAppendFloatAlpha(tint, alpha); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, 0); }, /** @@ -44864,6 +47058,8 @@ var TextureTintPipeline = new Class({ var xw = x + width; var yh = y + height; + this.setTexture2D(); + var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); this.batchQuad(x, y, x, yh, xw, yh, xw, y, 0, 0, 1, 1, tint, tint, tint, tint, 2); @@ -45260,18 +47456,18 @@ module.exports = TextureTintPipeline; /***/ }), -/* 197 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(10); +var Utils = __webpack_require__(9); /** * @classdesc @@ -45310,7 +47506,7 @@ var Utils = __webpack_require__(10); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for this WebGL Pipeline, as described above. */ var WebGLPipeline = new Class({ @@ -45328,7 +47524,7 @@ var WebGLPipeline = new Class({ this.name = 'WebGLPipeline'; /** - * [description] + * The Game which owns this WebGL Pipeline. * * @name Phaser.Renderer.WebGL.WebGLPipeline#game * @type {Phaser.Game} @@ -45337,7 +47533,7 @@ var WebGLPipeline = new Class({ this.game = config.game; /** - * [description] + * The canvas which this WebGL Pipeline renders to. * * @name Phaser.Renderer.WebGL.WebGLPipeline#view * @type {HTMLCanvasElement} @@ -45352,7 +47548,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.resolution = config.game.config.resolution; + this.resolution = 1; /** * Width of the current viewport @@ -45361,7 +47557,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.width = config.game.config.width * this.resolution; + this.width = 0; /** * Height of the current viewport @@ -45370,10 +47566,10 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.height = config.game.config.height * this.resolution; + this.height = 0; /** - * [description] + * The WebGL context this WebGL Pipeline uses. * * @name Phaser.Renderer.WebGL.WebGLPipeline#gl * @type {WebGLRenderingContext} @@ -45401,7 +47597,7 @@ var WebGLPipeline = new Class({ this.vertexCapacity = config.vertexCapacity; /** - * [description] + * The WebGL Renderer which owns this WebGL Pipeline. * * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer * @type {Phaser.Renderer.WebGL.WebGLRenderer} @@ -45549,7 +47745,7 @@ var WebGLPipeline = new Class({ * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush * @since 3.0.0 * - * @return {boolean} [description] + * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. */ shouldFlush: function () { @@ -45562,9 +47758,9 @@ var WebGLPipeline = new Class({ * @method Phaser.Renderer.WebGL.WebGLPipeline#resize * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * @param {number} resolution - The resolution this WebGL Pipeline should be resized to. * * @return {this} This WebGLPipeline instance. */ @@ -45572,6 +47768,7 @@ var WebGLPipeline = new Class({ { this.width = width * resolution; this.height = height * resolution; + this.resolution = resolution; return this; }, @@ -45616,7 +47813,9 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Set whenever this WebGL Pipeline is bound to a WebGL Renderer. + * + * This method is called every time the WebGL Pipeline is attempted to be bound, even if it already is the current pipeline. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind * @since 3.0.0 @@ -45630,7 +47829,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called before each frame is rendered, but after the canvas has been cleared. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender * @since 3.0.0 @@ -45644,13 +47843,13 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called before a Scene's Camera is rendered. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. */ @@ -45661,7 +47860,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Called after each frame has been completely rendered and snapshots have been taken. * * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender * @since 3.0.0 @@ -45710,7 +47909,7 @@ var WebGLPipeline = new Class({ }, /** - * [description] + * Removes all object references in this WebGL Pipeline and removes its program from the WebGL context. * * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy * @since 3.0.0 @@ -45738,7 +47937,7 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] + * @param {number} x - The new value of the `float` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45756,8 +47955,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45775,9 +47974,9 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} z - [description] + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45888,7 +48087,7 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] + * @param {integer} x - The new value of the `int` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45906,8 +48105,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] + * @param {integer} x - The new X component of the `ivec2` uniform. + * @param {integer} y - The new Y component of the `ivec2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45925,9 +48124,9 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] + * @param {integer} x - The new X component of the `ivec3` uniform. + * @param {integer} y - The new Y component of the `ivec3` uniform. + * @param {integer} z - The new Z component of the `ivec3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45966,8 +48165,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat2` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -45985,8 +48184,8 @@ var WebGLPipeline = new Class({ * @since 3.2.0 * * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. * * @return {this} This WebGLPipeline instance. */ @@ -46022,16 +48221,16 @@ module.exports = WebGLPipeline; /***/ }), -/* 198 */ +/* 213 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * Wrap an angle in degrees. @@ -46054,16 +48253,16 @@ module.exports = WrapDegrees; /***/ }), -/* 199 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathWrap = __webpack_require__(53); +var MathWrap = __webpack_require__(57); /** * Wrap an angle. @@ -46086,7 +48285,7 @@ module.exports = Wrap; /***/ }), -/* 200 */ +/* 215 */ /***/ (function(module, exports) { var g; @@ -46112,23 +48311,52 @@ module.exports = g; /***/ }), -/* 201 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tweens.Events + */ + +module.exports = { + + TIMELINE_COMPLETE: __webpack_require__(475), + TIMELINE_LOOP: __webpack_require__(474), + TIMELINE_PAUSE: __webpack_require__(473), + TIMELINE_RESUME: __webpack_require__(472), + TIMELINE_START: __webpack_require__(471), + TIMELINE_UPDATE: __webpack_require__(470) + +}; + + +/***/ }), +/* 217 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(11); -var TweenBuilder = __webpack_require__(97); -var TWEEN_CONST = __webpack_require__(83); +var Events = __webpack_require__(216); +var TweenBuilder = __webpack_require__(104); +var TWEEN_CONST = __webpack_require__(89); /** * @classdesc - * [description] + * A Timeline combines multiple Tweens into one. Its overall behavior is otherwise similar to a single Tween. + * + * The Timeline updates all of its Tweens simultaneously. Its methods allow you to easily build a sequence of Tweens (each one starting after the previous one) or run multiple Tweens at once during given parts of the Timeline. * * @class Timeline * @memberof Phaser.Tweens @@ -46136,7 +48364,7 @@ var TWEEN_CONST = __webpack_require__(83); * @constructor * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] + * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager which owns this Timeline. */ var Timeline = new Class({ @@ -46149,7 +48377,7 @@ var Timeline = new Class({ EventEmitter.call(this); /** - * [description] + * The Tween Manager which owns this Timeline. * * @name Phaser.Tweens.Timeline#manager * @type {Phaser.Tweens.TweenManager} @@ -46158,7 +48386,7 @@ var Timeline = new Class({ this.manager = manager; /** - * [description] + * A constant value which allows this Timeline to be easily identified as one. * * @name Phaser.Tweens.Timeline#isTimeline * @type {boolean} @@ -46459,14 +48687,14 @@ var Timeline = new Class({ }, /** - * [description] + * Checks whether the offset value is a number or a directive that is relative to previous tweens. * * @method Phaser.Tweens.Timeline#isOffsetAbsolute * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The offset value to be evaluated * - * @return {boolean} [description] + * @return {boolean} True if the result is a number, false if it is a directive like " -= 1000" */ isOffsetAbsolute: function (value) { @@ -46474,14 +48702,14 @@ var Timeline = new Class({ }, /** - * [description] + * Checks if the offset is a relative value rather than an absolute one. If the value is just a number, this returns false. * * @method Phaser.Tweens.Timeline#isOffsetRelative * @since 3.0.0 * - * @param {string} value - [description] + * @param {string} value - The offset value to be evaluated * - * @return {boolean} [description] + * @return {boolean} Returns true if the value is relative, i.e " -= 1000". If false, the offset is absolute. */ isOffsetRelative: function (value) { @@ -46501,15 +48729,15 @@ var Timeline = new Class({ }, /** - * [description] + * Parses the relative offset value, returning a positive or negative number. * * @method Phaser.Tweens.Timeline#getRelativeOffset * @since 3.0.0 * - * @param {string} value - [description] - * @param {number} base - [description] + * @param {string} value - The relative offset, in the format of '-=500', for example. The first character determines whether it will be a positive or negative number. Spacing matters here. + * @param {number} base - The value to use as the offset. * - * @return {number} [description] + * @return {number} The returned number value. */ getRelativeOffset: function (value, base) { @@ -46533,7 +48761,7 @@ var Timeline = new Class({ }, /** - * [description] + * Calculates the total duration of the timeline. Computes all tween's durations and returns the full duration of the timeline. The resulting number is stored in the timeline, not as a return value. * * @method Phaser.Tweens.Timeline#calcDuration * @since 3.0.0 @@ -46596,12 +48824,12 @@ var Timeline = new Class({ }, /** - * [description] + * Initializes the timeline, which means all Tweens get their init() called, and the total duration will be computed. Returns a boolean indicating whether the timeline is auto-started or not. * * @method Phaser.Tweens.Timeline#init * @since 3.0.0 * - * @return {boolean} [description] + * @return {boolean} Returns true if the timeline is started. False if it is paused. */ init: function () { @@ -46623,12 +48851,12 @@ var Timeline = new Class({ }, /** - * [description] + * Resets all of the timeline's tweens back to their initial states. The boolean parameter indicates whether tweens that are looping should reset as well, or not. * * @method Phaser.Tweens.Timeline#resetTweens * @since 3.0.0 * - * @param {boolean} resetFromLoop - [description] + * @param {boolean} resetFromLoop - If true, resets all looping tweens to their initial values. */ resetTweens: function (resetFromLoop) { @@ -46641,15 +48869,15 @@ var Timeline = new Class({ }, /** - * Sets a callback for the Tween Manager. + * Sets a callback for the Timeline. * * @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] + * @param {string} type - The internal type of callback to set. + * @param {function} callback - Timeline allows multiple tweens to be linked together to create a streaming sequence. + * @param {array} [params] - The parameters to pass to the callback. + * @param {object} [scope] - The context scope of the callback. * * @return {Phaser.Tweens.Timeline} This Timeline object. */ @@ -46679,9 +48907,10 @@ var Timeline = new Class({ }, /** - * [description] + * Starts playing the timeline. * * @method Phaser.Tweens.Timeline#play + * @fires Phaser.Tweens.Events#TIMELINE_START * @since 3.0.0 */ play: function () @@ -46713,13 +48942,15 @@ var Timeline = new Class({ onStart.func.apply(onStart.scope, onStart.params); } - this.emit('start', this); + this.emit(Events.TIMELINE_START, this); }, /** * [description] * * @method Phaser.Tweens.Timeline#nextState + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_LOOP * @since 3.0.0 */ nextState: function () @@ -46742,7 +48973,7 @@ var Timeline = new Class({ onLoop.func.apply(onLoop.scope, onLoop.params); } - this.emit('loop', this, this.loopCounter); + this.emit(Events.TIMELINE_LOOP, this, this.loopCounter); this.resetTweens(true); @@ -46763,6 +48994,8 @@ var Timeline = new Class({ } else { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -46770,9 +49003,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } }, @@ -46781,6 +49012,8 @@ var Timeline = new Class({ * Otherwise, returns false. * * @method Phaser.Tweens.Timeline#update + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_UPDATE * @since 3.0.0 * * @param {number} timestamp - [description] @@ -46833,7 +49066,7 @@ var Timeline = new Class({ onUpdate.func.apply(onUpdate.scope, onUpdate.params); } - this.emit('update', this); + this.emit(Events.TIMELINE_UPDATE, this); // Anything still running? If not, we're done if (stillRunning === 0) @@ -46860,6 +49093,8 @@ var Timeline = new Class({ if (this.countdown <= 0) { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -46867,9 +49102,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } break; @@ -46890,9 +49123,10 @@ var Timeline = new Class({ }, /** - * [description] + * Pauses the timeline, retaining its internal state. * * @method Phaser.Tweens.Timeline#pause + * @fires Phaser.Tweens.Events#TIMELINE_PAUSE * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -46910,15 +49144,16 @@ var Timeline = new Class({ this.state = TWEEN_CONST.PAUSED; - this.emit('pause', this); + this.emit(Events.TIMELINE_PAUSE, this); return this; }, /** - * [description] + * Resumes the timeline from where it was when it was paused. * * @method Phaser.Tweens.Timeline#resume + * @fires Phaser.Tweens.Events#TIMELINE_RESUME * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -46932,20 +49167,20 @@ var Timeline = new Class({ this.state = this._pausedState; } - this.emit('resume', this); + this.emit(Events.TIMELINE_RESUME, this); return this; }, /** - * [description] + * Checks if any of the tweens has the target as the object they are operating on. Retuns false if no tweens operate on the target object. * * @method Phaser.Tweens.Timeline#hasTarget * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - The target to check all tweens against. * - * @return {boolean} [description] + * @return {boolean} True if there at least a single tween that operates on the target object. False otherwise. */ hasTarget: function (target) { @@ -46982,37 +49217,66 @@ module.exports = Timeline; /***/ }), -/* 202 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); -var Defaults = __webpack_require__(129); +var Clone = __webpack_require__(70); +var Defaults = __webpack_require__(141); var GetAdvancedValue = __webpack_require__(12); -var GetBoolean = __webpack_require__(84); -var GetEaseFunction = __webpack_require__(86); -var GetNewValue = __webpack_require__(98); -var GetTargets = __webpack_require__(131); -var GetTweens = __webpack_require__(204); +var GetBoolean = __webpack_require__(90); +var GetEaseFunction = __webpack_require__(92); +var GetNewValue = __webpack_require__(105); +var GetTargets = __webpack_require__(143); +var GetTweens = __webpack_require__(220); var GetValue = __webpack_require__(4); -var Timeline = __webpack_require__(201); -var TweenBuilder = __webpack_require__(97); +var Timeline = __webpack_require__(217); +var TweenBuilder = __webpack_require__(104); /** - * [description] + * Builds a Timeline of Tweens based on a configuration object. + * + * The configuration object (`config`) can have the following properties: + * + * `tweens` - an array of tween configuration objects to create and add into the new Timeline, as described by `TweenBuilder`. If this doesn't exist or is empty, the Timeline will start off paused and none of the other configuration settings will be read. If it's a function, it will be called and its return value will be used as the array. + * `targets` - an array (or function which returns one) of default targets to which to apply the Timeline. Each individual Tween configuration can override this value. + * `totalDuration` - if specified, each Tween in the Timeline will get an equal portion of this duration, usually in milliseconds, by default. Each individual Tween configuration can override the Tween's duration. + * `duration` - if `totalDuration` is not specified, the default duration, usually in milliseconds, of each Tween which will be created. Each individual Tween configuration can override the Tween's duration. + * `delay`, `easeParams`, `ease`, `hold`, `repeat`, `repeatDelay`, `yoyo`, `flipX`, `flipY` - the default settings for each Tween which will be created, as specified by `TweenBuilder`. Each individual Tween configuration can override any of these values. + * `completeDelay` - if specified, the time to wait, usually in milliseconds, before the Timeline completes. + * `loop` - how many times the Timeline should loop, or -1 to loop indefinitely. + * `loopDelay` - the time, usually in milliseconds, between each loop + * `paused` - if `true`, the Timeline will start paused + * `useFrames` - if `true`, all duration in the Timeline will be in frames instead of milliseconds + * `callbackScope` - the default scope (`this` value) to use for each callback registered by the Timeline Builder. If not specified, the Timeline itself will be used. + * `onStart` - if specified, the `onStart` callback for the Timeline, called every time it starts playing + * `onStartScope` - the scope (`this` value) to use for the `onStart` callback. If not specified, the `callbackScope` will be used. + * `onStartParams` - additional arguments to pass to the `onStart` callback. The Timeline will always be the first argument. + * `onUpdate` - if specified, the `onUpdate` callback for the Timeline, called every frame it's active, regardless of its Tweens + * `onUpdateScope` - the scope (`this` value) to use for the `onUpdate` callback. If not specified, the `callbackScope` will be used. + * `onUpdateParams` - additional arguments to pass to the `onUpdate` callback. The Timeline will always be the first argument. + * `onLoop` - if specified, the `onLoop` callback for the Timeline, called every time it loops + * `onLoopScope` - the scope (`this` value) to use for the `onLoop` callback. If not specified, the `callbackScope` will be used. + * `onLoopParams` - additional arguments to pass to the `onLoop` callback. The Timeline will always be the first argument. + * `onYoyo` - if specified, the `onYoyo` callback for the Timeline, called every time it yoyos + * `onYoyoScope` - the scope (`this` value) to use for the `onYoyo` callback. If not specified, the `callbackScope` will be used. + * `onYoyoParams` - additional arguments to pass to the `onYoyo` callback. The first argument will always be `null`, while the Timeline will always be the second argument. + * `onComplete` - if specified, the `onComplete` callback for the Timeline, called after it completes + * `onCompleteScope` - the scope (`this` value) to use for the `onComplete` callback. If not specified, the `callbackScope` will be used. + * `onCompleteParams` - additional arguments to pass to the `onComplete` callback. The Timeline will always be the first argument. * * @function Phaser.Tweens.Builders.TimelineBuilder * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] - * @param {object} config - [description] + * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager to which the Timeline will belong. + * @param {object} config - The configuration object for the Timeline, as described above. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline. */ var TimelineBuilder = function (manager, config) { @@ -47134,24 +49398,24 @@ module.exports = TimelineBuilder; /***/ }), -/* 203 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(129); +var Defaults = __webpack_require__(141); var GetAdvancedValue = __webpack_require__(12); -var GetBoolean = __webpack_require__(84); -var GetEaseFunction = __webpack_require__(86); -var GetNewValue = __webpack_require__(98); +var GetBoolean = __webpack_require__(90); +var GetEaseFunction = __webpack_require__(92); +var GetNewValue = __webpack_require__(105); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(130); -var Tween = __webpack_require__(128); -var TweenData = __webpack_require__(127); +var GetValueOp = __webpack_require__(142); +var Tween = __webpack_require__(140); +var TweenData = __webpack_require__(139); /** * [description] @@ -47262,19 +49526,19 @@ module.exports = NumberTweenBuilder; /***/ }), -/* 204 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); /** - * [description] + * Returns an array of all tweens in the given config * * @function Phaser.Tweens.Builders.GetTweens * @since 3.0.0 @@ -47308,16 +49572,16 @@ module.exports = GetTweens; /***/ }), -/* 205 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RESERVED = __webpack_require__(437); +var RESERVED = __webpack_require__(476); /** * [description] @@ -47366,12 +49630,12 @@ module.exports = GetProps; /***/ }), -/* 206 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47381,27 +49645,29 @@ var GetFastValue = __webpack_require__(2); /** * @typedef {object} TimerEventConfig * - * @property {number} [delay=0] - [description] - * @property {number} [repeat=0] - [description] - * @property {boolean} [loop=false] - [description] - * @property {function} [callback] - [description] - * @property {*} [callbackScope] - [description] - * @property {Array.<*>} [args] - [description] - * @property {number} [timeScale=1] - [description] - * @property {number} [startAt=1] - [description] - * @property {boolean} [paused=false] - [description] + * @property {number} [delay=0] - The delay after which the Timer Event should fire, in milliseconds. + * @property {number} [repeat=0] - The total number of times the Timer Event will repeat before finishing. + * @property {boolean} [loop=false] - `true` if the Timer Event should repeat indefinitely. + * @property {function} [callback] - The callback which will be called when the Timer Event fires. + * @property {*} [callbackScope] - The scope (`this` object) with which to invoke the `callback`. + * @property {Array.<*>} [args] - Additional arguments to be passed to the `callback`. + * @property {number} [timeScale=1] - The scale of the elapsed time. + * @property {number} [startAt=1] - The initial elapsed time in milliseconds. Useful if you want a long duration with repeat, but for the first loop to fire quickly. + * @property {boolean} [paused=false] - `true` if the Timer Event should be paused. */ /** * @classdesc - * [description] + * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. + * + * Because it's managed by a Clock, a Timer Event is based on game time, will be affected by its Clock's time scale, and will pause if its Clock pauses. * * @class TimerEvent * @memberof Phaser.Time * @constructor * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. */ var TimerEvent = new Class({ @@ -47500,7 +49766,9 @@ var TimerEvent = new Class({ this.startAt = 0; /** - * [description] + * The time in milliseconds which has elapsed since the Timer Event's creation. + * + * This value is local for the Timer Event and is relative to its Clock. As such, it's influenced by the Clock's time scale and paused state, the Timer Event's initial {@link #startAt} property, and the Timer Event's {@link #timeScale} and {@link #paused} state. * * @name Phaser.Time.TimerEvent#elapsed * @type {number} @@ -47510,7 +49778,7 @@ var TimerEvent = new Class({ this.elapsed = 0; /** - * [description] + * Whether or not this timer is paused. * * @name Phaser.Time.TimerEvent#paused * @type {boolean} @@ -47520,7 +49788,9 @@ var TimerEvent = new Class({ this.paused = false; /** - * [description] + * Whether the Timer Event's function has been called. + * + * When the Timer Event fires, this property will be set to `true` before the callback function is invoked and will be reset immediately afterward if the Timer Event should repeat. The value of this property does not directly influence whether the Timer Event will be removed from its Clock, but can prevent it from firing. * * @name Phaser.Time.TimerEvent#hasDispatched * @type {boolean} @@ -47533,12 +49803,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Completely reinitializes the Timer Event, regardless of its current state, according to a configuration object. * * @method Phaser.Time.TimerEvent#reset * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The new state for the Timer Event. * * @return {Phaser.Time.TimerEvent} This TimerEvent object. */ @@ -47576,7 +49846,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#getProgress * @since 3.0.0 * - * @return {number} [description] + * @return {number} A number between 0 and 1 representing the current progress. */ getProgress: function () { @@ -47589,7 +49859,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#getOverallProgress * @since 3.0.0 * - * @return {number} [description] + * @return {number} The overall progress of the Timer Event, between 0 and 1. */ getOverallProgress: function () { @@ -47607,12 +49877,14 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the number of times this Timer Event will repeat before finishing. + * + * This should not be confused with the number of times the Timer Event will fire before finishing. A return value of 0 doesn't indicate that the Timer Event has finished running - it indicates that it will not repeat after the next time it fires. * * @method Phaser.Time.TimerEvent#getRepeatCount * @since 3.0.0 * - * @return {number} [description] + * @return {number} How many times the Timer Event will repeat. */ getRepeatCount: function () { @@ -47620,12 +49892,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the local elapsed time for the current iteration of the Timer Event. * * @method Phaser.Time.TimerEvent#getElapsed * @since 3.0.0 * - * @return {number} [description] + * @return {number} The local elapsed time in milliseconds. */ getElapsed: function () { @@ -47633,12 +49905,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Returns the local elapsed time for the current iteration of the Timer Event in seconds. * * @method Phaser.Time.TimerEvent#getElapsedSeconds * @since 3.0.0 * - * @return {number} [description] + * @return {number} The local elapsed time in seconds. */ getElapsedSeconds: function () { @@ -47646,12 +49918,12 @@ var TimerEvent = new Class({ }, /** - * [description] + * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. * * @method Phaser.Time.TimerEvent#remove * @since 3.0.0 * - * @param {function} dispatchCallback - [description] + * @param {boolean} [dispatchCallback] - If `true` (by default `false`), the function of the Timer Event will be called before its removal from its Clock. */ remove: function (dispatchCallback) { @@ -47665,7 +49937,9 @@ var TimerEvent = new Class({ }, /** - * [description] + * Destroys all object references in the Timer Event, i.e. its callback, scope, and arguments. + * + * Normally, this method is only called by the Clock when it shuts down. As such, it doesn't stop the Timer Event. If called manually, the Timer Event will still be updated by the Clock, but it won't do anything when it fires. * * @method Phaser.Time.TimerEvent#destroy * @since 3.0.0 @@ -47683,23 +49957,23 @@ module.exports = TimerEvent; /***/ }), -/* 207 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var CONST = __webpack_require__(26); -var GameObject = __webpack_require__(19); -var StaticTilemapLayerRender = __webpack_require__(446); -var TilemapComponents = __webpack_require__(103); -var TransformMatrix = __webpack_require__(38); -var Utils = __webpack_require__(10); +var Components = __webpack_require__(13); +var CONST = __webpack_require__(28); +var GameObject = __webpack_require__(18); +var StaticTilemapLayerRender = __webpack_require__(485); +var TilemapComponents = __webpack_require__(110); +var TransformMatrix = __webpack_require__(41); +var Utils = __webpack_require__(9); /** * @classdesc @@ -47903,9 +50177,9 @@ var StaticTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -48043,7 +50317,7 @@ var StaticTilemapLayer = new Class({ this.setAlpha(this.layer.alpha); this.setPosition(x, y); this.setOrigin(); - this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); this.updateVBOData(); @@ -48284,8 +50558,8 @@ var StaticTilemapLayer = new Class({ * @param {integer} vOffset - The vertex offset. * @param {any} tile - The tile being rendered. * @param {any} tileset - The tileset being used for rendering. - * @param {integer} width - The width of the layer. - * @param {integer} height - The height of the layer. + * @param {integer} width - The width of the tileset image in pixels. + * @param {integer} height - The height of the tileset image in pixels. * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the layer is being rendered with. * @param {integer} tilesetIndex - The tileset index. * @@ -48300,32 +50574,32 @@ var StaticTilemapLayer = new Class({ return vOffset; } - var u0 = texCoords.x / width; - var v0 = texCoords.y / height; - var u1 = (texCoords.x + tile.width) / width; - var v1 = (texCoords.y + tile.height) / height; - - var matrix = this._tempMatrix; - - var tileWidth = tile.width; - var tileHeight = tile.height; + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; var halfTileWidth = tileWidth / 2; var halfTileHeight = tileHeight / 2; + var u0 = texCoords.x / width; + var v0 = texCoords.y / height; + var u1 = (texCoords.x + tileWidth) / width; + var v1 = (texCoords.y + tileHeight) / height; + + var matrix = this._tempMatrix; + var x = -halfTileWidth; var y = -halfTileHeight; if (tile.flipX) { tileWidth *= -1; - x += tile.width; + x += tileset.tileWidth; } if (tile.flipY) { tileHeight *= -1; - y += tile.height; + y += tileset.tileHeight; } var xw = x + tileWidth; @@ -48349,17 +50623,17 @@ var StaticTilemapLayer = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } var vertexViewF32 = this.vertexViewF32[tilesetIndex]; @@ -48487,10 +50761,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesWithin * @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 {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -48627,17 +50901,11 @@ var StaticTilemapLayer = new Class({ * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -48658,17 +50926,11 @@ var StaticTilemapLayer = new Class({ * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -48687,17 +50949,11 @@ var StaticTilemapLayer = new Class({ * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -48736,7 +50992,7 @@ var StaticTilemapLayer = new Class({ * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile * object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates * were invalid. @@ -48752,17 +51008,11 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithin * @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 {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. + * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -48777,18 +51027,12 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinWorldXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {number} worldX - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} worldY - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles high from the `tileY` index the area will be. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -48805,14 +51049,8 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -48828,8 +51066,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAt * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] + * @param {integer} tileX - X position to get the tile from in tile coordinates. + * @param {integer} tileY - Y position to get the tile from in tile coordinates. * * @return {boolean} */ @@ -48845,9 +51083,9 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAtWorldXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {number} worldX - The X coordinate of the world position. + * @param {number} worldY - The Y coordinate of the world position. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {boolean} */ @@ -48866,13 +51104,7 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -49036,10 +51268,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] + * @param {integer} tileX - The leftmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} tileY - The topmost tile index (in tile coordinates) to use as the origin of the area. + * @param {integer} width - How many tiles wide from the `tileX` index the area will be. + * @param {integer} height - How many tiles tall from the `tileY` index the area will be. * @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. * @@ -49059,8 +51291,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {integer} tileX - The X coordinate, in tile coordinates. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {number} */ @@ -49076,8 +51308,8 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY * @since 3.0.0 * - * @param {integer} tileY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {integer} tileY - The Y coordinate, in tile coordinates. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {number} */ @@ -49094,10 +51326,10 @@ var StaticTilemapLayer = new Class({ * @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] + * @param {integer} tileX - The X coordinate, in tile coordinates. + * @param {integer} tileY - The Y coordinate, in tile coordinates. + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. * * @return {Phaser.Math.Vector2} */ @@ -49113,10 +51345,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX * @since 3.0.0 * - * @param {number} worldX - [description] + * @param {number} worldX - The X coordinate, in world pixels. * @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] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.] * * @return {number} */ @@ -49132,10 +51364,10 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileY * @since 3.0.0 * - * @param {number} worldY - [description] + * @param {number} worldY - The Y coordinate, in world pixels. * @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] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {number} */ @@ -49152,12 +51384,12 @@ var StaticTilemapLayer = new Class({ * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY * @since 3.0.0 * - * @param {number} worldX - [description] - * @param {number} worldY - [description] + * @param {number} worldX - The X coordinate, in world pixels. + * @param {number} worldY - The Y coordinate, in world pixels. * @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] + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Math.Vector2} */ @@ -49207,20 +51439,20 @@ module.exports = StaticTilemapLayer; /***/ }), -/* 208 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(14); -var DynamicTilemapLayerRender = __webpack_require__(449); -var GameObject = __webpack_require__(19); -var TilemapComponents = __webpack_require__(103); +var Components = __webpack_require__(13); +var DynamicTilemapLayerRender = __webpack_require__(488); +var GameObject = __webpack_require__(18); +var TilemapComponents = __webpack_require__(110); /** * @classdesc @@ -49411,9 +51643,9 @@ var DynamicTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -49459,7 +51691,7 @@ var DynamicTilemapLayer = new Class({ this.setAlpha(this.layer.alpha); this.setPosition(x, y); this.setOrigin(); - this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); this.initPipeline('TextureTintPipeline'); }, @@ -49725,10 +51957,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -49773,10 +52002,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -49798,10 +52024,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -49858,10 +52081,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -49878,10 +52098,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -49901,10 +52118,7 @@ var DynamicTilemapLayer = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -50090,13 +52304,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -50188,10 +52396,8 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -50213,10 +52419,8 @@ var DynamicTilemapLayer = new Class({ * * @param {integer} start - The first index of the tile to be set for collision. * @param {integer} stop - The last index of the tile to be set 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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -50239,12 +52443,9 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -50264,10 +52465,8 @@ var DynamicTilemapLayer = new Class({ * @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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -50287,10 +52486,8 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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. + * @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.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -50310,8 +52507,7 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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 {(integer|integer[])} 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. * @@ -50336,7 +52532,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @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.DynamicTilemapLayer} This Tilemap Layer object. @@ -50547,26 +52743,26 @@ module.exports = DynamicTilemapLayer; /***/ }), -/* 209 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var DynamicTilemapLayer = __webpack_require__(208); -var Extend = __webpack_require__(20); -var Formats = __webpack_require__(29); -var LayerData = __webpack_require__(78); -var Rotate = __webpack_require__(242); -var StaticTilemapLayer = __webpack_require__(207); -var Tile = __webpack_require__(55); -var TilemapComponents = __webpack_require__(103); -var Tileset = __webpack_require__(99); +var DegToRad = __webpack_require__(34); +var DynamicTilemapLayer = __webpack_require__(224); +var Extend = __webpack_require__(19); +var Formats = __webpack_require__(31); +var LayerData = __webpack_require__(84); +var Rotate = __webpack_require__(373); +var StaticTilemapLayer = __webpack_require__(223); +var Tile = __webpack_require__(61); +var TilemapComponents = __webpack_require__(110); +var Tileset = __webpack_require__(106); /** * @callback TilemapFilterCallback @@ -50676,14 +52872,14 @@ var Tilemap = new Class({ /** * The render (draw) order of the map data (as specified in Tiled), usually 'right-down'. - * + * * The draw orders are: - * + * * right-down * left-down * right-up * left-up - * + * * This can be changed via the `setRenderOrder` method. * * @name Phaser.Tilemaps.Tilemap#renderOrder @@ -50793,22 +52989,22 @@ var Tilemap = new Class({ /** * Sets the rendering (draw) order of the tiles in this map. - * + * * The default is 'right-down', meaning it will order the tiles starting from the top-left, * drawing to the right and then moving down to the next row. - * + * * The draw orders are: - * + * * 0 = right-down * 1 = left-down * 2 = right-up * 3 = left-up - * + * * Setting the render order does not change the tiles or how they are stored in the layer, * it purely impacts the order in which they are rendered. - * + * * You can provide either an integer (0 to 3), or the string version of the order. - * + * * Calling this method _after_ creating Static or Dynamic Tilemap Layers will **not** automatically * update them to use the new render order. If you call this method after creating layers, use their * own `setRenderOrder` methods to change them as needed. @@ -50960,12 +53156,12 @@ var Tilemap = new Class({ * Copies the tiles in the source rectangular area to a new destination (all specified in tile * coordinates) within the layer. This copies all tile properties & recalculates collision * information in the destination region. - * + * * If no layer specified, the map's current layer is used. This cannot be applied to StaticTilemapLayers. * * @method Phaser.Tilemaps.Tilemap#copy * @since 3.0.0 - * + * * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. * @param {integer} width - The width of the area to copy, in tiles, not pixels. @@ -50973,7 +53169,7 @@ var Tilemap = new Class({ * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -51010,7 +53206,7 @@ var Tilemap = new Class({ * @param {integer} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. * @param {integer} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. * @param {integer} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. - * + * * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer was created, or null if it failed. */ createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) @@ -51240,7 +53436,7 @@ var Tilemap = new Class({ * @param {SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -51269,8 +53465,8 @@ var Tilemap = new Class({ * * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} x - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} y - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer was created, or null if it failed. */ @@ -51340,7 +53536,7 @@ var Tilemap = new Class({ * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -51390,6 +53586,14 @@ var Tilemap = new Class({ return objectLayer.objects.filter(callback, context); }, + /** + * @typedef {object} FilteringOptions + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ + /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns @@ -51407,11 +53611,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to apply the filter on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -51438,7 +53639,7 @@ var Tilemap = new Class({ * @param {integer} index - The tile index value to search for. * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -51498,11 +53699,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -51530,11 +53728,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -51691,7 +53886,7 @@ var Tilemap = new Class({ * @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 tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -51715,7 +53910,7 @@ var Tilemap = new Class({ * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -51744,11 +53939,8 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -51770,12 +53962,9 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -51799,12 +53988,9 @@ var Tilemap = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -51861,7 +54047,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -51886,7 +54072,7 @@ var Tilemap = new Class({ * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -51936,7 +54122,7 @@ var Tilemap = new Class({ * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. */ @@ -51968,7 +54154,7 @@ var Tilemap = new Class({ * @param {number} worldY - The y coordinate, in pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -52000,7 +54186,7 @@ var Tilemap = new Class({ * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -52036,7 +54222,7 @@ var Tilemap = new Class({ * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -52066,7 +54252,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -52095,7 +54281,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -52150,7 +54336,7 @@ var Tilemap = new Class({ * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -52180,7 +54366,7 @@ var Tilemap = new Class({ * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -52195,6 +54381,14 @@ var Tilemap = new Class({ return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, layer); }, + /** + * @typedef {object} StyleConfig + * + * @property {?number} [tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. + * @property {?number} [collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. + * @property {?number} [faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. + */ + /** * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles @@ -52207,11 +54401,8 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to search. If not given the current layer is used. + * @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52243,7 +54434,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52274,7 +54465,7 @@ var Tilemap = new Class({ * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52304,7 +54495,7 @@ var Tilemap = new Class({ * @param {integer} stop - The last index of the tile to be set 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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52336,7 +54527,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52364,7 +54555,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52392,7 +54583,7 @@ var Tilemap = new Class({ * * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52421,7 +54612,7 @@ var Tilemap = new Class({ * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52452,7 +54643,7 @@ var Tilemap = new Class({ * @param {integer} height - How many tiles tall from the `tileY` index the area will be. * @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. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52520,9 +54711,9 @@ var Tilemap = new Class({ var mapWidth = this.layers[i].width; var mapHeight = this.layers[i].height; - for (var row = 0; row < mapHeight; ++row) + for (var row = 0; row < mapHeight; row++) { - for (var col = 0; col < mapWidth; ++col) + for (var col = 0; col < mapWidth; col++) { var tile = mapData[row][col]; @@ -52566,13 +54757,16 @@ var Tilemap = new Class({ var mapWidth = layer.width; var mapHeight = layer.height; - for (var row = 0; row < mapHeight; ++row) + for (var row = 0; row < mapHeight; row++) { - for (var col = 0; col < mapWidth; ++col) + for (var col = 0; col < mapWidth; col++) { var tile = mapData[row][col]; - if (tile !== null) { tile.setSize(tileWidth, tileHeight); } + if (tile !== null) + { + tile.setSize(tileWidth, tileHeight); + } } } @@ -52595,7 +54789,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52630,7 +54824,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52659,7 +54853,7 @@ var Tilemap = new Class({ * * @param {integer} tileX - The x coordinate, in tiles, not pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -52683,7 +54877,8 @@ var Tilemap = new Class({ * * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer + * to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -52710,7 +54905,7 @@ var Tilemap = new Class({ * @param {integer} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. */ @@ -52751,7 +54946,7 @@ var Tilemap = new Class({ * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during * randomization. They should be in the form: { index: 0, weight: 4 } or * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -52781,7 +54976,8 @@ var Tilemap = new Class({ * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @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] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer + * to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -52806,7 +55002,7 @@ var Tilemap = new Class({ * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. * @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] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -52834,7 +55030,7 @@ var Tilemap = new Class({ * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. */ @@ -52875,19 +55071,19 @@ module.exports = Tilemap; /***/ }), -/* 210 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var MapData = __webpack_require__(77); -var ParseTileLayers = __webpack_require__(451); -var ParseTilesets = __webpack_require__(450); +var Formats = __webpack_require__(31); +var MapData = __webpack_require__(83); +var ParseTileLayers = __webpack_require__(490); +var ParseTilesets = __webpack_require__(489); /** * @namespace Phaser.Tilemaps.Parsers.Impact @@ -52946,12 +55142,12 @@ module.exports = ParseWeltmeister; /***/ }), -/* 211 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -52972,7 +55168,7 @@ var GetFastValue = __webpack_require__(2); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {object} [config] - The data for the layer from the Tiled JSON object. */ var ObjectLayer = new Class({ @@ -52983,7 +55179,7 @@ var ObjectLayer = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the Object Layer. * * @name Phaser.Tilemaps.ObjectLayer#name * @type {string} @@ -52992,7 +55188,7 @@ var ObjectLayer = new Class({ this.name = GetFastValue(config, 'name', 'object layer'); /** - * [description] + * The opacity of the layer, between 0 and 1. * * @name Phaser.Tilemaps.ObjectLayer#opacity * @type {number} @@ -53001,7 +55197,7 @@ var ObjectLayer = new Class({ this.opacity = GetFastValue(config, 'opacity', 1); /** - * [description] + * The custom properties defined on the Object Layer, keyed by their name. * * @name Phaser.Tilemaps.ObjectLayer#properties * @type {object} @@ -53010,7 +55206,7 @@ var ObjectLayer = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * [description] + * The type of each custom property defined on the Object Layer, keyed by its name. * * @name Phaser.Tilemaps.ObjectLayer#propertyTypes * @type {object} @@ -53019,7 +55215,7 @@ var ObjectLayer = new Class({ this.propertyTypes = GetFastValue(config, 'propertytypes', {}); /** - * [description] + * The type of the layer, which should be `objectgroup`. * * @name Phaser.Tilemaps.ObjectLayer#type * @type {string} @@ -53028,7 +55224,7 @@ var ObjectLayer = new Class({ this.type = GetFastValue(config, 'type', 'objectgroup'); /** - * [description] + * Whether the layer is shown (`true`) or hidden (`false`). * * @name Phaser.Tilemaps.ObjectLayer#visible * @type {boolean} @@ -53037,7 +55233,15 @@ var ObjectLayer = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * An array of all objects on this Object Layer. + * + * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique), `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees), `properties` (if any), `visible` state (`true` if visible, `false` otherwise), `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels). + * + * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property, a `flippedVertical` property, and `flippedAntiDiagonal` property. The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains information on flipping and rotation. + * + * Polylines have a `polyline` property, which is an array of objects corresponding to points, where each point has an `x` property and a `y` property. Polygons have an identically structured array in their `polygon` property. Text objects have a `text` property with the text's properties. + * + * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`. * * @name Phaser.Tilemaps.ObjectLayer#objects * @type {Phaser.GameObjects.GameObject[]} @@ -53052,33 +55256,33 @@ module.exports = ObjectLayer; /***/ }), -/* 212 */ +/* 228 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pick = __webpack_require__(455); -var ParseGID = __webpack_require__(214); +var Pick = __webpack_require__(494); +var ParseGID = __webpack_require__(230); var copyPoints = function (p) { return { x: p.x, y: p.y }; }; var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; /** - * [description] + * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) * * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject * @since 3.0.0 * - * @param {object} tiledObject - [description] - * @param {number} [offsetX=0] - [description] - * @param {number} [offsetY=0] - [description] + * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. + * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. + * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. * - * @return {object} [description] + * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. */ var ParseObject = function (tiledObject, offsetX, offsetY) { @@ -53134,12 +55338,12 @@ module.exports = ParseObject; /***/ }), -/* 213 */ +/* 229 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -53306,12 +55510,12 @@ module.exports = ImageCollection; /***/ }), -/* 214 */ +/* 230 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -53396,23 +55600,23 @@ module.exports = ParseGID; /***/ }), -/* 215 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var MapData = __webpack_require__(77); -var ParseTileLayers = __webpack_require__(459); -var ParseImageLayers = __webpack_require__(457); -var ParseTilesets = __webpack_require__(456); -var ParseObjectLayers = __webpack_require__(454); -var BuildTilesetIndex = __webpack_require__(453); -var AssignTileProperties = __webpack_require__(452); +var Formats = __webpack_require__(31); +var MapData = __webpack_require__(83); +var ParseTileLayers = __webpack_require__(498); +var ParseImageLayers = __webpack_require__(496); +var ParseTilesets = __webpack_require__(495); +var ParseObjectLayers = __webpack_require__(493); +var BuildTilesetIndex = __webpack_require__(492); +var AssignTileProperties = __webpack_require__(491); /** * @namespace Phaser.Tilemaps.Parsers.Tiled @@ -53477,17 +55681,17 @@ module.exports = ParseJSONTiled; /***/ }), -/* 216 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var Parse2DArray = __webpack_require__(133); +var Formats = __webpack_require__(31); +var Parse2DArray = __webpack_require__(145); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -53525,20 +55729,20 @@ module.exports = ParseCSV; /***/ }), -/* 217 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(29); -var Parse2DArray = __webpack_require__(133); -var ParseCSV = __webpack_require__(216); -var ParseJSONTiled = __webpack_require__(215); -var ParseWeltmeister = __webpack_require__(210); +var Formats = __webpack_require__(31); +var Parse2DArray = __webpack_require__(145); +var ParseCSV = __webpack_require__(232); +var ParseJSONTiled = __webpack_require__(231); +var ParseWeltmeister = __webpack_require__(226); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -53595,18 +55799,18 @@ module.exports = Parse; /***/ }), -/* 218 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tile = __webpack_require__(55); -var IsInLayerBounds = __webpack_require__(79); -var CalculateFacesAt = __webpack_require__(136); +var Tile = __webpack_require__(61); +var IsInLayerBounds = __webpack_require__(85); +var CalculateFacesAt = __webpack_require__(148); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -53630,7 +55834,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la if (recalculateFaces === undefined) { recalculateFaces = true; } if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } - var tile = layer.data[tileY][tileX]; + var tile = layer.data[tileY][tileX] || null; if (tile === null) { return null; @@ -53655,16 +55859,16 @@ module.exports = RemoveTileAt; /***/ }), -/* 219 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(79); +var IsInLayerBounds = __webpack_require__(85); /** * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns @@ -53698,16 +55902,16 @@ module.exports = HasTileAt; /***/ }), -/* 220 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -53743,12 +55947,12 @@ module.exports = ReplaceByIndex; /***/ }), -/* 221 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ @@ -53924,7 +56128,7 @@ module.exports = BasePlugin; /***/ }), -/* 222 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53937,7 +56141,7 @@ var Sleeping = {}; module.exports = Sleeping; -var Events = __webpack_require__(195); +var Events = __webpack_require__(210); (function() { @@ -54059,12 +56263,12 @@ var Events = __webpack_require__(195); /***/ }), -/* 223 */ +/* 239 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -54117,12 +56321,12 @@ module.exports = { /***/ }), -/* 224 */ +/* 240 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -54182,19 +56386,19 @@ module.exports = { /***/ }), -/* 225 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircleContains = __webpack_require__(40); +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var RectangleContains = __webpack_require__(39); +var CONST = __webpack_require__(38); +var RectangleContains = __webpack_require__(42); var Vector2 = __webpack_require__(3); /** @@ -54213,8 +56417,8 @@ var Vector2 = __webpack_require__(3); * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - [description] - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Static Body belongs to. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object this Static Body belongs to. */ var StaticBody = new Class({ @@ -54226,7 +56430,7 @@ var StaticBody = new Class({ var height = (gameObject.height) ? gameObject.height : 64; /** - * [description] + * The Arcade Physics simulation this Static Body belongs to. * * @name Phaser.Physics.Arcade.StaticBody#world * @type {Phaser.Physics.Arcade.World} @@ -54235,7 +56439,7 @@ var StaticBody = new Class({ this.world = world; /** - * [description] + * The Game Object this Static Body belongs to. * * @name Phaser.Physics.Arcade.StaticBody#gameObject * @type {Phaser.GameObjects.GameObject} @@ -54244,7 +56448,7 @@ var StaticBody = new Class({ this.gameObject = gameObject; /** - * [description] + * Whether the Static Body's boundary is drawn to the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugShowBody * @type {boolean} @@ -54253,7 +56457,7 @@ var StaticBody = new Class({ this.debugShowBody = world.defaults.debugShowStaticBody; /** - * [description] + * The color of this Static Body on the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor * @type {integer} @@ -54262,7 +56466,7 @@ var StaticBody = new Class({ this.debugBodyColor = world.defaults.staticBodyDebugColor; /** - * [description] + * Whether this Static Body is updated by the physics simulation. * * @name Phaser.Physics.Arcade.StaticBody#enable * @type {boolean} @@ -54272,7 +56476,7 @@ var StaticBody = new Class({ this.enable = true; /** - * [description] + * Whether this Static Body's boundary is circular (`true`) or rectangular (`false`). * * @name Phaser.Physics.Arcade.StaticBody#isCircle * @type {boolean} @@ -54282,7 +56486,8 @@ var StaticBody = new Class({ this.isCircle = false; /** - * [description] + * If this Static Body is circular, this is the unscaled radius of the Static Body's boundary, as set by {@link #setCircle}, in source pixels. + * The true radius is equal to `halfWidth`. * * @name Phaser.Physics.Arcade.StaticBody#radius * @type {number} @@ -54292,7 +56497,9 @@ var StaticBody = new Class({ this.radius = 0; /** - * [description] + * The offset of this Static Body's actual position from any updated position. + * + * Unlike a dynamic Body, a Static Body does not follow its Game Object. As such, this offset is only applied when resizing the Static Body. * * @name Phaser.Physics.Arcade.StaticBody#offset * @type {Phaser.Math.Vector2} @@ -54301,7 +56508,7 @@ var StaticBody = new Class({ this.offset = new Vector2(); /** - * [description] + * The position of this Static Body within the simulation. * * @name Phaser.Physics.Arcade.StaticBody#position * @type {Phaser.Math.Vector2} @@ -54310,7 +56517,8 @@ var StaticBody = new Class({ this.position = new Vector2(gameObject.x - gameObject.displayOriginX, gameObject.y - gameObject.displayOriginY); /** - * [description] + * The width of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. * * @name Phaser.Physics.Arcade.StaticBody#width * @type {number} @@ -54319,7 +56527,8 @@ var StaticBody = new Class({ this.width = width; /** - * [description] + * The height of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. * * @name Phaser.Physics.Arcade.StaticBody#height * @type {number} @@ -54328,7 +56537,8 @@ var StaticBody = new Class({ this.height = height; /** - * [description] + * Half the Static Body's width, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. * * @name Phaser.Physics.Arcade.StaticBody#halfWidth * @type {number} @@ -54337,7 +56547,8 @@ var StaticBody = new Class({ this.halfWidth = Math.abs(this.width / 2); /** - * [description] + * Half the Static Body's height, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. * * @name Phaser.Physics.Arcade.StaticBody#halfHeight * @type {number} @@ -54346,7 +56557,8 @@ var StaticBody = new Class({ this.halfHeight = Math.abs(this.height / 2); /** - * [description] + * The center of the Static Body's boundary. + * This is the midpoint of its `position` (top-left corner) and its bottom-right corner. * * @name Phaser.Physics.Arcade.StaticBody#center * @type {Phaser.Math.Vector2} @@ -54355,7 +56567,7 @@ var StaticBody = new Class({ this.center = new Vector2(gameObject.x + this.halfWidth, gameObject.y + this.halfHeight); /** - * [description] + * A constant zero velocity used by the Arcade Physics simulation for calculations. * * @name Phaser.Physics.Arcade.StaticBody#velocity * @type {Phaser.Math.Vector2} @@ -54365,7 +56577,7 @@ var StaticBody = new Class({ this.velocity = Vector2.ZERO; /** - * [description] + * A constant `false` value expected by the Arcade Physics simulation. * * @name Phaser.Physics.Arcade.StaticBody#allowGravity * @type {boolean} @@ -54398,10 +56610,12 @@ var StaticBody = new Class({ // If true this Body will dispatch events /** - * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary (and `collideWorldBounds` is also true). + * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary and never trigger a `worldbounds` event.) * * @name Phaser.Physics.Arcade.StaticBody#onWorldBounds * @type {boolean} + * @readonly * @default false * @since 3.0.0 */ @@ -54448,7 +56662,7 @@ var StaticBody = new Class({ this.immovable = true; /** - * A flag disabling the default horizontal separation of colliding bodies. Pass your own `processHandler` to the collider. + * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. * * @name Phaser.Physics.Arcade.StaticBody#customSeparateX * @type {boolean} @@ -54458,7 +56672,7 @@ var StaticBody = new Class({ this.customSeparateX = false; /** - * A flag disabling the default vertical separation of colliding bodies. Pass your own `processHandler` to the collider. + * A flag disabling the default vertical separation of colliding bodies. Pass your own `collideHandler` to the collider. * * @name Phaser.Physics.Arcade.StaticBody#customSeparateY * @type {boolean} @@ -54498,7 +56712,7 @@ var StaticBody = new Class({ this.overlapR = 0; /** - * Whether this StaticBody is overlapped with another and both have zero velocity. + * Whether this StaticBody has ever overlapped with another while both were not moving. * * @name Phaser.Physics.Arcade.StaticBody#embedded * @type {boolean} @@ -54509,9 +56723,11 @@ var StaticBody = new Class({ /** * Whether this StaticBody interacts with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary.) * * @name Phaser.Physics.Arcade.StaticBody#collideWorldBounds * @type {boolean} + * @readonly * @default false * @since 3.0.0 */ @@ -54527,7 +56743,7 @@ var StaticBody = new Class({ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; /** - * Whether this StaticBody is colliding with another and in which direction. + * Whether this StaticBody has ever collided with another body and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#touching * @type {ArcadeBodyCollision} @@ -54536,7 +56752,7 @@ var StaticBody = new Class({ this.touching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody was colliding with another during the last step, and in which direction. + * Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#wasTouching * @type {ArcadeBodyCollision} @@ -54545,7 +56761,7 @@ var StaticBody = new Class({ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody is colliding with a tile or the world boundary. + * Whether this StaticBody has ever collided with a tile or the world boundary. * * @name Phaser.Physics.Arcade.StaticBody#blocked * @type {ArcadeBodyCollision} @@ -54558,6 +56774,7 @@ var StaticBody = new Class({ * * @name Phaser.Physics.Arcade.StaticBody#physicsType * @type {integer} + * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ this.physicsType = CONST.STATIC_BODY; @@ -54793,14 +57010,14 @@ var StaticBody = new Class({ }, /** - * Updates this Static Body's position based on the current Game Object it is bound to. + * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. * Similar to `updateFromGameObject`, but doesn't modify the Body's dimensions. * * @method Phaser.Physics.Arcade.StaticBody#reset * @since 3.0.0 * - * @param {number} x - The x coordinate to reset the body to. - * @param {number} y - The y coordinate to reset the body to. + * @param {number} [x] - The x coordinate to reset the body to. If not given will use the parent Game Object's coordinate. + * @param {number} [y] - The y coordinate to reset the body to. If not given will use the parent Game Object's coordinate. */ reset: function (x, y) { @@ -54811,6 +57028,8 @@ var StaticBody = new Class({ this.world.staticTree.remove(this); + gameObject.setPosition(x, y); + gameObject.getTopLeft(this.position); this.updateCenter(); @@ -54909,7 +57128,7 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#deltaX * @since 3.0.0 * - * @return {number} Always zero for a Static Body. + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. */ deltaX: function () { @@ -54922,7 +57141,7 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#deltaY * @since 3.0.0 * - * @return {number} 0 + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. */ deltaY: function () { @@ -54930,12 +57149,12 @@ var StaticBody = new Class({ }, /** - * [description] + * The change in this StaticBody's rotation from the previous step. Always zero. * * @method Phaser.Physics.Arcade.StaticBody#deltaZ * @since 3.0.0 * - * @return {number} 0 + * @return {number} The change in this StaticBody's rotation from the previous step. Always zero. */ deltaZ: function () { @@ -54967,10 +57186,22 @@ var StaticBody = new Class({ { var pos = this.position; + var x = pos.x + this.halfWidth; + var y = pos.y + this.halfHeight; + if (this.debugShowBody) { graphic.lineStyle(1, this.debugBodyColor, 1); - graphic.strokeRect(pos.x, pos.y, this.width, this.height); + + if (this.isCircle) + { + graphic.strokeCircle(x, y, this.width / 2); + } + else + { + graphic.strokeRect(pos.x, pos.y, this.width, this.height); + } + } }, @@ -55134,30 +57365,29 @@ module.exports = StaticBody; /***/ }), -/* 226 */ +/* 242 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body. * * @function Phaser.Physics.Arcade.Tilemap.TileIntersectsBody * @since 3.0.0 * - * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - [description] - * @param {Phaser.Physics.Arcade.Body} body - [description] + * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - A rectangle object that defines the tile placement in the world. + * @param {Phaser.Physics.Arcade.Body} body - The body to check for intersection against. * - * @return {boolean} [description] + * @return {boolean} Returns `true` of the tile intersects with the body, otherwise `false`. */ var TileIntersectsBody = function (tileWorldRect, body) { - // Currently, all bodies are treated as rectangles when colliding with a Tile. Eventually, this - // should support circle bodies when those are less buggy in v3. + // Currently, all bodies are treated as rectangles when colliding with a Tile. return !( body.right <= tileWorldRect.left || @@ -55171,16 +57401,16 @@ module.exports = TileIntersectsBody; /***/ }), -/* 227 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var quickselect = __webpack_require__(313); +var quickselect = __webpack_require__(317); /** * @classdesc @@ -55779,12 +58009,12 @@ function multiSelect (arr, left, right, n, compare) module.exports = rbush; /***/ }), -/* 228 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -55792,7 +58022,16 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * A Process Queue maintains three internal lists. + * + * The `pending` list is a selection of items which are due to be made 'active' in the next update. + * The `active` list is a selection of items which are considered active and should be updated. + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. + * + * When new items are added to a Process Queue they are put in a pending data, rather than being added + * immediately the active list. Equally, items that are removed are put into the destroy list, rather than + * being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed + * time, rather than at the time of the request from the API. * * @class ProcessQueue * @memberof Phaser.Structs @@ -55808,7 +58047,7 @@ var ProcessQueue = new Class({ function ProcessQueue () { /** - * [description] + * The `pending` list is a selection of items which are due to be made 'active' in the next update. * * @genericUse {T[]} - [$type] * @@ -55821,7 +58060,7 @@ var ProcessQueue = new Class({ this._pending = []; /** - * [description] + * The `active` list is a selection of items which are considered active and should be updated. * * @genericUse {T[]} - [$type] * @@ -55834,7 +58073,7 @@ var ProcessQueue = new Class({ this._active = []; /** - * [description] + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. * * @genericUse {T[]} - [$type] * @@ -55847,7 +58086,7 @@ var ProcessQueue = new Class({ this._destroy = []; /** - * [description] + * The total number of items awaiting processing. * * @name Phaser.Structs.ProcessQueue#_toProcess * @type {integer} @@ -55859,7 +58098,8 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Adds a new item to the Process Queue. + * The item is added to the pending list and made active in the next update. * * @method Phaser.Structs.ProcessQueue#add * @since 3.0.0 @@ -55867,7 +58107,7 @@ var ProcessQueue = new Class({ * @genericUse {T} - [item] * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] * - * @param {*} item - [description] + * @param {*} item - The item to add to the queue. * * @return {Phaser.Structs.ProcessQueue} This Process Queue object. */ @@ -55881,7 +58121,8 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Removes an item from the Process Queue. + * The item is added to the pending destroy and fully removed in the next update. * * @method Phaser.Structs.ProcessQueue#remove * @since 3.0.0 @@ -55889,7 +58130,7 @@ var ProcessQueue = new Class({ * @genericUse {T} - [item] * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] * - * @param {*} item - [description] + * @param {*} item - The item to be removed from the queue. * * @return {Phaser.Structs.ProcessQueue} This Process Queue object. */ @@ -55903,14 +58144,17 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Update this queue. First it will process any items awaiting destruction, and remove them. + * + * Then it will check to see if there are any items pending insertion, and move them to an + * active state. Finally, it will return a list of active items for further processing. * * @method Phaser.Structs.ProcessQueue#update * @since 3.0.0 * * @genericUse {T[]} - [$return] * - * @return {Array.<*>} [description] + * @return {Array.<*>} A list of active items. */ update: function () { @@ -55962,14 +58206,14 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Returns the current list of active items. * * @method Phaser.Structs.ProcessQueue#getActive * @since 3.0.0 * * @genericUse {T[]} - [$return] * - * @return {Array.<*>} [description] + * @return {Array.<*>} A list of active items. */ getActive: function () { @@ -55977,13 +58221,15 @@ var ProcessQueue = new Class({ }, /** - * [description] + * Immediately destroys this process queue, clearing all of its internal arrays and resetting the process totals. * * @method Phaser.Structs.ProcessQueue#destroy * @since 3.0.0 */ destroy: function () { + this._toProcess = 0; + this._pending = []; this._active = []; this._destroy = []; @@ -55995,29 +58241,30 @@ module.exports = ProcessQueue; /***/ }), -/* 229 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(35); +var CONST = __webpack_require__(38); /** - * [description] + * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'. * * @function Phaser.Physics.Arcade.GetOverlapY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). * - * @return {number} [description] + * @return {number} The amount of overlap. */ var GetOverlapY = function (body1, body2, overlapOnly, bias) { @@ -56102,29 +58349,30 @@ module.exports = GetOverlapY; /***/ }), -/* 230 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(35); +var CONST = __webpack_require__(38); /** - * [description] + * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'. * * @function Phaser.Physics.Arcade.GetOverlapX * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). * - * @return {number} [description] + * @return {number} The amount of overlap. */ var GetOverlapX = function (body1, body2, overlapOnly, bias) { @@ -56209,12 +58457,12 @@ module.exports = GetOverlapX; /***/ }), -/* 231 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -56222,15 +58470,16 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects + * every step. If a collision, or overlap, occurs it will invoke the given callbacks. * * @class Collider * @memberof Phaser.Physics.Arcade * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - [description] - * @param {boolean} overlapOnly - [description] + * @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions. + * @param {boolean} overlapOnly - Whether to check for collisions or overlap. * @param {ArcadeColliderType} object1 - The first object to check for collision. * @param {ArcadeColliderType} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. @@ -56244,7 +58493,7 @@ var Collider = new Class({ function Collider (world, overlapOnly, object1, object2, collideCallback, processCallback, callbackContext) { /** - * [description] + * The world in which the bodies will collide. * * @name Phaser.Physics.Arcade.Collider#world * @type {Phaser.Physics.Arcade.World} @@ -56253,7 +58502,7 @@ var Collider = new Class({ this.world = world; /** - * [description] + * The name of the collider (unused by Phaser). * * @name Phaser.Physics.Arcade.Collider#name * @type {string} @@ -56262,7 +58511,7 @@ var Collider = new Class({ this.name = ''; /** - * [description] + * Whether the collider is active. * * @name Phaser.Physics.Arcade.Collider#active * @type {boolean} @@ -56272,7 +58521,7 @@ var Collider = new Class({ this.active = true; /** - * [description] + * Whether to check for collisions or overlaps. * * @name Phaser.Physics.Arcade.Collider#overlapOnly * @type {boolean} @@ -56281,7 +58530,7 @@ var Collider = new Class({ this.overlapOnly = overlapOnly; /** - * [description] + * The first object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object1 * @type {ArcadeColliderType} @@ -56290,7 +58539,7 @@ var Collider = new Class({ this.object1 = object1; /** - * [description] + * The second object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object2 * @type {ArcadeColliderType} @@ -56299,7 +58548,7 @@ var Collider = new Class({ this.object2 = object2; /** - * [description] + * The callback to invoke when the two objects collide. * * @name Phaser.Physics.Arcade.Collider#collideCallback * @type {ArcadePhysicsCallback} @@ -56308,7 +58557,7 @@ var Collider = new Class({ this.collideCallback = collideCallback; /** - * [description] + * If a processCallback exists it must return true or collision checking will be skipped. * * @name Phaser.Physics.Arcade.Collider#processCallback * @type {ArcadePhysicsCallback} @@ -56317,7 +58566,7 @@ var Collider = new Class({ this.processCallback = processCallback; /** - * [description] + * The context the collideCallback and processCallback will run in. * * @name Phaser.Physics.Arcade.Collider#callbackContext * @type {object} @@ -56327,14 +58576,16 @@ var Collider = new Class({ }, /** - * [description] + * A name for the Collider. + * + * Phaser does not use this value, it's for your own reference. * * @method Phaser.Physics.Arcade.Collider#setName * @since 3.1.0 * - * @param {string} name - [description] + * @param {string} name - The name to assign to the Collider. * - * @return {Phaser.Physics.Arcade.Collider} [description] + * @return {Phaser.Physics.Arcade.Collider} This Collider instance. */ setName: function (name) { @@ -56344,7 +58595,7 @@ var Collider = new Class({ }, /** - * [description] + * Called by World as part of its step processing, initial operation of collision checking. * * @method Phaser.Physics.Arcade.Collider#update * @since 3.0.0 @@ -56362,7 +58613,7 @@ var Collider = new Class({ }, /** - * [description] + * Removes Collider from World and disposes of its resources. * * @method Phaser.Physics.Arcade.Collider#destroy * @since 3.0.0 @@ -56389,21 +58640,49 @@ module.exports = Collider; /***/ }), -/* 232 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircleContains = __webpack_require__(40); +/** + * @namespace Phaser.Physics.Arcade.Events + */ + +module.exports = { + + COLLIDE: __webpack_require__(563), + OVERLAP: __webpack_require__(562), + PAUSE: __webpack_require__(561), + RESUME: __webpack_require__(560), + TILE_COLLIDE: __webpack_require__(559), + TILE_OVERLAP: __webpack_require__(558), + WORLD_BOUNDS: __webpack_require__(557) + +}; + + +/***/ }), +/* 249 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var RadToDeg = __webpack_require__(172); -var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(39); +var CONST = __webpack_require__(38); +var Events = __webpack_require__(248); +var RadToDeg = __webpack_require__(183); +var Rectangle = __webpack_require__(10); +var RectangleContains = __webpack_require__(42); var Vector2 = __webpack_require__(3); /** @@ -56795,7 +59074,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:worldbounds + * @see Phaser.Physics.Arcade.World#worldboundsEvent */ this.onWorldBounds = false; @@ -56806,7 +59085,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:collide + * @see Phaser.Physics.Arcade.World#collideEvent */ this.onCollide = false; @@ -56817,7 +59096,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#event:overlap + * @see Phaser.Physics.Arcade.World#overlapEvent */ this.onOverlap = false; @@ -56831,6 +59110,19 @@ var Body = new Class({ */ this.maxVelocity = new Vector2(10000, 10000); + /** + * The maximum speed this Body is allowed to reach. + * + * If not negative it limits the scalar value of speed. + * + * Any negative value means no maximum is being applied. + * + * @name Phaser.Physics.Arcade.Body#maxSpeed + * @type {number} + * @since 3.16.0 + */ + this.maxSpeed = -1; + /** * If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1. * The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all. @@ -57017,7 +59309,7 @@ var Body = new Class({ this.overlapR = 0; /** - * Whether this Body is overlapped with another and both have zero velocity. + * Whether this Body is overlapped with another and both are not moving. * * @name Phaser.Physics.Arcade.Body#embedded * @type {boolean} @@ -57038,7 +59330,7 @@ var Body = new Class({ /** * Whether this Body is checked for collisions and for which directions. - * You can set `checkCollision.none = false` to disable collision checks. + * You can set `checkCollision.none = true` to disable collision checks. * * @name Phaser.Physics.Arcade.Body#checkCollision * @type {ArcadeBodyCollision} @@ -57112,6 +59404,7 @@ var Body = new Class({ * @name Phaser.Physics.Arcade.Body#physicsType * @type {integer} * @readonly + * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ this.physicsType = CONST.DYNAMIC_BODY; @@ -57181,7 +59474,8 @@ var Body = new Class({ }, /** - * Updates this Body's transform, dimensions, and position from its Game Object. + * Updates the Body's `transform`, `width`, `height`, and `center` from its Game Object. + * The Body's `position` isn't changed. * * @method Phaser.Physics.Arcade.Body#updateBounds * @since 3.0.0 @@ -57268,7 +59562,7 @@ var Body = new Class({ * @fires Phaser.Physics.Arcade.World#worldbounds * @since 3.0.0 * - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} delta - The delta time, in seconds, elapsed since the last frame. */ update: function (delta) { @@ -57338,7 +59632,7 @@ var Body = new Class({ if (this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds) { - this.world.emit('worldbounds', this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); + this.world.emit(Events.WORLD_BOUNDS, this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); } } @@ -57789,7 +60083,10 @@ var Body = new Class({ { this.enable = false; - this.world.pendingDestroy.set(this); + if (this.world) + { + this.world.pendingDestroy.set(this); + } }, /** @@ -57809,7 +60106,7 @@ var Body = new Class({ if (this.debugShowBody) { - graphic.lineStyle(1, this.debugBodyColor); + graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor); if (this.isCircle) { @@ -57823,7 +60120,7 @@ var Body = new Class({ if (this.debugShowVelocity) { - graphic.lineStyle(1, this.world.defaults.velocityDebugColor, 1); + graphic.lineStyle(graphic.defaultStrokeWidth, this.world.defaults.velocityDebugColor, 1); graphic.lineBetween(x, y, x + this.velocity.x / 2, y + this.velocity.y / 2); } }, @@ -57942,6 +60239,23 @@ var Body = new Class({ return this; }, + /** + * Sets the maximum speed the Body can move. + * + * @method Phaser.Physics.Arcade.Body#setMaxSpeed + * @since 3.16.0 + * + * @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxSpeed: function (value) + { + this.maxSpeed = value; + + return this; + }, + /** * Sets the Body's bounce. * @@ -58484,74 +60798,42 @@ module.exports = Body; /***/ }), -/* 233 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(232); +var Body = __webpack_require__(249); var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); -var Collider = __webpack_require__(231); -var CONST = __webpack_require__(35); -var DistanceBetween = __webpack_require__(52); +var Collider = __webpack_require__(247); +var CONST = __webpack_require__(38); +var DistanceBetween = __webpack_require__(56); var EventEmitter = __webpack_require__(11); -var FuzzyEqual = __webpack_require__(248); -var FuzzyGreaterThan = __webpack_require__(247); -var FuzzyLessThan = __webpack_require__(246); -var GetOverlapX = __webpack_require__(230); -var GetOverlapY = __webpack_require__(229); +var Events = __webpack_require__(248); +var FuzzyEqual = __webpack_require__(186); +var FuzzyGreaterThan = __webpack_require__(383); +var FuzzyLessThan = __webpack_require__(382); +var GetOverlapX = __webpack_require__(246); +var GetOverlapY = __webpack_require__(245); var GetValue = __webpack_require__(4); -var ProcessQueue = __webpack_require__(228); -var ProcessTileCallbacks = __webpack_require__(514); -var Rectangle = __webpack_require__(9); -var RTree = __webpack_require__(227); -var SeparateTile = __webpack_require__(513); -var SeparateX = __webpack_require__(508); -var SeparateY = __webpack_require__(507); -var Set = __webpack_require__(95); -var StaticBody = __webpack_require__(225); -var TileIntersectsBody = __webpack_require__(226); -var TransformMatrix = __webpack_require__(38); +var ProcessQueue = __webpack_require__(244); +var ProcessTileCallbacks = __webpack_require__(556); +var Rectangle = __webpack_require__(10); +var RTree = __webpack_require__(243); +var SeparateTile = __webpack_require__(555); +var SeparateX = __webpack_require__(550); +var SeparateY = __webpack_require__(549); +var Set = __webpack_require__(102); +var StaticBody = __webpack_require__(241); +var TileIntersectsBody = __webpack_require__(242); +var TransformMatrix = __webpack_require__(41); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(53); - -/** - * @event Phaser.Physics.Arcade.World#pause - */ - -/** - * @event Phaser.Physics.Arcade.World#resume - */ - -/** - * @event Phaser.Physics.Arcade.World#collide - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - */ - -/** - * @event Phaser.Physics.Arcade.World#overlap - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - */ - -/** - * @event Phaser.Physics.Arcade.World#worldbounds - * @param {Phaser.Physics.Arcade.Body} body - * @param {boolean} up - * @param {boolean} down - * @param {boolean} left - * @param {boolean} right - */ +var Wrap = __webpack_require__(57); /** * @typedef {object} ArcadeWorldConfig @@ -58588,30 +60870,30 @@ var Wrap = __webpack_require__(53); /** * @typedef {object} CheckCollisionObject * - * @property {boolean} up - [description] - * @property {boolean} down - [description] - * @property {boolean} left - [description] - * @property {boolean} right - [description] + * @property {boolean} up - Will bodies collide with the top side of the world bounds? + * @property {boolean} down - Will bodies collide with the bottom side of the world bounds? + * @property {boolean} left - Will bodies collide with the left side of the world bounds? + * @property {boolean} right - Will bodies collide with the right side of the world bounds? */ /** * @typedef {object} ArcadeWorldDefaults * - * @property {boolean} debugShowBody - [description] - * @property {boolean} debugShowStaticBody - [description] - * @property {boolean} debugShowVelocity - [description] - * @property {number} bodyDebugColor - [description] - * @property {number} staticBodyDebugColor - [description] - * @property {number} velocityDebugColor - [description] + * @property {boolean} debugShowBody - Set to `true` to render dynamic body outlines to the debug display. + * @property {boolean} debugShowStaticBody - Set to `true` to render static body outlines to the debug display. + * @property {boolean} debugShowVelocity - Set to `true` to render body velocity markers to the debug display. + * @property {number} bodyDebugColor - The color of dynamic body outlines when rendered to the debug display. + * @property {number} staticBodyDebugColor - The color of static body outlines when rendered to the debug display. + * @property {number} velocityDebugColor - The color of the velocity markers when rendered to the debug display. */ /** * @typedef {object} ArcadeWorldTreeMinMax * - * @property {number} minX - [description] - * @property {number} minY - [description] - * @property {number} maxX - [description] - * @property {number} maxY - [description] + * @property {number} minX - The minimum x value used in RTree searches. + * @property {number} minY - The minimum y value used in RTree searches. + * @property {number} maxX - The maximum x value used in RTree searches. + * @property {number} maxY - The maximum y value used in RTree searches. */ /** @@ -58699,6 +60981,28 @@ var World = new Class({ */ this.pendingDestroy = new Set(); + /** + * Dynamic Bodies that need a second `update` call to resynchronize their Game Objects. + * This set is filled only when the `_late` flag is on, and is processed and cleared during `postUpdate`. + * + * @name Phaser.Physics.Arcade.World#late + * @type {Phaser.Structs.Set.} + * @private + * @since 3.16.0 + */ + this.late = new Set(); + + /** + * A flag allowing the `late` set to be filled, as appropriate. + * This is on (true) only between `update` and `postUpdate` and false at other times. + * + * @name Phaser.Physics.Arcade.World#_late + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._late = false; + /** * This simulation's collision processors. * @@ -58727,8 +61031,8 @@ var World = new Class({ this.bounds = new Rectangle( GetValue(config, 'x', 0), GetValue(config, 'y', 0), - GetValue(config, 'width', scene.sys.game.config.width), - GetValue(config, 'height', scene.sys.game.config.height) + GetValue(config, 'width', scene.sys.scale.width), + GetValue(config, 'height', scene.sys.scale.height) ); /** @@ -59233,6 +61537,7 @@ var World = new Class({ { this.tree.remove(body); this.bodies.delete(body); + this.late.delete(body); } else if (body.physicsType === CONST.STATIC_BODY) { @@ -59342,7 +61647,7 @@ var World = new Class({ * checks. * * @method Phaser.Physics.Arcade.World#pause - * @fires Phaser.Physics.Arcade.World#pause + * @fires Phaser.Physics.Arcade.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -59351,7 +61656,7 @@ var World = new Class({ { this.isPaused = true; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -59360,7 +61665,7 @@ var World = new Class({ * Resumes the simulation, if paused. * * @method Phaser.Physics.Arcade.World#resume - * @fires Phaser.Physics.Arcade.World#resume + * @fires Phaser.Physics.Arcade.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -59369,7 +61674,7 @@ var World = new Class({ { this.isPaused = false; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -59521,6 +61826,7 @@ var World = new Class({ var msPerFrame = this._frameTimeMS * this.timeScale; this._elapsed += delta; + this._late = false; while (this._elapsed >= msPerFrame) { @@ -59532,15 +61838,16 @@ var World = new Class({ } this.stepsLastFrame = stepsThisFrame; + this._late = true; }, /** - * Advances the simulation by one step. + * Advances the simulation by a time increment. * * @method Phaser.Physics.Arcade.World#step * @since 3.10.0 * - * @param {number} delta - The delta time amount, in ms, by which to advance the simulation. + * @param {number} delta - The delta time amount, in seconds, by which to advance the simulation. */ step: function (delta) { @@ -59602,14 +61909,37 @@ var World = new Class({ postUpdate: function () { var i; + var bodies; var body; + var len; var dynamic = this.bodies; var staticBodies = this.staticBodies; var pending = this.pendingDestroy; + var late = this.late; - var bodies = dynamic.entries; - var len = bodies.length; + if (late.size > 0) + { + bodies = late.entries; + len = bodies.length; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.postUpdate(); + } + } + + late.clear(); + } + + this._late = false; + + bodies = dynamic.entries; + len = bodies.length; if (this.drawDebug) { @@ -59657,6 +61987,7 @@ var World = new Class({ { dynamicTree.remove(body); dynamic.delete(body); + late.delete(body); } else if (body.physicsType === CONST.STATIC_BODY) { @@ -59679,7 +62010,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to be updated. - * @param {number} delta - The delta value to be used in the motion calculations. + * @param {number} delta - The delta value to be used in the motion calculations, in seconds. */ updateMotion: function (body, delta) { @@ -59698,7 +62029,7 @@ var World = new Class({ * @since 3.10.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation. + * @param {number} delta - The delta value to be used in the calculation, in seconds. */ computeAngularVelocity: function (body, delta) { @@ -59744,7 +62075,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation. + * @param {number} delta - The delta value to be used in the calculation, in seconds. */ computeVelocity: function (body, delta) { @@ -59759,6 +62090,7 @@ var World = new Class({ var maxY = body.maxVelocity.y; var speed = body.speed; + var maxSpeed = body.maxSpeed; var allowDrag = body.allowDrag; var useDamping = body.useDamping; @@ -59844,14 +62176,19 @@ var World = new Class({ velocityY = Clamp(velocityY, -maxY, maxY); body.velocity.set(velocityX, velocityY); + + if (maxSpeed > -1 && body.velocity.length() > maxSpeed) + { + body.velocity.normalize().scale(maxSpeed); + } }, /** * Separates two Bodies. * * @method Phaser.Physics.Arcade.World#separate - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. @@ -59942,18 +62279,24 @@ var World = new Class({ if (result) { - if (overlapOnly && (body1.onOverlap || body2.onOverlap)) + if (overlapOnly) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + if (body1.onOverlap || body2.onOverlap) + { + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); + } } else { - body1.postUpdate(); - body2.postUpdate(); + if (this._late) + { + this.late.set(body1); + this.late.set(body2); + } if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } } } @@ -59965,14 +62308,14 @@ var World = new Class({ * Separates two Bodies, when both are circular. * * @method Phaser.Physics.Arcade.World#separateCircle - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. * @param {boolean} [overlapOnly] - If this a collide or overlap check? - * @param {number} bias - A small value added to the calculations. + * @param {number} [bias] - A small value added to the calculations. * * @return {boolean} True if separation occurred, otherwise false. */ @@ -60039,7 +62382,7 @@ var World = new Class({ { if (overlap !== 0 && (body1.onOverlap || body2.onOverlap)) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); } // return true if there was some overlap, otherwise false @@ -60151,7 +62494,7 @@ var World = new Class({ if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } // sync changes back to the bodies @@ -60279,9 +62622,9 @@ var World = new Class({ * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {*} [callbackContext] - The context in which to run the callbacks. + * @param {any} [callbackContext] - The context in which to run the callbacks. * - * @return {boolean} True if any overlapping Game Objects were separated, otherwise false. + * @return {boolean} `true` if any overlapping Game Objects were separated, otherwise `false`. */ collide: function (object1, object2, collideCallback, processCallback, callbackContext) { @@ -60293,16 +62636,17 @@ var World = new Class({ }, /** - * Helper for Phaser.Physics.Arcade.World#collide. + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideObjects + * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - [description] - * @param {ArcadeColliderType} [object2] - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {ArcadeColliderType} object1 - The first object to check for collision. + * @param {ArcadeColliderType} object2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -60363,16 +62707,17 @@ var World = new Class({ }, /** - * Helper for Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap. + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap instead. * * @method Phaser.Physics.Arcade.World#collideHandler + * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - [description] - * @param {ArcadeColliderType} [object2] - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. + * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -60441,19 +62786,21 @@ var World = new Class({ }, /** - * Handler for Sprite vs. Sprite collisions. + * Internal handler for Sprite vs. Sprite collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsSprite + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite1 - [description] - * @param {Phaser.GameObjects.GameObject} sprite2 - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.GameObject} sprite1 - The first object to check for collision. + * @param {Phaser.GameObjects.GameObject} sprite2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -60476,19 +62823,21 @@ var World = new Class({ }, /** - * Handler for Sprite vs. Group collisions. + * Internal handler for Sprite vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsGroup + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite - [description] - * @param {Phaser.GameObjects.Group} group - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} `true` if the Sprite collided with the given Group, otherwise `false`. */ collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -60569,19 +62918,21 @@ var World = new Class({ }, /** - * Helper for Group vs. Tilemap collisions. + * Internal handler for Group vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.Group} group - [description] - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.Group} group - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -60609,21 +62960,22 @@ var World = new Class({ }, /** - * Helper for Sprite vs. Tilemap collisions. + * Internal handler for Sprite vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer - * @fires Phaser.Physics.Arcade.World#collide - * @fires Phaser.Physics.Arcade.World#overlap + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} sprite - [description] - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -60699,11 +63051,11 @@ var World = new Class({ if (overlapOnly && body.onOverlap) { - sprite.emit('overlap', body.gameObject, tile, body, null); + this.emit(Events.TILE_OVERLAP, body.gameObject, tile, body); } else if (body.onCollide) { - sprite.emit('collide', body.gameObject, tile, body, null); + this.emit(Events.TILE_COLLIDE, body.gameObject, tile, body); } // sync changes back to the body @@ -60713,19 +63065,21 @@ var World = new Class({ }, /** - * Helper for Group vs. Group collisions. + * Internal helper for Group vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideGroupVsGroup + * @private * @since 3.0.0 * - * @param {Phaser.GameObjects.Group} group1 - [description] - * @param {Phaser.GameObjects.Group} group2 - [description] - * @param {ArcadePhysicsCallback} collideCallback - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {*} callbackContext - [description] + * @param {Phaser.GameObjects.Group} group1 - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group2 - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * - * @return {boolean} [description] + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly) { @@ -60820,6 +63174,7 @@ var World = new Class({ this.staticTree.clear(); this.bodies.clear(); this.staticBodies.clear(); + this.late.clear(); this.colliders.destroy(); this.removeAllListeners(); @@ -60844,19 +63199,19 @@ module.exports = World; /***/ }), -/* 234 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeSprite = __webpack_require__(104); +var ArcadeSprite = __webpack_require__(111); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var Group = __webpack_require__(88); +var CONST = __webpack_require__(38); +var Group = __webpack_require__(94); var IsPlainObject = __webpack_require__(8); /** @@ -60935,7 +63290,7 @@ var StaticPhysicsGroup = new Class({ * * @name Phaser.Physics.Arcade.StaticGroup#physicsType * @type {integer} - * @default STATIC_BODY + * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ this.physicsType = CONST.STATIC_BODY; @@ -61023,20 +63378,20 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 235 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeSprite = __webpack_require__(104); +var ArcadeSprite = __webpack_require__(111); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); +var CONST = __webpack_require__(38); var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(88); +var Group = __webpack_require__(94); var IsPlainObject = __webpack_require__(8); /** @@ -61149,6 +63504,14 @@ var PhysicsGroup = new Class({ singleConfig.removeCallback = this.removeCallbackHandler; }); } + else + { + // config is not defined and children is not a plain object nor an array of plain objects + config = { + createCallback: this.createCallbackHandler, + removeCallback: this.removeCallbackHandler + }; + } /** * The physics simulation. @@ -61160,11 +63523,12 @@ var PhysicsGroup = new Class({ this.world = world; /** - * The class to create new group members from. - * This should be ArcadeImage, ArcadeSprite, or a class extending one of those. + * The class to create new Group members from. + * + * This should be either `Phaser.Physics.Arcade.Image`, `Phaser.Physics.Arcade.Sprite`, or a class extending one of those. * * @name Phaser.Physics.Arcade.Group#classType - * @type {(Phaser.Physics.Arcade.Image|Phaser.Physics.Arcade.Sprite)} + * @type {GroupClassTypeConstructor} * @default ArcadeSprite */ config.classType = GetFastValue(config, 'classType', ArcadeSprite); @@ -61174,7 +63538,7 @@ var PhysicsGroup = new Class({ * * @name Phaser.Physics.Arcade.Group#physicsType * @type {integer} - * @default DYNAMIC_BODY + * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ this.physicsType = CONST.DYNAMIC_BODY; @@ -61335,12 +63699,12 @@ module.exports = PhysicsGroup; /***/ }), -/* 236 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -61350,44 +63714,42 @@ module.exports = PhysicsGroup; module.exports = { - Acceleration: __webpack_require__(526), - Angular: __webpack_require__(525), - Bounce: __webpack_require__(524), - Debug: __webpack_require__(523), - Drag: __webpack_require__(522), - Enable: __webpack_require__(521), - Friction: __webpack_require__(520), - Gravity: __webpack_require__(519), - Immovable: __webpack_require__(518), - Mass: __webpack_require__(517), - Size: __webpack_require__(516), - Velocity: __webpack_require__(515) + Acceleration: __webpack_require__(575), + Angular: __webpack_require__(574), + Bounce: __webpack_require__(573), + Debug: __webpack_require__(572), + Drag: __webpack_require__(571), + Enable: __webpack_require__(570), + Friction: __webpack_require__(569), + Gravity: __webpack_require__(568), + Immovable: __webpack_require__(567), + Mass: __webpack_require__(566), + Size: __webpack_require__(565), + Velocity: __webpack_require__(564) }; /***/ }), -/* 237 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(236); -var Image = __webpack_require__(87); +var Components = __webpack_require__(253); +var Image = __webpack_require__(93); /** * @classdesc - * An Arcade Physics Image Game Object. + * An Arcade Physics Image is an Image with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * 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. + * The main difference between an Arcade Image and an Arcade Sprite is that you cannot animate an Arcade Image. * * @class Image * @extends Phaser.GameObjects.Image @@ -61470,21 +63832,21 @@ module.exports = ArcadeImage; /***/ }), -/* 238 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeImage = __webpack_require__(237); -var ArcadeSprite = __webpack_require__(104); +var ArcadeImage = __webpack_require__(254); +var ArcadeSprite = __webpack_require__(111); var Class = __webpack_require__(0); -var CONST = __webpack_require__(35); -var PhysicsGroup = __webpack_require__(235); -var StaticPhysicsGroup = __webpack_require__(234); +var CONST = __webpack_require__(38); +var PhysicsGroup = __webpack_require__(252); +var StaticPhysicsGroup = __webpack_require__(251); /** * @classdesc @@ -61533,7 +63895,7 @@ var Factory = new Class({ }, /** - * Create a new Arcade Physics Collider object. + * Creates a new Arcade Physics Collider object. * * @method Phaser.Physics.Arcade.Factory#collider * @since 3.0.0 @@ -61552,7 +63914,7 @@ var Factory = new Class({ }, /** - * Create a new Arcade Physics Collider Overlap object. + * Creates a new Arcade Physics Collider Overlap object. * * @method Phaser.Physics.Arcade.Factory#overlap * @since 3.0.0 @@ -61741,3110 +64103,18 @@ module.exports = Factory; /***/ }), -/* 239 */ +/* 256 */ /***/ (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__(138); -var Matrix3 = __webpack_require__(241); - -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 - * A quaternion. - * - * @class Quaternion - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. - */ -var Quaternion = new Class({ - - initialize: - - function Quaternion (x, y, z, w) - { - /** - * The x component of this Quaternion. - * - * @name Phaser.Math.Quaternion#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The y component of this Quaternion. - * - * @name Phaser.Math.Quaternion#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The z component of this Quaternion. - * - * @name Phaser.Math.Quaternion#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - - /** - * The w component of this Quaternion. - * - * @name Phaser.Math.Quaternion#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; - } - }, - - /** - * Copy the components of a given Quaternion or Vector into this Quaternion. - * - * @method Phaser.Math.Quaternion#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; - }, - - /** - * Set the components of this Quaternion. - * - * @method Phaser.Math.Quaternion#set - * @since 3.0.0 - * - * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. - * @param {number} [y=0] - The y component. - * @param {number} [z=0] - The z component. - * @param {number} [w=0] - The w component. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - set: function (x, y, z, w) - { - 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; - }, - - /** - * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. - * - * @method Phaser.Math.Quaternion#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - }, - - /** - * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. - * - * @method Phaser.Math.Quaternion#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - }, - - /** - * Scale this Quaternion by the given value. - * - * @method Phaser.Math.Quaternion#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - - return this; - }, - - /** - * Calculate the length of this Quaternion. - * - * @method Phaser.Math.Quaternion#length - * @since 3.0.0 - * - * @return {number} The length of this Quaternion. - */ - length: function () - { - 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); - }, - - /** - * Calculate the length of this Quaternion squared. - * - * @method Phaser.Math.Quaternion#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Quaternion, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return x * x + y * y + z * z + w * w; - }, - - /** - * Normalize this Quaternion. - * - * @method Phaser.Math.Quaternion#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - - 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; - }, - - /** - * Calculate the dot product of this Quaternion and the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#dot - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. - * - * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, - - /** - * Linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#lerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. - * @param {number} [t=0] - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - lerp: function (v, t) - { - 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; - }, - - /** - * [description] - * - * @method Phaser.Math.Quaternion#rotationTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - [description] - * @param {Phaser.Math.Vector3} b - [description] - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotationTo: function (a, b) - { - 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(); - - 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(); - } - }, - - /** - * Set the axes of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxes - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} view - The view axis. - * @param {Phaser.Math.Vector3} right - The right axis. - * @param {Phaser.Math.Vector3} up - The upwards axis. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxes: function (view, right, up) - { - var m = tmpMat3.val; - - 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(); - }, - - /** - * Reset this Matrix to an identity (default) Quaternion. - * - * @method Phaser.Math.Quaternion#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - identity: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; - }, - - /** - * Set the axis angle of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxisAngle - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} axis - The axis. - * @param {number} rad - The angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxisAngle: function (axis, rad) - { - 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; - }, - - /** - * Multiply this Quaternion by the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - multiply: function (b) - { - 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; - - 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; - }, - - /** - * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#slerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. - * @param {number} t - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - slerp: function (b, t) - { - // 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) - { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; - } - - // "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) - { - // 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; - }, - - /** - * Invert this Quaternion. - * - * @method Phaser.Math.Quaternion#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - invert: 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 - - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; - - return this; - }, - - /** - * Convert this Quaternion into its conjugate. - * - * Sets the x, y and z components. - * - * @method Phaser.Math.Quaternion#conjugate - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - conjugate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Rotate this Quaternion on the X axis. - * - * @method Phaser.Math.Quaternion#rotateX - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateX: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this Quaternion on the Y axis. - * - * @method Phaser.Math.Quaternion#rotateY - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - }, - - /** - * Rotate this Quaternion on the Z axis. - * - * @method Phaser.Math.Quaternion#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateZ: function (rad) - { - 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); - - 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; - }, - - /** - * Create a unit (or rotation) Quaternion from its x, y, and z components. - * - * Sets the w component. - * - * @method Phaser.Math.Quaternion#calculateW - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - calculateW: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); - - return this; - }, - - /** - * Convert the given Matrix into this Quaternion. - * - * @method Phaser.Math.Quaternion#fromMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - 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; - - -/***/ }), -/* 240 */ -/***/ (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 EPSILON = 0.000001; - -/** - * @classdesc - * A four-dimensional matrix. - * - * @class Matrix4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. - */ -var Matrix4 = new Class({ - - initialize: - - function Matrix4 (m) - { - /** - * The matrix values. - * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} - * @since 3.0.0 - */ - this.val = new Float32Array(16); - - if (m) - { - // Assume Matrix4 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, - - /** - * Make a clone of this Matrix4. - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} A clone of this Matrix4. - */ - clone: function () - { - return new Matrix4(this); - }, - - // TODO - Should work with basic values - - /** - * This method is an alias for `Matrix4.copy`. - * - * @method Phaser.Math.Matrix4#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - copy: function (src) - { - 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]; - 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; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix4#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromArray: function (a) - { - 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; - }, - - /** - * Reset this Matrix. - * - * Sets all values to `0`. - * - * @method Phaser.Math.Matrix4#zero - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - zero: function () - { - 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; - - return this; - }, - - /** - * Set the `x`, `y` and `z` values of this Matrix. - * - * @method Phaser.Math.Matrix4#xyz - * @since 3.0.0 - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - xyz: function (x, y, z) - { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; - - return this; - }, - - /** - * Set the scaling values of this Matrix. - * - * @method Phaser.Math.Matrix4#scaling - * @since 3.0.0 - * - * @param {number} x - The x scaling value. - * @param {number} y - The y scaling value. - * @param {number} z - The z scaling value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaling: function (x, y, z) - { - this.zero(); - - var out = this.val; - - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; - - return this; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix4#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - identity: function () - { - 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; - - return this; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix4#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - transpose: function () - { - 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; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix4#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - invert: 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 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; - - return this; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix4#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - adjoint: 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)); - - return this; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix4#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: 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 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; - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix4#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiply: function (src) - { - 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; - - 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.Math.Matrix4#multiplyLocal - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - [description] - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiplyLocal: function (src) - { - 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); - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix4#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translate: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - 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; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix4#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scale: 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; - - return this; - }, - - /** - * Derive a rotation matrix around the given axis. - * - * @method Phaser.Math.Matrix4#makeRotationAxis - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. - * @param {number} angle - The rotation angle in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - makeRotationAxis: function (axis, angle) - { - // 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.fromArray([ - 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; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotate: function (rad, axis) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its X axis. - * - * @method Phaser.Math.Matrix4#rotateX - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateX: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its Y axis. - * - * @method Phaser.Math.Matrix4#rotateY - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateY: function (rad) - { - 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; - - return this; - }, - - /** - * Rotate this matrix on its Z axis. - * - * @method Phaser.Math.Matrix4#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateZ: function (rad) - { - 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]; - - // 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; - }, - - /** - * Set the values of this Matrix from the given rotation Quaternion and translation Vector. - * - * @method Phaser.Math.Matrix4#fromRotationTranslation - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. - * @param {Phaser.Math.Vector3} v - The Vector to set translation from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromRotationTranslation: function (q, v) - { - // 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; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = v.x; - out[13] = v.y; - out[14] = v.z; - out[15] = 1; - - return this; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix4#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromQuat: function (q) - { - 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; - - 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[15] = 1; - - return this; - }, - - /** - * Generate a frustum matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#frustum - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - frustum: function (left, right, bottom, top, near, far) - { - 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; - - 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; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspective - * @since 3.0.0 - * - * @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. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspective: function (fovy, aspect, near, far) - { - 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; - - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspectiveLH - * @since 3.0.0 - * - * @param {number} width - The width of the frustum. - * @param {number} height - The height of the frustum. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspectiveLH: function (width, height, near, far) - { - 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; - - out[12] = 0; - out[13] = 0; - out[14] = (near * far) / (near - far); - out[15] = 0; - - return this; - }, - - /** - * Generate an orthogonal projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#ortho - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - ortho: function (left, right, bottom, top, near, far) - { - 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; - - 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; - }, - - /** - * Generate a look-at matrix with the given eye position, focal point, and up axis. - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer - * @param {Phaser.Math.Vector3} center - Point the viewer is looking at - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - lookAt: function (eye, center, up) - { - var out = this.val; - - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; - - var upx = up.x; - var upy = up.y; - var upz = up.z; - - 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(); - } - - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; - - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - - z0 *= len; - z1 *= len; - z2 *= len; - - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; - - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - - if (!len) - { - x0 = 0; - x1 = 0; - x2 = 0; - } - else - { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - - if (!len) - { - y0 = 0; - y1 = 0; - y2 = 0; - } - else - { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - 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; - }, - - /** - * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {number} yaw - [description] - * @param {number} pitch - [description] - * @param {number} roll - [description] - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - yawPitchRoll: function (yaw, pitch, roll) - { - 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; - }, - - /** - * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. - * @param {Phaser.Math.Vector3} position - The position of the world matrix. - * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. - * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. - * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) - { - 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) - { - this.multiplyLocal(viewMatrix); - } - - if (projectionMatrix !== undefined) - { - this.multiplyLocal(projectionMatrix); - } - - return this; - } - -}); - -var _tempMat1 = new Matrix4(); -var _tempMat2 = new Matrix4(); - -module.exports = Matrix4; - - -/***/ }), -/* 241 */ -/***/ (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 - * A three-dimensional matrix. - * - * Defaults to the identity matrix when instantiated. - * - * @class Matrix3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. - */ -var Matrix3 = new Class({ - - initialize: - - function Matrix3 (m) - { - /** - * The matrix values. - * - * @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(); - } - }, - - /** - * Make a clone of this Matrix3. - * - * @method Phaser.Math.Matrix3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} A clone of this Matrix3. - */ - clone: function () - { - return new Matrix3(this); - }, - - /** - * This method is an alias for `Matrix3.copy`. - * - * @method Phaser.Math.Matrix3#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix3#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - copy: function (src) - { - 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; - }, - - /** - * Copy the values of a given Matrix4 into this Matrix3. - * - * @method Phaser.Math.Matrix3#fromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromMat4: function (m) - { - 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; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix3#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromArray: function (a) - { - 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; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix3#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - 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; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix3#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - transpose: function () - { - 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; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix3#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - invert: 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 a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; - - 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; - - if (!det) - { - 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; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix3#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - adjoint: 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 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; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix3#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: 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 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); - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix3#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - multiply: function (src) - { - 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]; - - 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; - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix3#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - translate: function (v) - { - var a = this.val; - var x = v.x; - var y = v.y; - - 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; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix3#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - rotate: function (rad) - { - 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; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x` and `y` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix3#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - scale: function (v) - { - 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; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix3#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromQuat: function (q) - { - 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; - - out[2] = xz + wy; - out[5] = yz - wx; - out[8] = 1 - (xx + yy); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Matrix3#normalFromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - [description] - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - normalFromMat4: function (m) - { - 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; - - 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; - - 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; - - -/***/ }), -/* 242 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. - * - * @function Phaser.Math.Rotate - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. - * @param {number} angle - The angle to be rotated by in an anticlockwise direction. - * - * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. - */ -var Rotate = function (point, angle) -{ - var x = point.x; - var y = point.y; - - point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); - point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); - - return point; -}; - -module.exports = Rotate; - - -/***/ }), -/* 243 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using ceil. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. - * As will `14` snap to `15`... but `16` will snap to `20`. - * - * @function Phaser.Math.Snap.Ceil - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapCeil = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.ceil(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapCeil; - - -/***/ }), -/* 244 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates the factorial of a given number for integer values greater than 0. - * - * @function Phaser.Math.Factorial - * @since 3.0.0 - * - * @param {number} value - A positive integer to calculate the factorial of. - * - * @return {number} The factorial of the given number. - */ -var Factorial = function (value) -{ - if (value === 0) - { - return 1; - } - - var res = value; - - while (--value) - { - res *= value; - } - - return res; -}; - -module.exports = Factorial; - - -/***/ }), -/* 245 */ -/***/ (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 Factorial = __webpack_require__(244); - -/** - * [description] - * - * @function Phaser.Math.Bernstein - * @since 3.0.0 - * - * @param {number} n - [description] - * @param {number} i - [description] - * - * @return {number} [description] - */ -var Bernstein = function (n, i) -{ - return Factorial(n) / Factorial(i) / Factorial(n - i); -}; - -module.exports = Bernstein; - - -/***/ }), -/* 246 */ -/***/ (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 whether `a` is fuzzily less than `b`. - * - * `a` is fuzzily less than `b` if it is less than `b + epsilon`. - * - * @function Phaser.Math.Fuzzy.LessThan - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. - */ -var LessThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a < b + epsilon; -}; - -module.exports = LessThan; - - -/***/ }), -/* 247 */ -/***/ (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 whether `a` is fuzzily greater than `b`. - * - * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. - * - * @function Phaser.Math.Fuzzy.GreaterThan - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. - */ -var GreaterThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a > b - epsilon; -}; - -module.exports = GreaterThan; - - -/***/ }), -/* 248 */ -/***/ (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 whether the given values are fuzzily equal. - * - * Two numbers are fuzzily equal if their difference is less than `epsilon`. - * - * @function Phaser.Math.Fuzzy.Equal - * @since 3.0.0 - * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. - */ -var Equal = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.abs(a - b) < epsilon; -}; - -module.exports = Equal; - - -/***/ }), -/* 249 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points), squared. - * - * @function Phaser.Math.Distance.Squared - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point, squared. - */ -var DistanceSquared = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; - - return dx * dx + dy * dy; -}; - -module.exports = DistanceSquared; - - -/***/ }), -/* 250 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Normalize an angle to the [0, 2pi] range. - * - * @function Phaser.Math.Angle.Normalize - * @since 3.0.0 - * - * @param {number} angle - The angle to normalize, in radians. - * - * @return {number} The normalized angle, in radians. - */ -var Normalize = function (angle) -{ - angle = angle % (2 * Math.PI); - - if (angle >= 0) - { - return angle; - } - else - { - return angle + 2 * Math.PI; - } -}; - -module.exports = Normalize; - - -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -65017,19 +64287,20 @@ module.exports = TextFile; /***/ }), -/* 252 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var File = __webpack_require__(21); +var Events = __webpack_require__(75); +var File = __webpack_require__(22); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(141); +var GetURL = __webpack_require__(152); var IsPlainObject = __webpack_require__(8); /** @@ -65126,6 +64397,7 @@ var HTML5AudioFile = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.FileTypes.HTML5AudioFile#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 */ onProgress: function (event) @@ -65139,7 +64411,7 @@ var HTML5AudioFile = new Class({ this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); if (this.filesLoaded === this.filesTotal) { @@ -65213,21 +64485,21 @@ module.exports = HTML5AudioFile; /***/ }), -/* 253 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(26); -var File = __webpack_require__(21); +var CONST = __webpack_require__(28); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(252); +var HTML5AudioFile = __webpack_require__(257); var IsPlainObject = __webpack_require__(8); /** @@ -65493,16 +64765,16 @@ module.exports = AudioFile; /***/ }), -/* 254 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MergeXHRSettings = __webpack_require__(140); +var MergeXHRSettings = __webpack_require__(151); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -65546,7 +64818,7 @@ var XHRLoader = function (file, globalXHRSettings) // After a successful request, the xhr.response property will contain the requested data as a DOMString, ArrayBuffer, Blob, or Document (depending on what was set for responseType.) xhr.onload = file.onLoad.bind(file, xhr); - xhr.onerror = file.onError.bind(file); + xhr.onerror = file.onError.bind(file, xhr); xhr.onprogress = file.onProgress.bind(file); // This is the only standard method, the ones above are browser additions (maybe not universal?) @@ -65561,19 +64833,20 @@ module.exports = XHRLoader; /***/ }), -/* 255 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(113); var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(605); -var ResetKeyCombo = __webpack_require__(603); +var ProcessKeyCombo = __webpack_require__(611); +var ResetKeyCombo = __webpack_require__(609); /** * @callback KeyboardKeydownCallback @@ -65621,6 +64894,7 @@ var ResetKeyCombo = __webpack_require__(603); * @class KeyCombo * @memberof Phaser.Input.Keyboard * @constructor + * @listens Phaser.Input.Keyboard.Events#ANY_KEY_DOWN * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. @@ -65801,7 +65075,7 @@ var KeyCombo = new Class({ if (matched) { - _this.manager.emit('keycombomatch', _this, event); + _this.manager.emit(Events.COMBO_MATCH, _this, event); if (_this.resetOnMatch) { @@ -65820,11 +65094,12 @@ var KeyCombo = new Class({ * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown * @private * @type {KeyboardKeydownCallback} + * @fires Phaser.Input.Keyboard.Events#COMBO_MATCH * @since 3.0.0 */ this.onKeyDown = onKeyDownHandler; - this.manager.on('keydown', onKeyDownHandler); + this.manager.on(Events.ANY_KEY_DOWN, this.onKeyDown); }, /** @@ -65855,7 +65130,7 @@ var KeyCombo = new Class({ this.enabled = false; this.keyCodes = []; - this.manager.off('keydown', this.onKeyDown); + this.manager.off(Events.ANY_KEY_DOWN, this.onKeyDown); this.manager = null; } @@ -65866,16 +65141,18 @@ module.exports = KeyCombo; /***/ }), -/* 256 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); +var Events = __webpack_require__(113); /** * @classdesc @@ -65883,6 +65160,7 @@ var Class = __webpack_require__(0); * keycode must be an integer * * @class Key + * @extends Phaser.Events.EventEmitter * @memberof Phaser.Input.Keyboard * @constructor * @since 3.0.0 @@ -65891,10 +65169,14 @@ var Class = __webpack_require__(0); */ var Key = new Class({ + Extends: EventEmitter, + initialize: function Key (keyCode) { + EventEmitter.call(this); + /** * The keycode of this key. * @@ -65913,16 +65195,6 @@ var Key = new Class({ */ this.originalEvent = undefined; - /** - * Should this Key prevent event propagation? - * - * @name Phaser.Input.Keyboard.Key#preventDefault - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.preventDefault = true; - /** * Can this Key be processed? * @@ -65983,6 +65255,17 @@ var Key = new Class({ */ this.shiftKey = false; + /** + * The down state of the Meta key, if pressed at the same time as this key. + * On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key. + * + * @name Phaser.Input.Keyboard.Key#metaKey + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.metaKey = false; + /** * The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad. * @@ -66023,6 +65306,19 @@ var Key = new Class({ */ this.timeUp = 0; + /** + * When a key is held down should it continuously fire the `down` event each time it repeats? + * + * By default it will emit the `down` event just once, but if you wish to receive the event + * for each repeat as well, enable this property. + * + * @name Phaser.Input.Keyboard.Key#emitOnRepeat + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.emitOnRepeat = false; + /** * If a key is held down this holds down the number of times the key has 'repeated'. * @@ -66066,10 +65362,104 @@ var Key = new Class({ this._tick = -1; }, + /** + * Controls if this Key will continuously emit a `down` event while being held down (true), + * or emit the event just once, on first press, and then skip future events (false). + * + * @method Phaser.Input.Keyboard.Key#setEmitOnRepeat + * @since 3.16.0 + * + * @param {boolean} value - Emit `down` events on repeated key down actions, or just once? + * + * @return {Phaser.Input.Keyboard.Key} This Key instance. + */ + setEmitOnRepeat: function (value) + { + this.emitOnRepeat = value; + + return this; + }, + + /** + * Processes the Key Down action for this Key. + * Called automatically by the Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.Key#onDown + * @fires Phaser.Input.Keyboard.Events#DOWN + * @since 3.16.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard event. + */ + onDown: function (event) + { + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.altKey = event.altKey; + this.ctrlKey = event.ctrlKey; + this.shiftKey = event.shiftKey; + this.metaKey = event.metaKey; + this.location = event.location; + + this.repeats++; + + if (!this.isDown) + { + this.isDown = true; + this.isUp = false; + this.timeDown = event.timeStamp; + this.duration = 0; + this._justDown = true; + this._justUp = false; + + this.emit(Events.DOWN, this, event); + } + else if (this.emitOnRepeat) + { + this.emit(Events.DOWN, this, event); + } + }, + + /** + * Processes the Key Up action for this Key. + * Called automatically by the Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.Key#onUp + * @fires Phaser.Input.Keyboard.Events#UP + * @since 3.16.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard event. + */ + onUp: function (event) + { + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.isDown = false; + this.isUp = true; + this.timeUp = event.timeStamp; + this.duration = this.timeUp - this.timeDown; + this.repeats = 0; + + this._justDown = false; + this._justUp = true; + this._tick = -1; + + this.emit(Events.UP, this, event); + }, + /** * Resets this Key object back to its default un-pressed state. * - * @method Phaser.Input.Keyboard.Key.reset + * @method Phaser.Input.Keyboard.Key#reset * @since 3.6.0 * * @return {Phaser.Input.Keyboard.Key} This Key instance. @@ -66083,6 +65473,7 @@ var Key = new Class({ this.altKey = false; this.ctrlKey = false; this.shiftKey = false; + this.metaKey = false; this.timeDown = 0; this.duration = 0; this.timeUp = 0; @@ -66092,6 +65483,19 @@ var Key = new Class({ this._tick = -1; return this; + }, + + /** + * Removes any bound event handlers and removes local references. + * + * @method Phaser.Input.Keyboard.Key#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.originalEvent = null; } }); @@ -66100,17 +65504,17 @@ module.exports = Key; /***/ }), -/* 257 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Axis = __webpack_require__(259); -var Button = __webpack_require__(258); +var Axis = __webpack_require__(264); +var Button = __webpack_require__(263); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(11); var Vector2 = __webpack_require__(3); @@ -66858,16 +66262,17 @@ module.exports = Gamepad; /***/ }), -/* 258 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var Events = __webpack_require__(153); /** * @classdesc @@ -66952,10 +66357,14 @@ var Button = new Class({ * Called automatically by the Gamepad as part of its update. * * @method Phaser.Input.Gamepad.Button#update + * @fires Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#BUTTON_UP + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP * @private * @since 3.0.0 * - * @param {number} value - The GamepadButton value. + * @param {number} value - The value of the button. Between 0 and 1. */ update: function (value) { @@ -66969,15 +66378,15 @@ var Button = new Class({ if (!this.pressed) { this.pressed = true; - this.events.emit('down', pad, this, value); - this.pad.emit('down', index, value, this); + this.events.emit(Events.BUTTON_DOWN, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_DOWN, index, value, this); } } else if (this.pressed) { this.pressed = false; - this.events.emit('up', pad, this, value); - this.pad.emit('up', index, value, this); + this.events.emit(Events.BUTTON_UP, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_UP, index, value, this); } }, @@ -66999,12 +66408,12 @@ module.exports = Button; /***/ }), -/* 259 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67124,12 +66533,12 @@ module.exports = Axis; /***/ }), -/* 260 */ +/* 265 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67220,12 +66629,12 @@ module.exports = CreateInteractiveObject; /***/ }), -/* 261 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67244,17 +66653,17 @@ function getLength (x1, y1, x2, y2) } /** - * [description] + * Calculates the position of the incenter of a Triangle object. This is the point where its three angle bisectors meet and it's also the center of the incircle, which is the circle inscribed in the triangle. * * @function Phaser.Geom.Triangle.InCenter * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to find the incenter of. + * @param {Phaser.Geom.Point} [out] - An optional Point in which to store the coordinates. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} Point (x, y) of the center pixel of the triangle. */ var InCenter = function (triangle, out) { @@ -67285,28 +66694,28 @@ module.exports = InCenter; /***/ }), -/* 262 */ +/* 267 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Moves each point (vertex) of a Triangle by a given offset, thus moving the entire Triangle by that offset. * * @function Phaser.Geom.Triangle.Offset * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to move. + * @param {number} x - The horizontal offset (distance) by which to move each point. Can be positive or negative. + * @param {number} y - The vertical offset (distance) by which to move each point. Can be positive or negative. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The modified Triangle. */ var Offset = function (triangle, x, y) { @@ -67326,12 +66735,12 @@ module.exports = Offset; /***/ }), -/* 263 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67342,17 +66751,19 @@ var Point = __webpack_require__(6); // The centroid divides each median in a ratio of 2:1 /** - * [description] + * Calculates the position of a Triangle's centroid, which is also its center of mass (center of gravity). + * + * The centroid is the point in a Triangle at which its three medians (the lines drawn from the vertices to the bisectors of the opposite sides) meet. It divides each one in a 2:1 ratio. * * @function Phaser.Geom.Triangle.Centroid * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the coordinates in. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} The `out` object with modified `x` and `y` properties, or a new Point if none was provided. */ var Centroid = function (triangle, out) { @@ -67368,27 +66779,25 @@ module.exports = Centroid; /***/ }), -/* 264 */ +/* 269 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Checks if rectB is fully contained within rectA - /** - * [description] + * Tests if one rectangle fully contains another. * * @function Phaser.Geom.Rectangle.ContainsRect * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first rectangle. + * @param {Phaser.Geom.Rectangle} rectB - The second rectangle. * - * @return {boolean} [description] + * @return {boolean} True only if rectA fully contains rectB. */ var ContainsRect = function (rectA, rectB) { @@ -67410,77 +66819,77 @@ module.exports = ContainsRect; /***/ }), -/* 265 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); -Rectangle.Area = __webpack_require__(656); -Rectangle.Ceil = __webpack_require__(655); -Rectangle.CeilAll = __webpack_require__(654); -Rectangle.CenterOn = __webpack_require__(175); -Rectangle.Clone = __webpack_require__(653); -Rectangle.Contains = __webpack_require__(39); -Rectangle.ContainsPoint = __webpack_require__(652); -Rectangle.ContainsRect = __webpack_require__(264); -Rectangle.CopyFrom = __webpack_require__(651); -Rectangle.Decompose = __webpack_require__(270); -Rectangle.Equals = __webpack_require__(650); -Rectangle.FitInside = __webpack_require__(649); -Rectangle.FitOutside = __webpack_require__(648); -Rectangle.Floor = __webpack_require__(647); -Rectangle.FloorAll = __webpack_require__(646); -Rectangle.FromPoints = __webpack_require__(173); -Rectangle.GetAspectRatio = __webpack_require__(145); -Rectangle.GetCenter = __webpack_require__(645); -Rectangle.GetPoint = __webpack_require__(190); -Rectangle.GetPoints = __webpack_require__(398); -Rectangle.GetSize = __webpack_require__(644); -Rectangle.Inflate = __webpack_require__(643); -Rectangle.Intersection = __webpack_require__(642); -Rectangle.MarchingAnts = __webpack_require__(388); -Rectangle.MergePoints = __webpack_require__(641); -Rectangle.MergeRect = __webpack_require__(640); -Rectangle.MergeXY = __webpack_require__(639); -Rectangle.Offset = __webpack_require__(638); -Rectangle.OffsetPoint = __webpack_require__(637); -Rectangle.Overlaps = __webpack_require__(636); -Rectangle.Perimeter = __webpack_require__(124); -Rectangle.PerimeterPoint = __webpack_require__(635); -Rectangle.Random = __webpack_require__(187); -Rectangle.RandomOutside = __webpack_require__(634); -Rectangle.SameDimensions = __webpack_require__(633); -Rectangle.Scale = __webpack_require__(632); -Rectangle.Union = __webpack_require__(309); +Rectangle.Area = __webpack_require__(675); +Rectangle.Ceil = __webpack_require__(674); +Rectangle.CeilAll = __webpack_require__(673); +Rectangle.CenterOn = __webpack_require__(189); +Rectangle.Clone = __webpack_require__(672); +Rectangle.Contains = __webpack_require__(42); +Rectangle.ContainsPoint = __webpack_require__(671); +Rectangle.ContainsRect = __webpack_require__(269); +Rectangle.CopyFrom = __webpack_require__(670); +Rectangle.Decompose = __webpack_require__(275); +Rectangle.Equals = __webpack_require__(669); +Rectangle.FitInside = __webpack_require__(668); +Rectangle.FitOutside = __webpack_require__(667); +Rectangle.Floor = __webpack_require__(666); +Rectangle.FloorAll = __webpack_require__(665); +Rectangle.FromPoints = __webpack_require__(180); +Rectangle.GetAspectRatio = __webpack_require__(155); +Rectangle.GetCenter = __webpack_require__(664); +Rectangle.GetPoint = __webpack_require__(204); +Rectangle.GetPoints = __webpack_require__(430); +Rectangle.GetSize = __webpack_require__(663); +Rectangle.Inflate = __webpack_require__(662); +Rectangle.Intersection = __webpack_require__(661); +Rectangle.MarchingAnts = __webpack_require__(419); +Rectangle.MergePoints = __webpack_require__(660); +Rectangle.MergeRect = __webpack_require__(659); +Rectangle.MergeXY = __webpack_require__(658); +Rectangle.Offset = __webpack_require__(657); +Rectangle.OffsetPoint = __webpack_require__(656); +Rectangle.Overlaps = __webpack_require__(655); +Rectangle.Perimeter = __webpack_require__(135); +Rectangle.PerimeterPoint = __webpack_require__(654); +Rectangle.Random = __webpack_require__(201); +Rectangle.RandomOutside = __webpack_require__(653); +Rectangle.SameDimensions = __webpack_require__(652); +Rectangle.Scale = __webpack_require__(651); +Rectangle.Union = __webpack_require__(313); module.exports = Rectangle; /***/ }), -/* 266 */ +/* 271 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the square of magnitude of given point.(Can be used for fast magnitude calculation of point) * * @function Phaser.Geom.Point.GetMagnitudeSq * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Point} point - Returns square of the magnitude/length of given point. * - * @return {number} [description] + * @return {number} Returns square of the magnitude of given point. */ var GetMagnitudeSq = function (point) { @@ -67491,24 +66900,24 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 267 */ +/* 272 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculate the magnitude of the point, which equivalent to the length of the line from the origin to this point. * * @function Phaser.Geom.Point.GetMagnitude * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Point} point - The point to calculate the magnitude for * - * @return {number} [description] + * @return {number} The resulting magnitude */ var GetMagnitude = function (point) { @@ -67519,18 +66928,18 @@ module.exports = GetMagnitude; /***/ }), -/* 268 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Wrap = __webpack_require__(53); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Wrap = __webpack_require__(57); +var Angle = __webpack_require__(73); /** * Get the angle of the normal of the given line in radians. @@ -67553,25 +66962,25 @@ module.exports = NormalAngle; /***/ }), -/* 269 */ +/* 274 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Decomposes a Triangle into an array of its points. * * @function Phaser.Geom.Triangle.Decompose * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {array} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to decompose. + * @param {array} [out] - An array to store the points into. * - * @return {array} [description] + * @return {array} The provided `out` array, or a new array if none was provided, with three objects with `x` and `y` properties representing each point of the Triangle appended to it. */ var Decompose = function (triangle, out) { @@ -67588,12 +66997,12 @@ module.exports = Decompose; /***/ }), -/* 270 */ +/* 275 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67625,63 +67034,103 @@ module.exports = Decompose; /***/ }), -/* 271 */ +/* 276 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if the a Point falls between the two end-points of a Line, based on the given line thickness. + * + * Assumes that the line end points are circular, not square. * * @function Phaser.Geom.Intersects.PointToLine * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Line} line - [description] + * @param {(Phaser.Geom.Point|any)} point - The point, or point-like object to check. + * @param {Phaser.Geom.Line} line - The line segment to test for intersection on. + * @param {number} [lineThickness=1] - The line thickness. Assumes that the line end points are circular. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point falls on the Line, otherwise `false`. */ -var PointToLine = function (point, line) +var PointToLine = function (point, line, lineThickness) { - return ((point.x - line.x1) * (line.y2 - line.y1) === (line.x2 - line.x1) * (point.y - line.y1)); + if (lineThickness === undefined) { lineThickness = 1; } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var px = point.x; + var py = point.y; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return false; + } + + var r = (((px - x1) * (x2 - x1)) + ((py - y1) * (y2 - y1))) / L2; + + // Assume line thickness is circular + if (r < 0) + { + // Outside line1 + return (Math.sqrt(((x1 - px) * (x1 - px)) + ((y1 - py) * (y1 - py))) <= lineThickness); + } + else if ((r >= 0) && (r <= 1)) + { + // On the line segment + var s = (((y1 - py) * (x2 - x1)) - ((x1 - px) * (y2 - y1))) / L2; + + return (Math.abs(s) * Math.sqrt(L2) <= lineThickness); + } + else + { + // Outside line2 + return (Math.sqrt(((x2 - px) * (x2 - px)) + ((y2 - py) * (y2 - py))) <= lineThickness); + } }; module.exports = PointToLine; /***/ }), -/* 272 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on code by Matt DesLauriers -// https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md - -var Contains = __webpack_require__(40); +var Contains = __webpack_require__(43); var Point = __webpack_require__(6); var tmp = new Point(); /** - * [description] + * Checks for intersection between the line segment and circle. + * + * Based on code by [Matt DesLauriers](https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md). * * @function Phaser.Geom.Intersects.LineToCircle * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] - * @param {Phaser.Geom.Circle} circle - [description] - * @param {Phaser.Geom.Point} [nearest] - [description] + * @param {Phaser.Geom.Line} line - The line segment to check. + * @param {Phaser.Geom.Circle} circle - The circle to check against the line. + * @param {(Phaser.Geom.Point|any)} [nearest] - An optional Point-like object. If given the closest point on the Line where the circle intersects will be stored in this object. * - * @return {boolean} [description] + * @return {boolean} `true` if the two objects intersect, otherwise `false`. */ var LineToCircle = function (line, circle, nearest) { @@ -67739,12 +67188,12 @@ module.exports = LineToCircle; /***/ }), -/* 273 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67754,31 +67203,31 @@ module.exports = LineToCircle; module.exports = { - CircleToCircle: __webpack_require__(703), - CircleToRectangle: __webpack_require__(702), - GetRectangleIntersection: __webpack_require__(701), - LineToCircle: __webpack_require__(272), - LineToLine: __webpack_require__(107), - LineToRectangle: __webpack_require__(700), - PointToLine: __webpack_require__(271), - PointToLineSegment: __webpack_require__(699), - RectangleToRectangle: __webpack_require__(148), - RectangleToTriangle: __webpack_require__(698), - RectangleToValues: __webpack_require__(697), - TriangleToCircle: __webpack_require__(696), - TriangleToLine: __webpack_require__(695), - TriangleToTriangle: __webpack_require__(694) + CircleToCircle: __webpack_require__(725), + CircleToRectangle: __webpack_require__(724), + GetRectangleIntersection: __webpack_require__(723), + LineToCircle: __webpack_require__(277), + LineToLine: __webpack_require__(115), + LineToRectangle: __webpack_require__(722), + PointToLine: __webpack_require__(276), + PointToLineSegment: __webpack_require__(721), + RectangleToRectangle: __webpack_require__(158), + RectangleToTriangle: __webpack_require__(720), + RectangleToValues: __webpack_require__(719), + TriangleToCircle: __webpack_require__(718), + TriangleToLine: __webpack_require__(717), + TriangleToTriangle: __webpack_require__(716) }; /***/ }), -/* 274 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -67788,31 +67237,31 @@ module.exports = { module.exports = { - Circle: __webpack_require__(723), - Ellipse: __webpack_require__(713), - Intersects: __webpack_require__(273), - Line: __webpack_require__(693), - Point: __webpack_require__(675), - Polygon: __webpack_require__(661), - Rectangle: __webpack_require__(265), - Triangle: __webpack_require__(631) + Circle: __webpack_require__(745), + Ellipse: __webpack_require__(735), + Intersects: __webpack_require__(278), + Line: __webpack_require__(715), + Point: __webpack_require__(694), + Polygon: __webpack_require__(680), + Rectangle: __webpack_require__(270), + Triangle: __webpack_require__(650) }; /***/ }), -/* 275 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Light = __webpack_require__(276); -var Utils = __webpack_require__(10); +var Light = __webpack_require__(281); +var Utils = __webpack_require__(9); /** * @callback LightForEach @@ -68164,17 +67613,17 @@ module.exports = LightsManager; /***/ }), -/* 276 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(10); +var Utils = __webpack_require__(9); /** * @classdesc @@ -68427,16 +67876,16 @@ module.exports = Light; /***/ }), -/* 277 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); var Point = __webpack_require__(6); /** @@ -68520,32 +67969,31 @@ module.exports = GetPoints; /***/ }), -/* 278 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); -// Position is a value between 0 and 1 /** - * [description] + * Returns a Point from around the perimeter of a Triangle. * * @function Phaser.Geom.Triangle.GetPoint * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} position - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the point on its perimeter from. + * @param {number} position - The position along the perimeter of the triangle. A value between 0 and 1. + * @param {(Phaser.Geom.Point|object)} [out] - An option Point, or Point-like object to store the value in. If not given a new Point will be created. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} A Point object containing the given position from the perimeter of the triangle. */ var GetPoint = function (triangle, position, out) { @@ -68608,19 +68056,19 @@ module.exports = GetPoint; /***/ }), -/* 279 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); -var GeomTriangle = __webpack_require__(59); -var TriangleRender = __webpack_require__(772); +var Shape = __webpack_require__(29); +var GeomTriangle = __webpack_require__(65); +var TriangleRender = __webpack_require__(795); /** * @classdesc @@ -68751,19 +68199,19 @@ module.exports = Triangle; /***/ }), -/* 280 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StarRender = __webpack_require__(775); +var StarRender = __webpack_require__(798); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); -var Shape = __webpack_require__(27); +var Earcut = __webpack_require__(71); +var Shape = __webpack_require__(29); /** * @classdesc @@ -69039,19 +68487,19 @@ module.exports = Star; /***/ }), -/* 281 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var GeomRectangle = __webpack_require__(9); -var Shape = __webpack_require__(27); -var RectangleRender = __webpack_require__(778); +var GeomRectangle = __webpack_require__(10); +var Shape = __webpack_require__(29); +var RectangleRender = __webpack_require__(801); /** * @classdesc @@ -69151,13 +68599,13 @@ module.exports = Rectangle; /***/ }), -/* 282 */ +/* 287 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Igor Ognichenko - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -69224,17 +68672,17 @@ module.exports = Smooth; /***/ }), -/* 283 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); -var Line = __webpack_require__(54); +var Length = __webpack_require__(58); +var Line = __webpack_require__(59); /** * Returns the perimeter of the given Polygon. @@ -69272,18 +68720,18 @@ module.exports = Perimeter; /***/ }), -/* 284 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); -var Line = __webpack_require__(54); -var Perimeter = __webpack_require__(283); +var Length = __webpack_require__(58); +var Line = __webpack_require__(59); +var Perimeter = __webpack_require__(288); /** * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, @@ -69349,29 +68797,29 @@ module.exports = GetPoints; /***/ }), -/* 285 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** - * [description] + * Calculates the bounding AABB rectangle of a polygon. * * @function Phaser.Geom.Polygon.GetAABB * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [out,$return] * - * @param {Phaser.Geom.Polygon} polygon - [description] - * @param {(Phaser.Geom.Rectangle|object)} [out] - [description] + * @param {Phaser.Geom.Polygon} polygon - The polygon that should be calculated. + * @param {(Phaser.Geom.Rectangle|object)} [out] - The rectangle or object that has x, y, width, and height properties to store the result. Optional. * - * @return {(Phaser.Geom.Rectangle|object)} [description] + * @return {(Phaser.Geom.Rectangle|object)} The resulting rectangle or object that is passed in with position and dimensions of the polygon's AABB. */ var GetAABB = function (polygon, out) { @@ -69405,22 +68853,22 @@ module.exports = GetAABB; /***/ }), -/* 286 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PolygonRender = __webpack_require__(781); +var PolygonRender = __webpack_require__(804); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); -var GetAABB = __webpack_require__(285); -var GeomPolygon = __webpack_require__(151); -var Shape = __webpack_require__(27); -var Smooth = __webpack_require__(282); +var Earcut = __webpack_require__(71); +var GetAABB = __webpack_require__(290); +var GeomPolygon = __webpack_require__(161); +var Shape = __webpack_require__(29); +var Smooth = __webpack_require__(287); /** * @classdesc @@ -69544,19 +68992,19 @@ module.exports = Polygon; /***/ }), -/* 287 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); -var GeomLine = __webpack_require__(54); -var LineRender = __webpack_require__(784); +var Shape = __webpack_require__(29); +var GeomLine = __webpack_require__(59); +var LineRender = __webpack_require__(807); /** * @classdesc @@ -69708,18 +69156,18 @@ module.exports = Line; /***/ }), -/* 288 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var IsoTriangleRender = __webpack_require__(787); -var Shape = __webpack_require__(27); +var IsoTriangleRender = __webpack_require__(810); +var Shape = __webpack_require__(29); /** * @classdesc @@ -69954,18 +69402,18 @@ module.exports = IsoTriangle; /***/ }), -/* 289 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsoBoxRender = __webpack_require__(790); +var IsoBoxRender = __webpack_require__(813); var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); +var Shape = __webpack_require__(29); /** * @classdesc @@ -70169,18 +69617,18 @@ module.exports = IsoBox; /***/ }), -/* 290 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(27); -var GridRender = __webpack_require__(793); +var Shape = __webpack_require__(29); +var GridRender = __webpack_require__(816); /** * @classdesc @@ -70451,20 +69899,20 @@ module.exports = Grid; /***/ }), -/* 291 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(64); -var EllipseRender = __webpack_require__(796); -var GeomEllipse = __webpack_require__(90); -var Shape = __webpack_require__(27); +var Earcut = __webpack_require__(71); +var EllipseRender = __webpack_require__(819); +var GeomEllipse = __webpack_require__(96); +var Shape = __webpack_require__(29); /** * @classdesc @@ -70638,20 +70086,20 @@ module.exports = Ellipse; /***/ }), -/* 292 */ +/* 297 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var CurveRender = __webpack_require__(799); -var Earcut = __webpack_require__(64); -var Rectangle = __webpack_require__(9); -var Shape = __webpack_require__(27); +var CurveRender = __webpack_require__(822); +var Earcut = __webpack_require__(71); +var Rectangle = __webpack_require__(10); +var Shape = __webpack_require__(29); /** * @classdesc @@ -70820,22 +70268,22 @@ module.exports = Curve; /***/ }), -/* 293 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcRender = __webpack_require__(802); +var ArcRender = __webpack_require__(825); var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var Earcut = __webpack_require__(64); -var GeomCircle = __webpack_require__(71); -var MATH_CONST = __webpack_require__(16); -var Shape = __webpack_require__(27); +var DegToRad = __webpack_require__(34); +var Earcut = __webpack_require__(71); +var GeomCircle = __webpack_require__(77); +var MATH_CONST = __webpack_require__(20); +var Shape = __webpack_require__(29); /** * @classdesc @@ -71224,42 +70672,12 @@ module.exports = Arc; /***/ }), -/* 294 */ +/* 299 */ /***/ (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 nearest power of 2 to the given `value`. - * - * @function Phaser.Math.Pow2.GetPowerOfTwo - * @since 3.0.0 - * - * @param {number} value - The value. - * - * @return {integer} The nearest power of 2 to `value`. - */ -var GetPowerOfTwo = function (value) -{ - var index = Math.log(value) / 0.6931471805599453; - - return (1 << Math.ceil(index)); -}; - -module.exports = GetPowerOfTwo; - - -/***/ }), -/* 295 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71289,21 +70707,21 @@ module.exports = UUID; /***/ }), -/* 296 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var GetBoolean = __webpack_require__(84); +var DegToRad = __webpack_require__(34); +var GetBoolean = __webpack_require__(90); var GetValue = __webpack_require__(4); -var Sprite = __webpack_require__(61); -var TWEEN_CONST = __webpack_require__(83); +var Sprite = __webpack_require__(67); +var TWEEN_CONST = __webpack_require__(89); var Vector2 = __webpack_require__(3); /** @@ -71317,7 +70735,7 @@ var Vector2 = __webpack_require__(3); * @property {boolean} [positionOnPath=false] - Whether to position the PathFollower on the Path using its path offset. * @property {boolean} [rotateToPath=false] - Should the PathFollower automatically rotate to point in the direction of the Path? * @property {number} [rotationOffset=0] - If the PathFollower is rotating to match the Path, this value is added to the rotation value. This allows you to rotate objects to a path but control the angle of the rotation as well. - * @property {boolean} [verticalAdjust=false] - [description] + * @property {number} [startAt=0] - Current start position of the path follow, between 0 and 1. */ /** @@ -71375,16 +70793,6 @@ var PathFollower = new Class({ */ this.rotateToPath = false; - /** - * [description] - * - * @name Phaser.GameObjects.PathFollower#pathRotationVerticalAdjust - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.pathRotationVerticalAdjust = false; - /** * If the PathFollower is rotating to match the Path (@see Phaser.GameObjects.PathFollower#rotateToPath) * this value is added to the rotation value. This allows you to rotate objects to a path but control @@ -71408,7 +70816,7 @@ var PathFollower = new Class({ this.pathOffset = new Vector2(x, y); /** - * [description] + * A Vector2 that stores the current point of the path the follower is on. * * @name Phaser.GameObjects.PathFollower#pathVector * @type {Phaser.Math.Vector2} @@ -71488,19 +70896,16 @@ var PathFollower = new Class({ * * @param {boolean} value - Whether the PathFollower should automatically rotate to point in the direction of the Path. * @param {number} [offset=0] - Rotation offset in degrees. - * @param {boolean} [verticalAdjust=false] - [description] * * @return {Phaser.GameObjects.PathFollower} This Game Object. */ - setRotateToPath: function (value, offset, verticalAdjust) + setRotateToPath: function (value, offset) { if (offset === undefined) { offset = 0; } - if (verticalAdjust === undefined) { verticalAdjust = false; } this.rotateToPath = value; this.pathRotationOffset = offset; - this.pathRotationVerticalAdjust = verticalAdjust; return this; }, @@ -71560,7 +70965,22 @@ var PathFollower = new Class({ this.rotateToPath = GetBoolean(config, 'rotateToPath', false); this.pathRotationOffset = GetValue(config, 'rotationOffset', 0); - this.pathRotationVerticalAdjust = GetBoolean(config, 'verticalAdjust', false); + + // This works, but it's not an ideal way of doing it as the follower jumps position + var seek = GetValue(config, 'startAt', startAt); + + if (seek) + { + config.onStart = function (tween) + { + var tweenData = tween.data[0]; + tweenData.progress = seek; + tweenData.elapsed = tweenData.duration * seek; + var v = tweenData.ease(tweenData.progress); + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + tweenData.target[tweenData.key] = tweenData.current; + }; + } this.pathTween = this.scene.sys.tweens.addCounter(config); @@ -71715,11 +71135,6 @@ var PathFollower = new Class({ if (this.rotateToPath) { this.rotation = Math.atan2(speedY, speedX) + DegToRad(this.pathRotationOffset); - - if (this.pathRotationVerticalAdjust) - { - this.flipY = (this.rotation !== 0 && tweenData.state === TWEEN_CONST.PLAYING_BACKWARD); - } } } } @@ -71730,12 +71145,12 @@ module.exports = PathFollower; /***/ }), -/* 297 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71822,12 +71237,12 @@ module.exports = RandomZone; /***/ }), -/* 298 */ +/* 302 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -71859,41 +71274,12 @@ module.exports = HasAny; /***/ }), -/* 299 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. - * - * @function Phaser.Math.FloatBetween - * @since 3.0.0 - * - * @param {number} min - The lower bound for the float, inclusive. - * @param {number} max - The upper bound for the float exclusive. - * - * @return {number} A random float within the given range. - */ -var FloatBetween = function (min, max) -{ - return Math.random() * (max - min) + min; -}; - -module.exports = FloatBetween; - - -/***/ }), -/* 300 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -72156,12 +71542,12 @@ module.exports = EdgeZone; /***/ }), -/* 301 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -72255,31 +71641,31 @@ module.exports = DeathZone; /***/ }), -/* 302 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); +var BlendModes = __webpack_require__(60); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var DeathZone = __webpack_require__(301); -var EdgeZone = __webpack_require__(300); -var EmitterOp = __webpack_require__(822); +var Components = __webpack_require__(13); +var DeathZone = __webpack_require__(304); +var EdgeZone = __webpack_require__(303); +var EmitterOp = __webpack_require__(845); var GetFastValue = __webpack_require__(2); -var GetRandom = __webpack_require__(162); -var HasAny = __webpack_require__(298); -var HasValue = __webpack_require__(85); -var Particle = __webpack_require__(303); -var RandomZone = __webpack_require__(297); -var Rectangle = __webpack_require__(9); -var StableSort = __webpack_require__(110); +var GetRandom = __webpack_require__(172); +var HasAny = __webpack_require__(302); +var HasValue = __webpack_require__(91); +var Particle = __webpack_require__(306); +var RandomZone = __webpack_require__(301); +var Rectangle = __webpack_require__(10); +var StableSort = __webpack_require__(118); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * @callback ParticleEmitterCallback @@ -72345,7 +71731,7 @@ var Wrap = __webpack_require__(53); * @typedef {object} ParticleEmitterConfig * * @property {boolean} [active] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#active}. - * @property {integer} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. + * @property {(Phaser.BlendModes|string)} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. * @property {*} [callbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope} and {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. * @property {boolean} [collideBottom] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideBottom}. * @property {boolean} [collideLeft] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideLeft}. @@ -72395,7 +71781,7 @@ var Wrap = __webpack_require__(53); * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. * @property {number} [followOffset.x] - x-coordinate of the offset. * @property {number} [followOffset.y] - y-coordinate of the offset. - * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frames] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frame] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. */ /** @@ -74272,13 +73658,9 @@ var ParticleEmitter = new Class({ for (var i = 0; i < count; i++) { - var particle; + var particle = dead.pop(); - if (dead.length > 0) - { - particle = dead.pop(); - } - else + if (!particle) { particle = new this.particleClass(this); } @@ -74333,47 +73715,49 @@ var ParticleEmitter = new Class({ var processors = this.manager.getProcessors(); var particles = this.alive; + var dead = this.dead; + + var i = 0; + var rip = []; var length = particles.length; - for (var index = 0; index < length; index++) + for (i = 0; i < length; i++) { - var particle = particles[index]; + var particle = particles[i]; - // update returns `true` if the particle is now dead (lifeStep < 0) + // update returns `true` if the particle is now dead (lifeCurrent <= 0) if (particle.update(delta, step, processors)) { - // Moves the dead particle to the end of the particles array (ready for splicing out later) - var last = particles[length - 1]; - - particles[length - 1] = particle; - particles[index] = last; - - index -= 1; - length -= 1; + rip.push({ index: i, particle: particle }); } } // Move dead particles to the dead array - var deadLength = particles.length - length; + length = rip.length; - if (deadLength > 0) + if (length > 0) { - var rip = particles.splice(particles.length - deadLength, deadLength); - var deathCallback = this.deathCallback; var deathCallbackScope = this.deathCallbackScope; - if (deathCallback) + for (i = length - 1; i >= 0; i--) { - for (var i = 0; i < rip.length; i++) + var entry = rip[i]; + + // Remove from particles array + particles.splice(entry.index, 1); + + // Add to dead array + dead.push(entry.particle); + + // Callback + if (deathCallback) { - deathCallback.call(deathCallbackScope, rip[i]); + deathCallback.call(deathCallbackScope, entry.particle); } + + entry.particle.resetPosition(); } - - this.dead.concat(rip); - - StableSort.inplace(particles, this.indexSortCallback); } if (!this.on) @@ -74413,22 +73797,6 @@ var ParticleEmitter = new Class({ depthSortCallback: function (a, b) { return a.y - b.y; - }, - - /** - * Calculates the difference of two particles, for sorting them by index. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#indexSortCallback - * @since 3.0.0 - * - * @param {object} a - The first particle. - * @param {object} b - The second particle. - * - * @return {integer} The difference of a and b's `index` properties. - */ - indexSortCallback: function (a, b) - { - return a.index - b.index; } }); @@ -74437,18 +73805,18 @@ module.exports = ParticleEmitter; /***/ }), -/* 303 */ +/* 306 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var DistanceBetween = __webpack_require__(52); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(56); /** * @classdesc @@ -74489,16 +73857,6 @@ var Particle = new Class({ */ this.frame = null; - /** - * The position of this Particle within its Emitter's particle pool. - * - * @name Phaser.GameObjects.Particles.Particle#index - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.index = 0; - /** * The x coordinate of this Particle. * @@ -74718,6 +74076,18 @@ var Particle = new Class({ return (this.lifeCurrent > 0); }, + /** + * Resets the position of this particle back to zero. + * + * @method Phaser.GameObjects.Particles.Particle#resetPosition + * @since 3.16.0 + */ + resetPosition: function () + { + this.x = 0; + this.y = 0; + }, + /** * Starts this Particle from the given coordinates. * @@ -74824,8 +74194,6 @@ var Particle = new Class({ this.alpha = emitter.alpha.onEmit(this, 'alpha'); this.tint = emitter.tint.onEmit(this, 'tint'); - - this.index = emitter.alive.length; }, /** @@ -75006,12 +74374,12 @@ module.exports = Particle; /***/ }), -/* 304 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75023,14 +74391,18 @@ var GetFastValue = __webpack_require__(2); * * @property {number} [x=0] - The x coordinate of the Gravity Well, in world space. * @property {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @property {number} [power=0] - The power of the Gravity Well. - * @property {number} [epsilon=100] - [description] + * @property {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @property {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. * @property {number} [gravity=50] - The gravitational force of this Gravity Well. */ /** * @classdesc - * [description] + * The GravityWell action applies a force on the particle to draw it towards, or repel it from, a single point. + * + * The force applied is inversely proportional to the square of the distance from the particle to the point, in accordance with Newton's law of gravity. + * + * This simulates the effect of gravity over large distances (as between planets, for example). * * @class GravityWell * @memberof Phaser.GameObjects.Particles @@ -75039,8 +74411,8 @@ var GetFastValue = __webpack_require__(2); * * @param {(number|GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. * @param {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @param {number} [power=0] - The power of the Gravity Well. - * @param {number} [epsilon=100] - [description] + * @param {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @param {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. * @param {number} [gravity=50] - The gravitational force of this Gravity Well. */ var GravityWell = new Class({ @@ -75129,7 +74501,7 @@ var GravityWell = new Class({ this._epsilon = 0; /** - * The power of the Gravity Well. + * The strength of the gravity force - larger numbers produce a stronger force. * * @name Phaser.GameObjects.Particles.GravityWell#power * @type {number} @@ -75138,7 +74510,7 @@ var GravityWell = new Class({ this.power = power; /** - * [description] + * The minimum distance for which the gravity force is calculated. * * @name Phaser.GameObjects.Particles.GravityWell#epsilon * @type {number} @@ -75231,17 +74603,17 @@ module.exports = GravityWell; /***/ }), -/* 305 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Commands = __webpack_require__(157); -var SetTransform = __webpack_require__(22); +var Commands = __webpack_require__(167); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -75281,8 +74653,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c var green = 0; var blue = 0; - ctx.save(); - // Reset any currently active paths ctx.beginPath(); @@ -75475,6 +74845,7 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c } } + // Restore the context saved in SetTransform ctx.restore(); }; @@ -75482,12 +74853,12 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 306 */ +/* 309 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75514,19 +74885,19 @@ module.exports = Circumference; /***/ }), -/* 307 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(306); -var CircumferencePoint = __webpack_require__(156); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var Circumference = __webpack_require__(309); +var CircumferencePoint = __webpack_require__(166); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); /** * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, @@ -75568,18 +74939,18 @@ module.exports = GetPoints; /***/ }), -/* 308 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CircumferencePoint = __webpack_require__(156); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var CircumferencePoint = __webpack_require__(166); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); var Point = __webpack_require__(6); /** @@ -75611,16 +74982,114 @@ module.exports = GetPoint; /***/ }), -/* 309 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Class = __webpack_require__(0); +var Components = __webpack_require__(13); +var GameObject = __webpack_require__(18); +var ExternRender = __webpack_require__(857); + +/** + * @classdesc + * An Extern Game Object is a special type of Game Object that allows you to pass + * rendering off to a 3rd party. + * + * When you create an Extern and place it in the display list of a Scene, the renderer will + * process the list as usual. When it finds an Extern it will flush the current batch, + * clear down the pipeline and prepare a transform matrix which your render function can + * take advantage of, if required. + * + * The WebGL context is then left is a 'clean' state, ready for you to bind your own shaders, + * or draw to it, whatever you wish to do. Once you've finished, you should free-up any + * of your resources. The Extern will then rebind the Phaser pipeline and carry on + * rendering the display list. + * + * Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of + * them are used during rendering unless you take advantage of them in your own render code. + * + * @class Extern + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.16.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.Origin + * @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. + */ +var Extern = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.Origin, + Components.ScaleMode, + Components.ScrollFactor, + Components.Size, + Components.Texture, + Components.Tint, + Components.Transform, + Components.Visible, + ExternRender + ], + + initialize: + + function Extern (scene) + { + GameObject.call(this, scene, 'Extern'); + }, + + preUpdate: function () + { + // override this! + // Arguments: time, delta + }, + + render: function () + { + // override this! + // Arguments: renderer, camera, calcMatrix + } + +}); + +module.exports = Extern; + + +/***/ }), +/* 313 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Rectangle = __webpack_require__(10); /** * Creates a new Rectangle or repositions and/or resizes an existing Rectangle so that it encompasses the two given Rectangles, i.e. calculates their union. @@ -75653,12 +75122,12 @@ module.exports = Union; /***/ }), -/* 310 */ +/* 314 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75794,12 +75263,12 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 311 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -75883,17 +75352,17 @@ module.exports = BuildGameObjectAnimation; /***/ }), -/* 312 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetValue = __webpack_require__(4); -var Shuffle = __webpack_require__(122); +var Shuffle = __webpack_require__(132); var BuildChunk = function (a, b, qty) { @@ -75913,47 +75382,45 @@ var BuildChunk = function (a, b, qty) return out; }; -// options = repeat, random, randomB, yoyo, max, qty - -// Range ([a,b,c], [1,2,3]) = -// a1, a2, a3, b1, b2, b3, c1, c2, c3 - -// Range ([a,b], [1,2,3], qty = 3) = -// a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 - -// Range ([a,b,c], [1,2,3], repeat x1) = -// a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 - -// Range ([a,b], [1,2], repeat -1 = endless, max = 14) = -// Maybe if max is set then repeat goes to -1 automatically? -// a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) - -// Range ([a], [1,2,3,4,5], random = true) = -// a4, a1, a5, a2, a3 - -// Range ([a, b], [1,2,3], random = true) = -// b3, a2, a1, b1, a3, b2 - -// Range ([a, b, c], [1,2,3], randomB = true) = -// a3, a1, a2, b2, b3, b1, c1, c3, c2 - -// Range ([a], [1,2,3,4,5], yoyo = true) = -// a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 - -// Range ([a, b], [1,2,3], yoyo = true) = -// a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 - /** - * [description] + * Creates an array populated with a range of values, based on the given arguments and configuration object. + * + * Range ([a,b,c], [1,2,3]) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2,3], qty = 3) = + * a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 + * + * Range ([a,b,c], [1,2,3], repeat x1) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2], repeat -1 = endless, max = 14) = + * Maybe if max is set then repeat goes to -1 automatically? + * a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) + * + * Range ([a], [1,2,3,4,5], random = true) = + * a4, a1, a5, a2, a3 + * + * Range ([a, b], [1,2,3], random = true) = + * b3, a2, a1, b1, a3, b2 + * + * Range ([a, b, c], [1,2,3], randomB = true) = + * a3, a1, a2, b2, b3, b1, c1, c3, c2 + * + * Range ([a], [1,2,3,4,5], yoyo = true) = + * a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 + * + * Range ([a, b], [1,2,3], yoyo = true) = + * a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 * * @function Phaser.Utils.Array.Range * @since 3.0.0 * - * @param {array} a - [description] - * @param {array} b - [description] - * @param {object} options - [description] + * @param {array} a - The first array of range elements. + * @param {array} b - The second array of range elements. + * @param {object} [options] - A range configuration object. Can contain: repeat, random, randomB, yoyo, max, qty. * - * @return {array} [description] + * @return {array} An array of arranged elements. */ var Range = function (a, b, options) { @@ -76023,41 +75490,51 @@ module.exports = Range; /***/ }), -/* 313 */ +/* 317 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// This is from the quickselect npm package: https://www.npmjs.com/package/quickselect -// Coded by https://www.npmjs.com/~mourner (Vladimir Agafonkin) +function swap (arr, i, j) +{ + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} -// https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm - -// Floyd-Rivest selection algorithm: -// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; -// The k-th element will have the (k - left + 1)th smallest value in [left, right] +function defaultCompare (a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} /** - * [description] + * A [Floyd-Rivest](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm) quick selection algorithm. + * + * Rearranges the array items so that all items in the [left, k] range are smaller than all items in [k, right]; + * The k-th element will have the (k - left + 1)th smallest value in [left, right]. + * + * The array is modified in-place. + * + * Based on code by [Vladimir Agafonkin](https://www.npmjs.com/~mourner) * * @function Phaser.Utils.Array.QuickSelect * @since 3.0.0 * - * @param {array} arr - [description] - * @param {number} k - [description] - * @param {number} left - [description] - * @param {number} right - [description] - * @param {function} compare - [description] + * @param {array} arr - The array to sort. + * @param {integer} k - The k-th element index. + * @param {integer} [left=0] - The index of the left part of the range. + * @param {integer} [right] - The index of the right part of the range. + * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. */ var QuickSelect = function (arr, k, left, right, compare) { - left = left || 0; - right = right || (arr.length - 1); - compare = compare || defaultCompare; + if (left === undefined) { left = 0; } + if (right === undefined) { right = arr.length - 1; } + if (compare === undefined) { compare = defaultCompare; } while (right > left) { @@ -76125,65 +75602,23 @@ var QuickSelect = function (arr, k, left, right, compare) } }; -function swap (arr, i, j) -{ - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultCompare (a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} - module.exports = QuickSelect; /***/ }), -/* 314 */ +/* 318 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * Transposes the elements of the given matrix (array of arrays). * - * @function Phaser.Math.RoundAwayFromZero - * @since 3.0.0 - * - * @param {number} value - The number to round. - * - * @return {number} The rounded number, rounded away from zero. - */ -var RoundAwayFromZero = function (value) -{ - // "Opposite" of truncate. - return (value > 0) ? Math.ceil(value) : Math.floor(value); -}; - -module.exports = RoundAwayFromZero; - - -/***/ }), -/* 315 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// Transposes the elements of the given matrix (array of arrays). -// The transpose of a matrix is a new matrix whose rows are the columns of the original. - -/** - * [description] + * The transpose of a matrix is a new matrix whose rows are the columns of the original. * * @function Phaser.Utils.Array.Matrix.TransposeMatrix * @since 3.0.0 @@ -76216,12 +75651,12 @@ module.exports = TransposeMatrix; /***/ }), -/* 316 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -76231,32 +75666,32 @@ module.exports = TransposeMatrix; module.exports = { - AtlasXML: __webpack_require__(886), - Canvas: __webpack_require__(885), - Image: __webpack_require__(884), - JSONArray: __webpack_require__(883), - JSONHash: __webpack_require__(882), - SpriteSheet: __webpack_require__(881), - SpriteSheetFromAtlas: __webpack_require__(880), - UnityYAML: __webpack_require__(879) + AtlasXML: __webpack_require__(910), + Canvas: __webpack_require__(909), + Image: __webpack_require__(908), + JSONArray: __webpack_require__(907), + JSONHash: __webpack_require__(906), + SpriteSheet: __webpack_require__(905), + SpriteSheetFromAtlas: __webpack_require__(904), + UnityYAML: __webpack_require__(903) }; /***/ }), -/* 317 */ +/* 320 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(24); var Class = __webpack_require__(0); -var IsSizePowerOfTwo = __webpack_require__(117); -var ScaleModes = __webpack_require__(94); +var IsSizePowerOfTwo = __webpack_require__(127); +var ScaleModes = __webpack_require__(101); /** * @classdesc @@ -76531,25 +75966,27 @@ module.exports = TextureSource; /***/ }), -/* 318 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasPool = __webpack_require__(24); -var CanvasTexture = __webpack_require__(887); +var CanvasTexture = __webpack_require__(911); var Class = __webpack_require__(0); -var Color = __webpack_require__(37); -var CONST = __webpack_require__(26); +var Color = __webpack_require__(32); +var CONST = __webpack_require__(28); var EventEmitter = __webpack_require__(11); -var GenerateTexture = __webpack_require__(357); +var Events = __webpack_require__(126); +var GameEvents = __webpack_require__(26); +var GenerateTexture = __webpack_require__(361); var GetValue = __webpack_require__(4); -var Parser = __webpack_require__(316); -var Texture = __webpack_require__(165); +var Parser = __webpack_require__(319); +var Texture = __webpack_require__(175); /** * @callback EachTextureCallback @@ -76645,7 +76082,7 @@ var TextureManager = new Class({ */ this._pending = 0; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -76659,13 +76096,13 @@ var TextureManager = new Class({ { this._pending = 2; - this.on('onload', this.updatePending, this); - this.on('onerror', this.updatePending, this); + this.on(Events.LOAD, this.updatePending, this); + this.on(Events.ERROR, this.updatePending, this); this.addBase64('__DEFAULT', this.game.config.defaultImage); this.addBase64('__MISSING', this.game.config.missingImage); - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -76681,10 +76118,10 @@ var TextureManager = new Class({ if (this._pending === 0) { - this.off('onload'); - this.off('onerror'); + this.off(Events.LOAD); + this.off(Events.ERROR); - this.game.events.emit('texturesready'); + this.emit(Events.READY); } }, @@ -76722,6 +76159,7 @@ var TextureManager = new Class({ * step when clearing down to avoid this. * * @method Phaser.Textures.TextureManager#remove + * @fires Phaser.Textures.Events#REMOVE * @since 3.7.0 * * @param {(string|Phaser.Textures.Texture)} key - The key of the Texture to remove, or a reference to it. @@ -76750,7 +76188,7 @@ var TextureManager = new Class({ key.destroy(); - this.emit('removetexture', key.key); + this.emit(Events.REMOVE, key.key); } return this; @@ -76760,6 +76198,9 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * * @method Phaser.Textures.TextureManager#addBase64 + * @fires Phaser.Textures.Events#ADD + * @fires Phaser.Textures.Events#ERROR + * @fires Phaser.Textures.Events#LOAD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -76777,7 +76218,7 @@ var TextureManager = new Class({ image.onerror = function () { - _this.emit('onerror', key); + _this.emit(Events.ERROR, key); }; image.onload = function () @@ -76786,9 +76227,9 @@ var TextureManager = new Class({ Parser.Image(texture, 0); - _this.emit('addtexture', key, texture); + _this.emit(Events.ADD, key, texture); - _this.emit('onload', key, texture); + _this.emit(Events.LOAD, key, texture); }; image.src = data; @@ -76852,11 +76293,12 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Image element. * * @method Phaser.Textures.TextureManager#addImage + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -76875,7 +76317,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -76886,6 +76328,7 @@ var TextureManager = new Class({ * This allows you to then use the Render Texture as a normal texture for texture based Game Objects like Sprites. * * @method Phaser.Textures.TextureManager#addRenderTexture + * @fires Phaser.Textures.Events#ADD * @since 3.12.0 * * @param {string} key - The unique string-based key of the Texture. @@ -76903,7 +76346,7 @@ var TextureManager = new Class({ texture.add('__BASE', 0, 0, 0, renderTexture.width, renderTexture.height); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -76950,7 +76393,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {integer} [width=256]- The width of the Canvas element. + * @param {integer} [width=256] - The width of the Canvas element. * @param {integer} [height=256] - The height of the Canvas element. * * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. @@ -76975,6 +76418,7 @@ var TextureManager = new Class({ * and adds it to this Texture Manager, unless `skipCache` is true. * * @method Phaser.Textures.TextureManager#addCanvas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -76999,7 +76443,7 @@ var TextureManager = new Class({ this.list[key] = texture; - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -77015,7 +76459,7 @@ var TextureManager = new Class({ * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -77038,12 +76482,13 @@ var TextureManager = new Class({ * This is known as a JSON Array in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONArray + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {(HTMLImageElement|HTMLImageElement[])} source - The source Image element/s. * @param {(object|object[])} data - The Texture Atlas data/s. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -77078,7 +76523,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -77090,12 +76535,13 @@ var TextureManager = new Class({ * This is known as a JSON Hash in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONHash + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -77124,7 +76570,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -77135,12 +76581,13 @@ var TextureManager = new Class({ * in the XML format. * * @method Phaser.Textures.TextureManager#addAtlasXML + * @fires Phaser.Textures.Events#ADD * @since 3.7.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas XML data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -77159,7 +76606,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -77170,12 +76617,13 @@ var TextureManager = new Class({ * The data must be in the form of a Unity YAML file. * * @method Phaser.Textures.TextureManager#addUnityAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement} [dataSource] - An optional data Image element. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -77194,7 +76642,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -77218,6 +76666,7 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheet + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -77239,7 +76688,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, 0, 0, width, height, config); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -77265,6 +76714,7 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -77304,7 +76754,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, sheet.cutX, sheet.cutY, sheet.cutWidth, sheet.cutHeight, config); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); return texture; } @@ -77451,7 +76901,7 @@ var TextureManager = new Class({ * @param {integer} x - The x coordinate of the pixel within the Texture. * @param {integer} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, * or `null` if the coordinates were out of bounds. @@ -77498,7 +76948,7 @@ var TextureManager = new Class({ * @param {integer} x - The x coordinate of the pixel within the Texture. * @param {integer} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {integer} A value between 0 and 255, or `null` if the coordinates were out of bounds. */ @@ -77542,7 +76992,7 @@ var TextureManager = new Class({ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame. + * @param {(string|integer)} [frame] - The string or index of the Frame. * * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. */ @@ -77644,18 +77094,19 @@ module.exports = TextureManager; /***/ }), -/* 319 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(114); +var BaseSound = __webpack_require__(122); var Class = __webpack_require__(0); +var Events = __webpack_require__(69); /** * @classdesc @@ -77824,11 +77275,6 @@ var WebAudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.WebAudioSound#playEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Play this sound, or a marked section of it. * @@ -77836,7 +77282,7 @@ var WebAudioSound = new Class({ * you can set 'seek' setting of the config object, provided to this call, to that value. * * @method Phaser.Sound.WebAudioSound#play - * @fires Phaser.Sound.WebAudioSound#playEvent + * @fires Phaser.Sound.Events#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. @@ -77855,21 +77301,16 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); this.createAndStartBufferSource(); - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#pauseEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.WebAudioSound#pause - * @fires Phaser.Sound.WebAudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -77890,21 +77331,16 @@ var WebAudioSound = new Class({ this.currentConfig.seek = this.getCurrentTime(); // Equivalent to setting paused time this.stopAndRemoveBufferSource(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#resumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.WebAudioSound#resume - * @fires Phaser.Sound.WebAudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -77924,21 +77360,16 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = true, isPaused = false \/\/\/ this.createAndStartBufferSource(); - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#stopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.WebAudioSound#stop - * @fires Phaser.Sound.WebAudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -77953,7 +77384,7 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndRemoveBufferSource(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -78102,22 +77533,12 @@ var WebAudioSound = new Class({ BaseSound.prototype.applyConfig.call(this); }, - /** - * @event Phaser.Sound.WebAudioSound#endedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.WebAudioSound#loopedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.WebAudioSound#update - * @fires Phaser.Sound.WebAudioSound#endedEvent - * @fires Phaser.Sound.WebAudioSound#loopedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -78135,7 +77556,7 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); } else if (this.hasLooped) { @@ -78152,7 +77573,7 @@ var WebAudioSound = new Class({ this.createAndStartLoopBufferSource(); - this.emit('looped', this); + this.emit(Events.LOOPED, this); } }, @@ -78262,12 +77683,6 @@ var WebAudioSound = new Class({ return this.playTime + lastRateUpdate.time + (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate; }, - /** - * @event Phaser.Sound.WebAudioSound#rateEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -78276,6 +77691,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -78291,7 +77707,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } }, @@ -78303,7 +77719,7 @@ var WebAudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.WebAudioSound#setRate - * @fires Phaser.Sound.WebAudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -78317,12 +77733,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#detuneEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -78330,6 +77740,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -78345,7 +77756,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } }, @@ -78355,7 +77766,7 @@ var WebAudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.WebAudioSound#setDetune - * @fires Phaser.Sound.WebAudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -78369,12 +77780,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#muteEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -78382,6 +77787,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -78396,7 +77802,7 @@ var WebAudioSound = new Class({ this.currentConfig.mute = value; this.muteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.MUTE, this, value); } }, @@ -78405,7 +77811,7 @@ var WebAudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.WebAudioSound#setMute - * @fires Phaser.Sound.WebAudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -78419,18 +77825,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#volumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.WebAudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -78445,7 +77846,7 @@ var WebAudioSound = new Class({ this.currentConfig.volume = value; this.volumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.VOLUME, this, value); } }, @@ -78453,7 +77854,7 @@ var WebAudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.WebAudioSound#setVolume - * @fires Phaser.Sound.WebAudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -78467,12 +77868,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#seekEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -78481,6 +77876,7 @@ var WebAudioSound = new Class({ * * @name Phaser.Sound.WebAudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -78525,7 +77921,7 @@ var WebAudioSound = new Class({ this.createAndStartBufferSource(); } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -78534,7 +77930,7 @@ var WebAudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.WebAudioSound#setSeek - * @fires Phaser.Sound.WebAudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -78548,18 +77944,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#loopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.WebAudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -78583,7 +77974,7 @@ var WebAudioSound = new Class({ } } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -78591,7 +77982,7 @@ var WebAudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.WebAudioSound#setLoop - * @fires Phaser.Sound.WebAudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. @@ -78611,19 +78002,20 @@ module.exports = WebAudioSound; /***/ }), -/* 320 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(115); +var BaseSoundManager = __webpack_require__(123); var Class = __webpack_require__(0); -var WebAudioSound = __webpack_require__(319); +var Events = __webpack_require__(69); +var WebAudioSound = __webpack_require__(322); /** * @classdesc @@ -78760,23 +78152,26 @@ var WebAudioSoundManager = new Class({ { var _this = this; - var unlock = function () + var unlockHandler = function unlockHandler () { - _this.context.resume().then(function () + if (_this.context) { - document.body.removeEventListener('touchstart', unlock); - document.body.removeEventListener('touchend', unlock); - document.body.removeEventListener('click', unlock); - - _this.unlocked = true; - }); + _this.context.resume().then(function () + { + document.body.removeEventListener('touchstart', unlockHandler); + document.body.removeEventListener('touchend', unlockHandler); + document.body.removeEventListener('click', unlockHandler); + + _this.unlocked = true; + }); + } }; if (document.body) { - document.body.addEventListener('touchstart', unlock, false); - document.body.addEventListener('touchend', unlock, false); - document.body.addEventListener('click', unlock, false); + document.body.addEventListener('touchstart', unlockHandler, false); + document.body.addEventListener('touchend', unlockHandler, false); + document.body.addEventListener('click', unlockHandler, false); } }, @@ -78790,7 +78185,10 @@ var WebAudioSoundManager = new Class({ */ onBlur: function () { - this.context.suspend(); + if (!this.locked) + { + this.context.suspend(); + } }, /** @@ -78803,7 +78201,10 @@ var WebAudioSoundManager = new Class({ */ onFocus: function () { - this.context.resume(); + if (!this.locked) + { + this.context.resume(); + } }, /** @@ -78840,17 +78241,11 @@ var WebAudioSoundManager = new Class({ BaseSoundManager.prototype.destroy.call(this); }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setMute - * @fires Phaser.Sound.WebAudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -78867,7 +78262,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.WebAudioSoundManager#MuteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -78881,22 +78276,16 @@ var WebAudioSoundManager = new Class({ { this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, 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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setVolume - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -78913,7 +78302,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -78927,7 +78316,7 @@ var WebAudioSoundManager = new Class({ { this.masterVolumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } @@ -78938,20 +78327,20 @@ module.exports = WebAudioSoundManager; /***/ }), -/* 321 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(114); +var BaseSound = __webpack_require__(122); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(11); -var Extend = __webpack_require__(20); +var Extend = __webpack_require__(19); /** * @classdesc @@ -79065,20 +78454,20 @@ module.exports = NoAudioSound; /***/ }), -/* 322 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(115); +var BaseSoundManager = __webpack_require__(123); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(11); -var NoAudioSound = __webpack_require__(321); +var NoAudioSound = __webpack_require__(324); var NOOP = __webpack_require__(1); /** @@ -79183,18 +78572,19 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 323 */ +/* 326 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSound = __webpack_require__(114); +var BaseSound = __webpack_require__(122); var Class = __webpack_require__(0); +var Events = __webpack_require__(69); /** * @classdesc @@ -79282,18 +78672,13 @@ var HTML5AudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.HTML5AudioSound#playEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * 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.HTML5AudioSound#play - * @fires Phaser.Sound.HTML5AudioSound#playEvent + * @fires Phaser.Sound.Events#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. @@ -79319,21 +78704,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#pauseEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.HTML5AudioSound#pause - * @fires Phaser.Sound.HTML5AudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -79360,21 +78740,16 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#resumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.HTML5AudioSound#resume - * @fires Phaser.Sound.HTML5AudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -79402,21 +78777,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#stopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.HTML5AudioSound#stop - * @fires Phaser.Sound.HTML5AudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -79436,7 +78806,7 @@ var HTML5AudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndReleaseAudioTag(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -79645,22 +79015,12 @@ var HTML5AudioSound = new Class({ this.pickAndPlayAudioTag(); }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.HTML5AudioSound#endedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.HTML5AudioSound#update - * @fires Phaser.Sound.HTML5AudioSound#loopedEvent - * @fires Phaser.Sound.HTML5AudioSound#endedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -79709,7 +79069,7 @@ var HTML5AudioSound = new Class({ if (currentTime < this.previousTime) { - this.emit('looped', this); + this.emit(Events.LOOPED, this); } } else if (currentTime >= endTime) @@ -79718,7 +79078,7 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); return; } @@ -79792,12 +79152,6 @@ var HTML5AudioSound = new Class({ } }, - /** - * @event Phaser.Sound.HTML5AudioSound#muteEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -79805,6 +79159,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -79823,7 +79178,9 @@ var HTML5AudioSound = new Class({ return; } - this.emit('mute', this, value); + this.updateMute(); + + this.emit(Events.MUTE, this, value); } }, @@ -79831,7 +79188,7 @@ var HTML5AudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setMute - * @fires Phaser.Sound.HTML5AudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -79845,18 +79202,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#volumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.HTML5AudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -79875,7 +79227,9 @@ var HTML5AudioSound = new Class({ return; } - this.emit('volume', this, value); + this.updateVolume(); + + this.emit(Events.VOLUME, this, value); } }, @@ -79883,7 +79237,7 @@ var HTML5AudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setVolume - * @fires Phaser.Sound.HTML5AudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -79897,12 +79251,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#rateEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -79911,6 +79259,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -79924,7 +79273,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.rate = value; - if (this.manager.isLocked(this, 'rate', value)) + if (this.manager.isLocked(this, Events.RATE, value)) { return; } @@ -79932,7 +79281,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } } @@ -79945,7 +79294,7 @@ var HTML5AudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.HTML5AudioSound#setRate - * @fires Phaser.Sound.HTML5AudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -79959,12 +79308,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#detuneEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -79972,6 +79315,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -79985,7 +79329,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.detune = value; - if (this.manager.isLocked(this, 'detune', value)) + if (this.manager.isLocked(this, Events.DETUNE, value)) { return; } @@ -79993,7 +79337,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } } @@ -80004,7 +79348,7 @@ var HTML5AudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.HTML5AudioSound#setDetune - * @fires Phaser.Sound.HTML5AudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -80018,12 +79362,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#seekEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -80032,6 +79370,7 @@ var HTML5AudioSound = new Class({ * * @name Phaser.Sound.HTML5AudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -80078,7 +79417,7 @@ var HTML5AudioSound = new Class({ this.currentConfig.seek = value; } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -80087,7 +79426,7 @@ var HTML5AudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.HTML5AudioSound#setSeek - * @fires Phaser.Sound.HTML5AudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -80101,18 +79440,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.HTML5AudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -80136,7 +79470,7 @@ var HTML5AudioSound = new Class({ this.audio.loop = value; } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -80145,7 +79479,7 @@ var HTML5AudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setLoop - * @fires Phaser.Sound.HTML5AudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. @@ -80165,19 +79499,20 @@ module.exports = HTML5AudioSound; /***/ }), -/* 324 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseSoundManager = __webpack_require__(115); +var BaseSoundManager = __webpack_require__(123); var Class = __webpack_require__(0); -var HTML5AudioSound = __webpack_require__(323); +var Events = __webpack_require__(69); +var HTML5AudioSound = __webpack_require__(326); /** * HTML5 Audio implementation of the Sound Manager. @@ -80408,7 +79743,7 @@ var HTML5AudioSoundManager = new Class({ }); }; - this.once('unlocked', function () + this.once(Events.UNLOCKED, function () { this.forEachActiveSound(function (sound) { @@ -80524,17 +79859,11 @@ var HTML5AudioSoundManager = new Class({ return false; }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setMute - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -80551,7 +79880,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -80570,22 +79899,16 @@ var HTML5AudioSoundManager = new Class({ sound.updateMute(); }); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, this, value); } }, - /** - * @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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setVolume - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -80602,7 +79925,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -80621,7 +79944,7 @@ var HTML5AudioSoundManager = new Class({ sound.updateVolume(); }); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } @@ -80632,19 +79955,19 @@ module.exports = HTML5AudioSoundManager; /***/ }), -/* 325 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(324); -var NoAudioSoundManager = __webpack_require__(322); -var WebAudioSoundManager = __webpack_require__(320); +var HTML5AudioSoundManager = __webpack_require__(327); +var NoAudioSoundManager = __webpack_require__(325); +var WebAudioSoundManager = __webpack_require__(323); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -80682,19 +80005,19 @@ module.exports = SoundManagerCreator; /***/ }), -/* 326 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(116); +var CONST = __webpack_require__(124); var GetValue = __webpack_require__(4); -var Merge = __webpack_require__(96); -var InjectionMap = __webpack_require__(888); +var Merge = __webpack_require__(103); +var InjectionMap = __webpack_require__(933); /** * @namespace Phaser.Scenes.Settings @@ -80703,50 +80026,50 @@ var InjectionMap = __webpack_require__(888); /** * @typedef {object} Phaser.Scenes.Settings.Config * - * @property {string} [key] - [description] - * @property {boolean} [active=false] - [description] - * @property {boolean} [visible=true] - [description] - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - [description] - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - [description] + * @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance. + * @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step. + * @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object. * @property {Object.} [map] - Overwrites the default injection map for a scene. * @property {Object.} [mapAdd] - Extends the injection map for a scene. - * @property {object} [physics={}] - [description] - * @property {object} [loader={}] - [description] - * @property {(false|*)} [plugins=false] - [description] + * @property {object} [physics={}] - The physics configuration object for the Scene. + * @property {object} [loader={}] - The loader configuration object for the Scene. + * @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene. */ /** * @typedef {object} Phaser.Scenes.Settings.Object * - * @property {number} status - [description] - * @property {string} key - [description] - * @property {boolean} active - [description] - * @property {boolean} visible - [description] - * @property {boolean} isBooted - [description] - * @property {boolean} isTransition - [description] - * @property {?Phaser.Scene} transitionFrom - [description] - * @property {integer} transitionDuration - [description] - * @property {boolean} transitionAllowInput - [description] - * @property {object} data - [description] - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - [description] - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - [description] - * @property {Object.} map - [description] - * @property {object} physics - [description] - * @property {object} loader - [description] - * @property {(false|*)} plugins - [description] + * @property {number} status - The current status of the Scene. Maps to the Scene constants. + * @property {string} key - The unique key of this Scene. Unique within the entire Game instance. + * @property {boolean} active - The active state of this Scene. An active Scene updates each step. + * @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step. + * @property {boolean} isBooted - Has the Scene finished booting? + * @property {boolean} isTransition - Is the Scene in a state of transition? + * @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set. + * @property {integer} transitionDuration - The duration of the transition, if set. + * @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions? + * @property {object} data - a data bundle passed to this Scene from the Scene Manager. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - The Camera configuration object. + * @property {Object.} map - The Scene's Injection Map. + * @property {object} physics - The physics configuration object for the Scene. + * @property {object} loader - The loader configuration object for the Scene. + * @property {(false|*)} plugins - The plugin configuration object for the Scene. */ var Settings = { /** - * Takes a Scene configuration object and returns a fully formed Systems object. + * Takes a Scene configuration object and returns a fully formed System Settings object. * * @function Phaser.Scenes.Settings.create * @since 3.0.0 * - * @param {(string|Phaser.Scenes.Settings.Config)} config - [description] + * @param {(string|Phaser.Scenes.Settings.Config)} config - The Scene configuration object used to create this Scene Settings. * - * @return {Phaser.Scenes.Settings.Object} [description] + * @return {Phaser.Scenes.Settings.Object} The Scene Settings object created as a result of the config and default settings. */ create: function (config) { @@ -80814,12 +80137,12 @@ module.exports = Settings; /***/ }), -/* 327 */ +/* 330 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -80851,21 +80174,21 @@ module.exports = UppercaseFirst; /***/ }), -/* 328 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Systems = __webpack_require__(166); +var Systems = __webpack_require__(176); /** * @classdesc - * [description] + * A base Phaser.Scene class which you could extend for your own use. * * @class Scene * @memberof Phaser @@ -81098,6 +80421,19 @@ var Scene = new Class({ * @since 3.0.0 */ this.matter; + + if (false) + {} + + /** + * A reference to the global Scale Manager. + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.2 + */ + this.scale; }, /** @@ -81120,21 +80456,24 @@ module.exports = Scene; /***/ }), -/* 329 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(116); +var CONST = __webpack_require__(124); +var Events = __webpack_require__(16); +var GameEvents = __webpack_require__(26); var GetValue = __webpack_require__(4); +var LoaderEvents = __webpack_require__(75); var NOOP = __webpack_require__(1); -var Scene = __webpack_require__(328); -var Systems = __webpack_require__(166); +var Scene = __webpack_require__(331); +var Systems = __webpack_require__(176); /** * @classdesc @@ -81277,7 +80616,7 @@ var SceneManager = new Class({ } } - game.events.once('ready', this.bootQueue, this); + game.events.once(GameEvents.READY, this.bootQueue, this); }, /** @@ -81564,6 +80903,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#bootScene * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to boot. @@ -81581,7 +80921,7 @@ var SceneManager = new Class({ if (settings.isTransition) { - sys.events.emit('transitioninit', settings.transitionFrom, settings.transitionDuration); + sys.events.emit(Events.TRANSITION_INIT, settings.transitionFrom, settings.transitionDuration); } } @@ -81608,7 +80948,7 @@ var SceneManager = new Class({ settings.status = CONST.LOADING; // Start the loader going as we have something in the queue - loader.once('complete', this.loadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.loadComplete, this); loader.start(); } @@ -81685,26 +81025,6 @@ var SceneManager = new Class({ } }, - /** - * Informs the Scenes of the Game being resized. - * - * @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); - } - }, - /** * Renders the Scenes. * @@ -81734,6 +81054,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#create * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to create. @@ -81748,11 +81069,11 @@ var SceneManager = new Class({ settings.status = CONST.CREATING; scene.create.call(scene, settings.data); + } - if (settings.isTransition) - { - sys.events.emit('transitionstart', settings.transitionFrom, settings.transitionDuration); - } + if (settings.isTransition) + { + sys.events.emit(Events.TRANSITION_START, settings.transitionFrom, settings.transitionDuration); } // If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP @@ -81957,6 +81278,41 @@ var SceneManager = new Class({ } }, + /** + * Returns an array of all the current Scenes being managed by this Scene Manager. + * + * You can filter the output by the active state of the Scene and choose to have + * the array returned in normal or reversed order. + * + * @method Phaser.Scenes.SceneManager#getScenes + * @since 3.16.0 + * + * @param {boolean} [isActive=true] - Only include Scene's that are currently active? + * @param {boolean} [inReverse=false] - Return the array of Scenes in reverse? + * + * @return {Phaser.Scene[]} An array containing all of the Scenes in the Scene Manager. + */ + getScenes: function (isActive, inReverse) + { + if (isActive === undefined) { isActive = true; } + if (inReverse === undefined) { inReverse = false; } + + var out = []; + var scenes = this.scenes; + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene && (!isActive || (isActive && scene.sys.isActive()))) + { + out.push(scene); + } + } + + return (inReverse) ? out.reverse() : out; + }, + /** * Retrieves a Scene. * @@ -82255,7 +81611,7 @@ var SceneManager = new Class({ { scene.sys.settings.status = CONST.LOADING; - loader.once('complete', this.payloadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); loader.start(); @@ -82703,114 +82059,2420 @@ module.exports = SceneManager; /***/ }), -/* 330 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(91); +var Clamp = __webpack_require__(23); +var Class = __webpack_require__(0); +var SnapFloor = __webpack_require__(98); +var Vector2 = __webpack_require__(3); /** - * Removes the given item, or array of items, from the array. + * @classdesc + * The Size component allows you to set `width` and `height` properties and define the relationship between them. * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * The component can automatically maintain the aspect ratios between the two values, and clamp them + * to a defined min-max range. You can also control the dominant axis. When dimensions are given to the Size component + * that would cause it to exceed its min-max range, the dimensions are adjusted based on the dominant axis. * - * @function Phaser.Utils.Array.Remove - * @since 3.4.0 + * @class Size + * @memberof Phaser.Structs + * @constructor + * @since 3.16.0 * - * @param {array} array - The array to be modified. - * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. - * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + * @param {number} [width=0] - The width of the Size component. + * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. + * @param {integer} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ -var Remove = function (array, item, callback, context) -{ - if (context === undefined) { context = array; } +var Size = new Class({ - var index; + initialize: - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) + function Size (width, height, aspectMode, parent) { - index = array.indexOf(item); + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (aspectMode === undefined) { aspectMode = 0; } + if (parent === undefined) { parent = null; } - if (index !== -1) - { - SpliceOne(array, index); + /** + * Internal width value. + * + * @name Phaser.Structs.Size#_width + * @type {number} + * @private + * @since 3.16.0 + */ + this._width = width; - if (callback) - { - callback.call(context, item); - } + /** + * Internal height value. + * + * @name Phaser.Structs.Size#_height + * @type {number} + * @private + * @since 3.16.0 + */ + this._height = height; - return item; - } - else - { - return null; - } - } + /** + * Internal parent reference. + * + * @name Phaser.Structs.Size#_parent + * @type {any} + * @private + * @since 3.16.0 + */ + this._parent = parent; - // If we got this far, we have an array of items to remove + /** + * The aspect mode this Size component will use when calculating its dimensions. + * This property is read-only. To change it use the `setAspectMode` method. + * + * @name Phaser.Structs.Size#aspectMode + * @type {integer} + * @readonly + * @since 3.16.0 + */ + this.aspectMode = aspectMode; - var itemLength = item.length - 1; + /** + * The proportional relationship between the width and height. + * + * This property is read-only and is updated automatically when either the `width` or `height` properties are changed, + * depending on the aspect mode. + * + * @name Phaser.Structs.Size#aspectRatio + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.aspectRatio = (height === 0) ? 1 : width / height; - while (itemLength >= 0) + /** + * The minimum allowed width. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minWidth = 0; + + /** + * The minimum allowed height. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minHeight = 0; + + /** + * The maximum allowed width. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxWidth = Number.MAX_VALUE; + + /** + * The maximum allowed height. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxHeight = Number.MAX_VALUE; + + /** + * A Vector2 containing the horizontal and vertical snap values, which the width and height are snapped to during resizing. + * + * By default this is disabled. + * + * This property is read-only. To change it see the `setSnap` method. + * + * @name Phaser.Structs.Size#snapTo + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.snapTo = new Vector2(); + }, + + /** + * Sets the aspect mode of this Size component. + * + * The aspect mode controls what happens when you modify the `width` or `height` properties, or call `setSize`. + * + * It can be a number from 0 to 4, or a Size constant: + * + * 0. NONE = Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * 1. WIDTH_CONTROLS_HEIGHT = The height is automatically adjusted based on the width. + * 2. HEIGHT_CONTROLS_WIDTH = The width is automatically adjusted based on the height. + * 3. FIT = The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * 4. ENVELOP = The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setAspectMode + * @since 3.16.0 + * + * @param {integer} [value=0] - The aspect mode value. + * + * @return {this} This Size component instance. + */ + setAspectMode: function (value) { - var entry = item[itemLength]; + if (value === undefined) { value = 0; } - index = array.indexOf(entry); + this.aspectMode = value; - if (index !== -1) + return this.setSize(this._width, this._height); + }, + + /** + * By setting a Snap To value when this Size component is modified its dimensions will automatically + * by snapped to the nearest grid slice, using floor. For example, if you have snap value of 16, + * and the width changes to 68, then it will snap down to 64 (the closest multiple of 16 when floored) + * + * Note that snapping takes place before adjustments by the parent, or the min / max settings. If these + * values are not multiples of the given snap values, then this can result in un-snapped dimensions. + * + * Call this method with no arguments to reset the snap values. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setSnap + * @since 3.16.0 + * + * @param {number} [snapWidth=0] - The amount to snap the width to. If you don't want to snap the width, pass a value of zero. + * @param {number} [snapHeight=snapWidth] - The amount to snap the height to. If not provided it will use the `snapWidth` value. If you don't want to snap the height, pass a value of zero. + * + * @return {this} This Size component instance. + */ + setSnap: function (snapWidth, snapHeight) + { + if (snapWidth === undefined) { snapWidth = 0; } + if (snapHeight === undefined) { snapHeight = snapWidth; } + + this.snapTo.set(snapWidth, snapHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets, or clears, the parent of this Size component. + * + * To clear the parent call this method with no arguments. + * + * The parent influences the maximum extents to which this Size compoent can expand, + * based on the aspect mode: + * + * NONE - The parent clamps both the width and height. + * WIDTH_CONTROLS_HEIGHT - The parent clamps just the width. + * HEIGHT_CONTROLS_WIDTH - The parent clamps just the height. + * FIT - The parent clamps whichever axis is required to ensure the size fits within it. + * ENVELOP - The parent is used to ensure the size fully envelops the parent. + * + * Calling this method automatically calls `setSize`. + * + * @method Phaser.Structs.Size#setParent + * @since 3.16.0 + * + * @param {any} [parent] - Sets the parent of this Size component. Don't provide a value to clear an existing parent. + * + * @return {this} This Size component instance. + */ + setParent: function (parent) + { + this._parent = parent; + + return this.setSize(this._width, this._height); + }, + + /** + * Set the minimum width and height values this Size component will allow. + * + * The minimum values can never be below zero, or greater than the maximum values. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the minimums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMin + * @since 3.16.0 + * + * @param {number} [width=0] - The minimum allowed width of the Size component. + * @param {number} [height=width] - The minimum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMin: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + + this.minWidth = Clamp(width, 0, this.maxWidth); + this.minHeight = Clamp(height, 0, this.maxHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Set the maximum width and height values this Size component will allow. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the maximums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMax + * @since 3.16.0 + * + * @param {number} [width=Number.MAX_VALUE] - The maximum allowed width of the Size component. + * @param {number} [height=width] - The maximum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMax: function (width, height) + { + if (width === undefined) { width = Number.MAX_VALUE; } + if (height === undefined) { height = width; } + + this.maxWidth = Clamp(width, this.minWidth, Number.MAX_VALUE); + this.maxHeight = Clamp(height, this.minHeight, Number.MAX_VALUE); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets the width and height of this Size component based on the aspect mode. + * + * If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current + * aspect ratio is honored across all other modes. + * + * If snapTo values have been set then the given width and height are snapped first, prior to any further + * adjustment via min/max values, or a parent. + * + * If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into + * that range prior to adjustment, but may still exceed them depending on the aspect mode. + * + * If this Size component has a parent set, and the aspect mode is `fit` or `envelop`, then the given sizes will + * be clamped to the range specified by the parent. + * + * @method Phaser.Structs.Size#setSize + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setSize: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + + switch (this.aspectMode) { - SpliceOne(array, index); + case Size.NONE: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + break; - if (callback) + case Size.WIDTH_CONTROLS_HEIGHT: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(this._width * (1 / this.aspectRatio), false); + break; + + case Size.HEIGHT_CONTROLS_WIDTH: + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this._width = this.getNewWidth(this._height * this.aspectRatio, false); + break; + + case Size.FIT: + this.constrain(width, height, true); + break; + + case Size.ENVELOP: + this.constrain(width, height, false); + break; + } + + return this; + }, + + /** + * Sets a new aspect ratio, overriding what was there previously. + * + * It then calls `setSize` immediately using the current dimensions. + * + * @method Phaser.Structs.Size#setAspectRatio + * @since 3.16.0 + * + * @param {number} ratio - The new aspect ratio. + * + * @return {this} This Size component instance. + */ + setAspectRatio: function (ratio) + { + this.aspectRatio = ratio; + + return this.setSize(this._width, this._height); + }, + + /** + * Sets a new width and height for this Size component and updates the aspect ratio based on them. + * + * It _doesn't_ change the `aspectMode` and still factors in size limits such as the min max and parent bounds. + * + * @method Phaser.Structs.Size#resize + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + resize: function (width, height) + { + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + + return this; + }, + + /** + * Takes a new width and passes it through the min/max clamp and then checks it doesn't exceed the parent width. + * + * @method Phaser.Structs.Size#getNewWidth + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified width value. + */ + getNewWidth: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minWidth, this.maxWidth); + + if (checkParent && this._parent && value > this._parent.width) + { + value = Math.max(this.minWidth, this._parent.width); + } + + return value; + }, + + /** + * Takes a new height and passes it through the min/max clamp and then checks it doesn't exceed the parent height. + * + * @method Phaser.Structs.Size#getNewHeight + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified height value. + */ + getNewHeight: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minHeight, this.maxHeight); + + if (checkParent && this._parent && value > this._parent.height) + { + value = Math.max(this.minHeight, this._parent.height); + } + + return value; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * If `fit` is true there may be some space inside the target area which is not covered if its aspect ratio differs. + * If `fit` is false the size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#constrain + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * @param {boolean} [fit=true] - Perform a `fit` (true) constraint, or an `envelop` (false) constraint. + * + * @return {this} This Size component instance. + */ + constrain: function (width, height, fit) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (fit === undefined) { fit = true; } + + width = this.getNewWidth(width); + height = this.getNewHeight(height); + + var snap = this.snapTo; + var newRatio = (height === 0) ? 1 : width / height; + + if ((fit && this.aspectRatio > newRatio) || (!fit && this.aspectRatio < newRatio)) + { + // We need to change the height to fit the width + // height = width / this.aspectRatio; + + width = SnapFloor(width, snap.x); + + height = width / this.aspectRatio; + + if (snap.y > 0) { - callback.call(context, entry); + height = SnapFloor(height, snap.y); + + // Reduce the width accordingly + width = height * this.aspectRatio; } } - else + else if ((fit && this.aspectRatio < newRatio) || (!fit && this.aspectRatio > newRatio)) { - // Item wasn't found in the array, so remove it from our return results - item.pop(); + // We need to change the width to fit the height + // width = height * this.aspectRatio; + + height = SnapFloor(height, snap.y); + + width = height * this.aspectRatio; + + if (snap.x > 0) + { + width = SnapFloor(width, snap.x); + + // Reduce the height accordingly + height = width * (1 / this.aspectRatio); + } + } + + this._width = width; + this._height = height; + + return this; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * There may be some space inside the target area which is not covered if its aspect ratio differs. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#fitTo + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + fitTo: function (width, height) + { + return this.constrain(width, height, true); + }, + + /** + * The current `width` and `height` are adjusted so that they fully envlop the given dimensions, while keeping the aspect ratio. + * + * The size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the values are clamped so that it never exceeds the parent + * on the longest axis. + * + * @method Phaser.Structs.Size#envelop + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + envelop: function (width, height) + { + return this.constrain(width, height, false); + }, + + /** + * Sets the width of this Size component. + * + * Depending on the aspect mode, changing the width may also update the height and aspect ratio. + * + * @method Phaser.Structs.Size#setWidth + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * + * @return {this} This Size component instance. + */ + setWidth: function (value) + { + return this.setSize(value, this._height); + }, + + /** + * Sets the height of this Size component. + * + * Depending on the aspect mode, changing the height may also update the width and aspect ratio. + * + * @method Phaser.Structs.Size#setHeight + * @since 3.16.0 + * + * @param {number} height - The new height of the Size component. + * + * @return {this} This Size component instance. + */ + setHeight: function (value) + { + return this.setSize(this._width, value); + }, + + /** + * Returns a string representation of this Size component. + * + * @method Phaser.Structs.Size#toString + * @since 3.16.0 + * + * @return {string} A string representation of this Size component. + */ + toString: function () + { + return '[{ Size (width=' + this._width + ' height=' + this._height + ' aspectRatio=' + this.aspectRatio + ' aspectMode=' + this.aspectMode + ') }]'; + }, + + /** + * Copies the aspect mode, aspect ratio, width and height from this Size component + * to the given Size component. Note that the parent, if set, is not copied across. + * + * @method Phaser.Structs.Size#copy + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} destination - The Size component to copy the values to. + * + * @return {Phaser.Structs.Size} The updated destination Size component. + */ + copy: function (destination) + { + destination.setAspectMode(this.aspectMode); + + destination.aspectRatio = this.aspectRatio; + + return destination.setSize(this.width, this.height); + }, + + /** + * Destroys this Size component. + * + * This clears the local properties and any parent object, if set. + * + * A destroyed Size component cannot be re-used. + * + * @method Phaser.Structs.Size#destroy + * @since 3.16.0 + */ + destroy: function () + { + this._parent = null; + this.snapTo = null; + }, + + /** + * The width of this Size component. + * + * This value is clamped to the range specified by `minWidth` and `maxWidth`, if enabled. + * + * A width can never be less than zero. + * + * Changing this value will automatically update the `height` if the aspect ratio lock is enabled. + * You can also use the `setWidth` and `getWidth` methods. + * + * @name Phaser.Structs.Size#width + * @type {number} + * @since 3.16.0 + */ + width: { + + get: function () + { + return this._width; + }, + + set: function (value) + { + this.setSize(value, this._height); + } + + }, + + /** + * The height of this Size component. + * + * This value is clamped to the range specified by `minHeight` and `maxHeight`, if enabled. + * + * A height can never be less than zero. + * + * Changing this value will automatically update the `width` if the aspect ratio lock is enabled. + * You can also use the `setHeight` and `getHeight` methods. + * + * @name Phaser.Structs.Size#height + * @type {number} + * @since 3.16.0 + */ + height: { + + get: function () + { + return this._height; + }, + + set: function (value) + { + this.setSize(this._width, value); } - itemLength--; } - return item; -}; +}); -module.exports = Remove; +/** + * Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * + * @name Phaser.Structs.Size.NONE + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.NONE = 0; + +/** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.WIDTH_CONTROLS_HEIGHT = 1; + +/** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.HEIGHT_CONTROLS_WIDTH = 2; + +/** + * The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * + * @name Phaser.Structs.Size.FIT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.FIT = 3; + +/** + * The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Structs.Size.ENVELOP + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.ENVELOP = 4; + +module.exports = Size; /***/ }), -/* 331 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scale.Events + */ + +module.exports = { + + ENTER_FULLSCREEN: __webpack_require__(951), + FULLSCREEN_UNSUPPORTED: __webpack_require__(950), + LEAVE_FULLSCREEN: __webpack_require__(949), + ORIENTATION_CHANGE: __webpack_require__(948), + RESIZE: __webpack_require__(947) + +}; + + +/***/ }), +/* 335 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(178); +var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(334); +var GameEvents = __webpack_require__(26); +var GetInnerHeight = __webpack_require__(946); +var GetTarget = __webpack_require__(345); +var GetScreenOrientation = __webpack_require__(350); +var NOOP = __webpack_require__(1); +var Rectangle = __webpack_require__(10); +var Size = __webpack_require__(333); +var SnapFloor = __webpack_require__(98); +var Vector2 = __webpack_require__(3); + +/** + * @classdesc + * The Scale Manager handles the scaling, resizing and alignment of the game canvas. + * + * The way scaling is handled is by setting the game canvas to a fixed size, which is defined in the + * game configuration. You also define the parent container in the game config. If no parent is given, + * it will default to using the document body. The Scale Manager will then look at the available space + * within the _parent_ and scale the canvas accordingly. Scaling is handled by setting the canvas CSS + * width and height properties, leaving the width and height of the canvas element itself untouched. + * Scaling is therefore achieved by keeping the core canvas the same size and 'stretching' + * it via its CSS properties. This gives the same result and speed as using the `transform-scale` CSS + * property, without the need for browser prefix handling. + * + * The calculations for the scale are heavily influenced by the bounding parent size, which is the computed + * dimensions of the canvas's parent. The CSS rules of the parent element play an important role in the + * operation of the Scale Manager. For example, if the parent has no defined width or height, then actions + * like auto-centering will fail to achieve the required result. The Scale Manager works in tandem with the + * CSS you set-up on the page hosting your game, rather than taking control of it. + * + * #### Parent and Display canvas containment guidelines: + * + * - Style the Parent element (of the game canvas) to control the Parent size and thus the games size and layout. + * + * - The Parent element's CSS styles should _effectively_ apply maximum (and minimum) bounding behavior. + * + * - The Parent element should _not_ apply a padding as this is not accounted for. + * If a padding is required apply it to the Parent's parent or apply a margin to the Parent. + * If you need to add a border, margin or any other CSS around your game container, then use a parent element and + * apply the CSS to this instead, otherwise you'll be constantly resizing the shape of the game container. + * + * - The Display canvas layout CSS styles (i.e. margins, size) should not be altered / specified as + * they may be updated by the Scale Manager. + * + * #### Scale Modes + * + * The way the scaling is handled is determined by the `scaleMode` property. The default is `NO_SCALE`, + * which prevents Phaser from scaling or touching the canvas, or its parent, at all. In this mode, you are + * responsible for all scaling. The other scaling modes afford you automatic scaling. + * + * If you wish to scale your game so that it always fits into the available space within the parent, you + * should use the scale mode `FIT`. Look at the documentation for other scale modes to see what options are + * available. Here is a basic config showing how to set this scale mode: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * mode: Phaser.Scale.FIT, + * width: 800, + * height: 600 + * } + * ``` + * + * Place the `scale` config object within your game config. + * + * If you wish for the canvas to be resized directly, so that the canvas itself fills the available space + * (i.e. it isn't scaled, it's resized) then use the `RESIZE` scale mode. This will give you a 1:1 mapping + * of canvas pixels to game size. In this mode CSS isn't used to scale the canvas, it's literally adjusted + * to fill all available space within the parent. You should be extremely careful about the size of the + * canvas you're creating when doing this, as the larger the area, the more work the GPU has to do and it's + * very easy to hit fill-rate limits quickly. + * + * For complex, custom-scaling requirements, you should probably consider using the `RESIZE` scale mode, + * with your own limitations in place re: canvas dimensions and managing the scaling with the game scenes + * yourself. For the vast majority of games, however, the `FIT` mode is likely to be the most used. + * + * Please appreciate that the Scale Manager cannot perform miracles. All it does is scale your game canvas + * as best it can, based on what it can infer from its surrounding area. There are all kinds of environments + * where it's up to you to guide and help the canvas position itself, especially when built into rendering + * frameworks like React and Vue. If your page requires meta tags to prevent user scaling gestures, or such + * like, then it's up to you to ensure they are present in the html. + * + * #### Centering + * + * You can also have the game canvas automatically centered. Again, this relies heavily on the parent being + * properly configured and styled, as the centering offsets are based entirely on the available space + * within the parent element. Centering is disabled by default, or can be applied horizontally, vertically, + * or both. Here's an example: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * autoCenter: Phaser.Scale.CENTER_BOTH, + * width: 800, + * height: 600 + * } + * ``` + * + * #### Fullscreen API + * + * If the browser supports it, you can send your game into fullscreen mode. In this mode, the game will fill + * the entire display, removing all browser UI and anything else present on the screen. It will remain in this + * mode until your game either disables it, or until the user tabs out or presses ESCape if on desktop. It's a + * great way to achieve a desktop-game like experience from the browser, but it does require a modern browser + * to handle it. Some mobile browsers also support this. + * + * @class ScaleManager + * @memberof Phaser.Scale + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance. + */ +var ScaleManager = new Class({ + + Extends: EventEmitter, + + initialize: + + function ScaleManager (game) + { + EventEmitter.call(this); + + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Scale.ScaleManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.15.0 + */ + this.game = game; + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * + * @name Phaser.Scale.ScaleManager#canvas + * @type {HTMLCanvasElement} + * @since 3.16.0 + */ + this.canvas; + + /** + * The DOM bounds of the canvas element. + * + * @name Phaser.Scale.ScaleManager#canvasBounds + * @type {Phaser.Geom.Rectangle} + * @since 3.16.0 + */ + this.canvasBounds = new Rectangle(); + + /** + * The parent object of the Canvas. Often a div, or the browser window, or nothing in non-browser environments. + * + * This is set in the Game Config as the `parent` property. If undefined (or just not present), it will default + * to use the document body. If specifically set to `null` Phaser will ignore all parent operations. + * + * @name Phaser.Scale.ScaleManager#parent + * @type {?any} + * @since 3.16.0 + */ + this.parent = null; + + /** + * Is the parent element the browser window? + * + * @name Phaser.Scale.ScaleManager#parentIsWindow + * @type {boolean} + * @since 3.16.0 + */ + this.parentIsWindow = false; + + /** + * The Parent Size component. + * + * @name Phaser.Scale.ScaleManager#parentSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.parentSize = new Size(); + + /** + * The Game Size component. + * + * The un-modified game size, as requested in the game config (the raw width / height), + * as used for world bounds, cameras, etc + * + * @name Phaser.Scale.ScaleManager#gameSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.gameSize = new Size(); + + /** + * The Base Size component. + * + * The modified game size, which is the gameSize * resolution, used to set the canvas width and height + * (but not the CSS style) + * + * @name Phaser.Scale.ScaleManager#baseSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.baseSize = new Size(); + + /** + * The Display Size component. + * + * The size used for the canvas style, factoring in the scale mode, parent and other values. + * + * @name Phaser.Scale.ScaleManager#displaySize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.displaySize = new Size(); + + /** + * The game scale mode. + * + * @name Phaser.Scale.ScaleManager#scaleMode + * @type {Phaser.Scale.ScaleModeType} + * @since 3.16.0 + */ + this.scaleMode = CONST.SCALE_MODE.NONE; + + /** + * The canvas resolution. + * + * This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date. + * + * @name Phaser.Scale.ScaleManager#resolution + * @type {number} + * @since 3.16.0 + */ + this.resolution = 1; + + /** + * The game zoom factor. + * + * This value allows you to multiply your games base size by the given zoom factor. + * This is then used when calculating the display size, even in `NO_SCALE` situations. + * If you don't want Phaser to touch the canvas style at all, this value should be 1. + * + * Can also be set to `MAX_ZOOM` in which case the zoom value will be derived based + * on the game size and available space within the parent. + * + * @name Phaser.Scale.ScaleManager#zoom + * @type {number} + * @since 3.16.0 + */ + this.zoom = 1; + + /** + * The scale factor between the baseSize and the canvasBounds. + * + * @name Phaser.Scale.ScaleManager#displayScale + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ + this.displayScale = new Vector2(1, 1); + + /** + * If set, the canvas sizes will be automatically passed through Math.floor. + * This results in rounded pixel display values, which is important for performance on legacy + * and low powered devices, but at the cost of not achieving a 'perfect' fit in some browser windows. + * + * @name Phaser.Scale.ScaleManager#autoRound + * @type {boolean} + * @since 3.16.0 + */ + this.autoRound = false; + + /** + * Automatically center the canvas within the parent? The different centering modes are: + * + * 1. No centering. + * 2. Center both horizontally and vertically. + * 3. Center horizontally. + * 4. Center vertically. + * + * Please be aware that in order to center the game canvas, you must have specified a parent + * that has a size set, or the canvas parent is the document.body. + * + * @name Phaser.Scale.ScaleManager#autoCenter + * @type {Phaser.Scale.CenterType} + * @since 3.16.0 + */ + this.autoCenter = CONST.CENTER.NO_CENTER; + + /** + * The current device orientation. + * + * Orientation events are dispatched via the Device Orientation API, typically only on mobile browsers. + * + * @name Phaser.Scale.ScaleManager#orientation + * @type {Phaser.Scale.OrientationType} + * @since 3.16.0 + */ + this.orientation = CONST.ORIENTATION.LANDSCAPE; + + /** + * A reference to the Device.Fullscreen object. + * + * @name Phaser.Scale.ScaleManager#fullscreen + * @type {Phaser.Device.Fullscreen} + * @since 3.16.0 + */ + this.fullscreen; + + /** + * The DOM Element which is sent into fullscreen mode. + * + * @name Phaser.Scale.ScaleManager#fullscreenTarget + * @type {?any} + * @since 3.16.0 + */ + this.fullscreenTarget = null; + + /** + * Did Phaser create the fullscreen target div, or was it provided in the game config? + * + * @name Phaser.Scale.ScaleManager#_createdFullscreenTarget + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._createdFullscreenTarget = false; + + /** + * Internal var that keeps track of the user, or the browser, requesting fullscreen changes. + * + * @name Phaser.Scale.ScaleManager#_requestedFullscreenChange + * @type {boolean} + * @private + * @since 3.16.2 + */ + this._requestedFullscreenChange = false; + + /** + * The dirty state of the Scale Manager. + * Set if there is a change between the parent size and the current size. + * + * @name Phaser.Scale.ScaleManager#dirty + * @type {boolean} + * @since 3.16.0 + */ + this.dirty = false; + + /** + * How many milliseconds should elapse before checking if the browser size has changed? + * + * Most modern browsers dispatch a 'resize' event, which the Scale Manager will listen for. + * However, older browsers fail to do this, or do it consistently, so we fall back to a + * more traditional 'size check' based on a time interval. You can control how often it is + * checked here. + * + * @name Phaser.Scale.ScaleManager#resizeInterval + * @type {integer} + * @since 3.16.0 + */ + this.resizeInterval = 500; + + /** + * Internal size interval tracker. + * + * @name Phaser.Scale.ScaleManager#_lastCheck + * @type {integer} + * @private + * @since 3.16.0 + */ + this._lastCheck = 0; + + /** + * Internal flag to check orientation state. + * + * @name Phaser.Scale.ScaleManager#_checkOrientation + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._checkOrientation = false; + + /** + * Internal object containing our defined event listeners. + * + * @name Phaser.Scale.ScaleManager#listeners + * @type {object} + * @private + * @since 3.16.0 + */ + this.listeners = { + + orientationChange: NOOP, + windowResize: NOOP, + fullScreenChange: NOOP, + fullScreenError: NOOP + + }; + }, + + /** + * Called _before_ the canvas object is created and added to the DOM. + * + * @method Phaser.Scale.ScaleManager#preBoot + * @protected + * @listens Phaser.Core.Events#BOOT + * @since 3.16.0 + */ + preBoot: function () + { + // Parse the config to get the scaling values we need + this.parseConfig(this.game.config); + + this.game.events.once('boot', this.boot, this); + }, + + /** + * The Boot handler is called by Phaser.Game when it first starts up. + * The renderer is available by now and the canvas has been added to the DOM. + * + * @method Phaser.Scale.ScaleManager#boot + * @protected + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + */ + boot: function () + { + var game = this.game; + + this.canvas = game.canvas; + + this.fullscreen = game.device.fullscreen; + + if (this.scaleMode !== CONST.SCALE_MODE.RESIZE) + { + this.displaySize.setAspectMode(this.scaleMode); + } + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + this.resize(this.width, this.height); + } + else + { + this.getParentBounds(); + + // Only set the parent bounds if the parent has an actual size + if (this.parentSize.width > 0 && this.parentSize.height > 0) + { + this.displaySize.setParent(this.parentSize); + } + + this.refresh(); + } + + game.events.on(GameEvents.PRE_STEP, this.step, this); + + this.startListeners(); + }, + + /** + * Parses the game configuration to set-up the scale defaults. + * + * @method Phaser.Scale.ScaleManager#parseConfig + * @protected + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + parseConfig: function (config) + { + // Get the parent element, if any + this.getParent(config); + + // Get the size of the parent element + // This can often set a height of zero (especially for un-styled divs) + this.getParentBounds(); + + var width = config.width; + var height = config.height; + var scaleMode = config.scaleMode; + var resolution = config.resolution; + var zoom = config.zoom; + var autoRound = config.autoRound; + + // If width = '100%', or similar value + if (typeof width === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentWidth = this.parentSize.width; + + if (parentWidth === 0) + { + parentWidth = window.innerWidth; + } + + var parentScaleX = parseInt(width, 10) / 100; + + width = Math.floor(parentWidth * parentScaleX); + } + + // If height = '100%', or similar value + if (typeof height === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentHeight = this.parentSize.height; + + if (parentHeight === 0) + { + parentHeight = window.innerHeight; + } + + var parentScaleY = parseInt(height, 10) / 100; + + height = Math.floor(parentHeight * parentScaleY); + } + + // This is fixed at 1 on purpose. + // Changing it will break all user input. + // Wait for another release to solve this issue. + this.resolution = 1; + + this.scaleMode = scaleMode; + + this.autoRound = autoRound; + + this.autoCenter = config.autoCenter; + + this.resizeInterval = config.resizeInterval; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.setSize(width, height); + + if (zoom === CONST.ZOOM.MAX_ZOOM) + { + zoom = this.getMaxZoom(); + } + + this.zoom = zoom; + + // The modified game size, which is the w/h * resolution + this.baseSize.setSize(width * resolution, height * resolution); + + if (autoRound) + { + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } + + if (config.minWidth > 0) + { + this.displaySize.setMin(config.minWidth * zoom, config.minHeight * zoom); + } + + if (config.maxWidth > 0) + { + this.displaySize.setMax(config.maxWidth * zoom, config.maxHeight * zoom); + } + + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) + this.displaySize.setSize(width, height); + + this.orientation = GetScreenOrientation(width, height); + }, + + /** + * Determines the parent element of the game canvas, if any, based on the game configuration. + * + * @method Phaser.Scale.ScaleManager#getParent + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + getParent: function (config) + { + var parent = config.parent; + + if (parent === null) + { + // User is responsible for managing the parent + return; + } + + this.parent = GetTarget(parent); + this.parentIsWindow = (this.parent === document.body); + + if (config.expandParent && config.scaleMode !== CONST.SCALE_MODE.NONE) + { + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow || DOMRect.height === 0) + { + document.documentElement.style.height = '100%'; + document.body.style.height = '100%'; + + DOMRect = this.parent.getBoundingClientRect(); + + // The parent STILL has no height, clearly no CSS + // has been set on it even though we fixed the body :( + if (!this.parentIsWindow && DOMRect.height === 0) + { + this.parent.style.overflow = 'hidden'; + this.parent.style.width = '100%'; + this.parent.style.height = '100%'; + } + } + } + + // And now get the fullscreenTarget + if (config.fullscreenTarget && !this.fullscreenTarget) + { + this.fullscreenTarget = GetTarget(config.fullscreenTarget); + } + }, + + /** + * Calculates the size of the parent bounds and updates the `parentSize` component, if the canvas has a dom parent. + * + * @method Phaser.Scale.ScaleManager#getParentBounds + * @since 3.16.0 + * + * @return {boolean} `true` if the parent bounds have changed size, otherwise `false`. + */ + getParentBounds: function () + { + if (!this.parent) + { + return false; + } + + var parentSize = this.parentSize; + + // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect + + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow && this.game.device.os.iOS) + { + DOMRect.height = GetInnerHeight(true); + } + + var resolution = this.resolution; + var newWidth = DOMRect.width * resolution; + var newHeight = DOMRect.height * resolution; + + if (parentSize.width !== newWidth || parentSize.height !== newHeight) + { + parentSize.setSize(newWidth, newHeight); + + return true; + } + else + { + return false; + } + }, + + /** + * Attempts to lock the orientation of the web browser using the Screen Orientation API. + * + * This API is only available on modern mobile browsers. + * See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details. + * + * @method Phaser.Scale.ScaleManager#lockOrientation + * @since 3.16.0 + * + * @param {string} orientation - The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc. + * + * @return {boolean} `true` if the orientation was successfully locked, otherwise `false`. + */ + lockOrientation: function (orientation) + { + var lock = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation; + + if (lock) + { + return lock(orientation); + } + + return false; + }, + + /** + * This method will set the size of the Parent Size component, which is used in scaling + * and centering calculations. You only need to call this method if you have explicitly + * disabled the use of a parent in your game config, but still wish to take advantage of + * other Scale Manager features. + * + * @method Phaser.Scale.ScaleManager#setParentSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the parent. + * @param {number} height - The new height of the parent. + * + * @return {this} The Scale Manager instance. + */ + setParentSize: function (width, height) + { + this.parentSize.setSize(width, height); + + return this.refresh(); + }, + + /** + * This method will set a new size for your game. + * + * @method Phaser.Scale.ScaleManager#setGameSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + setGameSize: function (width, height) + { + var autoRound = this.autoRound; + var resolution = this.resolution; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + this.baseSize.resize(width * resolution, height * resolution); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this.refresh(); + }, + + /** + * Call this to modify the size of the Phaser canvas element directly. + * You should only use this if you are using the `NO_SCALE` scale mode, + * it will update all internal components completely. + * + * If all you want to do is change the size of the parent, see the `setParentSize` method. + * + * If all you want is to change the base size of the game, but still have the Scale Manager + * manage all the scaling, then see the `setGameSize` method. + * + * This method will set the `gameSize`, `baseSize` and `displaySize` components to the given + * dimensions. It will then resize the canvas width and height to the values given, by + * directly setting the properties. Finally, if you have set the Scale Manager zoom value + * to anything other than 1 (the default), it will set the canvas CSS width and height to + * be the given size multiplied by the zoom factor (the canvas pixel size remains untouched). + * + * If you have enabled `autoCenter`, it is then passed to the `updateCenter` method and + * the margins are set, allowing the canvas to be centered based on its parent element + * alone. Finally, the `displayScale` is adjusted and the RESIZE event dispatched. + * + * @method Phaser.Scale.ScaleManager#resize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + resize: function (width, height) + { + var zoom = this.zoom; + var resolution = this.resolution; + var autoRound = this.autoRound; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + + this.baseSize.resize(width * resolution, height * resolution); + + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + this.canvas.width = this.baseSize.width; + this.canvas.height = this.baseSize.height; + + var style = this.canvas.style; + + var styleWidth = width * zoom; + var styleHeight = height * zoom; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (styleWidth !== width || styleHeight !== height) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + this.getParentBounds(); + + this.updateCenter(); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this; + }, + + /** + * Sets the zoom value of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#setZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {integer} value - The new zoom value of the game. + * + * @return {this} The Scale Manager instance. + */ + setZoom: function (value) + { + this.zoom = value; + + return this.refresh(); + }, + + /** + * Sets the zoom to be the maximum possible based on the _current_ parent size. + * + * @method Phaser.Scale.ScaleManager#setMaxZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + setMaxZoom: function () + { + this.zoom = this.getMaxZoom(); + + return this.refresh(); + }, + + /** + * Refreshes the internal scale values, bounds sizes and orientation checks. + * + * Once finished, dispatches the resize event. + * + * This is called automatically by the Scale Manager when the browser window size changes, + * as long as it is using a Scale Mode other than 'NONE'. + * + * @method Phaser.Scale.ScaleManager#refresh + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + refresh: function () + { + this.updateScale(); + this.updateBounds(); + this.updateOrientation(); + + this.displayScale.set(this.baseSize.width / this.canvasBounds.width, this.baseSize.height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + return this; + }, + + /** + * Internal method that checks the current screen orientation, only if the internal check flag is set. + * + * If the orientation has changed it updates the orientation property and then dispatches the orientation change event. + * + * @method Phaser.Scale.ScaleManager#updateOrientation + * @fires Phaser.Scale.Events#ORIENTATION_CHANGE + * @since 3.16.0 + */ + updateOrientation: function () + { + if (this._checkOrientation) + { + this._checkOrientation = false; + + var newOrientation = GetScreenOrientation(this.width, this.height); + + if (newOrientation !== this.orientation) + { + this.orientation = newOrientation; + + this.emit(Events.ORIENTATION_CHANGE, newOrientation); + } + } + }, + + /** + * Internal method that manages updating the size components based on the scale mode. + * + * @method Phaser.Scale.ScaleManager#updateScale + * @since 3.16.0 + */ + updateScale: function () + { + var style = this.canvas.style; + + var width = this.gameSize.width; + var height = this.gameSize.height; + + var styleWidth; + var styleHeight; + + var zoom = this.zoom; + var autoRound = this.autoRound; + var resolution = 1; + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + // No scale + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (zoom > 1) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + } + else if (this.scaleMode === CONST.SCALE_MODE.RESIZE) + { + // Resize to match parent + + // This will constrain using min/max + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + this.gameSize.setSize(this.displaySize.width, this.displaySize.height); + + this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + this.canvas.width = styleWidth; + this.canvas.height = styleHeight; + } + else + { + // All other scale modes + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + // Update the parentSize incase the canvas / style change modified it + this.getParentBounds(); + + // Finally, update the centering + this.updateCenter(); + }, + + /** + * Calculates and returns the largest possible zoom factor, based on the current + * parent and game sizes. If the parent has no dimensions (i.e. an unstyled div), + * or is smaller than the un-zoomed game, then this will return a value of 1 (no zoom) + * + * @method Phaser.Scale.ScaleManager#getMaxZoom + * @since 3.16.0 + * + * @return {integer} The maximum possible zoom factor. At a minimum this value is always at least 1. + */ + getMaxZoom: function () + { + var zoomH = SnapFloor(this.parentSize.width, this.gameSize.width, 0, true); + var zoomV = SnapFloor(this.parentSize.height, this.gameSize.height, 0, true); + + return Math.max(Math.min(zoomH, zoomV), 1); + }, + + /** + * Calculates and updates the canvas CSS style in order to center it within the + * bounds of its parent. If you have explicitly set parent to be `null` in your + * game config then this method will likely give incorrect results unless you have called the + * `setParentSize` method first. + * + * It works by modifying the canvas CSS `marginLeft` and `marginTop` properties. + * + * If they have already been set by your own style sheet, or code, this will overwrite them. + * + * To prevent the Scale Manager from centering the canvas, either do not set the + * `autoCenter` property in your game config, or make sure it is set to `NO_CENTER`. + * + * @method Phaser.Scale.ScaleManager#updateCenter + * @since 3.16.0 + */ + updateCenter: function () + { + var autoCenter = this.autoCenter; + + if (autoCenter === CONST.CENTER.NO_CENTER) + { + return; + } + + var canvas = this.canvas; + + var style = canvas.style; + + var bounds = canvas.getBoundingClientRect(); + + // var width = parseInt(canvas.style.width, 10) || canvas.width; + // var height = parseInt(canvas.style.height, 10) || canvas.height; + + var width = bounds.width; + var height = bounds.height; + + var offsetX = Math.floor((this.parentSize.width - width) / 2); + var offsetY = Math.floor((this.parentSize.height - height) / 2); + + if (autoCenter === CONST.CENTER.CENTER_HORIZONTALLY) + { + offsetY = 0; + } + else if (autoCenter === CONST.CENTER.CENTER_VERTICALLY) + { + offsetX = 0; + } + + style.marginLeft = offsetX + 'px'; + style.marginTop = offsetY + 'px'; + }, + + /** + * Updates the `canvasBounds` rectangle to match the bounding client rectangle of the + * canvas element being used to track input events. + * + * @method Phaser.Scale.ScaleManager#updateBounds + * @since 3.16.0 + */ + updateBounds: function () + { + var bounds = this.canvasBounds; + var clientRect = this.canvas.getBoundingClientRect(); + + bounds.x = clientRect.left + (window.pageXOffset || 0) - (document.documentElement.clientLeft || 0); + bounds.y = clientRect.top + (window.pageYOffset || 0) - (document.documentElement.clientTop || 0); + bounds.width = clientRect.width; + bounds.height = clientRect.height; + }, + + /** + * Transforms the pageX value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformX + * @since 3.16.0 + * + * @param {number} pageX - The DOM pageX value. + * + * @return {number} The translated value. + */ + transformX: function (pageX) + { + return (pageX - this.canvasBounds.left) * this.displayScale.x; + }, + + /** + * Transforms the pageY value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformY + * @since 3.16.0 + * + * @param {number} pageY - The DOM pageY value. + * + * @return {number} The translated value. + */ + transformY: function (pageY) + { + return (pageY - this.canvasBounds.top) * this.displayScale.y; + }, + + /** + * Sends a request to the browser to ask it to go in to full screen mode, using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Fullscreen API}. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * Performing an action that navigates to another page, or opens another tab, will automatically cancel + * fullscreen mode, as will the user pressing the ESC key. To cancel fullscreen mode from your game, i.e. + * from clicking an icon, call the `stopFullscreen` method. + * + * A browser can only send one DOM element into fullscreen. You can control which element this is by + * setting the `fullscreenTarget` property in your game config, or changing the property in the Scale Manager. + * Note that the game canvas _must_ be a child of the target. If you do not give a target, Phaser will + * automatically create a blank `
` element and move the canvas into it, before going fullscreen. + * When it leaves fullscreen, the div will be removed. + * + * @method Phaser.Scale.ScaleManager#startFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + startFullscreen: function (fullscreenOptions) + { + if (fullscreenOptions === undefined) { fullscreenOptions = { navigationUI: 'hide' }; } + + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return; + } + + if (!fullscreen.active) + { + var fsTarget = this.getFullscreenTarget(); + + this._requestedFullscreenChange = true; + + if (fullscreen.keyboard) + { + fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); + } + else + { + fsTarget[fullscreen.request](fullscreenOptions); + } + + this.getParentBounds(); + + this.refresh(); + + this.emit(Events.ENTER_FULLSCREEN); + } + }, + + /** + * An internal method that gets the target element that is used when entering fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#getFullscreenTarget + * @since 3.16.0 + * + * @return {object} The fullscreen target element. + */ + getFullscreenTarget: function () + { + if (!this.fullscreenTarget) + { + var fsTarget = document.createElement('div'); + + fsTarget.style.margin = '0'; + fsTarget.style.padding = '0'; + fsTarget.style.width = '100%'; + fsTarget.style.height = '100%'; + + this.fullscreenTarget = fsTarget; + + this._createdFullscreenTarget = true; + } + + if (this._createdFullscreenTarget) + { + var canvasParent = this.canvas.parentNode; + + canvasParent.insertBefore(this.fullscreenTarget, this.canvas); + + this.fullscreenTarget.appendChild(this.canvas); + } + + return this.fullscreenTarget; + }, + + /** + * Calling this method will cancel fullscreen mode, if the browser has entered it. + * + * @method Phaser.Scale.ScaleManager#stopFullscreen + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.16.0 + */ + stopFullscreen: function () + { + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return false; + } + + if (fullscreen.active) + { + this._requestedFullscreenChange = true; + + document[fullscreen.cancel](); + } + + if (this._createdFullscreenTarget) + { + var fsTarget = this.fullscreenTarget; + + if (fsTarget && fsTarget.parentNode) + { + var parent = fsTarget.parentNode; + + parent.insertBefore(this.canvas, fsTarget); + + parent.removeChild(fsTarget); + } + } + + this.emit(Events.LEAVE_FULLSCREEN); + + this.refresh(); + }, + + /** + * Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. + * If not in fullscreen, this will request the browser to enter fullscreen mode. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * @method Phaser.Scale.ScaleManager#toggleFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + toggleFullscreen: function (fullscreenOptions) + { + if (this.fullscreen.active) + { + this.stopFullscreen(); + } + else + { + this.startFullscreen(fullscreenOptions); + } + }, + + /** + * An internal method that starts the different DOM event listeners running. + * + * @method Phaser.Scale.ScaleManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + var listeners = this.listeners; + + listeners.orientationChange = function () + { + _this._checkOrientation = true; + _this.dirty = true; + }; + + listeners.windowResize = function () + { + _this.dirty = true; + }; + + // Only dispatched on mobile devices + window.addEventListener('orientationchange', listeners.orientationChange, false); + + window.addEventListener('resize', listeners.windowResize, false); + + if (this.fullscreen.available) + { + listeners.fullScreenChange = function (event) + { + return _this.onFullScreenChange(event); + }; + + listeners.fullScreenError = function (event) + { + return _this.onFullScreenError(event); + }; + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); + } + }, + + /** + * Triggered when a fullscreenchange event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenChange + * @since 3.16.0 + */ + onFullScreenChange: function () + { + // They pressed ESC while in fullscreen mode + if (!this._requestedFullscreenChange) + { + this.stopFullscreen(); + } + + this._requestedFullscreenChange = false; + }, + + /** + * Triggered when a fullscreenerror event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenError + * @since 3.16.0 + */ + onFullScreenError: function () + { + }, + + /** + * Internal method, called automatically by the game step. + * Monitors the elapsed time and resize interval to see if a parent bounds check needs to take place. + * + * @method Phaser.Scale.ScaleManager#step + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + step: function (time, delta) + { + if (!this.parent) + { + return; + } + + this._lastCheck += delta; + + if (this.dirty || this._lastCheck > this.resizeInterval) + { + // Returns true if the parent bounds have changed size + if (this.getParentBounds()) + { + this.refresh(); + } + + this.dirty = false; + this._lastCheck = 0; + } + }, + + /** + * Stops all DOM event listeners. + * + * @method Phaser.Scale.ScaleManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var listeners = this.listeners; + + window.removeEventListener('orientationchange', listeners.orientationChange, false); + window.removeEventListener('resize', listeners.windowResize, false); + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); + }, + + /** + * Destroys this Scale Manager, releasing all references to external resources. + * Once destroyed, the Scale Manager cannot be used again. + * + * @method Phaser.Scale.ScaleManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.stopListeners(); + + this.game = null; + this.canvas = null; + this.canvasBounds = null; + this.parent = null; + this.parentSize.destroy(); + this.gameSize.destroy(); + this.baseSize.destroy(); + this.displaySize.destroy(); + this.fullscreenTarget = null; + }, + + /** + * Is the browser currently in fullscreen mode or not? + * + * @name Phaser.Scale.ScaleManager#isFullscreen + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isFullscreen: { + + get: function () + { + return this.fullscreen.active; + } + + }, + + /** + * The game width. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#width + * @type {number} + * @readonly + * @since 3.16.0 + */ + width: { + + get: function () + { + return this.gameSize.width; + } + + }, + + /** + * The game height. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#height + * @type {number} + * @readonly + * @since 3.16.0 + */ + height: { + + get: function () + { + return this.gameSize.height; + } + + }, + + /** + * Is the device in a portrait orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isPortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isPortrait: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.PORTRAIT); + } + + }, + + /** + * Is the device in a landscape orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isLandscape: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.LANDSCAPE); + } + + }, + + /** + * Are the game dimensions portrait? (i.e. taller than they are wide) + * + * This is different to the device itself being in a portrait orientation. + * + * @name Phaser.Scale.ScaleManager#isGamePortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGamePortrait: { + + get: function () + { + return (this.height > this.width); + } + + }, + + /** + * Are the game dimensions landscape? (i.e. wider than they are tall) + * + * This is different to the device itself being in a landscape orientation. + * + * @name Phaser.Scale.ScaleManager#isGameLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGameLandscape: { + + get: function () + { + return (this.width > this.height); + } + + } + +}); + +module.exports = ScaleManager; + + +/***/ }), +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(26); var EventEmitter = __webpack_require__(11); var FileTypesManager = __webpack_require__(7); -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GameObjectFactory = __webpack_require__(5); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); -var Remove = __webpack_require__(330); +var PluginCache = __webpack_require__(17); +var Remove = __webpack_require__(177); /** * @typedef {object} GlobalPlugin @@ -82832,8 +84494,8 @@ var Remove = __webpack_require__(330); * * There are two types of plugin: * - * 1) A Global Plugin - * 2) A Scene Plugin + * 1. A Global Plugin + * 2. A Scene Plugin * * A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get * access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in @@ -82847,9 +84509,9 @@ var Remove = __webpack_require__(330); * * You can add a plugin to Phaser in three different ways: * - * 1) Preload it - * 2) Include it in your source code and install it via the Game Config - * 3) Include it in your source code and install it within a Scene + * 1. Preload it + * 2. Include it in your source code and install it via the Game Config + * 3. Include it in your source code and install it within a Scene * * For examples of all of these approaches please see the Phaser 3 Examples Repo `plugins` folder. * @@ -82926,7 +84588,7 @@ var PluginManager = new Class({ } else { - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); } }, @@ -82997,7 +84659,7 @@ var PluginManager = new Class({ this._pendingGlobal = []; this._pendingScene = []; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -83205,6 +84867,8 @@ var PluginManager = new Class({ * @param {boolean} [start=false] - Automatically start the plugin running? This is always `true` if you provide a mapping value. * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. * @param {any} [data] - A value passed to the plugin's `init` method. + * + * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if `start` was false, or game isn't yet booted. */ install: function (key, plugin, start, mapping, data) { @@ -83215,13 +84879,13 @@ var PluginManager = new Class({ if (typeof plugin !== 'function') { console.warn('Invalid Plugin: ' + key); - return; + return null; } if (PluginCache.hasCustom(key)) { console.warn('Plugin key in use: ' + key); - return; + return null; } if (mapping !== null) @@ -83243,6 +84907,8 @@ var PluginManager = new Class({ return this.start(key); } } + + return null; }, /** @@ -83649,71 +85315,17 @@ module.exports = PluginManager; /***/ }), -/* 332 */ +/* 337 */ /***/ (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 Vector2 = __webpack_require__(3); - -/** - * Takes the `x` and `y` coordinates and transforms them into the same space as - * defined by the position, rotation and scale values. - * - * @function Phaser.Math.TransformXY - * @since 3.0.0 - * - * @param {number} x - The x coordinate to be transformed. - * @param {number} y - The y coordinate to be transformed. - * @param {number} positionX - Horizontal position of the transform point. - * @param {number} positionY - Vertical position of the transform point. - * @param {number} rotation - Rotation of the transform point, in radians. - * @param {number} scaleX - Horizontal scale of the transform point. - * @param {number} scaleY - Vertical scale of the transform point. - * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. - * - * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. - */ -var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) -{ - if (output === undefined) { output = new Vector2(); } - - var radianSin = Math.sin(rotation); - var radianCos = Math.cos(rotation); - - // Rotate and Scale - var a = radianCos * scaleX; - var b = radianSin * scaleX; - var c = -radianSin * scaleY; - var d = radianCos * scaleY; - - // Invert - var id = 1 / ((a * d) + (c * -b)); - - output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); - output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); - - return output; -}; - -module.exports = TransformXY; - - -/***/ }), -/* 333 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); +var InputEvents = __webpack_require__(52); var NOOP = __webpack_require__(1); // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events @@ -83821,7 +85433,27 @@ var TouchManager = new Class({ */ this.onTouchCancel = NOOP; - inputManager.events.once('boot', this.boot, this); + /** + * The Touch Over event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchOver + * @type {function} + * @since 3.16.0 + */ + this.onTouchOver = NOOP; + + /** + * The Touch Out event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchOut + * @type {function} + * @since 3.16.0 + */ + this.onTouchOut = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -83863,9 +85495,16 @@ var TouchManager = new Class({ startListeners: function () { var _this = this; + var canvas = this.manager.canvas; + var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); this.onTouchStart = function (event) { + if (autoFocus) + { + window.focus(); + } + if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled @@ -83874,7 +85513,7 @@ var TouchManager = new Class({ _this.manager.queueTouchStart(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } @@ -83906,7 +85545,7 @@ var TouchManager = new Class({ _this.manager.queueTouchEnd(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } @@ -83928,6 +85567,28 @@ var TouchManager = new Class({ } }; + this.onTouchOver = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOver(event); + }; + + this.onTouchOut = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOut(event); + }; + var target = this.target; if (!target) @@ -83938,18 +85599,17 @@ var TouchManager = new Class({ var passive = { passive: true }; var nonPassive = { passive: false }; - if (this.capture) + target.addEventListener('touchstart', this.onTouchStart, (this.capture) ? nonPassive : passive); + target.addEventListener('touchmove', this.onTouchMove, (this.capture) ? nonPassive : passive); + target.addEventListener('touchend', this.onTouchEnd, (this.capture) ? nonPassive : passive); + target.addEventListener('touchcancel', this.onTouchCancel, (this.capture) ? nonPassive : passive); + target.addEventListener('touchover', this.onTouchOver, (this.capture) ? nonPassive : passive); + target.addEventListener('touchout', this.onTouchOut, (this.capture) ? nonPassive : passive); + + if (window) { - target.addEventListener('touchstart', this.onTouchStart, nonPassive); - target.addEventListener('touchmove', this.onTouchMove, nonPassive); - target.addEventListener('touchend', this.onTouchEnd, nonPassive); - target.addEventListener('touchcancel', this.onTouchCancel, nonPassive); - } - else - { - target.addEventListener('touchstart', this.onTouchStart, passive); - target.addEventListener('touchmove', this.onTouchMove, passive); - target.addEventListener('touchend', this.onTouchEnd, passive); + window.addEventListener('touchstart', this.onTouchStart, nonPassive); + window.addEventListener('touchend', this.onTouchEnd, nonPassive); } this.enabled = true; @@ -83970,6 +85630,14 @@ var TouchManager = new Class({ target.removeEventListener('touchmove', this.onTouchMove); target.removeEventListener('touchend', this.onTouchEnd); target.removeEventListener('touchcancel', this.onTouchCancel); + target.removeEventListener('touchover', this.onTouchOver); + target.removeEventListener('touchout', this.onTouchOut); + + if (window) + { + window.removeEventListener('touchstart', this.onTouchStart); + window.removeEventListener('touchend', this.onTouchEnd); + } }, /** @@ -83993,51 +85661,20 @@ module.exports = TouchManager; /***/ }), -/* 334 */ +/* 338 */ /***/ (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 SmoothStep = __webpack_require__(181); - -/** - * A Smooth Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmoothStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmoothStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmoothStep(t, 0, 1); -}; - -module.exports = SmoothStepInterpolation; - - -/***/ }), -/* 335 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Angle = __webpack_require__(386); var Class = __webpack_require__(0); -var Distance = __webpack_require__(52); -var SmoothStepInterpolation = __webpack_require__(334); +var Distance = __webpack_require__(56); +var FuzzyEqual = __webpack_require__(186); +var SmoothStepInterpolation = __webpack_require__(377); var Vector2 = __webpack_require__(3); /** @@ -84097,6 +85734,26 @@ var Pointer = new Class({ */ this.event; + /** + * The DOM element the Pointer was pressed down on, taken from the DOM event. + * + * @name Phaser.Input.Pointer#downElement + * @type {any} + * @readonly + * @since 3.16.0 + */ + this.downElement; + + /** + * The DOM element the Pointer was released on, taken from the DOM event. + * + * @name Phaser.Input.Pointer#upElement + * @type {any} + * @readonly + * @since 3.16.0 + */ + this.upElement; + /** * The camera the Pointer interacted with during its last update. * @@ -84133,6 +85790,7 @@ var Pointer = new Class({ * * @name Phaser.Input.Pointer#position * @type {Phaser.Math.Vector2} + * @readonly * @since 3.0.0 */ this.position = new Vector2(); @@ -84142,15 +85800,109 @@ var Pointer = new Class({ * * The old x and y values are stored in here during the InputManager.transformPointer call. * - * You can use it to track how fast the pointer is moving, or to smoothly interpolate between the old and current position. - * See the `Pointer.getInterpolatedPosition` method to assist in this. + * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition. * * @name Phaser.Input.Pointer#prevPosition * @type {Phaser.Math.Vector2} + * @readonly * @since 3.11.0 */ this.prevPosition = new Vector2(); + /** + * An internal vector used for calculations of the pointer speed and angle. + * + * @name Phaser.Input.Pointer#midPoint + * @type {Phaser.Math.Vector2} + * @private + * @since 3.16.0 + */ + this.midPoint = new Vector2(-1, -1); + + /** + * The current velocity of the Pointer, based on its current and previous positions. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#velocity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.velocity = new Vector2(); + + /** + * The current angle the Pointer is moving, in radians, based on its previous and current position. + * + * The angle is based on the old position facing to the current position. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#angle + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.angle = 0; + + /** + * The distance the Pointer has moved, based on its previous and current position. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * If you need the total distance travelled since the primary buttons was pressed down, + * then use the `Pointer.getDistance` method. + * + * @name Phaser.Input.Pointer#distance + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.distance = 0; + + /** + * The smoothing factor to apply to the Pointer position. + * + * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions + * then you can set this value to apply an automatic smoothing to the positions as they are recorded. + * + * The default value of zero means 'no smoothing'. + * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this + * value directly, or by setting the `input.smoothFactor` property in the Game Config. + * + * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position + * is always precise, and not smoothed. + * + * @name Phaser.Input.Pointer#smoothFactor + * @type {number} + * @default 0 + * @since 3.16.0 + */ + this.smoothFactor = 0; + + /** + * The factor applied to the motion smoothing each frame. + * + * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, + * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current + * position of the Pointer. 0.2 provides a good average but can be increased if you need a + * quicker update and are working in a high performance environment. Never set this value to + * zero. + * + * @name Phaser.Input.Pointer#motionFactor + * @type {number} + * @default 0.2 + * @since 3.16.0 + */ + this.motionFactor = 0.2; + /** * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. * @@ -84171,6 +85923,16 @@ var Pointer = new Class({ */ this.worldY = 0; + /** + * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any) + * + * @name Phaser.Input.Pointer#moveTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.moveTime = 0; + /** * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. * @@ -84241,20 +86003,6 @@ var Pointer = new Class({ */ this.primaryDown = false; - /** - * The Drag State of the Pointer: - * - * 0 = Not dragging anything - * 1 = Being checked if dragging - * 2 = Dragging something - * - * @name Phaser.Input.Pointer#dragState - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.dragState = 0; - /** * Is _any_ button on this pointer considered as being down? * @@ -84375,6 +86123,15 @@ var Pointer = new Class({ * @since 3.10.0 */ this.active = (id === 0) ? true : false; + + /** + * Time when this Pointer was most recently updated by the Game step. + * + * @name Phaser.Input.Pointer#time + * @type {number} + * @since 3.16.0 + */ + this.time = 0; }, /** @@ -84396,13 +86153,13 @@ var Pointer = new Class({ /** * Resets the temporal properties of this Pointer. - * Called automatically by the Input Plugin each update. + * This method is called automatically each frame by the Input Manager. * * @method Phaser.Input.Pointer#reset * @private * @since 3.0.0 */ - reset: function () + reset: function (time) { this.dirty = false; @@ -84410,10 +86167,60 @@ var Pointer = new Class({ this.justUp = false; this.justMoved = false; + this.time = time; + this.movementX = 0; this.movementY = 0; }, + /** + * Calculates the motion of this Pointer, including its velocity and angle of movement. + * This method is called automatically each frame by the Input Manager. + * + * @method Phaser.Input.Pointer#updateMotion + * @private + * @since 3.16.0 + */ + updateMotion: function () + { + var cx = this.position.x; + var cy = this.position.y; + + var mx = this.midPoint.x; + var my = this.midPoint.y; + + if (cx === mx && cy === my) + { + // Nothing to do here + return; + } + + // Moving towards our goal ... + var vx = SmoothStepInterpolation(this.motionFactor, mx, cx); + var vy = SmoothStepInterpolation(this.motionFactor, my, cy); + + if (FuzzyEqual(vx, cx, 0.1)) + { + vx = cx; + } + + if (FuzzyEqual(vy, cy, 0.1)) + { + vy = cy; + } + + this.midPoint.set(vx, vy); + + var dx = cx - vx; + var dy = cy - vy; + + this.velocity.set(dx, dy); + + this.angle = Angle(vx, vy, cx, cy); + + this.distance = Math.sqrt(dx * dx + dy * dy); + }, + /** * Internal method to handle a Mouse Up Event. * @@ -84426,15 +86233,17 @@ var Pointer = new Class({ */ up: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } this.event = event; + this.upElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); // 0: Main button pressed, usually the left button or the un-initialized state if (event.button === 0) @@ -84465,15 +86274,17 @@ var Pointer = new Class({ */ down: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } this.event = event; + this.downElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); // 0: Main button pressed, usually the left button or the un-initialized state if (event.button === 0) @@ -84502,9 +86313,9 @@ var Pointer = new Class({ * @param {MouseEvent} event - The Mouse Event to process. * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. */ - move: function (event) + move: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } @@ -84512,7 +86323,7 @@ var Pointer = new Class({ this.event = event; // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, true); if (this.manager.mouse.locked) { @@ -84523,6 +86334,8 @@ var Pointer = new Class({ this.justMoved = true; + this.moveTime = time; + this.dirty = true; this.wasTouch = false; @@ -84553,8 +86366,10 @@ var Pointer = new Class({ this.event = event; + this.downElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); this.primaryDown = true; this.downX = this.x; @@ -84580,15 +86395,17 @@ var Pointer = new Class({ * @param {TouchEvent} event - The Touch Event to process. * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. */ - touchmove: function (event) + touchmove: function (event, time) { this.event = event; // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, true); this.justMoved = true; + this.moveTime = time; + this.dirty = true; this.wasTouch = true; @@ -84610,8 +86427,10 @@ var Pointer = new Class({ this.event = event; + this.upElement = event.target; + // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY); + this.manager.transformPointer(this, event.pageX, event.pageY, false); this.primaryDown = false; this.upX = this.x; @@ -84680,7 +86499,7 @@ var Pointer = new Class({ */ leftButtonDown: function () { - return (this.buttons & 1); + return (this.buttons & 1) ? true : false; }, /** @@ -84693,7 +86512,7 @@ var Pointer = new Class({ */ rightButtonDown: function () { - return (this.buttons & 2); + return (this.buttons & 2) ? true : false; }, /** @@ -84706,7 +86525,7 @@ var Pointer = new Class({ */ middleButtonDown: function () { - return (this.buttons & 4); + return (this.buttons & 4) ? true : false; }, /** @@ -84719,7 +86538,7 @@ var Pointer = new Class({ */ backButtonDown: function () { - return (this.buttons & 8); + return (this.buttons & 8) ? true : false; }, /** @@ -84732,21 +86551,135 @@ var Pointer = new Class({ */ forwardButtonDown: function () { - return (this.buttons & 16); + return (this.buttons & 16) ? true : false; }, /** - * Returns the distance between the Pointer's current position and where it was - * first pressed down (the `downX` and `downY` properties) + * If the Pointer has a button pressed down at the time this method is called, it will return the + * distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded distance, based on where + * the Pointer was when the button was released. + * + * If you wish to get the distance being travelled currently, based on the velocity of the Pointer, + * then see the `Pointer.distance` property. * * @method Phaser.Input.Pointer#getDistance * @since 3.13.0 * - * @return {number} The distance the Pointer has moved since being pressed down. + * @return {number} The distance the Pointer moved. */ getDistance: function () { - return Distance(this.downX, this.downY, this.x, this.y); + if (this.isDown) + { + return Distance(this.downX, this.downY, this.x, this.y); + } + else + { + return Distance(this.downX, this.downY, this.upX, this.upY); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * horizontal distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded horizontal distance, based on where + * the Pointer was when the button was released. + * + * @method Phaser.Input.Pointer#getDistanceX + * @since 3.16.0 + * + * @return {number} The horizontal distance the Pointer moved. + */ + getDistanceX: function () + { + if (this.isDown) + { + return Math.abs(this.downX - this.x); + } + else + { + return Math.abs(this.downX - this.upX); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * vertical distance between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded vertical distance, based on where + * the Pointer was when the button was released. + * + * @method Phaser.Input.Pointer#getDistanceY + * @since 3.16.0 + * + * @return {number} The vertical distance the Pointer moved. + */ + getDistanceY: function () + { + if (this.isDown) + { + return Math.abs(this.downY - this.y); + } + else + { + return Math.abs(this.downY - this.upY); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * duration since the Pointer's was pressed down. + * + * If no button is held down, it will return the last recorded duration, based on the time + * the Pointer button was released. + * + * @method Phaser.Input.Pointer#getDuration + * @since 3.16.0 + * + * @return {number} The duration the Pointer was held down for in milliseconds. + */ + getDuration: function () + { + if (this.isDown) + { + return (this.time - this.downTime); + } + else + { + return (this.upTime - this.downTime); + } + }, + + /** + * If the Pointer has a button pressed down at the time this method is called, it will return the + * angle between the Pointer's `downX` and `downY` values and the current position. + * + * If no button is held down, it will return the last recorded angle, based on where + * the Pointer was when the button was released. + * + * The angle is based on the old position facing to the current position. + * + * If you wish to get the current angle, based on the velocity of the Pointer, then + * see the `Pointer.angle` property. + * + * @method Phaser.Input.Pointer#getAngle + * @since 3.16.0 + * + * @return {number} The angle between the Pointer's coordinates in radians. + */ + getAngle: function () + { + if (this.isDown) + { + return Angle(this.downX, this.downY, this.x, this.y); + } + else + { + return Angle(this.downX, this.downY, this.upX, this.upY); + } }, /** @@ -84865,17 +86798,19 @@ module.exports = Pointer; /***/ }), -/* 336 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Features = __webpack_require__(168); +var Features = __webpack_require__(187); +var InputEvents = __webpack_require__(52); +var NOOP = __webpack_require__(0); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md @@ -84951,7 +86886,73 @@ var MouseManager = new Class({ */ this.locked = false; - inputManager.events.once('boot', this.boot, this); + /** + * The Mouse Move Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseMove + * @type {function} + * @since 3.10.0 + */ + this.onMouseMove = NOOP; + + /** + * The Mouse Down Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseDown + * @type {function} + * @since 3.10.0 + */ + this.onMouseDown = NOOP; + + /** + * The Mouse Up Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseUp + * @type {function} + * @since 3.10.0 + */ + this.onMouseUp = NOOP; + + /** + * The Mouse Over Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOver + * @type {function} + * @since 3.16.0 + */ + this.onMouseOver = NOOP; + + /** + * The Mouse Out Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOut + * @type {function} + * @since 3.16.0 + */ + this.onMouseOut = NOOP; + + /** + * Internal pointerLockChange handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#pointerLockChange + * @type {function} + * @since 3.0.0 + */ + this.pointerLockChange = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -84979,7 +86980,7 @@ var MouseManager = new Class({ this.disableContextMenu(); } - if (this.enabled) + if (this.enabled && this.target) { this.startListeners(); } @@ -85029,31 +87030,13 @@ var MouseManager = new Class({ if (Features.pointerLock) { var element = this.target; + element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; + element.requestPointerLock(); } }, - /** - * Internal pointerLockChange handler. - * - * @method Phaser.Input.Mouse.MouseManager#pointerLockChange - * @since 3.0.0 - * - * @param {MouseEvent} event - The native event from the browser. - */ - - /* - pointerLockChange: function (event) - { - var element = this.target; - - this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; - - this.manager.queue.push(event); - }, - */ - /** * If the browser supports pointer lock, this will request that the pointer lock is released. If * the browser successfully enters a locked state, a 'POINTER_LOCK_CHANGE_EVENT' will be @@ -85071,87 +87054,6 @@ var MouseManager = new Class({ } }, - /** - * The Mouse Move Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseMove - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Move Event. - */ - - /* - onMouseMove: function (event) - { - if (event.defaultPrevented || !this.enabled || !this.manager) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseMove(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - - /** - * The Mouse Down Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseDown - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Down Event. - */ - - /* - onMouseDown: function (event) - { - if (event.defaultPrevented || !this.enabled) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseDown(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - - /** - * The Mouse Up Event Handler. - * - * @method Phaser.Input.Mouse.MouseManager#onMouseUp - * @since 3.10.0 - * - * @param {MouseEvent} event - The native DOM Mouse Up Event. - */ - - /* - onMouseUp: function (event) - { - if (event.defaultPrevented || !this.enabled) - { - // Do nothing if event already handled - return; - } - - this.manager.queueMouseUp(event); - - if (this.capture) - { - event.preventDefault(); - } - }, - */ - /** * Starts the Mouse Event listeners running. * This is called automatically and does not need to be manually invoked. @@ -85162,15 +87064,17 @@ var MouseManager = new Class({ startListeners: function () { var _this = this; + var canvas = this.manager.canvas; + var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); - var onMouseMove = function (event) + this.onMouseMove = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled return; } - + _this.manager.queueMouseMove(event); if (_this.capture) @@ -85179,8 +87083,13 @@ var MouseManager = new Class({ } }; - var onMouseDown = function (event) + this.onMouseDown = function (event) { + if (autoFocus) + { + window.focus(); + } + if (event.defaultPrevented || !_this.enabled || !_this.manager) { // Do nothing if event already handled @@ -85189,13 +87098,13 @@ var MouseManager = new Class({ _this.manager.queueMouseDown(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } }; - var onMouseUp = function (event) + this.onMouseUp = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) { @@ -85205,27 +87114,59 @@ var MouseManager = new Class({ _this.manager.queueMouseUp(event); - if (_this.capture) + if (_this.capture && event.target === canvas) { event.preventDefault(); } }; - this.onMouseMove = onMouseMove; - this.onMouseDown = onMouseDown; - this.onMouseUp = onMouseUp; + this.onMouseOver = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOver(event); + }; + + this.onMouseOut = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.manager.setCanvasOut(event); + }; var target = this.target; + + if (!target) + { + return; + } + var passive = { passive: true }; var nonPassive = { passive: false }; - target.addEventListener('mousemove', onMouseMove, (this.capture) ? nonPassive : passive); - target.addEventListener('mousedown', onMouseDown, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseup', onMouseUp, (this.capture) ? nonPassive : passive); + target.addEventListener('mousemove', this.onMouseMove, (this.capture) ? nonPassive : passive); + target.addEventListener('mousedown', this.onMouseDown, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseup', this.onMouseUp, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseover', this.onMouseOver, (this.capture) ? nonPassive : passive); + target.addEventListener('mouseout', this.onMouseOut, (this.capture) ? nonPassive : passive); + + if (window) + { + window.addEventListener('mousedown', this.onMouseDown, nonPassive); + window.addEventListener('mouseup', this.onMouseUp, nonPassive); + } if (Features.pointerLock) { - var onPointerLockChange = function (event) + this.pointerLockChange = function (event) { var element = _this.target; @@ -85234,12 +87175,12 @@ var MouseManager = new Class({ _this.manager.queue.push(event); }; - this.pointerLockChange = onPointerLockChange; - - document.addEventListener('pointerlockchange', onPointerLockChange, true); - document.addEventListener('mozpointerlockchange', onPointerLockChange, true); - document.addEventListener('webkitpointerlockchange', onPointerLockChange, true); + document.addEventListener('pointerlockchange', this.pointerLockChange, true); + document.addEventListener('mozpointerlockchange', this.pointerLockChange, true); + document.addEventListener('webkitpointerlockchange', this.pointerLockChange, true); } + + this.enabled = true; }, /** @@ -85256,6 +87197,14 @@ var MouseManager = new Class({ target.removeEventListener('mousemove', this.onMouseMove); target.removeEventListener('mousedown', this.onMouseDown); target.removeEventListener('mouseup', this.onMouseUp); + target.removeEventListener('mouseover', this.onMouseOver); + target.removeEventListener('mouseout', this.onMouseOut); + + if (window) + { + window.removeEventListener('mousedown', this.onMouseDown); + window.removeEventListener('mouseup', this.onMouseUp); + } if (Features.pointerLock) { @@ -85276,6 +87225,7 @@ var MouseManager = new Class({ this.stopListeners(); this.target = null; + this.enabled = false; this.manager = null; } @@ -85285,12 +87235,462 @@ module.exports = MouseManager; /***/ }), -/* 337 */ +/* 340 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ArrayRemove = __webpack_require__(177); +var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(26); +var InputEvents = __webpack_require__(52); +var KeyCodes = __webpack_require__(125); +var NOOP = __webpack_require__(0); + +/** + * @classdesc + * The Keyboard Manager is a helper class that belongs to the global Input Manager. + * + * Its role is to listen for native DOM Keyboard Events and then store them for further processing by the Keyboard Plugin. + * + * You do not need to create this class directly, the Input Manager will create an instance of it automatically if keyboard + * input has been enabled in the Game Config. + * + * @class KeyboardManager + * @memberof Phaser.Input.Keyboard + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. + */ +var KeyboardManager = new Class({ + + initialize: + + function KeyboardManager (inputManager) + { + /** + * A reference to the Input Manager. + * + * @name Phaser.Input.Keyboard.KeyboardManager#manager + * @type {Phaser.Input.InputManager} + * @since 3.16.0 + */ + this.manager = inputManager; + + /** + * An internal event queue. + * + * @name Phaser.Input.Keyboard.KeyboardManager#queue + * @type {KeyboardEvent[]} + * @private + * @since 3.16.0 + */ + this.queue = []; + + /** + * A flag that controls if the non-modified keys, matching those stored in the `captures` array, + * have `preventDefault` called on them or not. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle this property at run-time. + * + * @name Phaser.Input.Keyboard.KeyboardManager#preventDefault + * @type {boolean} + * @since 3.16.0 + */ + this.preventDefault = true; + + /** + * An array of Key Code values that will automatically have `preventDefault` called on them, + * as long as the `KeyboardManager.preventDefault` boolean is set to `true`. + * + * By default the array is empty. + * + * The key must be non-modified when pressed in order to be captured. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle the `KeyboardManager.preventDefault` boolean at run-time. + * + * If you need more specific control, you can create Key objects and set the flag on each of those instead. + * + * This array can be populated via the Game Config by setting the `input.keyboard.capture` array, or you + * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. + * + * @name Phaser.Input.Keyboard.KeyboardManager#captures + * @type {integer[]} + * @since 3.16.0 + */ + this.captures = []; + + /** + * A boolean that controls if the Keyboard Manager is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Keyboard.KeyboardManager#enabled + * @type {boolean} + * @default false + * @since 3.16.0 + */ + this.enabled = false; + + /** + * The Keyboard Event target, as defined in the Game Config. + * Typically the window in which the game is rendering, but can be any interactive DOM element. + * + * @name Phaser.Input.Keyboard.KeyboardManager#target + * @type {any} + * @since 3.16.0 + */ + this.target; + + /** + * The Key Down Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyDown + * @type {function} + * @since 3.16.00 + */ + this.onKeyDown = NOOP; + + /** + * The Key Up Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyUp + * @type {function} + * @since 3.16.00 + */ + this.onKeyUp = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); + }, + + /** + * The Keyboard Manager boot process. + * + * @method Phaser.Input.Keyboard.KeyboardManager#boot + * @private + * @since 3.16.0 + */ + boot: function () + { + var config = this.manager.config; + + this.enabled = config.inputKeyboard; + this.target = config.inputKeyboardEventTarget; + + this.addCapture(config.inputKeyboardCapture); + + if (!this.target && window) + { + this.target = window; + } + + if (this.enabled && this.target) + { + this.startListeners(); + } + + this.manager.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); + }, + + /** + * Starts the Keyboard Event listeners running. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Keyboard.KeyboardManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + + this.onKeyDown = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } + + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); + + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; + + this.onKeyUp = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } + + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); + + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; + + var target = this.target; + + if (target) + { + target.addEventListener('keydown', this.onKeyDown, false); + target.addEventListener('keyup', this.onKeyUp, false); + + this.enabled = true; + } + }, + + /** + * Stops the Key Event listeners. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Keyboard.KeyboardManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var target = this.target; + + target.removeEventListener('keydown', this.onKeyDown, false); + target.removeEventListener('keyup', this.onKeyUp, false); + + this.enabled = false; + }, + + /** + * Clears the event queue. + * Called automatically by the Input Manager. + * + * @method Phaser.Input.Keyboard.KeyboardManager#postUpdate + * @private + * @since 3.16.0 + */ + postUpdate: function () + { + this.queue = []; + }, + + /** + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. + * + * This `addCapture` method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browser + * and cause the default browser behavior. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass in a single key code value, or an array of key codes, or a string: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are active captures after calling this method, the `preventDefault` property is set to `true`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#addCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. + */ + addCapture: function (keycode) + { + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } + + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } + + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.trim().toUpperCase()]; + } + + if (captures.indexOf(code) === -1) + { + captures.push(code); + } + } + + this.preventDefault = captures.length > 0; + }, + + /** + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass in a single key code value, or an array of key codes, or a string: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are no captures left after calling this method, the `preventDefault` property is set to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. + */ + removeCapture: function (keycode) + { + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } + + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } + + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.toUpperCase()]; + } + + ArrayRemove(captures, code); + } + + this.preventDefault = captures.length > 0; + }, + + /** + * Removes all keyboard captures and sets the `preventDefault` property to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#clearCaptures + * @since 3.16.0 + */ + clearCaptures: function () + { + this.captures = []; + + this.preventDefault = false; + }, + + /** + * Destroys this Keyboard Manager instance. + * + * @method Phaser.Input.Keyboard.KeyboardManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.stopListeners(); + + this.clearCaptures(); + + this.queue = []; + + this.manager.game.events.off(GameEvents.POST_RENDER, this.postUpdate, this); + + this.target = null; + this.enabled = false; + this.manager = null; + } + +}); + +module.exports = KeyboardManager; + + +/***/ }), +/* 341 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -85374,24 +87774,26 @@ module.exports = INPUT_CONST; /***/ }), -/* 338 */ +/* 342 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(337); +var CONST = __webpack_require__(341); var EventEmitter = __webpack_require__(11); -var Mouse = __webpack_require__(336); -var Pointer = __webpack_require__(335); -var Rectangle = __webpack_require__(9); -var Touch = __webpack_require__(333); -var TransformMatrix = __webpack_require__(38); -var TransformXY = __webpack_require__(332); +var Events = __webpack_require__(52); +var GameEvents = __webpack_require__(26); +var Keyboard = __webpack_require__(340); +var Mouse = __webpack_require__(339); +var Pointer = __webpack_require__(338); +var Touch = __webpack_require__(337); +var TransformMatrix = __webpack_require__(41); +var TransformXY = __webpack_require__(371); /** * @classdesc @@ -85432,6 +87834,16 @@ var InputManager = new Class({ */ this.game = game; + /** + * A reference to the global Game Scale Manager. + * Used for all bounds checks and pointer scaling. + * + * @name Phaser.Input.InputManager#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scaleManager; + /** * The Canvas that is used for all DOM event input listeners. * @@ -85442,10 +87854,10 @@ var InputManager = new Class({ this.canvas; /** - * The Input Configuration object, as set in the Game Config. + * The Game Configuration object, as set during the game boot. * * @name Phaser.Input.InputManager#config - * @type {object} + * @type {Phaser.Core.Config} * @since 3.0.0 */ this.config = config; @@ -85475,6 +87887,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#queue * @type {array} * @default [] + * @deprecated * @since 3.0.0 */ this.queue = []; @@ -85485,16 +87898,29 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#domCallbacks * @private * @type {object} + * @deprecated * @since 3.10.0 */ this.domCallbacks = { up: [], down: [], move: [], upOnce: [], downOnce: [], moveOnce: [] }; + /** + * Are any mouse or touch pointers currently over the game canvas? + * This is updated automatically by the canvas over and out handlers. + * + * @name Phaser.Input.InputManager#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + this.isOver = true; + /** * Are there any up callbacks defined? * * @name Phaser.Input.InputManager#_hasUpCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasUpCallback = false; @@ -85505,6 +87931,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasDownCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasDownCallback = false; @@ -85515,6 +87942,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasMoveCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasMoveCallback = false; @@ -85554,6 +87982,15 @@ var InputManager = new Class({ */ this.defaultCursor = ''; + /** + * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property. + * + * @name Phaser.Input.InputManager#keyboard + * @type {?Phaser.Input.Keyboard.KeyboardManager} + * @since 3.16.0 + */ + this.keyboard = (config.inputKeyboard) ? new Keyboard(this) : null; + /** * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property. * @@ -85605,7 +88042,11 @@ var InputManager = new Class({ for (var i = 0; i <= this.pointersTotal; i++) { - this.pointers.push(new Pointer(this, i)); + var pointer = new Pointer(this, i); + + pointer.smoothFactor = config.inputSmoothFactor; + + this.pointers.push(pointer); } /** @@ -85642,15 +88083,6 @@ var InputManager = new Class({ */ this.dirty = false; - /** - * The Scale factor being applied to input coordinates. - * - * @name Phaser.Input.InputManager#scale - * @type { { x:number, y:number } } - * @since 3.0.0 - */ - this.scale = { x: 1, y: 1 }; - /** * If the top-most Scene in the Scene List receives an input it will stop input from * propagating any lower down the scene list, i.e. if you have a UI Scene at the top @@ -85676,19 +88108,49 @@ var InputManager = new Class({ this.ignoreEvents = false; /** - * The bounds of the Input Manager, used for pointer hit test calculations. + * Use the internal event queue or not? + * + * Set this via the Game Config with the `inputQueue` property. + * + * Phaser 3.15.1 and earlier used a event queue by default. + * + * This was changed in version 3.16 to use an immediate-mode system. + * The previous queue based version remains and is left under this flag for backwards + * compatibility. This flag, along with the legacy system, will be removed in a future version. * - * @name Phaser.Input.InputManager#bounds - * @type {Phaser.Geom.Rectangle} - * @since 3.0.0 + * @name Phaser.Input.InputManager#useQueue + * @type {boolean} + * @default false + * @since 3.16.0 */ - this.bounds = new Rectangle(); + this.useQueue = config.inputQueue; + + /** + * The time this Input Manager was last updated. + * This value is populated by the Game Step each frame. + * + * @name Phaser.Input.InputManager#time + * @type {number} + * @readonly + * @since 3.16.2 + */ + this.time = 0; + + /** + * Internal property that tracks frame event state. + * + * @name Phaser.Input.InputManager#_updatedThisFrame + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._updatedThisFrame = false; /** * A re-cycled point-like object to store hit test values in. * * @name Phaser.Input.InputManager#_tempPoint - * @type {{x:number,y:number}} + * @type {{x:number, y:number}} * @private * @since 3.0.0 */ @@ -85725,7 +88187,7 @@ var InputManager = new Class({ */ this._tempMatrix2 = new TransformMatrix(); - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -85734,79 +88196,131 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#boot * @protected + * @fires Phaser.Input.Events#MANAGER_BOOT * @since 3.0.0 */ boot: function () { this.canvas = this.game.canvas; - this.updateBounds(); + this.scaleManager = this.game.scale; - this.events.emit('boot'); + this.events.emit(Events.MANAGER_BOOT); - this.game.events.on('prestep', this.update, this); - this.game.events.on('poststep', this.postUpdate, this); - this.game.events.once('destroy', this.destroy, this); + if (this.useQueue) + { + this.game.events.on(GameEvents.PRE_STEP, this.legacyUpdate, this); + } + else + { + this.game.events.on(GameEvents.PRE_STEP, this.preStep, this); + } + + this.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); + + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * Updates the Input Manager bounds rectangle to match the bounding client rectangle of the - * canvas element being used to track input events. + * Internal canvas state change, called automatically by the Mouse Manager. * - * @method Phaser.Input.InputManager#updateBounds - * @since 3.0.0 - */ - updateBounds: function () - { - var bounds = this.bounds; - - 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; - }, - - /** - * Resizes the Input Manager internal values, including the bounds and scale factor. + * @method Phaser.Input.InputManager#setCanvasOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.0 * - * @method Phaser.Input.InputManager#resize - * @since 3.2.0 + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ - resize: function () + setCanvasOver: function (event) { - this.updateBounds(); + this.isOver = true; - // 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; + this.events.emit(Events.GAME_OVER, event); }, /** - * Internal update loop, called automatically by the Game Step. + * Internal canvas state change, called automatically by the Mouse Manager. + * + * @method Phaser.Input.InputManager#setCanvasOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.0 + * + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. + */ + setCanvasOut: function (event) + { + this.isOver = false; + + this.events.emit(Events.GAME_OUT, event); + }, + + /** + * Internal update method, called automatically when a DOM input event is received. * * @method Phaser.Input.InputManager#update * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE * @since 3.0.0 * * @param {number} time - The time stamp value of this game step. */ update: function (time) { + if (!this._updatedThisFrame) + { + this._setCursor = 0; + + this._updatedThisFrame = true; + } + + this.events.emit(Events.MANAGER_UPDATE); + + this.ignoreEvents = false; + + this.dirty = true; + + var pointers = this.pointers; + + for (var i = 0; i < this.pointersTotal; i++) + { + pointers[i].reset(time); + } + }, + + /** + * Internal update, called automatically by the Game Step. + * + * @method Phaser.Input.InputManager#preStep + * @private + * @since 3.16.2 + * + * @param {number} time - The time stamp value of this game step. + */ + preStep: function (time) + { + this.time = time; + }, + + /** + * Internal update loop, called automatically by the Game Step when using the legacy event queue. + * + * @method Phaser.Input.InputManager#legacyUpdate + * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE + * @since 3.16.0 + * + * @param {number} time - The time stamp value of this game step. + */ + legacyUpdate: function (time) + { + this.time = time; + var i; this._setCursor = 0; - this.events.emit('update'); + this.events.emit(Events.MANAGER_UPDATE); this.ignoreEvents = false; @@ -85818,21 +88332,21 @@ var InputManager = new Class({ for (i = 0; i < this.pointersTotal; i++) { - pointers[i].reset(); + pointers[i].reset(time); } if (!this.enabled || len === 0) { + for (i = 0; i < this.pointersTotal; i++) + { + pointers[i].updateMotion(); + } + return; } this.dirty = true; - this.updateBounds(); - - this.scale.x = this.game.config.width / this.bounds.width; - this.scale.y = this.game.config.height / this.bounds.height; - // Clears the queue array, and also means we don't work on array data that could potentially // be modified during the processing phase var queue = this.queue.splice(0, len); @@ -85875,10 +88389,15 @@ var InputManager = new Class({ break; case CONST.POINTER_LOCK_CHANGE: - this.events.emit('pointerlockchange', event, this.mouse.locked); + this.events.emit(Events.POINTERLOCK_CHANGE, event, this.mouse.locked); break; } } + + for (i = 0; i < this.pointersTotal; i++) + { + pointers[i].updateMotion(); + } }, /** @@ -85898,6 +88417,10 @@ var InputManager = new Class({ { this.canvas.style.cursor = this.defaultCursor; } + + this.dirty = false; + + this._updatedThisFrame = false; }, /** @@ -85989,10 +88512,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ startPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -86005,11 +88531,17 @@ var InputManager = new Class({ if (!pointer.active) { pointer.touchstart(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -86021,10 +88553,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ updatePointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -86037,11 +88572,17 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchmove(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, // For touch end its a list of the touch points that have been removed from the surface @@ -86057,10 +88598,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ stopPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -86073,10 +88617,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -86088,10 +88637,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ cancelPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -86104,10 +88656,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -86145,6 +88702,8 @@ var InputManager = new Class({ var pointer = new Pointer(this, id); + pointer.smoothFactor = this.config.inputSmoothFactor; + this.pointers.push(pointer); this.pointersTotal++; @@ -86160,6 +88719,7 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#processDomCallbacks * @private + * @deprecated * @since 3.10.0 * * @param {array} once - The isOnce callbacks to invoke. @@ -86182,11 +88742,35 @@ var InputManager = new Class({ every[i](event); } - once = []; - return (every.length > 0); }, + /** + * Internal method that gets a list of all the active Input Plugins in the game + * and updates each of them in turn, in reverse order (top to bottom), to allow + * for DOM top-level event handling simulation. + * + * @method Phaser.Input.InputManager#updateInputPlugins + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + updateInputPlugins: function (time, delta) + { + var scenes = this.game.scene.getScenes(true, true); + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene.sys.input) + { + scene.sys.input.update(time, delta); + } + } + }, + /** * Queues a touch start event, as passed in by the TouchManager. * Also dispatches any DOM callbacks for this event. @@ -86199,13 +88783,31 @@ var InputManager = new Class({ */ queueTouchStart: function (event) { - this.queue.push(CONST.TOUCH_START, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_START, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.startPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -86221,13 +88823,31 @@ var InputManager = new Class({ */ queueTouchMove: function (event) { - this.queue.push(CONST.TOUCH_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.updatePointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -86243,13 +88863,31 @@ var InputManager = new Class({ */ queueTouchEnd: function (event) { - this.queue.push(CONST.TOUCH_END, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_END, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.stopPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -86265,7 +88903,23 @@ var InputManager = new Class({ */ queueTouchCancel: function (event) { - this.queue.push(CONST.TOUCH_CANCEL, event); + if (this.useQueue) + { + this.queue.push(CONST.TOUCH_CANCEL, event); + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.cancelPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); + } }, /** @@ -86280,13 +88934,28 @@ var InputManager = new Class({ */ queueMouseDown: function (event) { - this.queue.push(CONST.MOUSE_DOWN, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_DOWN, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.down(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -86302,13 +88971,28 @@ var InputManager = new Class({ */ queueMouseMove: function (event) { - this.queue.push(CONST.MOUSE_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.move(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -86324,17 +89008,36 @@ var InputManager = new Class({ */ queueMouseUp: function (event) { - this.queue.push(CONST.MOUSE_UP, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_UP, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.up(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -86357,6 +89060,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -86383,6 +89087,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -86405,6 +89113,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -86431,6 +89140,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -86453,6 +89166,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -86687,97 +89401,35 @@ var InputManager = new Class({ * @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for. * @param {number} pageX - The Page X value. * @param {number} pageY - The Page Y value. + * @param {boolean} wasMove - Are we transforming the Pointer from a move event, or an up / down event? */ - transformPointer: function (pointer, pageX, pageY) + transformPointer: function (pointer, pageX, pageY, wasMove) { - // Store the previous position - pointer.prevPosition.x = pointer.x; - pointer.prevPosition.y = pointer.y; + var p0 = pointer.position; + var p1 = pointer.prevPosition; - pointer.x = (pageX - this.bounds.left) * this.scale.x; - pointer.y = (pageY - this.bounds.top) * this.scale.y; - }, + // Store previous position + p1.x = p0.x; + p1.y = p0.y; - /** - * Transforms the pageX value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformX - * @since 3.0.0 - * - * @param {number} pageX - The DOM pageX value. - * - * @return {number} The translated value. - */ - transformX: function (pageX) - { - return (pageX - this.bounds.left) * this.scale.x; - }, + // Translate coordinates + var x = this.scaleManager.transformX(pageX); + var y = this.scaleManager.transformY(pageY); - /** - * Transforms the pageY value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformY - * @since 3.0.0 - * - * @param {number} pageY - The DOM pageY value. - * - * @return {number} The translated value. - */ - transformY: function (pageY) - { - return (pageY - this.bounds.top) * this.scale.y; - }, + var a = pointer.smoothFactor; - /** - * Returns the left offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetX - * @since 3.0.0 - * - * @return {number} The left bounds value. - */ - getOffsetX: function () - { - return this.bounds.left; - }, - - /** - * Returns the top offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetY - * @since 3.0.0 - * - * @return {number} The top bounds value. - */ - getOffsetY: function () - { - return this.bounds.top; - }, - - /** - * Returns the horizontal Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleX - * @since 3.0.0 - * - * @return {number} The horizontal scale factor of the input. - */ - getScaleX: function () - { - return this.game.config.width / this.bounds.width; - }, - - /** - * Returns the vertical Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleY - * @since 3.0.0 - * - * @return {number} The vertical scale factor of the input. - */ - getScaleY: function () - { - return this.game.config.height / this.bounds.height; + if (!wasMove || a === 0) + { + // Set immediately + p0.x = x; + p0.y = y; + } + else + { + // Apply smoothing + p0.x = x * a + p1.x * (1 - a); + p0.y = y * a + p1.y * (1 - a); + } }, /** @@ -86792,6 +89444,11 @@ var InputManager = new Class({ { this.events.removeAllListeners(); + if (this.keyboard) + { + this.keyboard.destroy(); + } + if (this.mouse) { this.mouse.destroy(); @@ -86822,370 +89479,12 @@ module.exports = InputManager; /***/ }), -/* 339 */ -/***/ (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__(24); - -/** - * 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. - * - * @typedef {object} Phaser.Device.CanvasFeatures - * @since 3.0.0 - * - * @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 = { - - supportInverseAlpha: false, - supportNewBlendModes: false - -}; - -function checkBlendMode () -{ - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - - var magenta = new Image(); - - magenta.onload = function () - { - var yellow = new Image(); - - yellow.onload = function () - { - var canvas = CanvasPool.create(yellow, 6, 1); - var context = canvas.getContext('2d'); - - context.globalCompositeOperation = 'multiply'; - - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); - - if (!context.getImageData(2, 0, 1, 1)) - { - return false; - } - - var data = context.getImageData(2, 0, 1, 1).data; - - CanvasPool.remove(yellow); - - CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); - }; - - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - }; - - magenta.src = pngHead + 'AP804Oa6' + pngEnd; - - return false; -} - -function checkInverseAlpha () -{ - var canvas = CanvasPool.create(this, 2, 1); - var context = canvas.getContext('2d'); - - context.fillStyle = 'rgba(10, 20, 30, 0.5)'; - - // Draw a single pixel - context.fillRect(0, 0, 1, 1); - - // Get the color values - var s1 = context.getImageData(0, 0, 1, 1); - - if (s1 === null) - { - return false; - } - - // Plot them to x2 - context.putImageData(s1, 1, 0); - - // 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) - { - CanvasFeatures.supportNewBlendModes = checkBlendMode(); - CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); - } - - return CanvasFeatures; -} - -module.exports = init(); - - -/***/ }), -/* 340 */ -/***/ (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 singleton is instantiated as soon as Phaser loads, -// before a Phaser.Game instance has even been created. -// Which means all instances of Phaser Games can share it, -// without having to re-poll the device all over again - -/** - * @namespace Phaser.Device - * @since 3.0.0 - */ - -/** - * @typedef {object} Phaser.DeviceConf - * - * @property {Phaser.Device.OS} os - The OS Device functions. - * @property {Phaser.Device.Browser} browser - The Browser Device functions. - * @property {Phaser.Device.Features} features - The Features Device functions. - * @property {Phaser.Device.Input} input - The Input Device functions. - * @property {Phaser.Device.Audio} audio - The Audio Device functions. - * @property {Phaser.Device.Video} video - The Video Device functions. - * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. - * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. - */ - -module.exports = { - - os: __webpack_require__(92), - browser: __webpack_require__(118), - features: __webpack_require__(168), - input: __webpack_require__(902), - audio: __webpack_require__(901), - video: __webpack_require__(900), - fullscreen: __webpack_require__(899), - canvasFeatures: __webpack_require__(339) - -}; - - -/***/ }), -/* 341 */ -/***/ (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__(1); - -/** - * @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. - * - * @name Phaser.DOM.RequestAnimationFrame#isRunning - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isRunning = false; - - /** - * The callback to be invoked each step. - * - * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {FrameRequestCallback} - * @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 {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 {FrameRequestCallback} - * @since 3.0.0 - */ - this.step = function step (timestamp) - { - // DOMHighResTimeStamp - _this.lastTime = _this.tick; - - _this.tick = timestamp; - - _this.timeOutID = window.requestAnimationFrame(step); - - _this.callback(timestamp); - }; - - /** - * 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.timeOutID = window.setTimeout(stepTimeout, delay); - - _this.callback(d); - }; - }, - - /** - * Starts the requestAnimationFrame or setTimeout process running. - * - * @method Phaser.DOM.RequestAnimationFrame#start - * @since 3.0.0 - * - * @param {FrameRequestCallback} callback - The callback to invoke each step. - * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? - */ - start: function (callback, forceSetTimeOut) - { - if (this.isRunning) - { - return; - } - - this.callback = callback; - - this.isSetTimeOut = forceSetTimeOut; - - this.isRunning = true; - - this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); - }, - - /** - * 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 - { - window.cancelAnimationFrame(this.timeOutID); - } - }, - - /** - * Stops the step from running and clears the callback reference. - * - * @method Phaser.DOM.RequestAnimationFrame#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); - - this.callback = NOOP; - } - -}); - -module.exports = RequestAnimationFrame; - - -/***/ }), -/* 342 */ +/* 343 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87209,12 +89508,12 @@ module.exports = RemoveFromDOM; /***/ }), -/* 343 */ +/* 344 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87266,16 +89565,401 @@ module.exports = ParseXML; /***/ }), -/* 344 */ +/* 345 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Attempts to get the target DOM element based on the given value, which can be either + * a string, in which case it will be looked-up by ID, or an element node. If nothing + * can be found it will return a reference to the document.body. + * + * @function Phaser.DOM.GetTarget + * @since 3.16.0 + * + * @param {HTMLElement} element - The DOM element to look-up. + */ +var GetTarget = function (element) +{ + var target; + + if (element !== '') + { + if (typeof element === 'string') + { + // Hopefully an element ID + target = document.getElementById(element); + } + else if (element && element.nodeType === 1) + { + // Quick test for a HTMLElement + target = element; + } + } + + // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. + if (!target) + { + // Use the full window + target = document.body; + } + + return target; +}; + +module.exports = GetTarget; + + +/***/ }), +/* 346 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * @namespace Phaser.Scale.Zoom + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}. + * + * @typedef {(Phaser.Scale.Zoom.NO_ZOOM|Phaser.Scale.Zoom.ZOOM_2X|Phaser.Scale.Zoom.ZOOM_4X|Phaser.Scale.Zoom.MAX_ZOOM)} Phaser.Scale.ZoomType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas will not be zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.NO_ZOOM + * @since 3.16.0 + */ + NO_ZOOM: 1, + + /** + * The game canvas will be 2x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_2X + * @since 3.16.0 + */ + ZOOM_2X: 2, + + /** + * The game canvas will be 4x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_4X + * @since 3.16.0 + */ + ZOOM_4X: 4, + + /** + * Calculate the zoom value based on the maximum multiplied game size that will + * fit into the parent, or browser window if no parent is set. + * + * @name Phaser.Scale.Zoom.MAX_ZOOM + * @since 3.16.0 + */ + MAX_ZOOM: -1 + +}; + + +/***/ }), +/* 347 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * @namespace Phaser.Scale.ScaleModes + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}. + * + * @typedef {(Phaser.Scale.ScaleModes.NONE|Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT|Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH|Phaser.Scale.ScaleModes.FIT|Phaser.Scale.ScaleModes.ENVELOP|Phaser.Scale.ScaleModes.RESIZE)} Phaser.Scale.ScaleModeType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it + * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need + * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. + * + * @name Phaser.Scale.ScaleModes.NONE + * @since 3.16.0 + */ + NONE: 0, + + /** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT + * @since 3.16.0 + */ + WIDTH_CONTROLS_HEIGHT: 1, + + /** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH + * @since 3.16.0 + */ + HEIGHT_CONTROLS_WIDTH: 2, + + /** + * The width and height are automatically adjusted to fit inside the given target area, + * while keeping the aspect ratio. Depending on the aspect ratio there may be some space + * inside the area which is not covered. + * + * @name Phaser.Scale.ScaleModes.FIT + * @since 3.16.0 + */ + FIT: 3, + + /** + * The width and height are automatically adjusted to make the size cover the entire target + * area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Scale.ScaleModes.ENVELOP + * @since 3.16.0 + */ + ENVELOP: 4, + + /** + * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. + * + * @name Phaser.Scale.ScaleModes.RESIZE + * @since 3.16.0 + */ + RESIZE: 5 + +}; + + +/***/ }), +/* 348 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * @namespace Phaser.Scale.Orientation + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}. + * + * @typedef {(Phaser.Scale.Orientation.LANDSCAPE|Phaser.Scale.Orientation.PORTRAIT)} Phaser.Scale.OrientationType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * A landscape orientation. + * + * @name Phaser.Scale.Orientation.LANDSCAPE + * @since 3.16.0 + */ + LANDSCAPE: 'landscape-primary', + + /** + * A portrait orientation. + * + * @name Phaser.Scale.Orientation.PORTRAIT + * @since 3.16.0 + */ + PORTRAIT: 'portrait-primary' + +}; + + +/***/ }), +/* 349 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * @namespace Phaser.Scale.Center + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}. + * + * @typedef {(Phaser.Scale.Center.NO_CENTER|Phaser.Scale.Center.CENTER_BOTH|Phaser.Scale.Center.CENTER_HORIZONTALLY|Phaser.Scale.Center.CENTER_VERTICALLY)} Phaser.Scale.CenterType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas is not centered within the parent by Phaser. + * You can still center it yourself via CSS. + * + * @name Phaser.Scale.Center.NO_CENTER + * @since 3.16.0 + */ + NO_CENTER: 0, + + /** + * The game canvas is centered both horizontally and vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_BOTH + * @since 3.16.0 + */ + CENTER_BOTH: 1, + + /** + * The game canvas is centered horizontally within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_HORIZONTALLY + * @since 3.16.0 + */ + CENTER_HORIZONTALLY: 2, + + /** + * The game canvas is centered both vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_VERTICALLY + * @since 3.16.0 + */ + CENTER_VERTICALLY: 3 + +}; + + +/***/ }), +/* 350 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); +var CONST = __webpack_require__(178); + +var GetScreenOrientation = function (width, height) +{ + var screen = window.screen; + var orientation = (screen) ? screen.orientation || screen.mozOrientation || screen.msOrientation : false; + + if (orientation && typeof orientation.type === 'string') + { + // Screen Orientation API specification + return orientation.type; + } + else if (typeof orientation === 'string') + { + // moz / ms-orientation are strings + return orientation; + } + + if (screen) + { + return (screen.height > screen.width) ? CONST.PORTRAIT : CONST.LANDSCAPE; + } + else if (typeof window.orientation === 'number') + { + // This may change by device based on "natural" orientation. + return (window.orientation === 0 || window.orientation === 180) ? CONST.PORTRAIT : CONST.LANDSCAPE; + } + else if (window.matchMedia) + { + if (window.matchMedia('(orientation: portrait)').matches) + { + return CONST.PORTRAIT; + } + else if (window.matchMedia('(orientation: landscape)').matches) + { + return CONST.LANDSCAPE; + } + } + + return (height > width) ? CONST.PORTRAIT : CONST.LANDSCAPE; +}; + +module.exports = GetScreenOrientation; + + +/***/ }), +/* 351 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var OS = __webpack_require__(99); /** * @callback ContentLoadedCallback @@ -87329,12 +90013,12 @@ module.exports = DOMContentLoaded; /***/ }), -/* 345 */ +/* 352 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87385,12 +90069,12 @@ module.exports = HueToComponent; /***/ }), -/* 346 */ +/* 353 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87415,12 +90099,12 @@ module.exports = ComponentToHex; /***/ }), -/* 347 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87434,115 +90118,53 @@ module.exports = ComponentToHex; */ /** - * @typedef {Object} ColorObject + * @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. */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); -Color.ColorToRGBA = __webpack_require__(915); -Color.ComponentToHex = __webpack_require__(346); -Color.GetColor = __webpack_require__(177); -Color.GetColor32 = __webpack_require__(376); -Color.HexStringToColor = __webpack_require__(377); -Color.HSLToColor = __webpack_require__(914); -Color.HSVColorWheel = __webpack_require__(913); -Color.HSVToRGB = __webpack_require__(176); -Color.HueToComponent = __webpack_require__(345); -Color.IntegerToColor = __webpack_require__(374); -Color.IntegerToRGB = __webpack_require__(373); -Color.Interpolate = __webpack_require__(912); -Color.ObjectToColor = __webpack_require__(372); -Color.RandomRGB = __webpack_require__(911); -Color.RGBStringToColor = __webpack_require__(371); -Color.RGBToHSV = __webpack_require__(375); -Color.RGBToString = __webpack_require__(910); -Color.ValueToColor = __webpack_require__(178); +Color.ColorToRGBA = __webpack_require__(1005); +Color.ComponentToHex = __webpack_require__(353); +Color.GetColor = __webpack_require__(191); +Color.GetColor32 = __webpack_require__(409); +Color.HexStringToColor = __webpack_require__(410); +Color.HSLToColor = __webpack_require__(1004); +Color.HSVColorWheel = __webpack_require__(1003); +Color.HSVToRGB = __webpack_require__(190); +Color.HueToComponent = __webpack_require__(352); +Color.IntegerToColor = __webpack_require__(407); +Color.IntegerToRGB = __webpack_require__(406); +Color.Interpolate = __webpack_require__(1002); +Color.ObjectToColor = __webpack_require__(405); +Color.RandomRGB = __webpack_require__(1001); +Color.RGBStringToColor = __webpack_require__(404); +Color.RGBToHSV = __webpack_require__(408); +Color.RGBToString = __webpack_require__(1000); +Color.ValueToColor = __webpack_require__(192); module.exports = Color; /***/ }), -/* 348 */ -/***/ (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.Display.Canvas.CanvasInterpolation - * @since 3.0.0 - */ -var CanvasInterpolation = { - - /** - * 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' ]; - - types.forEach(function (type) - { - canvas.style['image-rendering'] = type; - }); - - canvas.style.msInterpolationMode = 'nearest-neighbor'; - - return canvas; - }, - - /** - * 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'; - - return canvas; - } - -}; - -module.exports = CanvasInterpolation; - - -/***/ }), -/* 349 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 CatmullRom = __webpack_require__(171); +var CatmullRom = __webpack_require__(185); var Class = __webpack_require__(0); -var Curve = __webpack_require__(70); +var Curve = __webpack_require__(76); var Vector2 = __webpack_require__(3); /** @@ -87754,72 +90376,18 @@ module.exports = SplineCurve; /***/ }), -/* 350 */ -/***/ (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 * p; -} - -function P1 (t, p) -{ - return 2 * (1 - t) * t * p; -} - -function P2 (t, p) -{ - return t * t * p; -} - -// p0 = start point -// p1 = control point 1 -// p2 = end point - -// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js - -/** - * A quadratic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.QuadraticBezier - * @since 3.2.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The control point. - * @param {number} p2 - The end point. - * - * @return {number} The interpolated value. - */ -var QuadraticBezierInterpolation = function (t, p0, p1, p2) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2); -}; - -module.exports = QuadraticBezierInterpolation; - - -/***/ }), -/* 351 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Curve = __webpack_require__(70); -var QuadraticBezierInterpolation = __webpack_require__(350); +var Curve = __webpack_require__(76); +var QuadraticBezierInterpolation = __webpack_require__(378); var Vector2 = __webpack_require__(3); /** @@ -88022,28 +90590,28 @@ module.exports = QuadraticBezier; /***/ }), -/* 352 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(70); -var FromPoints = __webpack_require__(173); -var Rectangle = __webpack_require__(9); +var Curve = __webpack_require__(76); +var FromPoints = __webpack_require__(180); +var Rectangle = __webpack_require__(10); var Vector2 = __webpack_require__(3); var tmpVec2 = new Vector2(); /** * @classdesc - * [description] + * A LineCurve is a "curve" comprising exactly two points (a line segment). * * @class Line * @extends Phaser.Curves.Curve @@ -88051,8 +90619,8 @@ var tmpVec2 = new Vector2(); * @constructor * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|number[])} p0 - [description] - * @param {Phaser.Math.Vector2} [p1] - [description] + * @param {(Phaser.Math.Vector2|number[])} p0 - The first endpoint. + * @param {Phaser.Math.Vector2} [p1] - The second endpoint. */ var LineCurve = new Class({ @@ -88072,7 +90640,7 @@ var LineCurve = new Class({ } /** - * [description] + * The first endpoint. * * @name Phaser.Curves.Line#p0 * @type {Phaser.Math.Vector2} @@ -88081,7 +90649,7 @@ var LineCurve = new Class({ this.p0 = p0; /** - * [description] + * The second endpoint. * * @name Phaser.Curves.Line#p1 * @type {Phaser.Math.Vector2} @@ -88129,14 +90697,14 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets the resolution of the line. * * @method Phaser.Curves.Line#getResolution * @since 3.0.0 * - * @param {number} [divisions=1] - [description] + * @param {number} [divisions=1] - The number of divisions to consider. * - * @return {number} [description] + * @return {number} The resolution. Equal to the number of divisions. */ getResolution: function (divisions) { @@ -88175,7 +90743,7 @@ var LineCurve = new Class({ // Line curve is linear, so we can overwrite default getPointAt /** - * [description] + * Gets a point at a given position on the line. * * @method Phaser.Curves.Line#getPointAt * @since 3.0.0 @@ -88193,14 +90761,14 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets the slope of the line as a unit vector. * * @method Phaser.Curves.Line#getTangent * @since 3.0.0 * * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} The tangent vector. */ getTangent: function () { @@ -88235,7 +90803,7 @@ var LineCurve = new Class({ }, /** - * [description] + * Gets a JSON representation of the line. * * @method Phaser.Curves.Line#toJSON * @since 3.0.0 @@ -88256,14 +90824,14 @@ var LineCurve = new Class({ }); /** - * [description] + * Configures this line from a JSON representation. * * @function Phaser.Curves.Line.fromJSON * @since 3.0.0 * * @param {JSONCurve} data - The JSON object containing this curve data. * - * @return {Phaser.Curves.Line} [description] + * @return {Phaser.Curves.Line} A new LineCurve object. */ LineCurve.fromJSON = function (data) { @@ -88279,22 +90847,22 @@ module.exports = LineCurve; /***/ }), -/* 353 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(70); -var DegToRad = __webpack_require__(31); +var Curve = __webpack_require__(76); +var DegToRad = __webpack_require__(34); var GetValue = __webpack_require__(4); -var RadToDeg = __webpack_require__(172); +var RadToDeg = __webpack_require__(183); var Vector2 = __webpack_require__(3); /** @@ -88930,83 +91498,20 @@ module.exports = EllipseCurve; /***/ }), -/* 354 */ -/***/ (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 - -/** - * A cubic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.CubicBezier - * @since 3.0.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The first control point. - * @param {number} p2 - The second control point. - * @param {number} p3 - The end point. - * - * @return {number} The interpolated value. - */ -var CubicBezierInterpolation = function (t, p0, p1, p2, p3) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); -}; - -module.exports = CubicBezierInterpolation; - - -/***/ }), -/* 355 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(354); -var Curve = __webpack_require__(70); +var CubicBezier = __webpack_require__(379); +var Curve = __webpack_require__(76); var Vector2 = __webpack_require__(3); /** @@ -89220,12 +91725,12 @@ module.exports = CubicBezierCurve; /***/ }), -/* 356 */ +/* 360 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89258,16 +91763,16 @@ module.exports = { /***/ }), -/* 357 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arne16 = __webpack_require__(356); +var Arne16 = __webpack_require__(360); var CanvasPool = __webpack_require__(24); var GetValue = __webpack_require__(4); @@ -89373,12 +91878,5762 @@ module.exports = GenerateTexture; /***/ }), -/* 358 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Events = __webpack_require__(26); + +/** + * The Visibility Handler is responsible for listening out for document level visibility change events. + * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses + * the provided Event Emitter and fires the related events. + * + * @function Phaser.Core.VisibilityHandler + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. + */ +var VisibilityHandler = function (game) +{ + var hiddenVar; + var eventEmitter = game.events; + + if (document.hidden !== undefined) + { + hiddenVar = 'visibilitychange'; + } + else + { + var vendors = [ 'webkit', 'moz', 'ms' ]; + + vendors.forEach(function (prefix) + { + if (document[prefix + 'Hidden'] !== undefined) + { + document.hidden = function () + { + return document[prefix + 'Hidden']; + }; + + hiddenVar = prefix + 'visibilitychange'; + } + + }); + } + + var onChange = function (event) + { + if (document.hidden || event.type === 'pause') + { + eventEmitter.emit(Events.HIDDEN); + } + else + { + eventEmitter.emit(Events.VISIBLE); + } + }; + + if (hiddenVar) + { + document.addEventListener(hiddenVar, onChange, false); + } + + window.onblur = function () + { + eventEmitter.emit(Events.BLUR); + }; + + window.onfocus = function () + { + eventEmitter.emit(Events.FOCUS); + }; + + // Automatically give the window focus unless config says otherwise + if (window.focus && game.config.autoFocus) + { + window.focus(); + } +}; + +module.exports = VisibilityHandler; + + +/***/ }), +/* 363 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(1); + +/** + * @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. + * + * @name Phaser.DOM.RequestAnimationFrame#isRunning + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isRunning = false; + + /** + * The callback to be invoked each step. + * + * @name Phaser.DOM.RequestAnimationFrame#callback + * @type {FrameRequestCallback} + * @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 {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 {FrameRequestCallback} + * @since 3.0.0 + */ + this.step = function step () + { + // Because we cannot trust the time passed to this callback from the browser and need it kept in sync with event times + var timestamp = window.performance.now(); + + // 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); + }; + }, + + /** + * Starts the requestAnimationFrame or setTimeout process running. + * + * @method Phaser.DOM.RequestAnimationFrame#start + * @since 3.0.0 + * + * @param {FrameRequestCallback} callback - The callback to invoke each step. + * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? + */ + start: function (callback, forceSetTimeOut) + { + if (this.isRunning) + { + return; + } + + this.callback = callback; + + this.isSetTimeOut = forceSetTimeOut; + + this.isRunning = true; + + this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + }, + + /** + * 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 + { + window.cancelAnimationFrame(this.timeOutID); + } + }, + + /** + * Stops the step from running and clears the callback reference. + * + * @method Phaser.DOM.RequestAnimationFrame#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.stop(); + + this.callback = NOOP; + } + +}); + +module.exports = RequestAnimationFrame; + + +/***/ }), +/* 364 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 NOOP = __webpack_require__(1); +var RequestAnimationFrame = __webpack_require__(363); + +// Frame Rate config +// fps: { +// min: 10, +// target: 60, +// forceSetTimeOut: false, +// deltaHistory: 10, +// panicMax: 120 +// } + +// http://www.testufo.com/#test=animation-time-graph + +/** + * @callback TimeStepCallback + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} average - The Delta Average. + * @param {number} interpolation - Interpolation - how far between what is expected and where we are? + */ + +/** + * @classdesc + * [description] + * + * @class TimeStep + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. + * @param {FPSConfig} config + */ +var TimeStep = new Class({ + + initialize: + + function TimeStep (game, config) + { + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Core.TimeStep#game + * @type {Phaser.Game} + * @readonly + * @since 3.0.0 + */ + this.game = game; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#raf + * @type {Phaser.DOM.RequestAnimationFrame} + * @readonly + * @since 3.0.0 + */ + this.raf = new RequestAnimationFrame(); + + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * + * @name Phaser.Core.TimeStep#started + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.started = false; + + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * The difference between this value and `started` is that `running` is toggled when + * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if + * the TimeStep is actually stopped, not just paused. + * + * @name Phaser.Core.TimeStep#running + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.running = false; + + /** + * The minimum fps rate you want the Time Step to run at. + * + * @name Phaser.Core.TimeStep#minFps + * @type {integer} + * @default 5 + * @since 3.0.0 + */ + this.minFps = GetValue(config, 'min', 5); + + /** + * The target fps rate for the Time Step to run at. + * + * Setting this value will not actually change the speed at which the browser runs, that is beyond + * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step + * is spiraling out of control. + * + * @name Phaser.Core.TimeStep#targetFps + * @type {integer} + * @default 60 + * @since 3.0.0 + */ + this.targetFps = GetValue(config, 'target', 60); + + /** + * The minFps value in ms. + * Defaults to 200ms between frames (i.e. super slow!) + * + * @name Phaser.Core.TimeStep#_min + * @type {number} + * @private + * @since 3.0.0 + */ + this._min = 1000 / this.minFps; + + /** + * The targetFps value in ms. + * Defaults to 16.66ms between frames (i.e. normal) + * + * @name Phaser.Core.TimeStep#_target + * @type {number} + * @private + * @since 3.0.0 + */ + this._target = 1000 / this.targetFps; + + /** + * An exponential moving average of the frames per second. + * + * @name Phaser.Core.TimeStep#actualFps + * @type {integer} + * @readonly + * @default 60 + * @since 3.0.0 + */ + this.actualFps = this.targetFps; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#nextFpsUpdate + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.nextFpsUpdate = 0; + + /** + * The number of frames processed this second. + * + * @name Phaser.Core.TimeStep#framesThisSecond + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.framesThisSecond = 0; + + /** + * A callback to be invoked each time the Time Step steps. + * + * @name Phaser.Core.TimeStep#callback + * @type {TimeStepCallback} + * @default NOOP + * @since 3.0.0 + */ + this.callback = NOOP; + + /** + * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting + * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. + * + * @name Phaser.Core.TimeStep#forceSetTimeOut + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); + + /** + * [description] + * + * @name Phaser.Core.TimeStep#time + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.time = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#startTime + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.startTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#lastTime + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.lastTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#frame + * @type {integer} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.frame = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#inFocus + * @type {boolean} + * @readonly + * @default true + * @since 3.0.0 + */ + this.inFocus = true; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#_pauseTime + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._pauseTime = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#_coolDown + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._coolDown = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#delta + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.delta = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaIndex + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.deltaIndex = 0; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaHistory + * @type {integer[]} + * @since 3.0.0 + */ + this.deltaHistory = []; + + /** + * [description] + * + * @name Phaser.Core.TimeStep#deltaSmoothingMax + * @type {integer} + * @default 10 + * @since 3.0.0 + */ + this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); + + /** + * [description] + * + * @name Phaser.Core.TimeStep#panicMax + * @type {integer} + * @default 120 + * @since 3.0.0 + */ + this.panicMax = GetValue(config, 'panicMax', 120); + + /** + * The actual elapsed time in ms between one update and the next. + * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. + * So please be careful when using this value in calculations. + * + * @name Phaser.Core.TimeStep#rawDelta + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.rawDelta = 0; + }, + + /** + * Called when the DOM window.onBlur event triggers. + * + * @method Phaser.Core.TimeStep#blur + * @since 3.0.0 + */ + blur: function () + { + this.inFocus = false; + }, + + /** + * Called when the DOM window.onFocus event triggers. + * + * @method Phaser.Core.TimeStep#focus + * @since 3.0.0 + */ + focus: function () + { + this.inFocus = true; + + this.resetDelta(); + }, + + /** + * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) + * + * @method Phaser.Core.TimeStep#pause + * @since 3.0.0 + */ + pause: function () + { + this._pauseTime = window.performance.now(); + }, + + /** + * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) + * + * @method Phaser.Core.TimeStep#resume + * @since 3.0.0 + */ + resume: function () + { + this.resetDelta(); + + this.startTime += this.time - this._pauseTime; + }, + + /** + * [description] + * + * @method Phaser.Core.TimeStep#resetDelta + * @since 3.0.0 + */ + resetDelta: function () + { + var now = window.performance.now(); + + this.time = now; + this.lastTime = now; + this.nextFpsUpdate = now + 1000; + this.framesThisSecond = 0; + this.frame = 0; + + // Pre-populate smoothing array + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); + } + + this.delta = 0; + this.deltaIndex = 0; + + this._coolDown = this.panicMax; + }, + + /** + * Starts the Time Step running, if it is not already doing so. + * Called automatically by the Game Boot process. + * + * @method Phaser.Core.TimeStep#start + * @since 3.0.0 + * + * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. + */ + start: function (callback) + { + if (this.started) + { + return this; + } + + this.started = true; + this.running = true; + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = this._target; + } + + this.resetDelta(); + + this.startTime = window.performance.now(); + + this.callback = callback; + + this.raf.start(this.step.bind(this), this.forceSetTimeOut); + }, + + /** + * The main step method. This is called each time the browser updates, either by Request Animation Frame, + * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. + * You generally should never call this method directly. + * + * @method Phaser.Core.TimeStep#step + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + */ + step: function (time) + { + var before = time - this.lastTime; + + if (before < 0) + { + // Because, Chrome. + before = 0; + } + + this.rawDelta = before; + + var idx = this.deltaIndex; + var history = this.deltaHistory; + var max = this.deltaSmoothingMax; + + // delta time (time is in ms) + var dt = before; + + // When a browser switches tab, then comes back again, it takes around 10 frames before + // the delta time settles down so we employ a 'cooling down' period before we start + // trusting the delta values again, to avoid spikes flooding through our delta average + + if (this._coolDown > 0 || !this.inFocus) + { + this._coolDown--; + + dt = Math.min(dt, this._target); + } + + if (dt > this._min) + { + // Probably super bad start time or browser tab context loss, + // so use the last 'sane' dt value + + dt = history[idx]; + + // Clamp delta to min (in case history has become corrupted somehow) + dt = Math.min(dt, this._min); + } + + // Smooth out the delta over the previous X frames + + // add the delta to the smoothing array + history[idx] = dt; + + // adjusts the delta history array index based on the smoothing count + // this stops the array growing beyond the size of deltaSmoothingMax + this.deltaIndex++; + + if (this.deltaIndex > max) + { + this.deltaIndex = 0; + } + + // Delta Average + var avg = 0; + + // Loop the history array, adding the delta values together + + for (var i = 0; i < max; i++) + { + avg += history[i]; + } + + // Then divide by the array length to get the average delta + avg /= max; + + // Set as the world delta value + this.delta = avg; + + // Real-world timer advance + this.time += this.rawDelta; + + // Update the estimate of the frame rate, `fps`. Every second, the number + // of frames that occurred in that second are included in an exponential + // moving average of all frames per second, with an alpha of 0.25. This + // means that more recent seconds affect the estimated frame rate more than + // older seconds. + // + // When a browser window is NOT minimized, but is covered up (i.e. you're using + // another app which has spawned a window over the top of the browser), then it + // will start to throttle the raf callback time. It waits for a while, and then + // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. + // So if the game was running at 60fps, and the player opens a new window, then + // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. + // + // When they make the game visible again, the frame rate is increased at a rate of + // approx. 8fps, back up to 60fps (or the max it can obtain) + // + // There is no easy way to determine if this drop in frame rate is because the + // browser is throttling raf, or because the game is struggling with performance + // because you're asking it to do too much on the device. + + if (time > this.nextFpsUpdate) + { + // Compute the new exponential moving average with an alpha of 0.25. + this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; + this.nextFpsUpdate = time + 1000; + this.framesThisSecond = 0; + } + + this.framesThisSecond++; + + // Interpolation - how far between what is expected and where we are? + var interpolation = avg / this._target; + + this.callback(time, avg, interpolation); + + // Shift time value over + this.lastTime = time; + + this.frame++; + }, + + /** + * Manually calls TimeStep.step, passing in the performance.now value to it. + * + * @method Phaser.Core.TimeStep#tick + * @since 3.0.0 + */ + tick: function () + { + this.step(window.performance.now()); + }, + + /** + * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. + * + * @method Phaser.Core.TimeStep#sleep + * @since 3.0.0 + */ + sleep: function () + { + if (this.running) + { + this.raf.stop(); + + this.running = false; + } + }, + + /** + * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. + * The `seamless` argument controls if the wake-up should adjust the start time or not. + * + * @method Phaser.Core.TimeStep#wake + * @since 3.0.0 + * + * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. + */ + wake: function (seamless) + { + if (this.running) + { + this.sleep(); + } + else if (seamless) + { + this.startTime += -this.lastTime + (this.lastTime + window.performance.now()); + } + + this.raf.start(this.step.bind(this), this.useRAF); + + this.running = true; + + this.step(window.performance.now()); + }, + + /** + * Stops the TimeStep running. + * + * @method Phaser.Core.TimeStep#stop + * @since 3.0.0 + * + * @return {Phaser.Core.TimeStep} The TimeStep object. + */ + stop: function () + { + this.running = false; + this.started = false; + + this.raf.stop(); + + return this; + }, + + /** + * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null + * any objects. + * + * @method Phaser.Core.TimeStep#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.stop(); + + this.callback = NOOP; + + this.raf = null; + this.game = null; + } + +}); + +module.exports = TimeStep; + + +/***/ }), +/* 365 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(28); + +/** + * Called automatically by Phaser.Game and responsible for creating the console.log debug header. + * + * You can customize or disable the header via the Game Config object. + * + * @function Phaser.Core.DebugHeader + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. + */ +var DebugHeader = function (game) +{ + var config = game.config; + + if (config.hideBanner) + { + return; + } + + 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; + + var audioType; + + if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + { + audioType = 'Web Audio'; + } + else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + audioType = 'No Audio'; + } + else + { + audioType = 'HTML5 Audio'; + } + + if (!game.device.browser.ie) + { + var c = ''; + var args = [ c ]; + + if (Array.isArray(config.bannerBackgroundColor)) + { + var lastColor; + + config.bannerBackgroundColor.forEach(function (color) + { + c = c.concat('%c '); + + args.push('background: ' + color); + + lastColor = color; + + }); + + // inject the text color + args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + } + else + { + c = c.concat('%c '); + + args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + } + + // URL link background color (always white) + args.push('background: #fff'); + + if (config.gameTitle) + { + c = c.concat(config.gameTitle); + + if (config.gameVersion) + { + c = c.concat(' v' + config.gameVersion); + } + + if (!config.hidePhaser) + { + c = c.concat(' / '); + } + } + + var fb = ( false) ? undefined : ''; + + if (!config.hidePhaser) + { + c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); + } + + c = c.concat(' %c ' + config.gameURL); + + // Inject the new string back into the args array + args[0] = c; + + console.log.apply(console, args); + } + else if (window['console']) + { + console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); + } +}; + +module.exports = DebugHeader; + + +/***/ }), +/* 366 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @since 3.0.0 + */ +var CanvasInterpolation = { + + /** + * 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' ]; + + types.forEach(function (type) + { + canvas.style['image-rendering'] = type; + }); + + canvas.style.msInterpolationMode = 'nearest-neighbor'; + + return canvas; + }, + + /** + * 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'; + + return canvas; + } + +}; + +module.exports = CanvasInterpolation; + + +/***/ }), +/* 367 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasInterpolation = __webpack_require__(366); +var CanvasPool = __webpack_require__(24); +var CONST = __webpack_require__(28); +var Features = __webpack_require__(187); + +/** + * 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.Core.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; + + if ((config.customEnvironment || config.canvas) && config.renderType === CONST.AUTO) + { + throw new Error('Must set explicit renderType in custom environment'); + } + + // Not a custom environment, didn't provide their own canvas and not headless, so determine the renderer: + if (!config.customEnvironment && !config.canvas && 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.antialias) + { + CanvasPool.disableSmoothing(); + } + + var baseSize = game.scale.baseSize; + + var width = baseSize.width; + var height = baseSize.height; + + // Does the game config provide its own canvas element to use? + if (config.canvas) + { + game.canvas = config.canvas; + + game.canvas.width = width; + game.canvas.height = height; + } + else + { + game.canvas = CanvasPool.create(game, width, 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.antialias) + { + CanvasInterpolation.setCrisp(game.canvas); + } + + if (config.renderType === CONST.HEADLESS) + { + // Nothing more to do here + return; + } + + var CanvasRenderer; + var WebGLRenderer; + + if (true) + { + CanvasRenderer = __webpack_require__(459); + WebGLRenderer = __webpack_require__(456); + + // Let the config pick the renderer type, as both are included + if (config.renderType === CONST.WEBGL) + { + game.renderer = new WebGLRenderer(game); + } + else + { + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } + } + + if (false) + {} + + if (false) + {} +}; + +module.exports = CreateRenderer; + + +/***/ }), +/* 368 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(182); +var Matrix3 = __webpack_require__(370); + +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 + * A quaternion. + * + * @class Quaternion + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +var Quaternion = new Class({ + + initialize: + + function Quaternion (x, y, z, w) + { + /** + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The y component of this Quaternion. + * + * @name Phaser.Math.Quaternion#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The z component of this Quaternion. + * + * @name Phaser.Math.Quaternion#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The w component of this Quaternion. + * + * @name Phaser.Math.Quaternion#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; + } + }, + + /** + * Copy the components of a given Quaternion or Vector into this Quaternion. + * + * @method Phaser.Math.Quaternion#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z; + this.w = src.w; + + return this; + }, + + /** + * Set the components of this Quaternion. + * + * @method Phaser.Math.Quaternion#set + * @since 3.0.0 + * + * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=0] - The w component. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + set: function (x, y, z, w) + { + 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; + }, + + /** + * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. + * + * @method Phaser.Math.Quaternion#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z; + this.w += v.w; + + return this; + }, + + /** + * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. + * + * @method Phaser.Math.Quaternion#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + this.w -= v.w; + + return this; + }, + + /** + * Scale this Quaternion by the given value. + * + * @method Phaser.Math.Quaternion#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + scale: function (scale) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; + + return this; + }, + + /** + * Calculate the length of this Quaternion. + * + * @method Phaser.Math.Quaternion#length + * @since 3.0.0 + * + * @return {number} The length of this Quaternion. + */ + length: function () + { + 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); + }, + + /** + * Calculate the length of this Quaternion squared. + * + * @method Phaser.Math.Quaternion#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Quaternion, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return x * x + y * y + z * z + w * w; + }, + + /** + * Normalize this Quaternion. + * + * @method Phaser.Math.Quaternion#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + + 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; + }, + + /** + * Calculate the dot product of this Quaternion and the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#dot + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. + * + * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, + + /** + * Linearly interpolate this Quaternion towards the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#lerp + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. + * @param {number} [t=0] - The percentage of interpolation. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + lerp: function (v, t) + { + 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; + }, + + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotationTo + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - [description] + * @param {Phaser.Math.Vector3} b - [description] + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotationTo: function (a, b) + { + 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(); + + 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(); + } + }, + + /** + * Set the axes of this Quaternion. + * + * @method Phaser.Math.Quaternion#setAxes + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} view - The view axis. + * @param {Phaser.Math.Vector3} right - The right axis. + * @param {Phaser.Math.Vector3} up - The upwards axis. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setAxes: function (view, right, up) + { + var m = tmpMat3.val; + + 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(); + }, + + /** + * Reset this Matrix to an identity (default) Quaternion. + * + * @method Phaser.Math.Quaternion#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + identity: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + + return this; + }, + + /** + * Set the axis angle of this Quaternion. + * + * @method Phaser.Math.Quaternion#setAxisAngle + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} axis - The axis. + * @param {number} rad - The angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setAxisAngle: function (axis, rad) + { + 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; + }, + + /** + * Multiply this Quaternion by the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + multiply: function (b) + { + 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; + + 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; + }, + + /** + * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. + * + * @method Phaser.Math.Quaternion#slerp + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. + * @param {number} t - The percentage of interpolation. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + slerp: function (b, t) + { + // 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) + { + cosom = -cosom; + bx = - bx; + by = - by; + bz = - bz; + bw = - bw; + } + + // "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) + { + // 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; + }, + + /** + * Invert this Quaternion. + * + * @method Phaser.Math.Quaternion#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + invert: 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 + + this.x = -a0 * invDot; + this.y = -a1 * invDot; + this.z = -a2 * invDot; + this.w = a3 * invDot; + + return this; + }, + + /** + * Convert this Quaternion into its conjugate. + * + * Sets the x, y and z components. + * + * @method Phaser.Math.Quaternion#conjugate + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + conjugate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Rotate this Quaternion on the X axis. + * + * @method Phaser.Math.Quaternion#rotateX + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotateX: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this Quaternion on the Y axis. + * + * @method Phaser.Math.Quaternion#rotateY + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + }, + + /** + * Rotate this Quaternion on the Z axis. + * + * @method Phaser.Math.Quaternion#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The rotation angle in radians. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + rotateZ: function (rad) + { + 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); + + 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; + }, + + /** + * Create a unit (or rotation) Quaternion from its x, y, and z components. + * + * Sets the w component. + * + * @method Phaser.Math.Quaternion#calculateW + * @since 3.0.0 + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + calculateW: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); + + return this; + }, + + /** + * Convert the given Matrix into this Quaternion. + * + * @method Phaser.Math.Quaternion#fromMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + 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; + + +/***/ }), +/* 369 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 EPSILON = 0.000001; + +/** + * @classdesc + * A four-dimensional matrix. + * + * @class Matrix4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. + */ +var Matrix4 = new Class({ + + initialize: + + function Matrix4 (m) + { + /** + * The matrix values. + * + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(16); + + if (m) + { + // Assume Matrix4 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, + + /** + * Make a clone of this Matrix4. + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} A clone of this Matrix4. + */ + clone: function () + { + return new Matrix4(this); + }, + + // TODO - Should work with basic values + + /** + * This method is an alias for `Matrix4.copy`. + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + copy: function (src) + { + 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]; + 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; + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix4#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromArray: function (a) + { + 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; + }, + + /** + * Reset this Matrix. + * + * Sets all values to `0`. + * + * @method Phaser.Math.Matrix4#zero + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + zero: function () + { + 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; + + return this; + }, + + /** + * Set the `x`, `y` and `z` values of this Matrix. + * + * @method Phaser.Math.Matrix4#xyz + * @since 3.0.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + xyz: function (x, y, z) + { + this.identity(); + + var out = this.val; + + out[12] = x; + out[13] = y; + out[14] = z; + + return this; + }, + + /** + * Set the scaling values of this Matrix. + * + * @method Phaser.Math.Matrix4#scaling + * @since 3.0.0 + * + * @param {number} x - The x scaling value. + * @param {number} y - The y scaling value. + * @param {number} z - The z scaling value. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scaling: function (x, y, z) + { + this.zero(); + + var out = this.val; + + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; + + return this; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix4#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + identity: function () + { + 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; + + return this; + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix4#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + transpose: function () + { + 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; + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix4#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + invert: 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 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; + + return this; + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix4#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + adjoint: 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)); + + return this; + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix4#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: 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 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; + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix4#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + multiply: function (src) + { + 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; + + 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.Math.Matrix4#multiplyLocal + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - [description] + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + multiplyLocal: function (src) + { + 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); + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix4#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + translate: function (v) + { + var x = v.x; + var y = v.y; + var z = v.z; + var a = this.val; + + 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; + }, + + /** + * Translate this Matrix using the given values. + * + * @method Phaser.Math.Matrix4#translateXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + translateXYZ: function (x, y, z) + { + var a = this.val; + + 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; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix4#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scale: 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; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#scaleXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + scaleXYZ: function (x, y, 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; + + return this; + }, + + /** + * Derive a rotation matrix around the given axis. + * + * @method Phaser.Math.Matrix4#makeRotationAxis + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. + * @param {number} angle - The rotation angle in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + makeRotationAxis: function (axis, angle) + { + // 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.fromArray([ + 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; + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotate: function (rad, axis) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its X axis. + * + * @method Phaser.Math.Matrix4#rotateX + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateX: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its Y axis. + * + * @method Phaser.Math.Matrix4#rotateY + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateY: function (rad) + { + 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; + + return this; + }, + + /** + * Rotate this matrix on its Z axis. + * + * @method Phaser.Math.Matrix4#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + rotateZ: function (rad) + { + 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]; + + // 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; + }, + + /** + * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * + * @method Phaser.Math.Matrix4#fromRotationTranslation + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. + * @param {Phaser.Math.Vector3} v - The Vector to set translation from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromRotationTranslation: function (q, v) + { + // 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; + + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + + out[12] = v.x; + out[13] = v.y; + out[14] = v.z; + out[15] = 1; + + return this; + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix4#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + fromQuat: function (q) + { + 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; + + 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[15] = 1; + + return this; + }, + + /** + * Generate a frustum matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#frustum + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + frustum: function (left, right, bottom, top, near, far) + { + 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; + + 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; + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspective + * @since 3.0.0 + * + * @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. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + perspective: function (fovy, aspect, near, far) + { + 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; + + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + + return this; + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspectiveLH + * @since 3.0.0 + * + * @param {number} width - The width of the frustum. + * @param {number} height - The height of the frustum. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + perspectiveLH: function (width, height, near, far) + { + 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; + + out[12] = 0; + out[13] = 0; + out[14] = (near * far) / (near - far); + out[15] = 0; + + return this; + }, + + /** + * Generate an orthogonal projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#ortho + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + ortho: function (left, right, bottom, top, near, far) + { + 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; + + 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; + }, + + /** + * Generate a look-at matrix with the given eye position, focal point, and up axis. + * + * @method Phaser.Math.Matrix4#lookAt + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer + * @param {Phaser.Math.Vector3} center - Point the viewer is looking at + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + lookAt: function (eye, center, up) + { + var out = this.val; + + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; + + var upx = up.x; + var upy = up.y; + var upz = up.z; + + 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(); + } + + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + + z0 *= len; + z1 *= len; + z2 *= len; + + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + + if (!len) + { + y0 = 0; + y1 = 0; + y2 = 0; + } + else + { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + 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; + }, + + /** + * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. + * + * @method Phaser.Math.Matrix4#yawPitchRoll + * @since 3.0.0 + * + * @param {number} yaw - [description] + * @param {number} pitch - [description] + * @param {number} roll - [description] + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + yawPitchRoll: function (yaw, pitch, roll) + { + 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; + }, + + /** + * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. + * + * @method Phaser.Math.Matrix4#setWorldMatrix + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. + * @param {Phaser.Math.Vector3} position - The position of the world matrix. + * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. + * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. + * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + { + 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) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix !== undefined) + { + this.multiplyLocal(projectionMatrix); + } + + return this; + } + +}); + +var _tempMat1 = new Matrix4(); +var _tempMat2 = new Matrix4(); + +module.exports = Matrix4; + + +/***/ }), +/* 370 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 + * A three-dimensional matrix. + * + * Defaults to the identity matrix when instantiated. + * + * @class Matrix3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. + */ +var Matrix3 = new Class({ + + initialize: + + function Matrix3 (m) + { + /** + * The matrix values. + * + * @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(); + } + }, + + /** + * Make a clone of this Matrix3. + * + * @method Phaser.Math.Matrix3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} A clone of this Matrix3. + */ + clone: function () + { + return new Matrix3(this); + }, + + /** + * This method is an alias for `Matrix3.copy`. + * + * @method Phaser.Math.Matrix3#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix3#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + copy: function (src) + { + 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; + }, + + /** + * Copy the values of a given Matrix4 into this Matrix3. + * + * @method Phaser.Math.Matrix3#fromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromMat4: function (m) + { + 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; + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix3#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromArray: function (a) + { + 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; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix3#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + 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; + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix3#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + transpose: function () + { + 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; + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix3#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + invert: 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 a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + + 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; + + if (!det) + { + 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; + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix3#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + adjoint: 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 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; + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix3#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: 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 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); + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix3#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + multiply: function (src) + { + 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]; + + 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; + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix3#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + translate: function (v) + { + var a = this.val; + var x = v.x; + var y = v.y; + + 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; + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix3#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + rotate: function (rad) + { + 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; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x` and `y` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix3#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + scale: function (v) + { + 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; + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix3#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromQuat: function (q) + { + 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; + + out[2] = xz + wy; + out[5] = yz - wx; + out[8] = 1 - (xx + yy); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Math.Matrix3#normalFromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - [description] + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + normalFromMat4: function (m) + { + 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; + + 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; + + 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; + + +/***/ }), +/* 371 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Takes the `x` and `y` coordinates and transforms them into the same space as + * defined by the position, rotation and scale values. + * + * @function Phaser.Math.TransformXY + * @since 3.0.0 + * + * @param {number} x - The x coordinate to be transformed. + * @param {number} y - The y coordinate to be transformed. + * @param {number} positionX - Horizontal position of the transform point. + * @param {number} positionY - Vertical position of the transform point. + * @param {number} rotation - Rotation of the transform point, in radians. + * @param {number} scaleX - Horizontal scale of the transform point. + * @param {number} scaleY - Vertical scale of the transform point. + * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. + * + * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. + */ +var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) +{ + if (output === undefined) { output = new Vector2(); } + + var radianSin = Math.sin(rotation); + var radianCos = Math.cos(rotation); + + // Rotate and Scale + var a = radianCos * scaleX; + var b = radianSin * scaleX; + var c = -radianSin * scaleY; + var d = radianCos * scaleY; + + // Invert + var id = 1 / ((a * d) + (c * -b)); + + output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); + output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); + + return output; +}; + +module.exports = TransformXY; + + +/***/ }), +/* 372 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * + * @function Phaser.Math.RoundAwayFromZero + * @since 3.0.0 + * + * @param {number} value - The number to round. + * + * @return {number} The rounded number, rounded away from zero. + */ +var RoundAwayFromZero = function (value) +{ + // "Opposite" of truncate. + return (value > 0) ? Math.ceil(value) : Math.floor(value); +}; + +module.exports = RoundAwayFromZero; + + +/***/ }), +/* 373 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. + * + * @function Phaser.Math.Rotate + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. + * @param {number} angle - The angle to be rotated by in an anticlockwise direction. + * + * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. + */ +var Rotate = function (point, angle) +{ + var x = point.x; + var y = point.y; + + point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); + point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); + + return point; +}; + +module.exports = Rotate; + + +/***/ }), +/* 374 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. + * + * @function Phaser.Math.FloatBetween + * @since 3.0.0 + * + * @param {number} min - The lower bound for the float, inclusive. + * @param {number} max - The upper bound for the float exclusive. + * + * @return {number} A random float within the given range. + */ +var FloatBetween = function (min, max) +{ + return Math.random() * (max - min) + min; +}; + +module.exports = FloatBetween; + + +/***/ }), +/* 375 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using ceil. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. + * As will `14` snap to `15`... but `16` will snap to `20`. + * + * @function Phaser.Math.Snap.Ceil + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapCeil = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.ceil(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapCeil; + + +/***/ }), +/* 376 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Returns the nearest power of 2 to the given `value`. + * + * @function Phaser.Math.Pow2.GetPowerOfTwo + * @since 3.0.0 + * + * @param {number} value - The value. + * + * @return {integer} The nearest power of 2 to `value`. + */ +var GetPowerOfTwo = function (value) +{ + var index = Math.log(value) / 0.6931471805599453; + + return (1 << Math.ceil(index)); +}; + +module.exports = GetPowerOfTwo; + + +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SmoothStep = __webpack_require__(195); + +/** + * A Smooth Step interpolation method. + * + * @function Phaser.Math.Interpolation.SmoothStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep} + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The interpolated value. + */ +var SmoothStepInterpolation = function (t, min, max) +{ + return min + (max - min) * SmoothStep(t, 0, 1); +}; + +module.exports = SmoothStepInterpolation; + + +/***/ }), +/* 378 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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 * p; +} + +function P1 (t, p) +{ + return 2 * (1 - t) * t * p; +} + +function P2 (t, p) +{ + return t * t * p; +} + +// p0 = start point +// p1 = control point 1 +// p2 = end point + +// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js + +/** + * A quadratic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.QuadraticBezier + * @since 3.2.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The control point. + * @param {number} p2 - The end point. + * + * @return {number} The interpolated value. + */ +var QuadraticBezierInterpolation = function (t, p0, p1, p2) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2); +}; + +module.exports = QuadraticBezierInterpolation; + + +/***/ }), +/* 379 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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 + +/** + * A cubic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.CubicBezier + * @since 3.0.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The first control point. + * @param {number} p2 - The second control point. + * @param {number} p3 - The end point. + * + * @return {number} The interpolated value. + */ +var CubicBezierInterpolation = function (t, p0, p1, p2, p3) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); +}; + +module.exports = CubicBezierInterpolation; + + +/***/ }), +/* 380 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the factorial of a given number for integer values greater than 0. + * + * @function Phaser.Math.Factorial + * @since 3.0.0 + * + * @param {number} value - A positive integer to calculate the factorial of. + * + * @return {number} The factorial of the given number. + */ +var Factorial = function (value) +{ + if (value === 0) + { + return 1; + } + + var res = value; + + while (--value) + { + res *= value; + } + + return res; +}; + +module.exports = Factorial; + + +/***/ }), +/* 381 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Factorial = __webpack_require__(380); + +/** + * [description] + * + * @function Phaser.Math.Bernstein + * @since 3.0.0 + * + * @param {number} n - [description] + * @param {number} i - [description] + * + * @return {number} [description] + */ +var Bernstein = function (n, i) +{ + return Factorial(n) / Factorial(i) / Factorial(n - i); +}; + +module.exports = Bernstein; + + +/***/ }), +/* 382 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether `a` is fuzzily less than `b`. + * + * `a` is fuzzily less than `b` if it is less than `b + epsilon`. + * + * @function Phaser.Math.Fuzzy.LessThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. + */ +var LessThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return a < b + epsilon; +}; + +module.exports = LessThan; + + +/***/ }), +/* 383 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check whether `a` is fuzzily greater than `b`. + * + * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. + * + * @function Phaser.Math.Fuzzy.GreaterThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. + */ +var GreaterThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return a > b - epsilon; +}; + +module.exports = GreaterThan; + + +/***/ }), +/* 384 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the distance between two sets of coordinates (points), squared. + * + * @function Phaser.Math.Distance.Squared + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The distance between each point, squared. + */ +var DistanceSquared = function (x1, y1, x2, y2) +{ + var dx = x1 - x2; + var dy = y1 - y2; + + return dx * dx + dy * dy; +}; + +module.exports = DistanceSquared; + + +/***/ }), +/* 385 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Normalize an angle to the [0, 2pi] range. + * + * @function Phaser.Math.Angle.Normalize + * @since 3.0.0 + * + * @param {number} angle - The angle to normalize, in radians. + * + * @return {number} The normalized angle, in radians. + */ +var Normalize = function (angle) +{ + angle = angle % (2 * Math.PI); + + if (angle >= 0) + { + return angle; + } + else + { + return angle + 2 * Math.PI; + } +}; + +module.exports = Normalize; + + +/***/ }), +/* 386 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * @function Phaser.Math.Angle.Between + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var Between = function (x1, y1, x2, y2) +{ + return Math.atan2(y2 - y1, x2 - x1); +}; + +module.exports = Between; + + +/***/ }), +/* 387 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); +var Extend = __webpack_require__(19); + +/** + * @namespace Phaser.Math + */ + +var PhaserMath = { + + // Collections of functions + Angle: __webpack_require__(1091), + Distance: __webpack_require__(1083), + Easing: __webpack_require__(1081), + Fuzzy: __webpack_require__(1080), + Interpolation: __webpack_require__(1077), + Pow2: __webpack_require__(1072), + Snap: __webpack_require__(1070), + + // Expose the RNG Class + RandomDataGenerator: __webpack_require__(1068), + + // Single functions + Average: __webpack_require__(1067), + Bernstein: __webpack_require__(381), + Between: __webpack_require__(184), + CatmullRom: __webpack_require__(185), + CeilTo: __webpack_require__(1066), + Clamp: __webpack_require__(23), + DegToRad: __webpack_require__(34), + Difference: __webpack_require__(1065), + Factorial: __webpack_require__(380), + FloatBetween: __webpack_require__(374), + FloorTo: __webpack_require__(1064), + FromPercent: __webpack_require__(100), + GetSpeed: __webpack_require__(1063), + IsEven: __webpack_require__(1062), + IsEvenStrict: __webpack_require__(1061), + Linear: __webpack_require__(129), + MaxAdd: __webpack_require__(1060), + MinSub: __webpack_require__(1059), + Percent: __webpack_require__(1058), + RadToDeg: __webpack_require__(183), + RandomXY: __webpack_require__(1057), + RandomXYZ: __webpack_require__(1056), + RandomXYZW: __webpack_require__(1055), + Rotate: __webpack_require__(373), + RotateAround: __webpack_require__(428), + RotateAroundDistance: __webpack_require__(197), + RoundAwayFromZero: __webpack_require__(372), + RoundTo: __webpack_require__(1054), + SinCosTableGenerator: __webpack_require__(1053), + SmootherStep: __webpack_require__(196), + SmoothStep: __webpack_require__(195), + TransformXY: __webpack_require__(371), + Within: __webpack_require__(1052), + Wrap: __webpack_require__(57), + + // Vector classes + Vector2: __webpack_require__(3), + Vector3: __webpack_require__(182), + Vector4: __webpack_require__(1051), + Matrix3: __webpack_require__(370), + Matrix4: __webpack_require__(369), + Quaternion: __webpack_require__(368), + RotateVec3: __webpack_require__(1050) + +}; + +// Merge in the consts + +PhaserMath = Extend(false, PhaserMath, CONST); + +// Export it + +module.exports = PhaserMath; + + +/***/ }), +/* 388 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(24); + +/** + * 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. + * + * @typedef {object} Phaser.Device.CanvasFeatures + * @since 3.0.0 + * + * @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 = { + + supportInverseAlpha: false, + supportNewBlendModes: false + +}; + +function checkBlendMode () +{ + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; + + var magenta = new Image(); + + magenta.onload = function () + { + var yellow = new Image(); + + yellow.onload = function () + { + var canvas = CanvasPool.create(yellow, 6, 1); + var context = canvas.getContext('2d'); + + context.globalCompositeOperation = 'multiply'; + + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + if (!context.getImageData(2, 0, 1, 1)) + { + return false; + } + + var data = context.getImageData(2, 0, 1, 1).data; + + CanvasPool.remove(yellow); + + CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); + }; + + yellow.src = pngHead + '/wCKxvRF' + pngEnd; + }; + + magenta.src = pngHead + 'AP804Oa6' + pngEnd; + + return false; +} + +function checkInverseAlpha () +{ + var canvas = CanvasPool.create(this, 2, 1); + var context = canvas.getContext('2d'); + + context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + + // Draw a single pixel + context.fillRect(0, 0, 1, 1); + + // Get the color values + var s1 = context.getImageData(0, 0, 1, 1); + + if (s1 === null) + { + return false; + } + + // Plot them to x2 + context.putImageData(s1, 1, 0); + + // 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) + { + CanvasFeatures.supportNewBlendModes = checkBlendMode(); + CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + } + + return CanvasFeatures; +} + +module.exports = init(); + + +/***/ }), +/* 389 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// This singleton is instantiated as soon as Phaser loads, +// before a Phaser.Game instance has even been created. +// Which means all instances of Phaser Games can share it, +// without having to re-poll the device all over again + +/** + * @namespace Phaser.Device + * @since 3.0.0 + */ + +/** + * @typedef {object} Phaser.DeviceConf + * + * @property {Phaser.Device.OS} os - The OS Device functions. + * @property {Phaser.Device.Browser} browser - The Browser Device functions. + * @property {Phaser.Device.Features} features - The Features Device functions. + * @property {Phaser.Device.Input} input - The Input Device functions. + * @property {Phaser.Device.Audio} audio - The Audio Device functions. + * @property {Phaser.Device.Video} video - The Video Device functions. + * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. + * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. + */ + +module.exports = { + + os: __webpack_require__(99), + browser: __webpack_require__(128), + features: __webpack_require__(187), + input: __webpack_require__(1095), + audio: __webpack_require__(1094), + video: __webpack_require__(1093), + fullscreen: __webpack_require__(1092), + canvasFeatures: __webpack_require__(388) + +}; + + +/***/ }), +/* 390 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(28); +var Device = __webpack_require__(389); +var GetFastValue = __webpack_require__(2); +var GetValue = __webpack_require__(4); +var IsPlainObject = __webpack_require__(8); +var PhaserMath = __webpack_require__(387); +var NOOP = __webpack_require__(1); +var DefaultPlugins = __webpack_require__(181); +var ValueToColor = __webpack_require__(192); + +/** + * This callback type is completely empty, a no-operation. + * + * @callback NOOP + */ + +/** + * @callback BootCallback + * + * @param {Phaser.Game} game - The game. + */ + +/** + * Config object containing various sound settings. + * + * @typedef {object} AudioConfig + * + * @property {boolean} [disableWebAudio=false] - Use HTML5 Audio instead of Web Audio. + * @property {AudioContext} [context] - An existing Web Audio context. + * @property {boolean} [noAudio=false] - Disable all audio output. + * + * @see Phaser.Sound.SoundManagerCreator + */ + +/** + * @typedef {object} InputConfig + * + * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. + * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. + * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. + * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. + * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. + * @property {number} [smoothFactor=0] - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + * @property {boolean} [inputQueue=false] - Should Phaser use a queued input system for native DOM Events or not? + */ + +/** + * @typedef {object} MouseInputConfig + * + * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether mouse input events have `preventDefault` called on them. + */ + +/** + * @typedef {object} KeyboardInputConfig + * + * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. + * @property {?integer} [capture] - `preventDefault` will be called on every non-modified key which has a key code in this array. By default it is empty. + */ + +/** + * @typedef {object} TouchInputConfig + * + * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. + */ + +/** + * @typedef {object} GamepadInputConfig + * + * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. + */ + +/** + * @typedef {object} BannerConfig + * + * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. + * @property {string} [text='#ffffff'] - The color of the banner text. + * @property {string[]} [background] - The background colors of the banner. + */ + +/** + * @typedef {object} FPSConfig + * + * @property {integer} [min=5] - The minimum acceptable rendering rate, in frames per second. + * @property {integer} [target=60] - The optimum rendering rate, in frames per second. + * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. + * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. + * @property {integer} [panicMax=120] - The amount of frames the time step counts before we trust the delta values again. + */ + +/** + * @typedef {object} RenderConfig + * + * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. + * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. + * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. + * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. + * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + * @property {integer} [batchSize=2000] - The default WebGL batch size. + * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + +/** + * @typedef {object} WidthHeight + * + * @property {integer} [width=0] - The width. + * @property {integer} [height=0] - The height. + */ + +/** + * @typedef {object} ScaleConfig + * + * @property {(integer|string)} [width=1024] - The base width of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(integer|string)} [height=768] - The base height of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(Phaser.Scale.ZoomType|integer)} [zoom=1] - The zoom value of the game canvas. + * @property {number} [resolution=1] - The rendering resolution of the canvas. This is reserved for future use and is currently ignored. + * @property {?(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If undefined, or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {boolean} [expandParent=true] - Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%? + * @property {Phaser.Scale.ScaleModeType} [mode=Phaser.Scale.ScaleModes.NONE] - The scale mode. + * @property {WidthHeight} [min] - The minimum width and height the canvas can be scaled down to. + * @property {WidthHeight} [max] - The maximum width the canvas can be scaled up to. + * @property {boolean} [autoRound=false] - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * @property {Phaser.Scale.CenterType} [autoCenter=Phaser.Scale.Center.NO_CENTER] - Automatically center the canvas within the parent? + * @property {integer} [resizeInterval=500] - How many ms should elapse before checking if the browser size has changed? + * @property {?(HTMLElement|string)} [fullscreenTarget] - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + +/** + * @typedef {object} CallbacksConfig + * + * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. + * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + +/** + * @typedef {object} LoaderConfig + * + * @property {string} [baseURL] - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + * @property {string} [path] - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. + * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. + * @property {boolean} [async=true] - Should the XHR request use async or not? + * @property {string} [user] - Optional username for all XHR requests. + * @property {string} [password] - Optional password for all XHR requests. + * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. + */ + +/** + * @typedef {object} DOMContainerConfig + * + * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. + * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. + */ + +/** + * @typedef {object} ImagesConfig + * + * @property {string} [default] - URL to use for the 'default' texture. + * @property {string} [missing] - URL to use for the 'missing' texture. + */ + +/** + * @typedef {object} PhysicsConfig + * + * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. + * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. + * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. + * @property {object} [matter] - Matter Physics configuration. + */ + +/** + * @typedef {object} PluginObjectItem + * + * @property {string} [key] - A key to identify the plugin in the Plugin Manager. + * @property {*} [plugin] - The plugin itself. Usually a class/constructor. + * @property {boolean} [start] - Whether the plugin should be started automatically. + * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). + * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). + * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @property {*} [data] - Arbitrary data passed to the plugin's init() method. + * + * @example + * // Global plugin + * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } + * @example + * // Scene plugin + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + */ + +/** + * @typedef {object} PluginObject + * + * @property {?PluginObjectItem[]} [global] - Global plugins to install. + * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. + * @property {string[]} [default] - The default set of scene plugins (names). + * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. + */ + +/** + * @typedef {object} GameConfig + * + * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. + * @property {(integer|string)} [height=768] - The height of the game, in game pixels. + * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. + * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. + * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. + * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If undefined or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. + * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. + * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. + * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. + * @property {string[]} [seed] - Seed for the random number generator. + * @property {string} [title=''] - The title of the game. Shown in the browser console. + * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. + * @property {string} [version=''] - The version of the game. Shown in the browser console. + * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. + * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. + * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). + * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. + * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. + * @property {FPSConfig} [fps] - Game loop configuration. + * @property {RenderConfig} [render] - Game renderer configuration. + * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. + * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. + * @property {LoaderConfig} [loader] - Loader configuration. + * @property {ImagesConfig} [images] - Images configuration. + * @property {object} [physics] - Physics configuration. + * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. + * @property {ScaleConfig} [scale] - The Scale Manager configuration. + */ + +/** + * @classdesc + * The active game configuration settings, parsed from a {@link GameConfig} object. + * + * @class Config + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * + * @see Phaser.Game#config + */ +var Config = new Class({ + + initialize: + + function Config (config) + { + if (config === undefined) { config = {}; } + + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; + + var defaultBannerTextColor = '#ffffff'; + + /** + * @const {(integer|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + */ + this.width = GetValue(config, 'width', 1024); + + /** + * @const {(integer|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + */ + this.height = GetValue(config, 'height', 768); + + /** + * @const {(Phaser.Scale.ZoomType|integer)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + */ + this.zoom = GetValue(config, 'zoom', 1); + + /** + * @const {number} Phaser.Core.Config#resolution - The canvas device pixel resolution. Currently un-used. + */ + this.resolution = GetValue(config, 'resolution', 1); + + /** + * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. + */ + this.parent = GetValue(config, 'parent', undefined); + + /** + * @const {Phaser.Scale.ScaleModeType} Phaser.Core.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. + */ + this.scaleMode = GetValue(config, 'scaleMode', 0); + + /** + * @const {boolean} Phaser.Core.Config#expandParent - Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%? + */ + this.expandParent = GetValue(config, 'expandParent', true); + + /** + * @const {integer} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + */ + this.autoRound = GetValue(config, 'autoRound', false); + + /** + * @const {Phaser.Scale.CenterType} Phaser.Core.Config#autoCenter - Automatically center the canvas within the parent? + */ + this.autoCenter = GetValue(config, 'autoCenter', 0); + + /** + * @const {integer} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + */ + this.resizeInterval = GetValue(config, 'resizeInterval', 500); + + /** + * @const {?(HTMLElement|string)} Phaser.Core.Config#fullscreenTarget - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); + + /** + * @const {integer} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minWidth = GetValue(config, 'minWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxWidth = GetValue(config, 'maxWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minHeight = GetValue(config, 'minHeight', 0); + + /** + * @const {integer} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxHeight = GetValue(config, 'maxHeight', 0); + + // Scale Manager - Anything set in here over-rides anything set above + + var scaleConfig = GetValue(config, 'scale', null); + + if (scaleConfig) + { + this.width = GetValue(scaleConfig, 'width', this.width); + this.height = GetValue(scaleConfig, 'height', this.height); + this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); + this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); + this.parent = GetValue(scaleConfig, 'parent', this.parent); + this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); + this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); + this.autoRound = GetValue(scaleConfig, 'autoRound', this.autoRound); + this.autoCenter = GetValue(scaleConfig, 'autoCenter', this.autoCenter); + this.resizeInterval = GetValue(scaleConfig, 'resizeInterval', this.resizeInterval); + this.fullscreenTarget = GetValue(scaleConfig, 'fullscreenTarget', this.fullscreenTarget); + this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); + this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); + this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); + this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); + } + + /** + * @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) + */ + this.renderType = GetValue(config, 'type', CONST.AUTO); + + /** + * @const {?HTMLCanvasElement} Phaser.Core.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. + */ + this.canvas = GetValue(config, 'canvas', null); + + /** + * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Core.Config#context - Force Phaser to use your own Canvas context instead of creating one. + */ + this.context = GetValue(config, 'context', null); + + /** + * @const {?string} Phaser.Core.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. + */ + this.canvasStyle = GetValue(config, 'canvasStyle', null); + + /** + * @const {boolean} Phaser.Core.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. + */ + this.customEnvironment = GetValue(config, 'customEnvironment', false); + + /** + * @const {?object} Phaser.Core.Config#sceneConfig - The default Scene configuration object. + */ + this.sceneConfig = GetValue(config, 'scene', null); + + /** + * @const {string[]} Phaser.Core.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. + */ + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + + PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); + + /** + * @const {string} Phaser.Core.Config#gameTitle - The title of the game. + */ + this.gameTitle = GetValue(config, 'title', ''); + + /** + * @const {string} Phaser.Core.Config#gameURL - The URL of the game. + */ + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); + + /** + * @const {string} Phaser.Core.Config#gameVersion - The version of the game. + */ + this.gameVersion = GetValue(config, 'version', ''); + + /** + * @const {boolean} Phaser.Core.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. + */ + this.autoFocus = GetValue(config, 'autoFocus', true); + + // DOM Element Container + + /** + * @const {?boolean} Phaser.Core.Config#domCreateContainer - EXPERIMENTAL: Do not currently use. + */ + this.domCreateContainer = GetValue(config, 'dom.createContainer', false); + + /** + * @const {?boolean} Phaser.Core.Config#domBehindCanvas - EXPERIMENTAL: Do not currently use. + */ + this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); + + // Input + + /** + * @const {boolean} Phaser.Core.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. + */ + this.inputKeyboard = GetValue(config, 'input.keyboard', true); + + /** + * @const {*} Phaser.Core.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. + */ + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + + /** + * @const {?integer[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + */ + this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); + + /** + * @const {(boolean|object)} Phaser.Core.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. + */ + this.inputMouse = GetValue(config, 'input.mouse', true); + + /** + * @const {?*} Phaser.Core.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. + */ + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. + */ + this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + + /** + * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. + */ + this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); + + /** + * @const {?*} Phaser.Core.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. + */ + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. + */ + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + + /** + * @const {integer} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + */ + this.inputActivePointers = GetValue(config, 'input.activePointers', 1); + + /** + * @const {integer} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + */ + this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); + + /** + * @const {boolean} Phaser.Core.Config#inputQueue - Should Phaser use a queued input system for native DOM Events or not? + */ + this.inputQueue = GetValue(config, 'input.queue', false); + + /** + * @const {boolean} Phaser.Core.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. + */ + this.inputGamepad = GetValue(config, 'input.gamepad', false); + + /** + * @const {*} Phaser.Core.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. + */ + this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); + + /** + * @const {boolean} Phaser.Core.Config#disableContextMenu - Set to `true` to disable the right-click context menu. + */ + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + + /** + * @const {AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. + */ + this.audio = GetValue(config, 'audio'); + + // If you do: { banner: false } it won't display any banner at all + + /** + * @const {boolean} Phaser.Core.Config#hideBanner - Don't write the banner line to the console.log. + */ + this.hideBanner = (GetValue(config, 'banner', null) === false); + + /** + * @const {boolean} Phaser.Core.Config#hidePhaser - Omit Phaser's name and version from the banner. + */ + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + + /** + * @const {string} Phaser.Core.Config#bannerTextColor - The color of the banner text. + */ + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + + /** + * @const {string[]} Phaser.Core.Config#bannerBackgroundColor - The background colors of the banner. + */ + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } + + /** + * @const {?FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + */ + this.fps = GetValue(config, 'fps', null); + + // Renderer Settings + // These can either be in a `render` object within the Config, or specified on their own + + var renderConfig = GetValue(config, 'render', config); + + /** + * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + */ + this.antialias = GetValue(renderConfig, 'antialias', true); + + /** + * @const {boolean} Phaser.Core.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + */ + this.roundPixels = GetValue(renderConfig, 'roundPixels', false); + + /** + * @const {boolean} Phaser.Core.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). + */ + this.pixelArt = GetValue(renderConfig, 'pixelArt', this.zoom !== 1); + + if (this.pixelArt) + { + this.antialias = false; + this.roundPixels = true; + } + + /** + * @const {boolean} Phaser.Core.Config#transparent - Whether the game canvas will have a transparent background. + */ + this.transparent = GetValue(renderConfig, 'transparent', false); + + /** + * @const {boolean} Phaser.Core.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. + */ + this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); + + /** + * @const {boolean} Phaser.Core.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. + */ + this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); + + /** + * @const {boolean} Phaser.Core.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + */ + this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); + + /** + * @const {string} Phaser.Core.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + */ + this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); + + /** + * @const {integer} Phaser.Core.Config#batchSize - The default WebGL Batch size. + */ + this.batchSize = GetValue(renderConfig, 'batchSize', 2000); + + /** + * @const {integer} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + this.maxLights = GetValue(renderConfig, 'maxLights', 10); + + var bgc = GetValue(config, 'backgroundColor', 0); + + /** + * @const {Phaser.Display.Color} Phaser.Core.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. + */ + this.backgroundColor = ValueToColor(bgc); + + if (bgc === 0 && this.transparent) + { + this.backgroundColor.alpha = 0; + } + + /** + * @const {BootCallback} Phaser.Core.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. + */ + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); + + /** + * @const {BootCallback} Phaser.Core.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + + /** + * @const {PhysicsConfig} Phaser.Core.Config#physics - The Physics Configuration object. + */ + this.physics = GetValue(config, 'physics', {}); + + /** + * @const {(boolean|string)} Phaser.Core.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. + */ + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + + /** + * @const {string} Phaser.Core.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + */ + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + */ + this.loaderPath = GetValue(config, 'loader.path', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + */ + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); + + /** + * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + */ + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + + /** + * @const {string} Phaser.Core.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. + */ + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + + /** + * @const {boolean} Phaser.Core.Config#loaderAsync - Should the XHR request use async or not? + */ + this.loaderAsync = GetValue(config, 'loader.async', true); + + /** + * @const {string} Phaser.Core.Config#loaderUser - Optional username for all XHR requests. + */ + this.loaderUser = GetValue(config, 'loader.user', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPassword - Optional password for all XHR requests. + */ + this.loaderPassword = GetValue(config, 'loader.password', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + */ + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + + /* + * Allows `plugins` property to either be an array, in which case it just replaces + * the default plugins like previously, or a config object. + * + * plugins: { + * global: [ + * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, + * ], + * scene: [ + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + * ], + * default: [], OR + * defaultMerge: [ + * 'ModPlayer' + * ] + * } + */ + + /** + * @const {any} Phaser.Core.Config#installGlobalPlugins - An array of global plugins to be installed. + */ + this.installGlobalPlugins = []; + + /** + * @const {any} Phaser.Core.Config#installScenePlugins - An array of Scene level plugins to be installed. + */ + this.installScenePlugins = []; + + var plugins = GetValue(config, 'plugins', null); + var defaultPlugins = DefaultPlugins.DefaultScene; + + if (plugins) + { + // Old 3.7 array format? + if (Array.isArray(plugins)) + { + this.defaultPlugins = plugins; + } + else if (IsPlainObject(plugins)) + { + this.installGlobalPlugins = GetFastValue(plugins, 'global', []); + this.installScenePlugins = GetFastValue(plugins, 'scene', []); + + if (Array.isArray(plugins.default)) + { + defaultPlugins = plugins.default; + } + else if (Array.isArray(plugins.defaultMerge)) + { + defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); + } + } + } + + /** + * @const {any} Phaser.Core.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). + */ + this.defaultPlugins = defaultPlugins; + + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + + /** + * @const {string} Phaser.Core.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. + */ + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + + /** + * @const {string} Phaser.Core.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. + */ + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + + if (window) + { + if (window.FORCE_WEBGL) + { + this.renderType = CONST.WEBGL; + } + else if (window.FORCE_CANVAS) + { + this.renderType = CONST.CANVAS; + } + } + } + +}); + +module.exports = Config; + + +/***/ }), +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89386,16 +97641,16 @@ module.exports = GenerateTexture; * @namespace Phaser.Math.Easing.Stepped */ -module.exports = __webpack_require__(952); +module.exports = __webpack_require__(1119); /***/ }), -/* 359 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89405,20 +97660,20 @@ module.exports = __webpack_require__(952); module.exports = { - In: __webpack_require__(955), - Out: __webpack_require__(954), - InOut: __webpack_require__(953) + In: __webpack_require__(1122), + Out: __webpack_require__(1121), + InOut: __webpack_require__(1120) }; /***/ }), -/* 360 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89428,20 +97683,20 @@ module.exports = { module.exports = { - In: __webpack_require__(958), - Out: __webpack_require__(957), - InOut: __webpack_require__(956) + In: __webpack_require__(1125), + Out: __webpack_require__(1124), + InOut: __webpack_require__(1123) }; /***/ }), -/* 361 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89451,20 +97706,20 @@ module.exports = { module.exports = { - In: __webpack_require__(961), - Out: __webpack_require__(960), - InOut: __webpack_require__(959) + In: __webpack_require__(1128), + Out: __webpack_require__(1127), + InOut: __webpack_require__(1126) }; /***/ }), -/* 362 */ +/* 395 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89474,20 +97729,20 @@ module.exports = { module.exports = { - In: __webpack_require__(964), - Out: __webpack_require__(963), - InOut: __webpack_require__(962) + In: __webpack_require__(1131), + Out: __webpack_require__(1130), + InOut: __webpack_require__(1129) }; /***/ }), -/* 363 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89495,16 +97750,16 @@ module.exports = { * @namespace Phaser.Math.Easing.Linear */ -module.exports = __webpack_require__(965); +module.exports = __webpack_require__(1132); /***/ }), -/* 364 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89514,20 +97769,20 @@ module.exports = __webpack_require__(965); module.exports = { - In: __webpack_require__(968), - Out: __webpack_require__(967), - InOut: __webpack_require__(966) + In: __webpack_require__(1135), + Out: __webpack_require__(1134), + InOut: __webpack_require__(1133) }; /***/ }), -/* 365 */ +/* 398 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89537,20 +97792,20 @@ module.exports = { module.exports = { - In: __webpack_require__(971), - Out: __webpack_require__(970), - InOut: __webpack_require__(969) + In: __webpack_require__(1138), + Out: __webpack_require__(1137), + InOut: __webpack_require__(1136) }; /***/ }), -/* 366 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89560,20 +97815,20 @@ module.exports = { module.exports = { - In: __webpack_require__(974), - Out: __webpack_require__(973), - InOut: __webpack_require__(972) + In: __webpack_require__(1141), + Out: __webpack_require__(1140), + InOut: __webpack_require__(1139) }; /***/ }), -/* 367 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89583,20 +97838,20 @@ module.exports = { module.exports = { - In: __webpack_require__(977), - Out: __webpack_require__(976), - InOut: __webpack_require__(975) + In: __webpack_require__(1144), + Out: __webpack_require__(1143), + InOut: __webpack_require__(1142) }; /***/ }), -/* 368 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89606,20 +97861,20 @@ module.exports = { module.exports = { - In: __webpack_require__(980), - Out: __webpack_require__(979), - InOut: __webpack_require__(978) + In: __webpack_require__(1147), + Out: __webpack_require__(1146), + InOut: __webpack_require__(1145) }; /***/ }), -/* 369 */ +/* 402 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89629,20 +97884,20 @@ module.exports = { module.exports = { - In: __webpack_require__(983), - Out: __webpack_require__(982), - InOut: __webpack_require__(981) + In: __webpack_require__(1150), + Out: __webpack_require__(1149), + InOut: __webpack_require__(1148) }; /***/ }), -/* 370 */ +/* 403 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89652,26 +97907,26 @@ module.exports = { module.exports = { - Fade: __webpack_require__(986), - Flash: __webpack_require__(985), - Pan: __webpack_require__(984), - Shake: __webpack_require__(951), - Zoom: __webpack_require__(950) + Fade: __webpack_require__(1153), + Flash: __webpack_require__(1152), + Pan: __webpack_require__(1151), + Shake: __webpack_require__(1118), + Zoom: __webpack_require__(1117) }; /***/ }), -/* 371 */ +/* 404 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); /** * Converts a CSS 'web' string into a Phaser Color object. @@ -89708,16 +97963,16 @@ module.exports = RGBStringToColor; /***/ }), -/* 372 */ +/* 405 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); /** * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. @@ -89738,12 +97993,12 @@ module.exports = ObjectToColor; /***/ }), -/* 373 */ +/* 406 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89786,17 +98041,17 @@ module.exports = IntegerToRGB; /***/ }), -/* 374 */ +/* 407 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); -var IntegerToRGB = __webpack_require__(373); +var Color = __webpack_require__(32); +var IntegerToRGB = __webpack_require__(406); /** * Converts the given color value into an instance of a Color object. @@ -89819,12 +98074,12 @@ module.exports = IntegerToColor; /***/ }), -/* 375 */ +/* 408 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89907,12 +98162,12 @@ module.exports = RGBToHSV; /***/ }), -/* 376 */ +/* 409 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89938,16 +98193,16 @@ module.exports = GetColor32; /***/ }), -/* 377 */ +/* 410 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(37); +var Color = __webpack_require__(32); /** * Converts a hex string into a Phaser Color object. @@ -89991,24 +98246,24 @@ module.exports = HexStringToColor; /***/ }), -/* 378 */ +/* 411 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(121); +var BaseCamera = __webpack_require__(131); var CanvasPool = __webpack_require__(24); -var CenterOn = __webpack_require__(175); +var CenterOn = __webpack_require__(189); var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); -var Components = __webpack_require__(14); -var Effects = __webpack_require__(370); -var Linear = __webpack_require__(119); -var Rectangle = __webpack_require__(9); +var Components = __webpack_require__(13); +var Effects = __webpack_require__(403); +var Linear = __webpack_require__(129); +var Rectangle = __webpack_require__(10); var Vector2 = __webpack_require__(3); /** @@ -90240,7 +98495,7 @@ var Camera = new Class({ * * This is only set if Phaser is running with the WebGL Renderer. * - * @name Phaser.Cameras.Scene2D.Camera#framebuffer + * @name Phaser.Cameras.Scene2D.Camera#glTexture * @type {?WebGLTexture} * @since 3.13.0 */ @@ -90482,6 +98737,8 @@ var Camera = new Class({ * Fades the Camera in from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeIn + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -90504,6 +98761,8 @@ var Camera = new Class({ * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades. * * @method Phaser.Cameras.Scene2D.Camera#fadeOut + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -90525,6 +98784,8 @@ var Camera = new Class({ * Fades the Camera from the given color to transparent over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeFrom + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.5.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -90547,6 +98808,8 @@ var Camera = new Class({ * Fades the Camera from transparent to the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fade + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.0.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -90569,6 +98832,8 @@ var Camera = new Class({ * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#flash + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.0.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -90591,6 +98856,8 @@ var Camera = new Class({ * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#shake + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.0.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -90612,13 +98879,15 @@ var Camera = new Class({ * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#pan + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -90635,12 +98904,14 @@ var Camera = new Class({ * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#zoomTo + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -90660,10 +98931,9 @@ var Camera = new Class({ * @protected * @since 3.0.0 * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. + * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (baseScale, resolution) + preRender: function (resolution) { var width = this.width; var height = this.height; @@ -90671,7 +98941,7 @@ var Camera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * baseScale; + var zoom = this.zoom * resolution; var matrix = this.matrix; var originX = width * this.originX; @@ -90753,11 +99023,7 @@ var Camera = new Class({ displayHeight ); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); this.shakeEffect.preRender(); @@ -90957,17 +99223,18 @@ module.exports = Camera; /***/ }), -/* 379 */ +/* 412 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCache = __webpack_require__(380); +var BaseCache = __webpack_require__(414); var Class = __webpack_require__(0); +var GameEvents = __webpack_require__(26); /** * @classdesc @@ -91111,7 +99378,7 @@ var CacheManager = new Class({ */ this.custom = {}; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -91180,18 +99447,41 @@ module.exports = CacheManager; /***/ }), -/* 380 */ +/* 413 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cache.Events + */ + +module.exports = { + + ADD: __webpack_require__(1175), + REMOVE: __webpack_require__(1174) + +}; + + +/***/ }), +/* 414 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(180); +var CustomMap = __webpack_require__(194); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(413); /** * @classdesc @@ -91233,23 +99523,12 @@ var BaseCache = new Class({ this.events = new EventEmitter(); }, - /** - * 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} cache - The BaseCache to which the object was added. - * @param {string} key - The key of the object added to the cache. - * @param {*} object - 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 + * @fires Phaser.Cache.Events#ADD * @since 3.0.0 * * @param {string} key - The unique key by which the data added to the cache will be referenced. @@ -91261,7 +99540,7 @@ var BaseCache = new Class({ { this.entries.set(key, data); - this.events.emit('add', this, key, data); + this.events.emit(Events.ADD, this, key, data); return this; }, @@ -91313,17 +99592,6 @@ var BaseCache = new Class({ 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} cache - The BaseCache from which the object was removed. - * @param {string} key - The key of the object removed from the cache. - * @param {*} object - The object that was removed from the cache. - */ - /** * Removes and item from this cache based on the given key. * @@ -91332,7 +99600,7 @@ var BaseCache = new Class({ * 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 + * @fires Phaser.Cache.Events#REMOVE * @since 3.0.0 * * @param {string} key - The unique key of the item to remove from the cache. @@ -91347,7 +99615,7 @@ var BaseCache = new Class({ { this.entries.delete(key); - this.events.emit('remove', this, key, entry.data); + this.events.emit(Events.REMOVE, this, key, entry.data); } return this; @@ -91374,28 +99642,23 @@ module.exports = BaseCache; /***/ }), -/* 381 */ +/* 415 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Animation = __webpack_require__(384); +var Animation = __webpack_require__(205); var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(180); +var CustomMap = __webpack_require__(194); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(136); +var GameEvents = __webpack_require__(26); var GetValue = __webpack_require__(4); -var Pad = __webpack_require__(179); - -/** - * @typedef {object} JSONAnimationManager - * - * @property {JSONAnimation[]} anims - [description] - * @property {number} globalTimeScale - [description] - */ +var Pad = __webpack_require__(193); /** * @classdesc @@ -91446,7 +99709,9 @@ var AnimationManager = new Class({ this.textureManager = null; /** - * [description] + * The global time scale of the Animation Manager. + * + * This scales the time delta between two frames, thus influencing the speed of time for the Animation Manager. * * @name Phaser.Animations.AnimationManager#globalTimeScale * @type {number} @@ -91456,7 +99721,9 @@ var AnimationManager = new Class({ this.globalTimeScale = 1; /** - * [description] + * The Animations registered in the Animation Manager. + * + * This map should be modified with the {@link #add} and {@link #create} methods of the Animation Manager. * * @name Phaser.Animations.AnimationManager#anims * @type {Phaser.Structs.Map.} @@ -91466,7 +99733,7 @@ var AnimationManager = new Class({ this.anims = new CustomMap(); /** - * [description] + * Whether the Animation Manager is paused along with all of its Animations. * * @name Phaser.Animations.AnimationManager#paused * @type {boolean} @@ -91476,7 +99743,7 @@ var AnimationManager = new Class({ this.paused = false; /** - * [description] + * The name of this Animation Manager. * * @name Phaser.Animations.AnimationManager#name * @type {string} @@ -91484,31 +99751,32 @@ var AnimationManager = new Class({ */ this.name = 'AnimationManager'; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** - * [description] + * Registers event listeners after the Game boots. * * @method Phaser.Animations.AnimationManager#boot + * @listens Phaser.Core.Events#DESTROY * @since 3.0.0 */ boot: function () { this.textureManager = this.game.textures; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * [description] + * Adds an existing Animation to the Animation Manager. * * @method Phaser.Animations.AnimationManager#add - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {string} key - [description] - * @param {Phaser.Animations.Animation} animation - [description] + * @param {string} key - The key under which the Animation should be added. The Animation will be updated with it. Must be unique. + * @param {Phaser.Animations.Animation} animation - The Animation which should be added to the Animation Manager. * * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ @@ -91516,7 +99784,8 @@ var AnimationManager = new Class({ { if (this.anims.has(key)) { - console.warn('Animation with key', key, 'already exists'); + console.warn('Animation key exists: ' + key); + return; } @@ -91524,48 +99793,79 @@ var AnimationManager = new Class({ this.anims.set(key, animation); - this.emit('add', key, animation); + this.emit(Events.ADD_ANIMATION, key, animation); return this; }, /** - * [description] + * Checks to see if the given key is already in use within the Animation Manager or not. + * + * Animations are global. Keys created in one scene can be used from any other Scene in your game. They are not Scene specific. + * + * @method Phaser.Animations.AnimationManager#exists + * @since 3.16.0 + * + * @param {string} key - The key of the Animation to check. + * + * @return {boolean} `true` if the Animation already exists in the Animation Manager, or `false` if the key is available. + */ + exists: function (key) + { + return this.anims.has(key); + }, + + /** + * Creates a new Animation and adds it to the Animation Manager. + * + * Animations are global. Once created, you can use them in any Scene in your game. They are not Scene specific. + * + * If an invalid key is given this method will return `false`. + * + * If you pass the key of an animation that already exists in the Animation Manager, that animation will be returned. + * + * A brand new animation is only created if the key is valid and not already in use. + * + * If you wish to re-use an existing key, call `AnimationManager.remove` first, then this method. * * @method Phaser.Animations.AnimationManager#create - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {AnimationConfig} config - [description] + * @param {Phaser.Animations.Types.Animation} config - The configuration settings for the Animation. * - * @return {Phaser.Animations.Animation} The Animation that was created. + * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` is the key is already in use. */ create: function (config) { var key = config.key; - if (!key || this.anims.has(key)) + var anim = false; + + if (key) { - console.warn('Invalid Animation Key, or Key already in use: ' + key); - return; + anim = this.get(key); + + if (!anim) + { + anim = new Animation(this, key, config); + + this.anims.set(key, anim); + + this.emit(Events.ADD_ANIMATION, key, anim); + } } - var anim = new Animation(this, key, config); - - this.anims.set(key, anim); - - this.emit('add', key, anim); - return anim; }, /** - * [description] + * Loads this Animation Manager's Animations and settings from a JSON object. * * @method Phaser.Animations.AnimationManager#fromJSON * @since 3.0.0 * - * @param {(string|JSONAnimationManager|JSONAnimation)} data - [description] + * @param {(string|Phaser.Animations.Types.JSONAnimations|Phaser.Animations.Types.JSONAnimation)} data - The JSON object to parse. * @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added. * * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. @@ -91609,29 +99909,15 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNamesConfig - * - * @property {string} [prefix=''] - [description] - * @property {integer} [start=0] - [description] - * @property {integer} [end=0] - [description] - * @property {string} [suffix=''] - [description] - * @property {integer} [zeroPad=0] - [description] - * @property {AnimationFrameConfig[]} [outputArray=[]] - [description] - * @property {boolean} [frames=false] - [description] - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with string frame names, as configured by the given {@link AnimationFrameConfig}. + * [description] * * @method Phaser.Animations.AnimationManager#generateFrameNames * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNamesConfig} [config] - The configuration object for the animation frame names. + * @param {Phaser.Animations.Types.GenerateFrameNames} [config] - The configuration object for the animation frame names. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNames: function (key, config) { @@ -91698,27 +99984,17 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNumbersConfig + * Generate an array of {@link Phaser.Animations.Types.AnimationFrame} objects from a texture key and configuration object. * - * @property {integer} [start=0] - The starting frame of the animation. - * @property {integer} [end=-1] - The ending frame of the animation. - * @property {(boolean|integer)} [first=false] - A frame to put at the beginning of the animation, before `start` or `outputArray` or `frames`. - * @property {AnimationFrameConfig[]} [outputArray=[]] - An array to concatenate the output onto. - * @property {(boolean|integer[])} [frames=false] - A custom sequence of frames. - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with numbered frame names, as configured by the given {@link GenerateFrameNumbersConfig}. + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Animations.Types.GenerateFrameNumbers}. * * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNumbersConfig} config - The configuration object for the animation frames. + * @param {Phaser.Animations.Types.GenerateFrameNumbers} config - The configuration object for the animation frames. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNumbers: function (key, config) { @@ -91798,7 +100074,7 @@ var AnimationManager = new Class({ * @param {string} key - The key of the animation to load. * @param {(string|integer)} [startFrame] - The name of a start frame to set on the loaded animation. * - * @return {Phaser.GameObjects.GameObject} [description] + * @return {Phaser.GameObjects.GameObject} The Game Object with the animation loaded into it. */ load: function (child, key, startFrame) { @@ -91816,7 +100092,7 @@ var AnimationManager = new Class({ * Pause all animations. * * @method Phaser.Animations.AnimationManager#pauseAll - * @fires PauseAllAnimationEvent + * @fires Phaser.Animations.Events#PAUSE_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -91827,7 +100103,7 @@ var AnimationManager = new Class({ { this.paused = true; - this.emit('pauseall'); + this.emit(Events.PAUSE_ALL); } return this; @@ -91870,7 +100146,7 @@ var AnimationManager = new Class({ * Remove an animation. * * @method Phaser.Animations.AnimationManager#remove - * @fires RemoveAnimationEvent + * @fires Phaser.Animations.Events#REMOVE_ANIMATION * @since 3.0.0 * * @param {string} key - The key of the animation to remove. @@ -91883,7 +100159,7 @@ var AnimationManager = new Class({ if (anim) { - this.emit('remove', key, anim); + this.emit(Events.REMOVE_ANIMATION, key, anim); this.anims.delete(key); } @@ -91895,7 +100171,7 @@ var AnimationManager = new Class({ * Resume all paused animations. * * @method Phaser.Animations.AnimationManager#resumeAll - * @fires ResumeAllAnimationEvent + * @fires Phaser.Animations.Events#RESUME_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -91906,7 +100182,7 @@ var AnimationManager = new Class({ { this.paused = false; - this.emit('resumeall'); + this.emit(Events.RESUME_ALL); } return this; @@ -91953,14 +100229,14 @@ var AnimationManager = new Class({ }, /** - * [description] + * Get the animation data as javascript object by giving key, or get the data of all animations as array of objects, if key wasn't provided. * * @method Phaser.Animations.AnimationManager#toJSON * @since 3.0.0 * * @param {string} key - [description] * - * @return {JSONAnimationManager} [description] + * @return {Phaser.Animations.Types.JSONAnimations} [description] */ toJSON: function (key) { @@ -91985,7 +100261,8 @@ var AnimationManager = new Class({ }, /** - * [description] + * Destroy this Animation Manager and clean up animation definitions and references to other objects. + * This method should not be called directly. It will be called automatically as a response to a `destroy` event from the Phaser.Game instance. * * @method Phaser.Animations.AnimationManager#destroy * @since 3.0.0 @@ -92005,1241 +100282,12 @@ module.exports = AnimationManager; /***/ }), -/* 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} - */ - -var Class = __webpack_require__(0); - -/** - * @typedef {object} JSONAnimationFrame - * - * @property {string} key - The key of the Texture this AnimationFrame uses. - * @property {(string|integer)} frame - The key of the Frame within the Texture that this AnimationFrame uses. - * @property {number} duration - Additional time (in ms) that this frame should appear for during playback. - */ - -/** - * @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({ - - initialize: - - 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; - - /** - * 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; - - /** - * The index of this AnimationFrame within the Animation sequence. - * - * @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; - - /** - * 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; - }, - - /** - * Generates a JavaScript object suitable for converting to JSON. - * - * @method Phaser.Animations.AnimationFrame#toJSON - * @since 3.0.0 - * - * @return {JSONAnimationFrame} 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; - } - -}); - -module.exports = AnimationFrame; - - -/***/ }), -/* 383 */ +/* 416 */ /***/ (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.Array.FindClosestInSorted - * @since 3.0.0 - * - * @param {number} value - The value to search for in the array. - * @param {array} array - The array to search, which must be sorted. - * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. - * - * @return {number|object} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. - */ -var FindClosestInSorted = function (value, array, key) -{ - if (!array.length) - { - return NaN; - } - else if (array.length === 1) - { - return array[0]; - } - - var i = 1; - var low; - var high; - - if (key) - { - if (value < array[0][key]) - { - return array[0]; - } - - while (array[i][key] < value) - { - i++; - } - } - else - { - while (array[i] < value) - { - i++; - } - } - - if (i > array.length) - { - i = array.length; - } - - if (key) - { - low = array[i - 1][key]; - high = array[i][key]; - - return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; - } - else - { - low = array[i - 1]; - high = array[i]; - - return ((high - value) <= (value - low)) ? high : low; - } -}; - -module.exports = FindClosestInSorted; - - -/***/ }), -/* 384 */ -/***/ (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 Clamp = __webpack_require__(23); -var Class = __webpack_require__(0); -var FindClosestInSorted = __webpack_require__(383); -var Frame = __webpack_require__(382); -var GetValue = __webpack_require__(4); - -/** - * @typedef {object} JSONAnimation - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {string} type - A frame based animation (as opposed to a bone based animation) - * @property {JSONAnimationFrame[]} frames - [description] - * @property {integer} frameRate - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} duration - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} skipMissedFrames - Skip frames if the time lags, or always advanced anyway? - * @property {integer} delay - Delay before starting playback. Value given in milliseconds. - * @property {integer} repeat - Number of times to repeat the animation (-1 for infinity) - * @property {integer} repeatDelay - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} yoyo - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} showOnStart - Should sprite.visible = true when the animation starts to play? - * @property {boolean} hideOnComplete - Should sprite.visible = false when the animation finishes? - */ - -/** - * @typedef {object} AnimationFrameConfig - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {(string|number)} frame - [description] - * @property {number} [duration=0] - [description] - * @property {boolean} [visible] - [description] - */ - -/** - * @typedef {object} AnimationConfig - * - * @property {string} [key] - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {AnimationFrameConfig[]} [frames] - An object containing data used to generate the frames for the animation - * @property {string} [defaultTextureKey=null] - The key of the texture all frames of the animation will use. Can be overridden on a per frame basis. - * @property {integer} [frameRate] - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} [duration] - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} [skipMissedFrames=true] - Skip frames if the time lags, or always advanced anyway? - * @property {integer} [delay=0] - Delay before starting playback. Value given in milliseconds. - * @property {integer} [repeat=0] - Number of times to repeat the animation (-1 for infinity) - * @property {integer} [repeatDelay=0] - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? - * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? - */ - -/** - * @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. - * - * @class Animation - * @memberof Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationManager} manager - [description] - * @param {string} key - [description] - * @param {AnimationConfig} config - [description] - */ -var Animation = new Class({ - - initialize: - - function Animation (manager, key, config) - { - /** - * A reference to the global Animation Manager - * - * @name Phaser.Animations.Animation#manager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.manager = manager; - - /** - * The unique identifying string for this animation - * - * @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 {Phaser.Animations.AnimationFrame[]} - * @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, in milliseconds. - * If the `frameRate` property has been set then it overrides this value, - * otherwise the `frameRate` is derived from `duration`. - * - * @name Phaser.Animations.Animation#duration - * @type {integer} - * @since 3.0.0 - */ - 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) * 1000; - } - 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 = 4000 ms - // So frameRate is 12 / (4000 / 1000) = 3 fps - this.frameRate = this.frames.length / (this.duration / 1000); - } - 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 * 1000 (half a second, or 500ms) - this.duration = (this.frames.length / this.frameRate) * 1000; - } - - /** - * How many ms per frame, not including frame specific modifiers. - * - * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} - * @since 3.0.0 - */ - this.msPerFrame = 1000 / this.frameRate; - - /** - * 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); - - /** - * The delay in ms before the playback will begin. - * - * @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. Set to -1 to repeat forever. - * - * @name Phaser.Animations.Animation#repeat - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeat = GetValue(config, 'repeat', 0); - - /** - * The delay in ms before the a repeat playthrough starts. - * - * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = GetValue(config, 'repeatDelay', 0); - - /** - * 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); - - /** - * 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); - - /** - * 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); - - /** - * Global pause. All Game Objects using this Animation instance are impacted by this property. - * - * @name Phaser.Animations.Animation#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - this.manager.on('pauseall', this.pause, this); - this.manager.on('resumeall', this.resume, this); - }, - - /** - * Add frames to the end of the animation. - * - * @method Phaser.Animations.Animation#addFrame - * @since 3.0.0 - * - * @param {(string|AnimationFrameConfig[])} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrame: function (config) - { - return this.addFrameAt(this.frames.length, config); - }, - - /** - * Add frame/s into the animation. - * - * @method Phaser.Animations.Animation#addFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * @param {(string|AnimationFrameConfig[])} 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); - } - - this.updateFrameSequence(); - } - - return this; - }, - - /** - * Check if the given frame index is valid. - * - * @method Phaser.Animations.Animation#checkFrame - * @since 3.0.0 - * - * @param {integer} index - The index to be checked. - * - * @return {boolean} `true` if the index is valid, otherwise `false`. - */ - checkFrame: function (index) - { - return (index >= 0 && index < this.frames.length); - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#completeAnimation - * @protected - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - completeAnimation: function (component) - { - if (this.hideOnComplete) - { - component.parent.visible = false; - } - - component.stop(); - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#getFirstTick - * @protected - * @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) - { - component.nextTick += component._delay; - } - }, - - /** - * Returns the AnimationFrame at the provided index - * - * @method Phaser.Animations.Animation#getFrameAt - * @protected - * @since 3.0.0 - * - * @param {integer} index - The index in the AnimationFrame array - * - * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence - */ - getFrameAt: function (index) - { - return this.frames[index]; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#getFrames - * @since 3.0.0 - * - * @param {Phaser.Textures.TextureManager} textureManager - [description] - * @param {(string|AnimationFrameConfig[])} frames - [description] - * @param {string} [defaultTextureKey] - [description] - * - * @return {Phaser.Animations.AnimationFrame[]} [description] - */ - getFrames: function (textureManager, frames, defaultTextureKey) - { - 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.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.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 - - // When is the next update due? - component.accumulator -= component.nextTick; - - component.nextTick = component.msPerFrame + component.currentFrame.duration; - }, - - /** - * Loads the Animation values into the Animation Component. - * - * @method Phaser.Animations.Animation#load - * @private - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to load values into. - * @param {integer} startFrame - The start frame of the animation to load. - */ - load: function (component, startFrame) - { - if (startFrame >= this.frames.length) - { - startFrame = 0; - } - - if (component.currentAnim !== this) - { - component.currentAnim = this; - - 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; - } - - var frame = this.frames[startFrame]; - - if (startFrame === 0 && !component.forward) - { - frame = this.getLastFrame(); - } - - component.updateFrame(frame); - }, - - /** - * Returns the frame closest to the given progress value between 0 and 1. - * - * @method Phaser.Animations.Animation#getFrameByProgress - * @since 3.4.0 - * - * @param {number} value - A value between 0 and 1. - * - * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. - */ - getFrameByProgress: function (value) - { - value = Clamp(value, 0, 1); - - return FindClosestInSorted(value, this.frames, 'progress'); - }, - - /** - * Advance the animation frame. - * - * @method Phaser.Animations.Animation#nextFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. - */ - nextFrame: function (component) - { - var frame = component.currentFrame; - - // TODO: Add frame skip support - - if (frame.isLast) - { - // We're at the end of the animation - - // Yoyo? (happens before repeat) - if (component._yoyo) - { - this.handleYoyoFrame(component, false); - } - else if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - - if (component._reverse && component.forward) - { - component.forward = false; - } - else - { - this.repeatAnimation(component); - } - } - else - { - this.completeAnimation(component); - } - } - else - { - this.updateAndGetNextTick(component, frame.nextFrame); - } - }, - - /** - * Handle the yoyo functionality in nextFrame and previousFrame methods. - * - * @method Phaser.Animations.Animation#handleYoyoFrame - * @private - * @since 3.12.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. - * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) - */ - handleYoyoFrame: function (component, isReverse) - { - if (!isReverse) { isReverse = false; } - - if (component._reverse === !isReverse && component.repeatCounter > 0) - { - component.forward = isReverse; - - this.repeatAnimation(component); - - return; - } - - if (component._reverse !== isReverse && component.repeatCounter === 0) - { - this.completeAnimation(component); - - return; - } - - component.forward = isReverse; - - var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; - - this.updateAndGetNextTick(component, frame); - }, - - /** - * Returns the animation last frame. - * - * @method Phaser.Animations.Animation#getLastFrame - * @since 3.12.0 - * - * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. - */ - getLastFrame: function () - { - return this.frames[this.frames.length - 1]; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#previousFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - previousFrame: function (component) - { - var frame = component.currentFrame; - - // TODO: Add frame skip support - - if (frame.isFirst) - { - // We're at the start of the animation - - if (component._yoyo) - { - this.handleYoyoFrame(component, true); - } - else if (component.repeatCounter > 0) - { - if (component._reverse && !component.forward) - { - component.currentFrame = this.getLastFrame(); - this.repeatAnimation(component); - } - else - { - // Repeat (happens before complete) - component.forward = true; - this.repeatAnimation(component); - } - } - else - { - this.completeAnimation(component); - } - } - else - { - this.updateAndGetNextTick(component, frame.prevFrame); - } - }, - - /** - * Update Frame and Wait next tick. - * - * @method Phaser.Animations.Animation#updateAndGetNextTick - * @private - * @since 3.12.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. - */ - updateAndGetNextTick: function (component, frame) - { - component.updateFrame(frame); - - this.getNextTick(component); - }, - - /** - * [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); - } - - return this; - }, - - /** - * Removes a frame from the AnimationFrame array at the provided index - * and updates the animation accordingly. - * - * @method Phaser.Animations.Animation#removeFrameAt - * @since 3.0.0 - * - * @param {integer} index - The index in the AnimationFrame array - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrameAt: function (index) - { - this.frames.splice(index, 1); - - this.updateFrameSequence(); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Animations.Animation#repeatAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - repeatAnimation: function (component) - { - if (component._pendingStop === 2) - { - return this.completeAnimation(component); - } - - if (component._repeatDelay > 0 && component.pendingRepeat === false) - { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += component._repeatDelay; - } - else - { - component.repeatCounter--; - - component.updateFrame(component.currentFrame[(component.forward) ? 'nextFrame' : 'prevFrame']); - - if (component.isPlaying) - { - this.getNextTick(component); - - component.pendingRepeat = false; - - component.parent.emit('animationrepeat', this, component.currentFrame, component.repeatCounter, component.parent); - } - } - }, - - /** - * [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 {JSONAnimation} [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; - }, - - /** - * [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); - - 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; - }, - - /** - * [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 () - { - this.manager.off('pauseall', this.pause, this); - this.manager.off('resumeall', this.resume, this); - - this.manager.remove(this.key); - - for (var i = 0; i < this.frames.length; i++) - { - this.frames[i].destroy(); - } - - this.frames = []; - - this.manager = null; - } - -}); - -module.exports = Animation; - - -/***/ }), -/* 385 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -93308,12 +100356,12 @@ module.exports = BresenhamPoints; /***/ }), -/* 386 */ +/* 417 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -93348,12 +100396,12 @@ module.exports = RotateRight; /***/ }), -/* 387 */ +/* 418 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -93388,16 +100436,16 @@ module.exports = RotateLeft; /***/ }), -/* 388 */ +/* 419 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(124); +var Perimeter = __webpack_require__(135); var Point = __webpack_require__(6); // Return an array of points from the perimeter of the rectangle @@ -93508,12 +100556,36 @@ module.exports = MarchingAnts; /***/ }), -/* 389 */ +/* 420 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data.Events + */ + +module.exports = { + + CHANGE_DATA: __webpack_require__(1238), + CHANGE_DATA_KEY: __webpack_require__(1237), + REMOVE_DATA: __webpack_require__(1236), + SET_DATA: __webpack_require__(1235) + +}; + + +/***/ }), +/* 421 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -93597,19 +100669,19 @@ module.exports = Visible; /***/ }), -/* 390 */ +/* 422 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var TransformMatrix = __webpack_require__(38); -var WrapAngle = __webpack_require__(199); -var WrapAngleDegrees = __webpack_require__(198); +var MATH_CONST = __webpack_require__(20); +var TransformMatrix = __webpack_require__(41); +var WrapAngle = __webpack_require__(214); +var WrapAngleDegrees = __webpack_require__(213); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -93860,8 +100932,8 @@ var Transform = { { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } this.x = x + (Math.random() * width); this.y = y + (Math.random() * height); @@ -94065,12 +101137,12 @@ module.exports = Transform; /***/ }), -/* 391 */ +/* 423 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -94152,12 +101224,12 @@ module.exports = ToJSON; /***/ }), -/* 392 */ +/* 424 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -94259,12 +101331,12 @@ module.exports = ScrollFactor; /***/ }), -/* 393 */ +/* 425 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -94272,11 +101344,21 @@ var Class = __webpack_require__(0); /** * @classdesc - * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect a visible pixel from the geometry mask. The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity). - * - * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and alpha of the pixel from the Geometry Mask do not matter. - * - * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. Moving or transforming the underlying Graphics object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask. You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed in front of all masked objects which has its own visual properties and, naturally, respects the camera's visual properties, but isn't affected by and doesn't follow the masked objects by itself. + * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect + * a visible pixel from the geometry mask. The mask is essentially a clipping path which can only + * make a masked pixel fully visible or fully invisible without changing its alpha (opacity). + * + * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) + * should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed + * if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and + * alpha of the pixel from the Geometry Mask do not matter. + * + * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. + * Moving or transforming the underlying Graphics object will change the mask (and affect the visibility + * of any masked objects), whereas moving or transforming a masked object will not affect the mask. + * You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed + * in front of all masked objects which has its own visual properties and, naturally, respects the camera's + * visual properties, but isn't affected by and doesn't follow the masked objects by itself. * * @class GeometryMask * @memberof Phaser.Display.Masks @@ -94300,6 +101382,16 @@ var GeometryMask = new Class({ * @since 3.0.0 */ this.geometryMask = graphicsGeometry; + + /** + * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels + * drawn to the Geometry Mask. + * + * @name Phaser.Display.Masks.GeometryMask#invertAlpha + * @type {boolean} + * @since 3.16.0 + */ + this.invertAlpha = false; }, /** @@ -94341,12 +101433,22 @@ var GeometryMask = new Class({ gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); + geometryMask.renderWebGL(renderer, geometryMask, 0, camera); + renderer.flush(); // Use stencil buffer to affect next rendering object gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, 1, 1); + + if (this.invertAlpha) + { + gl.stencilFunc(gl.NOTEQUAL, 1, 1); + } + else + { + gl.stencilFunc(gl.EQUAL, 1, 1); + } + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); }, @@ -94404,7 +101506,7 @@ var GeometryMask = new Class({ /** * Destroys this GeometryMask and nulls any references it holds. - * + * * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, * so be sure to call `clearMask` on any Game Object using it, before destroying it. * @@ -94422,12 +101524,12 @@ module.exports = GeometryMask; /***/ }), -/* 394 */ +/* 426 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -94435,14 +101537,37 @@ var Class = __webpack_require__(0); /** * @classdesc - * [description] + * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. + * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, + * not a clipping path. It is only available when using the WebGL Renderer. + * + * A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). + * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha + * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the + * Bitmap Mask doesn't matter. + * + * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an + * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means + * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects + * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the + * corresponding pixel in the mask. + * + * The Bitmap Mask's location matches the location of its Game Object, not the location of the + * masked objects. Moving or transforming the underlying Game Object will change the mask + * (and affect the visibility of any masked objects), whereas moving or transforming a masked object + * will not affect the mask. + * + * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a + * Scene's display list, it will only be used for the mask and its full texture will not be directly + * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will + * render as a normal Game Object and will also serve as a mask. * * @class BitmapMask * @memberof Phaser.Display.Masks * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which this Bitmap Mask will be used in. * @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite. */ var BitmapMask = new Class({ @@ -94472,7 +101597,7 @@ var BitmapMask = new Class({ this.bitmapMask = renderable; /** - * [description] + * The texture used for the mask's framebuffer. * * @name Phaser.Display.Masks.BitmapMask#maskTexture * @type {WebGLTexture} @@ -94482,7 +101607,7 @@ var BitmapMask = new Class({ this.maskTexture = null; /** - * [description] + * The texture used for the main framebuffer. * * @name Phaser.Display.Masks.BitmapMask#mainTexture * @type {WebGLTexture} @@ -94492,7 +101617,7 @@ var BitmapMask = new Class({ this.mainTexture = null; /** - * [description] + * Whether the Bitmap Mask is dirty and needs to be updated. * * @name Phaser.Display.Masks.BitmapMask#dirty * @type {boolean} @@ -94502,7 +101627,7 @@ var BitmapMask = new Class({ this.dirty = true; /** - * [description] + * The framebuffer to which a masked Game Object is rendered. * * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer * @type {WebGLFramebuffer} @@ -94511,7 +101636,7 @@ var BitmapMask = new Class({ this.mainFramebuffer = null; /** - * [description] + * The framebuffer to which the Bitmap Mask's masking Game Object is rendered. * * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer * @type {WebGLFramebuffer} @@ -94520,7 +101645,9 @@ var BitmapMask = new Class({ this.maskFramebuffer = null; /** - * [description] + * Whether to invert the mask's alpha. + * + * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. * * @name Phaser.Display.Masks.BitmapMask#invertAlpha * @type {boolean} @@ -94561,7 +101688,7 @@ var BitmapMask = new Class({ }, /** - * [description] + * Sets a new masking Game Object for the Bitmap Mask. * * @method Phaser.Display.Masks.BitmapMask#setBitmap * @since 3.0.0 @@ -94574,13 +101701,15 @@ var BitmapMask = new Class({ }, /** - * [description] + * Prepares the WebGL Renderer to render a Game Object with this mask applied. + * + * This renders the masking Game Object to the mask framebuffer and switches to the main framebuffer so that the masked Game Object will be rendered to it instead of being rendered directly to the frame. * * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] - * @param {Phaser.GameObjects.GameObject} maskedObject - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to prepare. + * @param {Phaser.GameObjects.GameObject} maskedObject - The masked Game Object which will be drawn. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ preRenderWebGL: function (renderer, maskedObject, camera) @@ -94589,12 +101718,14 @@ var BitmapMask = new Class({ }, /** - * [description] + * Finalizes rendering of a masked Game Object. + * + * This resets the previously bound framebuffer and switches the WebGL Renderer to the Bitmap Mask Pipeline, which uses a special fragment shader to apply the masking effect. * * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to clean up. */ postRenderWebGL: function (renderer) { @@ -94602,13 +101733,13 @@ var BitmapMask = new Class({ }, /** - * [description] + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] - * @param {Phaser.GameObjects.GameObject} mask - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + * @param {Phaser.GameObjects.GameObject} mask - The masked Game Object which would be rendered. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ preRenderCanvas: function () @@ -94617,12 +101748,12 @@ var BitmapMask = new Class({ }, /** - * [description] + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description] + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. */ postRenderCanvas: function () { @@ -94665,17 +101796,17 @@ module.exports = BitmapMask; /***/ }), -/* 395 */ +/* 427 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapMask = __webpack_require__(394); -var GeometryMask = __webpack_require__(393); +var BitmapMask = __webpack_require__(426); +var GeometryMask = __webpack_require__(425); /** * Provides methods used for getting and setting the mask of a Game Object. @@ -94812,12 +101943,12 @@ module.exports = Mask; /***/ }), -/* 396 */ +/* 428 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -94852,12 +101983,12 @@ module.exports = RotateAround; /***/ }), -/* 397 */ +/* 429 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -94891,17 +102022,17 @@ module.exports = GetPoint; /***/ }), -/* 398 */ +/* 430 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetPoint = __webpack_require__(190); -var Perimeter = __webpack_require__(124); +var GetPoint = __webpack_require__(204); +var Perimeter = __webpack_require__(135); // Return an array of points from the perimeter of the rectangle // each spaced out based on the quantity or step required @@ -94915,8 +102046,8 @@ var Perimeter = __webpack_require__(124); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. - * @param {number} step - [description] - * @param {integer} quantity - [description] + * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsy. Ignored if quantity is positive. + * @param {integer} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsy, step param will be used to calculate the number of points. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. * * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. @@ -94945,12 +102076,12 @@ module.exports = GetPoints; /***/ }), -/* 399 */ +/* 431 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -95038,16 +102169,16 @@ module.exports = Depth; /***/ }), -/* 400 */ +/* 432 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(66); +var BlendModes = __webpack_require__(60); /** * Provides methods used for setting the blend mode of a Game Object. @@ -95080,6 +102211,7 @@ var BlendMode = { * * ADD * * MULTIPLY * * SCREEN + * * ERASE * * Canvas has more available depending on browser support. * @@ -95128,6 +102260,7 @@ var BlendMode = { * * ADD * * MULTIPLY * * SCREEN + * * ERASE (only works when rendering to a framebuffer, like a Render Texture) * * Canvas has more available depending on browser support. * @@ -95135,7 +102268,7 @@ var BlendMode = { * * 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 + * reasons try to be careful about the construction of your Scene and the frequency in which blend modes * are used. * * @method Phaser.GameObjects.Components.BlendMode#setBlendMode @@ -95158,12 +102291,270 @@ module.exports = BlendMode; /***/ }), -/* 401 */ +/* 433 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +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 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({ + + initialize: + + 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; + + /** + * 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; + + /** + * The index of this AnimationFrame within the Animation sequence. + * + * @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; + + /** + * 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; + }, + + /** + * Generates a JavaScript object suitable for converting to JSON. + * + * @method Phaser.Animations.AnimationFrame#toJSON + * @since 3.0.0 + * + * @return {Phaser.Animations.Types.JSONAnimationFrame} 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; + } + +}); + +module.exports = AnimationFrame; + + +/***/ }), +/* 434 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Searches a pre-sorted array for the closet value to the given number. + * + * If the `key` argument is given it will assume the array contains objects that all have the required `key` property name, + * and will check for the closest value of those to the given number. + * + * @function Phaser.Utils.Array.FindClosestInSorted + * @since 3.0.0 + * + * @param {number} value - The value to search for in the array. + * @param {array} array - The array to search, which must be sorted. + * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. + * + * @return {(number|any)} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. + */ +var FindClosestInSorted = function (value, array, key) +{ + if (!array.length) + { + return NaN; + } + else if (array.length === 1) + { + return array[0]; + } + + var i = 1; + var low; + var high; + + if (key) + { + if (value < array[0][key]) + { + return array[0]; + } + + while (array[i][key] < value) + { + i++; + } + } + else + { + while (array[i] < value) + { + i++; + } + } + + if (i > array.length) + { + i = array.length; + } + + if (key) + { + low = array[i - 1][key]; + high = array[i][key]; + + return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; + } + else + { + low = array[i - 1]; + high = array[i]; + + return ((high - value) <= (value - low)) ? high : low; + } +}; + +module.exports = FindClosestInSorted; + + +/***/ }), +/* 435 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -95453,12 +102844,12 @@ module.exports = Alpha; /***/ }), -/* 402 */ +/* 436 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -95481,19 +102872,19 @@ module.exports = Circumference; /***/ }), -/* 403 */ +/* 437 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(402); -var CircumferencePoint = __webpack_require__(192); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var Circumference = __webpack_require__(436); +var CircumferencePoint = __webpack_require__(207); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); /** * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, @@ -95533,517 +102924,18 @@ module.exports = GetPoints; /***/ }), -/* 404 */ +/* 438 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); - -/** - * @classdesc - * A seeded Random Data Generator. - * - * Access via `Phaser.Math.RND` which is an instance of this class pre-defined - * by Phaser. Or, create your own instance to use as you require. - * - * The `Math.RND` generator is seeded by the Game Config property value `seed`. - * If no such config property exists, a random number is used. - * - * If you create your own instance of this class you should provide a seed for it. - * If no seed is given it will use a 'random' one based on Date.now. - * - * @class RandomDataGenerator - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. - */ -var RandomDataGenerator = new Class({ - - initialize: - - function RandomDataGenerator (seeds) - { - if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } - - /** - * 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; - - /** - * Signs to choose from. - * - * @name Phaser.Math.RandomDataGenerator#signs - * @type {number[]} - * @since 3.0.0 - */ - this.signs = [ -1, 1 ]; - - if (seeds) - { - this.init(seeds); - } - }, - - /** - * Private random helper. - * - * @method Phaser.Math.RandomDataGenerator#rnd - * @since 3.0.0 - * @private - * - * @return {number} A random number. - */ - rnd: function () - { - 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 {string} data - The value to hash. - * - * @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++) - { - 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 - }, - - /** - * Initialize the state of the random data generator. - * - * @method Phaser.Math.RandomDataGenerator#init - * @since 3.0.0 - * - * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. - */ - 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 {string[]} 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 {*} 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 {*} 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(','); - }, - - /** - * Shuffles the given array, using the current seed. - * - * @method Phaser.Math.RandomDataGenerator#shuffle - * @since 3.7.0 - * - * @param {array} [array] - The array to be shuffled. - * - * @return {array} The shuffled array. - */ - shuffle: function (array) - { - var len = array.length - 1; - - for (var i = len; i > 0; i--) - { - var randomIndex = Math.floor(this.frac() * (len + 1)); - var itemAtIndex = array[randomIndex]; - - array[randomIndex] = array[i]; - array[i] = itemAtIndex; - } - - return array; - } - -}); - -module.exports = RandomDataGenerator; - - -/***/ }), -/* 405 */ -/***/ (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__(192); -var FromPercent = __webpack_require__(93); -var MATH_CONST = __webpack_require__(16); +var CircumferencePoint = __webpack_require__(207); +var FromPercent = __webpack_require__(100); +var MATH_CONST = __webpack_require__(20); var Point = __webpack_require__(6); /** @@ -96075,19 +102967,19 @@ module.exports = GetPoint; /***/ }), -/* 406 */ +/* 439 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(44); -var GetTop = __webpack_require__(42); -var SetRight = __webpack_require__(43); -var SetTop = __webpack_require__(41); +var GetRight = __webpack_require__(47); +var GetTop = __webpack_require__(45); +var SetRight = __webpack_require__(46); +var SetTop = __webpack_require__(44); /** * Takes given Game Object and aligns it so that it is positioned in the top right of the other. @@ -96119,19 +103011,19 @@ module.exports = TopRight; /***/ }), -/* 407 */ +/* 440 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(46); -var GetTop = __webpack_require__(42); -var SetLeft = __webpack_require__(45); -var SetTop = __webpack_require__(41); +var GetLeft = __webpack_require__(49); +var GetTop = __webpack_require__(45); +var SetLeft = __webpack_require__(48); +var SetTop = __webpack_require__(44); /** * Takes given Game Object and aligns it so that it is positioned in the top left of the other. @@ -96163,19 +103055,19 @@ module.exports = TopLeft; /***/ }), -/* 408 */ +/* 441 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterX = __webpack_require__(75); -var GetTop = __webpack_require__(42); -var SetCenterX = __webpack_require__(74); -var SetTop = __webpack_require__(41); +var GetCenterX = __webpack_require__(81); +var GetTop = __webpack_require__(45); +var SetCenterX = __webpack_require__(80); +var SetTop = __webpack_require__(44); /** * Takes given Game Object and aligns it so that it is positioned in the top center of the other. @@ -96207,19 +103099,19 @@ module.exports = TopCenter; /***/ }), -/* 409 */ +/* 442 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(72); -var GetRight = __webpack_require__(44); -var SetCenterY = __webpack_require__(73); -var SetRight = __webpack_require__(43); +var GetCenterY = __webpack_require__(78); +var GetRight = __webpack_require__(47); +var SetCenterY = __webpack_require__(79); +var SetRight = __webpack_require__(46); /** * Takes given Game Object and aligns it so that it is positioned in the right center of the other. @@ -96251,19 +103143,19 @@ module.exports = RightCenter; /***/ }), -/* 410 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(72); -var GetLeft = __webpack_require__(46); -var SetCenterY = __webpack_require__(73); -var SetLeft = __webpack_require__(45); +var GetCenterY = __webpack_require__(78); +var GetLeft = __webpack_require__(49); +var SetCenterY = __webpack_require__(79); +var SetLeft = __webpack_require__(48); /** * Takes given Game Object and aligns it so that it is positioned in the left center of the other. @@ -96295,17 +103187,17 @@ module.exports = LeftCenter; /***/ }), -/* 411 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetCenterX = __webpack_require__(74); -var SetCenterY = __webpack_require__(73); +var SetCenterX = __webpack_require__(80); +var SetCenterY = __webpack_require__(79); /** * Positions the Game Object so that it is centered on the given coordinates. @@ -96332,18 +103224,18 @@ module.exports = CenterOn; /***/ }), -/* 412 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(411); -var GetCenterX = __webpack_require__(75); -var GetCenterY = __webpack_require__(72); +var CenterOn = __webpack_require__(444); +var GetCenterX = __webpack_require__(81); +var GetCenterY = __webpack_require__(78); /** * Takes given Game Object and aligns it so that it is positioned in the center of the other. @@ -96374,19 +103266,19 @@ module.exports = Center; /***/ }), -/* 413 */ +/* 446 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(48); -var GetRight = __webpack_require__(44); -var SetBottom = __webpack_require__(47); -var SetRight = __webpack_require__(43); +var GetBottom = __webpack_require__(51); +var GetRight = __webpack_require__(47); +var SetBottom = __webpack_require__(50); +var SetRight = __webpack_require__(46); /** * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. @@ -96418,19 +103310,19 @@ module.exports = BottomRight; /***/ }), -/* 414 */ +/* 447 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(48); -var GetLeft = __webpack_require__(46); -var SetBottom = __webpack_require__(47); -var SetLeft = __webpack_require__(45); +var GetBottom = __webpack_require__(51); +var GetLeft = __webpack_require__(49); +var SetBottom = __webpack_require__(50); +var SetLeft = __webpack_require__(48); /** * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. @@ -96462,19 +103354,19 @@ module.exports = BottomLeft; /***/ }), -/* 415 */ +/* 448 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(48); -var GetCenterX = __webpack_require__(75); -var SetBottom = __webpack_require__(47); -var SetCenterX = __webpack_require__(74); +var GetBottom = __webpack_require__(51); +var GetCenterX = __webpack_require__(81); +var SetBottom = __webpack_require__(50); +var SetCenterX = __webpack_require__(80); /** * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. @@ -96506,28 +103398,28 @@ module.exports = BottomCenter; /***/ }), -/* 416 */ +/* 449 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ALIGN_CONST = __webpack_require__(193); +var ALIGN_CONST = __webpack_require__(208); var AlignInMap = []; -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(415); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(414); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(413); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(412); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(410); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(409); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(408); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(407); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(406); +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(448); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(447); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(446); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(445); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(443); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(442); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(441); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(440); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(439); /** * Takes given Game Object and aligns it so that it is positioned relative to the other. @@ -96555,12 +103447,12 @@ module.exports = QuickSet; /***/ }), -/* 417 */ +/* 450 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -96570,61 +103462,61 @@ module.exports = QuickSet; module.exports = { - Angle: __webpack_require__(1050), - Call: __webpack_require__(1049), - GetFirst: __webpack_require__(1048), - GetLast: __webpack_require__(1047), - GridAlign: __webpack_require__(1046), - IncAlpha: __webpack_require__(1035), - IncX: __webpack_require__(1034), - IncXY: __webpack_require__(1033), - IncY: __webpack_require__(1032), - PlaceOnCircle: __webpack_require__(1031), - PlaceOnEllipse: __webpack_require__(1030), - PlaceOnLine: __webpack_require__(1029), - PlaceOnRectangle: __webpack_require__(1028), - PlaceOnTriangle: __webpack_require__(1027), - PlayAnimation: __webpack_require__(1026), - PropertyValueInc: __webpack_require__(32), - PropertyValueSet: __webpack_require__(25), - RandomCircle: __webpack_require__(1025), - RandomEllipse: __webpack_require__(1024), - RandomLine: __webpack_require__(1023), - RandomRectangle: __webpack_require__(1022), - RandomTriangle: __webpack_require__(1021), - Rotate: __webpack_require__(1020), - RotateAround: __webpack_require__(1019), - RotateAroundDistance: __webpack_require__(1018), - ScaleX: __webpack_require__(1017), - ScaleXY: __webpack_require__(1016), - ScaleY: __webpack_require__(1015), - SetAlpha: __webpack_require__(1014), - SetBlendMode: __webpack_require__(1013), - SetDepth: __webpack_require__(1012), - SetHitArea: __webpack_require__(1011), - SetOrigin: __webpack_require__(1010), - SetRotation: __webpack_require__(1009), - SetScale: __webpack_require__(1008), - SetScaleX: __webpack_require__(1007), - SetScaleY: __webpack_require__(1006), - SetTint: __webpack_require__(1005), - SetVisible: __webpack_require__(1004), - SetX: __webpack_require__(1003), - SetXY: __webpack_require__(1002), - SetY: __webpack_require__(1001), - ShiftPosition: __webpack_require__(1000), - Shuffle: __webpack_require__(999), - SmootherStep: __webpack_require__(998), - SmoothStep: __webpack_require__(997), - Spread: __webpack_require__(996), - ToggleVisible: __webpack_require__(995), - WrapInRectangle: __webpack_require__(994) + Angle: __webpack_require__(1271), + Call: __webpack_require__(1270), + GetFirst: __webpack_require__(1269), + GetLast: __webpack_require__(1268), + GridAlign: __webpack_require__(1267), + IncAlpha: __webpack_require__(1233), + IncX: __webpack_require__(1232), + IncXY: __webpack_require__(1231), + IncY: __webpack_require__(1230), + PlaceOnCircle: __webpack_require__(1229), + PlaceOnEllipse: __webpack_require__(1228), + PlaceOnLine: __webpack_require__(1227), + PlaceOnRectangle: __webpack_require__(1226), + PlaceOnTriangle: __webpack_require__(1225), + PlayAnimation: __webpack_require__(1224), + PropertyValueInc: __webpack_require__(35), + PropertyValueSet: __webpack_require__(27), + RandomCircle: __webpack_require__(1223), + RandomEllipse: __webpack_require__(1222), + RandomLine: __webpack_require__(1221), + RandomRectangle: __webpack_require__(1220), + RandomTriangle: __webpack_require__(1219), + Rotate: __webpack_require__(1218), + RotateAround: __webpack_require__(1217), + RotateAroundDistance: __webpack_require__(1216), + ScaleX: __webpack_require__(1215), + ScaleXY: __webpack_require__(1214), + ScaleY: __webpack_require__(1213), + SetAlpha: __webpack_require__(1212), + SetBlendMode: __webpack_require__(1211), + SetDepth: __webpack_require__(1210), + SetHitArea: __webpack_require__(1209), + SetOrigin: __webpack_require__(1208), + SetRotation: __webpack_require__(1207), + SetScale: __webpack_require__(1206), + SetScaleX: __webpack_require__(1205), + SetScaleY: __webpack_require__(1204), + SetTint: __webpack_require__(1203), + SetVisible: __webpack_require__(1202), + SetX: __webpack_require__(1201), + SetXY: __webpack_require__(1200), + SetY: __webpack_require__(1199), + ShiftPosition: __webpack_require__(1198), + Shuffle: __webpack_require__(1197), + SmootherStep: __webpack_require__(1196), + SmoothStep: __webpack_require__(1195), + Spread: __webpack_require__(1194), + ToggleVisible: __webpack_require__(1193), + WrapInRectangle: __webpack_require__(1192) }; /***/ }), -/* 418 */ +/* 451 */ /***/ (function(module, exports) { /** @@ -96750,12 +103642,12 @@ module.exports = Pair; /***/ }), -/* 419 */ +/* 452 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -96765,36 +103657,36 @@ module.exports = Pair; module.exports = { - Bounce: __webpack_require__(1103), - Collision: __webpack_require__(1102), - Force: __webpack_require__(1101), - Friction: __webpack_require__(1100), - Gravity: __webpack_require__(1099), - Mass: __webpack_require__(1098), - Static: __webpack_require__(1097), - Sensor: __webpack_require__(1096), - SetBody: __webpack_require__(1095), - Sleep: __webpack_require__(1093), - Transform: __webpack_require__(1092), - Velocity: __webpack_require__(1091) + Bounce: __webpack_require__(1336), + Collision: __webpack_require__(1335), + Force: __webpack_require__(1334), + Friction: __webpack_require__(1333), + Gravity: __webpack_require__(1332), + Mass: __webpack_require__(1331), + Static: __webpack_require__(1330), + Sensor: __webpack_require__(1329), + SetBody: __webpack_require__(1328), + Sleep: __webpack_require__(1326), + Transform: __webpack_require__(1313), + Velocity: __webpack_require__(1312) }; /***/ }), -/* 420 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(895); -var TextureTintPipeline = __webpack_require__(196); +var ShaderSourceFS = __webpack_require__(1042); +var TextureTintPipeline = __webpack_require__(211); var LIGHT_COUNT = 10; @@ -96810,7 +103702,7 @@ var LIGHT_COUNT = 10; * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration of the pipeline, same as the {@link Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline}. The fragment shader will be replaced with the lighting shader. */ var ForwardDiffuseLightPipeline = new Class({ @@ -96835,6 +103727,20 @@ var ForwardDiffuseLightPipeline = new Class({ * @since 3.11.0 */ this.defaultNormalMap; + + /** + * Inverse rotation matrix for normal map rotations. + * + * @name Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#inverseRotationMatrix + * @type {Float32Array} + * @private + * @since 3.16.0 + */ + this.inverseRotationMatrix = new Float32Array([ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + ]); }, /** @@ -96889,8 +103795,8 @@ var ForwardDiffuseLightPipeline = new Class({ * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#onRender * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. */ @@ -96951,7 +103857,7 @@ var ForwardDiffuseLightPipeline = new Class({ /** * Generic function for batching a textured quad * - * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#batchTexture + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchTexture * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject @@ -97031,6 +103937,7 @@ var ForwardDiffuseLightPipeline = new Class({ } this.setTexture2D(normalTexture.glTexture, 1); + this.setNormalMapRotation(rotation); var camMatrix = this._tempMatrix1; var spriteMatrix = this._tempMatrix2; @@ -97149,22 +104056,22 @@ var ForwardDiffuseLightPipeline = new Class({ if (camera.roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } this.setTexture2D(texture, 0); - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); }, /** @@ -97173,7 +104080,7 @@ var ForwardDiffuseLightPipeline = new Class({ * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMap * @since 3.11.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to update. */ setNormalMap: function (gameObject) { @@ -97200,15 +104107,46 @@ var ForwardDiffuseLightPipeline = new Class({ }, /** - * [description] + * Rotates the normal map vectors inversely by the given angle. + * Only works in 2D space. + * + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#setNormalMapRotation + * @since 3.16.0 + * + * @param {number} rotation - The angle of rotation in radians. + */ + setNormalMapRotation: function (rotation) + { + var inverseRotationMatrix = this.inverseRotationMatrix; + + if (rotation) + { + var rot = -rotation; + var c = Math.cos(rot); + var s = Math.sin(rot); + + inverseRotationMatrix[1] = s; + inverseRotationMatrix[3] = -s; + inverseRotationMatrix[0] = inverseRotationMatrix[4] = c; + } + else + { + inverseRotationMatrix[0] = inverseRotationMatrix[4] = 1; + inverseRotationMatrix[1] = inverseRotationMatrix[3] = 0; + } + + this.renderer.setMatrix3(this.program, 'uInverseRotationMatrix', false, inverseRotationMatrix); + }, + + /** + * Takes a Sprite Game Object, or any object that extends it, which has a normal texture and adds it to the batch. * * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchSprite * @since 3.0.0 * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - [description] - * + * @param {Phaser.GameObjects.Sprite} sprite - The texture-based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - The transform matrix of the parent container, if set. */ batchSprite: function (sprite, camera, parentTransformMatrix) { @@ -97224,6 +104162,7 @@ var ForwardDiffuseLightPipeline = new Class({ this.renderer.setPipeline(this); this.setTexture2D(normalTexture.glTexture, 1); + this.setNormalMapRotation(sprite.rotation); TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera, parentTransformMatrix); } @@ -97237,20 +104176,20 @@ module.exports = ForwardDiffuseLightPipeline; /***/ }), -/* 421 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(897); -var ShaderSourceVS = __webpack_require__(896); -var WebGLPipeline = __webpack_require__(197); +var ShaderSourceFS = __webpack_require__(1044); +var ShaderSourceVS = __webpack_require__(1043); +var WebGLPipeline = __webpack_require__(212); /** * @classdesc @@ -97468,98 +104407,130 @@ module.exports = BitmapMaskPipeline; /***/ }), -/* 422 */ -/***/ (function(module, exports) { +/* 455 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CanvasPool = __webpack_require__(24); +var Color = __webpack_require__(32); +var GetFastValue = __webpack_require__(2); + /** - * Takes a snapshot of the current frame displayed by a WebGL canvas. + * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * * @function Phaser.Renderer.Snapshot.WebGL * @since 3.0.0 * * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. - * @param {string} [type='image/png'] - The format of the returned image. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - * - * @return {HTMLImageElement} A new image which contains a snapshot of the canvas's contents. + * @param {SnapshotState} config - The snapshot configuration object. */ -var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) +var WebGLSnapshot = function (sourceCanvas, config) { - 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; + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = GetFastValue(config, 'x', 0); + var y = GetFastValue(config, 'y', 0); + var width = GetFastValue(config, 'width', gl.drawingBufferWidth); + var height = GetFastValue(config, 'height', gl.drawingBufferHeight); + var getPixel = GetFastValue(config, 'getPixel', false); - 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) + if (getPixel) { - 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]; - } + var pixel = new Uint8Array(4); + + gl.readPixels(x, gl.drawingBufferHeight - y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel); + + callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3] / 255)); } + else + { + var pixels = new Uint8Array(width * height * 4); - ctx.putImageData(imageData, 0, 0); + gl.readPixels(x, gl.drawingBufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + + var canvas = CanvasPool.createWebGL(this, width, height); + var ctx = canvas.getContext('2d'); - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); + var imageData = ctx.getImageData(0, 0, width, height); + + var data = imageData.data; + + for (var py = 0; py < height; py++) + { + for (var px = 0; px < width; px++) + { + var sourceIndex = ((height - py) * width + px) * 4; + var destIndex = (py * width + px) * 4; - image.src = src; + data[destIndex + 0] = pixels[sourceIndex + 0]; + data[destIndex + 1] = pixels[sourceIndex + 1]; + data[destIndex + 2] = pixels[sourceIndex + 2]; + data[destIndex + 3] = pixels[sourceIndex + 3]; + } + } + + ctx.putImageData(imageData, 0, 0); + + var image = new Image(); - return image; + image.onerror = function () + { + callback.call(null); + + CanvasPool.remove(canvas); + }; + + image.onload = function () + { + callback.call(null, image); + + CanvasPool.remove(canvas); + }; + + image.src = canvas.toDataURL(type, encoderOptions); + } }; module.exports = WebGLSnapshot; /***/ }), -/* 423 */ +/* 456 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCamera = __webpack_require__(121); +var BaseCamera = __webpack_require__(131); +var CameraEvents = __webpack_require__(40); var Class = __webpack_require__(0); -var CONST = __webpack_require__(26); -var IsSizePowerOfTwo = __webpack_require__(117); -var SpliceOne = __webpack_require__(91); -var TransformMatrix = __webpack_require__(38); -var Utils = __webpack_require__(10); -var WebGLSnapshot = __webpack_require__(422); +var CONST = __webpack_require__(28); +var IsSizePowerOfTwo = __webpack_require__(127); +var SpliceOne = __webpack_require__(97); +var TextureEvents = __webpack_require__(126); +var TransformMatrix = __webpack_require__(41); +var Utils = __webpack_require__(9); +var WebGLSnapshot = __webpack_require__(455); // Default Pipelines -var BitmapMaskPipeline = __webpack_require__(421); -var ForwardDiffuseLightPipeline = __webpack_require__(420); -var TextureTintPipeline = __webpack_require__(196); +var BitmapMaskPipeline = __webpack_require__(454); +var ForwardDiffuseLightPipeline = __webpack_require__(453); +var TextureTintPipeline = __webpack_require__(211); /** * @callback WebGLContextCallback @@ -97567,14 +104538,6 @@ var TextureTintPipeline = __webpack_require__(196); * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. */ -/** - * @typedef {object} SnapshotState - * - * @property {SnapshotCallback} callback - The function to call after the snapshot is taken. - * @property {string} type - The type of the image to create. - * @property {number} encoder - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - */ - /** * @classdesc * WebGLRenderer is a class that contains the needed functionality to keep the @@ -97605,11 +104568,10 @@ var WebGLRenderer = new Class({ var contextCreationConfig = { alpha: gameConfig.transparent, - depth: false, // enable when 3D is added in the future + depth: false, antialias: gameConfig.antialias, premultipliedAlpha: gameConfig.premultipliedAlpha, stencil: true, - preserveDrawingBuffer: gameConfig.preserveDrawingBuffer, failIfMajorPerformanceCaveat: gameConfig.failIfMajorPerformanceCaveat, powerPreference: gameConfig.powerPreference }; @@ -97618,7 +104580,7 @@ var WebGLRenderer = new Class({ * The local configuration settings of this WebGL Renderer. * * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {RendererConfig} + * @type {object} * @since 3.0.0 */ this.config = { @@ -97627,7 +104589,6 @@ var WebGLRenderer = new Class({ backgroundColor: gameConfig.backgroundColor, contextCreation: contextCreationConfig, resolution: gameConfig.resolution, - autoResize: gameConfig.autoResize, roundPixels: gameConfig.roundPixels, maxTextures: gameConfig.maxTextures, maxTextureSize: gameConfig.maxTextureSize, @@ -97655,21 +104616,23 @@ var WebGLRenderer = new Class({ /** * The width of the canvas being rendered to. + * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#width * @type {integer} * @since 3.0.0 */ - this.width = game.config.width; + this.width = 0; /** * The height of the canvas being rendered to. + * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#height * @type {integer} * @since 3.0.0 */ - this.height = game.config.height; + this.height = 0; /** * The canvas which this WebGL Renderer draws to. @@ -97750,9 +104713,14 @@ var WebGLRenderer = new Class({ * @since 3.0.0 */ this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, callback: null, - type: null, - encoder: null + type: 'image/png', + encoder: 0.92 }; // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) @@ -97964,6 +104932,13 @@ var WebGLRenderer = new Class({ */ this.blankTexture = null; + /** + * A default Camera used in calls when no other camera has been provided. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultCamera + * @type {Phaser.Cameras.Scene2D.BaseCamera} + * @since 3.12.0 + */ this.defaultCamera = new BaseCamera(0, 0, 0, 0); /** @@ -98010,8 +104985,7 @@ var WebGLRenderer = new Class({ }, /** - * Creates a new WebGLRenderingContext and initializes all internal - * state. + * Creates a new WebGLRenderingContext and initializes all internal state. * * @method Phaser.Renderer.WebGL.WebGLRenderer#init * @since 3.0.0 @@ -98023,13 +104997,14 @@ var WebGLRenderer = new Class({ init: function (config) { var gl; + var game = this.game; var canvas = this.canvas; var clearColor = config.backgroundColor; // Did they provide their own context? - if (this.game.config.context) + if (game.config.context) { - gl = this.game.config.context; + gl = game.config.context; } else { @@ -98046,17 +105021,25 @@ var WebGLRenderer = new Class({ this.gl = gl; // Set it back into the Game, so developers can access it from there too - this.game.context = gl; + game.context = gl; - for (var i = 0; i <= 16; i++) + for (var i = 0; i <= 27; i++) { this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); } + // ADD this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; + + // MULTIPLY this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; + + // SCREEN this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; + // ERASE + this.blendModes[17] = { func: [ gl.ZERO, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_REVERSE_SUBTRACT }; + this.glFormats[0] = gl.BYTE; this.glFormats[1] = gl.SHORT; this.glFormats[2] = gl.UNSIGNED_BYTE; @@ -98085,14 +105068,13 @@ var WebGLRenderer = new Class({ this.supportedExtensions = exts; - // Setup initial WebGL state + // 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); + + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); // Initialize all textures to null for (var index = 0; index < this.currentTextures.length; ++index) @@ -98103,15 +105085,13 @@ var WebGLRenderer = new Class({ // Clear previous pipelines and reload default ones this.pipelines = {}; - this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ 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, maxLights: config.maxLights })); + this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: game, renderer: this })); + this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: game, renderer: this })); + this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: game, renderer: this, maxLights: config.maxLights })); this.setBlendMode(CONST.BlendModes.NORMAL); - this.resize(this.width, this.height); - - this.game.events.once('texturesready', this.boot, this); + game.textures.once(TextureEvents.READY, this.boot, this); return this; }, @@ -98135,38 +105115,64 @@ var WebGLRenderer = new Class({ this.pipelines.TextureTintPipeline.currentFrame = blank; this.blankTexture = blank; + + var gl = this.gl; + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + gl.enable(gl.SCISSOR_TEST); + + this.setPipeline(this.pipelines.TextureTintPipeline); + + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height, this.game.scale.resolution); }, /** - * Resizes the drawing buffer. + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize, displaySize, resolution) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height || resolution !== this.resolution) + { + this.resize(baseSize.width, baseSize.height, resolution); + } + }, + + /** + * Resizes the drawing buffer to match that required by the Scale Manager. * * @method Phaser.Renderer.WebGL.WebGLRenderer#resize * @since 3.0.0 * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. + * @param {number} [resolution] - The new resolution of the renderer. * * @return {this} This WebGLRenderer instance. */ - resize: function (width, height) + resize: function (width, height, resolution) { var gl = this.gl; var pipelines = this.pipelines; - var resolution = this.config.resolution; - this.width = Math.floor(width * resolution); - this.height = Math.floor(height * resolution); + this.width = width; + this.height = height; + this.resolution = resolution; - this.canvas.width = this.width; - this.canvas.height = this.height; - - if (this.config.autoResize) - { - this.canvas.style.width = (this.width / resolution) + 'px'; - this.canvas.style.height = (this.height / resolution) + 'px'; - } - - gl.viewport(0, 0, this.width, this.height); + gl.viewport(0, 0, width, height); // Update all registered pipelines for (var pipelineName in pipelines) @@ -98176,9 +105182,9 @@ var WebGLRenderer = new Class({ this.drawingBufferHeight = gl.drawingBufferHeight; - this.defaultCamera.setSize(width, height); + gl.scissor(0, (gl.drawingBufferHeight - height), width, height); - gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); + this.defaultCamera.setSize(width, height); return this; }, @@ -98326,7 +105332,7 @@ var WebGLRenderer = new Class({ * @param {string} pipelineName - A unique string-based key for the pipeline. * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - A pipeline instance which must extend WebGLPipeline. * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipline instance that was passed. + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance that was passed. */ addPipeline: function (pipelineName, pipelineInstance) { @@ -98356,18 +105362,21 @@ var WebGLRenderer = new Class({ * @param {integer} y - The y position of the scissor. * @param {integer} width - The width of the scissor. * @param {integer} height - The height of the scissor. + * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. * * @return {integer[]} An array containing the scissor values. */ - pushScissor: function (x, y, width, height) + pushScissor: function (x, y, width, height, drawingBufferHeight) { + if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } + var scissorStack = this.scissorStack; var scissor = [ x, y, width, height ]; scissorStack.push(scissor); - this.setScissor(x, y, width, height); + this.setScissor(x, y, width, height, drawingBufferHeight); this.currentScissor = scissor; @@ -98384,29 +105393,32 @@ var WebGLRenderer = new Class({ * @param {integer} y - The y position of the scissor. * @param {integer} width - The width of the scissor. * @param {integer} height - The height of the scissor. + * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. */ - setScissor: function (x, y, width, height) + setScissor: function (x, y, width, height, drawingBufferHeight) { var gl = this.gl; var current = this.currentScissor; - var cx = current[0]; - var cy = current[1]; - var cw = current[2]; - var ch = current[3]; + var setScissor = (width > 0 && height > 0); - if (cx !== x || cy !== y || cw !== width || ch !== height) + if (current && setScissor) + { + var cx = current[0]; + var cy = current[1]; + var cw = current[2]; + var ch = current[3]; + + setScissor = (cx !== x || cy !== y || cw !== width || ch !== height); + } + + if (setScissor) { this.flush(); // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor - - if (width > 0 && height > 0) - { - gl.scissor(x, (this.drawingBufferHeight - y - height), width, height); - - } + gl.scissor(x, (drawingBufferHeight - y - height), width, height); } }, @@ -98461,6 +105473,71 @@ var WebGLRenderer = new Class({ return this.currentPipeline; }, + /** + * Use this to reset the gl context to the state that Phaser requires to continue rendering. + * Calling this will: + * + * * Disable `DEPTH_TEST`, `CULL_FACE` and `STENCIL_TEST`. + * * Clear the depth buffer and stencil buffers. + * * Reset the viewport size. + * * Reset the blend mode. + * * Bind a blank texture as the active texture on texture unit zero. + * * Rebinds the given pipeline instance. + * + * You should call this having previously called `clearPipeline` and then wishing to return + * control to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#rebindPipeline + * @since 3.16.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - The pipeline instance to be activated. + */ + rebindPipeline: function (pipelineInstance) + { + var gl = this.gl; + + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.disable(gl.STENCIL_TEST); + + gl.clear(gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); + + gl.viewport(0, 0, this.width, this.height); + + this.setBlendMode(0, true); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, this.blankTexture.glTexture); + + this.currentActiveTextureUnit = 0; + this.currentTextures[0] = this.blankTexture.glTexture; + + this.currentPipeline = pipelineInstance; + this.currentPipeline.bind(); + this.currentPipeline.onBind(); + }, + + /** + * Flushes the current WebGLPipeline being used and then clears it, along with the + * the current shader program and vertex buffer. Then resets the blend mode to NORMAL. + * Call this before jumping to your own gl context handler, and then call `rebindPipeline` when + * you wish to return control to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#clearPipeline + * @since 3.16.0 + */ + clearPipeline: function () + { + this.flush(); + + this.currentPipeline = null; + this.currentProgram = null; + this.currentVertexBuffer = null; + this.currentIndexBuffer = null; + + this.setBlendMode(0, true); + }, + /** * Sets the blend mode to the value given. * @@ -98471,15 +105548,18 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {integer} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. + * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. * * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. */ - setBlendMode: function (blendModeId) + setBlendMode: function (blendModeId, force) { + if (force === undefined) { force = false; } + var gl = this.gl; var blendMode = this.blendModes[blendModeId]; - if (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId) + if (force || (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId)) { this.flush(); @@ -98561,7 +105641,7 @@ var WebGLRenderer = new Class({ */ removeBlendMode: function (index) { - if (index > 16 && this.blendModes[index]) + if (index > 17 && this.blendModes[index]) { this.blendModes.splice(index, 1); } @@ -98598,16 +105678,22 @@ var WebGLRenderer = new Class({ * * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. * @param {integer} textureUnit - The texture unit to which the texture will be bound. + * @param {boolean} [flush=true] - Will the current pipeline be flushed if this is a new texture, or not? * * @return {this} This WebGLRenderer instance. */ - setTexture2D: function (texture, textureUnit) + setTexture2D: function (texture, textureUnit, flush) { + if (flush === undefined) { flush = true; } + var gl = this.gl; if (texture !== this.currentTextures[textureUnit]) { - this.flush(); + if (flush) + { + this.flush(); + } if (this.currentActiveTextureUnit !== textureUnit) { @@ -98631,11 +105717,14 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. * * @return {this} This WebGLRenderer instance. */ - setFramebuffer: function (framebuffer) + setFramebuffer: function (framebuffer, updateScissor) { + if (updateScissor === undefined) { updateScissor = false; } + var gl = this.gl; var width = this.width; @@ -98657,6 +105746,22 @@ var WebGLRenderer = new Class({ gl.viewport(0, 0, width, height); + if (updateScissor) + { + if (framebuffer) + { + this.drawingBufferHeight = height; + + this.pushScissor(0, 0, width, height); + } + else + { + this.drawingBufferHeight = this.height; + + this.popScissor(); + } + } + this.currentFramebuffer = framebuffer; } @@ -98827,6 +105932,7 @@ var WebGLRenderer = new Class({ else { gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); + width = pixels.width; height = pixels.height; } @@ -99013,7 +106119,7 @@ var WebGLRenderer = new Class({ this.gl.deleteTexture(texture); - if (this.currentTextures[0] === texture) + if (this.currentTextures[0] === texture && !this.game.pendingDestroy) { // texture we just deleted is in use, so bind a blank texture this.setBlankTexture(true); @@ -99118,7 +106224,7 @@ var WebGLRenderer = new Class({ ); } - camera.emit('prerender', camera); + camera.emit(CameraEvents.PRE_RENDER, camera); } else { @@ -99161,7 +106267,7 @@ var WebGLRenderer = new Class({ this.setFramebuffer(null); - camera.emit('postrender', camera); + camera.emit(CameraEvents.POST_RENDER, camera); TextureTintPipeline.projOrtho(0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0); @@ -99207,12 +106313,17 @@ var WebGLRenderer = new Class({ if (this.contextLost) { return; } var gl = this.gl; - var color = this.config.backgroundColor; var pipelines = this.pipelines; + // Make sure we are bound to the main frame buffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + if (this.config.clearBeforeRender) { - gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); + var clearColor = this.config.backgroundColor; + + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } @@ -99238,8 +106349,14 @@ var WebGLRenderer = new Class({ }, /** - * The core render step for a Scene. + * The core render step for a Scene Camera. + * * Iterates through the given Game Object's array and renders them with the given Camera. + * + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. + * + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * * @method Phaser.Renderer.WebGL.WebGLRenderer#render * @since 3.0.0 @@ -99315,10 +106432,13 @@ var WebGLRenderer = new Class({ // Unbind custom framebuffer here - if (this.snapshotState.callback) + var state = this.snapshotState; + + if (state.callback) { - this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); - this.snapshotState.callback = null; + WebGLSnapshot(this.canvas, state); + + state.callback = null; } var pipelines = this.pipelines; @@ -99330,22 +106450,100 @@ var WebGLRenderer = new Class({ }, /** - * Schedules a snapshot to be taken after the current frame is rendered. + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot * @since 3.0.0 * - * @param {SnapshotCallback} callback - Function to invoke after the snapshot is created. - * @param {string} type - The format of the image to create, usually `image/png`. - * @param {number} encoderOptions - The image quality, between 0 and 1, to use for image formats with lossy compression (such as `image/jpeg`). + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} This WebGL Renderer. + * @return {this} This WebGL Renderer. */ snapshot: function (callback, type, encoderOptions) { - this.snapshotState.callback = callback; - this.snapshotState.type = type; - this.snapshotState.encoder = encoderOptions; + return this.snapshotArea(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gl.drawingBufferWidth); + state.height = Math.min(height, this.gl.drawingBufferHeight); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; return this; }, @@ -99377,7 +106575,9 @@ var WebGLRenderer = new Class({ wrapping = gl.REPEAT; } - dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); + var filter = (this.config.antialias) ? gl.LINEAR : gl.NEAREST; + + dstTexture = this.createTexture2D(0, filter, filter, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); } else { @@ -99624,8 +106824,8 @@ var WebGLRenderer = new Class({ * * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] + * @param {integer} x - The new X component + * @param {integer} y - The new Y component * * @return {this} This WebGL Renderer instance. */ @@ -99646,9 +106846,9 @@ var WebGLRenderer = new Class({ * * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] + * @param {integer} x - The new X component + * @param {integer} y - The new Y component + * @param {integer} z - The new Z component * * @return {this} This WebGL Renderer instance. */ @@ -99686,15 +106886,15 @@ var WebGLRenderer = new Class({ }, /** - * [description] + * Sets the value of a 2x2 matrix uniform variable in the given WebGLProgram. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 * @since 3.0.0 * * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] + * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. + * @param {Float32Array} matrix - The new matrix value. * * @return {this} This WebGL Renderer instance. */ @@ -99780,7 +106980,7 @@ var WebGLRenderer = new Class({ }, /** - * [description] + * Destroy this WebGLRenderer, cleaning up all related resources such as pipelines, native textures, etc. * * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy * @since 3.0.0 @@ -99795,7 +106995,7 @@ var WebGLRenderer = new Class({ delete this.pipelines[key]; } - for (var index = 0; index < this.nativeTextures.length; ++index) + for (var index = 0; index < this.nativeTextures.length; index++) { this.deleteTexture(this.nativeTextures[index]); @@ -99816,25 +107016,27 @@ module.exports = WebGLRenderer; /***/ }), -/* 424 */ +/* 457 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var modes = __webpack_require__(66); -var CanvasFeatures = __webpack_require__(339); +var modes = __webpack_require__(60); +var CanvasFeatures = __webpack_require__(388); /** - * [description] + * Returns an array which maps the default blend modes to supported Canvas blend modes. + * + * If the browser doesn't support a blend mode, it will default to the normal `source-over` blend mode. * * @function Phaser.Renderer.Canvas.GetBlendModes * @since 3.0.0 * - * @return {array} [description] + * @return {array} Which Canvas blend mode corresponds to which default Phaser blend mode. */ var GetBlendModes = function () { @@ -99859,6 +107061,17 @@ var GetBlendModes = function () output[modes.SATURATION] = (useNew) ? 'saturation' : so; output[modes.COLOR] = (useNew) ? 'color' : so; output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : so; + output[modes.ERASE] = 'destination-out'; + output[modes.SOURCE_IN] = 'source-in'; + output[modes.SOURCE_OUT] = 'source-out'; + output[modes.SOURCE_ATOP] = 'source-atop'; + output[modes.DESTINATION_OVER] = 'destination-over'; + output[modes.DESTINATION_IN] = 'destination-in'; + output[modes.DESTINATION_OUT] = 'destination-out'; + output[modes.DESTINATION_ATOP] = 'destination-atop'; + output[modes.LIGHTER] = 'lighter'; + output[modes.COPY] = 'copy'; + output[modes.XOR] = 'xor'; return output; }; @@ -99867,66 +107080,121 @@ module.exports = GetBlendModes; /***/ }), -/* 425 */ -/***/ (function(module, exports) { +/* 458 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CanvasPool = __webpack_require__(24); +var Color = __webpack_require__(32); +var GetFastValue = __webpack_require__(2); + /** - * [description] + * Takes a snapshot of an area from the current frame displayed by a canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * * @function Phaser.Renderer.Snapshot.Canvas * @since 3.0.0 * - * @param {HTMLCanvasElement} canvas - [description] - * @param {string} [type='image/png'] - [description] - * @param {number} [encoderOptions=0.92] - [description] - * - * @return {HTMLImageElement} [description] + * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {SnapshotState} config - The snapshot configuration object. */ -var CanvasSnapshot = function (canvas, type, encoderOptions) +var CanvasSnapshot = function (canvas, config) { - if (type === undefined) { type = 'image/png'; } - if (encoderOptions === undefined) { encoderOptions = 0.92; } + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); + var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); + var width = GetFastValue(config, 'width', canvas.width); + var height = GetFastValue(config, 'height', canvas.height); + var getPixel = GetFastValue(config, 'getPixel', false); - var src = canvas.toDataURL(type, encoderOptions); + if (getPixel) + { + var context = canvas.getContext('2d'); + var imageData = context.getImageData(x, y, 1, 1); + var data = imageData.data; - var image = new Image(); + callback.call(null, new Color(data[0], data[1], data[2], data[3] / 255)); + } + else if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) + { + // Area Grab + var copyCanvas = CanvasPool.createWebGL(this, width, height); + var ctx = copyCanvas.getContext('2d'); - image.src = src; + ctx.drawImage(canvas, x, y, width, height, 0, 0, width, height); - return image; + var image1 = new Image(); + + image1.onerror = function () + { + callback.call(null); + + CanvasPool.remove(copyCanvas); + }; + + image1.onload = function () + { + callback.call(null, image1); + + CanvasPool.remove(copyCanvas); + }; + + image1.src = copyCanvas.toDataURL(type, encoderOptions); + } + else + { + // Full Grab + var image2 = new Image(); + + image2.onerror = function () + { + callback.call(null); + }; + + image2.onload = function () + { + callback.call(null, image2); + }; + + image2.src = canvas.toDataURL(type, encoderOptions); + } }; module.exports = CanvasSnapshot; /***/ }), -/* 426 */ +/* 459 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasSnapshot = __webpack_require__(425); +var CanvasSnapshot = __webpack_require__(458); +var CameraEvents = __webpack_require__(40); var Class = __webpack_require__(0); -var CONST = __webpack_require__(26); -var GetBlendModes = __webpack_require__(424); -var ScaleModes = __webpack_require__(94); -var Smoothing = __webpack_require__(120); -var TransformMatrix = __webpack_require__(38); +var CONST = __webpack_require__(28); +var GetBlendModes = __webpack_require__(457); +var ScaleModes = __webpack_require__(101); +var Smoothing = __webpack_require__(130); +var TransformMatrix = __webpack_require__(41); /** * @classdesc - * [description] + * The Canvas Renderer is responsible for managing 2D canvas rendering contexts, including the one used by the Game's canvas. It tracks the internal state of a given context and can renderer textured Game Objects to it, taking into account alpha, blending, and scaling. * * @class CanvasRenderer * @memberof Phaser.Renderer.Canvas @@ -99951,7 +107219,7 @@ var CanvasRenderer = new Class({ this.game = game; /** - * [description] + * A constant which allows the renderer to be easily identified as a Canvas Renderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#type * @type {integer} @@ -99960,7 +107228,7 @@ var CanvasRenderer = new Class({ this.type = CONST.CANVAS; /** - * [description] + * The total number of Game Objects which were rendered in a frame. * * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount * @type {number} @@ -99970,41 +107238,40 @@ var CanvasRenderer = new Class({ this.drawCount = 0; /** - * [description] + * The width of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {number} + * @type {integer} * @since 3.0.0 */ - this.width = game.config.width; + this.width = 0; /** - * [description] + * The height of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {number} + * @type {integer} * @since 3.0.0 */ - this.height = game.config.height; + this.height = 0; /** - * [description] + * The local configuration settings of the CanvasRenderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {RendererConfig} + * @type {object} * @since 3.0.0 */ this.config = { clearBeforeRender: game.config.clearBeforeRender, backgroundColor: game.config.backgroundColor, resolution: game.config.resolution, - autoResize: game.config.autoResize, antialias: game.config.antialias, roundPixels: game.config.roundPixels }; /** - * [description] + * The scale mode which should be used by the CanvasRenderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode * @type {integer} @@ -100013,7 +107280,7 @@ var CanvasRenderer = new Class({ this.scaleMode = (game.config.antialias) ? ScaleModes.LINEAR : ScaleModes.NEAREST; /** - * [description] + * The canvas element which the Game uses. * * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas * @type {HTMLCanvasElement} @@ -100022,7 +107289,7 @@ var CanvasRenderer = new Class({ this.gameCanvas = game.canvas; /** - * [description] + * The canvas context used to render all Cameras in all Scenes during the game loop. * * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext * @type {CanvasRenderingContext2D} @@ -100031,7 +107298,7 @@ var CanvasRenderer = new Class({ this.gameContext = (this.game.config.context) ? this.game.config.context : this.gameCanvas.getContext('2d'); /** - * [description] + * The canvas context currently used by the CanvasRenderer for all rendering operations. * * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext * @type {CanvasRenderingContext2D} @@ -100040,7 +107307,9 @@ var CanvasRenderer = new Class({ this.currentContext = this.gameContext; /** - * [description] + * The blend modes supported by the Canvas Renderer. + * + * This object maps the {@link Phaser.BlendModes} to canvas compositing operations. * * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes * @type {array} @@ -100052,7 +107321,7 @@ var CanvasRenderer = new Class({ // image-rendering: pixelated; /** - * [description] + * The scale mode currently in use by the Canvas Renderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#currentScaleMode * @type {number} @@ -100062,34 +107331,24 @@ var CanvasRenderer = new Class({ this.currentScaleMode = 0; /** - * [description] + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback - * @type {?SnapshotCallback} - * @default null - * @since 3.0.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState + * @type {SnapshotState} + * @since 3.16.0 */ - this.snapshotCallback = null; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType - * @type {?string} - * @default null - * @since 3.0.0 - */ - this.snapshotType = null; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder - * @type {?number} - * @default null - * @since 3.0.0 - */ - this.snapshotEncoder = null; + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92 + }; /** * A temporary Transform Matrix, re-used internally during batching. @@ -100135,14 +107394,38 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Prepares the game canvas for rendering. * * @method Phaser.Renderer.Canvas.CanvasRenderer#init * @since 3.0.0 */ init: function () { - this.resize(this.width, this.height); + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height); + }, + + /** + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height) + { + this.resize(baseSize.width, baseSize.height); + } }, /** @@ -100151,24 +107434,13 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#resize * @since 3.0.0 * - * @param {integer} width - [description] - * @param {integer} height - [description] + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. */ resize: function (width, height) { - var resolution = this.config.resolution; - - this.width = width * resolution; - this.height = height * resolution; - - this.gameCanvas.width = this.width; - this.gameCanvas.height = this.height; - - if (this.config.autoResize) - { - this.gameCanvas.style.width = (this.width / resolution) + 'px'; - this.gameCanvas.style.height = (this.height / resolution) + 'px'; - } + this.width = width; + this.height = height; // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) if (this.scaleMode === ScaleModes.NEAREST) @@ -100178,31 +107450,31 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * A NOOP method for handling lost context. Intentionally empty. * * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost * @since 3.0.0 * - * @param {function} callback - [description] + * @param {function} callback - Ignored parameter. */ onContextLost: function () { }, /** - * [description] + * A NOOP method for handling restored context. Intentionally empty. * * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored * @since 3.0.0 * - * @param {function} callback - [description] + * @param {function} callback - Ignored parameter. */ onContextRestored: function () { }, /** - * [description] + * Resets the transformation matrix of the current context to the identity matrix, thus resetting any transformation. * * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform * @since 3.0.0 @@ -100213,14 +107485,14 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Sets the blend mode (compositing operation) of the current context. * * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode * @since 3.0.0 * - * @param {number} blendMode - [description] + * @param {string} blendMode - The new blend mode which should be used. * - * @return {this} [description] + * @return {this} This CanvasRenderer object. */ setBlendMode: function (blendMode) { @@ -100247,14 +107519,14 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Sets the global alpha of the current context. * * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha * @since 3.0.0 * - * @param {number} alpha - [description] + * @param {number} alpha - The new alpha to use, where 0 is fully transparent and 1 is fully opaque. * - * @return {this} [description] + * @return {this} This CanvasRenderer object. */ setAlpha: function (alpha) { @@ -100277,6 +107549,10 @@ var CanvasRenderer = new Class({ var width = this.width; var height = this.height; + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; + ctx.setTransform(1, 0, 0, 1, 0, 0); + if (config.clearBeforeRender) { ctx.clearRect(0, 0, width, height); @@ -100288,6 +107564,8 @@ var CanvasRenderer = new Class({ ctx.fillRect(0, 0, width, height); } + ctx.save(); + this.drawCount = 0; }, @@ -100297,10 +107575,10 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#render * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.DisplayList} children - [description] - * @param {number} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Scene} scene - The Scene to render. + * @param {Phaser.GameObjects.DisplayList} children - The Game Objects within the Scene to be rendered. + * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently unused. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ render: function (scene, children, interpolationPercentage, camera) { @@ -100314,12 +107592,18 @@ var CanvasRenderer = new Class({ var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; - var scissor = (cx !== 0 || cy !== 0 || cw !== ctx.canvas.width || ch !== ctx.canvas.height); + // Save context pre-clip + ctx.save(); + + if (this.game.scene.customViewports) + { + ctx.beginPath(); + ctx.rect(cx, cy, cw, ch); + ctx.clip(); + } 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 (!camera.transparent) { ctx.fillStyle = camera.backgroundColor.rgba; @@ -100332,17 +107616,9 @@ var CanvasRenderer = new Class({ this.drawCount += list.length; - if (scissor) - { - ctx.save(); - ctx.beginPath(); - ctx.rect(cx, cy, cw, ch); - ctx.clip(); - } - if (camera.renderToTexture) { - camera.emit('prerender', camera); + camera.emit(CameraEvents.PRE_RENDER, camera); } camera.matrix.copyToContext(ctx); @@ -100378,22 +107654,21 @@ var CanvasRenderer = new Class({ camera.dirty = false; - // Reset the camera scissor - if (scissor) - { - ctx.restore(); - } + // Restore pre-clip context + ctx.restore(); if (camera.renderToTexture) { - camera.emit('postrender', camera); + camera.emit(CameraEvents.POST_RENDER, camera); scene.sys.context.drawImage(camera.canvas, cx, cy); } }, /** - * [description] + * Restores the game context's global settings and takes a snapshot if one is scheduled. + * + * The post-render step happens after all Cameras in all Scenes have been rendered. * * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender * @since 3.0.0 @@ -100402,31 +107677,111 @@ var CanvasRenderer = new Class({ { var ctx = this.gameContext; - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = 'source-over'; + ctx.restore(); - if (this.snapshotCallback) + var state = this.snapshotState; + + if (state.callback) { - this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); - this.snapshotCallback = null; + CanvasSnapshot(this.gameCanvas, state); + + state.callback = null; } }, /** - * [description] + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot * @since 3.0.0 * - * @param {SnapshotCallback} callback - [description] - * @param {string} type - [description] - * @param {number} encoderOptions - [description] + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. */ snapshot: function (callback, type, encoderOptions) { - this.snapshotCallback = callback; - this.snapshotType = type; - this.snapshotEncoder = encoderOptions; + return this.snapshotArea(0, 0, this.gameCanvas.width, this.gameCanvas.height, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gameCanvas.width); + state.height = Math.min(height, this.gameCanvas.height); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; + + return this; }, /** @@ -100554,7 +107909,7 @@ var CanvasRenderer = new Class({ }, /** - * [description] + * Destroys all object references in the Canvas Renderer. * * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy * @since 3.0.0 @@ -100573,73 +107928,18 @@ module.exports = CanvasRenderer; /***/ }), -/* 427 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var BaseAnimation = __webpack_require__(205); var Class = __webpack_require__(0); - -/** - * This event is dispatched when an animation starts playing. - * - * Listen for it on the Game Object: `sprite.on('animationstart', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onStartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation restarts. - * - * Listen for it on the Game Object: `sprite.on('animationrestart', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onRestartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation repeats. - * - * Listen for it on the Game Object: `sprite.on('animationrepeat', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onRepeatEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {integer} repeatCount - The number of times this animation has repeated. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation updates. This happens when the animation frame changes, - * based on the animation frame rate and other factors like timeScale and delay. - * - * Listen for it on the Game Object: `sprite.on('animationupdate', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onUpdateEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation completes playing, either naturally or via Animation.stop. - * - * Listen for it on the Game Object: `sprite.on('animationcomplete', listener)` - * - * @event Phaser.GameObjects.Components.Animation#onCompleteEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ +var Events = __webpack_require__(136); /** * @classdesc @@ -100678,7 +107978,7 @@ var Animation = new Class({ */ this.animationManager = parent.scene.sys.anims; - this.animationManager.once('remove', this.remove, this); + this.animationManager.once(Events.REMOVE_ANIMATION, this.remove, this); /** * Is an animation currently playing or not? @@ -100710,6 +108010,16 @@ var Animation = new Class({ */ this.currentFrame = null; + /** + * The key of the next Animation to be loaded into this Animation Controller when the current animation completes. + * + * @name Phaser.GameObjects.Components.Animation#nextAnim + * @type {?string} + * @default null + * @since 3.16.0 + */ + this.nextAnim = null; + /** * Time scale factor. * @@ -100822,9 +108132,10 @@ var Animation = new Class({ * An Internal trigger that's play the animation in reverse mode ('true') or not ('false'), * needed because forward can be changed by yoyo feature. * - * @name Phaser.GameObjects.Components.Animation#forward + * @name Phaser.GameObjects.Components.Animation#_reverse * @type {boolean} * @default false + * @private * @since 3.12.0 */ this._reverse = false; @@ -100917,6 +108228,37 @@ var Animation = new Class({ this._pendingStopValue; }, + /** + * Sets an animation to be played immediately after the current one completes. + * + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, or have the `stop` method called directly on it. + * + * An animation set to repeat forever will never enter a completed state. + * + * You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` callback). + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing. + * + * Call this method with no arguments to reset the chained animation. + * + * @method Phaser.GameObjects.Components.Animation#chain + * @since 3.16.0 + * + * @param {(string|Phaser.Animations.Animation)} [key] - The string-based key of the animation to play next, as defined previously in the Animation Manager. Or an Animation instance. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + */ + chain: function (key) + { + if (key instanceof BaseAnimation) + { + key = key.key; + } + + this.nextAnim = key; + + return this.parent; + }, + /** * Sets the amount of time, in milliseconds, that the animation will be delayed before starting playback. * @@ -101086,13 +108428,15 @@ var Animation = new Class({ }, /** - * Plays an Animation on the Game Object that owns this Animation Component. + * Plays an Animation on a Game Object that has the Animation component, such as a Sprite. + * + * Animations are stored in the global Animation Manager and are referenced by a unique string-based key. * * @method Phaser.GameObjects.Components.Animation#play * @fires Phaser.GameObjects.Components.Animation#onStartEvent * @since 3.0.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. + * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * @@ -101103,6 +108447,11 @@ var Animation = new Class({ if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (key instanceof BaseAnimation) + { + key = key.key; + } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) { return this.parent; @@ -101121,7 +108470,7 @@ var Animation = new Class({ * @fires Phaser.GameObjects.Components.Animation#onStartEvent * @since 3.12.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. + * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * @@ -101132,6 +108481,11 @@ var Animation = new Class({ if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (key instanceof BaseAnimation) + { + key = key.key; + } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) { return this.parent; @@ -101144,11 +108498,12 @@ var Animation = new Class({ }, /** - * Load an Animation and fires 'onStartEvent' event, - * extracted from 'play' method + * Load an Animation and fires 'onStartEvent' event, extracted from 'play' method. * * @method Phaser.GameObjects.Components.Animation#_startAnimation - * @fires Phaser.GameObjects.Components.Animation#onStartEvent + * @fires Phaser.Animations.Events#START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_KEY_ANIMATION_EVENT * @since 3.12.0 * * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. @@ -101176,26 +108531,33 @@ var Animation = new Class({ gameObject.visible = true; } - gameObject.emit('animationstart', this.currentAnim, this.currentFrame, gameObject); + var frame = this.currentFrame; + + anim.emit(Events.ANIMATION_START, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_START + key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_START, anim, frame, gameObject); return gameObject; }, /** - * Reverse an Animation that is already playing on the Game Object. + * Reverse the Animation that is already playing on the Game Object. * * @method Phaser.GameObjects.Components.Animation#reverse * @since 3.12.0 * - * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. - * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - reverse: function (key) + reverse: function () { - if (!this.isPlaying || this.currentAnim.key !== key) { return this.parent; } - this._reverse = !this._reverse; - this.forward = !this.forward; + if (this.isPlaying) + { + this._reverse = !this._reverse; + + this.forward = !this.forward; + } return this.parent; }, @@ -101341,7 +108703,9 @@ var Animation = new Class({ * Restarts the current animation from its beginning, optionally including its delay value. * * @method Phaser.GameObjects.Components.Animation#restart - * @fires Phaser.GameObjects.Components.Animation#onRestartEvent + * @fires Phaser.Animations.Events#RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_KEY_ANIMATION_EVENT * @since 3.0.0 * * @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting. @@ -101352,7 +108716,9 @@ var Animation = new Class({ { if (includeDelay === undefined) { includeDelay = false; } - this.currentAnim.getFirstTick(this, includeDelay); + var anim = this.currentAnim; + + anim.getFirstTick(this, includeDelay); this.forward = true; this.isPlaying = true; @@ -101360,17 +108726,26 @@ var Animation = new Class({ this._paused = false; // Set frame - this.updateFrame(this.currentAnim.frames[0]); + this.updateFrame(anim.frames[0]); var gameObject = this.parent; + var frame = this.currentFrame; - gameObject.emit('animationrestart', this.currentAnim, this.currentFrame, gameObject); + anim.emit(Events.ANIMATION_RESTART, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_RESTART + anim.key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_RESTART, anim, frame, gameObject); return this.parent; }, /** * Immediately stops the current animation from playing and dispatches the `animationcomplete` event. + * + * If no animation is set, no event will be dispatched. + * + * If there is another animation queued (via the `chain` method) then it will start playing immediately. * * @method Phaser.GameObjects.Components.Animation#stop * @fires Phaser.GameObjects.Components.Animation#onCompleteEvent @@ -101385,8 +108760,26 @@ var Animation = new Class({ this.isPlaying = false; var gameObject = this.parent; + var anim = this.currentAnim; + var frame = this.currentFrame; - gameObject.emit('animationcomplete', this.currentAnim, this.currentFrame, gameObject); + if (anim) + { + anim.emit(Events.ANIMATION_COMPLETE, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_KEY_COMPLETE + anim.key, anim, frame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_COMPLETE, anim, frame, gameObject); + } + + if (this.nextAnim) + { + var key = this.nextAnim; + + this.nextAnim = null; + + this.play(key); + } return gameObject; }, @@ -101434,7 +108827,7 @@ var Animation = new Class({ * @fires Phaser.GameObjects.Components.Animation#onCompleteEvent * @since 3.4.0 * - * @param {Phaser.Animations.AnimationFrame} delay - The frame to check before stopping this animation. + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -101569,7 +108962,8 @@ var Animation = new Class({ * Internal frame change handler. * * @method Phaser.GameObjects.Components.Animation#updateFrame - * @fires Phaser.GameObjects.Components.Animation#onUpdateEvent + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE_EVENT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE_EVENT * @private * @since 3.0.0 * @@ -101588,7 +108982,9 @@ var Animation = new Class({ var anim = this.currentAnim; - gameObject.emit('animationupdate', anim, animationFrame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_UPDATE + anim.key, anim, animationFrame, gameObject); + + gameObject.emit(Events.SPRITE_ANIMATION_UPDATE, anim, animationFrame, gameObject); if (this._pendingStop === 3 && this._pendingStopValue === animationFrame) { @@ -101597,6 +108993,50 @@ var Animation = new Class({ } }, + /** + * Advances the animation to the next frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. + * + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in reverse, calling this method doesn't then change the direction to forwards. + * + * @method Phaser.GameObjects.Components.Animation#nextFrame + * @since 3.16.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + */ + nextFrame: function () + { + if (this.currentAnim) + { + this.currentAnim.nextFrame(this); + } + + return this.parent; + }, + + /** + * Advances the animation to the previous frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. + * + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in forwards, calling this method doesn't then change the direction to backwards. + * + * @method Phaser.GameObjects.Components.Animation#previousFrame + * @since 3.16.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + */ + previousFrame: function () + { + if (this.currentAnim) + { + this.currentAnim.previousFrame(this); + } + + return this.parent; + }, + /** * Sets if the current Animation will yoyo when it reaches the end. * A yoyo'ing animation will play through consecutively, and then reverse-play back to the start again. @@ -101641,7 +109081,7 @@ var Animation = new Class({ */ destroy: function () { - this.animationManager.off('remove', this.remove, this); + this.animationManager.off(Events.REMOVE_ANIMATION, this.remove, this); this.animationManager = null; this.parent = null; @@ -101656,12 +109096,12 @@ module.exports = Animation; /***/ }), -/* 428 */ +/* 461 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101669,28 +109109,28 @@ module.exports = Animation; * Takes the given string and reverses it, returning the reversed string. * For example if given the string `Atari 520ST` it would return `TS025 iratA`. * - * @function Phaser.Utils.String.ReverseString + * @function Phaser.Utils.String.Reverse * @since 3.0.0 * * @param {string} string - The string to be reversed. * * @return {string} The reversed string. */ -var ReverseString = function (string) +var Reverse = function (string) { return string.split('').reverse().join(''); }; -module.exports = ReverseString; +module.exports = Reverse; /***/ }), -/* 429 */ +/* 462 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101720,12 +109160,12 @@ module.exports = Format; /***/ }), -/* 430 */ +/* 463 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101735,26 +109175,26 @@ module.exports = Format; module.exports = { - Format: __webpack_require__(429), - Pad: __webpack_require__(179), - Reverse: __webpack_require__(428), - UppercaseFirst: __webpack_require__(327), - UUID: __webpack_require__(295) + Format: __webpack_require__(462), + Pad: __webpack_require__(193), + Reverse: __webpack_require__(461), + UppercaseFirst: __webpack_require__(330), + UUID: __webpack_require__(299) }; /***/ }), -/* 431 */ +/* 464 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Creates a new Object using all values from obj1. @@ -101764,10 +109204,10 @@ var Clone = __webpack_require__(63); * @function Phaser.Utils.Objects.MergeRight * @since 3.0.0 * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] + * @param {object} obj1 - The first object to merge. + * @param {object} obj2 - The second object to merge. Keys from this object which also exist in `obj1` will be copied to `obj1`. * - * @return {object} [description] + * @return {object} The merged object. `obj1` and `obj2` are not modified. */ var MergeRight = function (obj1, obj2) { @@ -101788,12 +109228,12 @@ module.exports = MergeRight; /***/ }), -/* 432 */ +/* 465 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101825,12 +109265,12 @@ module.exports = HasAll; /***/ }), -/* 433 */ +/* 466 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101864,44 +109304,44 @@ module.exports = GetMinMaxValue; /***/ }), -/* 434 */ +/* 467 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.Utils.Object + * @namespace Phaser.Utils.Objects */ module.exports = { - Clone: __webpack_require__(63), - Extend: __webpack_require__(20), + Clone: __webpack_require__(70), + Extend: __webpack_require__(19), GetAdvancedValue: __webpack_require__(12), GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(433), + GetMinMaxValue: __webpack_require__(466), GetValue: __webpack_require__(4), - HasAll: __webpack_require__(432), - HasAny: __webpack_require__(298), - HasValue: __webpack_require__(85), + HasAll: __webpack_require__(465), + HasAny: __webpack_require__(302), + HasValue: __webpack_require__(91), IsPlainObject: __webpack_require__(8), - Merge: __webpack_require__(96), - MergeRight: __webpack_require__(431) + Merge: __webpack_require__(103), + MergeRight: __webpack_require__(464) }; /***/ }), -/* 435 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -101911,40 +109351,41 @@ module.exports = { module.exports = { - Array: __webpack_require__(164), - Objects: __webpack_require__(434), - String: __webpack_require__(430) + Array: __webpack_require__(174), + Objects: __webpack_require__(467), + String: __webpack_require__(463) }; /***/ }), -/* 436 */ +/* 469 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(203); -var PluginCache = __webpack_require__(15); -var TimelineBuilder = __webpack_require__(202); -var TWEEN_CONST = __webpack_require__(83); -var TweenBuilder = __webpack_require__(97); +var NumberTweenBuilder = __webpack_require__(219); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var TimelineBuilder = __webpack_require__(218); +var TWEEN_CONST = __webpack_require__(89); +var TweenBuilder = __webpack_require__(104); /** * @classdesc - * [description] + * The Tween Manager is a default Scene Plugin which controls and updates Tweens and Timelines. * * @class TweenManager * @memberof Phaser.Tweens * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which owns this Tween Manager. */ var TweenManager = new Class({ @@ -101953,7 +109394,7 @@ var TweenManager = new Class({ function TweenManager (scene) { /** - * [description] + * The Scene which owns this Tween Manager. * * @name Phaser.Tweens.TweenManager#scene * @type {Phaser.Scene} @@ -101962,7 +109403,7 @@ var TweenManager = new Class({ this.scene = scene; /** - * [description] + * The Systems object of the Scene which owns this Tween Manager. * * @name Phaser.Tweens.TweenManager#systems * @type {Phaser.Scenes.Systems} @@ -101971,7 +109412,9 @@ var TweenManager = new Class({ this.systems = scene.sys; /** - * [description] + * The time scale of the Tween Manager. + * + * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager. * * @name Phaser.Tweens.TweenManager#timeScale * @type {number} @@ -101981,7 +109424,7 @@ var TweenManager = new Class({ this.timeScale = 1; /** - * [description] + * An array of Tweens and Timelines which will be added to the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_add * @type {array} @@ -101991,7 +109434,7 @@ var TweenManager = new Class({ this._add = []; /** - * [description] + * An array of Tweens and Timelines pending to be later added to the Tween Manager. * * @name Phaser.Tweens.TweenManager#_pending * @type {array} @@ -102001,7 +109444,7 @@ var TweenManager = new Class({ this._pending = []; /** - * [description] + * An array of Tweens and Timelines which are still incomplete and are actively processed by the Tween Manager. * * @name Phaser.Tweens.TweenManager#_active * @type {array} @@ -102011,7 +109454,7 @@ var TweenManager = new Class({ this._active = []; /** - * [description] + * An array of Tweens and Timelines which will be removed from the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_destroy * @type {array} @@ -102021,7 +109464,7 @@ var TweenManager = new Class({ this._destroy = []; /** - * [description] + * The number of Tweens and Timelines which need to be processed by the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_toProcess * @type {integer} @@ -102031,8 +109474,8 @@ var TweenManager = new Class({ */ this._toProcess = 0; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -102045,7 +109488,7 @@ var TweenManager = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -102061,9 +109504,9 @@ var TweenManager = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); this.timeScale = 1; }, @@ -102074,9 +109517,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#createTimeline * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Timeline and its Tweens. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline object. */ createTimeline: function (config) { @@ -102089,9 +109532,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#timeline * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Timeline and its Tweens. * - * @return {Phaser.Tweens.Timeline} [description] + * @return {Phaser.Tweens.Timeline} The created Timeline object. */ timeline: function (config) { @@ -102113,9 +109556,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#create * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Tween as per {@link Phaser.Tweens.Builders.TweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Tween object. */ create: function (config) { @@ -102128,9 +109571,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#add * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Tween as per the {@link Phaser.Tweens.Builders.TweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Tween. */ add: function (config) { @@ -102149,7 +109592,7 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#existing * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to add. * * @return {Phaser.Tweens.TweenManager} This Tween Manager object. */ @@ -102168,9 +109611,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#addCounter * @since 3.0.0 * - * @param {object} config - [description] + * @param {object} config - The configuration object for the Number Tween as per the {@link Phaser.Tweens.Builders.NumberTweenBuilder}. * - * @return {Phaser.Tweens.Tween} [description] + * @return {Phaser.Tweens.Tween} The created Number Tween. */ addCounter: function (config) { @@ -102184,7 +109627,9 @@ var TweenManager = new Class({ }, /** - * [description] + * Updates the Tween Manager's internal lists at the start of the frame. + * + * This method will return immediately if no changes have been indicated. * * @method Phaser.Tweens.TweenManager#preUpdate * @since 3.0.0 @@ -102262,12 +109707,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Updates all Tweens and Timelines of the Tween Manager. * * @method Phaser.Tweens.TweenManager#update * @since 3.0.0 * - * @param {number} timestamp - [description] + * @param {number} timestamp - The current time in milliseconds. * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ update: function (timestamp, delta) @@ -102294,12 +109739,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't. * * @method Phaser.Tweens.TweenManager#makeActive * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to check. * * @return {Phaser.Tweens.TweenManager} This Tween Manager object. */ @@ -102332,9 +109777,9 @@ var TweenManager = new Class({ * @method Phaser.Tweens.TweenManager#each * @since 3.0.0 * - * @param {function} callback - [description] - * @param {object} [scope] - [description] - * @param {...*} [args] - [description] + * @param {function} callback - The function to call. + * @param {object} [scope] - The scope (`this` object) to call the function with. + * @param {...*} [args] - The arguments to pass into the function. Its first argument will always be the Tween currently being iterated. */ each: function (callback, scope) { @@ -102354,12 +109799,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns an array of all active Tweens and Timelines in the Tween Manager. * * @method Phaser.Tweens.TweenManager#getAllTweens * @since 3.0.0 * - * @return {Phaser.Tweens.Tween[]} [description] + * @return {Phaser.Tweens.Tween[]} A new array containing references to all active Tweens and Timelines. */ getAllTweens: function () { @@ -102375,12 +109820,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns the scale of the time delta for all Tweens and Timelines owned by this Tween Manager. * * @method Phaser.Tweens.TweenManager#getGlobalTimeScale * @since 3.0.0 * - * @return {number} [description] + * @return {number} The scale of the time delta, usually 1. */ getGlobalTimeScale: function () { @@ -102388,14 +109833,14 @@ var TweenManager = new Class({ }, /** - * [description] + * Returns an array of all Tweens or Timelines in the Tween Manager which affect the given target or array of targets. * * @method Phaser.Tweens.TweenManager#getTweensOf * @since 3.0.0 * - * @param {(object|array)} target - [description] + * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. * - * @return {Phaser.Tweens.Tween[]} [description] + * @return {Phaser.Tweens.Tween[]} A new array containing all Tweens and Timelines which affect the given target(s). */ getTweensOf: function (target) { @@ -102436,14 +109881,14 @@ var TweenManager = new Class({ }, /** - * [description] + * Checks if the given object is being affected by a playing Tween. * * @method Phaser.Tweens.TweenManager#isTweening * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - target Phaser.Tweens.Tween object * - * @return {boolean} [description] + * @return {boolean} returns if target tween object is active or not */ isTweening: function (target) { @@ -102464,12 +109909,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Stops all Tweens in this Tween Manager. They will be removed at the start of the frame. * * @method Phaser.Tweens.TweenManager#killAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ killAll: function () { @@ -102484,14 +109929,16 @@ var TweenManager = new Class({ }, /** - * [description] + * Stops all Tweens which affect the given target or array of targets. The Tweens will be removed from the Tween Manager at the start of the frame. + * + * @see {@link #getTweensOf} * * @method Phaser.Tweens.TweenManager#killTweensOf * @since 3.0.0 * - * @param {(object|array)} target - [description] + * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ killTweensOf: function (target) { @@ -102506,12 +109953,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Pauses all Tweens in this Tween Manager. * * @method Phaser.Tweens.TweenManager#pauseAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ pauseAll: function () { @@ -102526,12 +109973,12 @@ var TweenManager = new Class({ }, /** - * [description] + * Resumes all Tweens in this Tween Manager. * * @method Phaser.Tweens.TweenManager#resumeAll * @since 3.0.0 * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ resumeAll: function () { @@ -102546,14 +109993,16 @@ var TweenManager = new Class({ }, /** - * [description] + * Sets a new scale of the time delta for this Tween Manager. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens. * * @method Phaser.Tweens.TweenManager#setGlobalTimeScale * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new scale of the time delta, where 1 is the normal speed. * - * @return {Phaser.Tweens.TweenManager} [description] + * @return {Phaser.Tweens.TweenManager} This Tween Manager. */ setGlobalTimeScale: function (value) { @@ -102582,9 +110031,9 @@ var TweenManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -102598,7 +110047,7 @@ var TweenManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -102612,12 +110061,227 @@ module.exports = TweenManager; /***/ }), -/* 437 */ +/* 470 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Update Event. + * + * This event is dispatched by a Tween Timeline every time it updates, which can happen a lot of times per second, + * so be careful about listening to this event unless you absolutely require it. + * + * Listen to it from a Timeline instance using `Timeline.on('update', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('update', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_UPDATE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'update'; + + +/***/ }), +/* 471 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Start Event. + * + * This event is dispatched by a Tween Timeline when it starts. + * + * Listen to it from a Timeline instance using `Timeline.on('start', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('start', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_START + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'start'; + + +/***/ }), +/* 472 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Resume Event. + * + * This event is dispatched by a Tween Timeline when it is resumed from a paused state. + * + * Listen to it from a Timeline instance using `Timeline.on('resume', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('resume', listener); + * // At some point later ... + * timeline.resume(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_RESUME + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'resume'; + + +/***/ }), +/* 473 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Pause Event. + * + * This event is dispatched by a Tween Timeline when it is paused. + * + * Listen to it from a Timeline instance using `Timeline.on('pause', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('pause', listener); + * // At some point later ... + * timeline.pause(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_PAUSE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'pause'; + + +/***/ }), +/* 474 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Loop Event. + * + * This event is dispatched by a Tween Timeline every time it loops. + * + * Listen to it from a Timeline instance using `Timeline.on('loop', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * loop: 4, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('loop', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_LOOP + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + * @param {integer} loopCount - The number of loops left before this Timeline completes. + */ +module.exports = 'loop'; + + +/***/ }), +/* 475 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Complete Event. + * + * This event is dispatched by a Tween Timeline when it completes playback. + * + * Listen to it from a Timeline instance using `Timeline.on('complete', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('complete', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_COMPLETE + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'complete'; + + +/***/ }), +/* 476 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -102684,12 +110348,12 @@ module.exports = [ /***/ }), -/* 438 */ +/* 477 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -102699,32 +110363,32 @@ module.exports = [ module.exports = { - GetBoolean: __webpack_require__(84), - GetEaseFunction: __webpack_require__(86), - GetNewValue: __webpack_require__(98), - GetProps: __webpack_require__(205), - GetTargets: __webpack_require__(131), - GetTweens: __webpack_require__(204), - GetValueOp: __webpack_require__(130), - NumberTweenBuilder: __webpack_require__(203), - TimelineBuilder: __webpack_require__(202), - TweenBuilder: __webpack_require__(97) + GetBoolean: __webpack_require__(90), + GetEaseFunction: __webpack_require__(92), + GetNewValue: __webpack_require__(105), + GetProps: __webpack_require__(221), + GetTargets: __webpack_require__(143), + GetTweens: __webpack_require__(220), + GetValueOp: __webpack_require__(142), + NumberTweenBuilder: __webpack_require__(219), + TimelineBuilder: __webpack_require__(218), + TweenBuilder: __webpack_require__(104) }; /***/ }), -/* 439 */ +/* 478 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(83); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(89); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Tweens @@ -102732,12 +110396,13 @@ var Extend = __webpack_require__(20); var Tweens = { - Builders: __webpack_require__(438), + Builders: __webpack_require__(477), + Events: __webpack_require__(216), - TweenManager: __webpack_require__(436), - Tween: __webpack_require__(128), - TweenData: __webpack_require__(127), - Timeline: __webpack_require__(201) + TweenManager: __webpack_require__(469), + Tween: __webpack_require__(140), + TweenData: __webpack_require__(139), + Timeline: __webpack_require__(217) }; @@ -102748,29 +110413,30 @@ module.exports = Tweens; /***/ }), -/* 440 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); -var TimerEvent = __webpack_require__(206); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var TimerEvent = __webpack_require__(222); /** * @classdesc - * [description] + * The Clock is a Scene plugin which creates and updates Timer Events for its Scene. * * @class Clock * @memberof Phaser.Time * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene which owns this Clock. */ var Clock = new Class({ @@ -102779,7 +110445,7 @@ var Clock = new Class({ function Clock (scene) { /** - * [description] + * The Scene which owns this Clock. * * @name Phaser.Time.Clock#scene * @type {Phaser.Scene} @@ -102788,7 +110454,7 @@ var Clock = new Class({ this.scene = scene; /** - * [description] + * The Scene Systems object of the Scene which owns this Clock. * * @name Phaser.Time.Clock#systems * @type {Phaser.Scenes.Systems} @@ -102797,7 +110463,9 @@ var Clock = new Class({ this.systems = scene.sys; /** - * [description] + * The current time of the Clock, in milliseconds. + * + * If accessed externally, this is equivalent to the `time` parameter normally passed to a Scene's `update` method. * * @name Phaser.Time.Clock#now * @type {number} @@ -102809,7 +110477,9 @@ var Clock = new Class({ // which then influences anything using this Clock for calculations, like TimerEvents /** - * [description] + * The scale of the Clock's time delta. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Clock and anything which uses it, such as its Timer Events. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing the Clock. * * @name Phaser.Time.Clock#timeScale * @type {number} @@ -102819,7 +110489,9 @@ var Clock = new Class({ this.timeScale = 1; /** - * [description] + * Whether the Clock is paused (`true`) or active (`false`). + * + * When paused, the Clock will not update any of its Timer Events, thus freezing time. * * @name Phaser.Time.Clock#paused * @type {boolean} @@ -102829,7 +110501,7 @@ var Clock = new Class({ this.paused = false; /** - * [description] + * An array of all Timer Events whose delays haven't expired - these are actively updating Timer Events. * * @name Phaser.Time.Clock#_active * @type {Phaser.Time.TimerEvent[]} @@ -102840,7 +110512,7 @@ var Clock = new Class({ this._active = []; /** - * [description] + * An array of all Timer Events which will be added to the Clock at the start of the frame. * * @name Phaser.Time.Clock#_pendingInsertion * @type {Phaser.Time.TimerEvent[]} @@ -102851,7 +110523,7 @@ var Clock = new Class({ this._pendingInsertion = []; /** - * [description] + * An array of all Timer Events which will be removed from the Clock at the start of the frame. * * @name Phaser.Time.Clock#_pendingRemoval * @type {Phaser.Time.TimerEvent[]} @@ -102861,8 +110533,8 @@ var Clock = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -102875,7 +110547,7 @@ var Clock = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -102891,20 +110563,20 @@ var Clock = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * [description] + * Creates a Timer Event and adds it to the Clock at the start of the frame. * * @method Phaser.Time.Clock#addEvent * @since 3.0.0 * - * @param {TimerEventConfig} config - [description] + * @param {TimerEventConfig} config - The configuration for the Timer Event. * - * @return {Phaser.Time.TimerEvent} [description] + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ addEvent: function (config) { @@ -102916,17 +110588,19 @@ var Clock = new Class({ }, /** - * [description] + * Creates a Timer Event and adds it to the Clock at the start of the frame. + * + * This is a shortcut for {@link #addEvent} which can be shorter and is compatible with the syntax of the GreenSock Animation Platform (GSAP). * * @method Phaser.Time.Clock#delayedCall * @since 3.0.0 * - * @param {number} delay - [description] - * @param {function} callback - [description] - * @param {Array.<*>} args - [description] - * @param {*} callbackScope - [description] + * @param {number} delay - The delay of the function call, in milliseconds. + * @param {function} callback - The function to call after the delay expires. + * @param {Array.<*>} args - The arguments to call the function with. + * @param {*} callbackScope - The scope (`this` object) to call the function with. * - * @return {Phaser.Time.TimerEvent} [description] + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ delayedCall: function (delay, callback, args, callbackScope) { @@ -102934,12 +110608,12 @@ var Clock = new Class({ }, /** - * [description] + * Clears and recreates the array of pending Timer Events. * * @method Phaser.Time.Clock#clearPendingEvents * @since 3.0.0 * - * @return {Phaser.Time.Clock} [description] + * @return {Phaser.Time.Clock} This Clock object. */ clearPendingEvents: function () { @@ -102949,12 +110623,12 @@ var Clock = new Class({ }, /** - * [description] + * Schedules all active Timer Events for removal at the start of the frame. * * @method Phaser.Time.Clock#removeAllEvents * @since 3.0.0 * - * @return {Phaser.Time.Clock} [description] + * @return {Phaser.Time.Clock} This Clock object. */ removeAllEvents: function () { @@ -102964,7 +110638,7 @@ var Clock = new Class({ }, /** - * [description] + * Updates the arrays of active and pending Timer Events. Called at the start of the frame. * * @method Phaser.Time.Clock#preUpdate * @since 3.0.0 @@ -103015,7 +110689,7 @@ var Clock = new Class({ }, /** - * [description] + * Updates the Clock's internal time and all of its Timer Events. * * @method Phaser.Time.Clock#update * @since 3.0.0 @@ -103111,9 +110785,9 @@ var Clock = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -103128,7 +110802,7 @@ var Clock = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -103142,12 +110816,12 @@ module.exports = Clock; /***/ }), -/* 441 */ +/* 480 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103157,24 +110831,24 @@ module.exports = Clock; module.exports = { - Clock: __webpack_require__(440), - TimerEvent: __webpack_require__(206) + Clock: __webpack_require__(479), + TimerEvent: __webpack_require__(222) }; /***/ }), -/* 442 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var ParseToTilemap = __webpack_require__(132); +var ParseToTilemap = __webpack_require__(144); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -103230,17 +110904,17 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 443 */ +/* 482 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); -var ParseToTilemap = __webpack_require__(132); +var GameObjectCreator = __webpack_require__(14); +var ParseToTilemap = __webpack_require__(144); /** * @typedef {object} TilemapConfig @@ -103291,12 +110965,12 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 444 */ +/* 483 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103382,8 +111056,10 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer if (tileTexCoords) { - var halfWidth = tile.width / 2; - var halfHeight = tile.height / 2; + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; + var halfWidth = tileWidth / 2; + var halfHeight = tileHeight / 2; ctx.save(); @@ -103404,9 +111080,9 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer ctx.drawImage( image, tileTexCoords.x, tileTexCoords.y, - tile.width, tile.height, + tileWidth, tileHeight, -halfWidth, -halfHeight, - tile.width, tile.height + tileWidth, tileHeight ); ctx.restore(); @@ -103420,12 +111096,12 @@ module.exports = StaticTilemapLayerCanvasRenderer; /***/ }), -/* 445 */ +/* 484 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103492,12 +111168,12 @@ module.exports = StaticTilemapLayerWebGLRenderer; /***/ }), -/* 446 */ +/* 485 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103506,12 +111182,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(445); + renderWebGL = __webpack_require__(484); } if (true) { - renderCanvas = __webpack_require__(444); + renderCanvas = __webpack_require__(483); } module.exports = { @@ -103523,12 +111199,12 @@ module.exports = { /***/ }), -/* 447 */ +/* 486 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103650,16 +111326,16 @@ module.exports = DynamicTilemapLayerCanvasRenderer; /***/ }), -/* 448 */ +/* 487 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -103745,7 +111421,7 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer src, texture, texture.width, texture.height, - (tw + x + tile.pixelX) * sx, (th + y + tile.pixelY) * sy, + x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), tile.width, tile.height, sx, sy, tile.rotation, @@ -103767,12 +111443,12 @@ module.exports = DynamicTilemapLayerWebGLRenderer; /***/ }), -/* 449 */ +/* 488 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -103781,12 +111457,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(448); + renderWebGL = __webpack_require__(487); } if (true) { - renderCanvas = __webpack_require__(447); + renderCanvas = __webpack_require__(486); } module.exports = { @@ -103798,16 +111474,16 @@ module.exports = { /***/ }), -/* 450 */ +/* 489 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tileset = __webpack_require__(99); +var Tileset = __webpack_require__(106); /** * [description] @@ -103849,17 +111525,17 @@ module.exports = ParseTilesets; /***/ }), -/* 451 */ +/* 490 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LayerData = __webpack_require__(78); -var Tile = __webpack_require__(55); +var LayerData = __webpack_require__(84); +var Tile = __webpack_require__(61); /** * [description] @@ -103933,16 +111609,16 @@ module.exports = ParseTileLayers; /***/ }), -/* 452 */ +/* 491 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Extend = __webpack_require__(20); +var Extend = __webpack_require__(19); /** * Copy properties from tileset to tiles. @@ -104006,12 +111682,12 @@ module.exports = AssignTileProperties; /***/ }), -/* 453 */ +/* 492 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104079,28 +111755,28 @@ module.exports = BuildTilesetIndex; /***/ }), -/* 454 */ +/* 493 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(212); -var ObjectLayer = __webpack_require__(211); +var ParseObject = __webpack_require__(228); +var ObjectLayer = __webpack_require__(227); /** - * [description] + * Parses a Tiled JSON object into an array of ObjectLayer objects. * * @function Phaser.Tilemaps.Parsers.Tiled.ParseObjectLayers * @since 3.0.0 * - * @param {object} json - [description] + * @param {object} json - The Tiled JSON object. * - * @return {array} [description] + * @return {array} An array of all object layers in the tilemap as `ObjectLayer`s. */ var ParseObjectLayers = function (json) { @@ -104138,27 +111814,27 @@ module.exports = ParseObjectLayers; /***/ }), -/* 455 */ +/* 494 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasValue = __webpack_require__(85); +var HasValue = __webpack_require__(91); /** - * [description] + * Returns a new object that only contains the `keys` that were found on the object provided. If no `keys` are found, an empty object is returned. * * @function Phaser.Tilemaps.Parsers.Tiled.Pick * @since 3.0.0 * - * @param {object} object - [description] - * @param {array} keys - [description] + * @param {object} object - The object to pick the provided keys from. + * @param {array} keys - An array of properties to retrieve from the provided object. * - * @return {object} [description] + * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. */ var Pick = function (object, keys) { @@ -104181,18 +111857,18 @@ module.exports = Pick; /***/ }), -/* 456 */ +/* 495 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Tileset = __webpack_require__(99); -var ImageCollection = __webpack_require__(213); -var ParseObject = __webpack_require__(212); +var Tileset = __webpack_require__(106); +var ImageCollection = __webpack_require__(229); +var ParseObject = __webpack_require__(228); /** * Tilesets & Image Collections @@ -104264,6 +111940,19 @@ var ParseTilesets = function (json) tiles[tile.id].objectgroup.objects = parsedObjects2; } } + + // Copy animation data + if (tile.animation) + { + if (tiles.hasOwnProperty(tile.id)) + { + tiles[tile.id].animation = tile.animation; + } + else + { + tiles[tile.id] = { animation: tile.animation }; + } + } } newSet.tileData = tiles; @@ -104337,12 +112026,12 @@ module.exports = ParseTilesets; /***/ }), -/* 457 */ +/* 496 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104389,12 +112078,12 @@ module.exports = ParseImageLayers; /***/ }), -/* 458 */ +/* 497 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104432,20 +112121,20 @@ module.exports = Base64Decode; /***/ }), -/* 459 */ +/* 498 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Base64Decode = __webpack_require__(458); +var Base64Decode = __webpack_require__(497); var GetFastValue = __webpack_require__(2); -var LayerData = __webpack_require__(78); -var ParseGID = __webpack_require__(214); -var Tile = __webpack_require__(55); +var LayerData = __webpack_require__(84); +var ParseGID = __webpack_require__(230); +var Tile = __webpack_require__(61); /** * [description] @@ -104558,12 +112247,12 @@ module.exports = ParseTileLayers; /***/ }), -/* 460 */ +/* 499 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104573,28 +112262,28 @@ module.exports = ParseTileLayers; module.exports = { - Parse: __webpack_require__(217), - Parse2DArray: __webpack_require__(133), - ParseCSV: __webpack_require__(216), + Parse: __webpack_require__(233), + Parse2DArray: __webpack_require__(145), + ParseCSV: __webpack_require__(232), - Impact: __webpack_require__(210), - Tiled: __webpack_require__(215) + Impact: __webpack_require__(226), + Tiled: __webpack_require__(231) }; /***/ }), -/* 461 */ +/* 500 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); var Vector2 = __webpack_require__(3); /** @@ -104629,16 +112318,16 @@ module.exports = WorldToTileXY; /***/ }), -/* 462 */ +/* 501 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -104709,17 +112398,17 @@ module.exports = WeightedRandomize; /***/ }), -/* 463 */ +/* 502 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileToWorldX = __webpack_require__(101); -var TileToWorldY = __webpack_require__(100); +var TileToWorldX = __webpack_require__(108); +var TileToWorldY = __webpack_require__(107); var Vector2 = __webpack_require__(3); /** @@ -104753,16 +112442,16 @@ module.exports = TileToWorldXY; /***/ }), -/* 464 */ +/* 503 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -104804,17 +112493,17 @@ module.exports = SwapByIndex; /***/ }), -/* 465 */ +/* 504 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var ShuffleArray = __webpack_require__(122); +var GetTilesWithin = __webpack_require__(21); +var ShuffleArray = __webpack_require__(132); /** * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given @@ -104849,16 +112538,16 @@ module.exports = Shuffle; /***/ }), -/* 466 */ +/* 505 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. @@ -104892,12 +112581,12 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 467 */ +/* 506 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -104939,17 +112628,17 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 468 */ +/* 507 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); /** * Sets collision on the tiles within a layer by checking each tile's collision group data @@ -104999,18 +112688,18 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 469 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var HasValue = __webpack_require__(85); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var HasValue = __webpack_require__(91); /** * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property @@ -105074,18 +112763,18 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 470 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(134); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var SetLayerCollisionIndex = __webpack_require__(146); /** * Sets collision on all tiles in the given layer, except for tiles that have an index specified in @@ -105131,18 +112820,18 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 471 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(134); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var SetLayerCollisionIndex = __webpack_require__(146); /** * Sets collision on a range of tiles in a layer whose index is between the specified `start` and @@ -105199,18 +112888,18 @@ module.exports = SetCollisionBetween; /***/ }), -/* 472 */ +/* 511 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTileCollision = __webpack_require__(56); -var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(134); +var SetTileCollision = __webpack_require__(62); +var CalculateFacesWithin = __webpack_require__(37); +var SetLayerCollisionIndex = __webpack_require__(146); /** * Sets collision on the given tile or tiles within a layer by index. You can pass in either a @@ -105262,17 +112951,17 @@ module.exports = SetCollision; /***/ }), -/* 473 */ +/* 512 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var Color = __webpack_require__(347); +var GetTilesWithin = __webpack_require__(21); +var Color = __webpack_require__(354); var defaultTileColor = new Color(105, 210, 231, 150); var defaultCollidingTileColor = new Color(243, 134, 48, 200); @@ -105351,18 +113040,18 @@ module.exports = RenderDebug; /***/ }), -/* 474 */ +/* 513 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RemoveTileAt = __webpack_require__(218); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var RemoveTileAt = __webpack_require__(234); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Removes the tile at the given world coordinates in the specified layer and updates the layer's @@ -105392,17 +113081,17 @@ module.exports = RemoveTileAtWorldXY; /***/ }), -/* 475 */ +/* 514 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var GetRandom = __webpack_require__(162); +var GetTilesWithin = __webpack_require__(21); +var GetRandom = __webpack_require__(172); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -105450,17 +113139,17 @@ module.exports = Randomize; /***/ }), -/* 476 */ +/* 515 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CalculateFacesWithin = __webpack_require__(34); -var PutTileAt = __webpack_require__(135); +var CalculateFacesWithin = __webpack_require__(37); +var PutTileAt = __webpack_require__(147); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -105514,18 +113203,18 @@ module.exports = PutTilesAt; /***/ }), -/* 477 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PutTileAt = __webpack_require__(135); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var PutTileAt = __webpack_require__(147); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either @@ -105557,18 +113246,18 @@ module.exports = PutTileAtWorldXY; /***/ }), -/* 478 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasTileAt = __webpack_require__(219); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var HasTileAt = __webpack_require__(235); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns @@ -105597,18 +113286,18 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 479 */ +/* 518 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var GetTilesWithin = __webpack_require__(21); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. @@ -105647,23 +113336,23 @@ module.exports = GetTilesWithinWorldXY; /***/ }), -/* 480 */ +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Geom = __webpack_require__(274); -var GetTilesWithin = __webpack_require__(17); -var Intersects = __webpack_require__(273); +var Geom = __webpack_require__(279); +var GetTilesWithin = __webpack_require__(21); +var Intersects = __webpack_require__(278); var NOOP = __webpack_require__(1); -var TileToWorldX = __webpack_require__(101); -var TileToWorldY = __webpack_require__(100); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var TileToWorldX = __webpack_require__(108); +var TileToWorldY = __webpack_require__(107); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); var TriangleToRectangle = function (triangle, rect) { @@ -105744,18 +113433,18 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 481 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTileAt = __webpack_require__(102); -var WorldToTileX = __webpack_require__(50); -var WorldToTileY = __webpack_require__(49); +var GetTileAt = __webpack_require__(109); +var WorldToTileX = __webpack_require__(54); +var WorldToTileY = __webpack_require__(53); /** * Gets a tile at the given world coordinates from the given layer. @@ -105785,16 +113474,16 @@ module.exports = GetTileAtWorldXY; /***/ }), -/* 482 */ +/* 521 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * @callback EachTileCallback @@ -105835,16 +113524,16 @@ module.exports = ForEachTile; /***/ }), -/* 483 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * @callback FindTileCallback @@ -105889,12 +113578,12 @@ module.exports = FindTile; /***/ }), -/* 484 */ +/* 523 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -105977,16 +113666,16 @@ module.exports = FindByIndex; /***/ }), -/* 485 */ +/* 524 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); +var GetTilesWithin = __webpack_require__(21); /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given @@ -106025,18 +113714,18 @@ module.exports = FilterTiles; /***/ }), -/* 486 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var CalculateFacesWithin = __webpack_require__(34); -var SetTileCollision = __webpack_require__(56); +var GetTilesWithin = __webpack_require__(21); +var CalculateFacesWithin = __webpack_require__(37); +var SetTileCollision = __webpack_require__(62); /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the @@ -106079,17 +113768,17 @@ module.exports = Fill; /***/ }), -/* 487 */ +/* 526 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SnapFloor = __webpack_require__(142); -var SnapCeil = __webpack_require__(243); +var SnapFloor = __webpack_require__(98); +var SnapCeil = __webpack_require__(375); /** * Returns the tiles in the given layer that are within the camera's viewport. This is used internally. @@ -106155,15 +113844,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawTop; y < drawBottom; y++) { - for (x = drawLeft; x < drawRight; x++) + for (x = drawLeft; mapData[y] && x < drawRight; x++) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -106174,15 +113863,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawTop; y < drawBottom; y++) { - for (x = drawRight; x >= drawLeft; x--) + for (x = drawRight; mapData[y] && x >= drawLeft; x--) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -106193,15 +113882,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawBottom; y >= drawTop; y--) { - for (x = drawLeft; x < drawRight; x++) + for (x = drawLeft; mapData[y] && x < drawRight; x++) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -106212,15 +113901,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) for (y = drawBottom; y >= drawTop; y--) { - for (x = drawRight; x >= drawLeft; x--) + for (x = drawRight; mapData[y] && x >= drawLeft; x--) { tile = mapData[y][x]; - + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) { continue; } - + outputArray.push(tile); } } @@ -106236,19 +113925,19 @@ module.exports = CullTiles; /***/ }), -/* 488 */ +/* 527 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileToWorldX = __webpack_require__(101); -var TileToWorldY = __webpack_require__(100); -var GetTilesWithin = __webpack_require__(17); -var ReplaceByIndex = __webpack_require__(220); +var TileToWorldX = __webpack_require__(108); +var TileToWorldY = __webpack_require__(107); +var GetTilesWithin = __webpack_require__(21); +var ReplaceByIndex = __webpack_require__(236); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -106321,17 +114010,17 @@ module.exports = CreateFromTiles; /***/ }), -/* 489 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetTilesWithin = __webpack_require__(17); -var CalculateFacesWithin = __webpack_require__(34); +var GetTilesWithin = __webpack_require__(21); +var CalculateFacesWithin = __webpack_require__(37); /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile @@ -106386,12 +114075,12 @@ module.exports = Copy; /***/ }), -/* 490 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -106401,35 +114090,35 @@ module.exports = Copy; module.exports = { - Components: __webpack_require__(103), - Parsers: __webpack_require__(460), + Components: __webpack_require__(110), + Parsers: __webpack_require__(499), - Formats: __webpack_require__(29), - ImageCollection: __webpack_require__(213), - ParseToTilemap: __webpack_require__(132), - Tile: __webpack_require__(55), - Tilemap: __webpack_require__(209), - TilemapCreator: __webpack_require__(443), - TilemapFactory: __webpack_require__(442), - Tileset: __webpack_require__(99), + Formats: __webpack_require__(31), + ImageCollection: __webpack_require__(229), + ParseToTilemap: __webpack_require__(144), + Tile: __webpack_require__(61), + Tilemap: __webpack_require__(225), + TilemapCreator: __webpack_require__(482), + TilemapFactory: __webpack_require__(481), + Tileset: __webpack_require__(106), - LayerData: __webpack_require__(78), - MapData: __webpack_require__(77), - ObjectLayer: __webpack_require__(211), + LayerData: __webpack_require__(84), + MapData: __webpack_require__(83), + ObjectLayer: __webpack_require__(227), - DynamicTilemapLayer: __webpack_require__(208), - StaticTilemapLayer: __webpack_require__(207) + DynamicTilemapLayer: __webpack_require__(224), + StaticTilemapLayer: __webpack_require__(223) }; /***/ }), -/* 491 */ +/* 530 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -106464,17 +114153,17 @@ module.exports = CONST; /***/ }), -/* 492 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Extend = __webpack_require__(20); -var FilterMode = __webpack_require__(491); +var Extend = __webpack_require__(19); +var FilterMode = __webpack_require__(530); /** * @namespace Phaser.Textures @@ -106496,12 +114185,13 @@ var FilterMode = __webpack_require__(491); var Textures = { + Events: __webpack_require__(126), FilterMode: FilterMode, - Frame: __webpack_require__(113), - Parsers: __webpack_require__(316), - Texture: __webpack_require__(165), - TextureManager: __webpack_require__(318), - TextureSource: __webpack_require__(317) + Frame: __webpack_require__(121), + Parsers: __webpack_require__(319), + Texture: __webpack_require__(175), + TextureManager: __webpack_require__(321), + TextureSource: __webpack_require__(320) }; @@ -106511,12 +114201,12 @@ module.exports = Textures; /***/ }), -/* 493 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -106526,23 +114216,24 @@ module.exports = Textures; module.exports = { - List: __webpack_require__(112), - Map: __webpack_require__(180), - ProcessQueue: __webpack_require__(228), - RTree: __webpack_require__(227), - Set: __webpack_require__(95) + List: __webpack_require__(120), + Map: __webpack_require__(194), + ProcessQueue: __webpack_require__(244), + RTree: __webpack_require__(243), + Set: __webpack_require__(102), + Size: __webpack_require__(333) }; /***/ }), -/* 494 */ +/* 533 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -106577,37 +114268,40 @@ module.exports = { module.exports = { - SoundManagerCreator: __webpack_require__(325), + SoundManagerCreator: __webpack_require__(328), - BaseSound: __webpack_require__(114), - BaseSoundManager: __webpack_require__(115), + Events: __webpack_require__(69), - WebAudioSound: __webpack_require__(319), - WebAudioSoundManager: __webpack_require__(320), + BaseSound: __webpack_require__(122), + BaseSoundManager: __webpack_require__(123), - HTML5AudioSound: __webpack_require__(323), - HTML5AudioSoundManager: __webpack_require__(324), + WebAudioSound: __webpack_require__(322), + WebAudioSoundManager: __webpack_require__(323), - NoAudioSound: __webpack_require__(321), - NoAudioSoundManager: __webpack_require__(322) + HTML5AudioSound: __webpack_require__(326), + HTML5AudioSoundManager: __webpack_require__(327), + + NoAudioSound: __webpack_require__(324), + NoAudioSoundManager: __webpack_require__(325) }; /***/ }), -/* 495 */ +/* 534 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(16); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); /** * @classdesc @@ -106751,8 +114445,8 @@ var ScenePlugin = new Class({ */ this._willRemove = false; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(Events.BOOT, this.boot, this); + scene.sys.events.on(Events.START, this.pluginStart, this); }, /** @@ -106765,7 +114459,7 @@ var ScenePlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(Events.DESTROY, this.destroy, this); }, /** @@ -106781,7 +114475,7 @@ var ScenePlugin = new Class({ { this._target = null; - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(Events.SHUTDOWN, this.shutdown, this); }, /** @@ -106810,7 +114504,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#restart * @since 3.4.0 - * + * * @param {object} [data] - The Scene data. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. @@ -106826,8 +114520,8 @@ var ScenePlugin = new Class({ }, /** - * @typedef {object} Phaser.Scenes.ScenePlugin.SceneTransitionConfig - * + * @typedef {object} SceneTransitionConfig + * * @property {string} target - The Scene key to transition to. * @property {integer} [duration=1000] - The duration, in ms, for the transition to last. * @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`) @@ -106841,24 +114535,24 @@ var ScenePlugin = new Class({ /** * This will start a transition from the current Scene to the target Scene given. - * + * * The transition will last for the duration specified in milliseconds. - * + * * You can have the target Scene moved above or below this one in the display list. - * + * * You can specify an update callback. This callback will be invoked _every frame_ for the duration * of the transition. * * This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop. - * - * There are also 5 transition related events: This scene will emit the event `transitionto` when + * + * There are also 5 transition related events: This scene will emit the event `transitionout` when * the transition begins, which is typically the frame after calling this method. - * + * * The target Scene will emit the event `transitioninit` when that Scene's `init` method is called. * It will then emit the event `transitionstart` when its `create` method is called. * If the Scene was sleeping and has been woken up, it will emit the event `transitionwake` instead of these two, * as the Scenes `init` and `create` methods are not invoked when a Scene wakes up. - * + * * When the duration of the transition has elapsed it will emit the event `transitioncomplete`. * These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep. * @@ -106868,11 +114562,12 @@ var ScenePlugin = new Class({ * this Scenes update loop to stop, then the transition will also pause for that duration. There are * checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to * override this understand that until the target Scene completes it might never be unlocked for input events. - * + * * @method Phaser.Scenes.ScenePlugin#transition + * @fires Phaser.Scenes.Events#TRANSITION_OUT * @since 3.5.0 * - * @param {Phaser.Scenes.ScenePlugin.SceneTransitionConfig} config - The transition configuration object. + * @param {SceneTransitionConfig} config - The transition configuration object. * * @return {boolean} `true` is the transition was started, otherwise `false`. */ @@ -106934,9 +114629,9 @@ var ScenePlugin = new Class({ this.manager.start(key, GetFastValue(config, 'data')); } - this.systems.events.emit('transitionout', target, duration); + this.systems.events.emit(Events.TRANSITION_OUT, target, duration); - this.systems.events.on('update', this.step, this); + this.systems.events.on(Events.UPDATE, this.step, this); return true; }, @@ -106996,6 +114691,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#transitionComplete * @private + * @fires Phaser.Scenes.Events#TRANSITION_COMPLETE * @since 3.5.0 */ transitionComplete: function () @@ -107004,10 +114700,10 @@ var ScenePlugin = new Class({ var targetSettings = this._target.sys.settings; // Stop the step - this.systems.events.off('update', this.step, this); + this.systems.events.off(Events.UPDATE, this.step, this); // Notify target scene - targetSys.events.emit('transitioncomplete', this.scene); + targetSys.events.emit(Events.TRANSITION_COMPLETE, this.scene); // Clear target scene settings targetSettings.isTransition = false; @@ -107043,12 +114739,13 @@ var ScenePlugin = new Class({ * @param {string} key - The Scene key. * @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene. * @param {boolean} autoStart - Whether to start the Scene after it's added. + * @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ - add: function (key, sceneConfig, autoStart) + add: function (key, sceneConfig, autoStart, data) { - this.manager.add(key, sceneConfig, autoStart); + this.manager.add(key, sceneConfig, autoStart, data); return this; }, @@ -107076,7 +114773,7 @@ var ScenePlugin = new Class({ /** * Runs the given Scene, but does not change the state of this Scene. - * + * * If the given Scene is paused, it will resume it. If sleeping, it will wake it. * If not running at all, it will be started. * @@ -107207,7 +114904,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#stop * @since 3.0.0 * - * @param {string} key - The Scene to stop. + * @param {string} [key] - The Scene to stop. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -107277,7 +114974,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isSleeping * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is sleeping. */ @@ -107294,7 +114991,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isActive * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is active. */ @@ -107311,7 +115008,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isVisible * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is visible. */ @@ -107409,7 +115106,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#remove * @since 3.2.0 * - * @param {(string|Phaser.Scene)} key - The Scene to be removed. + * @param {(string|Phaser.Scene)} [key] - The Scene to be removed. * * @return {Phaser.Scenes.SceneManager} This SceneManager. */ @@ -107428,7 +115125,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveUp * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -107447,7 +115144,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveDown * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -107468,7 +115165,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#bringToTop * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -107489,7 +115186,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#sendToBack * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -107546,9 +115243,9 @@ var ScenePlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('shutdown', this.shutdown, this); - eventEmitter.off('postupdate', this.step, this); - eventEmitter.off('transitionout'); + eventEmitter.off(Events.SHUTDOWN, this.shutdown, this); + eventEmitter.off(Events.POST_UPDATE, this.step, this); + eventEmitter.off(Events.TRANSITION_OUT); }, /** @@ -107563,7 +115260,7 @@ var ScenePlugin = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(Events.START, this.start, this); this.scene = null; this.systems = null; @@ -107579,17 +115276,17 @@ module.exports = ScenePlugin; /***/ }), -/* 496 */ +/* 535 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(116); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(124); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Scenes @@ -107597,10 +115294,11 @@ var Extend = __webpack_require__(20); var Scene = { - SceneManager: __webpack_require__(329), - ScenePlugin: __webpack_require__(495), - Settings: __webpack_require__(326), - Systems: __webpack_require__(166) + Events: __webpack_require__(16), + SceneManager: __webpack_require__(332), + ScenePlugin: __webpack_require__(534), + Settings: __webpack_require__(329), + Systems: __webpack_require__(176) }; @@ -107611,17 +115309,74 @@ module.exports = Scene; /***/ }), -/* 497 */ +/* 536 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Extend = __webpack_require__(19); +var CONST = __webpack_require__(178); + +/** + * @namespace Phaser.Scale + * + * @borrows Phaser.Scale.Center.NO_CENTER as NO_CENTER + * @borrows Phaser.Scale.Center.CENTER_BOTH as CENTER_BOTH + * @borrows Phaser.Scale.Center.CENTER_HORIZONTALLY as CENTER_HORIZONTALLY + * @borrows Phaser.Scale.Center.CENTER_VERTICALLY as CENTER_VERTICALLY + * + * @borrows Phaser.Scale.Orientation.LANDSCAPE as LANDSCAPE + * @borrows Phaser.Scale.Orientation.PORTRAIT as PORTRAIT + * + * @borrows Phaser.Scale.ScaleModes.NONE as NONE + * @borrows Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT as WIDTH_CONTROLS_HEIGHT + * @borrows Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH as HEIGHT_CONTROLS_WIDTH + * @borrows Phaser.Scale.ScaleModes.FIT as FIT + * @borrows Phaser.Scale.ScaleModes.ENVELOP as ENVELOP + * @borrows Phaser.Scale.ScaleModes.RESIZE as RESIZE + * + * @borrows Phaser.Scale.Zoom.NO_ZOOM as NO_ZOOM + * @borrows Phaser.Scale.Zoom.ZOOM_2X as ZOOM_2X + * @borrows Phaser.Scale.Zoom.ZOOM_4X as ZOOM_4X + * @borrows Phaser.Scale.Zoom.MAX_ZOOM as MAX_ZOOM + */ + +var Scale = { + + Center: __webpack_require__(349), + Events: __webpack_require__(334), + Orientation: __webpack_require__(348), + ScaleManager: __webpack_require__(335), + ScaleModes: __webpack_require__(347), + Zoom: __webpack_require__(346) + +}; + +Scale = Extend(false, Scale, CONST.CENTER); +Scale = Extend(false, Scale, CONST.ORIENTATION); +Scale = Extend(false, Scale, CONST.SCALE_MODE); +Scale = Extend(false, Scale, CONST.ZOOM); + +module.exports = Scale; + + +/***/ }), +/* 537 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ -var BasePlugin = __webpack_require__(221); +var BasePlugin = __webpack_require__(237); var Class = __webpack_require__(0); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -107651,7 +115406,7 @@ var ScenePlugin = new Class({ this.scene = scene; this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); }, /** @@ -107699,12 +115454,12 @@ module.exports = ScenePlugin; /***/ }), -/* 498 */ +/* 538 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -107714,17 +115469,17 @@ module.exports = ScenePlugin; module.exports = { - BasePlugin: __webpack_require__(221), - DefaultPlugins: __webpack_require__(167), - PluginCache: __webpack_require__(15), - PluginManager: __webpack_require__(331), - ScenePlugin: __webpack_require__(497) + BasePlugin: __webpack_require__(237), + DefaultPlugins: __webpack_require__(181), + PluginCache: __webpack_require__(17), + PluginManager: __webpack_require__(336), + ScenePlugin: __webpack_require__(537) }; /***/ }), -/* 499 */ +/* 539 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107744,9 +115499,9 @@ var World = {}; module.exports = World; -var Composite = __webpack_require__(137); -var Constraint = __webpack_require__(194); -var Common = __webpack_require__(33); +var Composite = __webpack_require__(149); +var Constraint = __webpack_require__(209); +var Common = __webpack_require__(36); (function() { @@ -107877,7 +115632,7 @@ var Common = __webpack_require__(33); /***/ }), -/* 500 */ +/* 540 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107890,7 +115645,7 @@ var Plugin = {}; module.exports = Plugin; -var Common = __webpack_require__(33); +var Common = __webpack_require__(36); (function() { @@ -108227,45 +115982,45 @@ var Common = __webpack_require__(33); /***/ }), -/* 501 */ +/* 541 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Matter = __webpack_require__(1065); +var Matter = __webpack_require__(1286); -Matter.Body = __webpack_require__(67); -Matter.Composite = __webpack_require__(137); -Matter.World = __webpack_require__(499); +Matter.Body = __webpack_require__(72); +Matter.Composite = __webpack_require__(149); +Matter.World = __webpack_require__(539); -Matter.Detector = __webpack_require__(503); -Matter.Grid = __webpack_require__(1064); -Matter.Pairs = __webpack_require__(1063); -Matter.Pair = __webpack_require__(418); -Matter.Query = __webpack_require__(1089); -Matter.Resolver = __webpack_require__(1062); -Matter.SAT = __webpack_require__(502); +Matter.Detector = __webpack_require__(543); +Matter.Grid = __webpack_require__(1285); +Matter.Pairs = __webpack_require__(1284); +Matter.Pair = __webpack_require__(451); +Matter.Query = __webpack_require__(1310); +Matter.Resolver = __webpack_require__(1283); +Matter.SAT = __webpack_require__(542); -Matter.Constraint = __webpack_require__(194); +Matter.Constraint = __webpack_require__(209); -Matter.Common = __webpack_require__(33); -Matter.Engine = __webpack_require__(1061); -Matter.Events = __webpack_require__(195); -Matter.Sleeping = __webpack_require__(222); -Matter.Plugin = __webpack_require__(500); +Matter.Common = __webpack_require__(36); +Matter.Engine = __webpack_require__(1282); +Matter.Events = __webpack_require__(210); +Matter.Sleeping = __webpack_require__(238); +Matter.Plugin = __webpack_require__(540); -Matter.Bodies = __webpack_require__(126); -Matter.Composites = __webpack_require__(1068); +Matter.Bodies = __webpack_require__(138); +Matter.Composites = __webpack_require__(1289); -Matter.Axes = __webpack_require__(505); -Matter.Bounds = __webpack_require__(80); -Matter.Svg = __webpack_require__(1087); -Matter.Vector = __webpack_require__(81); -Matter.Vertices = __webpack_require__(76); +Matter.Axes = __webpack_require__(546); +Matter.Bounds = __webpack_require__(86); +Matter.Svg = __webpack_require__(1308); +Matter.Vector = __webpack_require__(87); +Matter.Vertices = __webpack_require__(82); // aliases @@ -108280,7 +116035,7 @@ module.exports = Matter; /***/ }), -/* 502 */ +/* 542 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108295,8 +116050,8 @@ var SAT = {}; module.exports = SAT; -var Vertices = __webpack_require__(76); -var Vector = __webpack_require__(81); +var Vertices = __webpack_require__(82); +var Vector = __webpack_require__(87); (function() { @@ -108556,7 +116311,7 @@ var Vector = __webpack_require__(81); /***/ }), -/* 503 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108571,9 +116326,9 @@ var Detector = {}; module.exports = Detector; -var SAT = __webpack_require__(502); -var Pair = __webpack_require__(418); -var Bounds = __webpack_require__(80); +var SAT = __webpack_require__(542); +var Pair = __webpack_require__(451); +var Bounds = __webpack_require__(86); (function() { @@ -108669,22 +116424,30 @@ var Bounds = __webpack_require__(80); /***/ }), -/* 504 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(126); -var Body = __webpack_require__(67); +var Bodies = __webpack_require__(138); +var Body = __webpack_require__(72); var Class = __webpack_require__(0); -var Components = __webpack_require__(419); +var Components = __webpack_require__(452); var GetFastValue = __webpack_require__(2); -var HasValue = __webpack_require__(85); -var Vertices = __webpack_require__(76); +var HasValue = __webpack_require__(91); +var Vertices = __webpack_require__(82); + +/** + * @typedef {object} MatterTileOptions + * + * @property {MatterJS.Body} [body=null] - An existing Matter body to be used instead of creating a new one. + * @property {boolean} [isStatic=true] - Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved. + * @property {boolean} [addToWorld=true] - Whether or not to add the newly created body (or existing body if options.body is used) to the Matter world. + */ /** * @classdesc @@ -108715,14 +116478,7 @@ var Vertices = __webpack_require__(76); * * @param {Phaser.Physics.Matter.World} world - [description] * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. - * @param {object} [options] - Options to be used when creating the Matter body. See - * Phaser.Physics.Matter.Matter.Body for a list of what Matter accepts. - * @param {Phaser.Physics.Matter.Matter.Body} [options.body=null] - An existing Matter body to - * be used instead of creating a new one. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. + * @param {MatterTileOptions} [options] - Options to be used when creating the Matter body. */ var MatterTileBody = new Class({ @@ -108794,17 +116550,20 @@ var MatterTileBody = new Class({ } }, + /** + * @typedef {object} MatterBodyTileOptions + * + * @property {boolean} [isStatic=true] - Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved. + * @property {boolean} [addToWorld=true] - Whether or not to add the newly created body (or existing body if options.body is used) to the Matter world. + */ + /** * Sets the current body to a rectangle that matches the bounds of the tile. * * @method Phaser.Physics.Matter.TileBody#setFromTileRectangle * @since 3.0.0 * - * @param {object} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. + * @param {MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. * * @return {Phaser.Physics.Matter.TileBody} This TileBody object. */ @@ -108838,11 +116597,7 @@ var MatterTileBody = new Class({ * @method Phaser.Physics.Matter.TileBody#setFromTileCollision * @since 3.0.0 * - * @param {object} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. + * @param {MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. * * @return {Phaser.Physics.Matter.TileBody} This TileBody object. */ @@ -108894,12 +116649,14 @@ var MatterTileBody = new Class({ // matter expects points to be relative to the center of mass. This only applies to // convex shapes. When a concave shape is decomposed, multiple parts are created and // the individual parts are positioned relative to (ox, oy). - if (Vertices.isConvex(points)) - { - var center = Vertices.centre(vertices); - ox += center.x; - oy += center.y; - } + // + // Update: 8th January 2019 - the latest version of Matter needs the Vertices adjusted, + // regardless if convex or concave. + + var center = Vertices.centre(vertices); + + ox += center.x; + oy += center.y; body = Bodies.fromVertices(ox, oy, vertices, options); } @@ -108995,7 +116752,39 @@ module.exports = MatterTileBody; /***/ }), -/* 505 */ +/* 545 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Events + */ + +module.exports = { + + AFTER_UPDATE: __webpack_require__(1325), + BEFORE_UPDATE: __webpack_require__(1324), + COLLISION_ACTIVE: __webpack_require__(1323), + COLLISION_END: __webpack_require__(1322), + COLLISION_START: __webpack_require__(1321), + DRAG_END: __webpack_require__(1320), + DRAG: __webpack_require__(1319), + DRAG_START: __webpack_require__(1318), + PAUSE: __webpack_require__(1317), + RESUME: __webpack_require__(1316), + SLEEP_END: __webpack_require__(1315), + SLEEP_START: __webpack_require__(1314) + +}; + + +/***/ }), +/* 546 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109008,8 +116797,8 @@ var Axes = {}; module.exports = Axes; -var Vector = __webpack_require__(81); -var Common = __webpack_require__(33); +var Vector = __webpack_require__(87); +var Common = __webpack_require__(36); (function() { @@ -109065,12 +116854,12 @@ var Common = __webpack_require__(33); /***/ }), -/* 506 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109080,46 +116869,73 @@ var Common = __webpack_require__(33); module.exports = { - Acceleration: __webpack_require__(1121), - BodyScale: __webpack_require__(1120), - BodyType: __webpack_require__(1119), - Bounce: __webpack_require__(1118), - CheckAgainst: __webpack_require__(1117), - Collides: __webpack_require__(1116), - Debug: __webpack_require__(1115), - Friction: __webpack_require__(1114), - Gravity: __webpack_require__(1113), - Offset: __webpack_require__(1112), - SetGameObject: __webpack_require__(1111), - Velocity: __webpack_require__(1110) + Acceleration: __webpack_require__(1354), + BodyScale: __webpack_require__(1353), + BodyType: __webpack_require__(1352), + Bounce: __webpack_require__(1351), + CheckAgainst: __webpack_require__(1350), + Collides: __webpack_require__(1349), + Debug: __webpack_require__(1348), + Friction: __webpack_require__(1347), + Gravity: __webpack_require__(1346), + Offset: __webpack_require__(1345), + SetGameObject: __webpack_require__(1344), + Velocity: __webpack_require__(1343) }; /***/ }), -/* 507 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapY = __webpack_require__(229); +/** + * @namespace Phaser.Physics.Impact.Events + */ + +module.exports = { + + COLLIDE: __webpack_require__(1358), + PAUSE: __webpack_require__(1357), + RESUME: __webpack_require__(1356) + +}; + + +/***/ }), +/* 549 */ +/***/ (function(module, exports, __webpack_require__) { /** - * [description] + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetOverlapY = __webpack_require__(245); + +/** + * Separates two overlapping bodies on the Y-axis (vertically). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} [description] + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. */ var SeparateY = function (body1, body2, overlapOnly, bias) { @@ -109184,29 +117000,33 @@ module.exports = SeparateY; /***/ }), -/* 508 */ +/* 550 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapX = __webpack_require__(230); +var GetOverlapX = __webpack_require__(246); /** - * [description] + * Separates two overlapping bodies on the X-axis (horizontally). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateX * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - [description] - * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {boolean} overlapOnly - [description] - * @param {number} bias - [description] + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} [description] + * @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`. */ var SeparateX = function (body1, body2, overlapOnly, bias) { @@ -109271,12 +117091,12 @@ module.exports = SeparateX; /***/ }), -/* 509 */ +/* 551 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109318,28 +117138,29 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 510 */ +/* 552 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(509); +var ProcessTileSeparationY = __webpack_require__(551); /** * Check the body against the given tile on the Y axis. + * Used internally by the SeparateTile function. * * @function Phaser.Physics.Arcade.Tilemap.TileCheckY * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileTop - [description] - * @param {number} tileBottom - [description] - * @param {number} tileBias - [description] + * @param {number} tileTop - The top position of the tile within the tile world. + * @param {number} tileBottom - The bottom position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * * @return {number} The amount of separation that occurred. */ @@ -109393,12 +117214,12 @@ module.exports = TileCheckY; /***/ }), -/* 511 */ +/* 553 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109440,28 +117261,29 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 512 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(511); +var ProcessTileSeparationX = __webpack_require__(553); /** * Check the body against the given tile on the X axis. + * Used internally by the SeparateTile function. * * @function Phaser.Physics.Arcade.Tilemap.TileCheckX * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileLeft - [description] - * @param {number} tileRight - [description] - * @param {number} tileBias - [description] + * @param {number} tileLeft - The left position of the tile within the tile world. + * @param {number} tileRight - The right position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * * @return {number} The amount of separation that occurred. */ @@ -109515,18 +117337,18 @@ module.exports = TileCheckX; /***/ }), -/* 513 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileCheckX = __webpack_require__(512); -var TileCheckY = __webpack_require__(510); -var TileIntersectsBody = __webpack_require__(226); +var TileCheckX = __webpack_require__(554); +var TileCheckY = __webpack_require__(552); +var TileIntersectsBody = __webpack_require__(242); /** * The core separation function to separate a physics body and a tile. @@ -109534,14 +117356,14 @@ var TileIntersectsBody = __webpack_require__(226); * @function Phaser.Physics.Arcade.Tilemap.SeparateTile * @since 3.0.0 * - * @param {number} i - [description] + * @param {number} i - The index of the tile within the map data. * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. - * @param {Phaser.Geom.Rectangle} tileWorldRect - [description] + * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against. - * @param {number} tileBias - [description] + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * - * @return {boolean} Returns true if the body was separated, otherwise false. + * @return {boolean} `true` if the body was separated, otherwise `false`. */ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias) { @@ -109628,29 +117450,29 @@ module.exports = SeparateTile; /***/ }), -/* 514 */ +/* 556 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object. * * @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks * @since 3.0.0 * - * @param {Phaser.Tilemaps.Tilemap} tile - [description] - * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Tilemaps.Tile} tile - The Tile to process. + * @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile. * - * @return {boolean} [description] + * @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair. */ var ProcessTileCallbacks = function (tile, sprite) { - // Tile callbacks take priority over layer level callbacks + // Tile callbacks take priority over layer level callbacks if (tile.collisionCallback) { return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile); @@ -109669,17 +117491,220 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 515 */ +/* 557 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * The Arcade Physics World Bounds Event. + * + * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_ + * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`. + * + * @event Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that hit the world bounds. + * @param {boolean} up - Is the Body blocked up? I.e. collided with the top of the world bounds. + * @param {boolean} down - Is the Body blocked down? I.e. collided with the bottom of the world bounds. + * @param {boolean} left - Is the Body blocked left? I.e. collided with the left of the world bounds. + * @param {boolean} right - Is the Body blocked right? I.e. collided with the right of the world bounds. + */ +module.exports = 'worldbounds'; + + +/***/ }), +/* 558 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_ + * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_OVERLAP + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the overlap. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body overlapped. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the overlap. + */ +module.exports = 'tileoverlap'; + + +/***/ }), +/* 559 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_ + * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_COLLIDE + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the collision. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body collided with. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the collision. + */ +module.exports = 'tilecollide'; + + +/***/ }), +/* 560 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Resume Event. + * + * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`. + * + * @event Phaser.Physics.Arcade.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 561 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Pause Event. + * + * This event is dispatched by an Arcade Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`. + * + * @event Phaser.Physics.Arcade.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 562 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least + * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#OVERLAP + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the overlap. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the overlap. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the overlap. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the overlap. + */ +module.exports = 'overlap'; + + +/***/ }), +/* 563 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least + * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#COLLIDE + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the collision. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the collision. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the collision. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the collision. + */ +module.exports = 'collide'; + + +/***/ }), +/* 564 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Provides methods for modifying the velocity of an Arcade Physics body. + * + * Should be applied as a mixin and not used directly. * * @name Phaser.Physics.Arcade.Components.Velocity * @since 3.0.0 @@ -109687,13 +117712,13 @@ module.exports = ProcessTileCallbacks; var Velocity = { /** - * [description] + * Sets the velocity of the Body. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left. + * @param {number} [y=x] - The vertical velocity of the body. Positive values move the body down, while negative values move it up. * * @return {this} This Game Object. */ @@ -109705,12 +117730,14 @@ var Velocity = { }, /** - * [description] + * Sets the horizontal component of the body's velocity. + * + * Positive values move the body to the right, while negative values move it to the left. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityX * @since 3.0.0 * - * @param {number} x - [description] + * @param {number} x - The new horizontal velocity. * * @return {this} This Game Object. */ @@ -109722,12 +117749,14 @@ var Velocity = { }, /** - * [description] + * Sets the vertical component of the body's velocity. + * + * Positive values move the body down, while negative values move it up. * * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityY * @since 3.0.0 * - * @param {number} y - [description] + * @param {number} y - The new vertical velocity of the body. * * @return {this} This Game Object. */ @@ -109739,13 +117768,13 @@ var Velocity = { }, /** - * [description] + * Sets the maximum velocity of the body. * * @method Phaser.Physics.Arcade.Components.Velocity#setMaxVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The new maximum horizontal velocity. + * @param {number} [y=x] - The new maximum vertical velocity. * * @return {this} This Game Object. */ @@ -109762,12 +117791,12 @@ module.exports = Velocity; /***/ }), -/* 516 */ +/* 565 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -109844,17 +117873,17 @@ module.exports = Size; /***/ }), -/* 517 */ +/* 566 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the mass properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Mass * @since 3.0.0 @@ -109862,12 +117891,12 @@ module.exports = Size; var Mass = { /** - * [description] + * Sets the mass of the physics body * * @method Phaser.Physics.Arcade.Components.Mass#setMass * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - New value for the mass of the body. * * @return {this} This Game Object. */ @@ -109884,17 +117913,17 @@ module.exports = Mass; /***/ }), -/* 518 */ +/* 567 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the immovable properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Immovable * @since 3.0.0 @@ -109902,12 +117931,12 @@ module.exports = Mass; var Immovable = { /** - * [description] + * Sets Whether this Body can be moved by collisions with another Body. * * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable * @since 3.0.0 * - * @param {boolean} [value=true] - [description] + * @param {boolean} [value=true] - Sets if this body can be moved by collisions with another Body. * * @return {this} This Game Object. */ @@ -109926,12 +117955,12 @@ module.exports = Immovable; /***/ }), -/* 519 */ +/* 568 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -110004,12 +118033,12 @@ module.exports = Gravity; /***/ }), -/* 520 */ +/* 569 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -110082,17 +118111,17 @@ module.exports = Friction; /***/ }), -/* 521 */ +/* 570 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the enable properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Enable * @since 3.0.0 @@ -110206,17 +118235,17 @@ module.exports = Enable; /***/ }), -/* 522 */ +/* 571 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the drag properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Drag * @since 3.0.0 @@ -110224,13 +118253,24 @@ module.exports = Enable; var Drag = { /** - * [description] + * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDrag * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The amount of horizontal drag to apply. + * @param {number} [y=x] - The amount of vertical drag to apply. * * @return {this} This Game Object. */ @@ -110242,12 +118282,23 @@ var Drag = { }, /** - * [description] + * Sets the body's horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDragX * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of horizontal drag to apply. * * @return {this} This Game Object. */ @@ -110259,12 +118310,23 @@ var Drag = { }, /** - * [description] + * Sets the body's vertical drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. * * @method Phaser.Physics.Arcade.Components.Drag#setDragY * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of vertical drag to apply. * * @return {this} This Game Object. */ @@ -110276,7 +118338,15 @@ var Drag = { }, /** - * [description] + * If this Body is using `drag` for deceleration this function controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. * * @method Phaser.Physics.Arcade.Components.Drag#setDamping * @since 3.10.0 @@ -110298,17 +118368,17 @@ module.exports = Drag; /***/ }), -/* 523 */ +/* 572 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the debug properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Debug * @since 3.0.0 @@ -110316,14 +118386,17 @@ module.exports = Drag; var Debug = { /** - * [description] + * Sets the debug values of this body. + * + * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole. + * Note that there is a performance cost in drawing debug displays. It should never be used in production. * * @method Phaser.Physics.Arcade.Components.Debug#setDebug * @since 3.0.0 * - * @param {boolean} showBody - [description] - * @param {boolean} showVelocity - [description] - * @param {number} bodyColor - [description] + * @param {boolean} showBody - Set to `true` to have this body render its outline to the debug display. + * @param {boolean} showVelocity - Set to `true` to have this body render a velocity marker to the debug display. + * @param {number} bodyColor - The color of the body outline when rendered to the debug display. * * @return {this} This Game Object. */ @@ -110337,12 +118410,12 @@ var Debug = { }, /** - * [description] + * Sets the color of the body outline when it renders to the debug display. * * @method Phaser.Physics.Arcade.Components.Debug#setDebugBodyColor * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The color of the body outline when rendered to the debug display. * * @return {this} This Game Object. */ @@ -110354,7 +118427,7 @@ var Debug = { }, /** - * [description] + * Set to `true` to have this body render its outline to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugShowBody * @type {boolean} @@ -110375,7 +118448,7 @@ var Debug = { }, /** - * [description] + * Set to `true` to have this body render a velocity marker to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugShowVelocity * @type {boolean} @@ -110396,7 +118469,7 @@ var Debug = { }, /** - * [description] + * The color of the body outline when it renders to the debug display. * * @name Phaser.Physics.Arcade.Components.Debug#debugBodyColor * @type {number} @@ -110422,17 +118495,17 @@ module.exports = Debug; /***/ }), -/* 524 */ +/* 573 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the bounce properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Bounce * @since 3.0.0 @@ -110440,13 +118513,16 @@ module.exports = Debug; var Bounce = { /** - * [description] + * Sets the bounce values of this body. + * + * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object. + * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounce * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. + * @param {number} [y=x] - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -110458,12 +118534,12 @@ var Bounce = { }, /** - * [description] + * Sets the horizontal bounce value for this body. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounceX * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -110475,12 +118551,12 @@ var Bounce = { }, /** - * [description] + * Sets the vertical bounce value for this body. * * @method Phaser.Physics.Arcade.Components.Bounce#setBounceY * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. * * @return {this} This Game Object. */ @@ -110492,12 +118568,12 @@ var Bounce = { }, /** - * [description] + * Sets if this body should collide with the world bounds or not. * * @method Phaser.Physics.Arcade.Components.Bounce#setCollideWorldBounds * @since 3.0.0 * - * @param {boolean} value - [description] + * @param {boolean} value - `true` if this body should collide with the world bounds, otherwise `false`. * * @return {this} This Game Object. */ @@ -110514,17 +118590,17 @@ module.exports = Bounce; /***/ }), -/* 525 */ +/* 574 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Angular * @since 3.0.0 @@ -110532,12 +118608,16 @@ module.exports = Bounce; var Angular = { /** - * [description] + * Sets the angular velocity of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularVelocity * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of angular velocity. * * @return {this} This Game Object. */ @@ -110549,12 +118629,16 @@ var Angular = { }, /** - * [description] + * Sets the angular acceleration of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularAcceleration * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of angular acceleration. * * @return {this} This Game Object. */ @@ -110566,12 +118650,12 @@ var Angular = { }, /** - * [description] + * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration. * * @method Phaser.Physics.Arcade.Components.Angular#setAngularDrag * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The amount of drag. * * @return {this} This Game Object. */ @@ -110588,17 +118672,17 @@ module.exports = Angular; /***/ }), -/* 526 */ +/* 575 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Provides methods used for setting the acceleration properties of an Arcade Body. + * Provides methods used for setting the acceleration properties of an Arcade Physics Body. * * @name Phaser.Physics.Arcade.Components.Acceleration * @since 3.0.0 @@ -110663,25 +118747,26 @@ module.exports = Acceleration; /***/ }), -/* 527 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(31); -var DistanceBetween = __webpack_require__(52); -var DistanceSquared = __webpack_require__(249); -var Factory = __webpack_require__(238); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(56); +var DistanceSquared = __webpack_require__(384); +var Factory = __webpack_require__(255); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(96); -var PluginCache = __webpack_require__(15); +var Merge = __webpack_require__(103); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); var Vector2 = __webpack_require__(3); -var World = __webpack_require__(233); +var World = __webpack_require__(250); /** * @classdesc @@ -110748,8 +118833,8 @@ var ArcadePhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -110765,7 +118850,7 @@ var ArcadePhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -110787,9 +118872,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -111136,9 +119221,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -111158,7 +119243,7 @@ var ArcadePhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -111172,23 +119257,23 @@ module.exports = ArcadePhysics; /***/ }), -/* 528 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(35); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(38); +var Extend = __webpack_require__(19); /** * @callback ArcadePhysicsCallback * - * @param {Phaser.GameObjects.GameObject} object1 - [description] - * @param {Phaser.GameObjects.GameObject} object2 - [description] + * @param {Phaser.GameObjects.GameObject} object1 - The first Body to separate. + * @param {Phaser.GameObjects.GameObject} object2 - The second Body to separate. */ /** @@ -111197,16 +119282,16 @@ var Extend = __webpack_require__(20); var Arcade = { - ArcadePhysics: __webpack_require__(527), - Body: __webpack_require__(232), - Collider: __webpack_require__(231), - Factory: __webpack_require__(238), - Group: __webpack_require__(235), - Image: __webpack_require__(237), - Sprite: __webpack_require__(104), - StaticBody: __webpack_require__(225), - StaticGroup: __webpack_require__(234), - World: __webpack_require__(233) + ArcadePhysics: __webpack_require__(576), + Body: __webpack_require__(249), + Collider: __webpack_require__(247), + Factory: __webpack_require__(255), + Group: __webpack_require__(252), + Image: __webpack_require__(254), + Sprite: __webpack_require__(111), + StaticBody: __webpack_require__(241), + StaticGroup: __webpack_require__(251), + World: __webpack_require__(250) }; @@ -111217,2090 +119302,25 @@ module.exports = Arcade; /***/ }), -/* 529 */ +/* 578 */ /***/ (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__(138); -var Matrix4 = __webpack_require__(240); -var Quaternion = __webpack_require__(239); - -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 - The vector to be rotated. - * @param {Phaser.Math.Vector3} axis - The axis to rotate around. - * @param {number} radians - The angle of rotation in radians. - * - * @return {Phaser.Math.Vector3} The given vector. - */ -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; - - -/***/ }), -/* 530 */ -/***/ (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 - * A representation of a vector in 4D space. - * - * A four-component vector. - * - * @class Vector4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. - */ -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 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector4#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector4#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - /** - * The w component of this Vector. - * - * @name Phaser.Math.Vector4#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.w = 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; - } - }, - - /** - * Make a clone of this Vector4. - * - * @method Phaser.Math.Vector4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} A clone of this Vector4. - */ - clone: function () - { - return new Vector4(this.x, this.y, this.z, this.w); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - this.w = src.w || 0; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict quality check against each Vector's components. - * - * @method Phaser.Math.Vector4#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The vector to check equality with. - * - * @return {boolean} A boolean indicating whether the two Vectors are equal or not. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); - }, - - /** - * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. - * - * @method Phaser.Math.Vector4#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. - * @param {number} y - The y value to set for this Vector. - * @param {number} z - The z value to set for this Vector. - * @param {number} w - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - set: function (x, y, z, w) - { - 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; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector4#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - this.w += v.w || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector4#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - this.w -= v.w || 0; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector4#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - - return this; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector4#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - 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); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector4#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return x * x + y * y + z * z + w * w; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector4#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - 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; - - 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; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector4#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. - * - * @return {number} The dot product of this Vector and the given Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector4#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - lerp: function (v, t) - { - 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; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector4#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - this.w *= v.w || 1; - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector4#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - this.w /= v.w || 1; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector4#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - 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); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector4#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - 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; - - return dx * dx + dy * dy + dz * dz + dw * dw; - }, - - /** - * Negate the `x`, `y`, `z` and `w` components of this Vector. - * - * @method Phaser.Math.Vector4#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector4#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var m = mat.val; - - 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; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector4#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformQuat: function (q) - { - // TODO: is this really the same as Vector3? - // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ - // 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; - - // 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; - - // 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; - }, - - /** - * Make this Vector the zero vector (0, 0, 0, 0). - * - * @method Phaser.Math.Vector4#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; - - return this; - } - -}); - -// 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; - -module.exports = Vector4; - - -/***/ }), -/* 531 */ -/***/ (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 two values are within the given `tolerance` of each other. - * - * @function Phaser.Math.Within - * @since 3.0.0 - * - * @param {number} a - The first value to use in the calculation. - * @param {number} b - The second value to use in the calculation. - * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. - * - * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. - */ -var Within = function (a, b, tolerance) -{ - return (Math.abs(a - b) <= tolerance); -}; - -module.exports = Within; - - -/***/ }), -/* 532 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @typedef {object} SinCosTable - * - * @property {number} sin - The sine value. - * @property {number} cos - The cosine value. - * @property {number} length - The length. - */ - -/** - * Generate a series of sine and cosine values. - * - * @function Phaser.Math.SinCosTableGenerator - * @since 3.0.0 - * - * @param {number} length - The number of values to generate. - * @param {number} [sinAmp=1] - The sine value amplitude. - * @param {number} [cosAmp=1] - The cosine value amplitude. - * @param {number} [frequency=1] - The frequency of the values. - * - * @return {SinCosTable} The generated values. - */ -var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) -{ - if (sinAmp === undefined) { sinAmp = 1; } - if (cosAmp === undefined) { cosAmp = 1; } - if (frequency === undefined) { frequency = 1; } - - frequency *= Math.PI / length; - - var cos = []; - var sin = []; - - for (var c = 0; c < length; c++) - { - cosAmp -= sinAmp * frequency; - sinAmp += cosAmp * frequency; - - cos[c] = cosAmp; - sin[c] = sinAmp; - } - - return { - sin: sin, - cos: cos, - length: length - }; -}; - -module.exports = SinCosTableGenerator; - - -/***/ }), -/* 533 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Round a value to a given decimal place. - * - * @function Phaser.Math.RoundTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var RoundTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.round(value * p) / p; -}; - -module.exports = RoundTo; - - -/***/ }), -/* 534 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random four-dimensional vector. - * - * @function Phaser.Math.RandomXYZW - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector4} The given Vector. - */ -var RandomXYZW = function (vec4, scale) -{ - if (scale === undefined) { scale = 1; } - - // TODO: 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; - - -/***/ }), -/* 535 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random position vector in a spherical area, optionally defined by the given radius. - * - * @function Phaser.Math.RandomXYZ - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. - * @param {number} [radius=1] - The radius. - * - * @return {Phaser.Math.Vector3} The given Vector. - */ -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; - - -/***/ }), -/* 536 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Compute a random unit vector. - * - * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. - * - * Optionally accepts a scale value to scale the resulting vector by. - * - * @function Phaser.Math.RandomXY - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector2} The given Vector. - */ -var RandomXY = function (vector, scale) -{ - if (scale === undefined) { scale = 1; } - - var r = Math.random() * 2 * Math.PI; - - vector.x = Math.cos(r) * scale; - vector.y = Math.sin(r) * scale; - - return vector; -}; - -module.exports = RandomXY; - - -/***/ }), -/* 537 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Work out what percentage `value` is of the range between `min` and `max`. - * If `max` isn't given then it will return the percentage of `value` to `min`. - * - * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. - * - * @function Phaser.Math.Percent - * @since 3.0.0 - * - * @param {number} value - The value to determine the percentage of. - * @param {number} min - The minimum value. - * @param {number} [max] - The maximum value. - * @param {number} [upperMax] - The mid-way point in the range that represents 100%. - * - * @return {number} A value between 0 and 1 representing the percentage. - */ -var Percent = function (value, min, max, upperMax) -{ - if (max === undefined) { max = min + 1; } - - var percentage = (value - min) / (max - min); - - if (percentage > 1) - { - if (upperMax !== undefined) - { - percentage = ((upperMax - value)) / (upperMax - max); - - if (percentage < 0) - { - percentage = 0; - } - } - else - { - percentage = 1; - } - } - else if (percentage < 0) - { - percentage = 0; - } - - return percentage; -}; - -module.exports = Percent; - - -/***/ }), -/* 538 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Subtract an `amount` from `value`, limiting the minimum result to `min`. - * - * @function Phaser.Math.MinSub - * @since 3.0.0 - * - * @param {number} value - The value to subtract from. - * @param {number} amount - The amount to subtract. - * @param {number} min - The minimum value to return. - * - * @return {number} The resulting value. - */ -var MinSub = function (value, amount, min) -{ - return Math.max(value - amount, min); -}; - -module.exports = MinSub; - - -/***/ }), -/* 539 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Add an `amount` to a `value`, limiting the maximum result to `max`. - * - * @function Phaser.Math.MaxAdd - * @since 3.0.0 - * - * @param {number} value - The value to add to. - * @param {number} amount - The amount to add. - * @param {number} max - The maximum value to return. - * - * @return {number} The resulting value. - */ -var MaxAdd = function (value, amount, max) -{ - return Math.min(value + amount, max); -}; - -module.exports = MaxAdd; - - -/***/ }), -/* 540 */ -/***/ (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 if a given value is an even number using a strict type check. - * - * @function Phaser.Math.IsEvenStrict - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEvenStrict = function (value) -{ - // Use strict equality === for "is number" test - return (value === parseFloat(value)) ? !(value % 2) : void 0; -}; - -module.exports = IsEvenStrict; - - -/***/ }), -/* 541 */ -/***/ (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 if a given value is an even number. - * - * @function Phaser.Math.IsEven - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEven = function (value) -{ - // Use abstract equality == for "is number" test - - // eslint-disable-next-line eqeqeq - return (value == parseFloat(value)) ? !(value % 2) : void 0; -}; - -module.exports = IsEven; - - -/***/ }), -/* 542 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the speed required to cover a distance in the time given. - * - * @function Phaser.Math.GetSpeed - * @since 3.0.0 - * - * @param {number} distance - The distance to travel in pixels. - * @param {integer} time - The time, in ms, to cover the distance in. - * - * @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given. - */ -var GetSpeed = function (distance, time) -{ - return (distance / time) / 1000; -}; - -module.exports = GetSpeed; - - -/***/ }), -/* 543 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Floors to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.FloorTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var FloorTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.floor(value * p) / p; -}; - -module.exports = FloorTo; - - -/***/ }), -/* 544 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculates the positive difference of two given numbers. - * - * @function Phaser.Math.Difference - * @since 3.0.0 - * - * @param {number} a - The first number in the calculation. - * @param {number} b - The second number in the calculation. - * - * @return {number} The positive difference of the two given numbers. - */ -var Difference = function (a, b) -{ - return Math.abs(a - b); -}; - -module.exports = Difference; - - -/***/ }), -/* 545 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Ceils to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.CeilTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {number} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var CeilTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } - - var p = Math.pow(base, -place); - - return Math.ceil(value * p) / p; -}; - -module.exports = CeilTo; - - -/***/ }), -/* 546 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the mean average of the given values. - * - * @function Phaser.Math.Average - * @since 3.0.0 - * - * @param {number[]} values - The values to average. - * - * @return {number} The average value. - */ -var Average = function (values) -{ - var sum = 0; - - for (var i = 0; i < values.length; i++) - { - sum += (+values[i]); - } - - return sum / values.length; -}; - -module.exports = Average; - - -/***/ }), -/* 547 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using rounding. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. - * - * @function Phaser.Math.Snap.To - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapTo = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.round(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapTo; - - -/***/ }), -/* 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} - */ - -/** - * @namespace Phaser.Math.Snap - */ - -module.exports = { - - Ceil: __webpack_require__(243), - Floor: __webpack_require__(142), - To: __webpack_require__(547) - -}; - - -/***/ }), -/* 549 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Tests the value and returns `true` if it is a power of two. - * - * @function Phaser.Math.Pow2.IsValuePowerOfTwo - * @since 3.0.0 - * - * @param {number} value - The value to check if it's a power of two. - * - * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. - */ -var IsValuePowerOfTwo = function (value) -{ - return (value > 0 && (value & (value - 1)) === 0); -}; - -module.exports = IsValuePowerOfTwo; - - -/***/ }), -/* 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} - */ - -/** - * @namespace Phaser.Math.Pow2 - */ - -module.exports = { - - GetNext: __webpack_require__(294), - IsSize: __webpack_require__(117), - IsValue: __webpack_require__(549) - -}; - - -/***/ }), -/* 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 SmootherStep = __webpack_require__(182); - -/** - * A Smoother Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmootherStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmootherStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmootherStep(t, 0, 1); -}; - -module.exports = SmootherStepInterpolation; - - -/***/ }), -/* 552 */ -/***/ (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 Linear = __webpack_require__(119); - -/** - * A linear interpolation method. - * - * @function Phaser.Math.Interpolation.Linear - * @since 3.0.0 - * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {!number} k - The percentage of interpolation, between 0 and 1. - * - * @return {!number} The interpolated value. - */ -var LinearInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - - if (k < 0) - { - return Linear(v[0], v[1], f); - } - - if (k > 1) - { - return Linear(v[m], v[m - 1], m - f); - } - - return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); -}; - -module.exports = LinearInterpolation; - - -/***/ }), -/* 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 CatmullRom = __webpack_require__(171); - -/** - * A Catmull-Rom interpolation method. - * - * @function Phaser.Math.Interpolation.CatmullRom - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var CatmullRomInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - - if (v[0] === v[m]) - { - if (k < 0) - { - i = Math.floor(f = m * (1 + k)); - } - - return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); - } - else - { - if (k < 0) - { - return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); - } - - if (k > 1) - { - return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); - } - - return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); - } -}; - -module.exports = CatmullRomInterpolation; - - -/***/ }), -/* 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 Bernstein = __webpack_require__(245); - -/** - * A bezier interpolation method. - * - * @function Phaser.Math.Interpolation.Bezier - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var BezierInterpolation = function (v, k) -{ - var b = 0; - var n = v.length - 1; - - for (var i = 0; i <= n; i++) - { - b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); - } - - return b; -}; - -module.exports = BezierInterpolation; - - -/***/ }), -/* 555 */ -/***/ (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.Math.Interpolation - */ - -module.exports = { - - Bezier: __webpack_require__(554), - CatmullRom: __webpack_require__(553), - CubicBezier: __webpack_require__(354), - Linear: __webpack_require__(552), - QuadraticBezier: __webpack_require__(350), - SmoothStep: __webpack_require__(334), - SmootherStep: __webpack_require__(551) - -}; - - -/***/ }), -/* 556 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the fuzzy floor of the given value. - * - * @function Phaser.Math.Fuzzy.Floor - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The floor of the value. - */ -var Floor = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.floor(value + epsilon); -}; - -module.exports = Floor; - - -/***/ }), -/* 557 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the fuzzy ceiling of the given value. - * - * @function Phaser.Math.Fuzzy.Ceil - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The fuzzy ceiling of the value. - */ -var Ceil = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.ceil(value - epsilon); -}; - -module.exports = Ceil; - - -/***/ }), -/* 558 */ -/***/ (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.Math.Fuzzy - */ - -module.exports = { - - Ceil: __webpack_require__(557), - Equal: __webpack_require__(248), - Floor: __webpack_require__(556), - GreaterThan: __webpack_require__(247), - LessThan: __webpack_require__(246) - -}; - - -/***/ }), -/* 559 */ -/***/ (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.Math.Easing - */ - -module.exports = { - - Back: __webpack_require__(369), - Bounce: __webpack_require__(368), - Circular: __webpack_require__(367), - Cubic: __webpack_require__(366), - Elastic: __webpack_require__(365), - Expo: __webpack_require__(364), - Linear: __webpack_require__(363), - Quadratic: __webpack_require__(362), - Quartic: __webpack_require__(361), - Quintic: __webpack_require__(360), - Sine: __webpack_require__(359), - Stepped: __webpack_require__(358) - -}; - - -/***/ }), -/* 560 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points) to the power of `pow`. - * - * @function Phaser.Math.Distance.Power - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * @param {number} pow - The exponent. - * - * @return {number} The distance between each point. - */ -var DistancePower = function (x1, y1, x2, y2, pow) -{ - if (pow === undefined) { pow = 2; } - - return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); -}; - -module.exports = DistancePower; - - -/***/ }), -/* 561 */ -/***/ (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.Math.Distance - */ - -module.exports = { - - Between: __webpack_require__(52), - Power: __webpack_require__(560), - Squared: __webpack_require__(249) - -}; - - -/***/ }), -/* 562 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Gets the shortest angle between `angle1` and `angle2`. - * - * Both angles must be in the range -180 to 180, which is the same clamped - * range that `sprite.angle` uses, so you can pass in two sprite angles to - * this method and get the shortest angle back between the two of them. - * - * The angle returned will be in the same range. If the returned angle is - * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's - * a clockwise rotation. - * - * TODO: Wrap the angles in this function? - * - * @function Phaser.Math.Angle.ShortestBetween - * @since 3.0.0 - * - * @param {number} angle1 - The first angle in the range -180 to 180. - * @param {number} angle2 - The second angle in the range -180 to 180. - * - * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. - */ -var ShortestBetween = function (angle1, angle2) -{ - var difference = angle2 - angle1; - - if (difference === 0) - { - return 0; - } - - var times = Math.floor((difference - (-180)) / 360); - - return difference - (times * 360); - -}; - -module.exports = ShortestBetween; - - -/***/ }), -/* 563 */ -/***/ (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 MATH_CONST = __webpack_require__(16); - -/** - * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. - * - * @function Phaser.Math.Angle.RotateTo - * @since 3.0.0 - * - * @param {number} currentAngle - The current angle, in radians. - * @param {number} targetAngle - The target angle to rotate to, in radians. - * @param {number} [lerp=0.05] - The lerp value to add to the current angle. - * - * @return {number} The adjusted angle. - */ -var RotateTo = function (currentAngle, targetAngle, lerp) -{ - if (lerp === undefined) { lerp = 0.05; } - - if (currentAngle === targetAngle) - { - return currentAngle; - } - - if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) - { - currentAngle = targetAngle; - } - else - { - if (Math.abs(targetAngle - currentAngle) > Math.PI) - { - if (targetAngle < currentAngle) - { - targetAngle += MATH_CONST.PI2; - } - else - { - targetAngle -= MATH_CONST.PI2; - } - } - - if (targetAngle > currentAngle) - { - currentAngle += lerp; - } - else if (targetAngle < currentAngle) - { - currentAngle -= lerp; - } - } - - return currentAngle; -}; - -module.exports = RotateTo; - - -/***/ }), -/* 564 */ -/***/ (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 Normalize = __webpack_require__(250); - -/** - * Reverse the given angle. - * - * @function Phaser.Math.Angle.Reverse - * @since 3.0.0 - * - * @param {number} angle - The angle to reverse, in radians. - * - * @return {number} The reversed angle, in radians. - */ -var Reverse = function (angle) -{ - return Normalize(angle + Math.PI); -}; - -module.exports = Reverse; - - -/***/ }), -/* 565 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenPointsY - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point1 - The first point. - * @param {(Phaser.Geom.Point|object)} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPointsY = function (point1, point2) -{ - return Math.atan2(point2.x - point1.x, point2.y - point1.y); -}; - -module.exports = BetweenPointsY; - - -/***/ }), -/* 566 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * Calculates the angle of the vector from the first point to the second point. - * - * @function Phaser.Math.Angle.BetweenPoints - * @since 3.0.0 - * - * @param {(Phaser.Geom.Point|object)} point1 - The first point. - * @param {(Phaser.Geom.Point|object)} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPoints = function (point1, point2) -{ - return Math.atan2(point2.y - point1.y, point2.x - point1.x); -}; - -module.exports = BetweenPoints; - - -/***/ }), -/* 567 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenY - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var BetweenY = function (x1, y1, x2, y2) -{ - return Math.atan2(x2 - x1, y2 - y1); -}; - -module.exports = BetweenY; - - -/***/ }), -/* 568 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * @function Phaser.Math.Angle.Between - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var Between = function (x1, y1, x2, y2) -{ - return Math.atan2(y2 - y1, x2 - x1); -}; - -module.exports = Between; - - -/***/ }), -/* 569 */ -/***/ (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.Math.Angle - */ - -module.exports = { - - Between: __webpack_require__(568), - BetweenY: __webpack_require__(567), - BetweenPoints: __webpack_require__(566), - BetweenPointsY: __webpack_require__(565), - Reverse: __webpack_require__(564), - RotateTo: __webpack_require__(563), - ShortestBetween: __webpack_require__(562), - Normalize: __webpack_require__(250), - Wrap: __webpack_require__(199), - WrapDegrees: __webpack_require__(198) - -}; - - -/***/ }), -/* 570 */ -/***/ (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 CONST = __webpack_require__(16); -var Extend = __webpack_require__(20); - -/** - * @namespace Phaser.Math - */ - -var PhaserMath = { - - // Collections of functions - Angle: __webpack_require__(569), - Distance: __webpack_require__(561), - Easing: __webpack_require__(559), - Fuzzy: __webpack_require__(558), - Interpolation: __webpack_require__(555), - Pow2: __webpack_require__(550), - Snap: __webpack_require__(548), - - // Expose the RNG Class - RandomDataGenerator: __webpack_require__(404), - - // Single functions - Average: __webpack_require__(546), - Bernstein: __webpack_require__(245), - Between: __webpack_require__(170), - CatmullRom: __webpack_require__(171), - CeilTo: __webpack_require__(545), - Clamp: __webpack_require__(23), - DegToRad: __webpack_require__(31), - Difference: __webpack_require__(544), - Factorial: __webpack_require__(244), - FloatBetween: __webpack_require__(299), - FloorTo: __webpack_require__(543), - FromPercent: __webpack_require__(93), - GetSpeed: __webpack_require__(542), - IsEven: __webpack_require__(541), - IsEvenStrict: __webpack_require__(540), - Linear: __webpack_require__(119), - MaxAdd: __webpack_require__(539), - MinSub: __webpack_require__(538), - Percent: __webpack_require__(537), - RadToDeg: __webpack_require__(172), - RandomXY: __webpack_require__(536), - RandomXYZ: __webpack_require__(535), - RandomXYZW: __webpack_require__(534), - Rotate: __webpack_require__(242), - RotateAround: __webpack_require__(396), - RotateAroundDistance: __webpack_require__(183), - RoundAwayFromZero: __webpack_require__(314), - RoundTo: __webpack_require__(533), - SinCosTableGenerator: __webpack_require__(532), - SmootherStep: __webpack_require__(182), - SmoothStep: __webpack_require__(181), - TransformXY: __webpack_require__(332), - Within: __webpack_require__(531), - Wrap: __webpack_require__(53), - - // Vector classes - Vector2: __webpack_require__(3), - Vector3: __webpack_require__(138), - Vector4: __webpack_require__(530), - Matrix3: __webpack_require__(241), - Matrix4: __webpack_require__(240), - Quaternion: __webpack_require__(239), - RotateVec3: __webpack_require__(529) - -}; - -// Merge in the consts - -PhaserMath = Extend(false, PhaserMath, CONST); - -// Export it - -module.exports = PhaserMath; - - -/***/ }), -/* 571 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var CustomSet = __webpack_require__(95); +var CONST = __webpack_require__(15); +var CustomSet = __webpack_require__(102); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(75); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); -var XHRSettings = __webpack_require__(105); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var XHRSettings = __webpack_require__(112); /** * @classdesc @@ -113354,7 +119374,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#scene * @type {Phaser.Scene} - * @protected * @since 3.0.0 */ this.scene = scene; @@ -113364,7 +119383,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#systems * @type {Phaser.Scenes.Systems} - * @protected * @since 3.0.0 */ this.systems = scene.sys; @@ -113374,7 +119392,6 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#cacheManager * @type {Phaser.Cache.CacheManager} - * @protected * @since 3.7.0 */ this.cacheManager = scene.sys.cache; @@ -113384,11 +119401,20 @@ var LoaderPlugin = new Class({ * * @name Phaser.Loader.LoaderPlugin#textureManager * @type {Phaser.Textures.TextureManager} - * @protected * @since 3.7.0 */ this.textureManager = scene.sys.textures; + /** + * A reference to the global Scene Manager. + * + * @name Phaser.Loader.LoaderPlugin#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @protected + * @since 3.16.0 + */ + this.sceneManager = scene.sys.game.scene; + // Inject the available filetypes into the Loader FileTypesManager.install(this); @@ -113594,8 +119620,8 @@ var LoaderPlugin = new Class({ */ this.state = CONST.LOADER_IDLE; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.pluginStart, this); }, /** @@ -113608,7 +119634,7 @@ var LoaderPlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -113622,7 +119648,7 @@ var LoaderPlugin = new Class({ */ pluginStart: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -113742,16 +119768,6 @@ var LoaderPlugin = new Class({ return this; }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#addFileEvent - * @param {string} key - The key of the file that was added. - * @param {string} type - The type of the file that was added. - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that had the file added to it. - * @param {Phaser.Loader.File} loader - The File object that was added to the Loader. - */ - /** * Adds a file, or array of files, into the load queue. * @@ -113764,7 +119780,7 @@ var LoaderPlugin = new Class({ * however you can call this as long as the file given to it is well formed. * * @method Phaser.Loader.LoaderPlugin#addFile - * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @fires Phaser.Loader.Events#ADD * @since 3.0.0 * * @param {(Phaser.Loader.File|Phaser.Loader.File[])} file - The file, or array of files, to be added to the load queue. @@ -113786,7 +119802,7 @@ var LoaderPlugin = new Class({ { this.list.set(item); - this.emit('addfile', item.key, item.type, this, item); + this.emit(Events.ADD, item.key, item.type, this, item); if (this.isLoading()) { @@ -113952,13 +119968,6 @@ var LoaderPlugin = new Class({ return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE); }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#startEvent - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader instance that started. - */ - /** * Starts the Loader running. This will reset the progress and totals and then emit a `start` event. * If there is nothing in the queue the Loader will immediately complete, otherwise it will start @@ -113971,7 +119980,7 @@ var LoaderPlugin = new Class({ * If the Loader is already running this method will simply return. * * @method Phaser.Loader.LoaderPlugin#start - * @fires Phaser.Loader.LoaderPlugin#startEvent + * @fires Phaser.Loader.Events#START * @since 3.0.0 */ start: function () @@ -113987,7 +119996,7 @@ var LoaderPlugin = new Class({ this.totalComplete = 0; this.totalToLoad = this.list.size; - this.emit('start', this); + this.emit(Events.START, this); if (this.list.size === 0) { @@ -114004,32 +120013,24 @@ var LoaderPlugin = new Class({ this.checkLoadQueue(); - this.systems.events.on('update', this.update, this); + this.systems.events.on(SceneEvents.UPDATE, this.update, this); } }, - /** - * This event is fired when the Loader updates its progress, typically as a result of - * a file having completed loading. - * - * @event Phaser.Loader.LoaderPlugin#progressEvent - * @param {number} progress - The current progress of the load. A value between 0 and 1. - */ - /** * Called automatically during the load process. * It updates the `progress` value and then emits a progress event, which you can use to * display a loading bar in your game. * * @method Phaser.Loader.LoaderPlugin#updateProgress - * @fires Phaser.Loader.LoaderPlugin#progressEvent + * @fires Phaser.Loader.Events#PROGRESS * @since 3.0.0 */ updateProgress: function () { this.progress = 1 - ((this.list.size + this.inflight.size) / this.totalToLoad); - this.emit('progress', this.progress); + this.emit(Events.PROGRESS, this.progress); }, /** @@ -114086,20 +120087,6 @@ var LoaderPlugin = new Class({ }, this); }, - /** - * This event is fired when the a file successfully completes loading, _before_ it is processed. - * - * @event Phaser.Loader.LoaderPlugin#loadEvent - * @param {Phaser.Loader.File} file - The file that has completed loading. - */ - - /** - * This event is fired when the a file errors during load. - * - * @event Phaser.Loader.LoaderPlugin#loadErrorEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * An internal method called automatically by the XHRLoader belong to a File. * @@ -114107,8 +120094,8 @@ var LoaderPlugin = new Class({ * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue. * * @method Phaser.Loader.LoaderPlugin#nextFile - * @fires Phaser.Loader.LoaderPlugin#loadEvent - * @fires Phaser.Loader.LoaderPlugin#loadErrorEvent + * @fires Phaser.Loader.Events#FILE_LOAD + * @fires Phaser.Loader.Events#FILE_LOAD_ERROR * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File that just finished loading, or errored during load. @@ -114132,7 +120119,7 @@ var LoaderPlugin = new Class({ this.queue.set(file); - this.emit('load', file); + this.emit(Events.FILE_LOAD, file); file.onProcess(); } @@ -114142,7 +120129,7 @@ var LoaderPlugin = new Class({ this._deleteQueue.set(file); - this.emit('loaderror', file); + this.emit(Events.FILE_LOAD_ERROR, file); this.fileProcessComplete(file); } @@ -114204,14 +120191,6 @@ var LoaderPlugin = new Class({ } }, - /** - * This event is fired when the Loader has finished loading everything and the queue is empty. - * By this point every loaded file will now be in its associated cache and ready for use. - * - * @event Phaser.Loader.LoaderPlugin#completeEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * Called at the end when the load queue is exhausted and all files have either loaded or errored. * By this point every loaded file will now be in its associated cache and ready for use. @@ -114219,12 +120198,13 @@ var LoaderPlugin = new Class({ * Also clears down the Sets, puts progress to 1 and clears the deletion queue. * * @method Phaser.Loader.LoaderPlugin#loadComplete - * @fires Phaser.Loader.LoaderPlugin#completeEvent + * @fires Phaser.Loader.Events#COMPLETE + * @fires Phaser.Loader.Events#POST_PROCESS * @since 3.7.0 */ loadComplete: function () { - this.emit('loadcomplete', this); + this.emit(Events.POST_PROCESS, this); this.list.clear(); this.inflight.clear(); @@ -114234,14 +120214,14 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_COMPLETE; - this.systems.events.off('update', this.update, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); // Call 'destroy' on each file ready for deletion this._deleteQueue.iterateLocal('destroy'); this._deleteQueue.clear(); - this.emit('complete', this, this.totalComplete, this.totalFailed); + this.emit(Events.COMPLETE, this, this.totalComplete, this.totalFailed); }, /** @@ -114349,8 +120329,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_SHUTDOWN; - this.systems.events.off('update', this.update, this); - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -114367,8 +120347,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_DESTROYED; - this.systems.events.off('update', this.update, this); - this.systems.events.off('start', this.pluginStart, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.START, this.pluginStart, this); this.list = null; this.inflight = null; @@ -114378,6 +120358,7 @@ var LoaderPlugin = new Class({ this.systems = null; this.textureManager = null; this.cacheManager = null; + this.sceneManager = null; } }); @@ -114388,22 +120369,22 @@ module.exports = LoaderPlugin; /***/ }), -/* 572 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(57); -var TextFile = __webpack_require__(251); +var MultiFile = __webpack_require__(63); +var TextFile = __webpack_require__(256); /** * @typedef {object} Phaser.Loader.FileTypes.UnityAtlasFileConfig @@ -114453,6 +120434,8 @@ var UnityAtlasFile = new Class({ { var config = key; + key = GetFastValue(config, 'key'); + image = new ImageFile(loader, { key: key, url: GetFastValue(config, 'textureURL'), @@ -114493,7 +120476,7 @@ var UnityAtlasFile = new Class({ */ addToCache: function () { - if (this.failed === 0 && !this.complete) + if (this.isReadyToProcess()) { var image = this.files[0]; var text = this.files[1]; @@ -114640,19 +120623,19 @@ module.exports = UnityAtlasFile; /***/ }), -/* 573 */ +/* 580 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); -var TILEMAP_FORMATS = __webpack_require__(29); +var JSONFile = __webpack_require__(55); +var TILEMAP_FORMATS = __webpack_require__(31); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapJSONFileConfig @@ -114805,19 +120788,19 @@ module.exports = TilemapJSONFile; /***/ }), -/* 574 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); -var TILEMAP_FORMATS = __webpack_require__(29); +var JSONFile = __webpack_require__(55); +var TILEMAP_FORMATS = __webpack_require__(31); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapImpactFileConfig @@ -114970,22 +120953,22 @@ module.exports = TilemapImpactFile; /***/ }), -/* 575 */ +/* 582 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); -var TILEMAP_FORMATS = __webpack_require__(29); +var TILEMAP_FORMATS = __webpack_require__(31); /** * @typedef {object} Phaser.Loader.FileTypes.TilemapCSVFileConfig @@ -115174,18 +121157,18 @@ module.exports = TilemapCSVFile; /***/ }), -/* 576 */ +/* 583 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -115531,18 +121514,18 @@ module.exports = SVGFile; /***/ }), -/* 577 */ +/* 584 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); /** * @typedef {object} Phaser.Loader.FileTypes.SpriteSheetFileConfig @@ -115733,18 +121716,18 @@ module.exports = SpriteSheetFile; /***/ }), -/* 578 */ +/* 585 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -115913,18 +121896,18 @@ module.exports = ScriptFile; /***/ }), -/* 579 */ +/* 586 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -116130,18 +122113,245 @@ module.exports = ScenePluginFile; /***/ }), -/* 580 */ +/* 587 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(8); + +/** + * @typedef {object} Phaser.Loader.FileTypes.SceneFileConfig + * + * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. + * @property {string} [url] - The absolute or relative URL to load the file from. + * @property {string} [extension='txt'] - The default file extension to use if no url is provided. + * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ + +/** + * @classdesc + * An external Scene JavaScript File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile. + * + * @class SceneFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var SceneFile = new Class({ + + Extends: File, + + initialize: + + function SceneFile (loader, key, url, xhrSettings) + { + var extension = 'js'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'text', + cache: loader.cacheManager.text, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.SceneFile#onProcess + * @since 3.16.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = this.xhrLoader.responseText; + + this.onProcessComplete(); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.SceneFile#addToCache + * @since 3.16.0 + */ + addToCache: function () + { + var code = this.data.concat('(function(){\n' + 'return new ' + this.key + '();\n' + '}).call(this);'); + + this.loader.sceneManager.add(this.key, eval(code)); + + this.complete = true; + } + +}); + +/** + * Adds an external Scene file, or array of Scene files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('Level1', 'src/Level1.js'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Scene Manager upon a successful load. + * + * For a Scene File it's vitally important that the key matches the class name in the JavaScript file. + * + * For example here is the source file: + * + * ```javascript + * class ExternalScene extends Phaser.Scene { + * + * constructor () + * { + * super('myScene'); + * } + * + * } + * ``` + * + * Because the class is called `ExternalScene` that is the exact same key you must use when loading it: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('ExternalScene', 'src/yourScene.js'); + * } + * ``` + * + * The key that is used within the Scene Manager can either be set to the same, or you can override it in the Scene + * constructor, as we've done in the example above, where the Scene key was changed to `myScene`. + * + * The key should be unique both in terms of files being loaded and Scenes already present in the Scene Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Scene Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.sceneFile({ + * key: 'Level1', + * url: 'src/Level1.js' + * }); + * ``` + * + * See the documentation for `Phaser.Loader.FileTypes.SceneFileConfig` for more details. + * + * Once the file has finished loading it will be added to the Scene Manager. + * + * ```javascript + * this.load.sceneFile('Level1', 'src/Level1.js'); + * // and later in your game ... + * this.scene.start('Level1'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `WORLD1.` and the key was `Story` the final key will be `WORLD1.Story` and + * this is what you would use to retrieve the text from the Scene Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Scene File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#sceneFile + * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @since 3.16.0 + * + * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig|Phaser.Loader.FileTypes.SceneFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {Phaser.Loader.LoaderPlugin} The Loader instance. + */ +FileTypesManager.register('sceneFile', 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 SceneFile(this, key[i])); + } + } + else + { + this.addFile(new SceneFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = SceneFile; + + +/***/ }), +/* 588 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -116257,7 +122467,14 @@ var PluginFile = new Class({ document.head.appendChild(this.data); - pluginManager.install(this.key, window[this.key], start, mapping); + var plugin = pluginManager.install(this.key, window[this.key], start, mapping); + + if (start || mapping) + { + // Install into the current Scene Systems and Scene + this.loader.systems[mapping] = plugin; + this.loader.scene[mapping] = plugin; + } } this.onProcessComplete(); @@ -116318,7 +122535,7 @@ var PluginFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.PluginFileConfig|Phaser.Loader.FileTypes.PluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function. - * @param {boolean} [start] - The plugin mapping configuration object. + * @param {boolean} [start] - Automatically start the plugin after loading? * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * @@ -116346,19 +122563,19 @@ module.exports = PluginFile; /***/ }), -/* 581 */ +/* 589 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); +var CONST = __webpack_require__(15); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); +var JSONFile = __webpack_require__(55); /** * @typedef {object} Phaser.Loader.FileTypes.PackFileConfig @@ -116574,22 +122791,22 @@ module.exports = PackFile; /***/ }), -/* 582 */ +/* 590 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(51); -var MultiFile = __webpack_require__(57); +var JSONFile = __webpack_require__(55); +var MultiFile = __webpack_require__(63); /** * @typedef {object} Phaser.Loader.FileTypes.MultiAtlasFileConfig @@ -116657,7 +122874,7 @@ var MultiAtlasFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.MultiFile#onFileComplete + * @method Phaser.Loader.FileTypes.MultiAtlasFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -116730,7 +122947,7 @@ var MultiAtlasFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.MultiFile#addToCache + * @method Phaser.Loader.FileTypes.MultiAtlasFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -116910,18 +123127,18 @@ module.exports = MultiAtlasFile; /***/ }), -/* 583 */ +/* 591 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -117179,18 +123396,18 @@ module.exports = HTMLTextureFile; /***/ }), -/* 584 */ +/* 592 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -117363,18 +123580,18 @@ module.exports = HTMLFile; /***/ }), -/* 585 */ +/* 593 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -117548,23 +123765,23 @@ module.exports = GLSLFile; /***/ }), -/* 586 */ +/* 594 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(57); -var ParseXMLBitmapFont = __webpack_require__(310); -var XMLFile = __webpack_require__(139); +var MultiFile = __webpack_require__(63); +var ParseXMLBitmapFont = __webpack_require__(314); +var XMLFile = __webpack_require__(150); /** * @typedef {object} Phaser.Loader.FileTypes.BitmapFontFileConfig @@ -117804,18 +124021,18 @@ module.exports = BitmapFontFile; /***/ }), -/* 587 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(18); -var File = __webpack_require__(21); +var CONST = __webpack_require__(15); +var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); @@ -117996,22 +124213,22 @@ module.exports = BinaryFile; /***/ }), -/* 588 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AudioFile = __webpack_require__(253); +var AudioFile = __webpack_require__(258); var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(51); -var MultiFile = __webpack_require__(57); +var JSONFile = __webpack_require__(55); +var MultiFile = __webpack_require__(63); /** * @typedef {object} Phaser.Loader.FileTypes.AudioSpriteFileConfig @@ -118097,7 +124314,7 @@ var AudioSpriteFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.AudioSpriteFile#onFileComplete + * @method Phaser.Loader.FileTypes.AudioSpriteFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -118133,7 +124350,7 @@ var AudioSpriteFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.AudioSpriteFile#addToCache + * @method Phaser.Loader.FileTypes.AudioSpriteFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -118297,22 +124514,22 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio /***/ }), -/* 589 */ +/* 597 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var MultiFile = __webpack_require__(57); -var XMLFile = __webpack_require__(139); +var MultiFile = __webpack_require__(63); +var XMLFile = __webpack_require__(150); /** * @typedef {object} Phaser.Loader.FileTypes.AtlasXMLFileConfig @@ -118552,22 +124769,22 @@ module.exports = AtlasXMLFile; /***/ }), -/* 590 */ +/* 598 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(58); +var ImageFile = __webpack_require__(64); var IsPlainObject = __webpack_require__(8); -var JSONFile = __webpack_require__(51); -var MultiFile = __webpack_require__(57); +var JSONFile = __webpack_require__(55); +var MultiFile = __webpack_require__(63); /** * @typedef {object} Phaser.Loader.FileTypes.AtlasJSONFileConfig @@ -118814,18 +125031,19 @@ module.exports = AtlasJSONFile; /***/ }), -/* 591 */ +/* 599 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(51); +var JSONFile = __webpack_require__(55); +var LoaderEvents = __webpack_require__(75); /** * @classdesc @@ -118873,7 +125091,7 @@ var AnimationJSONFile = new Class({ onProcess: function () { // We need to hook into this event: - this.loader.once('loadcomplete', this.onLoadComplete, this); + this.loader.once(LoaderEvents.POST_PROCESS, this.onLoadComplete, this); // But the rest is the same as a normal JSON file JSONFile.prototype.onProcess.call(this); @@ -119016,12 +125234,12 @@ module.exports = AnimationJSONFile; /***/ }), -/* 592 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119031,48 +125249,49 @@ module.exports = AnimationJSONFile; module.exports = { - AnimationJSONFile: __webpack_require__(591), - AtlasJSONFile: __webpack_require__(590), - AtlasXMLFile: __webpack_require__(589), - AudioFile: __webpack_require__(253), - AudioSpriteFile: __webpack_require__(588), - BinaryFile: __webpack_require__(587), - BitmapFontFile: __webpack_require__(586), - GLSLFile: __webpack_require__(585), - HTML5AudioFile: __webpack_require__(252), - HTMLFile: __webpack_require__(584), - HTMLTextureFile: __webpack_require__(583), - ImageFile: __webpack_require__(58), - JSONFile: __webpack_require__(51), - MultiAtlasFile: __webpack_require__(582), - PackFile: __webpack_require__(581), - PluginFile: __webpack_require__(580), - ScenePluginFile: __webpack_require__(579), - ScriptFile: __webpack_require__(578), - SpriteSheetFile: __webpack_require__(577), - SVGFile: __webpack_require__(576), - TextFile: __webpack_require__(251), - TilemapCSVFile: __webpack_require__(575), - TilemapImpactFile: __webpack_require__(574), - TilemapJSONFile: __webpack_require__(573), - UnityAtlasFile: __webpack_require__(572), - XMLFile: __webpack_require__(139) + AnimationJSONFile: __webpack_require__(599), + AtlasJSONFile: __webpack_require__(598), + AtlasXMLFile: __webpack_require__(597), + AudioFile: __webpack_require__(258), + AudioSpriteFile: __webpack_require__(596), + BinaryFile: __webpack_require__(595), + BitmapFontFile: __webpack_require__(594), + GLSLFile: __webpack_require__(593), + HTML5AudioFile: __webpack_require__(257), + HTMLFile: __webpack_require__(592), + HTMLTextureFile: __webpack_require__(591), + ImageFile: __webpack_require__(64), + JSONFile: __webpack_require__(55), + MultiAtlasFile: __webpack_require__(590), + PackFile: __webpack_require__(589), + PluginFile: __webpack_require__(588), + SceneFile: __webpack_require__(587), + ScenePluginFile: __webpack_require__(586), + ScriptFile: __webpack_require__(585), + SpriteSheetFile: __webpack_require__(584), + SVGFile: __webpack_require__(583), + TextFile: __webpack_require__(256), + TilemapCSVFile: __webpack_require__(582), + TilemapImpactFile: __webpack_require__(581), + TilemapJSONFile: __webpack_require__(580), + UnityAtlasFile: __webpack_require__(579), + XMLFile: __webpack_require__(150) }; /***/ }), -/* 593 */ +/* 601 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(18); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(15); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Loader @@ -119080,16 +125299,18 @@ var Extend = __webpack_require__(20); var Loader = { - FileTypes: __webpack_require__(592), + Events: __webpack_require__(75), - File: __webpack_require__(21), + FileTypes: __webpack_require__(600), + + File: __webpack_require__(22), FileTypesManager: __webpack_require__(7), - GetURL: __webpack_require__(141), - LoaderPlugin: __webpack_require__(571), - MergeXHRSettings: __webpack_require__(140), - MultiFile: __webpack_require__(57), - XHRLoader: __webpack_require__(254), - XHRSettings: __webpack_require__(105) + GetURL: __webpack_require__(152), + LoaderPlugin: __webpack_require__(578), + MergeXHRSettings: __webpack_require__(151), + MultiFile: __webpack_require__(63), + XHRLoader: __webpack_require__(259), + XHRSettings: __webpack_require__(112) }; @@ -119100,12 +125321,12 @@ module.exports = Loader; /***/ }), -/* 594 */ +/* 602 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119116,19 +125337,19 @@ module.exports = Loader; /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(333) + TouchManager: __webpack_require__(337) }; /* eslint-enable */ /***/ }), -/* 595 */ +/* 603 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119139,19 +125360,19 @@ module.exports = { /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(336) + MouseManager: __webpack_require__(339) }; /* eslint-enable */ /***/ }), -/* 596 */ +/* 604 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119178,12 +125399,12 @@ module.exports = UpDuration; /***/ }), -/* 597 */ +/* 605 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119210,12 +125431,12 @@ module.exports = DownDuration; /***/ }), -/* 598 */ +/* 606 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119252,12 +125473,12 @@ module.exports = JustUp; /***/ }), -/* 599 */ +/* 607 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119294,127 +125515,16 @@ module.exports = JustDown; /***/ }), -/* 600 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Used internally by the Keyboard Plugin. - * - * @function Phaser.Input.Keyboard.ProcessKeyUp - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to process the event for. - * @param {KeyboardEvent} event - The native Keyboard event. - * - * @return {Phaser.Input.Keyboard.Key} The Key that was processed. - */ -var ProcessKeyUp = function (key, event) -{ - key.originalEvent = event; - - if (key.preventDefault) - { - event.preventDefault(); - } - - if (!key.enabled) - { - return; - } - - key.isDown = false; - key.isUp = true; - key.timeUp = event.timeStamp; - key.duration = key.timeUp - key.timeDown; - key.repeats = 0; - - key._justDown = false; - key._justUp = true; - key._tick = -1; - - return key; -}; - -module.exports = ProcessKeyUp; - - -/***/ }), -/* 601 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Used internally by the Keyboard Plugin. - * - * @function Phaser.Input.Keyboard.ProcessKeyDown - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to process the event for. - * @param {KeyboardEvent} event - The native Keyboard event. - * - * @return {Phaser.Input.Keyboard.Key} The Key that was processed. - */ -var ProcessKeyDown = function (key, event) -{ - key.originalEvent = event; - - if (key.preventDefault) - { - event.preventDefault(); - } - - if (!key.enabled) - { - return; - } - - key.altKey = event.altKey; - key.ctrlKey = event.ctrlKey; - key.shiftKey = event.shiftKey; - key.location = event.location; - - if (key.isDown === false) - { - key.isDown = true; - key.isUp = false; - key.timeDown = event.timeStamp; - key.duration = 0; - key._justDown = true; - key._justUp = false; - } - - key.repeats++; - - return key; -}; - -module.exports = ProcessKeyDown; - - -/***/ }), -/* 602 */ +/* 608 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var KeyCodes = __webpack_require__(143); +var KeyCodes = __webpack_require__(125); var KeyMap = {}; @@ -119427,12 +125537,12 @@ module.exports = KeyMap; /***/ }), -/* 603 */ +/* 609 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119462,12 +125572,12 @@ module.exports = ResetKeyCombo; /***/ }), -/* 604 */ +/* 610 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -119504,16 +125614,16 @@ module.exports = AdvanceKeyCombo; /***/ }), -/* 605 */ +/* 611 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(604); +var AdvanceKeyCombo = __webpack_require__(610); /** * Used internally by the KeyCombo class. @@ -119585,26 +125695,27 @@ module.exports = ProcessKeyCombo; /***/ }), -/* 606 */ +/* 612 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); +var Events = __webpack_require__(113); +var GameEvents = __webpack_require__(26); var GetValue = __webpack_require__(4); -var InputPluginCache = __webpack_require__(106); -var Key = __webpack_require__(256); -var KeyCodes = __webpack_require__(143); -var KeyCombo = __webpack_require__(255); -var KeyMap = __webpack_require__(602); -var ProcessKeyDown = __webpack_require__(601); -var ProcessKeyUp = __webpack_require__(600); -var SnapFloor = __webpack_require__(142); +var InputEvents = __webpack_require__(52); +var InputPluginCache = __webpack_require__(114); +var Key = __webpack_require__(261); +var KeyCodes = __webpack_require__(125); +var KeyCombo = __webpack_require__(260); +var KeyMap = __webpack_require__(608); +var SnapFloor = __webpack_require__(98); /** * @classdesc @@ -119623,7 +125734,7 @@ var SnapFloor = __webpack_require__(142); * Or, to listen for a specific key: * * ```javascript - * this.input.keyboard.on('keydown_A', callback, context); + * this.input.keyboard.on('keydown-A', callback, context); * ``` * * You can also create Key objects, which you can then poll in your game loop: @@ -119631,6 +125742,10 @@ var SnapFloor = __webpack_require__(142); * ```javascript * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); * ``` + * + * If you have multiple parallel Scenes, each trying to get keyboard input, be sure to disable capture on them to stop them from + * stealing input from another Scene in the list. You can do this with `this.input.keyboard.enabled = false` within the + * Scene to stop all input, or `this.input.keyboard.preventDefault = false` to stop a Scene halting input on another Scene. * * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details. @@ -119657,6 +125772,15 @@ var KeyboardPlugin = new Class({ { EventEmitter.call(this); + /** + * A reference to the core game, so we can listen for visibility events. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#game + * @type {Phaser.Game} + * @since 3.16.0 + */ + this.game = sceneInputPlugin.systems.game; + /** * A reference to the Scene that this Input Plugin is responsible for. * @@ -119685,7 +125809,16 @@ var KeyboardPlugin = new Class({ this.sceneInputPlugin = sceneInputPlugin; /** - * A boolean that controls if the Keyboard Plugin is enabled or not. + * A reference to the global Keyboard Manager. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#manager + * @type {Phaser.Input.InputPlugin} + * @since 3.16.0 + */ + this.manager = sceneInputPlugin.manager.keyboard; + + /** + * A boolean that controls if this Keyboard Plugin is enabled or not. * Can be toggled on the fly. * * @name Phaser.Input.Keyboard.KeyboardPlugin#enabled @@ -119695,16 +125828,6 @@ var KeyboardPlugin = new Class({ */ this.enabled = true; - /** - * The Keyboard Event target, as defined in the Scene or Game Config. - * Typically the browser window, but can be any interactive DOM element. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#target - * @type {any} - * @since 3.10.0 - */ - this.target; - /** * An array of Key objects to process. * @@ -119723,38 +125846,8 @@ var KeyboardPlugin = new Class({ */ this.combos = []; - /** - * An internal event queue. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#queue - * @type {KeyboardEvent[]} - * @private - * @since 3.10.0 - */ - this.queue = []; - - /** - * Internal event handler. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#onKeyHandler - * @type {function} - * @private - * @since 3.10.0 - */ - this.onKeyHandler; - - /** - * Internal time value. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#time - * @type {number} - * @private - * @since 3.11.0 - */ - this.time = 0; - - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -119768,12 +125861,17 @@ var KeyboardPlugin = new Class({ boot: function () { var settings = this.settings.input; - var config = this.scene.sys.game.config; - this.enabled = GetValue(settings, 'keyboard', config.inputKeyboard); - this.target = GetValue(settings, 'keyboard.target', config.inputKeyboardEventTarget); + this.enabled = GetValue(settings, 'keyboard', true); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + var captures = GetValue(settings, 'keyboard.capture', null); + + if (captures) + { + this.addCaptures(captures); + } + + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -119787,12 +125885,18 @@ var KeyboardPlugin = new Class({ */ start: function () { - if (this.enabled) + if (this.sceneInputPlugin.manager.useQueue) { - this.startListeners(); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.on(InputEvents.MANAGER_PROCESS, this.update, this); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); + + this.game.events.on(GameEvents.BLUR, this.resetKeys, this); }, /** @@ -119809,59 +125913,153 @@ var KeyboardPlugin = new Class({ }, /** - * Starts the Keyboard Event listeners running. - * This is called automatically and does not need to be manually invoked. + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. * - * @method Phaser.Input.Keyboard.KeyboardPlugin#startListeners - * @private - * @since 3.10.0 + * This `addCapture` method enables consuming keyboard events for specific keys, so they don't bubble up the browser + * and cause the default behaviors. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable event capture for. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ - startListeners: function () + addCapture: function (keycode) { - var _this = this; + this.manager.addCapture(keycode); - var handler = function (event) - { - if (event.defaultPrevented || !_this.isActive()) - { - // Do nothing if event already handled - return; - } - - _this.queue.push(event); - - var key = _this.keys[event.keyCode]; - - if (key && key.preventDefault) - { - event.preventDefault(); - } - - }; - - this.onKeyHandler = handler; - - this.target.addEventListener('keydown', handler, false); - this.target.addEventListener('keyup', handler, false); - - // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + return this; }, /** - * Stops the Keyboard Event listeners. - * This is called automatically and does not need to be manually invoked. + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. * - * @method Phaser.Input.Keyboard.KeyboardPlugin#stopListeners - * @private - * @since 3.10.0 + * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture + * @since 3.16.0 + * + * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable event capture for. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ - stopListeners: function () + removeCapture: function (keycode) { - this.target.removeEventListener('keydown', this.onKeyHandler); - this.target.removeEventListener('keyup', this.onKeyHandler); + this.manager.removeCapture(keycode); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + return this; + }, + + /** + * Returns an array that contains all of the keyboard captures currently enabled. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures + * @since 3.16.0 + * + * @return {integer[]} An array of all the currently capturing key codes. + */ + getCaptures: function () + { + return this.manager.captures; + }, + + /** + * Allows Phaser to prevent any key captures you may have defined from bubbling up the browser. + * You can use this to re-enable event capturing if you had paused it via `disableGlobalCapture`. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#enableGlobalCapture + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + enableGlobalCapture: function () + { + this.manager.preventDefault = true; + + return this; + }, + + /** + * Disables Phaser from preventing any key captures you may have defined, without actually removing them. + * You can use this to temporarily disable event capturing if, for example, you swap to a DOM element. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#disableGlobalCapture + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + disableGlobalCapture: function () + { + this.manager.preventDefault = false; + + return this; + }, + + /** + * Removes all keyboard captures. + * + * Note that this is a global change. It will clear all event captures across your game, not just for this specific Scene. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#clearCaptures + * @since 3.16.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. + */ + clearCaptures: function () + { + this.manager.clearCaptures(); + + return this; }, /** @@ -119921,11 +126119,16 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(object|string)} keys - An object containing Key Codes, or a comma-separated string. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * * @return {object} An object containing Key objects mapped to the input properties. */ - addKeys: function (keys) + addKeys: function (keys, enableCapture, emitOnRepeat) { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var output = {}; if (typeof keys === 'string') @@ -119938,7 +126141,7 @@ var KeyboardPlugin = new Class({ if (currentKey) { - output[currentKey] = this.addKey(currentKey); + output[currentKey] = this.addKey(currentKey, enableCapture, emitOnRepeat); } } } @@ -119946,7 +126149,7 @@ var KeyboardPlugin = new Class({ { for (var key in keys) { - output[key] = this.addKey(keys[key]); + output[key] = this.addKey(keys[key], enableCapture, emitOnRepeat); } } @@ -119964,11 +126167,16 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * * @return {Phaser.Input.Keyboard.Key} The newly created Key object, or a reference to it if it already existed in the keys array. */ - addKey: function (key) + addKey: function (key, enableCapture, emitOnRepeat) { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var keys = this.keys; if (key instanceof Key) @@ -119984,6 +126192,13 @@ var KeyboardPlugin = new Class({ keys[key.keyCode] = key; } + if (enableCapture) + { + this.addCapture(key.keyCode); + } + + key.setEmitOnRepeat(emitOnRepeat); + return key; } @@ -119995,6 +126210,13 @@ var KeyboardPlugin = new Class({ if (!keys[key]) { keys[key] = new Key(key); + + if (enableCapture) + { + this.addCapture(key); + } + + keys[key].setEmitOnRepeat(emitOnRepeat); } return keys[key]; @@ -120009,6 +126231,8 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ removeKey: function (key) { @@ -120032,6 +126256,8 @@ var KeyboardPlugin = new Class({ { keys[key] = undefined; } + + return this; }, /** @@ -120092,7 +126318,7 @@ var KeyboardPlugin = new Class({ * @param {Phaser.Input.Keyboard.Key} key - A Key object. * @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down. * - * @return {boolean} `True` if the Key is down within the duration specified, otherwise `false`. + * @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`. */ checkDown: function (key, duration) { @@ -120112,29 +126338,22 @@ var KeyboardPlugin = new Class({ }, /** - * Internal update handler called by the Input Manager, which is in turn invoked by the Game step. + * Internal update handler called by the Input Plugin, which is in turn invoked by the Game step. * * @method Phaser.Input.Keyboard.KeyboardPlugin#update * @private * @since 3.10.0 - * - * @param {number} time - The game loop time value. */ - update: function (time) + update: function () { - this.time = time; + var queue = this.manager.queue; + var len = queue.length; - var len = this.queue.length; - - if (!this.enabled || len === 0) + if (!this.isActive() || len === 0) { return; } - // Clears the queue array, and also means we don't work on array data that could potentially - // be modified during the processing phase - var queue = this.queue.splice(0, len); - var keys = this.keys; // Process the event queue, dispatching all of the events that have stored up @@ -120142,40 +126361,98 @@ var KeyboardPlugin = new Class({ { var event = queue[i]; var code = event.keyCode; + var key = keys[code]; + var repeat = false; + + // Override the default functions (it's too late for the browser to use them anyway, so we may as well) + if (event.cancelled === undefined) + { + // Event allowed to flow across all handlers in this Scene, and any other Scene in the Scene list + event.cancelled = 0; + + // Won't reach any more local (Scene level) handlers + event.stopImmediatePropagation = function () + { + event.cancelled = 1; + }; + + // Won't reach any more handlers in any Scene further down the Scene list + event.stopPropagation = function () + { + event.cancelled = -1; + }; + } + + if (event.cancelled === -1) + { + // This event has been stopped from broadcasting to any other Scene, so abort. + continue; + } if (event.type === 'keydown') { - if (KeyMap[code] && (keys[code] === undefined || keys[code].isDown === false)) + // Key specific callback first + if (key) { - // Will emit a keyboard or keyup event - this.emit(event.type, event); + repeat = key.isDown; - this.emit('keydown_' + KeyMap[code], event); + key.onDown(event); } - if (keys[code]) + if (!event.cancelled && (!key || !repeat)) { - ProcessKeyDown(keys[code], event); + if (KeyMap[code]) + { + this.emit(Events.KEY_DOWN + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. + this.emit('keydown_' + KeyMap[code], event); + } + + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_DOWN, event); + } } } else { - // Will emit a keyboard or keyup event - this.emit(event.type, event); - - this.emit('keyup_' + KeyMap[code], event); - - if (keys[code]) + // Key specific callback first + if (key) { - ProcessKeyUp(keys[code], event); + key.onUp(event); } + + if (!event.cancelled) + { + if (KeyMap[code]) + { + this.emit(Events.KEY_UP + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. + this.emit('keyup_' + KeyMap[code], event); + } + + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_UP, event); + } + } + } + + // Reset the cancel state for other Scenes to use + if (event.cancelled === 1) + { + event.cancelled = 0; } } }, /** * Resets all Key objects created by _this_ Keyboard Plugin back to their default un-pressed states. - * This can only reset keys created via the `addKey`, `addKeys` or `createCursors` methods. + * This can only reset keys created via the `addKey`, `addKeys` or `createCursorKeys` methods. * If you have created a Key object directly you'll need to reset it yourself. * * This method is called automatically when the Keyboard Plugin shuts down, but can be @@ -120183,6 +126460,8 @@ var KeyboardPlugin = new Class({ * * @method Phaser.Input.Keyboard.KeyboardPlugin#resetKeys * @since 3.15.0 + * + * @return {Phaser.Input.Keyboard.KeyboardPlugin} This KeyboardPlugin object. */ resetKeys: function () { @@ -120215,7 +126494,16 @@ var KeyboardPlugin = new Class({ { this.resetKeys(); - this.stopListeners(); + if (this.sceneInputPlugin.manager.useQueue) + { + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.off(InputEvents.MANAGER_PROCESS, this.update, this); + } + + this.game.events.off(GameEvents.BLUR, this.resetKeys); this.removeAllListeners(); @@ -120233,6 +126521,17 @@ var KeyboardPlugin = new Class({ { this.shutdown(); + var keys = this.keys; + + for (var i = 0; i < keys.length; i++) + { + // Because it's a sparsely populated array + if (keys[i]) + { + keys[i].destroy(); + } + } + this.keys = []; this.combos = []; this.queue = []; @@ -120240,7 +126539,24 @@ var KeyboardPlugin = new Class({ this.scene = null; this.settings = null; this.sceneInputPlugin = null; - this.target = null; + this.manager = null; + }, + + /** + * Internal time value. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#time + * @type {number} + * @private + * @since 3.11.0 + */ + time: { + + get: function () + { + return this.sceneInputPlugin.manager.time; + } + } }); @@ -120259,12 +126575,243 @@ module.exports = KeyboardPlugin; /***/ }), -/* 607 */ +/* 613 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('up', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * @event Phaser.Input.Keyboard.Events#UP + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was released. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'up'; + + +/***/ }), +/* 614 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released + * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keyup-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#KEY_UP + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup-'; + + +/***/ }), +/* 615 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed + * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keydown-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#KEY_DOWN + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown-'; + + +/***/ }), +/* 616 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('down', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * @event Phaser.Input.Keyboard.Events#DOWN + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was pressed. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'down'; + + +/***/ }), +/* 617 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Combo Match Event. + * + * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched. + * + * Listen for this event from the Key Plugin after a combo has been created: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * @event Phaser.Input.Keyboard.Events#COMBO_MATCH + * + * @param {Phaser.Input.Keyboard.KeyCombo} keycombo - The Key Combo object that was matched. + * @param {KeyboardEvent} event - The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'keycombomatch'; + + +/***/ }), +/* 618 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`. + * + * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_UP + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup'; + + +/***/ }), +/* 619 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`. + * + * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_DOWN + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown'; + + +/***/ }), +/* 620 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120274,28 +126821,31 @@ module.exports = KeyboardPlugin; module.exports = { - KeyboardPlugin: __webpack_require__(606), + Events: __webpack_require__(113), - Key: __webpack_require__(256), - KeyCodes: __webpack_require__(143), + KeyboardManager: __webpack_require__(340), + KeyboardPlugin: __webpack_require__(612), - KeyCombo: __webpack_require__(255), + Key: __webpack_require__(261), + KeyCodes: __webpack_require__(125), - JustDown: __webpack_require__(599), - JustUp: __webpack_require__(598), - DownDuration: __webpack_require__(597), - UpDuration: __webpack_require__(596) + KeyCombo: __webpack_require__(260), + + JustDown: __webpack_require__(607), + JustUp: __webpack_require__(606), + DownDuration: __webpack_require__(605), + UpDuration: __webpack_require__(604) }; /***/ }), -/* 608 */ +/* 621 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -120326,32 +126876,34 @@ module.exports = CreatePixelPerfectHandler; /***/ }), -/* 609 */ +/* 622 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); -var CircleContains = __webpack_require__(40); +var Circle = __webpack_require__(77); +var CircleContains = __webpack_require__(43); var Class = __webpack_require__(0); -var CreateInteractiveObject = __webpack_require__(260); -var CreatePixelPerfectHandler = __webpack_require__(608); -var DistanceBetween = __webpack_require__(52); -var Ellipse = __webpack_require__(90); -var EllipseContains = __webpack_require__(89); +var CreateInteractiveObject = __webpack_require__(265); +var CreatePixelPerfectHandler = __webpack_require__(621); +var DistanceBetween = __webpack_require__(56); +var Ellipse = __webpack_require__(96); +var EllipseContains = __webpack_require__(95); +var Events = __webpack_require__(52); var EventEmitter = __webpack_require__(11); var GetFastValue = __webpack_require__(2); -var InputPluginCache = __webpack_require__(106); +var InputPluginCache = __webpack_require__(114); var IsPlainObject = __webpack_require__(8); -var PluginCache = __webpack_require__(15); -var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(39); -var Triangle = __webpack_require__(59); -var TriangleContains = __webpack_require__(69); +var PluginCache = __webpack_require__(17); +var Rectangle = __webpack_require__(10); +var RectangleContains = __webpack_require__(42); +var SceneEvents = __webpack_require__(16); +var Triangle = __webpack_require__(65); +var TriangleContains = __webpack_require__(74); /** * @classdesc @@ -120538,7 +127090,7 @@ var InputPlugin = new Class({ * Internal event propagation callback container. * * @name Phaser.Input.InputPlugin#_eventContainer - * @type {object} + * @type {Phaser.Input.EventData} * @private * @since 3.13.0 */ @@ -120655,6 +127207,16 @@ var InputPlugin = new Class({ */ this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; + /** + * A array containing the dragStates, for this Scene, index by the Pointer ID. + * + * @name Phaser.Input.InputPlugin#_dragState + * @type {integer[]} + * @private + * @since 3.16.0 + */ + this._dragState = []; + /** * A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID. * @@ -120675,8 +127237,8 @@ var InputPlugin = new Class({ */ this._validTypes = [ 'onDown', 'onUp', 'onOver', 'onOut', 'onMove', 'onDragStart', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDrop' ]; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -120684,6 +127246,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#boot + * @fires Phaser.Input.Events#BOOT * @private * @since 3.5.1 */ @@ -120693,10 +127256,10 @@ var InputPlugin = new Class({ this.displayList = this.systems.displayList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); // Registered input plugins listen for this - this.pluginEvents.emit('boot'); + this.pluginEvents.emit(Events.BOOT); }, /** @@ -120705,6 +127268,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#start + * @fires Phaser.Input.Events#START * @private * @since 3.5.0 */ @@ -120712,18 +127276,60 @@ var InputPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('transitionstart', this.transitionIn, this); - eventEmitter.on('transitionout', this.transitionOut, this); - eventEmitter.on('transitioncomplete', this.transitionComplete, this); - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); + eventEmitter.on(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.once('shutdown', this.shutdown, this); + if (this.manager.useQueue) + { + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + } + + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + + this.manager.events.on(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.on(Events.GAME_OVER, this.onGameOver, this); this.enabled = true; + // Populate the pointer drag states + this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + // Registered input plugins listen for this - this.pluginEvents.emit('start'); + this.pluginEvents.emit(Events.START); + }, + + /** + * Game Over handler. + * + * @method Phaser.Input.InputPlugin#onGameOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.2 + */ + onGameOver: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OVER, event.timeStamp, event); + } + }, + + /** + * Game Out handler. + * + * @method Phaser.Input.InputPlugin#onGameOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.2 + */ + onGameOut: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OUT, event.timeStamp, event); + } }, /** @@ -120731,13 +127337,14 @@ var InputPlugin = new Class({ * deleting old Game Objects. * * @method Phaser.Input.InputPlugin#preUpdate + * @fires Phaser.Input.Events#PRE_UPDATE * @private * @since 3.0.0 */ preUpdate: function () { // Registered input plugins listen for this - this.pluginEvents.emit('preUpdate'); + this.pluginEvents.emit(Events.PRE_UPDATE); var removeList = this._pendingRemoval; var insertList = this._pendingInsertion; @@ -120794,6 +127401,7 @@ var InputPlugin = new Class({ * Called automatically by the Scene Systems step. * * @method Phaser.Input.InputPlugin#update + * @fires Phaser.Input.Events#UPDATE * @private * @since 3.0.0 * @@ -120807,10 +127415,10 @@ var InputPlugin = new Class({ return; } - this.pluginEvents.emit('update', time, delta); - var manager = this.manager; + this.pluginEvents.emit(Events.UPDATE, time, delta); + // Another Scene above this one has already consumed the input events, or we're in transition if (manager.globalTopOnly && manager.ignoreEvents) { @@ -120838,8 +127446,9 @@ var InputPlugin = new Class({ } var pointers = this.manager.pointers; + var pointersTotal = this.manager.pointersTotal; - for (var i = 0; i < this.manager.pointersTotal; i++) + for (var i = 0; i < pointersTotal; i++) { var pointer = pointers[i]; @@ -120868,8 +127477,11 @@ var InputPlugin = new Class({ var total = this.processDragEvents(pointer, time); - // TODO: Enable for touch - if (!pointer.wasTouch) + // TODO: Enable for touch - the method needs recoding to take ALL pointers at once + // and process them all together, in the same batch, otherwise the justOut and stillOver + // arrays will get corrupted in multi-touch enabled games. For now, we'll enable it for + // single touch games (which is probably the majority anyway). + if (pointersTotal < 3 || !pointer.wasTouch) { total += this.processOverOutEvents(pointer); } @@ -120879,16 +127491,16 @@ var InputPlugin = new Class({ total += this.processDownEvents(pointer); } - if (pointer.justUp) - { - total += this.processUpEvents(pointer); - } - if (pointer.justMoved) { total += this.processMoveEvents(pointer); } + if (pointer.justUp) + { + total += this.processUpEvents(pointer); + } + if (total > 0 && manager.globalTopOnly) { // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame @@ -121079,6 +127691,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processDownEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. @@ -121109,7 +127725,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointerdown', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_DOWN, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -121117,7 +127733,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectdown', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_DOWN, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -121126,20 +127742,89 @@ var InputPlugin = new Class({ } } - // Contains ALL Game Objects currently over in the array + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - this.emit('pointerdown', pointer, currentlyOver); + if (pointer.downElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_DOWN, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_DOWN_OUTSIDE, pointer); + } } return total; }, + /** + * Returns the drag state of the given Pointer for this Input Plugin. + * + * The state will be one of the following: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#getDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. + * + * @return {integer} The drag state of the given Pointer. + */ + getDragState: function (pointer) + { + return this._dragState[pointer.id]; + }, + + /** + * Sets the drag state of the given Pointer for this Input Plugin. + * + * The state must be one of the following values: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#setDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. + * @param {integer} state - The drag state value. An integer between 0 and 5. + */ + setDragState: function (pointer, state) + { + this._dragState[pointer.id] = state; + }, + /** * An internal method that handles the Pointer drag events. * * @method Phaser.Input.InputPlugin#processDragEvents * @private + * @fires Phaser.Input.Events#DRAG_END + * @fires Phaser.Input.Events#DRAG_ENTER + * @fires Phaser.Input.Events#DRAG + * @fires Phaser.Input.Events#DRAG_LEAVE + * @fires Phaser.Input.Events#DRAG_OVER + * @fires Phaser.Input.Events#DRAG_START + * @fires Phaser.Input.Events#DROP + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @fires Phaser.Input.Events#GAMEOBJECT_DROP * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. @@ -121168,19 +127853,19 @@ var InputPlugin = new Class({ // 4 = Pointer actively dragging the draglist and has moved // 5 = Pointer actively dragging but has been released, notify draglist - if (pointer.dragState === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) + if (this.getDragState(pointer) === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) { - pointer.dragState = 1; + this.setDragState(pointer, 1); } - else if (pointer.dragState > 0 && !pointer.primaryDown && pointer.justUp) + else if (this.getDragState(pointer) > 0 && !pointer.primaryDown && pointer.justUp) { - pointer.dragState = 5; + this.setDragState(pointer, 5); } // Process the various drag states // 1 = Primary button down and objects below, so collect a draglist - if (pointer.dragState === 1) + if (this.getDragState(pointer) === 1) { // Get draggable objects, sort them, pick the top (or all) and store them somewhere var draglist = []; @@ -121197,7 +127882,7 @@ var InputPlugin = new Class({ if (draglist.length === 0) { - pointer.dragState = 0; + this.setDragState(pointer, 0); return 0; } @@ -121217,35 +127902,35 @@ var InputPlugin = new Class({ if (this.dragDistanceThreshold === 0 && this.dragTimeThreshold === 0) { // No drag criteria, so snap immediately to mode 3 - pointer.dragState = 3; + this.setDragState(pointer, 3); } else { // Check the distance / time - pointer.dragState = 2; + this.setDragState(pointer, 2); } } // 2 = Pointer being checked if meets drag criteria - if (pointer.dragState === 2) + if (this.getDragState(pointer) === 2) { // Has it moved far enough to be considered a drag? if (this.dragDistanceThreshold > 0 && DistanceBetween(pointer.x, pointer.y, pointer.downX, pointer.downY) >= this.dragDistanceThreshold) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } // Held down long enough to be considered a drag? if (this.dragTimeThreshold > 0 && (time >= pointer.downTime + this.dragTimeThreshold)) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } } // 3 = Pointer meets criteria and is freshly down, notify the draglist - if (pointer.dragState === 3) + if (this.getDragState(pointer) === 3) { list = this._drag[pointer.id]; @@ -121263,18 +127948,18 @@ var InputPlugin = new Class({ input.dragStartX = gameObject.x; input.dragStartY = gameObject.y; - gameObject.emit('dragstart', pointer, input.dragX, input.dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG_START, pointer, input.dragX, input.dragY); - this.emit('dragstart', pointer, gameObject); + this.emit(Events.DRAG_START, pointer, gameObject); } - pointer.dragState = 4; + this.setDragState(pointer, 4); return list.length; } // 4 = Pointer actively dragging the draglist and has moved - if (pointer.dragState === 4 && pointer.justMoved && !pointer.justUp) + if (this.getDragState(pointer) === 4 && pointer.justMoved && !pointer.justUp) { var dropZones = this._tempZones; @@ -121295,29 +127980,29 @@ var InputPlugin = new Class({ if (index === 0) { // We're still over it, and it's still the top of the display list, phew ... - gameObject.emit('dragover', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_OVER, pointer, input.target); - this.emit('dragover', pointer, gameObject, input.target); + this.emit(Events.DRAG_OVER, pointer, gameObject, input.target); } else if (index > 0) { // Still over it but it's no longer top of the display list (targets must always be at the top) - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { // Nope, we've moved on (or the target has!), leave the old target - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); // Anything new to replace it? // Yup! @@ -121325,9 +128010,9 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { @@ -121340,24 +128025,24 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } var dragX = pointer.x - gameObject.input.dragX; var dragY = pointer.y - gameObject.input.dragY; - gameObject.emit('drag', pointer, dragX, dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG, pointer, dragX, dragY); - this.emit('drag', pointer, gameObject, dragX, dragY); + this.emit(Events.DRAG, pointer, gameObject, dragX, dragY); } return list.length; } // 5 = Pointer was actively dragging but has been released, notify draglist - if (pointer.dragState === 5) + if (this.getDragState(pointer) === 5) { list = this._drag[pointer.id]; @@ -121378,9 +128063,9 @@ var InputPlugin = new Class({ if (input.target) { - gameObject.emit('drop', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DROP, pointer, input.target); - this.emit('drop', pointer, gameObject, input.target); + this.emit(Events.DROP, pointer, gameObject, input.target); input.target = null; @@ -121389,13 +128074,13 @@ var InputPlugin = new Class({ // And finally the dragend event - gameObject.emit('dragend', pointer, input.dragX, input.dragY, dropped); + gameObject.emit(Events.GAMEOBJECT_DRAG_END, pointer, input.dragX, input.dragY, dropped); - this.emit('dragend', pointer, gameObject, dropped); + this.emit(Events.DRAG_END, pointer, gameObject, dropped); } } - pointer.dragState = 0; + this.setDragState(pointer, 0); list.splice(0); } @@ -121407,6 +128092,9 @@ var InputPlugin = new Class({ * An internal method that handles the Pointer movement event. * * @method Phaser.Input.InputPlugin#processMoveEvents + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @fires Phaser.Input.Events#GAMEOBJECT_MOVE + * @fires Phaser.Input.Events#POINTER_MOVE * @private * @since 3.0.0 * @@ -121438,7 +128126,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointermove', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_MOVE, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -121446,7 +128134,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectmove', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_MOVE, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -121462,7 +128150,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointermove', pointer, currentlyOver); + this.emit(Events.POINTER_MOVE, pointer, currentlyOver); } return total; @@ -121473,6 +128161,12 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processOverOutEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_OVER + * @fires Phaser.Input.Events#POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @fires Phaser.Input.Events#GAMEOBJECT_OUT + * @fires Phaser.Input.Events#POINTER_OUT * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -121554,7 +128248,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerout', pointer, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); manager.resetCursor(gameObject.input); @@ -121566,7 +128260,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectout', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -121577,7 +128271,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerout', pointer, justOut); + this.emit(Events.POINTER_OUT, pointer, justOut); } } @@ -121602,7 +128296,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerover', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); manager.setCursor(gameObject.input); @@ -121614,7 +128308,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectover', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -121625,7 +128319,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerover', pointer, justOver); + this.emit(Events.POINTER_OVER, pointer, justOver); } } @@ -121643,6 +128337,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processUpEvents * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @fires Phaser.Input.Events#GAMEOBJECT_UP + * @fires Phaser.Input.Events#POINTER_UP + * @fires Phaser.Input.Events#POINTER_UP_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -121670,9 +128368,15 @@ var InputPlugin = new Class({ continue; } - // pointerupoutside + gameObject.emit(Events.GAMEOBJECT_POINTER_UP, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - gameObject.emit('pointerup', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + // Clear over and emit 'pointerout' on touch. + if (pointer.wasTouch) + { + this._over[pointer.id] = []; + + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + } if (_eventData.cancelled) { @@ -121680,7 +128384,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectup', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_UP, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -121689,10 +128393,17 @@ var InputPlugin = new Class({ } } + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - // Contains ALL Game Objects currently up in the array - this.emit('pointerup', pointer, currentlyOver); + if (pointer.upElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_UP, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_UP_OUTSIDE, pointer); + } } return currentlyOver.length; @@ -122010,20 +128721,20 @@ var InputPlugin = new Class({ var width = 0; var height = 0; - if (frame) - { - width = frame.realWidth; - height = frame.realHeight; - } - else if (gameObject.width) + if (gameObject.width) { width = gameObject.width; height = gameObject.height; } + else if (frame) + { + width = frame.realWidth; + height = frame.realHeight; + } if (gameObject.type === 'Container' && (width === 0 || height === 0)) { - console.warn('Container.setInteractive() must specify a Shape or call setSize() first'); + console.warn('Container.setInteractive must specify a Shape or call setSize() first'); continue; } @@ -122297,6 +129008,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -122319,6 +129034,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this DOM event. @@ -122334,6 +129050,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -122356,6 +129076,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -122371,6 +129092,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -122393,6 +129118,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -122508,19 +129234,21 @@ var InputPlugin = new Class({ * We need to kill and reset all internal properties as well as stop listening to Scene events. * * @method Phaser.Input.InputPlugin#shutdown + * @fires Phaser.Input.Events#SHUTDOWN * @private * @since 3.0.0 */ shutdown: function () { // Registered input plugins listen for this - this.pluginEvents.emit('shutdown'); + this.pluginEvents.emit(Events.SHUTDOWN); this._temp.length = 0; this._list.length = 0; this._draggable.length = 0; this._pendingRemoval.length = 0; this._pendingInsertion.length = 0; + this._dragState.length = 0; for (var i = 0; i < 10; i++) { @@ -122532,13 +129260,21 @@ var InputPlugin = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('transitionstart', this.transitionIn, this); - eventEmitter.off('transitionout', this.transitionOut, this); - eventEmitter.off('transitioncomplete', this.transitionComplete, this); + eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + + if (this.manager.useQueue) + { + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + } + + this.manager.events.off(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.off(Events.GAME_OVER, this.onGameOver, this); + + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -122546,6 +129282,7 @@ var InputPlugin = new Class({ * We need to shutdown and then kill off all external references. * * @method Phaser.Input.InputPlugin#destroy + * @fires Phaser.Input.Events#DESTROY * @private * @since 3.0.0 */ @@ -122554,11 +129291,11 @@ var InputPlugin = new Class({ this.shutdown(); // Registered input plugins listen for this - this.pluginEvents.emit('destroy'); + this.pluginEvents.emit(Events.DESTROY); this.pluginEvents.removeAllListeners(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.cameras = null; @@ -122603,6 +129340,23 @@ var InputPlugin = new Class({ }, + /** + * Are any mouse or touch pointers currently over the game canvas? + * + * @name Phaser.Input.InputPlugin#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isOver: { + + get: function () + { + return this.manager.isOver; + } + + }, + /** * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` @@ -122827,12 +129581,12 @@ module.exports = InputPlugin; /***/ }), -/* 610 */ +/* 623 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122878,12 +129632,12 @@ module.exports = { /***/ }), -/* 611 */ +/* 624 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122917,12 +129671,12 @@ module.exports = { /***/ }), -/* 612 */ +/* 625 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122967,12 +129721,12 @@ module.exports = { /***/ }), -/* 613 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -122982,28 +129736,30 @@ module.exports = { module.exports = { - DUALSHOCK_4: __webpack_require__(612), - SNES_USB: __webpack_require__(611), - XBOX_360: __webpack_require__(610) + DUALSHOCK_4: __webpack_require__(625), + SNES_USB: __webpack_require__(624), + XBOX_360: __webpack_require__(623) }; /***/ }), -/* 614 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(11); -var Gamepad = __webpack_require__(257); +var Events = __webpack_require__(153); +var Gamepad = __webpack_require__(262); var GetValue = __webpack_require__(4); -var InputPluginCache = __webpack_require__(106); +var InputPluginCache = __webpack_require__(114); +var InputEvents = __webpack_require__(52); /** * @typedef {object} Pad @@ -123183,8 +129939,8 @@ var GamepadPlugin = new Class({ */ this._pad4; - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -123204,7 +129960,7 @@ var GamepadPlugin = new Class({ this.enabled = GetValue(settings, 'gamepad', config.inputGamepad) && game.device.input.gamepads; this.target = GetValue(settings, 'gamepad.target', config.inputGamepadEventTarget); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -123223,7 +129979,7 @@ var GamepadPlugin = new Class({ this.startListeners(); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -123277,7 +130033,7 @@ var GamepadPlugin = new Class({ // until more browsers support this // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); }, /** @@ -123293,7 +130049,7 @@ var GamepadPlugin = new Class({ this.target.removeEventListener('gamepadconnected', this.onGamepadHandler); this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); }, /** @@ -123440,6 +130196,8 @@ var GamepadPlugin = new Class({ * * @method Phaser.Input.Gamepad.GamepadPlugin#update * @private + * @fires Phaser.Input.Gamepad.Events#CONNECTED + * @fires Phaser.Input.Gamepad.Events#DISCONNECTED * @since 3.10.0 */ update: function () @@ -123468,11 +130226,11 @@ var GamepadPlugin = new Class({ if (event.type === 'gamepadconnected') { - this.emit('connected', pad, event); + this.emit(Events.CONNECTED, pad, event); } else if (event.type === 'gamepaddisconnected') { - this.emit('disconnected', pad, event); + this.emit(Events.DISCONNECTED, pad, event); } } }, @@ -123633,12 +130391,185 @@ module.exports = GamepadPlugin; /***/ }), -/* 615 */ +/* 628 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by a Gamepad instance when a button has been released on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('up', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP + * + * @param {integer} index - The index of the button that was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + */ +module.exports = 'up'; + + +/***/ }), +/* 629 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by a Gamepad instance when a button has been pressed on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('down', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * + * @param {integer} index - The index of the button that was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + */ +module.exports = 'down'; + + +/***/ }), +/* 630 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Disconnected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`. + * + * @event Phaser.Input.Gamepad.Events#DISCONNECTED + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was disconnected. + * @param {Event} event - The native DOM Event that triggered the disconnection. + */ +module.exports = 'disconnected'; + + +/***/ }), +/* 631 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Connected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`. + * + * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, + * this is for security reasons. However, it may also trust the page already, in which case you won't get the + * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads + * already connected. + * + * @event Phaser.Input.Gamepad.Events#CONNECTED + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was connected. + * @param {Event} event - The native DOM Event that triggered the connection. + */ +module.exports = 'connected'; + + +/***/ }), +/* 632 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`. + * + * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_UP + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was released. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'up'; + + +/***/ }), +/* 633 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`. + * + * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_DOWN + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was pressed. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'down'; + + +/***/ }), +/* 634 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123648,27 +130579,28 @@ module.exports = GamepadPlugin; module.exports = { - Axis: __webpack_require__(259), - Button: __webpack_require__(258), - Gamepad: __webpack_require__(257), - GamepadPlugin: __webpack_require__(614), + Axis: __webpack_require__(264), + Button: __webpack_require__(263), + Events: __webpack_require__(153), + Gamepad: __webpack_require__(262), + GamepadPlugin: __webpack_require__(627), - Configs: __webpack_require__(613) + Configs: __webpack_require__(626) }; /***/ }), -/* 616 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(337); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(341); +var Extend = __webpack_require__(19); /** * @namespace Phaser.Input @@ -123676,15 +130608,16 @@ var Extend = __webpack_require__(20); var Input = { - CreateInteractiveObject: __webpack_require__(260), - Gamepad: __webpack_require__(615), - InputManager: __webpack_require__(338), - InputPlugin: __webpack_require__(609), - InputPluginCache: __webpack_require__(106), - Keyboard: __webpack_require__(607), - Mouse: __webpack_require__(595), - Pointer: __webpack_require__(335), - Touch: __webpack_require__(594) + CreateInteractiveObject: __webpack_require__(265), + Events: __webpack_require__(52), + Gamepad: __webpack_require__(634), + InputManager: __webpack_require__(342), + InputPlugin: __webpack_require__(622), + InputPluginCache: __webpack_require__(114), + Keyboard: __webpack_require__(620), + Mouse: __webpack_require__(603), + Pointer: __webpack_require__(338), + Touch: __webpack_require__(602) }; @@ -123695,30 +130628,30 @@ module.exports = Input; /***/ }), -/* 617 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(144); +var RotateAroundXY = __webpack_require__(154); /** - * [description] + * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. * * @function Phaser.Geom.Triangle.RotateAroundPoint * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} point - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {Phaser.Geom.Point} point - The Point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var RotateAroundPoint = function (triangle, point, angle) { @@ -123729,30 +130662,30 @@ module.exports = RotateAroundPoint; /***/ }), -/* 618 */ +/* 637 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(144); -var InCenter = __webpack_require__(261); +var RotateAroundXY = __webpack_require__(154); +var InCenter = __webpack_require__(266); /** - * [description] + * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. * * @function Phaser.Geom.Triangle.Rotate * @since 3.0.0 * * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} angle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} The rotated Triangle. */ var Rotate = function (triangle, angle) { @@ -123765,16 +130698,16 @@ module.exports = Rotate; /***/ }), -/* 619 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(58); // The 2D area of a triangle. The area value is always non-negative. @@ -123801,12 +130734,12 @@ module.exports = Perimeter; /***/ }), -/* 620 */ +/* 639 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123837,12 +130770,12 @@ module.exports = Equals; /***/ }), -/* 621 */ +/* 640 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -123868,27 +130801,27 @@ module.exports = CopyFrom; /***/ }), -/* 622 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(69); +var Contains = __webpack_require__(74); /** - * [description] + * Tests if a triangle contains a point. * * @function Phaser.Geom.Triangle.ContainsPoint * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} point - [description] + * @param {Phaser.Geom.Triangle} triangle - The triangle. + * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|any)} point - The point to test, or any point-like object with public `x` and `y` properties. * - * @return {boolean} [description] + * @return {boolean} `true` if the point is within the triangle, otherwise `false`. */ var ContainsPoint = function (triangle, point) { @@ -123899,26 +130832,26 @@ module.exports = ContainsPoint; /***/ }), -/* 623 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); /** - * [description] + * Clones a Triangle object. * * @function Phaser.Geom.Triangle.Clone * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} source - [description] + * @param {Phaser.Geom.Triangle} source - The Triangle to clone. * - * @return {Phaser.Geom.Triangle} [description] + * @return {Phaser.Geom.Triangle} A new Triangle identical to the given one but separate from it. */ var Clone = function (source) { @@ -123929,31 +130862,31 @@ module.exports = Clone; /***/ }), -/* 624 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); +var Circle = __webpack_require__(77); // Adapted from https://gist.github.com/mutoo/5617691 /** - * [description] + * Finds the circumscribed circle (circumcircle) of a Triangle object. The circumcircle is the circle which touches all of the triangle's vertices. * * @function Phaser.Geom.Triangle.CircumCircle * @since 3.0.0 * * @generic {Phaser.Geom.Circle} O - [out,$return] * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Circle} [out] - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use as input. + * @param {Phaser.Geom.Circle} [out] - An optional Circle to store the result in. * - * @return {Phaser.Geom.Circle} [description] + * @return {Phaser.Geom.Circle} The updated `out` Circle, or a new Circle if none was provided. */ var CircumCircle = function (triangle, out) { @@ -124012,12 +130945,12 @@ module.exports = CircumCircle; /***/ }), -/* 625 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124088,24 +131021,24 @@ module.exports = CircumCenter; /***/ }), -/* 626 */ +/* 645 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Centroid = __webpack_require__(263); -var Offset = __webpack_require__(262); +var Centroid = __webpack_require__(268); +var Offset = __webpack_require__(267); /** * @callback CenterFunction * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to return the center coordinates of. * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Math.Vector2} The center point of the Triangle according to the function. */ /** @@ -124141,16 +131074,16 @@ module.exports = CenterOn; /***/ }), -/* 627 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); // 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) @@ -124190,17 +131123,17 @@ module.exports = BuildRight; /***/ }), -/* 628 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EarCut = __webpack_require__(64); -var Triangle = __webpack_require__(59); +var EarCut = __webpack_require__(71); +var Triangle = __webpack_require__(65); /** * [description] @@ -124265,16 +131198,16 @@ module.exports = BuildFromPolygon; /***/ }), -/* 629 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); /** * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). @@ -124309,26 +131242,26 @@ module.exports = BuildEquilateral; /***/ }), -/* 630 */ +/* 649 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // The 2D area of a triangle. The area value is always non-negative. /** - * [description] + * Returns the area of a Triangle. * * @function Phaser.Geom.Triangle.Area * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. * - * @return {number} [description] + * @return {number} The area of the Triangle, always non-negative. */ var Area = function (triangle) { @@ -124348,70 +131281,70 @@ module.exports = Area; /***/ }), -/* 631 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(59); +var Triangle = __webpack_require__(65); -Triangle.Area = __webpack_require__(630); -Triangle.BuildEquilateral = __webpack_require__(629); -Triangle.BuildFromPolygon = __webpack_require__(628); -Triangle.BuildRight = __webpack_require__(627); -Triangle.CenterOn = __webpack_require__(626); -Triangle.Centroid = __webpack_require__(263); -Triangle.CircumCenter = __webpack_require__(625); -Triangle.CircumCircle = __webpack_require__(624); -Triangle.Clone = __webpack_require__(623); -Triangle.Contains = __webpack_require__(69); -Triangle.ContainsArray = __webpack_require__(147); -Triangle.ContainsPoint = __webpack_require__(622); -Triangle.CopyFrom = __webpack_require__(621); -Triangle.Decompose = __webpack_require__(269); -Triangle.Equals = __webpack_require__(620); -Triangle.GetPoint = __webpack_require__(278); -Triangle.GetPoints = __webpack_require__(277); -Triangle.InCenter = __webpack_require__(261); -Triangle.Perimeter = __webpack_require__(619); -Triangle.Offset = __webpack_require__(262); -Triangle.Random = __webpack_require__(184); -Triangle.Rotate = __webpack_require__(618); -Triangle.RotateAroundPoint = __webpack_require__(617); -Triangle.RotateAroundXY = __webpack_require__(144); +Triangle.Area = __webpack_require__(649); +Triangle.BuildEquilateral = __webpack_require__(648); +Triangle.BuildFromPolygon = __webpack_require__(647); +Triangle.BuildRight = __webpack_require__(646); +Triangle.CenterOn = __webpack_require__(645); +Triangle.Centroid = __webpack_require__(268); +Triangle.CircumCenter = __webpack_require__(644); +Triangle.CircumCircle = __webpack_require__(643); +Triangle.Clone = __webpack_require__(642); +Triangle.Contains = __webpack_require__(74); +Triangle.ContainsArray = __webpack_require__(157); +Triangle.ContainsPoint = __webpack_require__(641); +Triangle.CopyFrom = __webpack_require__(640); +Triangle.Decompose = __webpack_require__(274); +Triangle.Equals = __webpack_require__(639); +Triangle.GetPoint = __webpack_require__(283); +Triangle.GetPoints = __webpack_require__(282); +Triangle.InCenter = __webpack_require__(266); +Triangle.Perimeter = __webpack_require__(638); +Triangle.Offset = __webpack_require__(267); +Triangle.Random = __webpack_require__(198); +Triangle.Rotate = __webpack_require__(637); +Triangle.RotateAroundPoint = __webpack_require__(636); +Triangle.RotateAroundXY = __webpack_require__(154); module.exports = Triangle; /***/ }), -/* 632 */ +/* 651 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // Scales the width and height of this Rectangle by the given amounts. /** - * [description] + * Scales the width and height of this Rectangle by the given amounts. * * @function Phaser.Geom.Rectangle.Scale * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The `Rectangle` object that will be scaled by the specified amount(s). + * @param {number} x - The factor by which to scale the rectangle horizontally. + * @param {number} y - The amount by which to scale the rectangle vertically. If this is not specified, the rectangle will be scaled by the factor `x` in both directions. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The rectangle object with updated `width` and `height` properties as calculated from the scaling factor(s). */ var Scale = function (rect, x, y) { @@ -124427,12 +131360,12 @@ module.exports = Scale; /***/ }), -/* 633 */ +/* 652 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124456,17 +131389,17 @@ module.exports = SameDimensions; /***/ }), -/* 634 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Between = __webpack_require__(170); -var ContainsRect = __webpack_require__(264); +var Between = __webpack_require__(184); +var ContainsRect = __webpack_require__(269); var Point = __webpack_require__(6); /** @@ -124527,17 +131460,17 @@ module.exports = RandomOutside; /***/ }), -/* 635 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var DegToRad = __webpack_require__(31); +var DegToRad = __webpack_require__(34); /** * [description] @@ -124584,25 +131517,25 @@ module.exports = PerimeterPoint; /***/ }), -/* 636 */ +/* 655 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks if two Rectangles overlap. If a Rectangle is within another Rectangle, the two will be considered overlapping. Thus, the Rectangles are treated as "solid". * * @function Phaser.Geom.Rectangle.Overlaps * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - [description] - * @param {Phaser.Geom.Rectangle} rectB - [description] + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check. * - * @return {boolean} [description] + * @return {boolean} `true` if the two Rectangles overlap, `false` otherwise. */ var Overlaps = function (rectA, rectB) { @@ -124618,12 +131551,12 @@ module.exports = Overlaps; /***/ }), -/* 637 */ +/* 656 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124652,12 +131585,12 @@ module.exports = OffsetPoint; /***/ }), -/* 638 */ +/* 657 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124687,12 +131620,12 @@ module.exports = Offset; /***/ }), -/* 639 */ +/* 658 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124731,12 +131664,12 @@ module.exports = MergeXY; /***/ }), -/* 640 */ +/* 659 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124778,12 +131711,12 @@ module.exports = MergeRect; /***/ }), -/* 641 */ +/* 660 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124827,17 +131760,17 @@ module.exports = MergePoints; /***/ }), -/* 642 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); -var Intersects = __webpack_require__(148); +var Rectangle = __webpack_require__(10); +var Intersects = __webpack_require__(158); /** * Takes two Rectangles and first checks to see if they intersect. @@ -124878,34 +131811,33 @@ module.exports = Intersection; /***/ }), -/* 643 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(175); +var CenterOn = __webpack_require__(189); -// 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 -// to the left and right by the x value, and to the top and the bottom by the y value. /** - * [description] + * Increases the size of a Rectangle by a specified amount. + * + * The center of the Rectangle stays the same. The amounts are added to each side, so the actual increase in width or height is two times bigger than the respective argument. * * @function Phaser.Geom.Rectangle.Inflate * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to inflate. + * @param {number} x - How many pixels the left and the right side should be moved by horizontally. + * @param {number} y - How many pixels the top and the bottom side should be moved by vertically. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The inflated Rectangle. */ var Inflate = function (rect, x, y) { @@ -124921,12 +131853,12 @@ module.exports = Inflate; /***/ }), -/* 644 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -124962,12 +131894,12 @@ module.exports = GetSize; /***/ }), -/* 645 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125000,12 +131932,12 @@ module.exports = GetCenter; /***/ }), -/* 646 */ +/* 665 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125035,26 +131967,26 @@ module.exports = FloorAll; /***/ }), -/* 647 */ +/* 666 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rounds down (floors) the top left X and Y co-ordinates of the given Rectangle to the largest integer less than or equal to them * * @function Phaser.Geom.Rectangle.Floor * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle to floor the top left X and Y co-ordinates of * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The rectangle that was passed to this function with its co-ordinates floored. */ var Floor = function (rect) { @@ -125068,33 +132000,33 @@ module.exports = Floor; /***/ }), -/* 648 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(145); - -// Fits the target rectangle around the source rectangle. -// Preserves aspect ration. -// Scales and centers the target rectangle to the source rectangle +var GetAspectRatio = __webpack_require__(155); /** - * [description] + * Adjusts the target rectangle, changing its width, height and position, + * so that it fully covers the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitInside` function, the target rectangle may extend further out than the source. * * @function Phaser.Geom.Rectangle.FitOutside * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @param {Phaser.Geom.Rectangle} target - [description] - * @param {Phaser.Geom.Rectangle} source - [description] + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envlope the target in. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ var FitOutside = function (target, source) { @@ -125121,33 +132053,33 @@ module.exports = FitOutside; /***/ }), -/* 649 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(145); - -// Fits the target rectangle into the source rectangle. -// Preserves aspect ratio. -// Scales and centers the target rectangle to the source rectangle +var GetAspectRatio = __webpack_require__(155); /** - * [description] + * Adjusts the target rectangle, changing its width, height and position, + * so that it fits inside the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitOutside` function, there may be some space inside the source area not covered. * * @function Phaser.Geom.Rectangle.FitInside * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @param {Phaser.Geom.Rectangle} target - [description] - * @param {Phaser.Geom.Rectangle} source - [description] + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envlope the target in. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ var FitInside = function (target, source) { @@ -125174,25 +132106,25 @@ module.exports = FitInside; /***/ }), -/* 650 */ +/* 669 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Compares the `x`, `y`, `width` and `height` properties of two rectangles. * * @function Phaser.Geom.Rectangle.Equals * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {Phaser.Geom.Rectangle} toCompare - [description] + * @param {Phaser.Geom.Rectangle} rect - Rectangle A + * @param {Phaser.Geom.Rectangle} toCompare - Rectangle B * - * @return {boolean} [description] + * @return {boolean} `true` if the rectangles' properties are an exact match, otherwise `false`. */ var Equals = function (rect, toCompare) { @@ -125208,12 +132140,12 @@ module.exports = Equals; /***/ }), -/* 651 */ +/* 670 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125239,16 +132171,16 @@ module.exports = CopyFrom; /***/ }), -/* 652 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(39); +var Contains = __webpack_require__(42); /** * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. @@ -125270,16 +132202,16 @@ module.exports = ContainsPoint; /***/ }), -/* 653 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Creates a new Rectangle which is identical to the given one. @@ -125300,26 +132232,26 @@ module.exports = Clone; /***/ }), -/* 654 */ +/* 673 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Rounds a Rectangle's position and size up to the smallest integer greater than or equal to each respective value. * * @function Phaser.Geom.Rectangle.CeilAll * @since 3.0.0 * * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to modify. * - * @return {Phaser.Geom.Rectangle} [description] + * @return {Phaser.Geom.Rectangle} The modified Rectangle. */ var CeilAll = function (rect) { @@ -125335,12 +132267,12 @@ module.exports = CeilAll; /***/ }), -/* 655 */ +/* 674 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125368,24 +132300,24 @@ module.exports = Ceil; /***/ }), -/* 656 */ +/* 675 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Calculates the area of the given Rectangle object. * * @function Phaser.Geom.Rectangle.Area * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle to calculate the area of. * - * @return {number} [description] + * @return {number} The area of the Rectangle object. */ var Area = function (rect) { @@ -125396,26 +132328,26 @@ module.exports = Area; /***/ }), -/* 657 */ +/* 676 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Reverses the order of the points of a Polygon. * * @function Phaser.Geom.Polygon.Reverse * @since 3.0.0 * * @generic {Phaser.Geom.Polygon} O - [polygon,$return] * - * @param {Phaser.Geom.Polygon} polygon - [description] + * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. * - * @return {Phaser.Geom.Polygon} [description] + * @return {Phaser.Geom.Polygon} The modified Polygon. */ var Reverse = function (polygon) { @@ -125428,12 +132360,12 @@ module.exports = Reverse; /***/ }), -/* 658 */ +/* 677 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125471,16 +132403,16 @@ module.exports = GetNumberArray; /***/ }), -/* 659 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(150); +var Contains = __webpack_require__(160); /** * [description] @@ -125502,26 +132434,26 @@ module.exports = ContainsPoint; /***/ }), -/* 660 */ +/* 679 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(151); +var Polygon = __webpack_require__(161); /** - * [description] + * Create a new polygon which is a copy of the specified polygon * * @function Phaser.Geom.Polygon.Clone * @since 3.0.0 * - * @param {Phaser.Geom.Polygon} polygon - [description] + * @param {Phaser.Geom.Polygon} polygon - The polygon to create a clone of * - * @return {Phaser.Geom.Polygon} [description] + * @return {Phaser.Geom.Polygon} A new separate Polygon cloned from the specified polygon, based on the same points. */ var Clone = function (polygon) { @@ -125532,54 +132464,54 @@ module.exports = Clone; /***/ }), -/* 661 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(151); +var Polygon = __webpack_require__(161); -Polygon.Clone = __webpack_require__(660); -Polygon.Contains = __webpack_require__(150); -Polygon.ContainsPoint = __webpack_require__(659); -Polygon.GetAABB = __webpack_require__(285); -Polygon.GetNumberArray = __webpack_require__(658); -Polygon.GetPoints = __webpack_require__(284); -Polygon.Perimeter = __webpack_require__(283); -Polygon.Reverse = __webpack_require__(657); -Polygon.Smooth = __webpack_require__(282); +Polygon.Clone = __webpack_require__(679); +Polygon.Contains = __webpack_require__(160); +Polygon.ContainsPoint = __webpack_require__(678); +Polygon.GetAABB = __webpack_require__(290); +Polygon.GetNumberArray = __webpack_require__(677); +Polygon.GetPoints = __webpack_require__(289); +Polygon.Perimeter = __webpack_require__(288); +Polygon.Reverse = __webpack_require__(676); +Polygon.Smooth = __webpack_require__(287); module.exports = Polygon; /***/ }), -/* 662 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetMagnitude = __webpack_require__(267); +var GetMagnitude = __webpack_require__(272); /** - * [description] + * Changes the magnitude (length) of a two-dimensional vector without changing its direction. * * @function Phaser.Geom.Point.SetMagnitude * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [point,$return] * - * @param {Phaser.Geom.Point} point - [description] - * @param {number} magnitude - [description] + * @param {Phaser.Geom.Point} point - The Point to treat as the end point of the vector. + * @param {number} magnitude - The new magnitude of the vector. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The modified Point. */ var SetMagnitude = function (point, magnitude) { @@ -125601,12 +132533,12 @@ module.exports = SetMagnitude; /***/ }), -/* 663 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125645,17 +132577,17 @@ module.exports = ProjectUnit; /***/ }), -/* 664 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -var GetMagnitudeSq = __webpack_require__(266); +var GetMagnitudeSq = __webpack_require__(271); /** * [description] @@ -125691,29 +132623,29 @@ module.exports = Project; /***/ }), -/* 665 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * [description] + * Inverts a Point's coordinates. * * @function Phaser.Geom.Point.Negative * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Point} [out] - [description] + * @param {Phaser.Geom.Point} point - The Point to invert. + * @param {Phaser.Geom.Point} [out] - The Point to return the inverted coordinates in. * - * @return {Phaser.Geom.Point} [description] + * @return {Phaser.Geom.Point} The modified `out` Point, or a new Point if none was provided. */ var Negative = function (point, out) { @@ -125726,12 +132658,12 @@ module.exports = Negative; /***/ }), -/* 666 */ +/* 685 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125756,31 +132688,31 @@ module.exports = Invert; /***/ }), -/* 667 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * Interpolate two given Point objects, based on `t` value. Return result either as new Point if `out` parameter is omitted or load result into Point passed as `out` parameter and return it. For `out` parameter you can also use any object with public x/y properties. + * [description] * * @function Phaser.Geom.Point.Interpolate * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {Phaser.Geom.Point} pointA - [description] - * @param {Phaser.Geom.Point} pointB - [description] - * @param {number} [t=0] - [description] - * @param {(Phaser.Geom.Point|object)} [out] - [description] + * @param {Phaser.Geom.Point} pointA - The starting `Point` for the interpolation. + * @param {Phaser.Geom.Point} pointB - The target `Point` for the interpolation. + * @param {number} [t=0] - The amount to interpolate between the two points. Generally, a value between 0 (returns the starting `Point`) and 1 (returns the target `Point`). If omitted, 0 is used. + * @param {(Phaser.Geom.Point|object)} [out] - An optional `Point` object whose `x` and `y` values will be set to the result of the interpolation (can also be any object with `x` and `y` properties). If omitted, a new `Point` created and returned. * - * @return {(Phaser.Geom.Point|object)} [description] + * @return {(Phaser.Geom.Point|object)} Either the object from the `out` argument with the properties `x` and `y` set to the result of the interpolation or a newly created `Point` object. */ var Interpolate = function (pointA, pointB, t, out) { @@ -125797,16 +132729,16 @@ module.exports = Interpolate; /***/ }), -/* 668 */ +/* 687 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Calculates the Axis Aligned Bounding Box (or aabb) from an array of points. @@ -125867,19 +132799,20 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 669 */ +/* 688 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); /** - * [description] + * Get the centroid or geometric center of a plane figure (the arithmetic mean position of all the points in the figure). + * Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin. * * @function Phaser.Geom.Point.GetCentroid * @since 3.0.0 @@ -125930,12 +132863,12 @@ module.exports = GetCentroid; /***/ }), -/* 670 */ +/* 689 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125960,12 +132893,12 @@ module.exports = Floor; /***/ }), -/* 671 */ +/* 690 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -125989,12 +132922,12 @@ module.exports = Equals; /***/ }), -/* 672 */ +/* 691 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126020,12 +132953,12 @@ module.exports = CopyFrom; /***/ }), -/* 673 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126050,12 +132983,12 @@ module.exports = Clone; /***/ }), -/* 674 */ +/* 693 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126080,43 +133013,43 @@ module.exports = Ceil; /***/ }), -/* 675 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = __webpack_require__(6); -Point.Ceil = __webpack_require__(674); -Point.Clone = __webpack_require__(673); -Point.CopyFrom = __webpack_require__(672); -Point.Equals = __webpack_require__(671); -Point.Floor = __webpack_require__(670); -Point.GetCentroid = __webpack_require__(669); -Point.GetMagnitude = __webpack_require__(267); -Point.GetMagnitudeSq = __webpack_require__(266); -Point.GetRectangleFromPoints = __webpack_require__(668); -Point.Interpolate = __webpack_require__(667); -Point.Invert = __webpack_require__(666); -Point.Negative = __webpack_require__(665); -Point.Project = __webpack_require__(664); -Point.ProjectUnit = __webpack_require__(663); -Point.SetMagnitude = __webpack_require__(662); +Point.Ceil = __webpack_require__(693); +Point.Clone = __webpack_require__(692); +Point.CopyFrom = __webpack_require__(691); +Point.Equals = __webpack_require__(690); +Point.Floor = __webpack_require__(689); +Point.GetCentroid = __webpack_require__(688); +Point.GetMagnitude = __webpack_require__(272); +Point.GetMagnitudeSq = __webpack_require__(271); +Point.GetRectangleFromPoints = __webpack_require__(687); +Point.Interpolate = __webpack_require__(686); +Point.Invert = __webpack_require__(685); +Point.Negative = __webpack_require__(684); +Point.Project = __webpack_require__(683); +Point.ProjectUnit = __webpack_require__(682); +Point.SetMagnitude = __webpack_require__(681); module.exports = Point; /***/ }), -/* 676 */ +/* 695 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126139,12 +133072,12 @@ module.exports = Width; /***/ }), -/* 677 */ +/* 696 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126167,12 +133100,12 @@ module.exports = Slope; /***/ }), -/* 678 */ +/* 697 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126207,16 +133140,16 @@ module.exports = SetToAngle; /***/ }), -/* 679 */ +/* 698 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(146); +var RotateAroundXY = __webpack_require__(156); /** * Rotate a line around a point by the given angle in radians. @@ -126241,16 +133174,16 @@ module.exports = RotateAroundPoint; /***/ }), -/* 680 */ +/* 699 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(146); +var RotateAroundXY = __webpack_require__(156); /** * Rotate a line around its midpoint by the given angle in radians. @@ -126277,17 +133210,17 @@ module.exports = Rotate; /***/ }), -/* 681 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Angle = __webpack_require__(68); -var NormalAngle = __webpack_require__(268); +var Angle = __webpack_require__(73); +var NormalAngle = __webpack_require__(273); /** * Calculate the reflected angle between two lines. @@ -126311,12 +133244,12 @@ module.exports = ReflectAngle; /***/ }), -/* 682 */ +/* 701 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126339,12 +133272,12 @@ module.exports = PerpSlope; /***/ }), -/* 683 */ +/* 702 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126377,27 +133310,28 @@ module.exports = Offset; /***/ }), -/* 684 */ +/* 703 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(73); /** - * [description] + * The Y value of the normal of the given line. + * The normal of a line is a vector that points perpendicular from it. * * @function Phaser.Geom.Line.NormalY * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Line} line - The line to calculate the normal of. * - * @return {number} [description] + * @return {number} The Y value of the normal of the Line. */ var NormalY = function (line) { @@ -126408,17 +133342,17 @@ module.exports = NormalY; /***/ }), -/* 685 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(73); /** * [description] @@ -126439,12 +133373,12 @@ module.exports = NormalX; /***/ }), -/* 686 */ +/* 705 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126467,17 +133401,64 @@ module.exports = Height; /***/ }), -/* 687 */ +/* 706 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Get the shortest distance from a Line to the given Point. + * + * @function Phaser.Geom.Line.GetShortestDistance + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the distance from. + * @param {(Phaser.Geom.Point|object)} point - The point to get the shortest distance to. + * + * @return {number} The shortest distance from the line to the point. + */ +var GetShortestDistance = function (line, point) +{ + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return false; + } + + var s = (((y1 - point.y) * (x2 - x1)) - ((x1 - point.x) * (y2 - y1))) / L2; + + return Math.abs(s) * Math.sqrt(L2); +}; + +module.exports = GetShortestDistance; + + +/***/ }), +/* 707 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(68); +var MATH_CONST = __webpack_require__(20); +var Angle = __webpack_require__(73); var Point = __webpack_require__(6); /** @@ -126511,12 +133492,67 @@ module.exports = GetNormal; /***/ }), -/* 688 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @author Florian Mertens + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Point = __webpack_require__(6); + +/** + * Get the nearest point on a line perpendicular to the given point. + * + * @function Phaser.Geom.Line.GetNearestPoint + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the nearest point on. + * @param {(Phaser.Geom.Point|object)} point - The point to get the nearest point to. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the nearest point on the line. + * + * @return {(Phaser.Geom.Point|object)} The nearest point on the line. + */ +var GetNearestPoint = function (line, point, out) +{ + if (out === undefined) { out = new Point(); } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + + if (L2 === 0) + { + return out; + } + + var r = (((point.x - x1) * (x2 - x1)) + ((point.y - y1) * (y2 - y1))) / L2; + + out.x = x1 + (r * (x2 - x1)); + out.y = y1 + (r * (y2 - y1)); + + return out; +}; + +module.exports = GetNearestPoint; + + +/***/ }), +/* 709 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126549,12 +133585,70 @@ module.exports = GetMidPoint; /***/ }), -/* 689 */ +/* 710 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Length = __webpack_require__(58); + +/** + * Extends the start and end points of a Line by the given amounts. + * + * The amounts can be positive or negative. Positive points will increase the length of the line, + * while negative ones will decrease it. + * + * If no `right` value is provided it will extend the length of the line equally in both directions. + * + * Pass a value of zero to leave the start or end point unchanged. + * + * @function Phaser.Geom.Line.Extend + * @since 3.16.0 + * + * @param {Phaser.Geom.Line} line - The line instance to extend. + * @param {number} left - The amount to extend the start of the line by. + * @param {number} [right] - The amount to extend the end of the line by. If not given it will be set to the `left` value. + * + * @return {Phaser.Geom.Line} The modified Line instance. + */ +var Extend = function (line, left, right) +{ + if (right === undefined) { right = left; } + + var length = Length(line); + + var slopX = line.x2 - line.x1; + var slopY = line.y2 - line.y1; + + if (left) + { + line.x1 = line.x1 - slopX / length * left; + line.y1 = line.y1 - slopY / length * left; + } + + if (right) + { + line.x2 = line.x2 + slopX / length * right; + line.y2 = line.y2 + slopY / length * right; + } + + return line; +}; + +module.exports = Extend; + + +/***/ }), +/* 711 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126583,12 +133677,12 @@ module.exports = Equals; /***/ }), -/* 690 */ +/* 712 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126614,16 +133708,16 @@ module.exports = CopyFrom; /***/ }), -/* 691 */ +/* 713 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(54); +var Line = __webpack_require__(59); /** * Clone the given line. @@ -126644,12 +133738,12 @@ module.exports = Clone; /***/ }), -/* 692 */ +/* 714 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -126684,70 +133778,75 @@ module.exports = CenterOn; /***/ }), -/* 693 */ +/* 715 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(54); +var Line = __webpack_require__(59); -Line.Angle = __webpack_require__(68); -Line.BresenhamPoints = __webpack_require__(385); -Line.CenterOn = __webpack_require__(692); -Line.Clone = __webpack_require__(691); -Line.CopyFrom = __webpack_require__(690); -Line.Equals = __webpack_require__(689); -Line.GetMidPoint = __webpack_require__(688); -Line.GetNormal = __webpack_require__(687); -Line.GetPoint = __webpack_require__(397); -Line.GetPoints = __webpack_require__(189); -Line.Height = __webpack_require__(686); -Line.Length = __webpack_require__(65); -Line.NormalAngle = __webpack_require__(268); -Line.NormalX = __webpack_require__(685); -Line.NormalY = __webpack_require__(684); -Line.Offset = __webpack_require__(683); -Line.PerpSlope = __webpack_require__(682); -Line.Random = __webpack_require__(188); -Line.ReflectAngle = __webpack_require__(681); -Line.Rotate = __webpack_require__(680); -Line.RotateAroundPoint = __webpack_require__(679); -Line.RotateAroundXY = __webpack_require__(146); -Line.SetToAngle = __webpack_require__(678); -Line.Slope = __webpack_require__(677); -Line.Width = __webpack_require__(676); +Line.Angle = __webpack_require__(73); +Line.BresenhamPoints = __webpack_require__(416); +Line.CenterOn = __webpack_require__(714); +Line.Clone = __webpack_require__(713); +Line.CopyFrom = __webpack_require__(712); +Line.Equals = __webpack_require__(711); +Line.Extend = __webpack_require__(710); +Line.GetMidPoint = __webpack_require__(709); +Line.GetNearestPoint = __webpack_require__(708); +Line.GetNormal = __webpack_require__(707); +Line.GetPoint = __webpack_require__(429); +Line.GetPoints = __webpack_require__(203); +Line.GetShortestDistance = __webpack_require__(706); +Line.Height = __webpack_require__(705); +Line.Length = __webpack_require__(58); +Line.NormalAngle = __webpack_require__(273); +Line.NormalX = __webpack_require__(704); +Line.NormalY = __webpack_require__(703); +Line.Offset = __webpack_require__(702); +Line.PerpSlope = __webpack_require__(701); +Line.Random = __webpack_require__(202); +Line.ReflectAngle = __webpack_require__(700); +Line.Rotate = __webpack_require__(699); +Line.RotateAroundPoint = __webpack_require__(698); +Line.RotateAroundXY = __webpack_require__(156); +Line.SetToAngle = __webpack_require__(697); +Line.Slope = __webpack_require__(696); +Line.Width = __webpack_require__(695); module.exports = Line; /***/ }), -/* 694 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ContainsArray = __webpack_require__(147); -var Decompose = __webpack_require__(269); -var LineToLine = __webpack_require__(107); +var ContainsArray = __webpack_require__(157); +var Decompose = __webpack_require__(274); +var LineToLine = __webpack_require__(115); /** - * [description] + * Checks if two Triangles intersect. + * + * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". * * @function Phaser.Geom.Intersects.TriangleToTriangle * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangleA - [description] - * @param {Phaser.Geom.Triangle} triangleB - [description] + * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. + * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Triangles intersect, otherwise `false`. */ var TriangleToTriangle = function (triangleA, triangleB) { @@ -126813,17 +133912,17 @@ module.exports = TriangleToTriangle; /***/ }), -/* 695 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(69); -var LineToLine = __webpack_require__(107); +var Contains = __webpack_require__(74); +var LineToLine = __webpack_require__(115); /** * Checks if a Triangle and a Line intersect. @@ -126869,28 +133968,30 @@ module.exports = TriangleToLine; /***/ }), -/* 696 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToCircle = __webpack_require__(272); -var Contains = __webpack_require__(69); +var LineToCircle = __webpack_require__(277); +var Contains = __webpack_require__(74); /** - * [description] + * Checks if a Triangle and a Circle intersect. + * + * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. * * @function Phaser.Geom.Intersects.TriangleToCircle * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Circle} circle - [description] + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. + * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Triangle and the `Circle` intersect, otherwise `false`. */ var TriangleToCircle = function (triangle, circle) { @@ -126932,29 +134033,29 @@ module.exports = TriangleToCircle; /***/ }), -/* 697 */ +/* 719 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Check if rectangle intersects with values. * * @function Phaser.Geom.Intersects.RectangleToValues * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} left - [description] - * @param {number} right - [description] - * @param {number} top - [description] - * @param {number} bottom - [description] - * @param {number} [tolerance=0] - [description] + * @param {Phaser.Geom.Rectangle} rect - The rectangle object + * @param {number} left - The x coordinate of the left of the Rectangle. + * @param {number} right - The x coordinate of the right of the Rectangle. + * @param {number} top - The y coordinate of the top of the Rectangle. + * @param {number} bottom - The y coordinate of the bottom of the Rectangle. + * @param {number} [tolerance=0] - Tolerance allowed in the calculation, expressed in pixels. * - * @return {boolean} [description] + * @return {boolean} Returns true if there is an intersection. */ var RectangleToValues = function (rect, left, right, top, bottom, tolerance) { @@ -126972,19 +134073,19 @@ module.exports = RectangleToValues; /***/ }), -/* 698 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToLine = __webpack_require__(107); -var Contains = __webpack_require__(39); -var ContainsArray = __webpack_require__(147); -var Decompose = __webpack_require__(270); +var LineToLine = __webpack_require__(115); +var Contains = __webpack_require__(42); +var ContainsArray = __webpack_require__(157); +var Decompose = __webpack_require__(275); /** * Checks for intersection between Rectangle shape and Triangle shape. @@ -127065,27 +134166,27 @@ module.exports = RectangleToTriangle; /***/ }), -/* 699 */ +/* 721 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PointToLine = __webpack_require__(271); +var PointToLine = __webpack_require__(276); /** - * [description] + * Checks if a Point is located on the given line segment. * * @function Phaser.Geom.Intersects.PointToLineSegment * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - [description] - * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Point} point - The Point to check for intersection. + * @param {Phaser.Geom.Line} line - The line segment to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Point is on the given line segment, otherwise `false`. */ var PointToLineSegment = function (point, line) { @@ -127106,12 +134207,12 @@ module.exports = PointToLineSegment; /***/ }), -/* 700 */ +/* 722 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127129,10 +134230,10 @@ module.exports = PointToLineSegment; * @function Phaser.Geom.Intersects.LineToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Line} line - [description] - * @param {(Phaser.Geom.Rectangle|object)} rect - [description] + * @param {Phaser.Geom.Line} line - The Line to check for intersection. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. * - * @return {boolean} [description] + * @return {boolean} `true` if the Line and the Rectangle intersect, `false` otherwise. */ var LineToRectangle = function (line, rect) { @@ -127207,17 +134308,17 @@ module.exports = LineToRectangle; /***/ }), -/* 701 */ +/* 723 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); -var RectangleToRectangle = __webpack_require__(148); +var Rectangle = __webpack_require__(10); +var RectangleToRectangle = __webpack_require__(158); /** * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. @@ -127256,25 +134357,25 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 702 */ +/* 724 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Checks for intersection between a circle and a rectangle. * * @function Phaser.Geom.Intersects.CircleToRectangle * @since 3.0.0 * - * @param {Phaser.Geom.Circle} circle - [description] - * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Circle} circle - The circle to be checked. + * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. * - * @return {boolean} [description] + * @return {boolean} `true` if the two objects intersect, otherwise `false`. */ var CircleToRectangle = function (circle, rect) { @@ -127310,16 +134411,16 @@ module.exports = CircleToRectangle; /***/ }), -/* 703 */ +/* 725 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DistanceBetween = __webpack_require__(52); +var DistanceBetween = __webpack_require__(56); /** * Checks if two Circles intersect. @@ -127341,12 +134442,12 @@ module.exports = CircleToCircle; /***/ }), -/* 704 */ +/* 726 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127375,12 +134476,12 @@ module.exports = OffsetPoint; /***/ }), -/* 705 */ +/* 727 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127410,16 +134511,16 @@ module.exports = Offset; /***/ }), -/* 706 */ +/* 728 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Returns the bounds of the Ellipse object. @@ -127450,12 +134551,12 @@ module.exports = GetBounds; /***/ }), -/* 707 */ +/* 729 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127485,12 +134586,12 @@ module.exports = Equals; /***/ }), -/* 708 */ +/* 730 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127517,16 +134618,16 @@ module.exports = CopyFrom; /***/ }), -/* 709 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(89); +var Contains = __webpack_require__(95); /** * Check to see if the Ellipse contains all four points of the given Rectangle object. @@ -127553,16 +134654,16 @@ module.exports = ContainsRect; /***/ }), -/* 710 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(89); +var Contains = __webpack_require__(95); /** * Check to see if the Ellipse contains the given Point object. @@ -127584,16 +134685,16 @@ module.exports = ContainsPoint; /***/ }), -/* 711 */ +/* 733 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(90); +var Ellipse = __webpack_require__(96); /** * Creates a new Ellipse instance based on the values contained in the given source. @@ -127614,12 +134715,12 @@ module.exports = Clone; /***/ }), -/* 712 */ +/* 734 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127648,43 +134749,43 @@ module.exports = Area; /***/ }), -/* 713 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(90); +var Ellipse = __webpack_require__(96); -Ellipse.Area = __webpack_require__(712); -Ellipse.Circumference = __webpack_require__(306); -Ellipse.CircumferencePoint = __webpack_require__(156); -Ellipse.Clone = __webpack_require__(711); -Ellipse.Contains = __webpack_require__(89); -Ellipse.ContainsPoint = __webpack_require__(710); -Ellipse.ContainsRect = __webpack_require__(709); -Ellipse.CopyFrom = __webpack_require__(708); -Ellipse.Equals = __webpack_require__(707); -Ellipse.GetBounds = __webpack_require__(706); -Ellipse.GetPoint = __webpack_require__(308); -Ellipse.GetPoints = __webpack_require__(307); -Ellipse.Offset = __webpack_require__(705); -Ellipse.OffsetPoint = __webpack_require__(704); -Ellipse.Random = __webpack_require__(185); +Ellipse.Area = __webpack_require__(734); +Ellipse.Circumference = __webpack_require__(309); +Ellipse.CircumferencePoint = __webpack_require__(166); +Ellipse.Clone = __webpack_require__(733); +Ellipse.Contains = __webpack_require__(95); +Ellipse.ContainsPoint = __webpack_require__(732); +Ellipse.ContainsRect = __webpack_require__(731); +Ellipse.CopyFrom = __webpack_require__(730); +Ellipse.Equals = __webpack_require__(729); +Ellipse.GetBounds = __webpack_require__(728); +Ellipse.GetPoint = __webpack_require__(311); +Ellipse.GetPoints = __webpack_require__(310); +Ellipse.Offset = __webpack_require__(727); +Ellipse.OffsetPoint = __webpack_require__(726); +Ellipse.Random = __webpack_require__(199); module.exports = Ellipse; /***/ }), -/* 714 */ +/* 736 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127713,12 +134814,12 @@ module.exports = OffsetPoint; /***/ }), -/* 715 */ +/* 737 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127748,16 +134849,16 @@ module.exports = Offset; /***/ }), -/* 716 */ +/* 738 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); +var Rectangle = __webpack_require__(10); /** * Returns the bounds of the Circle object. @@ -127788,12 +134889,12 @@ module.exports = GetBounds; /***/ }), -/* 717 */ +/* 739 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127822,12 +134923,12 @@ module.exports = Equals; /***/ }), -/* 718 */ +/* 740 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127854,16 +134955,16 @@ module.exports = CopyFrom; /***/ }), -/* 719 */ +/* 741 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(40); +var Contains = __webpack_require__(43); /** * Check to see if the Circle contains all four points of the given Rectangle object. @@ -127890,16 +134991,16 @@ module.exports = ContainsRect; /***/ }), -/* 720 */ +/* 742 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(40); +var Contains = __webpack_require__(43); /** * Check to see if the Circle contains the given Point object. @@ -127921,16 +135022,16 @@ module.exports = ContainsPoint; /***/ }), -/* 721 */ +/* 743 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); +var Circle = __webpack_require__(77); /** * Creates a new Circle instance based on the values contained in the given source. @@ -127951,12 +135052,12 @@ module.exports = Clone; /***/ }), -/* 722 */ +/* 744 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -127979,49 +135080,50 @@ module.exports = Area; /***/ }), -/* 723 */ +/* 745 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(71); +var Circle = __webpack_require__(77); -Circle.Area = __webpack_require__(722); -Circle.Circumference = __webpack_require__(402); -Circle.CircumferencePoint = __webpack_require__(192); -Circle.Clone = __webpack_require__(721); -Circle.Contains = __webpack_require__(40); -Circle.ContainsPoint = __webpack_require__(720); -Circle.ContainsRect = __webpack_require__(719); -Circle.CopyFrom = __webpack_require__(718); -Circle.Equals = __webpack_require__(717); -Circle.GetBounds = __webpack_require__(716); -Circle.GetPoint = __webpack_require__(405); -Circle.GetPoints = __webpack_require__(403); -Circle.Offset = __webpack_require__(715); -Circle.OffsetPoint = __webpack_require__(714); -Circle.Random = __webpack_require__(191); +Circle.Area = __webpack_require__(744); +Circle.Circumference = __webpack_require__(436); +Circle.CircumferencePoint = __webpack_require__(207); +Circle.Clone = __webpack_require__(743); +Circle.Contains = __webpack_require__(43); +Circle.ContainsPoint = __webpack_require__(742); +Circle.ContainsRect = __webpack_require__(741); +Circle.CopyFrom = __webpack_require__(740); +Circle.Equals = __webpack_require__(739); +Circle.GetBounds = __webpack_require__(738); +Circle.GetPoint = __webpack_require__(438); +Circle.GetPoints = __webpack_require__(437); +Circle.Offset = __webpack_require__(737); +Circle.OffsetPoint = __webpack_require__(736); +Circle.Random = __webpack_require__(206); module.exports = Circle; /***/ }), -/* 724 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(275); -var PluginCache = __webpack_require__(15); +var LightsManager = __webpack_require__(280); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -128081,7 +135183,7 @@ var LightsPlugin = new Class({ if (!scene.sys.settings.isBooted) { - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); } LightsManager.call(this); @@ -128097,8 +135199,8 @@ var LightsPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); + eventEmitter.on(SceneEvents.SHUTDOWN, this.shutdown, this); + eventEmitter.on(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -128125,19 +135227,19 @@ module.exports = LightsPlugin; /***/ }), -/* 725 */ +/* 747 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Quad = __webpack_require__(149); +var Quad = __webpack_require__(159); /** * Creates a new Quad Game Object and returns it. @@ -128175,20 +135277,20 @@ GameObjectCreator.register('quad', function (config, addToScene) /***/ }), -/* 726 */ +/* 748 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); var GetValue = __webpack_require__(4); -var Mesh = __webpack_require__(108); +var Mesh = __webpack_require__(116); /** * Creates a new Mesh Game Object and returns it. @@ -128230,16 +135332,16 @@ GameObjectCreator.register('mesh', function (config, addToScene) /***/ }), -/* 727 */ +/* 749 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Quad = __webpack_require__(149); +var Quad = __webpack_require__(159); var GameObjectFactory = __webpack_require__(5); /** @@ -128276,16 +135378,16 @@ if (true) /***/ }), -/* 728 */ +/* 750 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Mesh = __webpack_require__(108); +var Mesh = __webpack_require__(116); var GameObjectFactory = __webpack_require__(5); /** @@ -128326,12 +135428,12 @@ if (true) /***/ }), -/* 729 */ +/* 751 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128355,16 +135457,16 @@ module.exports = MeshCanvasRenderer; /***/ }), -/* 730 */ +/* 752 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -128427,7 +135529,7 @@ var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera var meshVerticesLength = vertices.length; var vertexCount = Math.floor(meshVerticesLength * 0.5); - if (pipeline.vertexCount + vertexCount >= pipeline.vertexCapacity) + if (pipeline.vertexCount + vertexCount > pipeline.vertexCapacity) { pipeline.flush(); } @@ -128452,8 +135554,8 @@ var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (camera.roundPixels) { - tx |= 0; - ty |= 0; + tx = Math.round(tx); + ty = Math.round(ty); } vertexViewF32[++vertexOffset] = tx; @@ -128473,12 +135575,12 @@ module.exports = MeshWebGLRenderer; /***/ }), -/* 731 */ +/* 753 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -128487,12 +135589,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(730); + renderWebGL = __webpack_require__(752); } if (true) { - renderCanvas = __webpack_require__(729); + renderCanvas = __webpack_require__(751); } module.exports = { @@ -128504,18 +135606,18 @@ module.exports = { /***/ }), -/* 732 */ +/* 754 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Zone = __webpack_require__(125); +var Zone = __webpack_require__(137); /** * Creates a new Zone Game Object and returns it. @@ -128543,19 +135645,19 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 733 */ +/* 755 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var TileSprite = __webpack_require__(152); +var TileSprite = __webpack_require__(162); /** * @typedef {object} TileSprite @@ -128609,19 +135711,19 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) /***/ }), -/* 734 */ +/* 756 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Text = __webpack_require__(153); +var Text = __webpack_require__(163); /** * Creates a new Text Game Object and returns it. @@ -128696,18 +135798,18 @@ GameObjectCreator.register('text', function (config, addToScene) /***/ }), -/* 735 */ +/* 757 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(109); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BitmapText = __webpack_require__(117); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); var GetValue = __webpack_require__(4); @@ -128749,20 +135851,20 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) /***/ }), -/* 736 */ +/* 758 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var BuildGameObjectAnimation = __webpack_require__(311); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var BuildGameObjectAnimation = __webpack_require__(315); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Sprite = __webpack_require__(61); +var Sprite = __webpack_require__(67); /** * @typedef {object} SpriteConfig @@ -128810,19 +135912,19 @@ GameObjectCreator.register('sprite', function (config, addToScene) /***/ }), -/* 737 */ +/* 759 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var RenderTexture = __webpack_require__(154); +var RenderTexture = __webpack_require__(164); /** * @typedef {object} RenderTextureConfig @@ -128869,19 +135971,19 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) /***/ }), -/* 738 */ +/* 760 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); var GetFastValue = __webpack_require__(2); -var ParticleEmitterManager = __webpack_require__(155); +var ParticleEmitterManager = __webpack_require__(165); /** * Creates a new Particle Emitter Manager Game Object and returns it. @@ -128926,19 +136028,19 @@ GameObjectCreator.register('particles', function (config, addToScene) /***/ }), -/* 739 */ +/* 761 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); -var Image = __webpack_require__(87); +var Image = __webpack_require__(93); /** * Creates a new Image Game Object and returns it. @@ -128976,17 +136078,17 @@ GameObjectCreator.register('image', function (config, addToScene) /***/ }), -/* 740 */ +/* 762 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); -var Group = __webpack_require__(88); +var GameObjectCreator = __webpack_require__(14); +var Group = __webpack_require__(94); /** * Creates a new Group Game Object and returns it. @@ -128996,7 +136098,7 @@ var Group = __webpack_require__(88); * @method Phaser.GameObjects.GameObjectCreator#group * @since 3.0.0 * - * @param {GroupConfig} config - The configuration object this Game Object will use to create itself. + * @param {GroupConfig|GroupCreateConfig} config - The configuration object this Game Object will use to create itself. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ @@ -129009,17 +136111,17 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 741 */ +/* 763 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObjectCreator = __webpack_require__(13); -var Graphics = __webpack_require__(158); +var GameObjectCreator = __webpack_require__(14); +var Graphics = __webpack_require__(168); /** * Creates a new Graphics Game Object and returns it. @@ -129057,18 +136159,18 @@ GameObjectCreator.register('graphics', function (config, addToScene) /***/ }), -/* 742 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(159); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var BitmapText = __webpack_require__(169); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); /** @@ -129117,19 +136219,19 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) /***/ }), -/* 743 */ +/* 765 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var Container = __webpack_require__(160); -var GameObjectCreator = __webpack_require__(13); +var BuildGameObject = __webpack_require__(30); +var Container = __webpack_require__(170); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); /** @@ -129166,18 +136268,18 @@ GameObjectCreator.register('container', function (config, addToScene) /***/ }), -/* 744 */ +/* 766 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Blitter = __webpack_require__(161); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(13); +var Blitter = __webpack_require__(171); +var BuildGameObject = __webpack_require__(30); +var GameObjectCreator = __webpack_require__(14); var GetAdvancedValue = __webpack_require__(12); /** @@ -129216,17 +136318,17 @@ GameObjectCreator.register('blitter', function (config, addToScene) /***/ }), -/* 745 */ +/* 767 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Triangle = __webpack_require__(279); +var Triangle = __webpack_require__(284); /** * Creates a new Triangle Shape Game Object and adds it to the Scene. @@ -129267,16 +136369,16 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f /***/ }), -/* 746 */ +/* 768 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Star = __webpack_require__(280); +var Star = __webpack_require__(285); var GameObjectFactory = __webpack_require__(5); /** @@ -129319,17 +136421,17 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad /***/ }), -/* 747 */ +/* 769 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Rectangle = __webpack_require__(281); +var Rectangle = __webpack_require__(286); /** * Creates a new Rectangle Shape Game Object and adds it to the Scene. @@ -129364,17 +136466,17 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor /***/ }), -/* 748 */ +/* 770 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Polygon = __webpack_require__(286); +var Polygon = __webpack_require__(291); /** * Creates a new Polygon Shape Game Object and adds it to the Scene. @@ -129417,17 +136519,17 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp /***/ }), -/* 749 */ +/* 771 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Line = __webpack_require__(287); +var Line = __webpack_require__(292); /** * Creates a new Line Shape Game Object and adds it to the Scene. @@ -129468,17 +136570,17 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, /***/ }), -/* 750 */ +/* 772 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var IsoTriangle = __webpack_require__(288); +var IsoTriangle = __webpack_require__(293); /** * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. @@ -129521,17 +136623,17 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed /***/ }), -/* 751 */ +/* 773 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var IsoBox = __webpack_require__(289); +var IsoBox = __webpack_require__(294); /** * Creates a new IsoBox Shape Game Object and adds it to the Scene. @@ -129572,17 +136674,17 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill /***/ }), -/* 752 */ +/* 774 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Grid = __webpack_require__(290); +var Grid = __webpack_require__(295); /** * Creates a new Grid Shape Game Object and adds it to the Scene. @@ -129627,16 +136729,16 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel /***/ }), -/* 753 */ +/* 775 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ellipse = __webpack_require__(291); +var Ellipse = __webpack_require__(296); var GameObjectFactory = __webpack_require__(5); /** @@ -129679,17 +136781,17 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, /***/ }), -/* 754 */ +/* 776 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Curve = __webpack_require__(292); +var Curve = __webpack_require__(297); /** * Creates a new Curve Shape Game Object and adds it to the Scene. @@ -129729,16 +136831,16 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) /***/ }), -/* 755 */ +/* 777 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arc = __webpack_require__(293); +var Arc = __webpack_require__(298); var GameObjectFactory = __webpack_require__(5); /** @@ -129802,16 +136904,16 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph /***/ }), -/* 756 */ +/* 778 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Zone = __webpack_require__(125); +var Zone = __webpack_require__(137); var GameObjectFactory = __webpack_require__(5); /** @@ -129844,16 +136946,16 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 757 */ +/* 779 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileSprite = __webpack_require__(152); +var TileSprite = __webpack_require__(162); var GameObjectFactory = __webpack_require__(5); /** @@ -129888,16 +136990,16 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 758 */ +/* 780 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Text = __webpack_require__(153); +var Text = __webpack_require__(163); var GameObjectFactory = __webpack_require__(5); /** @@ -129953,16 +137055,16 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 759 */ +/* 781 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BitmapText = __webpack_require__(109); +var BitmapText = __webpack_require__(117); var GameObjectFactory = __webpack_require__(5); /** @@ -130017,17 +137119,17 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align /***/ }), -/* 760 */ +/* 782 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var Sprite = __webpack_require__(61); +var Sprite = __webpack_require__(67); /** * Creates a new Sprite Game Object and adds it to the Scene. @@ -130064,17 +137166,17 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 761 */ +/* 783 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var RenderTexture = __webpack_require__(154); +var RenderTexture = __webpack_require__(164); /** * Creates a new Render Texture Game Object and adds it to the Scene. @@ -130102,17 +137204,17 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height) /***/ }), -/* 762 */ +/* 784 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var PathFollower = __webpack_require__(296); +var PathFollower = __webpack_require__(300); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -130150,17 +137252,17 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 763 */ +/* 785 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectFactory = __webpack_require__(5); -var ParticleEmitterManager = __webpack_require__(155); +var ParticleEmitterManager = __webpack_require__(165); /** * Creates a new Particle Emitter Manager Game Object and adds it to the Scene. @@ -130196,16 +137298,16 @@ GameObjectFactory.register('particles', function (key, frame, emitters) /***/ }), -/* 764 */ +/* 786 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Image = __webpack_require__(87); +var Image = __webpack_require__(93); var GameObjectFactory = __webpack_require__(5); /** @@ -130238,16 +137340,16 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 765 */ +/* 787 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Group = __webpack_require__(88); +var Group = __webpack_require__(94); var GameObjectFactory = __webpack_require__(5); /** @@ -130259,7 +137361,7 @@ var GameObjectFactory = __webpack_require__(5); * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument. - * @param {GroupConfig} [config] - A Group Configuration object. + * @param {GroupConfig|GroupCreateConfig} [config] - A Group Configuration object. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ @@ -130270,16 +137372,16 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 766 */ +/* 788 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Graphics = __webpack_require__(158); +var Graphics = __webpack_require__(168); var GameObjectFactory = __webpack_require__(5); /** @@ -130309,16 +137411,58 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 767 */ +/* 789 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DynamicBitmapText = __webpack_require__(159); +var Extern = __webpack_require__(312); +var GameObjectFactory = __webpack_require__(5); + +/** + * Creates a new Extern Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Extern Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#extern + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Extern} The Game Object that was created. + */ +GameObjectFactory.register('extern', function () +{ + var extern = new Extern(this.scene); + + this.displayList.add(extern); + this.updateList.add(extern); + + return extern; +}); + +// 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 + + +/***/ }), +/* 790 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var DynamicBitmapText = __webpack_require__(169); var GameObjectFactory = __webpack_require__(5); /** @@ -130378,17 +137522,17 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 768 */ +/* 791 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Container = __webpack_require__(160); +var Container = __webpack_require__(170); var GameObjectFactory = __webpack_require__(5); /** @@ -130412,16 +137556,16 @@ GameObjectFactory.register('container', function (x, y, children) /***/ }), -/* 769 */ +/* 792 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Blitter = __webpack_require__(161); +var Blitter = __webpack_require__(171); var GameObjectFactory = __webpack_require__(5); /** @@ -130454,18 +137598,18 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) /***/ }), -/* 770 */ +/* 793 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -130519,6 +137663,9 @@ var TriangleCanvasRenderer = function (renderer, src, interpolationPercentage, c ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -130526,17 +137673,17 @@ module.exports = TriangleCanvasRenderer; /***/ }), -/* 771 */ +/* 794 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StrokePathWebGL = __webpack_require__(60); -var Utils = __webpack_require__(10); +var StrokePathWebGL = __webpack_require__(66); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -130629,12 +137776,12 @@ module.exports = TriangleWebGLRenderer; /***/ }), -/* 772 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130643,12 +137790,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(771); + renderWebGL = __webpack_require__(794); } if (true) { - renderCanvas = __webpack_require__(770); + renderCanvas = __webpack_require__(793); } module.exports = { @@ -130660,18 +137807,18 @@ module.exports = { /***/ }), -/* 773 */ +/* 796 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -130735,6 +137882,9 @@ var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -130742,17 +137892,17 @@ module.exports = StarCanvasRenderer; /***/ }), -/* 774 */ +/* 797 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -130820,12 +137970,12 @@ module.exports = StarWebGLRenderer; /***/ }), -/* 775 */ +/* 798 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -130834,12 +137984,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(774); + renderWebGL = __webpack_require__(797); } if (true) { - renderCanvas = __webpack_require__(773); + renderCanvas = __webpack_require__(796); } module.exports = { @@ -130851,18 +138001,18 @@ module.exports = { /***/ }), -/* 776 */ +/* 799 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -130915,6 +138065,9 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -130922,17 +138075,17 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 777 */ +/* 800 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var StrokePathWebGL = __webpack_require__(60); -var Utils = __webpack_require__(10); +var StrokePathWebGL = __webpack_require__(66); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -130993,7 +138146,9 @@ var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, c fillTint.TR = fillTintColor; fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; - + + pipeline.setTexture2D(); + pipeline.batchFillRect( -dx, -dy, @@ -131012,12 +138167,12 @@ module.exports = RectangleWebGLRenderer; /***/ }), -/* 778 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131026,12 +138181,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(777); + renderWebGL = __webpack_require__(800); } if (true) { - renderCanvas = __webpack_require__(776); + renderCanvas = __webpack_require__(799); } module.exports = { @@ -131043,18 +138198,18 @@ module.exports = { /***/ }), -/* 779 */ +/* 802 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -131118,6 +138273,9 @@ var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -131125,17 +138283,17 @@ module.exports = PolygonCanvasRenderer; /***/ }), -/* 780 */ +/* 803 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -131203,12 +138361,12 @@ module.exports = PolygonWebGLRenderer; /***/ }), -/* 781 */ +/* 804 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131217,12 +138375,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(780); + renderWebGL = __webpack_require__(803); } if (true) { - renderCanvas = __webpack_require__(779); + renderCanvas = __webpack_require__(802); } module.exports = { @@ -131234,17 +138392,17 @@ module.exports = { /***/ }), -/* 782 */ +/* 805 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -131281,6 +138439,9 @@ var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -131288,16 +138449,16 @@ module.exports = LineCanvasRenderer; /***/ }), -/* 783 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -131381,12 +138542,12 @@ module.exports = LineWebGLRenderer; /***/ }), -/* 784 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131395,12 +138556,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(783); + renderWebGL = __webpack_require__(806); } if (true) { - renderCanvas = __webpack_require__(782); + renderCanvas = __webpack_require__(805); } module.exports = { @@ -131412,17 +138573,17 @@ module.exports = { /***/ }), -/* 785 */ +/* 808 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -131516,6 +138677,9 @@ var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage ctx.fill(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -131523,16 +138687,16 @@ module.exports = IsoTriangleCanvasRenderer; /***/ }), -/* 786 */ +/* 809 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -131700,12 +138864,12 @@ module.exports = IsoTriangleWebGLRenderer; /***/ }), -/* 787 */ +/* 810 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -131714,12 +138878,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(786); + renderWebGL = __webpack_require__(809); } if (true) { - renderCanvas = __webpack_require__(785); + renderCanvas = __webpack_require__(808); } module.exports = { @@ -131731,17 +138895,17 @@ module.exports = { /***/ }), -/* 788 */ +/* 811 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -131822,6 +138986,9 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam ctx.fill(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -131829,16 +138996,16 @@ module.exports = IsoBoxCanvasRenderer; /***/ }), -/* 789 */ +/* 812 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -131987,12 +139154,12 @@ module.exports = IsoBoxWebGLRenderer; /***/ }), -/* 790 */ +/* 813 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132001,12 +139168,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(789); + renderWebGL = __webpack_require__(812); } if (true) { - renderCanvas = __webpack_require__(788); + renderCanvas = __webpack_require__(811); } module.exports = { @@ -132018,18 +139185,18 @@ module.exports = { /***/ }), -/* 791 */ +/* 814 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -132082,6 +139249,9 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -132089,16 +139259,16 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 792 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -132315,12 +139485,12 @@ module.exports = GridWebGLRenderer; /***/ }), -/* 793 */ +/* 816 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132329,12 +139499,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(792); + renderWebGL = __webpack_require__(815); } if (true) { - renderCanvas = __webpack_require__(791); + renderCanvas = __webpack_require__(814); } module.exports = { @@ -132346,18 +139516,18 @@ module.exports = { /***/ }), -/* 794 */ +/* 817 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -132421,6 +139591,9 @@ var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -132428,17 +139601,17 @@ module.exports = EllipseCanvasRenderer; /***/ }), -/* 795 */ +/* 818 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -132506,12 +139679,12 @@ module.exports = EllipseWebGLRenderer; /***/ }), -/* 796 */ +/* 819 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132520,12 +139693,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(795); + renderWebGL = __webpack_require__(818); } if (true) { - renderCanvas = __webpack_require__(794); + renderCanvas = __webpack_require__(817); } module.exports = { @@ -132537,18 +139710,18 @@ module.exports = { /***/ }), -/* 797 */ +/* 820 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -132615,6 +139788,9 @@ var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, came ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -132622,17 +139798,17 @@ module.exports = CurveCanvasRenderer; /***/ }), -/* 798 */ +/* 821 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -132700,12 +139876,12 @@ module.exports = CurveWebGLRenderer; /***/ }), -/* 799 */ +/* 822 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132714,12 +139890,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(798); + renderWebGL = __webpack_require__(821); } if (true) { - renderCanvas = __webpack_require__(797); + renderCanvas = __webpack_require__(820); } module.exports = { @@ -132731,19 +139907,19 @@ module.exports = { /***/ }), -/* 800 */ +/* 823 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DegToRad = __webpack_require__(31); -var FillStyleCanvas = __webpack_require__(30); -var LineStyleCanvas = __webpack_require__(36); -var SetTransform = __webpack_require__(22); +var DegToRad = __webpack_require__(34); +var FillStyleCanvas = __webpack_require__(33); +var LineStyleCanvas = __webpack_require__(39); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -132797,6 +139973,9 @@ var ArcCanvasRenderer = function (renderer, src, interpolationPercentage, camera ctx.stroke(); } + + // Restore the context saved in SetTransform + ctx.restore(); } }; @@ -132804,17 +139983,17 @@ module.exports = ArcCanvasRenderer; /***/ }), -/* 801 */ +/* 824 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var FillPathWebGL = __webpack_require__(82); -var StrokePathWebGL = __webpack_require__(60); +var FillPathWebGL = __webpack_require__(88); +var StrokePathWebGL = __webpack_require__(66); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -132882,12 +140061,12 @@ module.exports = ArcWebGLRenderer; /***/ }), -/* 802 */ +/* 825 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132896,12 +140075,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(801); + renderWebGL = __webpack_require__(824); } if (true) { - renderCanvas = __webpack_require__(800); + renderCanvas = __webpack_require__(823); } module.exports = { @@ -132913,12 +140092,12 @@ module.exports = { /***/ }), -/* 803 */ +/* 826 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -132948,16 +140127,16 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 804 */ +/* 827 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -133008,12 +140187,12 @@ module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 805 */ +/* 828 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133022,12 +140201,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(804); + renderWebGL = __webpack_require__(827); } if (true) { - renderCanvas = __webpack_require__(803); + renderCanvas = __webpack_require__(826); } module.exports = { @@ -133039,12 +140218,12 @@ module.exports = { /***/ }), -/* 806 */ +/* 829 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -133056,7 +140235,7 @@ var CanvasPool = __webpack_require__(24); * @function Phaser.GameObjects.Text.MeasureText * @since 3.0.0 * - * @param {Phaser.GameObjects.Text.TextStyle} textStyle - The TextStyle object to measure. + * @param {Phaser.GameObjects.TextStyle} textStyle - The TextStyle object to measure. * * @return {object} An object containing the ascent, descent and fontSize of the TextStyle. */ @@ -133174,19 +140353,19 @@ module.exports = MeasureText; /***/ }), -/* 807 */ +/* 830 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(12); var GetValue = __webpack_require__(4); -var MeasureText = __webpack_require__(806); +var MeasureText = __webpack_require__(829); // Key: [ Object Key, Default Value ] @@ -133242,10 +140421,14 @@ var propertyMap = { /** * @classdesc - * Style settings for a Text object. + * A TextStyle class manages all of the style settings for a Text object. + * + * Text Game Objects create a TextStyle instance automatically, which is + * accessed via the `Text.style` property. You do not normally need to + * instantiate one yourself. * * @class TextStyle - * @memberof Phaser.GameObjects.Text + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -133261,7 +140444,7 @@ var TextStyle = new Class({ /** * The Text object that this TextStyle is styling. * - * @name Phaser.GameObjects.Text.TextStyle#parent + * @name Phaser.GameObjects.TextStyle#parent * @type {Phaser.GameObjects.Text} * @since 3.0.0 */ @@ -133270,7 +140453,7 @@ var TextStyle = new Class({ /** * The font family. * - * @name Phaser.GameObjects.Text.TextStyle#fontFamily + * @name Phaser.GameObjects.TextStyle#fontFamily * @type {string} * @default 'Courier' * @since 3.0.0 @@ -133280,7 +140463,7 @@ var TextStyle = new Class({ /** * The font size. * - * @name Phaser.GameObjects.Text.TextStyle#fontSize + * @name Phaser.GameObjects.TextStyle#fontSize * @type {string} * @default '16px' * @since 3.0.0 @@ -133290,7 +140473,7 @@ var TextStyle = new Class({ /** * The font style. * - * @name Phaser.GameObjects.Text.TextStyle#fontStyle + * @name Phaser.GameObjects.TextStyle#fontStyle * @type {string} * @since 3.0.0 */ @@ -133299,7 +140482,7 @@ var TextStyle = new Class({ /** * The background color. * - * @name Phaser.GameObjects.Text.TextStyle#backgroundColor + * @name Phaser.GameObjects.TextStyle#backgroundColor * @type {string} * @since 3.0.0 */ @@ -133308,7 +140491,7 @@ var TextStyle = new Class({ /** * The text fill color. * - * @name Phaser.GameObjects.Text.TextStyle#color + * @name Phaser.GameObjects.TextStyle#color * @type {string} * @default '#fff' * @since 3.0.0 @@ -133318,7 +140501,7 @@ var TextStyle = new Class({ /** * The text stroke color. * - * @name Phaser.GameObjects.Text.TextStyle#stroke + * @name Phaser.GameObjects.TextStyle#stroke * @type {string} * @default '#fff' * @since 3.0.0 @@ -133328,7 +140511,7 @@ var TextStyle = new Class({ /** * The text stroke thickness. * - * @name Phaser.GameObjects.Text.TextStyle#strokeThickness + * @name Phaser.GameObjects.TextStyle#strokeThickness * @type {number} * @default 0 * @since 3.0.0 @@ -133338,7 +140521,7 @@ var TextStyle = new Class({ /** * The horizontal shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetX + * @name Phaser.GameObjects.TextStyle#shadowOffsetX * @type {number} * @default 0 * @since 3.0.0 @@ -133348,7 +140531,7 @@ var TextStyle = new Class({ /** * The vertical shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetY + * @name Phaser.GameObjects.TextStyle#shadowOffsetY * @type {number} * @default 0 * @since 3.0.0 @@ -133358,7 +140541,7 @@ var TextStyle = new Class({ /** * The shadow color. * - * @name Phaser.GameObjects.Text.TextStyle#shadowColor + * @name Phaser.GameObjects.TextStyle#shadowColor * @type {string} * @default '#000' * @since 3.0.0 @@ -133368,7 +140551,7 @@ var TextStyle = new Class({ /** * The shadow blur radius. * - * @name Phaser.GameObjects.Text.TextStyle#shadowBlur + * @name Phaser.GameObjects.TextStyle#shadowBlur * @type {number} * @default 0 * @since 3.0.0 @@ -133378,7 +140561,7 @@ var TextStyle = new Class({ /** * Whether shadow stroke is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowStroke + * @name Phaser.GameObjects.TextStyle#shadowStroke * @type {boolean} * @default false * @since 3.0.0 @@ -133388,7 +140571,7 @@ var TextStyle = new Class({ /** * Whether shadow fill is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowFill + * @name Phaser.GameObjects.TextStyle#shadowFill * @type {boolean} * @default false * @since 3.0.0 @@ -133398,7 +140581,7 @@ var TextStyle = new Class({ /** * The text alignment. * - * @name Phaser.GameObjects.Text.TextStyle#align + * @name Phaser.GameObjects.TextStyle#align * @type {string} * @default 'left' * @since 3.0.0 @@ -133408,7 +140591,7 @@ var TextStyle = new Class({ /** * The maximum number of lines to draw. * - * @name Phaser.GameObjects.Text.TextStyle#maxLines + * @name Phaser.GameObjects.TextStyle#maxLines * @type {integer} * @default 0 * @since 3.0.0 @@ -133420,7 +140603,7 @@ var TextStyle = new Class({ * * `0` means no fixed with. * - * @name Phaser.GameObjects.Text.TextStyle#fixedWidth + * @name Phaser.GameObjects.TextStyle#fixedWidth * @type {number} * @default 0 * @since 3.0.0 @@ -133432,7 +140615,7 @@ var TextStyle = new Class({ * * `0` means no fixed height. * - * @name Phaser.GameObjects.Text.TextStyle#fixedHeight + * @name Phaser.GameObjects.TextStyle#fixedHeight * @type {number} * @default 0 * @since 3.0.0 @@ -133443,7 +140626,7 @@ var TextStyle = new Class({ * The resolution the text is rendered to its internal canvas at. * The default is 0, which means it will use the resolution set in the Game Config. * - * @name Phaser.GameObjects.Text.TextStyle#resolution + * @name Phaser.GameObjects.TextStyle#resolution * @type {number} * @default 0 * @since 3.12.0 @@ -133453,7 +140636,7 @@ var TextStyle = new Class({ /** * Whether the text should render right to left. * - * @name Phaser.GameObjects.Text.TextStyle#rtl + * @name Phaser.GameObjects.TextStyle#rtl * @type {boolean} * @default false * @since 3.0.0 @@ -133463,7 +140646,7 @@ var TextStyle = new Class({ /** * The test string to use when measuring the font. * - * @name Phaser.GameObjects.Text.TextStyle#testString + * @name Phaser.GameObjects.TextStyle#testString * @type {string} * @default '|MÉqgy' * @since 3.0.0 @@ -133473,7 +140656,7 @@ var TextStyle = new Class({ /** * The amount of horizontal padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineX + * @name Phaser.GameObjects.TextStyle#baselineX * @type {number} * @default 1.2 * @since 3.3.0 @@ -133483,7 +140666,7 @@ var TextStyle = new Class({ /** * The amount of vertical padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineY + * @name Phaser.GameObjects.TextStyle#baselineY * @type {number} * @default 1.4 * @since 3.3.0 @@ -133493,7 +140676,7 @@ var TextStyle = new Class({ /** * The font style, size and family. * - * @name Phaser.GameObjects.Text.TextStyle#_font + * @name Phaser.GameObjects.TextStyle#_font * @type {string} * @private * @since 3.0.0 @@ -133533,7 +140716,7 @@ var TextStyle = new Class({ * backgroundColor: '#ff00ff' * }); * - * @method Phaser.GameObjects.Text.TextStyle#setStyle + * @method Phaser.GameObjects.TextStyle#setStyle * @since 3.0.0 * * @param {object} style - The style settings to set. @@ -133571,15 +140754,13 @@ var TextStyle = new Class({ // Allow for 'font' override var font = GetValue(style, 'font', null); - if (font === null) + if (font !== null) { - this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); - } - else - { - this._font = font; + this.setFont(font, false); } + this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); + // Allow for 'fill' to be used in place of 'color' var fill = GetValue(style, 'fill', null); @@ -133601,7 +140782,7 @@ var TextStyle = new Class({ /** * Synchronize the font settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncFont + * @method Phaser.GameObjects.TextStyle#syncFont * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -133615,7 +140796,7 @@ var TextStyle = new Class({ /** * Synchronize the text style settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncStyle + * @method Phaser.GameObjects.TextStyle#syncStyle * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -133636,7 +140817,7 @@ var TextStyle = new Class({ /** * Synchronize the shadow settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncShadow + * @method Phaser.GameObjects.TextStyle#syncShadow * @since 3.0.0 * * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. @@ -133663,7 +140844,7 @@ var TextStyle = new Class({ /** * Update the style settings for the parent Text object. * - * @method Phaser.GameObjects.Text.TextStyle#update + * @method Phaser.GameObjects.TextStyle#update * @since 3.0.0 * * @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics. @@ -133690,15 +140871,18 @@ var TextStyle = new Class({ * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. * - * @method Phaser.GameObjects.Text.TextStyle#setFont + * @method Phaser.GameObjects.TextStyle#setFont * @since 3.0.0 * * @param {(string|object)} font - The font family or font settings to set. + * @param {boolean} [updateText=true] - Whether to update the text immediately. * * @return {Phaser.GameObjects.Text} The parent Text object. */ - setFont: function (font) + setFont: function (font, updateText) { + if (updateText === undefined) { updateText = true; } + var fontFamily = font; var fontSize = ''; var fontStyle = ''; @@ -133709,14 +140893,27 @@ var TextStyle = new Class({ fontSize = GetValue(font, 'fontSize', '16px'); fontStyle = GetValue(font, 'fontStyle', ''); } + else + { + var fontSplit = font.split(' '); + + var i = 0; + + fontStyle = (fontSplit.length > 2) ? fontSplit[i++] : ''; + fontSize = fontSplit[i++] || '16px'; + fontFamily = fontSplit[i++] || 'Courier'; + } if (fontFamily !== this.fontFamily || fontSize !== this.fontSize || fontStyle !== this.fontStyle) { this.fontFamily = fontFamily; this.fontSize = fontSize; this.fontStyle = fontStyle; - - this.update(true); + + if (updateText) + { + this.update(true); + } } return this.parent; @@ -133725,7 +140922,7 @@ var TextStyle = new Class({ /** * Set the font family. * - * @method Phaser.GameObjects.Text.TextStyle#setFontFamily + * @method Phaser.GameObjects.TextStyle#setFontFamily * @since 3.0.0 * * @param {string} family - The font family. @@ -133747,7 +140944,7 @@ var TextStyle = new Class({ /** * Set the font style. * - * @method Phaser.GameObjects.Text.TextStyle#setFontStyle + * @method Phaser.GameObjects.TextStyle#setFontStyle * @since 3.0.0 * * @param {string} style - The font style. @@ -133769,7 +140966,7 @@ var TextStyle = new Class({ /** * Set the font size. * - * @method Phaser.GameObjects.Text.TextStyle#setFontSize + * @method Phaser.GameObjects.TextStyle#setFontSize * @since 3.0.0 * * @param {(number|string)} size - The font size. @@ -133796,7 +140993,7 @@ var TextStyle = new Class({ /** * Set the test string to use when measuring the font. * - * @method Phaser.GameObjects.Text.TextStyle#setTestString + * @method Phaser.GameObjects.TextStyle#setTestString * @since 3.0.0 * * @param {string} string - The test string to use when measuring the font. @@ -133815,7 +141012,7 @@ var TextStyle = new Class({ * * Pass in `0` for either of these parameters to disable fixed width or height respectively. * - * @method Phaser.GameObjects.Text.TextStyle#setFixedSize + * @method Phaser.GameObjects.TextStyle#setFixedSize * @since 3.0.0 * * @param {number} width - The fixed width to set. @@ -133844,7 +141041,7 @@ var TextStyle = new Class({ /** * Set the background color. * - * @method Phaser.GameObjects.Text.TextStyle#setBackgroundColor + * @method Phaser.GameObjects.TextStyle#setBackgroundColor * @since 3.0.0 * * @param {string} color - The background color. @@ -133861,7 +141058,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setFill + * @method Phaser.GameObjects.TextStyle#setFill * @since 3.0.0 * * @param {string} color - The text fill color. @@ -133878,7 +141075,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setColor + * @method Phaser.GameObjects.TextStyle#setColor * @since 3.0.0 * * @param {string} color - The text fill color. @@ -133901,7 +141098,7 @@ var TextStyle = new Class({ * * Please use with caution, as the more high res Text you have, the more memory it uses up. * - * @method Phaser.GameObjects.Text.TextStyle#setResolution + * @method Phaser.GameObjects.TextStyle#setResolution * @since 3.12.0 * * @param {number} value - The resolution for this Text object to use. @@ -133918,7 +141115,7 @@ var TextStyle = new Class({ /** * Set the stroke settings. * - * @method Phaser.GameObjects.Text.TextStyle#setStroke + * @method Phaser.GameObjects.TextStyle#setStroke * @since 3.0.0 * * @param {string} color - The stroke color. @@ -133954,7 +141151,7 @@ var TextStyle = new Class({ * Calling this method always re-measures the parent Text object, * so only call it when you actually change the shadow settings. * - * @method Phaser.GameObjects.Text.TextStyle#setShadow + * @method Phaser.GameObjects.TextStyle#setShadow * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -133988,7 +141185,7 @@ var TextStyle = new Class({ /** * Set the shadow offset. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowOffset + * @method Phaser.GameObjects.TextStyle#setShadowOffset * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -134010,7 +141207,7 @@ var TextStyle = new Class({ /** * Set the shadow color. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowColor + * @method Phaser.GameObjects.TextStyle#setShadowColor * @since 3.0.0 * * @param {string} [color='#000'] - The shadow color. @@ -134029,7 +141226,7 @@ var TextStyle = new Class({ /** * Set the shadow blur radius. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowBlur + * @method Phaser.GameObjects.TextStyle#setShadowBlur * @since 3.0.0 * * @param {number} [blur=0] - The shadow blur radius. @@ -134048,7 +141245,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow stroke. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowStroke + * @method Phaser.GameObjects.TextStyle#setShadowStroke * @since 3.0.0 * * @param {boolean} enabled - Whether shadow stroke is enabled or not. @@ -134065,7 +141262,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow fill. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowFill + * @method Phaser.GameObjects.TextStyle#setShadowFill * @since 3.0.0 * * @param {boolean} enabled - Whether shadow fill is enabled or not. @@ -134084,7 +141281,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by width. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapWidth + * @method Phaser.GameObjects.TextStyle#setWordWrapWidth * @since 3.0.0 * * @param {number} width - The maximum width of a line in pixels. Set to null to remove wrapping. @@ -134109,7 +141306,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by callback. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapCallback + * @method Phaser.GameObjects.TextStyle#setWordWrapCallback * @since 3.0.0 * * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the @@ -134135,7 +141332,7 @@ var TextStyle = new Class({ * * Expects values like `'left'`, `'right'`, `'center'` or `'justified'`. * - * @method Phaser.GameObjects.Text.TextStyle#setAlign + * @method Phaser.GameObjects.TextStyle#setAlign * @since 3.0.0 * * @param {string} align - The text alignment. @@ -134154,7 +141351,7 @@ var TextStyle = new Class({ /** * Set the maximum number of lines to draw. * - * @method Phaser.GameObjects.Text.TextStyle#setMaxLines + * @method Phaser.GameObjects.TextStyle#setMaxLines * @since 3.0.0 * * @param {integer} [max=0] - The maximum number of lines to draw. @@ -134173,7 +141370,7 @@ var TextStyle = new Class({ /** * Get the current text metrics. * - * @method Phaser.GameObjects.Text.TextStyle#getTextMetrics + * @method Phaser.GameObjects.TextStyle#getTextMetrics * @since 3.0.0 * * @return {BitmapTextMetrics} The text metrics. @@ -134192,7 +141389,7 @@ var TextStyle = new Class({ /** * Build a JSON representation of this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#toJSON + * @method Phaser.GameObjects.TextStyle#toJSON * @since 3.0.0 * * @return {object} A JSON representation of this Text Style. @@ -134214,7 +141411,7 @@ var TextStyle = new Class({ /** * Destroy this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#destroy + * @method Phaser.GameObjects.TextStyle#destroy * @since 3.0.0 */ destroy: function () @@ -134228,12 +141425,12 @@ module.exports = TextStyle; /***/ }), -/* 808 */ +/* 831 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134264,16 +141461,16 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 809 */ +/* 832 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -134329,12 +141526,12 @@ module.exports = TextWebGLRenderer; /***/ }), -/* 810 */ +/* 833 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134343,12 +141540,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(809); + renderWebGL = __webpack_require__(832); } if (true) { - renderCanvas = __webpack_require__(808); + renderCanvas = __webpack_require__(831); } module.exports = { @@ -134360,12 +141557,12 @@ module.exports = { /***/ }), -/* 811 */ +/* 834 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134442,12 +141639,12 @@ module.exports = GetTextSize; /***/ }), -/* 812 */ +/* 835 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134558,12 +141755,12 @@ module.exports = ParseRetroFont; /***/ }), -/* 813 */ +/* 836 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134674,17 +141871,17 @@ module.exports = RETRO_FONT_CONST; /***/ }), -/* 814 */ +/* 837 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RETRO_FONT_CONST = __webpack_require__(813); -var Extend = __webpack_require__(20); +var RETRO_FONT_CONST = __webpack_require__(836); +var Extend = __webpack_require__(19); /** * @typedef {object} Phaser.GameObjects.RetroFont.Config @@ -134706,7 +141903,7 @@ var Extend = __webpack_require__(20); * @since 3.6.0 */ -var RetroFont = { Parse: __webpack_require__(812) }; +var RetroFont = { Parse: __webpack_require__(835) }; // Merge in the consts RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); @@ -134715,12 +141912,12 @@ module.exports = RetroFont; /***/ }), -/* 815 */ +/* 838 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134748,16 +141945,16 @@ module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 816 */ +/* 839 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -134811,12 +142008,12 @@ module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 817 */ +/* 840 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134825,12 +142022,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(816); + renderWebGL = __webpack_require__(839); } if (true) { - renderCanvas = __webpack_require__(815); + renderCanvas = __webpack_require__(838); } module.exports = { @@ -134842,12 +142039,12 @@ module.exports = { /***/ }), -/* 818 */ +/* 841 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134857,20 +142054,20 @@ module.exports = { module.exports = { - DeathZone: __webpack_require__(301), - EdgeZone: __webpack_require__(300), - RandomZone: __webpack_require__(297) + DeathZone: __webpack_require__(304), + EdgeZone: __webpack_require__(303), + RandomZone: __webpack_require__(301) }; /***/ }), -/* 819 */ +/* 842 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -134969,8 +142166,8 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol if (roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); @@ -134986,16 +142183,16 @@ module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 820 */ +/* 843 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -135109,25 +142306,22 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola if (roundPixels) { - tx0 |= 0; - ty0 |= 0; - - tx1 |= 0; - ty1 |= 0; - - tx2 |= 0; - ty2 |= 0; - - tx3 |= 0; - ty3 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); + + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); + + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); + + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } var tint = getTint(particle.tint, alpha); - if (pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect)) - { - pipeline.setTexture2D(texture, 0); - } + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, 0); } } }; @@ -135136,12 +142330,12 @@ module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 821 */ +/* 844 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135150,12 +142344,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(820); + renderWebGL = __webpack_require__(843); } if (true) { - renderCanvas = __webpack_require__(819); + renderCanvas = __webpack_require__(842); } module.exports = { @@ -135167,20 +142361,20 @@ module.exports = { /***/ }), -/* 822 */ +/* 845 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(299); -var GetEaseFunction = __webpack_require__(86); +var FloatBetween = __webpack_require__(374); +var GetEaseFunction = __webpack_require__(92); var GetFastValue = __webpack_require__(2); -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * The returned value sets what the property will be at the START of the particle's life, on emit. @@ -135250,14 +142444,14 @@ var Wrap = __webpack_require__(53); /** * @typedef {object} EmitterOpCustomEmitConfig * - * @property {EmitterOpOnEmitCallback} onEmit - [description] + * @property {EmitterOpOnEmitCallback} onEmit - A callback that is invoked each time the emitter emits a particle. */ /** * @typedef {object} EmitterOpCustomUpdateConfig * - * @property {EmitterOpOnEmitCallback} [onEmit] - [description] - * @property {EmitterOpOnUpdateCallback} onUpdate - [description] + * @property {EmitterOpOnEmitCallback} [onEmit] - A callback that is invoked each time the emitter emits a particle. + * @property {EmitterOpOnUpdateCallback} onUpdate - A callback that is invoked each time the emitter updates. */ /** @@ -135836,12 +143030,12 @@ module.exports = EmitterOp; /***/ }), -/* 823 */ +/* 846 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135851,22 +143045,22 @@ module.exports = EmitterOp; module.exports = { - GravityWell: __webpack_require__(304), - Particle: __webpack_require__(303), - ParticleEmitter: __webpack_require__(302), - ParticleEmitterManager: __webpack_require__(155), - Zones: __webpack_require__(818) + GravityWell: __webpack_require__(307), + Particle: __webpack_require__(306), + ParticleEmitter: __webpack_require__(305), + ParticleEmitterManager: __webpack_require__(165), + Zones: __webpack_require__(841) }; /***/ }), -/* 824 */ +/* 847 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135894,12 +143088,12 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 825 */ +/* 848 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135927,12 +143121,12 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 826 */ +/* 849 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135941,12 +143135,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(825); + renderWebGL = __webpack_require__(848); } if (true) { - renderCanvas = __webpack_require__(824); + renderCanvas = __webpack_require__(847); } module.exports = { @@ -135958,12 +143152,12 @@ module.exports = { /***/ }), -/* 827 */ +/* 850 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -135991,12 +143185,12 @@ module.exports = SpriteCanvasRenderer; /***/ }), -/* 828 */ +/* 851 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136024,12 +143218,12 @@ module.exports = SpriteWebGLRenderer; /***/ }), -/* 829 */ +/* 852 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136038,12 +143232,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(828); + renderWebGL = __webpack_require__(851); } if (true) { - renderCanvas = __webpack_require__(827); + renderCanvas = __webpack_require__(850); } module.exports = { @@ -136055,17 +143249,17 @@ module.exports = { /***/ }), -/* 830 */ +/* 853 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Commands = __webpack_require__(157); -var Utils = __webpack_require__(10); +var Commands = __webpack_require__(167); +var Utils = __webpack_require__(9); // TODO: Remove the use of this var Point = function (x, y, width) @@ -136107,12 +143301,12 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca return; } - var pipeline = this.pipeline; + var pipeline = renderer.currentPipeline; var camMatrix = pipeline._tempMatrix1; var graphicsMatrix = pipeline._tempMatrix2; var currentMatrix = pipeline._tempMatrix4; - + renderer.setPipeline(pipeline); currentMatrix.loadIdentity(); @@ -136420,12 +143614,12 @@ module.exports = GraphicsWebGLRenderer; /***/ }), -/* 831 */ +/* 854 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136434,15 +143628,15 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(830); + renderWebGL = __webpack_require__(853); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(305); + renderCanvas = __webpack_require__(308); } if (true) { - renderCanvas = __webpack_require__(305); + renderCanvas = __webpack_require__(308); } module.exports = { @@ -136454,16 +143648,122 @@ module.exports = { /***/ }), -/* 832 */ +/* 855 */ +/***/ (function(module, exports) { + + + +/***/ }), +/* 856 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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.Extern#renderWebGL + * @since 3.16.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Extern} 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. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +{ + var pipeline = renderer.currentPipeline; + + renderer.clearPipeline(); + + var camMatrix = renderer._tempMatrix1; + var spriteMatrix = renderer._tempMatrix2; + var calcMatrix = renderer._tempMatrix3; + + spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = src.x; + spriteMatrix.f = src.y; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + else + { + spriteMatrix.e -= camera.scrollX * src.scrollFactorX; + spriteMatrix.f -= camera.scrollY * src.scrollFactorY; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + } + + // Callback + src.render.call(src, renderer, camera, calcMatrix); + + renderer.rebindPipeline(pipeline); +}; + +module.exports = ExternWebGLRenderer; + + +/***/ }), +/* 857 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTransform = __webpack_require__(22); +var renderWebGL = __webpack_require__(1); +var renderCanvas = __webpack_require__(1); + +if (true) +{ + renderWebGL = __webpack_require__(856); +} + +if (true) +{ + renderCanvas = __webpack_require__(855); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 858 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -136495,6 +143795,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc var textureFrame = src.frame; var displayCallback = src.displayCallback; + var callbackData = src.callbackData; var cameraScrollX = camera.scrollX * src.scrollFactorX; var cameraScrollY = camera.scrollY * src.scrollFactorY; @@ -136520,7 +143821,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc var lastGlyph = null; var lastCharCode = 0; - // var ctx = renderer.currentContext; var image = src.frame.source.image; var textureX = textureFrame.cutX; @@ -136531,7 +143831,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (src.cropWidth > 0 && src.cropHeight > 0) { - ctx.save(); ctx.beginPath(); ctx.rect(0, 0, src.cropWidth, src.cropHeight); ctx.clip(); @@ -136580,7 +143879,15 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (displayCallback) { - var output = displayCallback({ tint: { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }, index: index, charCode: charCode, x: x, y: y, scale: scale, rotation: 0, data: glyph.data }); + callbackData.index = index; + callbackData.charCode = charCode; + callbackData.x = x; + callbackData.y = y; + callbackData.scale = scale; + callbackData.rotation = rotation; + callbackData.data = glyph.data; + + var output = displayCallback(callbackData); x = output.x; y = output.y; @@ -136596,8 +143903,8 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc if (camera.roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.save(); @@ -136618,11 +143925,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc lastCharCode = charCode; } - if (src.cropWidth > 0 && src.cropHeight > 0) - { - ctx.restore(); - } - + // Restore the context saved in SetTransform ctx.restore(); }; @@ -136630,16 +143933,16 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 833 */ +/* 859 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -136908,20 +144211,20 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); } if (crop) @@ -136936,12 +144239,12 @@ module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 834 */ +/* 860 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -136950,12 +144253,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(833); + renderWebGL = __webpack_require__(859); } if (true) { - renderCanvas = __webpack_require__(832); + renderCanvas = __webpack_require__(858); } module.exports = { @@ -136967,13 +144270,13 @@ module.exports = { /***/ }), -/* 835 */ +/* 861 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137065,13 +144368,13 @@ module.exports = ContainerCanvasRenderer; /***/ }), -/* 836 */ +/* 862 */ /***/ (function(module, exports) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137162,13 +144465,13 @@ module.exports = ContainerWebGLRenderer; /***/ }), -/* 837 */ +/* 863 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137177,12 +144480,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(836); + renderWebGL = __webpack_require__(862); } if (true) { - renderCanvas = __webpack_require__(835); + renderCanvas = __webpack_require__(861); } module.exports = { @@ -137194,12 +144497,12 @@ module.exports = { /***/ }), -/* 838 */ +/* 864 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137222,7 +144525,7 @@ var Class = __webpack_require__(0); * handled via the Blitter parent. * * @class Bob - * @memberof Phaser.GameObjects.Blitter + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -137241,7 +144544,7 @@ var Bob = new Class({ /** * The Blitter object that this Bob belongs to. * - * @name Phaser.GameObjects.Blitter.Bob#parent + * @name Phaser.GameObjects.Bob#parent * @type {Phaser.GameObjects.Blitter} * @since 3.0.0 */ @@ -137250,7 +144553,7 @@ var Bob = new Class({ /** * The x position of this Bob, relative to the x position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#x + * @name Phaser.GameObjects.Bob#x * @type {number} * @since 3.0.0 */ @@ -137259,7 +144562,7 @@ var Bob = new Class({ /** * The y position of this Bob, relative to the y position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#y + * @name Phaser.GameObjects.Bob#y * @type {number} * @since 3.0.0 */ @@ -137269,7 +144572,7 @@ var Bob = new Class({ * The frame that the Bob uses to render with. * To change the frame use the `Bob.setFrame` method. * - * @name Phaser.GameObjects.Blitter.Bob#frame + * @name Phaser.GameObjects.Bob#frame * @type {Phaser.Textures.Frame} * @protected * @since 3.0.0 @@ -137279,7 +144582,7 @@ var Bob = new Class({ /** * A blank object which can be used to store data related to this Bob in. * - * @name Phaser.GameObjects.Blitter.Bob#data + * @name Phaser.GameObjects.Bob#data * @type {object} * @default {} * @since 3.0.0 @@ -137289,7 +144592,7 @@ var Bob = new Class({ /** * The visible state of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_visible + * @name Phaser.GameObjects.Bob#_visible * @type {boolean} * @private * @since 3.0.0 @@ -137299,7 +144602,7 @@ var Bob = new Class({ /** * The alpha value of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_alpha + * @name Phaser.GameObjects.Bob#_alpha * @type {number} * @private * @default 1 @@ -137312,7 +144615,7 @@ var Bob = new Class({ * A Bob that is flipped horizontally will render inversed on the horizontal axis. * Flipping always takes place from the middle of the texture. * - * @name Phaser.GameObjects.Blitter.Bob#flipX + * @name Phaser.GameObjects.Bob#flipX * @type {boolean} * @since 3.0.0 */ @@ -137323,7 +144626,7 @@ var Bob = new Class({ * A Bob 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. * - * @name Phaser.GameObjects.Blitter.Bob#flipY + * @name Phaser.GameObjects.Bob#flipY * @type {boolean} * @since 3.0.0 */ @@ -137335,12 +144638,12 @@ var Bob = new Class({ * The frame must be part of the Texture the parent Blitter is using. * If no value is given it will use the default frame of the Blitter parent. * - * @method Phaser.GameObjects.Blitter.Bob#setFrame + * @method Phaser.GameObjects.Bob#setFrame * @since 3.0.0 * * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFrame: function (frame) { @@ -137359,10 +144662,10 @@ var Bob = new Class({ /** * Resets the horizontal and vertical flipped state of this Bob back to their default un-flipped state. * - * @method Phaser.GameObjects.Blitter.Bob#resetFlip + * @method Phaser.GameObjects.Bob#resetFlip * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ resetFlip: function () { @@ -137379,14 +144682,14 @@ var Bob = new Class({ * * Also resets the flipX and flipY values, sets alpha back to 1 and visible to true. * - * @method Phaser.GameObjects.Blitter.Bob#reset + * @method Phaser.GameObjects.Bob#reset * @since 3.0.0 * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ reset: function (x, y, frame) { @@ -137412,12 +144715,12 @@ var Bob = new Class({ /** * Sets the horizontal flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipX + * @method Phaser.GameObjects.Bob#setFlipX * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipX: function (value) { @@ -137429,12 +144732,12 @@ var Bob = new Class({ /** * Sets the vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipY + * @method Phaser.GameObjects.Bob#setFlipY * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipY: function (value) { @@ -137446,13 +144749,13 @@ var Bob = new Class({ /** * Sets the horizontal and vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlip + * @method Phaser.GameObjects.Bob#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.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlip: function (x, y) { @@ -137467,12 +144770,12 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setVisible + * @method Phaser.GameObjects.Bob#setVisible * @since 3.0.0 * * @param {boolean} value - The visible state of the Game Object. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setVisible: function (value) { @@ -137487,12 +144790,12 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setAlpha + * @method Phaser.GameObjects.Bob#setAlpha * @since 3.0.0 * * @param {number} value - The alpha value used for this Bob. Between 0 and 1. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setAlpha: function (value) { @@ -137505,7 +144808,7 @@ var Bob = new Class({ * Destroys this Bob instance. * Removes itself from the Blitter and clears the parent, frame and data properties. * - * @method Phaser.GameObjects.Blitter.Bob#destroy + * @method Phaser.GameObjects.Bob#destroy * @since 3.0.0 */ destroy: function () @@ -137524,7 +144827,7 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#visible + * @name Phaser.GameObjects.Bob#visible * @type {boolean} * @since 3.0.0 */ @@ -137548,7 +144851,7 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#alpha + * @name Phaser.GameObjects.Bob#alpha * @type {number} * @since 3.0.0 */ @@ -137573,12 +144876,12 @@ module.exports = Bob; /***/ }), -/* 839 */ +/* 865 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137656,8 +144959,8 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca { if (roundPixels) { - dx |= 0; - dy |= 0; + dx = Math.round(dx); + dy = Math.round(dy); } ctx.drawImage( @@ -137701,16 +145004,16 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 840 */ +/* 866 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -137812,15 +145115,15 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); } // TL x/y, BL x/y, BR x/y, TR x/y - if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect)) + if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, 0)) { prevTextureSourceIndex = -1; } @@ -137831,12 +145134,12 @@ module.exports = BlitterWebGLRenderer; /***/ }), -/* 841 */ +/* 867 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -137845,12 +145148,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(840); + renderWebGL = __webpack_require__(866); } if (true) { - renderCanvas = __webpack_require__(839); + renderCanvas = __webpack_require__(865); } module.exports = { @@ -137862,16 +145165,16 @@ module.exports = { /***/ }), -/* 842 */ +/* 868 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SetTransform = __webpack_require__(22); +var SetTransform = __webpack_require__(25); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -138015,8 +145318,8 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, if (roundPixels) { - x |= 0; - y |= 0; + x = Math.round(x); + y = Math.round(y); } ctx.save(); @@ -138037,16 +145340,16 @@ module.exports = BitmapTextCanvasRenderer; /***/ }), -/* 843 */ +/* 869 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(9); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -138245,20 +145548,20 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, if (roundPixels) { - tx0 |= 0; - ty0 |= 0; + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); - tx1 |= 0; - ty1 |= 0; + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - tx2 |= 0; - ty2 |= 0; + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - tx3 |= 0; - ty3 |= 0; + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); + pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, 0); } }; @@ -138266,12 +145569,12 @@ module.exports = BitmapTextWebGLRenderer; /***/ }), -/* 844 */ +/* 870 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138280,12 +145583,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(843); + renderWebGL = __webpack_require__(869); } if (true) { - renderCanvas = __webpack_require__(842); + renderCanvas = __webpack_require__(868); } module.exports = { @@ -138297,16 +145600,16 @@ module.exports = { /***/ }), -/* 845 */ +/* 871 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(310); +var ParseXMLBitmapFont = __webpack_require__(314); /** * Parse an XML Bitmap Font from an Atlas. @@ -138350,12 +145653,12 @@ module.exports = ParseFromAtlas; /***/ }), -/* 846 */ +/* 872 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138592,17 +145895,18 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 847 */ +/* 873 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(15); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); /** * @classdesc @@ -138676,8 +145980,8 @@ var UpdateList = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -138690,7 +145994,7 @@ var UpdateList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -138706,9 +146010,9 @@ var UpdateList = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -138878,9 +146182,9 @@ var UpdateList = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -138894,7 +146198,7 @@ var UpdateList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -138925,12 +146229,12 @@ module.exports = UpdateList; /***/ }), -/* 848 */ +/* 874 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -138973,16 +146277,16 @@ module.exports = Swap; /***/ }), -/* 849 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Scans the array for elements with the given property. If found, the property is set to the `value`. @@ -139028,12 +146332,12 @@ module.exports = SetAll; /***/ }), -/* 850 */ +/* 876 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139066,12 +146370,12 @@ module.exports = SendToBack; /***/ }), -/* 851 */ +/* 877 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139109,16 +146413,16 @@ module.exports = Replace; /***/ }), -/* 852 */ +/* 878 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(91); +var SpliceOne = __webpack_require__(97); /** * Removes a random object from the given array and returns it. @@ -139147,16 +146451,16 @@ module.exports = RemoveRandomElement; /***/ }), -/* 853 */ +/* 879 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Removes the item within the given range in the array. @@ -139210,16 +146514,16 @@ module.exports = RemoveBetween; /***/ }), -/* 854 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(91); +var SpliceOne = __webpack_require__(97); /** * Removes the item from the given position in the array. @@ -139261,16 +146565,16 @@ module.exports = RemoveAt; /***/ }), -/* 855 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RoundAwayFromZero = __webpack_require__(314); +var RoundAwayFromZero = __webpack_require__(372); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -139307,7 +146611,7 @@ var RoundAwayFromZero = __webpack_require__(314); * @param {number} [end=null] - The end of the range. * @param {number} [step=1] - The value to increment or decrement by. * - * @return {number[]} [description] + * @return {number[]} The array of number values. */ var NumberArrayStep = function (start, end, step) { @@ -139338,12 +146642,12 @@ module.exports = NumberArrayStep; /***/ }), -/* 856 */ +/* 882 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139402,12 +146706,12 @@ module.exports = NumberArray; /***/ }), -/* 857 */ +/* 883 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139427,10 +146731,10 @@ var MoveUp = function (array, item) { var currentIndex = array.indexOf(item); - if (currentIndex !== -1 && currentIndex < array.length - 2) + if (currentIndex !== -1 && currentIndex < array.length - 1) { + // The element one above `item` in the array var item2 = array[currentIndex + 1]; - var index2 = array.indexOf(item2); array[currentIndex] = item2; @@ -139444,12 +146748,12 @@ module.exports = MoveUp; /***/ }), -/* 858 */ +/* 884 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139491,12 +146795,12 @@ module.exports = MoveTo; /***/ }), -/* 859 */ +/* 885 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139533,16 +146837,16 @@ module.exports = MoveDown; /***/ }), -/* 860 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Returns the first element in the array. @@ -139592,16 +146896,16 @@ module.exports = GetFirst; /***/ }), -/* 861 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Returns all elements in the array. @@ -139654,16 +146958,16 @@ module.exports = GetAll; /***/ }), -/* 862 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Passes each element in the array, between the start and end indexes, to the given callback. @@ -139710,12 +147014,12 @@ module.exports = EachInRange; /***/ }), -/* 863 */ +/* 889 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139756,16 +147060,16 @@ module.exports = Each; /***/ }), -/* 864 */ +/* 890 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SafeRange = __webpack_require__(62); +var SafeRange = __webpack_require__(68); /** * Returns the total number of elements in the array which have a property matching the given value. @@ -139808,12 +147112,12 @@ module.exports = CountAllMatching; /***/ }), -/* 865 */ +/* 891 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139846,12 +147150,12 @@ module.exports = BringToTop; /***/ }), -/* 866 */ +/* 892 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -139968,12 +147272,12 @@ module.exports = AddAt; /***/ }), -/* 867 */ +/* 893 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140085,26 +147389,26 @@ module.exports = Add; /***/ }), -/* 868 */ +/* 894 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(111); +var RotateMatrix = __webpack_require__(119); /** - * [description] + * Rotates the array matrix to the left (or -90 degrees) * * @function Phaser.Utils.Array.Matrix.RotateRight * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var RotateRight = function (matrix) { @@ -140115,26 +147419,26 @@ module.exports = RotateRight; /***/ }), -/* 869 */ +/* 895 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(111); +var RotateMatrix = __webpack_require__(119); /** - * [description] + * Rotates the array matrix to the left (or 90 degrees) * * @function Phaser.Utils.Array.Matrix.RotateLeft * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var RotateLeft = function (matrix) { @@ -140145,26 +147449,26 @@ module.exports = RotateLeft; /***/ }), -/* 870 */ +/* 896 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateMatrix = __webpack_require__(111); +var RotateMatrix = __webpack_require__(119); /** - * [description] + * Rotates the array matrix 180 degrees. * * @function Phaser.Utils.Array.Matrix.Rotate180 * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array to rotate. * - * @return {array} [description] + * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix. */ var Rotate180 = function (matrix) { @@ -140175,40 +147479,45 @@ module.exports = Rotate180; /***/ }), -/* 871 */ +/* 897 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Reverses the rows in the given Array Matrix. * * @function Phaser.Utils.Array.Matrix.ReverseRows * @since 3.0.0 * - * @param {array} matrix - [description] + * @param {array} matrix - The array matrix to reverse the rows for. * - * @return {array} [description] + * @return {array} The column reversed matrix. */ var ReverseRows = function (matrix) { - return matrix.reverse(); + for (var i = 0; i < matrix.length; i++) + { + matrix[i].reverse(); + } + + return matrix; }; module.exports = ReverseRows; /***/ }), -/* 872 */ +/* 898 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140224,32 +147533,24 @@ module.exports = ReverseRows; */ var ReverseColumns = function (matrix) { - for (var i = 0; i < matrix.length; i++) - { - matrix[i].reverse(); - } - - return matrix; + return matrix.reverse(); }; module.exports = ReverseColumns; /***/ }), -/* 873 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pad = __webpack_require__(179); -var CheckMatrix = __webpack_require__(163); - -// Generates a string (which you can pass to console.log) from the given -// Array Matrix. +var Pad = __webpack_require__(193); +var CheckMatrix = __webpack_require__(173); /** * Generates a string (which you can pass to console.log) from the given Array Matrix. @@ -140317,12 +147618,12 @@ module.exports = MatrixToString; /***/ }), -/* 874 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140332,33 +147633,34 @@ module.exports = MatrixToString; module.exports = { - CheckMatrix: __webpack_require__(163), - MatrixToString: __webpack_require__(873), - ReverseColumns: __webpack_require__(872), - ReverseRows: __webpack_require__(871), - Rotate180: __webpack_require__(870), - RotateLeft: __webpack_require__(869), - RotateMatrix: __webpack_require__(111), - RotateRight: __webpack_require__(868), - TransposeMatrix: __webpack_require__(315) + CheckMatrix: __webpack_require__(173), + MatrixToString: __webpack_require__(899), + ReverseColumns: __webpack_require__(898), + ReverseRows: __webpack_require__(897), + Rotate180: __webpack_require__(896), + RotateLeft: __webpack_require__(895), + RotateMatrix: __webpack_require__(119), + RotateRight: __webpack_require__(894), + TransposeMatrix: __webpack_require__(318) }; /***/ }), -/* 875 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var List = __webpack_require__(112); -var PluginCache = __webpack_require__(15); -var StableSort = __webpack_require__(110); +var List = __webpack_require__(120); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var StableSort = __webpack_require__(118); /** * @classdesc @@ -140414,8 +147716,8 @@ var DisplayList = new Class({ */ this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -140428,7 +147730,7 @@ var DisplayList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -140442,7 +147744,7 @@ var DisplayList = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -140489,46 +147791,8 @@ var DisplayList = new Class({ }, /** - * Given an array of Game Objects, sort the array and return it, so that - * the objects are in index order with the lowest at the bottom. - * - * @method Phaser.GameObjects.DisplayList#sortGameObjects - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects to sort. - * - * @return {array} The sorted array of Game Objects. - */ - sortGameObjects: function (gameObjects) - { - if (gameObjects === undefined) { gameObjects = this.list; } - - this.scene.sys.depthSort(); - - return gameObjects.sort(this.sortIndexHandler.bind(this)); - }, - - /** - * Get the top-most Game Object in the given array of Game Objects, after sorting it. - * - * Note that the given array is sorted in place, even though it isn't returned directly it will still be updated. - * - * @method Phaser.GameObjects.DisplayList#getTopGameObject - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects. - * - * @return {Phaser.GameObjects.GameObject} The top-most Game Object in the array of Game Objects. - */ - getTopGameObject: function (gameObjects) - { - this.sortGameObjects(gameObjects); - - return gameObjects[gameObjects.length - 1]; - }, - - /** - * All members of the group. + * Returns an array which contains all objects currently on the Display List. + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. * * @method Phaser.GameObjects.DisplayList#getChildren * @since 3.12.0 @@ -140559,7 +147823,7 @@ var DisplayList = new Class({ this.list.length = 0; - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -140574,7 +147838,7 @@ var DisplayList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -140588,12 +147852,12 @@ module.exports = DisplayList; /***/ }), -/* 876 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -140603,93 +147867,97 @@ module.exports = DisplayList; var GameObjects = { - DisplayList: __webpack_require__(875), - GameObjectCreator: __webpack_require__(13), + Events: __webpack_require__(133), + + DisplayList: __webpack_require__(901), + GameObjectCreator: __webpack_require__(14), GameObjectFactory: __webpack_require__(5), - UpdateList: __webpack_require__(847), + UpdateList: __webpack_require__(873), - Components: __webpack_require__(14), + Components: __webpack_require__(13), - BuildGameObject: __webpack_require__(28), - BuildGameObjectAnimation: __webpack_require__(311), - GameObject: __webpack_require__(19), - BitmapText: __webpack_require__(109), - Blitter: __webpack_require__(161), - Container: __webpack_require__(160), - DynamicBitmapText: __webpack_require__(159), - Graphics: __webpack_require__(158), - Group: __webpack_require__(88), - Image: __webpack_require__(87), - Particles: __webpack_require__(823), - PathFollower: __webpack_require__(296), - RenderTexture: __webpack_require__(154), - RetroFont: __webpack_require__(814), - Sprite: __webpack_require__(61), - Text: __webpack_require__(153), - TileSprite: __webpack_require__(152), - Zone: __webpack_require__(125), + BuildGameObject: __webpack_require__(30), + BuildGameObjectAnimation: __webpack_require__(315), + GameObject: __webpack_require__(18), + BitmapText: __webpack_require__(117), + Blitter: __webpack_require__(171), + Container: __webpack_require__(170), + DynamicBitmapText: __webpack_require__(169), + Extern: __webpack_require__(312), + Graphics: __webpack_require__(168), + Group: __webpack_require__(94), + Image: __webpack_require__(93), + Particles: __webpack_require__(846), + PathFollower: __webpack_require__(300), + RenderTexture: __webpack_require__(164), + RetroFont: __webpack_require__(837), + Sprite: __webpack_require__(67), + Text: __webpack_require__(163), + TileSprite: __webpack_require__(162), + Zone: __webpack_require__(137), // Shapes - Shape: __webpack_require__(27), - Arc: __webpack_require__(293), - Curve: __webpack_require__(292), - Ellipse: __webpack_require__(291), - Grid: __webpack_require__(290), - IsoBox: __webpack_require__(289), - IsoTriangle: __webpack_require__(288), - Line: __webpack_require__(287), - Polygon: __webpack_require__(286), - Rectangle: __webpack_require__(281), - Star: __webpack_require__(280), - Triangle: __webpack_require__(279), + Shape: __webpack_require__(29), + Arc: __webpack_require__(298), + Curve: __webpack_require__(297), + Ellipse: __webpack_require__(296), + Grid: __webpack_require__(295), + IsoBox: __webpack_require__(294), + IsoTriangle: __webpack_require__(293), + Line: __webpack_require__(292), + Polygon: __webpack_require__(291), + Rectangle: __webpack_require__(286), + Star: __webpack_require__(285), + Triangle: __webpack_require__(284), // Game Object Factories Factories: { - Blitter: __webpack_require__(769), - Container: __webpack_require__(768), - DynamicBitmapText: __webpack_require__(767), - Graphics: __webpack_require__(766), - Group: __webpack_require__(765), - Image: __webpack_require__(764), - Particles: __webpack_require__(763), - PathFollower: __webpack_require__(762), - RenderTexture: __webpack_require__(761), - Sprite: __webpack_require__(760), - StaticBitmapText: __webpack_require__(759), - Text: __webpack_require__(758), - TileSprite: __webpack_require__(757), - Zone: __webpack_require__(756), + Blitter: __webpack_require__(792), + Container: __webpack_require__(791), + DynamicBitmapText: __webpack_require__(790), + Extern: __webpack_require__(789), + Graphics: __webpack_require__(788), + Group: __webpack_require__(787), + Image: __webpack_require__(786), + Particles: __webpack_require__(785), + PathFollower: __webpack_require__(784), + RenderTexture: __webpack_require__(783), + Sprite: __webpack_require__(782), + StaticBitmapText: __webpack_require__(781), + Text: __webpack_require__(780), + TileSprite: __webpack_require__(779), + Zone: __webpack_require__(778), // Shapes - Arc: __webpack_require__(755), - Curve: __webpack_require__(754), - Ellipse: __webpack_require__(753), - Grid: __webpack_require__(752), - IsoBox: __webpack_require__(751), - IsoTriangle: __webpack_require__(750), - Line: __webpack_require__(749), - Polygon: __webpack_require__(748), - Rectangle: __webpack_require__(747), - Star: __webpack_require__(746), - Triangle: __webpack_require__(745) + Arc: __webpack_require__(777), + Curve: __webpack_require__(776), + Ellipse: __webpack_require__(775), + Grid: __webpack_require__(774), + IsoBox: __webpack_require__(773), + IsoTriangle: __webpack_require__(772), + Line: __webpack_require__(771), + Polygon: __webpack_require__(770), + Rectangle: __webpack_require__(769), + Star: __webpack_require__(768), + Triangle: __webpack_require__(767) }, Creators: { - Blitter: __webpack_require__(744), - Container: __webpack_require__(743), - DynamicBitmapText: __webpack_require__(742), - Graphics: __webpack_require__(741), - Group: __webpack_require__(740), - Image: __webpack_require__(739), - Particles: __webpack_require__(738), - RenderTexture: __webpack_require__(737), - Sprite: __webpack_require__(736), - StaticBitmapText: __webpack_require__(735), - Text: __webpack_require__(734), - TileSprite: __webpack_require__(733), - Zone: __webpack_require__(732) + Blitter: __webpack_require__(766), + Container: __webpack_require__(765), + DynamicBitmapText: __webpack_require__(764), + Graphics: __webpack_require__(763), + Group: __webpack_require__(762), + Image: __webpack_require__(761), + Particles: __webpack_require__(760), + RenderTexture: __webpack_require__(759), + Sprite: __webpack_require__(758), + StaticBitmapText: __webpack_require__(757), + Text: __webpack_require__(756), + TileSprite: __webpack_require__(755), + Zone: __webpack_require__(754) } }; @@ -140700,835 +147968,31 @@ if (false) if (true) { // WebGL only Game Objects - GameObjects.Mesh = __webpack_require__(108); - GameObjects.Quad = __webpack_require__(149); + GameObjects.Mesh = __webpack_require__(116); + GameObjects.Quad = __webpack_require__(159); - GameObjects.Factories.Mesh = __webpack_require__(728); - GameObjects.Factories.Quad = __webpack_require__(727); + GameObjects.Factories.Mesh = __webpack_require__(750); + GameObjects.Factories.Quad = __webpack_require__(749); - GameObjects.Creators.Mesh = __webpack_require__(726); - GameObjects.Creators.Quad = __webpack_require__(725); + GameObjects.Creators.Mesh = __webpack_require__(748); + GameObjects.Creators.Quad = __webpack_require__(747); - GameObjects.Light = __webpack_require__(276); + GameObjects.Light = __webpack_require__(281); - __webpack_require__(275); - __webpack_require__(724); + __webpack_require__(280); + __webpack_require__(746); } module.exports = GameObjects; /***/ }), -/* 877 */ +/* 903 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Visibility Handler hidden event. - * - * The document in which the Game is embedded has entered a hidden state. - * - * @event Phaser.Boot.VisibilityHandler#hidden - */ - -/** - * Visibility Handler visible event. - * - * The document in which the Game is embedded has entered a visible state. - * - * @event Phaser.Boot.VisibilityHandler#visible - */ - -/** - * Visibility Handler blur event. - * - * The window in which the Game is embedded has entered a blurred state. - * - * @event Phaser.Boot.VisibilityHandler#blur - */ - -/** - * Visibility Handler focus event. - * - * The window in which the Game is embedded has entered a focused state. - * - * @event Phaser.Boot.VisibilityHandler#focus - */ - -/** - * The Visibility Handler is responsible for listening out for document level visibility change events. - * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses - * the provided Event Emitter and fires the related events. - * - * @function Phaser.Boot.VisibilityHandler - * @fires Phaser.Boot.VisibilityHandler#hidden - * @fires Phaser.Boot.VisibilityHandler#visible - * @fires Phaser.Boot.VisibilityHandler#blur - * @fires Phaser.Boot.VisibilityHandler#focus - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. - */ -var VisibilityHandler = function (game) -{ - var hiddenVar; - var eventEmitter = game.events; - - if (document.hidden !== undefined) - { - hiddenVar = 'visibilitychange'; - } - else - { - var vendors = [ 'webkit', 'moz', 'ms' ]; - - vendors.forEach(function (prefix) - { - if (document[prefix + 'Hidden'] !== undefined) - { - document.hidden = function () - { - return document[prefix + 'Hidden']; - }; - - hiddenVar = prefix + 'visibilitychange'; - } - - }); - } - - var onChange = function (event) - { - if (document.hidden || event.type === 'pause') - { - eventEmitter.emit('hidden'); - } - else - { - eventEmitter.emit('visible'); - } - }; - - if (hiddenVar) - { - document.addEventListener(hiddenVar, onChange, false); - } - - window.onblur = function () - { - eventEmitter.emit('blur'); - }; - - window.onfocus = function () - { - eventEmitter.emit('focus'); - }; - - // Automatically give the window focus unless config says otherwise - if (window.focus && game.config.autoFocus) - { - window.focus(); - - game.canvas.addEventListener('mousedown', function () - { - window.focus(); - }, { passive: true }); - } - - if (game.canvas) - { - game.canvas.onmouseout = function () - { - game.isOver = false; - eventEmitter.emit('mouseout'); - }; - - game.canvas.onmouseover = function () - { - game.isOver = true; - eventEmitter.emit('mouseover'); - }; - } -}; - -module.exports = VisibilityHandler; - - -/***/ }), -/* 878 */ -/***/ (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 GetValue = __webpack_require__(4); -var NOOP = __webpack_require__(1); -var RequestAnimationFrame = __webpack_require__(341); - -// Frame Rate config -// fps: { -// min: 10, -// target: 60, -// forceSetTimeOut: false, -// deltaHistory: 10, -// panicMax: 120 -// } - -// http://www.testufo.com/#test=animation-time-graph - -/** - * @callback TimeStepCallback - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} average - The Delta Average. - * @param {number} interpolation - Interpolation - how far between what is expected and where we are? - */ - -/** - * @classdesc - * [description] - * - * @class TimeStep - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. - * @param {FPSConfig} config - */ -var TimeStep = new Class({ - - initialize: - - function TimeStep (game, config) - { - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.Boot.TimeStep#game - * @type {Phaser.Game} - * @readonly - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#raf - * @type {Phaser.DOM.RequestAnimationFrame} - * @readonly - * @since 3.0.0 - */ - this.raf = new RequestAnimationFrame(); - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * - * @name Phaser.Boot.TimeStep#started - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.started = false; - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * The difference between this value and `started` is that `running` is toggled when - * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if - * the TimeStep is actually stopped, not just paused. - * - * @name Phaser.Boot.TimeStep#running - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.running = false; - - /** - * The minimum fps rate you want the Time Step to run at. - * - * @name Phaser.Boot.TimeStep#minFps - * @type {integer} - * @default 5 - * @since 3.0.0 - */ - this.minFps = GetValue(config, 'min', 5); - - /** - * The target fps rate for the Time Step to run at. - * - * Setting this value will not actually change the speed at which the browser runs, that is beyond - * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step - * is spiraling out of control. - * - * @name Phaser.Boot.TimeStep#targetFps - * @type {integer} - * @default 60 - * @since 3.0.0 - */ - this.targetFps = GetValue(config, 'target', 60); - - /** - * The minFps value in ms. - * Defaults to 200ms between frames (i.e. super slow!) - * - * @name Phaser.Boot.TimeStep#_min - * @type {number} - * @private - * @since 3.0.0 - */ - this._min = 1000 / this.minFps; - - /** - * The targetFps value in ms. - * Defaults to 16.66ms between frames (i.e. normal) - * - * @name Phaser.Boot.TimeStep#_target - * @type {number} - * @private - * @since 3.0.0 - */ - this._target = 1000 / this.targetFps; - - /** - * An exponential moving average of the frames per second. - * - * @name Phaser.Boot.TimeStep#actualFps - * @type {integer} - * @readonly - * @default 60 - * @since 3.0.0 - */ - this.actualFps = this.targetFps; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#nextFpsUpdate - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.nextFpsUpdate = 0; - - /** - * The number of frames processed this second. - * - * @name Phaser.Boot.TimeStep#framesThisSecond - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.framesThisSecond = 0; - - /** - * A callback to be invoked each time the Time Step steps. - * - * @name Phaser.Boot.TimeStep#callback - * @type {TimeStepCallback} - * @default NOOP - * @since 3.0.0 - */ - this.callback = NOOP; - - /** - * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting - * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. - * - * @name Phaser.Boot.TimeStep#forceSetTimeOut - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#time - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.time = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#startTime - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.startTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#lastTime - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.lastTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#frame - * @type {integer} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.frame = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#inFocus - * @type {boolean} - * @readonly - * @default true - * @since 3.0.0 - */ - this.inFocus = true; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#_pauseTime - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._pauseTime = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#_coolDown - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._coolDown = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#delta - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.delta = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaIndex - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.deltaIndex = 0; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaHistory - * @type {integer[]} - * @since 3.0.0 - */ - this.deltaHistory = []; - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#deltaSmoothingMax - * @type {integer} - * @default 10 - * @since 3.0.0 - */ - this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); - - /** - * [description] - * - * @name Phaser.Boot.TimeStep#panicMax - * @type {integer} - * @default 120 - * @since 3.0.0 - */ - this.panicMax = GetValue(config, 'panicMax', 120); - - /** - * The actual elapsed time in ms between one update and the next. - * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. - * So please be careful when using this value in calculations. - * - * @name Phaser.Boot.TimeStep#rawDelta - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.rawDelta = 0; - }, - - /** - * Called when the DOM window.onBlur event triggers. - * - * @method Phaser.Boot.TimeStep#blur - * @since 3.0.0 - */ - blur: function () - { - this.inFocus = false; - }, - - /** - * Called when the DOM window.onFocus event triggers. - * - * @method Phaser.Boot.TimeStep#focus - * @since 3.0.0 - */ - focus: function () - { - this.inFocus = true; - - this.resetDelta(); - }, - - /** - * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) - * - * @method Phaser.Boot.TimeStep#pause - * @since 3.0.0 - */ - pause: function () - { - this._pauseTime = window.performance.now(); - }, - - /** - * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) - * - * @method Phaser.Boot.TimeStep#resume - * @since 3.0.0 - */ - resume: function () - { - this.resetDelta(); - - this.startTime += this.time - this._pauseTime; - }, - - /** - * [description] - * - * @method Phaser.Boot.TimeStep#resetDelta - * @since 3.0.0 - */ - resetDelta: function () - { - var now = window.performance.now(); - - this.time = now; - this.lastTime = now; - this.nextFpsUpdate = now + 1000; - this.framesThisSecond = 0; - this.frame = 0; - - // Pre-populate smoothing array - - for (var i = 0; i < this.deltaSmoothingMax; i++) - { - this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); - } - - this.delta = 0; - this.deltaIndex = 0; - - this._coolDown = this.panicMax; - }, - - /** - * Starts the Time Step running, if it is not already doing so. - * Called automatically by the Game Boot process. - * - * @method Phaser.Boot.TimeStep#start - * @since 3.0.0 - * - * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. - */ - start: function (callback) - { - if (this.started) - { - return this; - } - - this.started = true; - this.running = true; - - for (var i = 0; i < this.deltaSmoothingMax; i++) - { - this.deltaHistory[i] = this._target; - } - - this.resetDelta(); - - this.startTime = window.performance.now(); - - this.callback = callback; - - this.raf.start(this.step.bind(this), this.forceSetTimeOut); - }, - - /** - * The main step method. This is called each time the browser updates, either by Request Animation Frame, - * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. - * You generally should never call this method directly. - * - * @method Phaser.Boot.TimeStep#step - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - */ - step: function (time) - { - this.frame++; - - var before = time - this.lastTime; - - if (before < 0) - { - // Because, Chrome. - before = 0; - } - - this.rawDelta = before; - - var idx = this.deltaIndex; - var history = this.deltaHistory; - var max = this.deltaSmoothingMax; - - // delta time (time is in ms) - var dt = before; - - // When a browser switches tab, then comes back again, it takes around 10 frames before - // the delta time settles down so we employ a 'cooling down' period before we start - // trusting the delta values again, to avoid spikes flooding through our delta average - - if (this._coolDown > 0 || !this.inFocus) - { - this._coolDown--; - - dt = Math.min(dt, this._target); - } - - if (dt > this._min) - { - // Probably super bad start time or browser tab context loss, - // so use the last 'sane' dt value - - dt = history[idx]; - - // Clamp delta to min (in case history has become corrupted somehow) - dt = Math.min(dt, this._min); - } - - // Smooth out the delta over the previous X frames - - // add the delta to the smoothing array - history[idx] = dt; - - // adjusts the delta history array index based on the smoothing count - // this stops the array growing beyond the size of deltaSmoothingMax - this.deltaIndex++; - - if (this.deltaIndex > max) - { - this.deltaIndex = 0; - } - - // Delta Average - var avg = 0; - - // Loop the history array, adding the delta values together - - for (var i = 0; i < max; i++) - { - avg += history[i]; - } - - // Then divide by the array length to get the average delta - avg /= max; - - // Set as the world delta value - this.delta = avg; - - // Real-world timer advance - this.time += this.rawDelta; - - // Update the estimate of the frame rate, `fps`. Every second, the number - // of frames that occurred in that second are included in an exponential - // moving average of all frames per second, with an alpha of 0.25. This - // means that more recent seconds affect the estimated frame rate more than - // older seconds. - // - // When a browser window is NOT minimized, but is covered up (i.e. you're using - // another app which has spawned a window over the top of the browser), then it - // will start to throttle the raf callback time. It waits for a while, and then - // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. - // So if the game was running at 60fps, and the player opens a new window, then - // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. - // - // When they make the game visible again, the frame rate is increased at a rate of - // approx. 8fps, back up to 60fps (or the max it can obtain) - // - // There is no easy way to determine if this drop in frame rate is because the - // browser is throttling raf, or because the game is struggling with performance - // because you're asking it to do too much on the device. - - if (time > this.nextFpsUpdate) - { - // Compute the new exponential moving average with an alpha of 0.25. - this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; - this.nextFpsUpdate = time + 1000; - this.framesThisSecond = 0; - } - - this.framesThisSecond++; - - // Interpolation - how far between what is expected and where we are? - var interpolation = avg / this._target; - - this.callback(time, avg, interpolation); - - // Shift time value over - this.lastTime = time; - }, - - /** - * Manually calls TimeStep.step, passing in the performance.now value to it. - * - * @method Phaser.Boot.TimeStep#tick - * @since 3.0.0 - */ - tick: function () - { - this.step(window.performance.now()); - }, - - /** - * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. - * - * @method Phaser.Boot.TimeStep#sleep - * @since 3.0.0 - */ - sleep: function () - { - if (this.running) - { - this.raf.stop(); - - this.running = false; - } - }, - - /** - * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. - * The `seamless` argument controls if the wake-up should adjust the start time or not. - * - * @method Phaser.Boot.TimeStep#wake - * @since 3.0.0 - * - * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. - */ - wake: function (seamless) - { - if (this.running) - { - this.sleep(); - } - else if (seamless) - { - this.startTime += -this.lastTime + (this.lastTime = window.performance.now()); - } - - this.raf.start(this.step.bind(this), this.useRAF); - - this.running = true; - - this.step(window.performance.now()); - }, - - /** - * Stops the TimeStep running. - * - * @method Phaser.Boot.TimeStep#stop - * @since 3.0.0 - * - * @return {Phaser.Boot.TimeStep} The TimeStep object. - */ - stop: function () - { - this.running = false; - this.started = false; - - this.raf.stop(); - - return this; - }, - - /** - * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null - * any objects. - * - * @method Phaser.Boot.TimeStep#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); - - this.callback = NOOP; - - this.raf = null; - this.game = null; - } - -}); - -module.exports = TimeStep; - - -/***/ }), -/* 879 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141693,12 +148157,12 @@ TextureImporter: /***/ }), -/* 880 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -141720,8 +148184,8 @@ var GetFastValue = __webpack_require__(2); * @param {object} config - An object describing how to parse the Sprite Sheet. * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. - * @param {number} [config.startFrame=0] - [description] - * @param {number} [config.endFrame=-1] - [description] + * @param {number} [config.startFrame=0] - Index of the start frame in the sprite sheet + * @param {number} [config.endFrame=-1] - Index of the end frame in the sprite sheet. -1 mean all the rest of the frames * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. * @@ -141815,27 +148279,33 @@ var SpriteSheetFromAtlas = function (texture, frame, config) { var destX = (leftRow) ? leftPad : 0; var destY = (topRow) ? topPad : 0; - var destWidth = frameWidth; - var destHeight = frameHeight; + + var trimWidth = 0; + var trimHeight = 0; if (leftRow) { - destWidth = leftWidth; + trimWidth += (frameWidth - leftWidth); } - else if (rightRow) + + if (rightRow) { - destWidth = rightWidth; + trimWidth += (frameWidth - rightWidth); } if (topRow) { - destHeight = topHeight; + trimHeight += (frameHeight - topHeight); } - else if (bottomRow) + + if (bottomRow) { - destHeight = bottomHeight; + trimHeight += (frameHeight - bottomHeight); } + var destWidth = frameWidth - trimWidth; + var destHeight = frameHeight - trimHeight; + sheetFrame.cutWidth = destWidth; sheetFrame.cutHeight = destHeight; @@ -141850,7 +148320,7 @@ var SpriteSheetFromAtlas = function (texture, frame, config) } else if (rightRow) { - frameX += rightRow; + frameX += rightWidth; } else { @@ -141884,12 +148354,12 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 881 */ +/* 905 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142009,16 +148479,16 @@ module.exports = SpriteSheet; /***/ }), -/* 882 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -142108,16 +148578,16 @@ module.exports = JSONHash; /***/ }), -/* 883 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(63); +var Clone = __webpack_require__(70); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -142215,12 +148685,12 @@ module.exports = JSONArray; /***/ }), -/* 884 */ +/* 908 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142250,12 +148720,12 @@ module.exports = Image; /***/ }), -/* 885 */ +/* 909 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142285,12 +148755,12 @@ module.exports = Canvas; /***/ }), -/* 886 */ +/* 910 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142366,19 +148836,20 @@ module.exports = AtlasXML; /***/ }), -/* 887 */ +/* 911 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Color = __webpack_require__(37); -var IsSizePowerOfTwo = __webpack_require__(117); -var Texture = __webpack_require__(165); +var Clamp = __webpack_require__(23); +var Color = __webpack_require__(32); +var IsSizePowerOfTwo = __webpack_require__(127); +var Texture = __webpack_require__(175); /** * @classdesc @@ -142594,6 +149065,148 @@ var CanvasTexture = new Class({ return this.update(); }, + /** + * Draws the given texture frame to this CanvasTexture, then updates the internal + * ImageData buffer and arrays. + * + * @method Phaser.Textures.CanvasTexture#drawFrame + * @since 3.16.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {integer} [x=0] - The x coordinate to draw the source at. + * @param {integer} [y=0] - The y coordinate to draw the source at. + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + drawFrame: function (key, frame, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + var textureFrame = this.manager.getFrame(key, frame); + + if (textureFrame) + { + var cd = textureFrame.canvasData; + + var width = textureFrame.cutWidth; + var height = textureFrame.cutHeight; + var res = textureFrame.source.resolution; + + this.context.drawImage( + textureFrame.source.image, + cd.x, cd.y, + width, + height, + x, y, + width / res, + height / res + ); + + return this.update(); + } + else + { + return this; + } + }, + + /** + * Sets a pixel in the CanvasTexture to the given color and alpha values. + * + * This is an expensive operation to run in large quantities, so use sparingly. + * + * @method Phaser.Textures.CanvasTexture#setPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @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=255] - The alpha value. A number between 0 and 255. + * + * @return {this} This CanvasTexture. + */ + setPixel: function (x, y, red, green, blue, alpha) + { + if (alpha === undefined) { alpha = 255; } + + x = Math.abs(Math.floor(x)); + y = Math.abs(Math.floor(y)); + + var index = this.getIndex(x, y); + + if (index > -1) + { + var imageData = this.context.getImageData(x, y, 1, 1); + + imageData.data[0] = red; + imageData.data[1] = green; + imageData.data[2] = blue; + imageData.data[3] = alpha; + + this.context.putImageData(imageData, x, y); + } + + return this; + }, + + /** + * Puts the ImageData into the context of this CanvasTexture at the given coordinates. + * + * @method Phaser.Textures.CanvasTexture#putData + * @since 3.16.0 + * + * @param {ImageData} imageData - The ImageData to put at the given location. + * @param {integer} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {integer} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. + * + * @return {this} This CanvasTexture. + */ + putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) + { + if (dirtyX === undefined) { dirtyX = 0; } + if (dirtyY === undefined) { dirtyY = 0; } + if (dirtyWidth === undefined) { dirtyWidth = imageData.width; } + if (dirtyHeight === undefined) { dirtyHeight = imageData.height; } + + this.context.putImageData(imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight); + + return this; + }, + + /** + * Gets an ImageData region from this CanvasTexture from the position and size specified. + * You can write this back using `CanvasTexture.putData`, or manipulate it. + * + * @method Phaser.Textures.CanvasTexture#getData + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {integer} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. + * + * @return {ImageData} The ImageData extracted from this CanvasTexture. + */ + getData: function (x, y, width, height) + { + x = Clamp(Math.floor(x), 0, this.width - 1); + y = Clamp(Math.floor(y), 0, this.height - 1); + width = Clamp(width, 1, this.width - x); + height = Clamp(height, 1, this.height - y); + + var imageData = this.context.getImageData(x, y, width, height); + + return imageData; + }, + /** * Get the color of a specific pixel from this texture and store it in a Color object. * @@ -142603,9 +149216,9 @@ var CanvasTexture = new Class({ * @method Phaser.Textures.CanvasTexture#getPixel * @since 3.13.0 * - * @param {integer} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {Phaser.Display.Color} [out] - An object into which 4 properties will be set: r, g, b and a. If not provided a Color object will be created. + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. * * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. */ @@ -142616,16 +149229,115 @@ var CanvasTexture = new Class({ out = new Color(); } - var index = ~~(x + (y * this.width)); + var index = this.getIndex(x, y); - index *= 4; + if (index > -1) + { + var data = this.data; - var r = this.data[index]; - var g = this.data[++index]; - var b = this.data[++index]; - var a = this.data[++index]; + var r = data[index + 0]; + var g = data[index + 1]; + var b = data[index + 2]; + var a = data[index + 3]; - return out.setTo(r, g, b, a); + out.setTo(r, g, b, a); + } + + return out; + }, + + /** + * An object containing the position and color data for a single pixel in a CanvasTexture. + * + * @typedef {object} PixelConfig + * + * @property {integer} x - The x-coordinate of the pixel. + * @property {integer} y - The y-coordinate of the pixel. + * @property {integer} color - The color of the pixel, not including the alpha channel. + * @property {float} alpha - The alpha of the pixel, between 0 and 1. + */ + + /** + * Returns an array containing all of the pixels in the given region. + * + * If the requested region extends outside the bounds of this CanvasTexture, + * the region is truncated to fit. + * + * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, + * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. + * + * @method Phaser.Textures.CanvasTexture#getPixels + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} width - The width of the region to get. Must be an integer. + * @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. + * + * @return {PixelConfig[]} An array of Pixel objects. + */ + getPixels: function (x, y, width, height) + { + if (height === undefined) { height = width; } + + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); + + var left = Clamp(x, 0, this.width); + var right = Clamp(x + width, 0, this.width); + var top = Clamp(y, 0, this.height); + var bottom = Clamp(y + height, 0, this.height); + + var pixel = new Color(); + + var out = []; + + for (var py = top; py < bottom; py++) + { + var row = []; + + for (var px = left; px < right; px++) + { + pixel = this.getPixel(px, py, pixel); + + row.push({ x: px, y: py, color: pixel.color, alpha: pixel.alphaGL }); + } + + out.push(row); + } + + return out; + }, + + /** + * Returns the Image Data index for the given pixel in this CanvasTexture. + * + * The index can be used to read directly from the `this.data` array. + * + * The index points to the red value in the array. The subsequent 3 indexes + * point to green, blue and alpha respectively. + * + * @method Phaser.Textures.CanvasTexture#getIndex + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @return {integer} + */ + getIndex: function (x, y) + { + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); + + if (x < this.width && y < this.height) + { + return (x + y * this.width) * 4; + } + else + { + return -1; + } }, /** @@ -142672,16 +149384,27 @@ var CanvasTexture = new Class({ }, /** - * Clears this Canvas Texture, resetting it back to transparent. + * Clears the given region of this Canvas Texture, resetting it back to transparent. + * If no region is given, the whole Canvas Texture is cleared. * * @method Phaser.Textures.CanvasTexture#clear * @since 3.7.0 + * + * @param {integer} [x=0] - The x coordinate of the top-left of the region to clear. + * @param {integer} [y=0] - The y coordinate of the top-left of the region to clear. + * @param {integer} [width] - The width of the region. + * @param {integer} [height] - The height of the region. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ - clear: function () + clear: function (x, y, width, height) { - this.context.clearRect(0, 0, this.width, this.height); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + + this.context.clearRect(x, y, width, height); return this.update(); }, @@ -142719,6 +149442,25 @@ var CanvasTexture = new Class({ } return this; + }, + + /** + * Destroys this Texture and releases references to its sources and frames. + * + * @method Phaser.Textures.CanvasTexture#destroy + * @since 3.16.0 + */ + destroy: function () + { + Texture.prototype.destroy.call(this); + + this._source = null; + this.canvas = null; + this.context = null; + this.imageData = null; + this.data = null; + this.pixels = null; + this.buffer = null; } }); @@ -142727,12 +149469,633 @@ module.exports = CanvasTexture; /***/ }), -/* 888 */ +/* 912 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Volume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their volume changes. + * + * Listen to it from a Sound instance using `Sound.on('volume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('volume', listener); + * music.play(); + * music.setVolume(0.5); + * ``` + * + * @event Phaser.Sound.Events#VOLUME + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} volume - The new volume of the Sound. + */ +module.exports = 'volume'; + + +/***/ }), +/* 913 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Unlocked Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched during the update loop when the Sound Manager becomes unlocked. For + * Web Audio this is on the first user gesture on the page. + * + * Listen to it from a Scene using: `this.sound.on('unlocked', listener)`. + * + * @event Phaser.Sound.Events#UNLOCKED + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'unlocked'; + + +/***/ }), +/* 914 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Stop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are stopped. + * + * Listen to it from a Sound instance using `Sound.on('stop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('stop', listener); + * music.play(); + * music.stop(); + * ``` + * + * @event Phaser.Sound.Events#STOP + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'stop'; + + +/***/ }), +/* 915 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Stop All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `stopAll` method is invoked and after all current Sounds + * have been stopped. + * + * Listen to it from a Scene using: `this.sound.on('stopall', listener)`. + * + * @event Phaser.Sound.Events#STOP_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'stopall'; + + +/***/ }), +/* 916 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Seek Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are seeked to a new position. + * + * Listen to it from a Sound instance using `Sound.on('seek', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('seek', listener); + * music.play(); + * music.setSeek(5000); + * ``` + * + * @event Phaser.Sound.Events#SEEK + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'seek'; + + +/***/ }), +/* 917 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Resume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are resumed from a paused state. + * + * Listen to it from a Sound instance using `Sound.on('resume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('resume', listener); + * music.play(); + * music.pause(); + * music.resume(); + * ``` + * + * @event Phaser.Sound.Events#RESUME + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'resume'; + + +/***/ }), +/* 918 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `resumeAll` method is invoked and after all current Sounds + * have been resumed. + * + * Listen to it from a Scene using: `this.sound.on('resumeall', listener)`. + * + * @event Phaser.Sound.Events#RESUME_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'resumeall'; + + +/***/ }), +/* 919 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Rate Change Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their rate changes. + * + * Listen to it from a Sound instance using `Sound.on('rate', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('rate', listener); + * music.play(); + * music.setRate(0.5); + * ``` + * + * @event Phaser.Sound.Events#RATE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} rate - The new rate of the Sound. + */ +module.exports = 'rate'; + + +/***/ }), +/* 920 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Play Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are played. + * + * Listen to it from a Sound instance using `Sound.on('play', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('play', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#PLAY + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'play'; + + +/***/ }), +/* 921 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Pause Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are paused. + * + * Listen to it from a Sound instance using `Sound.on('pause', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('pause', listener); + * music.play(); + * music.pause(); + * ``` + * + * @event Phaser.Sound.Events#PAUSE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'pause'; + + +/***/ }), +/* 922 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `pauseAll` method is invoked and after all current Sounds + * have been paused. + * + * Listen to it from a Scene using: `this.sound.on('pauseall', listener)`. + * + * @event Phaser.Sound.Events#PAUSE_ALL + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'pauseall'; + + +/***/ }), +/* 923 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Mute Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their mute state changes. + * + * Listen to it from a Sound instance using `Sound.on('mute', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('mute', listener); + * music.play(); + * music.setMute(true); + * ``` + * + * @event Phaser.Sound.Events#MUTE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound is now muted, otherwise `false`. + */ +module.exports = 'mute'; + + +/***/ }), +/* 924 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Looped Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they loop during playback. + * + * Listen to it from a Sound instance using `Sound.on('looped', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('looped', listener); + * music.setLoop(true); + * music.play(); + * ``` + * + * This is not to be confused with the [LOOP]{@linkcode Phaser.Sound.Events#event:LOOP} event, which only emits when the loop state of a Sound is changed. + * + * @event Phaser.Sound.Events#LOOPED + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'looped'; + + +/***/ }), +/* 925 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Loop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their loop state is changed. + * + * Listen to it from a Sound instance using `Sound.on('loop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('loop', listener); + * music.setLoop(true); + * ``` + * + * This is not to be confused with the [LOOPED]{@linkcode Phaser.Sound.Events#event:LOOPED} event, which emits each time a Sound loops during playback. + * + * @event Phaser.Sound.Events#LOOP + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} loop - The new loop value. `true` if the Sound will loop, otherwise `false`. + */ +module.exports = 'loop'; + + +/***/ }), +/* 926 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Volume Event. + * + * This event is dispatched by the Sound Manager when its `volume` property is changed, either directly + * or via the `setVolume` method. This changes the volume of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('volume', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_VOLUME + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {number} volume - The new global volume of the Sound Manager. + */ +module.exports = 'volume'; + + +/***/ }), +/* 927 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Rate Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `rate` property of the Sound Manager is changed, which globally + * adjusts the playback rate of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_RATE + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} rate - The updated rate value. + */ +module.exports = 'rate'; + + +/***/ }), +/* 928 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Mute Event. + * + * This event is dispatched by the Sound Manager when its `mute` property is changed, either directly + * or via the `setMute` method. This changes the mute state of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('mute', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_MUTE + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. + */ +module.exports = 'mute'; + + +/***/ }), +/* 929 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Detune Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `detune` property of the Sound Manager is changed, which globally + * adjusts the detuning of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_DETUNE + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} detune - The updated detune value. + */ +module.exports = 'detune'; + + +/***/ }), +/* 930 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Detune Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their detune value changes. + * + * Listen to it from a Sound instance using `Sound.on('detune', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('detune', listener); + * music.play(); + * music.setDetune(200); + * ``` + * + * @event Phaser.Sound.Events#DETUNE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'detune'; + + +/***/ }), +/* 931 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Destroy Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are destroyed, either + * directly or via a Sound Manager. + * + * Listen to it from a Sound instance using `Sound.on('destroy', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('destroy', listener); + * music.destroy(); + * ``` + * + * @event Phaser.Sound.Events#DESTROY + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 932 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Complete Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they complete playback. + * + * Listen to it from a Sound instance using `Sound.on('complete', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('complete', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#COMPLETE + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'complete'; + + +/***/ }), +/* 933 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142754,6 +150117,7 @@ var InjectionMap = { cache: 'cache', plugins: 'plugins', registry: 'registry', + scale: 'scale', sound: 'sound', textures: 'textures', @@ -142787,12 +150151,12 @@ module.exports = InjectionMap; /***/ }), -/* 889 */ +/* 934 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -142804,9 +150168,9 @@ var GetFastValue = __webpack_require__(2); * @function Phaser.Scenes.GetScenePlugins * @since 3.0.0 * - * @param {Phaser.Scenes.Systems} sys - [description] + * @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins. * - * @return {array} [description] + * @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object. */ var GetScenePlugins = function (sys) { @@ -142834,17 +150198,17 @@ module.exports = GetScenePlugins; /***/ }), -/* 890 */ +/* 935 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(327); +var UppercaseFirst = __webpack_require__(330); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -142896,137 +150260,5252 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 891 */ +/* 936 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Start Event. + * + * This event is dispatched when the Loader starts running. At this point load progress is zero. + * + * This event is dispatched even if there aren't any files in the load queue. + * + * Listen to it from a Scene using: `this.load.on('start', listener)`. + * + * @event Phaser.Loader.Events#START + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'start'; + + +/***/ }), +/* 937 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Progress Event. + * + * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading. + * + * Listen to it from a Scene using: `this.load.on('progress', listener)`. + * + * @event Phaser.Loader.Events#PROGRESS + * + * @param {number} progress - The current progress of the load. A value between 0 and 1. + */ +module.exports = 'progress'; + + +/***/ }), +/* 938 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Post Process Event. + * + * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue. + * It is dispatched before the internal lists are cleared and each File is destroyed. + * + * Use this hook to perform any last minute processing of files that can only happen once the + * Loader has completed, but prior to it emitting the `complete` event. + * + * Listen to it from a Scene using: `this.load.on('postprocess', listener)`. + * + * @event Phaser.Loader.Events#POST_PROCESS + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'postprocess'; + + +/***/ }), +/* 939 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Progress Event. + * + * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and + * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen. + * + * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`. + * + * @event Phaser.Loader.Events#FILE_PROGRESS + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + * @param {number} percentComplete - A value between 0 and 1 indicating how 'complete' this file is. + */ +module.exports = 'fileprogress'; + + +/***/ }), +/* 940 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Event. + * + * This event is dispatched by the Loader Plugin when a file finishes loading, + * but _before_ it is processed and added to the internal Phaser caches. + * + * Listen to it from a Scene using: `this.load.on('load', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD + * + * @param {Phaser.Loader.File} file - A reference to the File which just finished loading. + */ +module.exports = 'load'; + + +/***/ }), +/* 941 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Error Event. + * + * This event is dispatched by the Loader Plugin when a file fails to load. + * + * Listen to it from a Scene using: `this.load.on('loaderror', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD_ERROR + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + */ +module.exports = 'loaderror'; + + +/***/ }), +/* 942 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * It uses a special dynamic event name constructed from the key and type of the file. + * + * For example, if you have loaded an `image` with a key of `monster`, you can listen for it + * using the following: + * + * ```javascript + * this.load.on('filecomplete-image-monster', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a texture `atlas` with a key of `Level1`: + * + * ```javascript + * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: + * + * ```javascript + * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_KEY_COMPLETE + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete-'; + + +/***/ }), +/* 943 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`. + * + * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_COMPLETE + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete'; + + +/***/ }), +/* 944 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Complete Event. + * + * This event is dispatched when the Loader has fully processed everything in the load queue. + * By this point every loaded file will now be in its associated cache and ready for use. + * + * Listen to it from a Scene using: `this.load.on('complete', listener)`. + * + * @event Phaser.Loader.Events#COMPLETE + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {integer} totalComplete - The total number of files that successfully loaded. + * @param {integer} totalFailed - The total number of files that failed to load. + */ +module.exports = 'complete'; + + +/***/ }), +/* 945 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Add File Event. + * + * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue. + * + * Listen to it from a Scene using: `this.load.on('addfile', listener)`. + * + * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them. + * + * @event Phaser.Loader.Events#ADD + * + * @param {string} key - The unique key of the file that was added to the Loader. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} string of the file that was added to the Loader, i.e. `image`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {Phaser.Loader.File} file - A reference to the File which was added to the Loader. + */ +module.exports = 'addfile'; + + +/***/ }), +/* 946 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetInnerHeight = function (iOS) +{ + // Based on code by @tylerjpeterson + + if (!iOS) + { + return window.innerHeight; + } + + var axis = Math.abs(window.orientation); + + var size = { w: 0, h: 0 }; + + var ruler = document.createElement('div'); + + ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); + + document.documentElement.appendChild(ruler); + + size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; + size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; + + document.documentElement.removeChild(ruler); + + ruler = null; + + if (Math.abs(window.orientation) !== 90) + { + return size.h; + } + else + { + return size.w; + } +}; + +module.exports = GetInnerHeight; + + +/***/ }), +/* 947 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * This event is dispatched whenever the Scale Manager detects a resize event from the browser. + * It sends three parameters to the callback, each of them being Size components. You can read + * the `width`, `height`, `aspectRatio` and other properties of these components to help with + * scaling your own game content. + * + * @event Phaser.Scale.Events#RESIZE + * + * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size multiplied by resolution. + * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. + */ +module.exports = 'resize'; + + +/***/ }), +/* 948 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#ORIENTATION_CHANGE + * + * @param {string} orientation - + */ +module.exports = 'orientationchange'; + + +/***/ }), +/* 949 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#LEAVE_FULLSCREEN + */ +module.exports = 'leavefullscreen'; + + +/***/ }), +/* 950 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + */ +module.exports = 'fullscreenunsupported'; + + +/***/ }), +/* 951 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * @event Phaser.Scale.Events#ENTER_FULLSCREEN + */ +module.exports = 'enterfullscreen'; + + +/***/ }), +/* 952 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `update` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#UPDATE + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; + + +/***/ }), +/* 953 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Start Event. + * + * This internal event is dispatched by the Input Plugin when it has finished setting-up, + * signalling to all of its internal systems to start. + * + * @event Phaser.Input.Events#START + */ +module.exports = 'start'; + + +/***/ }), +/* 954 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Shutdown Event. + * + * This internal event is dispatched by the Input Plugin when it shuts down, signalling to all of its systems to shut themselves down. + * + * @event Phaser.Input.Events#SHUTDOWN + */ +module.exports = 'shutdown'; + + +/***/ }), +/* 955 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Pre-Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `preUpdate` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#PRE_UPDATE + */ +module.exports = 'preupdate'; + + +/***/ }), +/* 956 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Pointer Lock Change Event. + * + * This event is dispatched by the Input Manager when it is processing a native Pointer Lock Change DOM Event. + * + * @event Phaser.Input.Events#POINTERLOCK_CHANGE + * + * @param {Event} event - The native DOM Event. + * @param {boolean} locked - The locked state of the Mouse Pointer. + */ +module.exports = 'pointerlockchange'; + + +/***/ }), +/* 957 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerupoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP_OUTSIDE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerupoutside'; + + +/***/ }), +/* 958 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerup'; + + +/***/ }), +/* 959 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerover', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOver - An array containing all interactive Game Objects that the pointer moved over when the event was created. + */ +module.exports = 'pointerover'; + + +/***/ }), +/* 960 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOut - An array containing all interactive Game Objects that the pointer moved out of when the event was created. + */ +module.exports = 'pointerout'; + + +/***/ }), +/* 961 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointermove', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointermove'; + + +/***/ }), +/* 962 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdownoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN_OUTSIDE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerdownoutside'; + + +/***/ }), +/* 963 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdown', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerdown'; + + +/***/ }), +/* 964 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Update Event. + * + * This internal event is dispatched by the Input Manager as part of its update step. + * + * @event Phaser.Input.Events#MANAGER_UPDATE + */ +module.exports = 'update'; + + +/***/ }), +/* 965 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Process Event. + * + * This internal event is dispatched by the Input Manager when not using the legacy queue system, + * and it wants the Input Plugins to update themselves. + * + * @event Phaser.Input.Events#MANAGER_PROCESS + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'process'; + + +/***/ }), +/* 966 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Boot Event. + * + * This internal event is dispatched by the Input Manager when it boots. + * + * @event Phaser.Input.Events#MANAGER_BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 967 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released while over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectup', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when released. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectup'; + + +/***/ }), +/* 968 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Up Event. + * + * This event is dispatched by an interactive Game Object if a pointer is released while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerup', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerup'; + + +/***/ }), +/* 969 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerover'; + + +/***/ }), +/* 970 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Out Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves out of it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerout', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerout'; + + +/***/ }), +/* 971 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Move Event. + * + * This event is dispatched by an interactive Game Object if a pointer is moved while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointermove', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointermove'; + + +/***/ }), +/* 972 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Down Event. + * + * This event is dispatched by an interactive Game Object if a pointer is pressed down on it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerdown', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerdown'; + + +/***/ }), +/* 973 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectover', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved over. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectover'; + + +/***/ }), +/* 974 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectout', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OUT + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved out of. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectout'; + + +/***/ }), +/* 975 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved across _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectmove', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_MOVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was moved on. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectmove'; + + +/***/ }), +/* 976 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drop Event. + * + * This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target. + * + * Listen to this event from a Game Object using: `gameObject.on('drop', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DROP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; + + +/***/ }), +/* 977 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Start Event. + * + * This event is dispatched by an interactive Game Object if a pointer starts to drag it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragstart', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * There are lots of useful drag related properties that are set within the Game Object when dragging occurs. + * For example, `gameObject.input.dragStartX`, `dragStartY` and so on. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_START + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 978 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it over a drag target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from a Game Object using: `gameObject.on('dragover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; + + +/***/ }), +/* 979 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Leave Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragleave', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; + + +/***/ }), +/* 980 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves while dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('drag', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; + + +/***/ }), +/* 981 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Enter Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it into a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragenter', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; + + +/***/ }), +/* 982 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag End Event. + * + * This event is dispatched by an interactive Game Object if a pointer stops dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragend', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive](Phaser.GameObjects.GameObject#setInteractive) for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_END + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer stopped dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer stopped dragging the Game Object, in world space. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 983 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down on _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectdown', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_DOWN + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was pressed down on. + * @param {Phaser.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectdown'; + + +/***/ }), +/* 984 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Over Event. + * + * This event is dispatched by the Input Plugin if the active pointer enters the game canvas and is now + * over of it, having previously been elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameover', listener)`. + * + * @event Phaser.Input.Events#GAME_OVER + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas over. + */ +module.exports = 'gameover'; + + +/***/ }), +/* 985 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Out Event. + * + * This event is dispatched by the Input Plugin if the active pointer leaves the game canvas and is now + * outside of it, elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameout', listener)`. + * + * @event Phaser.Input.Events#GAME_OUT + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas out. + */ +module.exports = 'gameout'; + + +/***/ }), +/* 986 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drop Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drops a Game Object on a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('drop', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DROP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DROP} event instead. + * + * @event Phaser.Input.Events#DROP + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer was dragging. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; + + +/***/ }), +/* 987 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Start Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer starts to drag any Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragstart', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_START]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_START} event instead. + * + * @event Phaser.Input.Events#DRAG_START + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 988 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object over a Drag Target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from within a Scene using: `this.input.on('dragover', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_OVER} event instead. + * + * @event Phaser.Input.Events#DRAG_OVER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; + + +/***/ }), +/* 989 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Leave Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object out of a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragleave', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_LEAVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_LEAVE} event instead. + * + * @event Phaser.Input.Events#DRAG_LEAVE + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; + + +/***/ }), +/* 990 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves while dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('drag', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG} event instead. + * + * @event Phaser.Input.Events#DRAG + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; + + +/***/ }), +/* 991 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Enter Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object into a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragenter', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_ENTER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_ENTER} event instead. + * + * @event Phaser.Input.Events#DRAG_ENTER + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; + + +/***/ }), +/* 992 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag End Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer stops dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragend', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_END]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_END} event instead. + * + * @event Phaser.Input.Events#DRAG_END + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer stopped dragging. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 993 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Destroy Event. + * + * This internal event is dispatched by the Input Plugin when it is destroyed, signalling to all of its systems to destroy themselves. + * + * @event Phaser.Input.Events#DESTROY + */ +module.exports = 'destroy'; + + +/***/ }), +/* 994 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Boot Event. + * + * This internal event is dispatched by the Input Plugin when it boots, signalling to all of its systems to create themselves. + * + * @event Phaser.Input.Events#BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 995 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = __webpack_require__(26); +var AddToDOM = __webpack_require__(179); +var AnimationManager = __webpack_require__(415); +var CacheManager = __webpack_require__(412); +var CanvasPool = __webpack_require__(24); +var Class = __webpack_require__(0); +var Config = __webpack_require__(390); +var CreateRenderer = __webpack_require__(367); +var DataManager = __webpack_require__(134); +var DebugHeader = __webpack_require__(365); +var Device = __webpack_require__(389); +var DOMContentLoaded = __webpack_require__(351); +var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(26); +var InputManager = __webpack_require__(342); +var PluginCache = __webpack_require__(17); +var PluginManager = __webpack_require__(336); +var ScaleManager = __webpack_require__(335); +var SceneManager = __webpack_require__(332); +var SoundManagerCreator = __webpack_require__(328); +var TextureEvents = __webpack_require__(126); +var TextureManager = __webpack_require__(321); +var TimeStep = __webpack_require__(364); +var VisibilityHandler = __webpack_require__(362); + +if (false) +{ var CreateDOMContainer; } + +if (false) +{ var FacebookInstantGamesPlugin; } /** - * Called automatically by Phaser.Game and responsible for creating the console.log debug header. + * @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 can customize or disable the header via the Game Config object. + * 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. * - * @function Phaser.Boot.DebugHeader + * @class Game + * @memberof Phaser + * @constructor + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE * @since 3.0.0 * - * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. + * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. */ -var DebugHeader = function (game) -{ - var config = game.config; +var Game = new Class({ - if (config.hideBanner) + initialize: + + function Game (config) { - return; - } + /** + * 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.Core.Config} + * @readonly + * @since 3.0.0 + */ + this.config = new Config(config); - var renderType = 'WebGL'; + /** + * 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; - if (config.renderType === CONST.CANVAS) + if (false) + {} + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * This is created automatically by Phaser unless you provide a `canvas` property + * in your Game Config. + * + * @name Phaser.Game#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = null; + + /** + * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. + * If the game is running under Canvas it will be a 2d Canvas Rendering Context. + * If the game is running under WebGL it will be a WebGL Rendering Context. + * This context is created automatically by Phaser unless you provide a `context` property + * in your Game Config. + * + * @name Phaser.Game#context + * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} + * @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 {Phaser.Events.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); + + /** + * An instance of the Data Manager + * + * @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); + + /** + * 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.DeviceConf} + * @since 3.0.0 + */ + this.device = Device; + + /** + * An instance of the Scale Manager. + * + * The Scale Manager is a global system responsible for handling scaling of the game canvas. + * + * @name Phaser.Game#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scale = new ScaleManager(this, this.config); + + /** + * 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.Sound.BaseSoundManager} + * @since 3.0.0 + */ + this.sound = SoundManagerCreator.create(this); + + /** + * 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.Core.TimeStep} + * @since 3.0.0 + */ + this.loop = new TimeStep(this, this.config.fps); + + /** + * 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.Plugins.PluginManager} + * @since 3.0.0 + */ + this.plugins = new PluginManager(this, this.config); + + if (false) + {} + + /** + * Is this Game pending destruction at the start of the next frame? + * + * @name Phaser.Game#pendingDestroy + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.pendingDestroy = false; + + /** + * Remove the Canvas once the destroy is over? + * + * @name Phaser.Game#removeCanvas + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.removeCanvas = false; + + /** + * Remove everything when the game is destroyed. + * You cannot create a new Phaser instance on the same web page after doing this. + * + * @name Phaser.Game#noReturn + * @type {boolean} + * @private + * @since 3.12.0 + */ + this.noReturn = false; + + /** + * Does the window the game is running in currently have focus or not? + * This is modified by the VisibilityHandler. + * + * @name Phaser.Game#hasFocus + * @type {boolean} + * @readonly + * @since 3.9.0 + */ + this.hasFocus = false; + + // Wait for the DOM Ready event, then call boot. + DOMContentLoaded(this.boot.bind(this)); + }, + + /** + * 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.Core.Events#BOOT + * @listens Phaser.Textures.Events#READY + * @since 3.0.0 + */ + boot: function () { - renderType = 'Canvas'; - } - else if (config.renderType === CONST.HEADLESS) - { - renderType = 'Headless'; - } - - var audioConfig = config.audio; - var deviceAudio = game.device.audio; - - var audioType; - - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) - { - audioType = 'Web Audio'; - } - else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) - { - audioType = 'No Audio'; - } - else - { - audioType = 'HTML5 Audio'; - } - - if (!game.device.browser.ie) - { - var c = ''; - var args = [ c ]; - - if (Array.isArray(config.bannerBackgroundColor)) + if (!PluginCache.hasCore('EventEmitter')) { - var lastColor; + console.warn('Aborting. Core Plugins missing.'); + return; + } - config.bannerBackgroundColor.forEach(function (color) - { - c = c.concat('%c '); + this.isBooted = true; - args.push('background: ' + color); + this.config.preBoot(this); - lastColor = color; + this.scale.preBoot(); - }); + CreateRenderer(this); - // inject the text color - args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + if (false) + {} + + DebugHeader(this); + + AddToDOM(this.canvas, this.config.parent); + + // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready. + // So it will emit this internal event when done: + this.textures.once(TextureEvents.READY, this.texturesReady, this); + + this.events.emit(Events.BOOT); + }, + + /** + * Called automatically when the Texture Manager has finished setting up and preparing the + * default textures. + * + * @method Phaser.Game#texturesReady + * @private + * @fires Phaser.Game#ready + * @since 3.12.0 + */ + texturesReady: function () + { + // Start all the other systems + this.events.emit(Events.READY); + + this.start(); + }, + + /** + * 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; + + this.config.postBoot(this); + + if (this.renderer) + { + this.loop.start(this.step.bind(this)); } else { - c = c.concat('%c '); - - args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + this.loop.start(this.headlessStep.bind(this)); } - // URL link background color (always white) - args.push('background: #fff'); + VisibilityHandler(this); - if (config.gameTitle) - { - c = c.concat(config.gameTitle); + var eventEmitter = this.events; - if (config.gameVersion) - { - c = c.concat(' v' + config.gameVersion); - } + eventEmitter.on(Events.HIDDEN, this.onHidden, this); + eventEmitter.on(Events.VISIBLE, this.onVisible, this); + eventEmitter.on(Events.BLUR, this.onBlur, this); + eventEmitter.on(Events.FOCUS, this.onFocus, this); + }, - if (!config.hidePhaser) - { - c = c.concat(' / '); - } - } - - var fb = ( false) ? undefined : ''; - - if (!config.hidePhaser) - { - c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); - } - - c = c.concat(' %c ' + config.gameURL); - - // Inject the new string back into the args array - args[0] = c; - - console.log.apply(console, args); - } - else if (window['console']) + /** + * 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.Core.Events#PRE_STEP_EVENT + * @fires Phaser.Core.Events#STEP_EVENT + * @fires Phaser.Core.Events#POST_STEP_EVENT + * @fires Phaser.Core.Events#PRE_RENDER_EVENT + * @fires Phaser.Core.Events#POST_RENDER_EVENT + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + step: function (time, delta) { - console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); - } -}; + if (this.pendingDestroy) + { + return this.runDestroy(); + } -module.exports = DebugHeader; + var eventEmitter = this.events; + + // Global Managers like Input and Sound update in the prestep + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + // This is mostly meant for user-land code and plugins + + eventEmitter.emit(Events.STEP, time, delta); + + // Update the Scene Manager and all active Scenes + + this.scene.update(time, delta); + + // Our final event before rendering starts + + eventEmitter.emit(Events.POST_STEP, time, delta); + + var renderer = this.renderer; + + // Run the Pre-render (clearing the canvas, setting background colors, etc) + + renderer.preRender(); + + eventEmitter.emit(Events.PRE_RENDER, renderer, time, delta); + + // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. + + this.scene.render(renderer); + + // The Post-Render call. Tidies up loose end, takes snapshots, etc. + + renderer.postRender(); + + // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. + + eventEmitter.emit(Events.POST_RENDER, renderer, time, delta); + }, + + /** + * 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 {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + headlessStep: function (time, delta) + { + var eventEmitter = this.events; + + // Global Managers + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + eventEmitter.emit(Events.STEP, time, delta); + + // Scenes + + this.scene.update(time, delta); + + eventEmitter.emit(Events.POST_STEP, time, delta); + + // Render + + eventEmitter.emit(Events.PRE_RENDER); + + eventEmitter.emit(Events.POST_RENDER); + }, + + /** + * 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.Core.Events#PAUSE + * @since 3.0.0 + */ + onHidden: function () + { + this.loop.pause(); + + this.events.emit(Events.PAUSE); + }, + + /** + * Called automatically by the Visibility Handler. + * This will resume the main loop and then emit a resume event. + * + * @method Phaser.Game#onVisible + * @protected + * @fires Phaser.Core.Events#RESUME + * @since 3.0.0 + */ + onVisible: function () + { + this.loop.resume(); + + this.events.emit(Events.RESUME); + }, + + /** + * 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.hasFocus = false; + + this.loop.blur(); + }, + + /** + * 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.hasFocus = true; + + this.loop.focus(); + }, + + /** + * Returns the current game frame. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * + * @method Phaser.Game#getFrame + * @since 3.16.0 + * + * @return {number} The current game frame. + */ + getFrame: function () + { + return this.loop.frame; + }, + + /** + * Returns the current game timestamp. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * + * @method Phaser.Game#getTime + * @since 3.16.0 + * + * @return {number} The current game timestamp. + */ + getTime: function () + { + return this.loop.frame.time; + }, + + /** + * Flags this Game instance as needing to be destroyed on the next frame. + * It will wait until the current frame has completed and then call `runDestroy` internally. + * + * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up + * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. + * + * @method Phaser.Game#destroy + * @fires Phaser.Core.Events#DESTROY + * @since 3.0.0 + * + * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. + * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. + */ + destroy: function (removeCanvas, noReturn) + { + if (noReturn === undefined) { noReturn = false; } + + this.pendingDestroy = true; + + this.removeCanvas = removeCanvas; + this.noReturn = noReturn; + }, + + /** + * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * + * @method Phaser.Game#runDestroy + * @private + * @since 3.5.0 + */ + runDestroy: function () + { + this.events.emit(Events.DESTROY); + + this.events.removeAllListeners(); + + this.scene.destroy(); + + if (this.renderer) + { + this.renderer.destroy(); + } + + if (this.removeCanvas && this.canvas) + { + CanvasPool.remove(this.canvas); + + if (this.canvas.parentNode) + { + this.canvas.parentNode.removeChild(this.canvas); + } + } + + if (false) + {} + + this.loop.destroy(); + + this.pendingDestroy = false; + } + +}); + +module.exports = Game; + +/** + * "Computers are good at following instructions, but not at reading your mind." - Donald Knuth + */ /***/ }), -/* 892 */ +/* 996 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var EE = __webpack_require__(11); +var PluginCache = __webpack_require__(17); + +/** + * @classdesc + * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. + * + * @class EventEmitter + * @memberof Phaser.Events + * @constructor + * @since 3.0.0 + */ +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 () + { + this.removeAllListeners(); + } + +}); + +/** + * Return an array listing the events for which the emitter has registered listeners. + * + * @method Phaser.Events.EventEmitter#eventNames + * @since 3.0.0 + * + * @return {array} + */ + +/** + * Return the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#listeners + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {array} The registered listeners. + */ + +/** + * Return the number of listeners listening to a given event. + * + * @method Phaser.Events.EventEmitter#listenerCount + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {number} The number of listeners. + */ + +/** + * Calls each of the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#emit + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {...*} [args] - Additional arguments that will be passed to the event handler. + * + * @return {boolean} `true` if the event had listeners, else `false`. + */ + +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#on + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#addListener + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Add a one-time listener for a given event. + * + * @method Phaser.Events.EventEmitter#once + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#removeListener + * @since 3.0.0 + * + * @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 {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#off + * @since 3.0.0 + * + * @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 {Phaser.Events.EventEmitter} `this`. + */ + +/** + * Remove all listeners, or those of the specified event. + * + * @method Phaser.Events.EventEmitter#removeAllListeners + * @since 3.0.0 + * + * @param {(string|symbol)} [event] - The event name. + * + * @return {Phaser.Events.EventEmitter} `this`. + */ + +PluginCache.register('EventEmitter', EventEmitter, 'events'); + +module.exports = EventEmitter; + + +/***/ }), +/* 997 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Events + */ + +module.exports = { EventEmitter: __webpack_require__(996) }; + + +/***/ }), +/* 998 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.DOM + */ + +var Dom = { + + AddToDOM: __webpack_require__(179), + DOMContentLoaded: __webpack_require__(351), + GetScreenOrientation: __webpack_require__(350), + GetTarget: __webpack_require__(345), + ParseXML: __webpack_require__(344), + RemoveFromDOM: __webpack_require__(343), + RequestAnimationFrame: __webpack_require__(363) + +}; + +module.exports = Dom; + + +/***/ }), +/* 999 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Masks + */ + +module.exports = { + + BitmapMask: __webpack_require__(426), + GeometryMask: __webpack_require__(425) + +}; + + +/***/ }), +/* 1000 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ComponentToHex = __webpack_require__(353); + +/** + * 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 (prefix === '#') + { + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + } + else + { + return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + } +}; + +module.exports = RGBToString; + + +/***/ }), +/* 1001 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Between = __webpack_require__(184); +var Color = __webpack_require__(32); + +/** + * 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; } + + return new Color(Between(min, max), Between(min, max), Between(min, max)); +}; + +module.exports = RandomRGB; + + +/***/ }), +/* 1002 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Linear = __webpack_require__(129); + +/** + * @namespace Phaser.Display.Color.Interpolate + * @memberof Phaser.Display.Color + * @since 3.0.0 + */ + +/** + * Interpolates between the two given color ranges over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + var t = index / length; + + return { + r: Linear(r1, r2, t), + g: Linear(g1, g2, t), + b: Linear(b1, b2, t) + }; +}; + +/** + * Interpolates between the two given color objects over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + 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 + * @memberof Phaser.Display.Color.Interpolate + * @static + * @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; } + + return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); +}; + +module.exports = { + + RGBWithRGB: RGBWithRGB, + ColorWithRGB: ColorWithRGB, + ColorWithColor: ColorWithColor + +}; + + +/***/ }), +/* 1003 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var HSVToRGB = __webpack_require__(190); + +/** + * 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 {ColorObject[]} 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++) + { + colors.push(HSVToRGB(c / 359, s, v)); + } + + return colors; +}; + +module.exports = HSVColorWheel; + + +/***/ }), +/* 1004 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Color = __webpack_require__(32); +var HueToComponent = __webpack_require__(352); + +/** + * 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 q = (l < 0.5) ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + + r = HueToComponent(p, q, h + 1 / 3); + g = HueToComponent(p, q, h); + b = HueToComponent(p, q, h - 1 / 3); + } + + var color = new Color(); + + return color.setGLTo(r, g, b, 1); +}; + +module.exports = HSLToColor; + + +/***/ }), +/* 1005 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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) + { + output.a = color >>> 24; + } + + return output; +}; + +module.exports = ColorToRGBA; + + +/***/ }), +/* 1006 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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'; } + + var vendors = [ + '-webkit-', + '-khtml-', + '-moz-', + '-ms-', + '' + ]; + + vendors.forEach(function (vendor) + { + canvas.style[vendor + 'user-select'] = value; + }); + + canvas.style['-webkit-touch-callout'] = value; + canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; + + return canvas; +}; + +module.exports = UserSelect; + + +/***/ }), +/* 1007 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = TouchAction; + + +/***/ }), +/* 1008 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Canvas + */ + +module.exports = { + + CanvasInterpolation: __webpack_require__(366), + CanvasPool: __webpack_require__(24), + Smoothing: __webpack_require__(130), + TouchAction: __webpack_require__(1007), + UserSelect: __webpack_require__(1006) + +}; + + +/***/ }), +/* 1009 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = GetOffsetY; + + +/***/ }), +/* 1010 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * 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; +}; + +module.exports = GetOffsetX; + + +/***/ }), +/* 1011 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Bounds + */ + +module.exports = { + + CenterOn: __webpack_require__(444), + GetBottom: __webpack_require__(51), + GetCenterX: __webpack_require__(81), + GetCenterY: __webpack_require__(78), + GetLeft: __webpack_require__(49), + GetOffsetX: __webpack_require__(1010), + GetOffsetY: __webpack_require__(1009), + GetRight: __webpack_require__(47), + GetTop: __webpack_require__(45), + SetBottom: __webpack_require__(50), + SetCenterX: __webpack_require__(80), + SetCenterY: __webpack_require__(79), + SetLeft: __webpack_require__(48), + SetRight: __webpack_require__(46), + SetTop: __webpack_require__(44) + +}; + + +/***/ }), +/* 1012 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(47); +var GetTop = __webpack_require__(45); +var SetBottom = __webpack_require__(50); +var SetRight = __webpack_require__(46); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopRight; + + +/***/ }), +/* 1013 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetLeft = __webpack_require__(49); +var GetTop = __webpack_require__(45); +var SetBottom = __webpack_require__(50); +var SetLeft = __webpack_require__(48); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopLeft; + + +/***/ }), +/* 1014 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterX = __webpack_require__(81); +var GetTop = __webpack_require__(45); +var SetBottom = __webpack_require__(50); +var SetCenterX = __webpack_require__(80); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopCenter; + + +/***/ }), +/* 1015 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(47); +var GetTop = __webpack_require__(45); +var SetLeft = __webpack_require__(48); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = RightTop; + + +/***/ }), +/* 1016 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterY = __webpack_require__(78); +var GetRight = __webpack_require__(47); +var SetCenterY = __webpack_require__(79); +var SetLeft = __webpack_require__(48); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = RightCenter; + + +/***/ }), +/* 1017 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetRight = __webpack_require__(47); +var SetBottom = __webpack_require__(50); +var SetLeft = __webpack_require__(48); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = RightBottom; + + +/***/ }), +/* 1018 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetLeft = __webpack_require__(49); +var GetTop = __webpack_require__(45); +var SetRight = __webpack_require__(46); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = LeftTop; + + +/***/ }), +/* 1019 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetCenterY = __webpack_require__(78); +var GetLeft = __webpack_require__(49); +var SetCenterY = __webpack_require__(79); +var SetRight = __webpack_require__(46); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftCenter; + + +/***/ }), +/* 1020 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetLeft = __webpack_require__(49); +var SetBottom = __webpack_require__(50); +var SetRight = __webpack_require__(46); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftBottom; + + +/***/ }), +/* 1021 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetRight = __webpack_require__(47); +var SetRight = __webpack_require__(46); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomRight; + + +/***/ }), +/* 1022 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetLeft = __webpack_require__(49); +var SetLeft = __webpack_require__(48); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomLeft; + + +/***/ }), +/* 1023 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetBottom = __webpack_require__(51); +var GetCenterX = __webpack_require__(81); +var SetCenterX = __webpack_require__(80); +var SetTop = __webpack_require__(44); + +/** + * 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 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @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; } + + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomCenter; + + +/***/ }), +/* 1024 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.To + */ + +module.exports = { + + BottomCenter: __webpack_require__(1023), + BottomLeft: __webpack_require__(1022), + BottomRight: __webpack_require__(1021), + LeftBottom: __webpack_require__(1020), + LeftCenter: __webpack_require__(1019), + LeftTop: __webpack_require__(1018), + RightBottom: __webpack_require__(1017), + RightCenter: __webpack_require__(1016), + RightTop: __webpack_require__(1015), + TopCenter: __webpack_require__(1014), + TopLeft: __webpack_require__(1013), + TopRight: __webpack_require__(1012) + +}; + + +/***/ }), +/* 1025 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.In + */ + +module.exports = { + + BottomCenter: __webpack_require__(448), + BottomLeft: __webpack_require__(447), + BottomRight: __webpack_require__(446), + Center: __webpack_require__(445), + LeftCenter: __webpack_require__(443), + QuickSet: __webpack_require__(449), + RightCenter: __webpack_require__(442), + TopCenter: __webpack_require__(441), + TopLeft: __webpack_require__(440), + TopRight: __webpack_require__(439) + +}; + + +/***/ }), +/* 1026 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(208); +var Extend = __webpack_require__(19); + +/** + * @namespace Phaser.Display.Align + */ + +var Align = { + + In: __webpack_require__(1025), + To: __webpack_require__(1024) + +}; + +// Merge in the consts +Align = Extend(false, Align, CONST); + +module.exports = Align; + + +/***/ }), +/* 1027 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Display + */ + +module.exports = { + + Align: __webpack_require__(1026), + Bounds: __webpack_require__(1011), + Canvas: __webpack_require__(1008), + Color: __webpack_require__(354), + Masks: __webpack_require__(999) + +}; + + +/***/ }), +/* 1028 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(134); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); + +/** + * @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 - A reference to the Scene that this DataManager belongs to. + */ +var DataManagerPlugin = new Class({ + + Extends: DataManager, + + initialize: + + function DataManagerPlugin (scene) + { + DataManager.call(this, scene, scene.sys.events); + + /** + * A reference to the Scene that this DataManager belongs to. + * + * @name Phaser.Data.DataManagerPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * A reference to the Scene's Systems. + * + * @name Phaser.Data.DataManagerPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, + + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Data.DataManagerPlugin#boot + * @private + * @since 3.5.1 + */ + boot: function () + { + this.events = this.systems.events; + + this.events.once(SceneEvents.DESTROY, this.destroy, this); + }, + + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Data.DataManagerPlugin#start + * @private + * @since 3.5.0 + */ + start: function () + { + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Data.DataManagerPlugin#shutdown + * @private + * @since 3.5.0 + */ + shutdown: function () + { + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.Data.DataManagerPlugin#destroy + * @since 3.5.0 + */ + destroy: function () + { + DataManager.prototype.destroy.call(this); + + this.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; + } + +}); + +PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); + +module.exports = DataManagerPlugin; + + +/***/ }), +/* 1029 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data + */ + +module.exports = { + + DataManager: __webpack_require__(134), + DataManagerPlugin: __webpack_require__(1028), + Events: __webpack_require__(420) + +}; + + +/***/ }), +/* 1030 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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__(3); + +/** + * @classdesc + * A MoveTo Curve is a very simple curve consisting of only a single point. Its intended use is to move the ending point in a Path. + * + * @class MoveTo + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - `x` pixel coordinate. + * @param {number} [y] - `y` pixel coordinate. + */ +var MoveTo = new Class({ + + initialize: + + function MoveTo (x, y) + { + // Skip length calcs in paths + + /** + * Denotes that this Curve does not influence the bounds, points, and drawing of its parent Path. Must be `false` or some methods in the parent Path will throw errors. + * + * @name Phaser.Curves.MoveTo#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; + + /** + * The lone point which this curve consists of. + * + * @name Phaser.Curves.MoveTo#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = new Vector2(x, y); + }, + + /** + * Get point at relative position in curve according to length. + * + * @method Phaser.Curves.MoveTo#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.p0); + }, + + /** + * Retrieves the point at given position in the curve. This will always return this curve's only point. + * + * @method Phaser.Curves.MoveTo#getPointAt + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} u - The position in the path to retrieve, between 0 and 1. Not used. + * @param {Phaser.Math.Vector2} [out] - An optional vector in which to store the point. + * + * @return {Phaser.Math.Vector2} The modified `out` vector, or a new `Vector2` if none was provided. + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, + + /** + * Gets the resolution of this curve. + * + * @method Phaser.Curves.MoveTo#getResolution + * @since 3.0.0 + * + * @return {number} The resolution of this curve. For a MoveTo the value is always 1. + */ + getResolution: function () + { + return 1; + }, + + /** + * Gets the length of this curve. + * + * @method Phaser.Curves.MoveTo#getLength + * @since 3.0.0 + * + * @return {number} The length of this curve. For a MoveTo the value is always 0. + */ + getLength: function () + { + return 0; + }, + + /** + * Converts this curve into a JSON-serializable object. + * + * @method Phaser.Curves.MoveTo#toJSON + * @since 3.0.0 + * + * @return {JSONCurve} A primitive object with the curve's type and only point. + */ + toJSON: function () + { + return { + type: 'MoveTo', + points: [ + this.p0.x, this.p0.y + ] + }; + } + +}); + +module.exports = MoveTo; + + +/***/ }), +/* 1031 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 CubicBezierCurve = __webpack_require__(359); +var EllipseCurve = __webpack_require__(358); +var GameObjectFactory = __webpack_require__(5); +var LineCurve = __webpack_require__(357); +var MovePathTo = __webpack_require__(1030); +var QuadraticBezierCurve = __webpack_require__(356); +var Rectangle = __webpack_require__(10); +var SplineCurve = __webpack_require__(355); +var Vector2 = __webpack_require__(3); + +/** + * @typedef {object} JSONPath + * + * @property {string} type - The of the curve. + * @property {number} x - The X coordinate of the curve's starting point. + * @property {number} y - The Y coordinate of the path's starting point. + * @property {boolean} autoClose - The path is auto closed. + * @property {JSONCurve[]} curves - The list of the curves + */ + +/** + * @classdesc + * A Path combines multiple Curves into one continuous compound curve. It does not matter how many Curves are in the Path or what type they are. + * + * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. + * + * @class Path + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link JSONPath}. + * @param {number} [y=0] - The Y coordinate of the Path's starting point. + */ +var Path = new Class({ + + initialize: + + function Path (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + /** + * The name of this Path. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.Curves.Path#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; + + /** + * The list of Curves which make up this Path. + * + * @name Phaser.Curves.Path#curves + * @type {Phaser.Curves.Curve[]} + * @default [] + * @since 3.0.0 + */ + this.curves = []; + + /** + * The cached length of each Curve in the Path. + * + * Used internally by {@link #getCurveLengths}. + * + * @name Phaser.Curves.Path#cacheLengths + * @type {number[]} + * @default [] + * @since 3.0.0 + */ + this.cacheLengths = []; + + /** + * Automatically closes the path. + * + * @name Phaser.Curves.Path#autoClose + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.autoClose = false; + + /** + * The starting point of the Path. + * + * This is not necessarily equivalent to the starting point of the first Curve in the Path. In an empty Path, it's also treated as the ending point. + * + * @name Phaser.Curves.Path#startPoint + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.startPoint = new Vector2(); + + /** + * A temporary vector used to avoid object creation when adding a Curve to the Path. + * + * @name Phaser.Curves.Path#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2A = new Vector2(); + + /** + * A temporary vector used to avoid object creation when adding a Curve to the Path. + * + * @name Phaser.Curves.Path#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2B = new Vector2(); + + if (typeof x === 'object') + { + this.fromJSON(x); + } + else + { + this.startPoint.set(x, y); + } + }, + + /** + * Appends a Curve to the end of the Path. + * + * The Curve does not have to start where the Path ends or, for an empty Path, at its defined starting point. + * + * @method Phaser.Curves.Path#add + * @since 3.0.0 + * + * @param {Phaser.Curves.Curve} curve - The Curve to append. + * + * @return {Phaser.Curves.Path} This Path object. + */ + add: function (curve) + { + this.curves.push(curve); + + return this; + }, + + /** + * Creates a circular Ellipse Curve positioned at the end of the Path. + * + * @method Phaser.Curves.Path#circleTo + * @since 3.0.0 + * + * @param {number} radius - The radius of the circle. + * @param {boolean} [clockwise=false] - `true` to create a clockwise circle as opposed to a counter-clockwise circle. + * @param {number} [rotation=0] - The rotation of the circle in degrees. + * + * @return {Phaser.Curves.Path} This Path object. + */ + circleTo: function (radius, clockwise, rotation) + { + if (clockwise === undefined) { clockwise = false; } + + return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); + }, + + /** + * Ensures that the Path is closed. + * + * A closed Path starts and ends at the same point. If the Path is not closed, a straight Line Curve will be created from the ending point directly to the starting point. During the check, the actual starting point of the Path, i.e. the starting point of the first Curve, will be used as opposed to the Path's defined {@link startPoint}, which could differ. + * + * Calling this method on an empty Path will result in an error. + * + * @method Phaser.Curves.Path#closePath + * @since 3.0.0 + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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)); + } + + return this; + }, + + /** + * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. + * + * @method Phaser.Curves.Path#cubicBezierTo + * @since 3.0.0 + * + * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vec2, the p1 value. + * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vec2, the p2 value. + * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vec2, the p3 value. + * @param {number} [control1Y] - The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments. + * @param {number} [control2X] - The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. + * @param {number} [control2Y] - The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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) + { + 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 + + /** + * Creates a Quadratic Bezier Curve starting at the ending point of the Path. + * + * @method Phaser.Curves.Path#quadraticBezierTo + * @since 3.2.0 + * + * @param {(number|Phaser.Math.Vector2[])} x - The X coordinate of the second control point or, if it's a `Vector2`, the first control point. + * @param {number} [y] - The Y coordinate of the second control point or, if `x` is a `Vector2`, the second control point. + * @param {number} [controlX] - If `x` is not a `Vector2`, the X coordinate of the first control point. + * @param {number} [controlY] - If `x` is not a `Vector2`, the Y coordinate of the first control point. + * + * @return {Phaser.Curves.Path} This Path object. + */ + 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)); + }, + + /** + * Draws all Curves in the Path to a Graphics Game Object. + * + * @method Phaser.Curves.Path#draw + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.Graphics} G - [out,$return] + * + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. + * @param {integer} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. + * + * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. + */ + 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; + }, + + /** + * 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 - The horizontal radius of the ellipse. + * @param {number} yRadius - The vertical radius of the ellipse. + * @param {number} startAngle - The start angle of the ellipse, in degrees. + * @param {number} endAngle - The end angle of the ellipse, in degrees. + * @param {boolean} clockwise - Whether the ellipse should be rotated clockwise (`true`) or counter-clockwise (`false`). + * @param {number} rotation - The rotation of the ellipse, in degrees. + * + * @return {Phaser.Curves.Path} This Path object. + */ + ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + { + 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); + }, + + /** + * Creates a Path from a Path Configuration object. + * + * The provided object should be a {@link JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. + * + * @method Phaser.Curves.Path#fromJSON + * @since 3.0.0 + * + * @param {object} data - The JSON object containing the Path data. + * + * @return {Phaser.Curves.Path} This Path object. + */ + fromJSON: function (data) + { + // 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++) + { + 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; + }, + + /** + * Returns a Rectangle with a position and size matching the bounds of this Path. + * + * @method Phaser.Curves.Path#getBounds + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. + * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. + * + * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. + */ + 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; + + 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]; + + 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); + } + + out.right = maxRight; + out.bottom = maxBottom; + + return out; + }, + + /** + * Returns an array containing the length of the Path at the end of each Curve. + * + * The result of this method will be cached to avoid recalculating it in subsequent calls. The cache is only invalidated when the {@link #curves} array changes in length, leading to potential inaccuracies if a Curve in the Path is changed, or if a Curve is removed and another is added in its place. + * + * @method Phaser.Curves.Path#getCurveLengths + * @since 3.0.0 + * + * @return {number[]} An array containing the length of the Path at the end of each one of its Curves. + */ + getCurveLengths: function () + { + // We use cache values if curves and cache array are same length + + if (this.cacheLengths.length === this.curves.length) + { + return this.cacheLengths; + } + + // Get length of sub-curve + // Push sums into cached array + + var lengths = []; + var sums = 0; + + for (var i = 0; i < this.curves.length; i++) + { + sums += this.curves[i].getLength(); + + lengths.push(sums); + } + + this.cacheLengths = lengths; + + return lengths; + }, + + /** + * Returns the ending point of the Path. + * + * A Path's ending point is equivalent to the ending point of the last Curve in the Path. For an empty Path, the ending point is at the Path's defined {@link #startPoint}. + * + * @method Phaser.Curves.Path#getEndPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - The object to store the point in. + * + * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. + */ + getEndPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + if (this.curves.length > 0) + { + this.curves[this.curves.length - 1].getPoint(1, out); + } + else + { + out.copy(this.startPoint); + } + + return out; + }, + + /** + * Returns the total length of the Path. + * + * @see {@link #getCurveLengths} + * + * @method Phaser.Curves.Path#getLength + * @since 3.0.0 + * + * @return {number} The total length of the Path. + */ + getLength: function () + { + var lens = this.getCurveLengths(); + + return lens[lens.length - 1]; + }, + + // 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') + + /** + * Calculates the coordinates of the point at the given normalized location (between 0 and 1) on the Path. + * + * The location is relative to the entire Path, not to an individual Curve. A location of 0.5 is always in the middle of the Path and is thus an equal distance away from both its starting and ending points. In a Path with one Curve, it would be in the middle of the Curve; in a Path with two Curves, it could be anywhere on either one of them depending on their lengths. + * + * @method Phaser.Curves.Path#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The location of the point to return, between 0 and 1. + * @param {Phaser.Math.Vector2} [out] - The object in which to store the calculated point. + * + * @return {?Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + */ + 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) + { + 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++; + } + + // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) + { + points.push(points[0]); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getRandomPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * + * @return {Phaser.Math.Vector2} [description] + */ + getRandomPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); + }, + + /** + * Creates a straight Line Curve from the ending point of the Path to the given coordinates. + * + * @method Phaser.Curves.Path#getSpacedPoints + * @since 3.0.0 + * + * @param {integer} [divisions=40] - The X coordinate of the line's ending point, or the line's ending point as a `Vector2`. + * + * @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)); + } + + if (this.autoClose) + { + points.push(points[0]); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + 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.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._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.Curves.Path#splineTo + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2[]} points - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + splineTo: function (points) + { + points.unshift(this.getEndPoint()); + + return this.add(new SplineCurve(points)); + }, + + /** + * [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)); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#toJSON + * @since 3.0.0 + * + * @return {JSONPath} [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.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; + + +/***/ }), +/* 1032 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Curves + */ + +/** + * @typedef {object} JSONCurve + * + * @property {string} type - The of the curve + * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` + */ + +module.exports = { + Path: __webpack_require__(1031), + + CubicBezier: __webpack_require__(359), + Curve: __webpack_require__(76), + Ellipse: __webpack_require__(358), + Line: __webpack_require__(357), + QuadraticBezier: __webpack_require__(356), + Spline: __webpack_require__(355) +}; + + +/***/ }), +/* 1033 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 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. + * + * @name Phaser.Create.Palettes.MSX + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1034 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.JMP + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1035 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.CGA + * @since 3.0.0 + * + * @type {Palette} + */ +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' +}; + + +/***/ }), +/* 1036 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @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 {Palette} + */ +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' +}; + + +/***/ }), +/* 1037 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Palette + * + * @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. + */ + +/** + * @namespace Phaser.Create.Palettes + */ + +module.exports = { + + ARNE16: __webpack_require__(360), + C64: __webpack_require__(1036), + CGA: __webpack_require__(1035), + JMP: __webpack_require__(1034), + MSX: __webpack_require__(1033) + +}; + + +/***/ }), +/* 1038 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Create + */ + +module.exports = { + + GenerateTexture: __webpack_require__(361), + Palettes: __webpack_require__(1037) + +}; + + +/***/ }), +/* 1039 */ /***/ (function(module, exports) { module.exports = [ @@ -143061,7 +155540,7 @@ module.exports = [ /***/ }), -/* 893 */ +/* 1040 */ /***/ (function(module, exports) { module.exports = [ @@ -143105,12 +155584,12 @@ module.exports = [ /***/ }), -/* 894 */ +/* 1041 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -143696,7 +156175,7 @@ module.exports = ModelViewProjection; /***/ }), -/* 895 */ +/* 1042 */ /***/ (function(module, exports) { module.exports = [ @@ -143720,6 +156199,7 @@ module.exports = [ 'uniform sampler2D uNormSampler;', 'uniform vec3 uAmbientLightColor;', 'uniform Light uLights[kMaxLights];', + 'uniform mat3 uInverseRotationMatrix;', '', 'varying vec2 outTexCoord;', 'varying vec4 outTint;', @@ -143729,7 +156209,7 @@ module.exports = [ ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);', ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', - ' vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));', + ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', '', ' for (int index = 0; index < kMaxLights; ++index)', @@ -143754,7 +156234,7 @@ module.exports = [ /***/ }), -/* 896 */ +/* 1043 */ /***/ (function(module, exports) { module.exports = [ @@ -143773,7 +156253,7 @@ module.exports = [ /***/ }), -/* 897 */ +/* 1044 */ /***/ (function(module, exports) { module.exports = [ @@ -143809,136 +156289,2629 @@ module.exports = [ /***/ }), -/* 898 */ -/***/ (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__(348); -var CanvasPool = __webpack_require__(24); -var CONST = __webpack_require__(26); -var Features = __webpack_require__(168); - -/** - * 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.antialias) - { - CanvasPool.disableSmoothing(); - } - - // Does the game config provide its own canvas element to use? - if (config.canvas) - { - game.canvas = config.canvas; - - game.canvas.width = game.config.width; - game.canvas.height = game.config.height; - } - else - { - game.canvas = CanvasPool.create(game, config.width * config.resolution, config.height * config.resolution, 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.antialias) - { - CanvasInterpolation.setCrisp(game.canvas); - } - - // Zoomed? - 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__(426); - WebGLRenderer = __webpack_require__(423); - - // Let the config pick the renderer type, as both are included - if (config.renderType === CONST.WEBGL) - { - game.renderer = new WebGLRenderer(game); - } - else - { - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } - } - - if (false) - {} - - if (false) - {} -}; - -module.exports = CreateRenderer; - - -/***/ }), -/* 899 */ +/* 1045 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Remove Event. + * + * This event is dispatched by the Texture Manager when a texture is removed from it. + * + * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`. + * + * If you have any Game Objects still using the removed texture, they will start throwing + * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. + * + * @event Phaser.Textures.Events#REMOVE + * + * @param {string} key - The key of the Texture that was removed from the Texture Manager. + */ +module.exports = 'removetexture'; + + +/***/ }), +/* 1046 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * This internal event signifies that the Texture Manager is now ready and the Game can continue booting. + * + * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking + * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game + * instance, which tells the Game to carry on booting. + * + * @event Phaser.Textures.Events#READY + */ +module.exports = 'ready'; + + +/***/ }), +/* 1047 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Event. + * + * This event is dispatched by the Texture Manager when a texture has finished loading on it. + * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`. + * + * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event. + * + * @event Phaser.Textures.Events#LOAD + * + * @param {string} key - The key of the Texture that was loaded by the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was loaded by the Texture Manager. + */ +module.exports = 'onload'; + + +/***/ }), +/* 1048 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Error Event. + * + * This event is dispatched by the Texture Manager when a texture it requested to load failed. + * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`. + * + * @event Phaser.Textures.Events#ERROR + * + * @param {string} key - The key of the Texture that failed to load into the Texture Manager. + */ +module.exports = 'onerror'; + + +/***/ }), +/* 1049 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Add Event. + * + * This event is dispatched by the Texture Manager when a texture is added to it. + * + * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`. + * + * @event Phaser.Textures.Events#ADD + * + * @param {string} key - The key of the Texture that was added to the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. + */ +module.exports = 'addtexture'; + + +/***/ }), +/* 1050 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Vector3 = __webpack_require__(182); +var Matrix4 = __webpack_require__(369); +var Quaternion = __webpack_require__(368); + +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 - The vector to be rotated. + * @param {Phaser.Math.Vector3} axis - The axis to rotate around. + * @param {number} radians - The angle of rotation in radians. + * + * @return {Phaser.Math.Vector3} The given vector. + */ +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; + + +/***/ }), +/* 1051 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 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 + * A representation of a vector in 4D space. + * + * A four-component vector. + * + * @class Vector4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +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 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector4#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector4#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + /** + * The w component of this Vector. + * + * @name Phaser.Math.Vector4#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.w = 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; + } + }, + + /** + * Make a clone of this Vector4. + * + * @method Phaser.Math.Vector4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} A clone of this Vector4. + */ + clone: function () + { + return new Vector4(this.x, this.y, this.z, this.w); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + this.w = src.w || 0; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict quality check against each Vector's components. + * + * @method Phaser.Math.Vector4#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The vector to check equality with. + * + * @return {boolean} A boolean indicating whether the two Vectors are equal or not. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); + }, + + /** + * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. + * + * @method Phaser.Math.Vector4#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. + * @param {number} y - The y value to set for this Vector. + * @param {number} z - The z value to set for this Vector. + * @param {number} w - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + set: function (x, y, z, w) + { + 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; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector4#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + this.w += v.w || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector4#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + this.w -= v.w || 0; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector4#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + scale: function (scale) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; + + return this; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector4#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + 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); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector4#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return x * x + y * y + z * z + w * w; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector4#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + 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; + + 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; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector4#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. + * + * @return {number} The dot product of this Vector and the given Vector. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector4#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + lerp: function (v, t) + { + 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; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector4#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + this.w *= v.w || 1; + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector4#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + this.w /= v.w || 1; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector4#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + 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); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector4#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + 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; + + return dx * dx + dy * dy + dz * dz + dw * dw; + }, + + /** + * Negate the `x`, `y`, `z` and `w` components of this Vector. + * + * @method Phaser.Math.Vector4#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + this.w = -this.w; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector4#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var m = mat.val; + + 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; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector4#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformQuat: function (q) + { + // TODO: is this really the same as Vector3? + // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ + // 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; + + // 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; + + // 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; + }, + + /** + * Make this Vector the zero vector (0, 0, 0, 0). + * + * @method Phaser.Math.Vector4#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 0; + + return this; + } + +}); + +// 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; + +module.exports = Vector4; + + +/***/ }), +/* 1052 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Checks if the two values are within the given `tolerance` of each other. + * + * @function Phaser.Math.Within + * @since 3.0.0 + * + * @param {number} a - The first value to use in the calculation. + * @param {number} b - The second value to use in the calculation. + * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. + * + * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. + */ +var Within = function (a, b, tolerance) +{ + return (Math.abs(a - b) <= tolerance); +}; + +module.exports = Within; + + +/***/ }), +/* 1053 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} SinCosTable + * + * @property {number} sin - The sine value. + * @property {number} cos - The cosine value. + * @property {number} length - The length. + */ + +/** + * Generate a series of sine and cosine values. + * + * @function Phaser.Math.SinCosTableGenerator + * @since 3.0.0 + * + * @param {number} length - The number of values to generate. + * @param {number} [sinAmp=1] - The sine value amplitude. + * @param {number} [cosAmp=1] - The cosine value amplitude. + * @param {number} [frequency=1] - The frequency of the values. + * + * @return {SinCosTable} The generated values. + */ +var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) +{ + if (sinAmp === undefined) { sinAmp = 1; } + if (cosAmp === undefined) { cosAmp = 1; } + if (frequency === undefined) { frequency = 1; } + + frequency *= Math.PI / length; + + var cos = []; + var sin = []; + + for (var c = 0; c < length; c++) + { + cosAmp -= sinAmp * frequency; + sinAmp += cosAmp * frequency; + + cos[c] = cosAmp; + sin[c] = sinAmp; + } + + return { + sin: sin, + cos: cos, + length: length + }; +}; + +module.exports = SinCosTableGenerator; + + +/***/ }), +/* 1054 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Round a value to a given decimal place. + * + * @function Phaser.Math.RoundTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {integer} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var RoundTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.round(value * p) / p; +}; + +module.exports = RoundTo; + + +/***/ }), +/* 1055 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random four-dimensional vector. + * + * @function Phaser.Math.RandomXYZW + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector4} The given Vector. + */ +var RandomXYZW = function (vec4, scale) +{ + if (scale === undefined) { scale = 1; } + + // TODO: 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; + + +/***/ }), +/* 1056 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random position vector in a spherical area, optionally defined by the given radius. + * + * @function Phaser.Math.RandomXYZ + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. + * @param {number} [radius=1] - The radius. + * + * @return {Phaser.Math.Vector3} The given Vector. + */ +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; + + +/***/ }), +/* 1057 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Compute a random unit vector. + * + * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. + * + * Optionally accepts a scale value to scale the resulting vector by. + * + * @function Phaser.Math.RandomXY + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector2} The given Vector. + */ +var RandomXY = function (vector, scale) +{ + if (scale === undefined) { scale = 1; } + + var r = Math.random() * 2 * Math.PI; + + vector.x = Math.cos(r) * scale; + vector.y = Math.sin(r) * scale; + + return vector; +}; + +module.exports = RandomXY; + + +/***/ }), +/* 1058 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Work out what percentage `value` is of the range between `min` and `max`. + * If `max` isn't given then it will return the percentage of `value` to `min`. + * + * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. + * + * @function Phaser.Math.Percent + * @since 3.0.0 + * + * @param {number} value - The value to determine the percentage of. + * @param {number} min - The minimum value. + * @param {number} [max] - The maximum value. + * @param {number} [upperMax] - The mid-way point in the range that represents 100%. + * + * @return {number} A value between 0 and 1 representing the percentage. + */ +var Percent = function (value, min, max, upperMax) +{ + if (max === undefined) { max = min + 1; } + + var percentage = (value - min) / (max - min); + + if (percentage > 1) + { + if (upperMax !== undefined) + { + percentage = ((upperMax - value)) / (upperMax - max); + + if (percentage < 0) + { + percentage = 0; + } + } + else + { + percentage = 1; + } + } + else if (percentage < 0) + { + percentage = 0; + } + + return percentage; +}; + +module.exports = Percent; + + +/***/ }), +/* 1059 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Subtract an `amount` from `value`, limiting the minimum result to `min`. + * + * @function Phaser.Math.MinSub + * @since 3.0.0 + * + * @param {number} value - The value to subtract from. + * @param {number} amount - The amount to subtract. + * @param {number} min - The minimum value to return. + * + * @return {number} The resulting value. + */ +var MinSub = function (value, amount, min) +{ + return Math.max(value - amount, min); +}; + +module.exports = MinSub; + + +/***/ }), +/* 1060 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Add an `amount` to a `value`, limiting the maximum result to `max`. + * + * @function Phaser.Math.MaxAdd + * @since 3.0.0 + * + * @param {number} value - The value to add to. + * @param {number} amount - The amount to add. + * @param {number} max - The maximum value to return. + * + * @return {number} The resulting value. + */ +var MaxAdd = function (value, amount, max) +{ + return Math.min(value + amount, max); +}; + +module.exports = MaxAdd; + + +/***/ }), +/* 1061 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check if a given value is an even number using a strict type check. + * + * @function Phaser.Math.IsEvenStrict + * @since 3.0.0 + * + * @param {number} value - The number to perform the check with. + * + * @return {boolean} Whether the number is even or not. + */ +var IsEvenStrict = function (value) +{ + // Use strict equality === for "is number" test + return (value === parseFloat(value)) ? !(value % 2) : void 0; +}; + +module.exports = IsEvenStrict; + + +/***/ }), +/* 1062 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check if a given value is an even number. + * + * @function Phaser.Math.IsEven + * @since 3.0.0 + * + * @param {number} value - The number to perform the check with. + * + * @return {boolean} Whether the number is even or not. + */ +var IsEven = function (value) +{ + // Use abstract equality == for "is number" test + + // eslint-disable-next-line eqeqeq + return (value == parseFloat(value)) ? !(value % 2) : void 0; +}; + +module.exports = IsEven; + + +/***/ }), +/* 1063 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the speed required to cover a distance in the time given. + * + * @function Phaser.Math.GetSpeed + * @since 3.0.0 + * + * @param {number} distance - The distance to travel in pixels. + * @param {integer} time - The time, in ms, to cover the distance in. + * + * @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given. + */ +var GetSpeed = function (distance, time) +{ + return (distance / time) / 1000; +}; + +module.exports = GetSpeed; + + +/***/ }), +/* 1064 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Floors to some place comparative to a `base`, default is 10 for decimal place. + * + * The `place` is represented by the power applied to `base` to get that place. + * + * @function Phaser.Math.FloorTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {integer} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var FloorTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.floor(value * p) / p; +}; + +module.exports = FloorTo; + + +/***/ }), +/* 1065 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculates the positive difference of two given numbers. + * + * @function Phaser.Math.Difference + * @since 3.0.0 + * + * @param {number} a - The first number in the calculation. + * @param {number} b - The second number in the calculation. + * + * @return {number} The positive difference of the two given numbers. + */ +var Difference = function (a, b) +{ + return Math.abs(a - b); +}; + +module.exports = Difference; + + +/***/ }), +/* 1066 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Ceils to some place comparative to a `base`, default is 10 for decimal place. + * + * The `place` is represented by the power applied to `base` to get that place. + * + * @function Phaser.Math.CeilTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {number} [place=0] - The place to round to. + * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var CeilTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.ceil(value * p) / p; +}; + +module.exports = CeilTo; + + +/***/ }), +/* 1067 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the mean average of the given values. + * + * @function Phaser.Math.Average + * @since 3.0.0 + * + * @param {number[]} values - The values to average. + * + * @return {number} The average value. + */ +var Average = function (values) +{ + var sum = 0; + + for (var i = 0; i < values.length; i++) + { + sum += (+values[i]); + } + + return sum / values.length; +}; + +module.exports = Average; + + +/***/ }), +/* 1068 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A seeded Random Data Generator. + * + * Access via `Phaser.Math.RND` which is an instance of this class pre-defined + * by Phaser. Or, create your own instance to use as you require. + * + * The `Math.RND` generator is seeded by the Game Config property value `seed`. + * If no such config property exists, a random number is used. + * + * If you create your own instance of this class you should provide a seed for it. + * If no seed is given it will use a 'random' one based on Date.now. + * + * @class RandomDataGenerator + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. + */ +var RandomDataGenerator = new Class({ + + initialize: + + function RandomDataGenerator (seeds) + { + if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } + + /** + * 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; + + /** + * Signs to choose from. + * + * @name Phaser.Math.RandomDataGenerator#signs + * @type {number[]} + * @since 3.0.0 + */ + this.signs = [ -1, 1 ]; + + if (seeds) + { + this.init(seeds); + } + }, + + /** + * Private random helper. + * + * @method Phaser.Math.RandomDataGenerator#rnd + * @since 3.0.0 + * @private + * + * @return {number} A random number. + */ + rnd: function () + { + 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 {string} data - The value to hash. + * + * @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++) + { + 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 + }, + + /** + * Initialize the state of the random data generator. + * + * @method Phaser.Math.RandomDataGenerator#init + * @since 3.0.0 + * + * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. + */ + 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 {string[]} 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 {*} 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 {*} 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(','); + }, + + /** + * Shuffles the given array, using the current seed. + * + * @method Phaser.Math.RandomDataGenerator#shuffle + * @since 3.7.0 + * + * @param {array} [array] - The array to be shuffled. + * + * @return {array} The shuffled array. + */ + shuffle: function (array) + { + var len = array.length - 1; + + for (var i = len; i > 0; i--) + { + var randomIndex = Math.floor(this.frac() * (i + 1)); + var itemAtIndex = array[randomIndex]; + + array[randomIndex] = array[i]; + array[i] = itemAtIndex; + } + + return array; + } + +}); + +module.exports = RandomDataGenerator; + + +/***/ }), +/* 1069 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using rounding. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. + * + * @function Phaser.Math.Snap.To + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapTo = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.round(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapTo; + + +/***/ }), +/* 1070 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Snap + */ + +module.exports = { + + Ceil: __webpack_require__(375), + Floor: __webpack_require__(98), + To: __webpack_require__(1069) + +}; + + +/***/ }), +/* 1071 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Tests the value and returns `true` if it is a power of two. + * + * @function Phaser.Math.Pow2.IsValuePowerOfTwo + * @since 3.0.0 + * + * @param {number} value - The value to check if it's a power of two. + * + * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. + */ +var IsValuePowerOfTwo = function (value) +{ + return (value > 0 && (value & (value - 1)) === 0); +}; + +module.exports = IsValuePowerOfTwo; + + +/***/ }), +/* 1072 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Pow2 + */ + +module.exports = { + + GetNext: __webpack_require__(376), + IsSize: __webpack_require__(127), + IsValue: __webpack_require__(1071) + +}; + + +/***/ }), +/* 1073 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var SmootherStep = __webpack_require__(196); + +/** + * A Smoother Step interpolation method. + * + * @function Phaser.Math.Interpolation.SmootherStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The interpolated value. + */ +var SmootherStepInterpolation = function (t, min, max) +{ + return min + (max - min) * SmootherStep(t, 0, 1); +}; + +module.exports = SmootherStepInterpolation; + + +/***/ }), +/* 1074 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Linear = __webpack_require__(129); + +/** + * A linear interpolation method. + * + * @function Phaser.Math.Interpolation.Linear + * @since 3.0.0 + * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {!number} k - The percentage of interpolation, between 0 and 1. + * + * @return {!number} The interpolated value. + */ +var LinearInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + + if (k < 0) + { + return Linear(v[0], v[1], f); + } + else if (k > 1) + { + return Linear(v[m], v[m - 1], m - f); + } + else + { + return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); + } +}; + +module.exports = LinearInterpolation; + + +/***/ }), +/* 1075 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CatmullRom = __webpack_require__(185); + +/** + * A Catmull-Rom interpolation method. + * + * @function Phaser.Math.Interpolation.CatmullRom + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var CatmullRomInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + + if (v[0] === v[m]) + { + if (k < 0) + { + i = Math.floor(f = m * (1 + k)); + } + + return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); + } + else + { + if (k < 0) + { + return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); + } + + if (k > 1) + { + return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); + } + + return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); + } +}; + +module.exports = CatmullRomInterpolation; + + +/***/ }), +/* 1076 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Bernstein = __webpack_require__(381); + +/** + * A bezier interpolation method. + * + * @function Phaser.Math.Interpolation.Bezier + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var BezierInterpolation = function (v, k) +{ + var b = 0; + var n = v.length - 1; + + for (var i = 0; i <= n; i++) + { + b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); + } + + return b; +}; + +module.exports = BezierInterpolation; + + +/***/ }), +/* 1077 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Interpolation + */ + +module.exports = { + + Bezier: __webpack_require__(1076), + CatmullRom: __webpack_require__(1075), + CubicBezier: __webpack_require__(379), + Linear: __webpack_require__(1074), + QuadraticBezier: __webpack_require__(378), + SmoothStep: __webpack_require__(377), + SmootherStep: __webpack_require__(1073) + +}; + + +/***/ }), +/* 1078 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the fuzzy floor of the given value. + * + * @function Phaser.Math.Fuzzy.Floor + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The floor of the value. + */ +var Floor = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.floor(value + epsilon); +}; + +module.exports = Floor; + + +/***/ }), +/* 1079 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the fuzzy ceiling of the given value. + * + * @function Phaser.Math.Fuzzy.Ceil + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The fuzzy ceiling of the value. + */ +var Ceil = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } + + return Math.ceil(value - epsilon); +}; + +module.exports = Ceil; + + +/***/ }), +/* 1080 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Fuzzy + */ + +module.exports = { + + Ceil: __webpack_require__(1079), + Equal: __webpack_require__(186), + Floor: __webpack_require__(1078), + GreaterThan: __webpack_require__(383), + LessThan: __webpack_require__(382) + +}; + + +/***/ }), +/* 1081 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing + */ + +module.exports = { + + Back: __webpack_require__(402), + Bounce: __webpack_require__(401), + Circular: __webpack_require__(400), + Cubic: __webpack_require__(399), + Elastic: __webpack_require__(398), + Expo: __webpack_require__(397), + Linear: __webpack_require__(396), + Quadratic: __webpack_require__(395), + Quartic: __webpack_require__(394), + Quintic: __webpack_require__(393), + Sine: __webpack_require__(392), + Stepped: __webpack_require__(391) + +}; + + +/***/ }), +/* 1082 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Calculate the distance between two sets of coordinates (points) to the power of `pow`. + * + * @function Phaser.Math.Distance.Power + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * @param {number} pow - The exponent. + * + * @return {number} The distance between each point. + */ +var DistancePower = function (x1, y1, x2, y2, pow) +{ + if (pow === undefined) { pow = 2; } + + return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); +}; + +module.exports = DistancePower; + + +/***/ }), +/* 1083 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Distance + */ + +module.exports = { + + Between: __webpack_require__(56), + Power: __webpack_require__(1082), + Squared: __webpack_require__(384) + +}; + + +/***/ }), +/* 1084 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Gets the shortest angle between `angle1` and `angle2`. + * + * Both angles must be in the range -180 to 180, which is the same clamped + * range that `sprite.angle` uses, so you can pass in two sprite angles to + * this method and get the shortest angle back between the two of them. + * + * The angle returned will be in the same range. If the returned angle is + * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's + * a clockwise rotation. + * + * TODO: Wrap the angles in this function? + * + * @function Phaser.Math.Angle.ShortestBetween + * @since 3.0.0 + * + * @param {number} angle1 - The first angle in the range -180 to 180. + * @param {number} angle2 - The second angle in the range -180 to 180. + * + * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. + */ +var ShortestBetween = function (angle1, angle2) +{ + var difference = angle2 - angle1; + + if (difference === 0) + { + return 0; + } + + var times = Math.floor((difference - (-180)) / 360); + + return difference - (times * 360); + +}; + +module.exports = ShortestBetween; + + +/***/ }), +/* 1085 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var MATH_CONST = __webpack_require__(20); + +/** + * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. + * + * @function Phaser.Math.Angle.RotateTo + * @since 3.0.0 + * + * @param {number} currentAngle - The current angle, in radians. + * @param {number} targetAngle - The target angle to rotate to, in radians. + * @param {number} [lerp=0.05] - The lerp value to add to the current angle. + * + * @return {number} The adjusted angle. + */ +var RotateTo = function (currentAngle, targetAngle, lerp) +{ + if (lerp === undefined) { lerp = 0.05; } + + if (currentAngle === targetAngle) + { + return currentAngle; + } + + if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) + { + currentAngle = targetAngle; + } + else + { + if (Math.abs(targetAngle - currentAngle) > Math.PI) + { + if (targetAngle < currentAngle) + { + targetAngle += MATH_CONST.PI2; + } + else + { + targetAngle -= MATH_CONST.PI2; + } + } + + if (targetAngle > currentAngle) + { + currentAngle += lerp; + } + else if (targetAngle < currentAngle) + { + currentAngle -= lerp; + } + } + + return currentAngle; +}; + +module.exports = RotateTo; + + +/***/ }), +/* 1086 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Normalize = __webpack_require__(385); + +/** + * Reverse the given angle. + * + * @function Phaser.Math.Angle.Reverse + * @since 3.0.0 + * + * @param {number} angle - The angle to reverse, in radians. + * + * @return {number} The reversed angle, in radians. + */ +var Reverse = function (angle) +{ + return Normalize(angle + Math.PI); +}; + +module.exports = Reverse; + + +/***/ }), +/* 1087 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = __webpack_require__(20); + +/** + * Takes an angle in Phasers default clockwise format and converts it so that + * 0 is North, 90 is West, 180 is South and 270 is East, + * therefore running counter-clockwise instead of clockwise. + * + * You can pass in the angle from a Game Object using: + * + * ```javascript + * var converted = CounterClockwise(gameobject.rotation); + * ``` + * + * All values for this function are in radians. + * + * @function Phaser.Math.Angle.CounterClockwise + * @since 3.16.0 + * + * @param {number} angle - The angle to convert, in radians. + * + * @return {number} The converted angle, in radians. + */ +var CounterClockwise = function (angle) +{ + return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2); +}; + +module.exports = CounterClockwise; + + +/***/ }), +/* 1088 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenY + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var BetweenY = function (x1, y1, x2, y2) +{ + return Math.atan2(x2 - x1, y2 - y1); +}; + +module.exports = BetweenY; + + +/***/ }), +/* 1089 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenPointsY + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point1 - The first point. + * @param {(Phaser.Geom.Point|object)} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPointsY = function (point1, point2) +{ + return Math.atan2(point2.x - point1.x, point2.y - point1.y); +}; + +module.exports = BetweenPointsY; + + +/***/ }), +/* 1090 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * Calculates the angle of the vector from the first point to the second point. + * + * @function Phaser.Math.Angle.BetweenPoints + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point1 - The first point. + * @param {(Phaser.Geom.Point|object)} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPoints = function (point1, point2) +{ + return Math.atan2(point2.y - point1.y, point2.x - point1.x); +}; + +module.exports = BetweenPoints; + + +/***/ }), +/* 1091 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Angle + */ + +module.exports = { + + Between: __webpack_require__(386), + BetweenPoints: __webpack_require__(1090), + BetweenPointsY: __webpack_require__(1089), + BetweenY: __webpack_require__(1088), + CounterClockwise: __webpack_require__(1087), + Normalize: __webpack_require__(385), + Reverse: __webpack_require__(1086), + RotateTo: __webpack_require__(1085), + ShortestBetween: __webpack_require__(1084), + Wrap: __webpack_require__(214), + WrapDegrees: __webpack_require__(213) + +}; + + +/***/ }), +/* 1092 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -143972,22 +158945,23 @@ function init () { var i; - var fs = [ - 'requestFullscreen', - 'requestFullScreen', - 'webkitRequestFullscreen', - 'webkitRequestFullScreen', - 'msRequestFullscreen', - 'msRequestFullScreen', - 'mozRequestFullScreen', - 'mozRequestFullscreen' - ]; + var suffix1 = 'Fullscreen'; + var suffix2 = 'FullScreen'; - var element = document.createElement('div'); + var fs = [ + 'request' + suffix1, + 'request' + suffix2, + 'webkitRequest' + suffix1, + 'webkitRequest' + suffix2, + 'msRequest' + suffix1, + 'msRequest' + suffix2, + 'mozRequest' + suffix2, + 'mozRequest' + suffix1 + ]; for (i = 0; i < fs.length; i++) { - if (element[fs[i]]) + if (document.documentElement[fs[i]]) { Fullscreen.available = true; Fullscreen.request = fs[i]; @@ -143996,14 +158970,14 @@ function init () } var cfs = [ - 'cancelFullScreen', - 'exitFullscreen', - 'webkitCancelFullScreen', - 'webkitExitFullscreen', - 'msCancelFullScreen', - 'msExitFullscreen', - 'mozCancelFullScreen', - 'mozExitFullscreen' + 'cancel' + suffix2, + 'exit' + suffix1, + 'webkitCancel' + suffix2, + 'webkitExit' + suffix1, + 'msCancel' + suffix2, + 'msExit' + suffix1, + 'mozCancel' + suffix2, + 'mozExit' + suffix1 ]; if (Fullscreen.available) @@ -144019,11 +158993,14 @@ function init () } // Keyboard Input? - if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT']) + // Safari 5.1 says it supports fullscreen keyboard, but is lying. + if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT'] && !(/ Version\/5\.1(?:\.\d+)? Safari\//).test(navigator.userAgent)) { Fullscreen.keyboard = true; } + Object.defineProperty(Fullscreen, 'active', { get: function () { return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } }); + return Fullscreen; } @@ -144031,12 +159008,12 @@ module.exports = init(); /***/ }), -/* 900 */ +/* 1093 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144116,16 +159093,16 @@ module.exports = init(); /***/ }), -/* 901 */ +/* 1094 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Browser = __webpack_require__(118); +var Browser = __webpack_require__(128); /** * Determines the audio playback capabilities of the device running this Phaser Game instance. @@ -144241,17 +159218,17 @@ module.exports = init(); /***/ }), -/* 902 */ +/* 1095 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(92); -var Browser = __webpack_require__(118); +var OS = __webpack_require__(99); +var Browser = __webpack_require__(128); /** * Determines the input support of the browser running this Phaser Game instance. @@ -144320,1730 +159297,7 @@ module.exports = init(); /***/ }), -/* 903 */ -/***/ (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__(26); -var Device = __webpack_require__(340); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(4); -var IsPlainObject = __webpack_require__(8); -var MATH = __webpack_require__(16); -var NOOP = __webpack_require__(1); -var DefaultPlugins = __webpack_require__(167); -var ValueToColor = __webpack_require__(178); - -/** - * This callback type is completely empty, a no-operation. - * - * @callback NOOP - */ - -/** - * @callback BootCallback - * - * @param {Phaser.Game} game - The game. - */ - -/** - * @typedef {object} InputConfig - * - * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. - * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. - * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. - * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. - * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. - */ - -/** - * @typedef {object} MouseInputConfig - * - * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether mouse input events have preventDefault() called on them. - */ - -/** - * @typedef {object} KeyboardInputConfig - * - * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. - */ - -/** - * @typedef {object} TouchInputConfig - * - * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. - */ - -/** - * @typedef {object} GamepadInputConfig - * - * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. - */ - -/** - * @typedef {object} BannerConfig - * - * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. - * @property {string} [text='#ffffff'] - The color of the banner text. - * @property {string[]} [background] - The background colors of the banner. - */ - -/** - * @typedef {object} FPSConfig - * - * @property {integer} [min=10] - The minimum acceptable rendering rate, in frames per second. - * @property {integer} [target=60] - The optimum rendering rate, in frames per second. - * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. - * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. - * @property {integer} [panicMax=120] - [description] - */ - -/** - * @typedef {object} RenderConfig - * - * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. - * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. - * @property {boolean} [autoResize=true] - Automatically resize the Game Canvas if you resize the renderer. - * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. - * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. - * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. - * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. - * @property {boolean} [preserveDrawingBuffer=false] - In WebGL mode, the drawing buffer won't be cleared automatically each frame. - * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. - * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. - * @property {integer} [batchSize=2000] - The default WebGL batch size. - * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - -/** - * @typedef {object} ScaleConfig - * - * @property {(integer|string)} [width=1024] - The base width of your game. - * @property {(integer|string)} [height=768] - The base height of your game. - * @property {integer} [zoom=1] - The zoom value of the game canvas. - * @property {number} [resolution=1] - The rendering resolution of the canvas. - * @property {(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {integer} [mode=0] - The scale mode to apply to the canvas. SHOW_ALL, EXACT_FIT, USER_SCALE, or RESIZE. - * @property {integer} [minWidth] - The minimum width the canvas can be scaled down to. - * @property {integer} [minHeight] - The minimum height the canvas can be scaled down to. - * @property {integer} [maxWidth] - The maximum width the canvas can be scaled up to. - * @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to. - */ - -/** - * @typedef {object} CallbacksConfig - * - * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. - * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. - */ - -/** - * @typedef {object} LoaderConfig - * - * @property {string} [baseURL] - An URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. - * @property {string} [path] - An URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. - * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. - * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. - * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. - * @property {boolean} [async=true] - Should the XHR request use async or not? - * @property {string} [user] - Optional username for the XHR request. - * @property {string} [password] - Optional password for the XHR request. - * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. - */ - -/** - * @typedef {object} DOMContainerConfig - * - * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. - * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. - */ - -/** - * @typedef {object} ImagesConfig - * - * @property {string} [default] - URL to use for the 'default' texture. - * @property {string} [missing] - URL to use for the 'missing' texture. - */ - -/** - * @typedef {object} PhysicsConfig - * - * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. - * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. - * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. - * @property {object} [matter] - Matter Physics configuration. - */ - -/** - * @typedef {object} PluginObjectItem - * - * @property {string} [key] - A key to identify the plugin in the Plugin Manager. - * @property {*} [plugin] - The plugin itself. Usually a class/constructor. - * @property {boolean} [start] - Whether the plugin should be started automatically. - * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). - * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). - * @property {*} [data] - Arbitrary data passed to the plugin's init() method. - * - * @example - * // Global plugin - * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } - * @example - * // Scene plugin - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - */ - -/** - * @typedef {object} PluginObject - * - * @property {?PluginObjectItem[]} [global] - Global plugins to install. - * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. - * @property {string[]} [default] - The default set of scene plugins (names). - * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. - */ - -/** - * @typedef {object} GameConfig - * - * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. - * @property {(integer|string)} [height=768] - The height of the game, in game pixels. - * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. - * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. - * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. - * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. - * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. - * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. - * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. - * @property {string[]} [seed] - Seed for the random number generator. - * @property {string} [title=''] - The title of the game. Shown in the browser console. - * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. - * @property {string} [version=''] - The version of the game. Shown in the browser console. - * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. - * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. - * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). - * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. - * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. - * @property {FPSConfig} [fps] - Game loop configuration. - * @property {RenderConfig} [render] - Game renderer configuration. - * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. - * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. - * @property {LoaderConfig} [loader] - Loader configuration. - * @property {ImagesConfig} [images] - Images configuration. - * @property {object} [physics] - Physics configuration. - * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. - */ - -/** - * @classdesc - * The active game configuration settings, parsed from a {@link GameConfig} object. - * - * @class Config - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. - * - * @see Phaser.Game#config - */ -var Config = new Class({ - - initialize: - - function Config (config) - { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; - - var defaultBannerTextColor = '#ffffff'; - - /** - * @const {(integer|string)} Phaser.Boot.Config#width - [description] - */ - this.width = GetValue(config, 'width', 1024); - - /** - * @const {(integer|string)} Phaser.Boot.Config#height - [description] - */ - this.height = GetValue(config, 'height', 768); - - /** - * @const {number} Phaser.Boot.Config#zoom - [description] - */ - this.zoom = GetValue(config, 'zoom', 1); - - /** - * @const {number} Phaser.Boot.Config#resolution - [description] - */ - this.resolution = GetValue(config, 'resolution', 1); - - /** - * @const {?*} Phaser.Boot.Config#parent - [description] - */ - this.parent = GetValue(config, 'parent', null); - - /** - * @const {integer} Phaser.Boot.Config#scaleMode - [description] - */ - this.scaleMode = GetValue(config, 'scaleMode', 0); - - /** - * @const {boolean} Phaser.Boot.Config#expandParent - [description] - */ - this.expandParent = GetValue(config, 'expandParent', false); - - /** - * @const {integer} Phaser.Boot.Config#minWidth - [description] - */ - this.minWidth = GetValue(config, 'minWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxWidth - [description] - */ - this.maxWidth = GetValue(config, 'maxWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#minHeight - [description] - */ - this.minHeight = GetValue(config, 'minHeight', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxHeight - [description] - */ - this.maxHeight = GetValue(config, 'maxHeight', 0); - - // Scale Manager - Anything set in here over-rides anything set above - - var scaleConfig = GetValue(config, 'scale', null); - - if (scaleConfig) - { - this.width = GetValue(scaleConfig, 'width', this.width); - this.height = GetValue(scaleConfig, 'height', this.height); - this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); - this.parent = GetValue(scaleConfig, 'parent', this.parent); - this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); - this.expandParent = GetValue(scaleConfig, 'mode', this.expandParent); - this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); - this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); - this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); - this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); - } - - /** - * @const {number} Phaser.Boot.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) - */ - this.renderType = GetValue(config, 'type', CONST.AUTO); - - /** - * @const {?HTMLCanvasElement} Phaser.Boot.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. - */ - this.canvas = GetValue(config, 'canvas', null); - - /** - * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Boot.Config#context - Force Phaser to use your own Canvas context instead of creating one. - */ - this.context = GetValue(config, 'context', null); - - /** - * @const {?string} Phaser.Boot.Config#canvasStyle - [description] - */ - this.canvasStyle = GetValue(config, 'canvasStyle', null); - - /** - * @const {?object} Phaser.Boot.Config#sceneConfig - [description] - */ - this.sceneConfig = GetValue(config, 'scene', null); - - /** - * @const {string[]} Phaser.Boot.Config#seed - [description] - */ - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - - MATH.RND.init(this.seed); - - /** - * @const {string} Phaser.Boot.Config#gameTitle - The title of the game. - */ - this.gameTitle = GetValue(config, 'title', ''); - - /** - * @const {string} Phaser.Boot.Config#gameURL - The URL of the game. - */ - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - - /** - * @const {string} Phaser.Boot.Config#gameVersion - The version of the game. - */ - this.gameVersion = GetValue(config, 'version', ''); - - /** - * @const {boolean} Phaser.Boot.Config#autoFocus - [description] - */ - this.autoFocus = GetValue(config, 'autoFocus', true); - - // DOM Element Container - - /** - * @const {?boolean} Phaser.Boot.Config#domCreateContainer - [description] - */ - this.domCreateContainer = GetValue(config, 'dom.createContainer', false); - - /** - * @const {?boolean} Phaser.Boot.Config#domBehindCanvas - [description] - */ - this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); - - // Input - - /** - * @const {boolean} Phaser.Boot.Config#inputKeyboard - [description] - */ - this.inputKeyboard = GetValue(config, 'input.keyboard', true); - - /** - * @const {*} Phaser.Boot.Config#inputKeyboardEventTarget - [description] - */ - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); - - /** - * @const {(boolean|object)} Phaser.Boot.Config#inputMouse - [description] - */ - this.inputMouse = GetValue(config, 'input.mouse', true); - - /** - * @const {?*} Phaser.Boot.Config#inputMouseEventTarget - [description] - */ - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputMouseCapture - [description] - */ - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouch - [description] - */ - this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); - - /** - * @const {?*} Phaser.Boot.Config#inputTouchEventTarget - [description] - */ - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouchCapture - [description] - */ - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); - - /** - * @const {integer} Phaser.Boot.Config#inputActivePointers - [description] - */ - this.inputActivePointers = GetValue(config, 'input.activePointers', 1); - - /** - * @const {boolean} Phaser.Boot.Config#inputGamepad - [description] - */ - this.inputGamepad = GetValue(config, 'input.gamepad', false); - - /** - * @const {*} Phaser.Boot.Config#inputGamepadEventTarget - [description] - */ - this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); - - /** - * @const {boolean} Phaser.Boot.Config#disableContextMenu - Set to `true` to disable context menu. Default value is `false`. - */ - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - - /** - * @const {any} Phaser.Boot.Config#audio - [description] - */ - this.audio = GetValue(config, 'audio'); - - // If you do: { banner: false } it won't display any banner at all - - /** - * @const {boolean} Phaser.Boot.Config#hideBanner - [description] - */ - this.hideBanner = (GetValue(config, 'banner', null) === false); - - /** - * @const {boolean} Phaser.Boot.Config#hidePhaser - [description] - */ - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - - /** - * @const {string} Phaser.Boot.Config#bannerTextColor - [description] - */ - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - - /** - * @const {string[]} Phaser.Boot.Config#bannerBackgroundColor - [description] - */ - 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 - // } - - /** - * @const {?FPSConfig} Phaser.Boot.Config#fps - [description] - */ - this.fps = GetValue(config, 'fps', null); - - // Renderer Settings - // These can either be in a `render` object within the Config, or specified on their own - - var renderConfig = GetValue(config, 'render', config); - - /** - * @const {boolean} Phaser.Boot.Config#autoResize - Automatically resize the Game Canvas if you resize the renderer. - */ - this.autoResize = GetValue(renderConfig, 'autoResize', true); - - /** - * @const {boolean} Phaser.Boot.Config#antialias - [description] - */ - this.antialias = GetValue(renderConfig, 'antialias', true); - - /** - * @const {boolean} Phaser.Boot.Config#roundPixels - [description] - */ - this.roundPixels = GetValue(renderConfig, 'roundPixels', false); - - /** - * @const {boolean} Phaser.Boot.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). - */ - this.pixelArt = GetValue(renderConfig, 'pixelArt', false); - - if (this.pixelArt) - { - this.antialias = false; - this.roundPixels = true; - } - - /** - * @const {boolean} Phaser.Boot.Config#transparent - [description] - */ - this.transparent = GetValue(renderConfig, 'transparent', false); - - /** - * @const {boolean} Phaser.Boot.Config#clearBeforeRender - [description] - */ - this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); - - /** - * @const {boolean} Phaser.Boot.Config#premultipliedAlpha - [description] - */ - this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); - - /** - * @const {boolean} Phaser.Boot.Config#preserveDrawingBuffer - [description] - */ - this.preserveDrawingBuffer = GetValue(renderConfig, 'preserveDrawingBuffer', false); - - /** - * @const {boolean} Phaser.Boot.Config#failIfMajorPerformanceCaveat - [description] - */ - this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); - - /** - * @const {string} Phaser.Boot.Config#powerPreference - [description] - */ - this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); - - /** - * @const {integer} Phaser.Boot.Config#batchSize - The default WebGL Batch size. - */ - this.batchSize = GetValue(renderConfig, 'batchSize', 2000); - - /** - * @const {integer} Phaser.Boot.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - this.maxLights = GetValue(renderConfig, 'maxLights', 10); - - var bgc = GetValue(config, 'backgroundColor', 0); - - /** - * @const {Phaser.Display.Color} Phaser.Boot.Config#backgroundColor - [description] - */ - this.backgroundColor = ValueToColor(bgc); - - if (bgc === 0 && this.transparent) - { - this.backgroundColor.alpha = 0; - } - - // Callbacks - - /** - * @const {BootCallback} Phaser.Boot.Config#preBoot - [description] - */ - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); - - /** - * @const {BootCallback} Phaser.Boot.Config#postBoot - [description] - */ - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); - - // Physics - // physics: { - // system: 'impact', - // setBounds: true, - // gravity: 0, - // cellSize: 64 - // } - - /** - * @const {object} Phaser.Boot.Config#physics - [description] - */ - this.physics = GetValue(config, 'physics', {}); - - /** - * @const {boolean} Phaser.Boot.Config#defaultPhysicsSystem - [description] - */ - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); - - // Loader Defaults - - /** - * @const {string} Phaser.Boot.Config#loaderBaseURL - [description] - */ - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPath - [description] - */ - this.loaderPath = GetValue(config, 'loader.path', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). - */ - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); - - /** - * @const {(string|undefined)} Phaser.Boot.Config#loaderCrossOrigin - [description] - */ - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - - /** - * @const {string} Phaser.Boot.Config#loaderResponseType - [description] - */ - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - - /** - * @const {boolean} Phaser.Boot.Config#loaderAsync - [description] - */ - this.loaderAsync = GetValue(config, 'loader.async', true); - - /** - * @const {string} Phaser.Boot.Config#loaderUser - [description] - */ - this.loaderUser = GetValue(config, 'loader.user', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPassword - [description] - */ - this.loaderPassword = GetValue(config, 'loader.password', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderTimeout - [description] - */ - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); - - // Plugins - - /* - * Allows `plugins` property to either be an array, in which case it just replaces - * the default plugins like previously, or a config object. - * - * plugins: { - * global: [ - * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, - * ], - * scene: [ - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - * ], - * default: [], OR - * defaultMerge: [ - * 'ModPlayer' - * ] - * } - */ - - /** - * @const {any} Phaser.Boot.Config#installGlobalPlugins - [description] - */ - this.installGlobalPlugins = []; - - /** - * @const {any} Phaser.Boot.Config#installScenePlugins - [description] - */ - this.installScenePlugins = []; - - var plugins = GetValue(config, 'plugins', null); - var defaultPlugins = DefaultPlugins.DefaultScene; - - if (plugins) - { - // Old 3.7 array format? - if (Array.isArray(plugins)) - { - this.defaultPlugins = plugins; - } - else if (IsPlainObject(plugins)) - { - this.installGlobalPlugins = GetFastValue(plugins, 'global', []); - this.installScenePlugins = GetFastValue(plugins, 'scene', []); - - if (Array.isArray(plugins.default)) - { - defaultPlugins = plugins.default; - } - else if (Array.isArray(plugins.defaultMerge)) - { - defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); - } - } - } - - /** - * @const {any} Phaser.Boot.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). - */ - this.defaultPlugins = defaultPlugins; - - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - - /** - * @const {string} Phaser.Boot.Config#defaultImage - [description] - */ - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - - /** - * @const {string} Phaser.Boot.Config#missingImage - [description] - */ - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); - - if (window) - { - if (window.FORCE_WEBGL) - { - this.renderType = CONST.WEBGL; - } - else if (window.FORCE_CANVAS) - { - this.renderType = CONST.CANVAS; - } - } - } - -}); - -module.exports = Config; - - -/***/ }), -/* 904 */ -/***/ (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 AddToDOM = __webpack_require__(169); -var AnimationManager = __webpack_require__(381); -var CacheManager = __webpack_require__(379); -var CanvasPool = __webpack_require__(24); -var Class = __webpack_require__(0); -var Config = __webpack_require__(903); -var CreateRenderer = __webpack_require__(898); -var DataManager = __webpack_require__(123); -var DebugHeader = __webpack_require__(891); -var Device = __webpack_require__(340); -var DOMContentLoaded = __webpack_require__(344); -var EventEmitter = __webpack_require__(11); -var InputManager = __webpack_require__(338); -var PluginCache = __webpack_require__(15); -var PluginManager = __webpack_require__(331); -var SceneManager = __webpack_require__(329); -var SoundManagerCreator = __webpack_require__(325); -var TextureManager = __webpack_require__(318); -var TimeStep = __webpack_require__(878); -var VisibilityHandler = __webpack_require__(877); - -if (false) -{ var CreateDOMContainer; } - -if (false) -{ var FacebookInstantGamesPlugin; } - -/** - * @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 {GameConfig} [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; - - if (false) - {} - - /** - * A reference to the HTML Canvas Element that Phaser uses to render the game. - * This is created automatically by Phaser unless you provide a `canvas` property - * in your Game Config. - * - * @name Phaser.Game#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = null; - - /** - * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. - * If the game is running under Canvas it will be a 2d Canvas Rendering Context. - * If the game is running under WebGL it will be a WebGL Rendering Context. - * This context is created automatically by Phaser unless you provide a `context` property - * in your Game Config. - * - * @name Phaser.Game#context - * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} - * @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 {Phaser.Events.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); - - /** - * An instance of the Data Manager - * - * @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); - - /** - * 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.DeviceConf} - * @since 3.0.0 - */ - this.device = Device; - - /** - * 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.Sound.BaseSoundManager} - * @since 3.0.0 - */ - this.sound = SoundManagerCreator.create(this); - - /** - * 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); - - /** - * 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.Plugins.PluginManager} - * @since 3.0.0 - */ - this.plugins = new PluginManager(this, this.config); - - if (false) - {} - - /** - * Is this Game pending destruction at the start of the next frame? - * - * @name Phaser.Game#pendingDestroy - * @type {boolean} - * @private - * @since 3.5.0 - */ - this.pendingDestroy = false; - - /** - * Remove the Canvas once the destroy is over? - * - * @name Phaser.Game#removeCanvas - * @type {boolean} - * @private - * @since 3.5.0 - */ - this.removeCanvas = false; - - /** - * Remove everything when the game is destroyed. - * You cannot create a new Phaser instance on the same web page after doing this. - * - * @name Phaser.Game#noReturn - * @type {boolean} - * @private - * @since 3.12.0 - */ - this.noReturn = false; - - /** - * Does the window the game is running in currently have focus or not? - * This is modified by the VisibilityHandler. - * - * @name Phaser.Game#hasFocus - * @type {boolean} - * @readonly - * @since 3.9.0 - */ - this.hasFocus = false; - - /** - * Is the mouse pointer currently over the game canvas or not? - * This is modified by the VisibilityHandler. - * - * @name Phaser.Game#isOver - * @type {boolean} - * @readonly - * @since 3.10.0 - */ - this.isOver = true; - - // Wait for the DOM Ready event, then call boot. - DOMContentLoaded(this.boot.bind(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`. - * - * @method Phaser.Game#boot - * @protected - * @fires Phaser.Game#boot - * @since 3.0.0 - */ - boot: function () - { - if (!PluginCache.hasCore('EventEmitter')) - { - console.warn('Aborting. Core Plugins missing.'); - return; - } - - this.isBooted = true; - - this.config.preBoot(this); - - CreateRenderer(this); - - if (false) - {} - - 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 internal event when done: - this.events.once('texturesready', this.texturesReady, this); - }, - - /** - * Called automatically when the Texture Manager has finished setting up and preparing the - * default textures. - * - * @method Phaser.Game#texturesReady - * @private - * @fires Phaser.Game#ready - * @since 3.12.0 - */ - texturesReady: function () - { - // Start all the other systems - this.events.emit('ready'); - - this.start(); - }, - - /** - * 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; - - this.config.postBoot(this); - - if (this.renderer) - { - this.loop.start(this.step.bind(this)); - } - else - { - this.loop.start(this.headlessStep.bind(this)); - } - - VisibilityHandler(this); - - var eventEmitter = this.events; - - eventEmitter.on('hidden', this.onHidden, this); - eventEmitter.on('visible', this.onVisible, this); - eventEmitter.on('blur', this.onBlur, this); - eventEmitter.on('focus', this.onFocus, this); - }, - - /** - * Game Pre-Step event. - * - * Listen for it using the event type `prestep`. - * - * This event is dispatched before the main Step starts. - * By this point none of the Scene updates have happened. - * Hook into it from plugins or systems that need to update before the Scene Manager does. - * - * @event Phaser.Game#prestepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Step event. - * - * Listen for it using the event type `step`. - * - * This event is dispatched after Pre-Step and before the Scene Manager steps. - * Hook into it from plugins or systems that need to update before the Scene Manager does, but after core Systems. - * - * @event Phaser.Game#stepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Post-Step event. - * - * Listen for it using the event type `poststep`. - * - * This event is dispatched after the Scene Manager has updated. - * Hook into it from plugins or systems that need to do things before the render starts. - * - * @event Phaser.Game#poststepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Pre-Render event. - * - * Listen for it using the event type `prerender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * Game Post-Render event. - * - * Listen for it using the event type `postrender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * 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#prestepEvent - * @fires Phaser.Game#stepEvent - * @fires Phaser.Game#poststepEvent - * @fires Phaser.Game#prerenderEvent - * @fires Phaser.Game#postrenderEvent - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - step: function (time, delta) - { - if (this.pendingDestroy) - { - return this.runDestroy(); - } - - var eventEmitter = this.events; - - // Global Managers like Input and Sound update in the prestep - - eventEmitter.emit('prestep', time, delta); - - // This is mostly meant for user-land code and plugins - - eventEmitter.emit('step', time, delta); - - // Update the Scene Manager and all active Scenes - - this.scene.update(time, delta); - - // Our final event before rendering starts - - eventEmitter.emit('poststep', time, delta); - - var renderer = this.renderer; - - // Run the Pre-render (clearing the canvas, setting background colors, etc) - - renderer.preRender(); - - eventEmitter.emit('prerender', renderer, time, delta); - - // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. - - this.scene.render(renderer); - - // The Post-Render call. Tidies up loose end, takes snapshots, etc. - - renderer.postRender(); - - // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. - - eventEmitter.emit('postrender', renderer, time, delta); - }, - - /** - * 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 {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - headlessStep: function (time, delta) - { - var eventEmitter = this.events; - - // Global Managers - - eventEmitter.emit('prestep', time, delta); - - eventEmitter.emit('step', time, delta); - - // Scenes - - this.scene.update(time, delta); - - eventEmitter.emit('poststep', time, delta); - - // Render - - eventEmitter.emit('prerender'); - - eventEmitter.emit('postrender'); - }, - - /** - * Game Pause event. - * - * Listen for it using the event type `pause`. - * - * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. - * - * @event Phaser.Game#pauseEvent - */ - - /** - * 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(); - - this.events.emit('pause'); - }, - - /** - * Game Resume event. - * - * Listen for it using the event type `resume`. - * - * 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.Game#onVisible - * @protected - * @fires Phaser.Game#resumeEvent - * @since 3.0.0 - */ - onVisible: function () - { - this.loop.resume(); - - this.events.emit('resume'); - }, - - /** - * 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.hasFocus = false; - - this.loop.blur(); - }, - - /** - * 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.hasFocus = true; - - this.loop.focus(); - }, - - /** - * Game Resize event. - * - * Listen for it using the event type `resize`. - * - * @event Phaser.Game#resizeEvent - * @param {number} width - The new width of the Game. - * @param {number} height - The new height of the Game. - */ - - /** - * Updates the Game Config with the new width and height values given. - * Then resizes the Renderer and Input Manager scale. - * - * @method Phaser.Game#resize - * @fires Phaser.Game#resizeEvent - * @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; - - if (false) - {} - - this.renderer.resize(width, height); - - this.input.resize(); - - this.scene.resize(width, height); - - this.events.emit('resize', width, height); - }, - - /** - * Game Destroy event. - * - * Listen for it using the event type `destroy`. - * - * @event Phaser.Game#destroyEvent - */ - - /** - * Flags this Game instance as needing to be destroyed on the next frame. - * It will wait until the current frame has completed and then call `runDestroy` internally. - * - * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up - * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. - * - * @method Phaser.Game#destroy - * @fires Phaser.Game#destroyEvent - * @since 3.0.0 - * - * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. - * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. - */ - destroy: function (removeCanvas, noReturn) - { - if (noReturn === undefined) { noReturn = false; } - - this.pendingDestroy = true; - - this.removeCanvas = removeCanvas; - this.noReturn = noReturn; - }, - - /** - * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. - * - * @method Phaser.Game#runDestroy - * @private - * @since 3.5.0 - */ - runDestroy: function () - { - this.events.emit('destroy'); - - this.events.removeAllListeners(); - - this.scene.destroy(); - - if (this.renderer) - { - this.renderer.destroy(); - } - - if (this.removeCanvas && this.canvas) - { - CanvasPool.remove(this.canvas); - - if (this.canvas.parentNode) - { - this.canvas.parentNode.removeChild(this.canvas); - } - } - - if (false) - {} - - this.loop.destroy(); - - this.pendingDestroy = false; - } - -}); - -module.exports = Game; - - -/***/ }), -/* 905 */ -/***/ (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 EE = __webpack_require__(11); -var PluginCache = __webpack_require__(15); - -/** - * @classdesc - * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. - * - * @class EventEmitter - * @memberof Phaser.Events - * @constructor - * @since 3.0.0 - */ -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 () - { - this.removeAllListeners(); - } - -}); - -/** - * Return an array listing the events for which the emitter has registered listeners. - * - * @method Phaser.Events.EventEmitter#eventNames - * @since 3.0.0 - * - * @return {array} - */ - -/** - * Return the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#listeners - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {array} The registered listeners. - */ - -/** - * Return the number of listeners listening to a given event. - * - * @method Phaser.Events.EventEmitter#listenerCount - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {number} The number of listeners. - */ - -/** - * Calls each of the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#emit - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {...*} [args] - Additional arguments that will be passed to the event handler. - * - * @return {boolean} `true` if the event had listeners, else `false`. - */ - -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#on - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#addListener - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Add a one-time listener for a given event. - * - * @method Phaser.Events.EventEmitter#once - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#removeListener - * @since 3.0.0 - * - * @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 {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#off - * @since 3.0.0 - * - * @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 {Phaser.Events.EventEmitter} `this`. - */ - -/** - * Remove all listeners, or those of the specified event. - * - * @method Phaser.Events.EventEmitter#removeAllListeners - * @since 3.0.0 - * - * @param {(string|symbol)} [event] - The event name. - * - * @return {Phaser.Events.EventEmitter} `this`. - */ - -PluginCache.register('EventEmitter', EventEmitter, 'events'); - -module.exports = EventEmitter; - - -/***/ }), -/* 906 */ -/***/ (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.Events - */ - -module.exports = { EventEmitter: __webpack_require__(905) }; - - -/***/ }), -/* 907 */ +/* 1096 */ /***/ (function(module, exports) { // shim for using process in browser @@ -146233,2597 +159487,601 @@ process.umask = function() { return 0; }; /***/ }), -/* 908 */ +/* 1097 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.DOM - */ - -var Dom = { - - AddToDOM: __webpack_require__(169), - DOMContentLoaded: __webpack_require__(344), - ParseXML: __webpack_require__(343), - RemoveFromDOM: __webpack_require__(342), - RequestAnimationFrame: __webpack_require__(341) - -}; - -module.exports = Dom; - - -/***/ }), -/* 909 */ -/***/ (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.Display.Masks + * @namespace Phaser.Core */ module.exports = { - BitmapMask: __webpack_require__(394), - GeometryMask: __webpack_require__(393) + Config: __webpack_require__(390), + CreateRenderer: __webpack_require__(367), + DebugHeader: __webpack_require__(365), + Events: __webpack_require__(26), + TimeStep: __webpack_require__(364), + VisibilityHandler: __webpack_require__(362) }; /***/ }), -/* 910 */ -/***/ (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 ComponentToHex = __webpack_require__(346); - -/** - * 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 (prefix === '#') - { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - else - { - return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); - } -}; - -module.exports = RGBToString; - - -/***/ }), -/* 911 */ -/***/ (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 Between = __webpack_require__(170); -var Color = __webpack_require__(37); - -/** - * 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; } - - return new Color(Between(min, max), Between(min, max), Between(min, max)); -}; - -module.exports = RandomRGB; - - -/***/ }), -/* 912 */ -/***/ (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 Linear = __webpack_require__(119); - -/** - * Interpolates color values - * - * @namespace Phaser.Display.Color.Interpolate - * @since 3.0.0 - */ - -/** - * 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; } - - var t = index / length; - - return { - r: Linear(r1, r2, t), - g: Linear(g1, g2, t), - b: Linear(b1, b2, t) - }; -}; - -/** - * 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; } - - 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; } - - return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); -}; - -module.exports = { - - RGBWithRGB: RGBWithRGB, - ColorWithRGB: ColorWithRGB, - ColorWithColor: ColorWithColor - -}; - - -/***/ }), -/* 913 */ -/***/ (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 HSVToRGB = __webpack_require__(176); - -/** - * 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 {ColorObject[]} 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++) - { - colors.push(HSVToRGB(c / 359, s, v)); - } - - return colors; -}; - -module.exports = HSVColorWheel; - - -/***/ }), -/* 914 */ -/***/ (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__(37); -var HueToComponent = __webpack_require__(345); - -/** - * 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 q = (l < 0.5) ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - - r = HueToComponent(p, q, h + 1 / 3); - g = HueToComponent(p, q, h); - b = HueToComponent(p, q, h - 1 / 3); - } - - var color = new Color(); - - return color.setGLTo(r, g, b, 1); -}; - -module.exports = HSLToColor; - - -/***/ }), -/* 915 */ +/* 1098 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Systems Wake Event. + * + * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('wake', listener)`. + * + * @event Phaser.Scenes.Events#WAKE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was woken up. */ -var ColorToRGBA = function (color) -{ - var output = { - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF, - a: 255 - }; - - if (color > 16777215) - { - output.a = color >>> 24; - } - - return output; -}; - -module.exports = ColorToRGBA; +module.exports = 'wake'; /***/ }), -/* 916 */ +/* 1099 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Systems Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('update', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ -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; - }); - - canvas.style['-webkit-touch-callout'] = value; - canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - - return canvas; -}; - -module.exports = UserSelect; +module.exports = 'update'; /***/ }), -/* 917 */ +/* 1100 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Wake Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before + * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead. + * + * Listen to it from a Scene using `this.scene.events.on('transitionwake', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_WAKE + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -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; -}; - -module.exports = TouchAction; +module.exports = 'transitionwake'; /***/ }), -/* 918 */ -/***/ (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.Display.Canvas - */ - -module.exports = { - - CanvasInterpolation: __webpack_require__(348), - CanvasPool: __webpack_require__(24), - Smoothing: __webpack_require__(120), - TouchAction: __webpack_require__(917), - UserSelect: __webpack_require__(916) - -}; - - -/***/ }), -/* 919 */ +/* 1101 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Start Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep. + * + * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method, + * this event is dispatched anyway. + * + * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is + * dispatched instead of this event. + * + * Listen to it from a Scene using `this.scene.events.on('transitionstart', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_START + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -var GetOffsetY = function (gameObject) -{ - return gameObject.height * gameObject.originY; -}; - -module.exports = GetOffsetY; +module.exports = 'transitionstart'; /***/ }), -/* 920 */ +/* 1102 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * 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. + * The Scene Transition Out Event. + * + * This event is dispatched by a Scene when it initiates a transition to another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('transitionout', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_OUT + * + * @param {Phaser.Scene} target - A reference to the Scene that is being transitioned to. + * @param {number} duration - The duration of the transition in ms. */ -var GetOffsetX = function (gameObject) -{ - return gameObject.width * gameObject.originX; -}; - -module.exports = GetOffsetX; +module.exports = 'transitionout'; /***/ }), -/* 921 */ -/***/ (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.Display.Bounds - */ - -module.exports = { - - CenterOn: __webpack_require__(411), - GetBottom: __webpack_require__(48), - GetCenterX: __webpack_require__(75), - GetCenterY: __webpack_require__(72), - GetLeft: __webpack_require__(46), - GetOffsetX: __webpack_require__(920), - GetOffsetY: __webpack_require__(919), - GetRight: __webpack_require__(44), - GetTop: __webpack_require__(42), - SetBottom: __webpack_require__(47), - SetCenterX: __webpack_require__(74), - SetCenterY: __webpack_require__(73), - SetLeft: __webpack_require__(45), - SetRight: __webpack_require__(43), - SetTop: __webpack_require__(41) - -}; - - -/***/ }), -/* 922 */ -/***/ (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__(44); -var GetTop = __webpack_require__(42); -var SetBottom = __webpack_require__(47); -var SetRight = __webpack_require__(43); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopRight; - - -/***/ }), -/* 923 */ -/***/ (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 GetLeft = __webpack_require__(46); -var GetTop = __webpack_require__(42); -var SetBottom = __webpack_require__(47); -var SetLeft = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopLeft; - - -/***/ }), -/* 924 */ -/***/ (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 GetCenterX = __webpack_require__(75); -var GetTop = __webpack_require__(42); -var SetBottom = __webpack_require__(47); -var SetCenterX = __webpack_require__(74); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = TopCenter; - - -/***/ }), -/* 925 */ -/***/ (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__(44); -var GetTop = __webpack_require__(42); -var SetLeft = __webpack_require__(45); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = RightTop; - - -/***/ }), -/* 926 */ -/***/ (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 GetCenterY = __webpack_require__(72); -var GetRight = __webpack_require__(44); -var SetCenterY = __webpack_require__(73); -var SetLeft = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = RightCenter; - - -/***/ }), -/* 927 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetRight = __webpack_require__(44); -var SetBottom = __webpack_require__(47); -var SetLeft = __webpack_require__(45); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = RightBottom; - - -/***/ }), -/* 928 */ -/***/ (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 GetLeft = __webpack_require__(46); -var GetTop = __webpack_require__(42); -var SetRight = __webpack_require__(43); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = LeftTop; - - -/***/ }), -/* 929 */ -/***/ (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 GetCenterY = __webpack_require__(72); -var GetLeft = __webpack_require__(46); -var SetCenterY = __webpack_require__(73); -var SetRight = __webpack_require__(43); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = LeftCenter; - - -/***/ }), -/* 930 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetLeft = __webpack_require__(46); -var SetBottom = __webpack_require__(47); -var SetRight = __webpack_require__(43); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = LeftBottom; - - -/***/ }), -/* 931 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetRight = __webpack_require__(44); -var SetRight = __webpack_require__(43); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomRight; - - -/***/ }), -/* 932 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetLeft = __webpack_require__(46); -var SetLeft = __webpack_require__(45); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomLeft; - - -/***/ }), -/* 933 */ -/***/ (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 GetBottom = __webpack_require__(48); -var GetCenterX = __webpack_require__(75); -var SetCenterX = __webpack_require__(74); -var SetTop = __webpack_require__(41); - -/** - * 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 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @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; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomCenter; - - -/***/ }), -/* 934 */ -/***/ (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.Display.Align.To - */ - -module.exports = { - - BottomCenter: __webpack_require__(933), - BottomLeft: __webpack_require__(932), - BottomRight: __webpack_require__(931), - LeftBottom: __webpack_require__(930), - LeftCenter: __webpack_require__(929), - LeftTop: __webpack_require__(928), - RightBottom: __webpack_require__(927), - RightCenter: __webpack_require__(926), - RightTop: __webpack_require__(925), - TopCenter: __webpack_require__(924), - TopLeft: __webpack_require__(923), - TopRight: __webpack_require__(922) - -}; - - -/***/ }), -/* 935 */ -/***/ (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.Display.Align.In - */ - -module.exports = { - - BottomCenter: __webpack_require__(415), - BottomLeft: __webpack_require__(414), - BottomRight: __webpack_require__(413), - Center: __webpack_require__(412), - LeftCenter: __webpack_require__(410), - QuickSet: __webpack_require__(416), - RightCenter: __webpack_require__(409), - TopCenter: __webpack_require__(408), - TopLeft: __webpack_require__(407), - TopRight: __webpack_require__(406) - -}; - - -/***/ }), -/* 936 */ -/***/ (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 CONST = __webpack_require__(193); -var Extend = __webpack_require__(20); - -/** - * @namespace Phaser.Display.Align - */ - -var Align = { - - In: __webpack_require__(935), - To: __webpack_require__(934) - -}; - -// Merge in the consts -Align = Extend(false, Align, CONST); - -module.exports = Align; - - -/***/ }), -/* 937 */ -/***/ (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.Display - */ - -module.exports = { - - Align: __webpack_require__(936), - Bounds: __webpack_require__(921), - Canvas: __webpack_require__(918), - Color: __webpack_require__(347), - Masks: __webpack_require__(909) - -}; - - -/***/ }), -/* 938 */ -/***/ (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__(123); -var PluginCache = __webpack_require__(15); - -/** - * @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 - A reference to the Scene that this DataManager belongs to. - */ -var DataManagerPlugin = new Class({ - - Extends: DataManager, - - initialize: - - function DataManagerPlugin (scene) - { - DataManager.call(this, scene, scene.sys.events); - - /** - * A reference to the Scene that this DataManager belongs to. - * - * @name Phaser.Data.DataManagerPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene's Systems. - * - * @name Phaser.Data.DataManagerPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Data.DataManagerPlugin#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.events = this.systems.events; - - this.events.once('destroy', this.destroy, this); - }, - - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Data.DataManagerPlugin#start - * @private - * @since 3.5.0 - */ - start: function () - { - this.events.once('shutdown', this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.Data.DataManagerPlugin#shutdown - * @private - * @since 3.5.0 - */ - shutdown: function () - { - this.systems.events.off('shutdown', this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Data.DataManagerPlugin#destroy - * @since 3.5.0 - */ - destroy: function () - { - DataManager.prototype.destroy.call(this); - - this.events.off('start', this.start, this); - - this.scene = null; - this.systems = null; - } - -}); - -PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); - -module.exports = DataManagerPlugin; - - -/***/ }), -/* 939 */ -/***/ (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__(123), - DataManagerPlugin: __webpack_require__(938) - -}; - - -/***/ }), -/* 940 */ -/***/ (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__(3); - -/** - * @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); - }, - - /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.MoveTo#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - 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 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, - - /** - * Gets the resolution of this curve. - * - * @method Phaser.Curves.MoveTo#getResolution - * @since 3.0.0 - * - * @return {number} The resolution of this curve. For a MoveTo the value is always 1. - */ - getResolution: function () - { - return 1; - }, - - /** - * Gets the length of this curve. - * - * @method Phaser.Curves.MoveTo#getLength - * @since 3.0.0 - * - * @return {number} The length of this curve. For a MoveTo the value is always 0. - */ - getLength: function () - { - return 0; - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#toJSON - * @since 3.0.0 - * - * @return {JSONCurve} [description] - */ - toJSON: function () - { - return { - type: 'MoveTo', - points: [ - this.p0.x, this.p0.y - ] - }; - } - -}); - -module.exports = MoveTo; - - -/***/ }), -/* 941 */ -/***/ (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 CubicBezierCurve = __webpack_require__(355); -var EllipseCurve = __webpack_require__(353); -var GameObjectFactory = __webpack_require__(5); -var LineCurve = __webpack_require__(352); -var MovePathTo = __webpack_require__(940); -var QuadraticBezierCurve = __webpack_require__(351); -var Rectangle = __webpack_require__(9); -var SplineCurve = __webpack_require__(349); -var Vector2 = __webpack_require__(3); - -/** - * @typedef {object} JSONPath - * - * @property {string} type - The of the curve. - * @property {number} x - [description] - * @property {number} y - [description] - * @property {boolean} autoClose - The path is auto closed. - * @property {JSONCurve[]} curves - The list of the curves - */ - -/** - * @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({ - - initialize: - - function Path (x, y) - { - 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 {Phaser.Curves.Curve[]} - * @default [] - * @since 3.0.0 - */ - this.curves = []; - - /** - * [description] - * - * @name Phaser.Curves.Path#cacheLengths - * @type {number[]} - * @default [] - * @since 3.0.0 - */ - this.cacheLengths = []; - - /** - * Automatically closes the path. - * - * @name Phaser.Curves.Path#autoClose - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.autoClose = false; - - /** - * [description] - * - * @name Phaser.Curves.Path#startPoint - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.startPoint = new Vector2(); - - /** - * [description] - * - * @name Phaser.Curves.Path#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); - - /** - * [description] - * - * @name Phaser.Curves.Path#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); - - if (typeof x === 'object') - { - this.fromJSON(x); - } - else - { - this.startPoint.set(x, y); - } - }, - - /** - * [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); - - return this; - }, - - /** - * [description] - * - * @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] - */ - circleTo: function (radius, clockwise, rotation) - { - if (clockwise === undefined) { clockwise = false; } - - return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); - }, - - /** - * [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)); - } - - return this; - }, - - /** - * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. - * - * @method Phaser.Curves.Path#cubicBezierTo - * @since 3.0.0 - * - * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vec2, the p1 value. - * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vec2, the p2 value. - * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vec2, the p3 value. - * @param {number} [control1Y] - The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments. - * @param {number} [control2X] - The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. - * @param {number} [control2Y] - The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments. - * - * @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) - { - 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.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] - */ - 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.Curves.Path#draw - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.Graphics} G - [out,$return] - * - * @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]; - - if (!curve.active) - { - continue; - } - - curve.draw(graphics, pointsTotal); - } - - return graphics; - }, - - /** - * 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); - - 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.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.curves = []; - this.cacheLengths = []; - - this.startPoint.set(data.x, data.y); - - this.autoClose = data.autoClose; - - for (var i = 0; i < data.curves.length; i++) - { - 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; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getBounds - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @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; - - 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]; - - 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); - } - - out.right = maxRight; - out.bottom = maxBottom; - - return out; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getCurveLengths - * @since 3.0.0 - * - * @return {number[]} [description] - */ - getCurveLengths: function () - { - // We use cache values if curves and cache array are same length - - if (this.cacheLengths.length === this.curves.length) - { - return this.cacheLengths; - } - - // Get length of sub-curve - // Push sums into cached array - - var lengths = []; - var sums = 0; - - for (var i = 0; i < this.curves.length; i++) - { - sums += this.curves[i].getLength(); - - lengths.push(sums); - } - - this.cacheLengths = lengths; - - return lengths; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getEndPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getEndPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - if (this.curves.length > 0) - { - this.curves[this.curves.length - 1].getPoint(1, out); - } - else - { - out.copy(this.startPoint); - } - - return out; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lens = this.getCurveLengths(); - - return lens[lens.length - 1]; - }, - - // 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 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @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(); } - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; - - while (i < curveLengths.length) - { - 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++; - } - - // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) - { - points.push(points[0]); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getRandomPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. - * - * @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)); - } - - if (this.autoClose) - { - points.push(points[0]); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#getStartPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - 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.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._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.Curves.Path#splineTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2[]} points - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - splineTo: function (points) - { - points.unshift(this.getEndPoint()); - - return this.add(new SplineCurve(points)); - }, - - /** - * [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)); - }, - - /** - * [description] - * - * @method Phaser.Curves.Path#toJSON - * @since 3.0.0 - * - * @return {JSONPath} [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.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; - - -/***/ }), -/* 942 */ -/***/ (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.Curves - */ - -/** - * @typedef {object} JSONCurve - * - * @property {string} type - The of the curve - * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` - */ - -module.exports = { - Path: __webpack_require__(941), - - CubicBezier: __webpack_require__(355), - Curve: __webpack_require__(70), - Ellipse: __webpack_require__(353), - Line: __webpack_require__(352), - QuadraticBezier: __webpack_require__(351), - Spline: __webpack_require__(349) -}; - - -/***/ }), -/* 943 */ +/* 1103 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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. - * - * @name Phaser.Create.Palettes.MSX - * @since 3.0.0 - * - * @type {Palette} + * The Scene Transition Init Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method, + * this event is not dispatched. + * + * Listen to it from a Scene using `this.scene.events.on('transitioninit', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_INIT + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -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' -}; +module.exports = 'transitioninit'; /***/ }), -/* 944 */ +/* 1104 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.JMP - * @since 3.0.0 - * - * @type {Palette} + * The Scene Transition Complete Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration + * of the transition. + * + * Listen to it from a Scene using `this.scene.events.on('transitioncomplete', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_COMPLETE + * + * @param {Phaser.Scene} scene -The Scene on which the transitioned completed. */ -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' -}; +module.exports = 'transitioncomplete'; /***/ }), -/* 945 */ +/* 1105 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.CGA - * @since 3.0.0 - * - * @type {Palette} + * The Scene Systems Start Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('start', listener)`. + * + * @event Phaser.Scenes.Events#START + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. */ -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' -}; +module.exports = 'start'; /***/ }), -/* 946 */ +/* 1106 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @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 {Palette} + * The Scene Systems Sleep Event. + * + * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('sleep', listener)`. + * + * @event Phaser.Scenes.Events#SLEEP + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was sent to sleep. */ -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' -}; +module.exports = 'sleep'; /***/ }), -/* 947 */ +/* 1107 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Shutdown Event. + * + * This event is dispatched by a Scene during the Scene Systems shutdown process. + * + * Listen to it from a Scene using `this.scene.events.on('shutdown', listener)`. + * + * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding + * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not + * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources. + * + * @event Phaser.Scenes.Events#SHUTDOWN + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was shutdown. + */ +module.exports = 'shutdown'; + + +/***/ }), +/* 1108 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Resume Event. + * + * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('resume', listener)`. + * + * @event Phaser.Scenes.Events#RESUME + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was resumed. + */ +module.exports = 'resume'; + + +/***/ }), +/* 1109 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Render Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('render', listener)`. + * + * A Scene will only render if it is visible and active. + * By the time this event is dispatched, the Scene will have already been rendered. + * + * @event Phaser.Scenes.Events#RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. + */ +module.exports = 'render'; + + +/***/ }), +/* 1110 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Ready Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. + * By this point in the process the Scene is now fully active and rendering. + * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event. + * + * Listen to it from a Scene using `this.scene.events.on('ready', listener)`. + * + * @event Phaser.Scenes.Events#READY + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was started. + */ +module.exports = 'ready'; + + +/***/ }), +/* 1111 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pre Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('preupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#PRE_UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'preupdate'; + + +/***/ }), +/* 1112 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Post Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('postupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#POST_UPDATE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'postupdate'; + + +/***/ }), +/* 1113 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pause Event. + * + * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an + * action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('pause', listener)`. + * + * @event Phaser.Scenes.Events#PAUSE + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was paused. + */ +module.exports = 'pause'; + + +/***/ }), +/* 1114 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Destroy Event. + * + * This event is dispatched by a Scene during the Scene Systems destroy process. + * + * Listen to it from a Scene using `this.scene.events.on('destroy', listener)`. + * + * You should destroy any resources that may be in use by your Scene in this event handler. + * + * @event Phaser.Scenes.Events#DESTROY + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1115 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Boot Event. + * + * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('boot', listener)`. + * + * @event Phaser.Scenes.Events#BOOT + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'boot'; + + +/***/ }), +/* 1116 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} Palette - * - * @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. - */ - -/** - * @namespace Phaser.Create.Palettes - */ - -module.exports = { - - ARNE16: __webpack_require__(356), - C64: __webpack_require__(946), - CGA: __webpack_require__(945), - JMP: __webpack_require__(944), - MSX: __webpack_require__(943) - -}; - - -/***/ }), -/* 948 */ -/***/ (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.Create - */ - -module.exports = { - - GenerateTexture: __webpack_require__(357), - Palettes: __webpack_require__(947) - -}; - - -/***/ }), -/* 949 */ -/***/ (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 Camera = __webpack_require__(378); +var Camera = __webpack_require__(411); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(15); -var RectangleContains = __webpack_require__(39); +var PluginCache = __webpack_require__(17); +var RectangleContains = __webpack_require__(42); +var SceneEvents = __webpack_require__(16); /** * @typedef {object} InputJSONCameraObject @@ -148949,17 +160207,8 @@ var CameraManager = new Class({ */ this.main; - /** - * This scale affects all cameras. It's used by the Scale Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#baseScale - * @type {number} - * @since 3.0.0 - */ - this.baseScale = 1; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -148968,6 +160217,7 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#boot * @private + * @listens Phaser.Scenes.Events#DESTROY * @since 3.5.1 */ boot: function () @@ -148987,7 +160237,7 @@ var CameraManager = new Class({ this.main = this.cameras[0]; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -148997,6 +160247,8 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#start * @private + * @listens Phaser.Scenes.Events#UPDATE + * @listens Phaser.Scenes.Events#SHUTDOWN * @since 3.5.0 */ start: function () @@ -149021,8 +160273,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -149037,7 +160289,7 @@ var CameraManager = new Class({ * By default Cameras are transparent and will render anything that they can see based on their `scrollX` * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. * - * The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after creation if required. * * See the Camera class documentation for more details. @@ -149058,8 +160310,8 @@ var CameraManager = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (makeMain === undefined) { makeMain = false; } if (name === undefined) { name = ''; } @@ -149086,7 +160338,7 @@ var CameraManager = new Class({ * * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. * - * The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after addition if required. * * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the @@ -149227,8 +160479,8 @@ var CameraManager = new Class({ config = [ config ]; } - var gameWidth = this.scene.sys.game.config.width; - var gameHeight = this.scene.sys.game.config.height; + var gameWidth = this.scene.sys.scale.width; + var gameHeight = this.scene.sys.scale.height; for (var i = 0; i < config.length; i++) { @@ -149413,8 +160665,6 @@ var CameraManager = new Class({ { var scene = this.scene; var cameras = this.cameras; - var baseScale = this.baseScale; - var resolution = renderer.config.resolution; for (var i = 0; i < this.cameras.length; i++) { @@ -149422,7 +160672,8 @@ var CameraManager = new Class({ if (camera.visible && camera.alpha > 0) { - camera.preRender(baseScale, resolution); + // Hard-coded to 1 for now + camera.preRender(1); renderer.render(scene, children, interpolation, camera); } @@ -149461,14 +160712,14 @@ var CameraManager = new Class({ * @protected * @since 3.0.0 * - * @param {number} timestep - The timestep value. - * @param {number} delta - The delta value since the last frame. + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - update: function (timestep, delta) + update: function (time, delta) { for (var i = 0; i < this.cameras.length; i++) { - this.cameras[i].update(timestep, delta); + this.cameras[i].update(time, delta); } }, @@ -149510,8 +160761,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -149526,7 +160777,7 @@ var CameraManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -149540,18 +160791,19 @@ module.exports = CameraManager; /***/ }), -/* 950 */ +/* 1117 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(174); +var EaseMap = __webpack_require__(188); +var Events = __webpack_require__(40); /** * @classdesc @@ -149683,36 +160935,18 @@ var Zoom = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the Zoom effect begins to run on a camera. - * - * @event CameraZoomStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} zoom - The destination zoom value. - */ - - /** - * This event is fired when the Zoom effect completes. - * - * @event CameraZoomCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - */ - /** * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#start - * @fires CameraZoomStartEvent - * @fires CameraZoomCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. * @param {CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * and the current camera zoom value. @@ -149760,7 +160994,7 @@ var Zoom = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerazoomstart', this.camera, this, duration, zoom); + this.camera.emit(Events.ZOOM_START, this.camera, this, duration, zoom); return cam; }, @@ -149811,6 +161045,7 @@ var Zoom = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -149820,7 +161055,7 @@ var Zoom = new Class({ this.isRunning = false; - this.camera.emit('camerazoomcomplete', this.camera, this); + this.camera.emit(Events.ZOOM_COMPLETE, this.camera, this); }, /** @@ -149857,17 +161092,18 @@ module.exports = Zoom; /***/ }), -/* 951 */ +/* 1118 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(40); var Vector2 = __webpack_require__(3); /** @@ -150008,30 +161244,12 @@ var Shake = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the shake effect begins to run on a camera. - * - * @event CameraShakeStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} intensity - The intensity of the effect. - */ - - /** - * This event is fired when the shake effect completes. - * - * @event CameraShakeCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - */ - /** * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Shake#start - * @fires CameraShakeStartEvent - * @fires CameraShakeCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -150076,7 +161294,7 @@ var Shake = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerashakestart', this.camera, this, duration, intensity); + this.camera.emit(Events.SHAKE_START, this.camera, this, duration, intensity); return this.camera; }, @@ -150132,8 +161350,8 @@ var Shake = new Class({ if (this.camera.roundPixels) { - this._offsetX |= 0; - this._offsetY |= 0; + this._offsetX = Math.round(this._offsetX); + this._offsetY = Math.round(this._offsetY); } } else @@ -150146,6 +161364,7 @@ var Shake = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Shake#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -150158,7 +161377,7 @@ var Shake = new Class({ this.isRunning = false; - this.camera.emit('camerashakecomplete', this.camera, this); + this.camera.emit(Events.SHAKE_COMPLETE, this.camera, this); }, /** @@ -150199,12 +161418,12 @@ module.exports = Shake; /***/ }), -/* 952 */ +/* 1119 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150241,12 +161460,12 @@ module.exports = Stepped; /***/ }), -/* 953 */ +/* 1120 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150280,12 +161499,12 @@ module.exports = InOut; /***/ }), -/* 954 */ +/* 1121 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150319,12 +161538,12 @@ module.exports = Out; /***/ }), -/* 955 */ +/* 1122 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150358,12 +161577,12 @@ module.exports = In; /***/ }), -/* 956 */ +/* 1123 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150393,12 +161612,12 @@ module.exports = InOut; /***/ }), -/* 957 */ +/* 1124 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150421,12 +161640,12 @@ module.exports = Out; /***/ }), -/* 958 */ +/* 1125 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150449,12 +161668,12 @@ module.exports = In; /***/ }), -/* 959 */ +/* 1126 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150484,12 +161703,12 @@ module.exports = InOut; /***/ }), -/* 960 */ +/* 1127 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150512,12 +161731,12 @@ module.exports = Out; /***/ }), -/* 961 */ +/* 1128 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150540,12 +161759,12 @@ module.exports = In; /***/ }), -/* 962 */ +/* 1129 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150575,12 +161794,12 @@ module.exports = InOut; /***/ }), -/* 963 */ +/* 1130 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150603,12 +161822,12 @@ module.exports = Out; /***/ }), -/* 964 */ +/* 1131 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150631,12 +161850,12 @@ module.exports = In; /***/ }), -/* 965 */ +/* 1132 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150659,12 +161878,12 @@ module.exports = Linear; /***/ }), -/* 966 */ +/* 1133 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150694,12 +161913,12 @@ module.exports = InOut; /***/ }), -/* 967 */ +/* 1134 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150722,12 +161941,12 @@ module.exports = Out; /***/ }), -/* 968 */ +/* 1135 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150750,12 +161969,12 @@ module.exports = In; /***/ }), -/* 969 */ +/* 1136 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150767,7 +161986,7 @@ module.exports = In; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -150812,12 +162031,12 @@ module.exports = InOut; /***/ }), -/* 970 */ +/* 1137 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150829,7 +162048,7 @@ module.exports = InOut; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -150867,12 +162086,12 @@ module.exports = Out; /***/ }), -/* 971 */ +/* 1138 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150884,7 +162103,7 @@ module.exports = Out; * * @param {number} v - The value to be tweened. * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - [description] + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. * * @return {number} The tweened value. */ @@ -150922,12 +162141,12 @@ module.exports = In; /***/ }), -/* 972 */ +/* 1139 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150957,12 +162176,12 @@ module.exports = InOut; /***/ }), -/* 973 */ +/* 1140 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -150985,12 +162204,12 @@ module.exports = Out; /***/ }), -/* 974 */ +/* 1141 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151013,12 +162232,12 @@ module.exports = In; /***/ }), -/* 975 */ +/* 1142 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151048,12 +162267,12 @@ module.exports = InOut; /***/ }), -/* 976 */ +/* 1143 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151076,12 +162295,12 @@ module.exports = Out; /***/ }), -/* 977 */ +/* 1144 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151104,12 +162323,12 @@ module.exports = In; /***/ }), -/* 978 */ +/* 1145 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151168,12 +162387,12 @@ module.exports = InOut; /***/ }), -/* 979 */ +/* 1146 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151211,12 +162430,12 @@ module.exports = Out; /***/ }), -/* 980 */ +/* 1147 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151256,12 +162475,12 @@ module.exports = In; /***/ }), -/* 981 */ +/* 1148 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151296,12 +162515,12 @@ module.exports = InOut; /***/ }), -/* 982 */ +/* 1149 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151327,12 +162546,12 @@ module.exports = Out; /***/ }), -/* 983 */ +/* 1150 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151358,19 +162577,20 @@ module.exports = In; /***/ }), -/* 984 */ +/* 1151 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var EaseMap = __webpack_require__(188); +var Events = __webpack_require__(40); var Vector2 = __webpack_require__(3); -var EaseMap = __webpack_require__(174); /** * @classdesc @@ -151516,39 +162736,20 @@ var Pan = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the pan effect begins to run on a camera. - * - * @event CameraPanStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} x - The destination scroll x coordinate. - * @param {number} y - The destination scroll y coordinate. - */ - - /** - * This event is fired when the pan effect completes. - * - * @event CameraPanCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - */ - /** * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Pan#start - * @fires CameraPanStartEvent - * @fires CameraPanCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -151599,7 +162800,7 @@ var Pan = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerapanstart', this.camera, this, duration, x, y); + this.camera.emit(Events.PAN_START, this.camera, this, duration, x, y); return cam; }, @@ -151661,6 +162862,7 @@ var Pan = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Pan#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -151670,7 +162872,7 @@ var Pan = new Class({ this.isRunning = false; - this.camera.emit('camerapancomplete', this.camera, this); + this.camera.emit(Events.PAN_COMPLETE, this.camera, this); }, /** @@ -151709,17 +162911,18 @@ module.exports = Pan; /***/ }), -/* 985 */ +/* 1152 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(40); /** * @classdesc @@ -151870,32 +163073,12 @@ var Flash = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the flash effect begins to run on a camera. - * - * @event CameraFlashStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the flash effect completes. - * - * @event CameraFlashCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - */ - /** * Flashes the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Flash#start - * @fires CameraFlashStartEvent - * @fires CameraFlashCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -151938,7 +163121,7 @@ var Flash = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('cameraflashstart', this.camera, this, duration, red, green, blue); + this.camera.emit(Events.FLASH_START, this.camera, this, duration, red, green, blue); return this.camera; }, @@ -152039,6 +163222,7 @@ var Flash = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Flash#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -152048,7 +163232,7 @@ var Flash = new Class({ this.isRunning = false; - this.camera.emit('cameraflashcomplete', this.camera, this); + this.camera.emit(Events.FLASH_COMPLETE, this.camera, this); }, /** @@ -152085,17 +163269,18 @@ module.exports = Flash; /***/ }), -/* 986 */ +/* 1153 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = __webpack_require__(23); var Class = __webpack_require__(0); +var Events = __webpack_require__(40); /** * @classdesc @@ -152271,54 +163456,12 @@ var Fade = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the fade in effect begins to run on a camera. - * - * @event CameraFadeInStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade out effect begins to run on a camera. - * - * @event CameraFadeOutStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade in effect completes. - * - * @event CameraFadeInCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - - /** - * This event is fired when the fade out effect completes. - * - * @event CameraFadeOutCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - /** * Fades the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Fade#start - * @fires CameraFadeInStartEvent - * @fires CameraFadeInCompleteEvent - * @fires CameraFadeOutStartEvent - * @fires CameraFadeOutCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START * @since 3.5.0 * * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) @@ -152365,7 +163508,7 @@ var Fade = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - var eventName = (direction) ? 'camerafadeoutstart' : 'camerafadeinstart'; + var eventName = (direction) ? Events.FADE_OUT_START : Events.FADE_IN_START; this.camera.emit(eventName, this.camera, this, duration, red, green, blue); @@ -152468,6 +163611,8 @@ var Fade = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Fade#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -152478,7 +163623,7 @@ var Fade = new Class({ this.isRunning = false; this.isComplete = true; - var eventName = (this.direction) ? 'camerafadeoutcomplete' : 'camerafadeincomplete'; + var eventName = (this.direction) ? Events.FADE_OUT_COMPLETE : Events.FADE_IN_COMPLETE; this.camera.emit(eventName, this.camera, this); }, @@ -152518,12 +163663,387 @@ module.exports = Fade; /***/ }), -/* 987 */ +/* 1154 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Start Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} zoom - The destination zoom value. + */ +module.exports = 'camerazoomstart'; + + +/***/ }), +/* 1155 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Complete Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + */ +module.exports = 'camerazoomcomplete'; + + +/***/ }), +/* 1156 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Start Event. + * + * This event is dispatched by a Camera instance when the Shake Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} intensity - The intensity of the effect. + */ +module.exports = 'camerashakestart'; + + +/***/ }), +/* 1157 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Complete Event. + * + * This event is dispatched by a Camera instance when the Shake Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + */ +module.exports = 'camerashakecomplete'; + + +/***/ }), +/* 1158 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pre-Render Event. + * + * This event is dispatched by a Camera instance when it is about to render. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('prerender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#PRE_RENDER + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that is about to render to a texture. + */ +module.exports = 'prerender'; + + +/***/ }), +/* 1159 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Post-Render Event. + * + * This event is dispatched by a Camera instance after is has finished rendering. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('postrender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#POST_RENDER + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that has finished rendering to a texture. + */ +module.exports = 'postrender'; + + +/***/ }), +/* 1160 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Start Event. + * + * This event is dispatched by a Camera instance when the Pan Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} x - The destination scroll x coordinate. + * @param {number} y - The destination scroll y coordinate. + */ +module.exports = 'camerapanstart'; + + +/***/ }), +/* 1161 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Complete Event. + * + * This event is dispatched by a Camera instance when the Pan Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + */ +module.exports = 'camerapancomplete'; + + +/***/ }), +/* 1162 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Start Event. + * + * This event is dispatched by a Camera instance when the Flash Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'cameraflashstart'; + + +/***/ }), +/* 1163 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Complete Event. + * + * This event is dispatched by a Camera instance when the Flash Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + */ +module.exports = 'cameraflashcomplete'; + + +/***/ }), +/* 1164 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Start Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeoutstart'; + + +/***/ }), +/* 1165 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Complete Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutcomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeoutcomplete'; + + +/***/ }), +/* 1166 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Start Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeinstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_START + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeinstart'; + + +/***/ }), +/* 1167 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Complete Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeincomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeincomplete'; + + +/***/ }), +/* 1168 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Destroy Camera Event. + * + * This event is dispatched by a Camera instance when it is destroyed by the Camera Manager. + * + * @event Phaser.Cameras.Scene2D.Events#DESTROY + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. + */ +module.exports = 'cameradestroy'; + + +/***/ }), +/* 1169 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -152533,40 +164053,27 @@ module.exports = Fade; module.exports = { - Camera: __webpack_require__(378), - CameraManager: __webpack_require__(949), - Effects: __webpack_require__(370) + Camera: __webpack_require__(411), + CameraManager: __webpack_require__(1116), + Effects: __webpack_require__(403), + Events: __webpack_require__(40) }; /***/ }), -/* 988 */ +/* 1170 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 -// }; - /** * @typedef {object} SmoothedKeyControlConfig * @@ -152584,14 +164091,36 @@ var GetValue = __webpack_require__(4); /** * @classdesc - * [description] + * A Smoothed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * Unlike the Fixed Camera Control you can also provide physics values for acceleration, drag and maxSpeed for smoothing effects. + * + * ```javascript + * + * 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 + * }; + * ``` + * + * You must call the `update` method of this controller every frame. * * @class SmoothedKeyControl * @memberof Phaser.Cameras.Controls * @constructor * @since 3.0.0 * - * @param {SmoothedKeyControlConfig} config - [description] + * @param {SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. */ var SmoothedKeyControl = new Class({ @@ -152779,7 +164308,7 @@ var SmoothedKeyControl = new Class({ } /** - * [description] + * Internal property to track the speed of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX * @type {number} @@ -152790,7 +164319,7 @@ var SmoothedKeyControl = new Class({ this._speedX = 0; /** - * [description] + * Internal property to track the speed of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY * @type {number} @@ -152801,7 +164330,7 @@ var SmoothedKeyControl = new Class({ this._speedY = 0; /** - * [description] + * Internal property to track the zoom of the control. * * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom * @type {number} @@ -152869,12 +164398,14 @@ var SmoothedKeyControl = new Class({ }, /** - * [description] + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. * * @method Phaser.Cameras.Controls.SmoothedKeyControl#update * @since 3.0.0 * - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ update: function (delta) { @@ -153030,25 +164561,18 @@ module.exports = SmoothedKeyControl; /***/ }), -/* 989 */ +/* 1171 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 camControl = new CameraControl({ -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// speed: float OR { x: 0, y: 0 } -// }) - /** * @typedef {object} FixedKeyControlConfig * @@ -153065,14 +164589,29 @@ var GetValue = __webpack_require__(4); /** * @classdesc - * [description] + * A Fixed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * + * ```javascript + * var camControl = new FixedKeyControl({ + * camera: this.cameras.main, + * left: cursors.left, + * right: cursors.right, + * speed: float OR { x: 0, y: 0 } + * }); + * ``` + * + * Movement is precise and has no 'smoothing' applied to it. + * + * You must call the `update` method of this controller every frame. * * @class FixedKeyControl * @memberof Phaser.Cameras.Controls * @constructor * @since 3.0.0 * - * @param {FixedKeyControlConfig} config - [description] + * @param {FixedKeyControlConfig} config - The Fixed Key Control configuration object. */ var FixedKeyControl = new Class({ @@ -153194,7 +164733,7 @@ var FixedKeyControl = new Class({ } /** - * [description] + * Internal property to track the current zoom level. * * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom * @type {number} @@ -153262,7 +164801,9 @@ var FixedKeyControl = new Class({ }, /** - * [description] + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. * * @method Phaser.Cameras.Controls.FixedKeyControl#update * @since 3.0.0 @@ -153340,12 +164881,12 @@ module.exports = FixedKeyControl; /***/ }), -/* 990 */ +/* 1172 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153355,19 +164896,19 @@ module.exports = FixedKeyControl; module.exports = { - FixedKeyControl: __webpack_require__(989), - SmoothedKeyControl: __webpack_require__(988) + FixedKeyControl: __webpack_require__(1171), + SmoothedKeyControl: __webpack_require__(1170) }; /***/ }), -/* 991 */ +/* 1173 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153377,19 +164918,67 @@ module.exports = { module.exports = { - Controls: __webpack_require__(990), - Scene2D: __webpack_require__(987) + Controls: __webpack_require__(1172), + Scene2D: __webpack_require__(1169) }; /***/ }), -/* 992 */ +/* 1174 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Remove Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time an object is removed from it. + * + * @event Phaser.Cache.Events#REMOVE + * + * @param {Phaser.Cache.BaseCache} cache - The cache from which the object was removed. + * @param {string} key - The key of the object removed from the cache. + * @param {*} object - A reference to the object that was removed from the cache. + */ +module.exports = 'remove'; + + +/***/ }), +/* 1175 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Add Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time a new object is added to it. + * + * @event Phaser.Cache.Events#ADD + * + * @param {Phaser.Cache.BaseCache} cache - The cache to which the object was added. + * @param {string} key - The key of the object added to the cache. + * @param {*} object - A reference to the object that was added to the cache. + */ +module.exports = 'add'; + + +/***/ }), +/* 1176 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153399,19 +164988,336 @@ module.exports = { module.exports = { - BaseCache: __webpack_require__(380), - CacheManager: __webpack_require__(379) + BaseCache: __webpack_require__(414), + CacheManager: __webpack_require__(412), + Events: __webpack_require__(413) }; /***/ }), -/* 993 */ +/* 1177 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Visible Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a visible state, previously having been hidden. + * + * Only browsers that support the Visibility API will cause this event to be emitted. + * + * @event Phaser.Core.Events#VISIBLE + */ +module.exports = 'visible'; + + +/***/ }), +/* 1178 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Step Event. + * + * This event is dispatched after the Game Pre-Step and before the Scene Manager steps. + * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have. + * + * @event Phaser.Core.Events#STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'step'; + + +/***/ }), +/* 1179 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Resume Event. + * + * This event is dispatched when the game loop leaves a paused state and resumes running. + * + * @event Phaser.Core.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 1180 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Ready Event. + * + * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, + * and all local systems are now able to start. + * + * @event Phaser.Core.Events#READY + */ +module.exports = 'ready'; + + +/***/ }), +/* 1181 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Pre-Step Event. + * + * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. + * Hook into it from plugins or systems that need to update before the Scene Manager does. + * + * @event Phaser.Core.Events#PRE_STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'prestep'; + + +/***/ }), +/* 1182 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PRE_RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'prerender'; + + +/***/ }), +/* 1183 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Step Event. + * + * This event is dispatched after the Scene Manager has updated. + * Hook into it from plugins or systems that need to do things before the render starts. + * + * @event Phaser.Core.Events#POST_STEP + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'poststep'; + + +/***/ }), +/* 1184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Render Event. + * + * This event is dispatched right at the end of the render process. + * + * Every Scene will have rendered and been drawn to the canvas by the time this event is fired. + * Use it for any last minute post-processing before the next game step begins. + * + * @event Phaser.Core.Events#POST_RENDER + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'postrender'; + + +/***/ }), +/* 1185 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 1186 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Hidden Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted. + * + * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which + * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something + * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games) + * + * @event Phaser.Core.Events#HIDDEN + */ +module.exports = 'hidden'; + + +/***/ }), +/* 1187 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Focus Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it. + * + * @event Phaser.Core.Events#FOCUS + */ +module.exports = 'focus'; + + +/***/ }), +/* 1188 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Destroy Event. + * + * This event is dispatched when the game instance has been told to destroy itself. + * Lots of internal systems listen to this event in order to clear themselves out. + * Custom plugins and game code should also do the same. + * + * @event Phaser.Core.Events#DESTROY + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1189 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Boot Event. + * + * This event is dispatched when the Phaser Game instance 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.Core.Events#BOOT + */ +module.exports = 'boot'; + + +/***/ }), +/* 1190 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Blur Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps + * tab, or if they simply remove focus from the browser to another app. + * + * @event Phaser.Core.Events#BLUR + */ +module.exports = 'blur'; + + +/***/ }), +/* 1191 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153421,25 +165327,26 @@ module.exports = { module.exports = { - Animation: __webpack_require__(384), - AnimationFrame: __webpack_require__(382), - AnimationManager: __webpack_require__(381) + Animation: __webpack_require__(205), + AnimationFrame: __webpack_require__(433), + AnimationManager: __webpack_require__(415), + Events: __webpack_require__(136) }; /***/ }), -/* 994 */ +/* 1192 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey * @author samme - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Wrap = __webpack_require__(53); +var Wrap = __webpack_require__(57); /** * Wrap each item's coordinates within a rectangle's area. @@ -153478,12 +165385,12 @@ module.exports = WrapInRectangle; /***/ }), -/* 995 */ +/* 1193 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153514,12 +165421,12 @@ module.exports = ToggleVisible; /***/ }), -/* 996 */ +/* 1194 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153577,16 +165484,16 @@ module.exports = Spread; /***/ }), -/* 997 */ +/* 1195 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmoothStep = __webpack_require__(181); +var MathSmoothStep = __webpack_require__(195); /** * Smoothstep is a sigmoid-like interpolation and clamping function. @@ -153635,16 +165542,16 @@ module.exports = SmoothStep; /***/ }), -/* 998 */ +/* 1196 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmootherStep = __webpack_require__(182); +var MathSmootherStep = __webpack_require__(196); /** * Smootherstep is a sigmoid-like interpolation and clamping function. @@ -153693,16 +165600,16 @@ module.exports = SmootherStep; /***/ }), -/* 999 */ +/* 1197 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayShuffle = __webpack_require__(122); +var ArrayShuffle = __webpack_require__(132); /** * Shuffles the array in place. The shuffled array is both modified and returned. @@ -153726,12 +165633,12 @@ module.exports = Shuffle; /***/ }), -/* 1000 */ +/* 1198 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -153856,16 +165763,16 @@ module.exports = ShiftPosition; /***/ }), -/* 1001 */ +/* 1199 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `y` @@ -153897,16 +165804,16 @@ module.exports = SetY; /***/ }), -/* 1002 */ +/* 1200 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` @@ -153944,16 +165851,16 @@ module.exports = SetXY; /***/ }), -/* 1003 */ +/* 1201 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `x` @@ -153985,16 +165892,16 @@ module.exports = SetX; /***/ }), -/* 1004 */ +/* 1202 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `visible` @@ -154023,12 +165930,12 @@ module.exports = SetVisible; /***/ }), -/* 1005 */ +/* 1203 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154062,16 +165969,16 @@ module.exports = SetTint; /***/ }), -/* 1006 */ +/* 1204 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleY` @@ -154103,16 +166010,16 @@ module.exports = SetScaleY; /***/ }), -/* 1007 */ +/* 1205 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleX` @@ -154144,16 +166051,16 @@ module.exports = SetScaleX; /***/ }), -/* 1008 */ +/* 1206 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` @@ -154191,16 +166098,16 @@ module.exports = SetScale; /***/ }), -/* 1009 */ +/* 1207 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `rotation` @@ -154232,16 +166139,16 @@ module.exports = SetRotation; /***/ }), -/* 1010 */ +/* 1208 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` @@ -154279,12 +166186,12 @@ module.exports = SetOrigin; /***/ }), -/* 1011 */ +/* 1209 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154318,16 +166225,16 @@ module.exports = SetHitArea; /***/ }), -/* 1012 */ +/* 1210 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `depth` @@ -154359,16 +166266,16 @@ module.exports = SetDepth; /***/ }), -/* 1013 */ +/* 1211 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `blendMode` @@ -154399,16 +166306,16 @@ module.exports = SetBlendMode; /***/ }), -/* 1014 */ +/* 1212 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `alpha` @@ -154440,16 +166347,16 @@ module.exports = SetAlpha; /***/ }), -/* 1015 */ +/* 1213 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `scaleY` property, @@ -154481,16 +166388,16 @@ module.exports = ScaleY; /***/ }), -/* 1016 */ +/* 1214 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, @@ -154528,16 +166435,16 @@ module.exports = ScaleXY; /***/ }), -/* 1017 */ +/* 1215 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `scaleX` property, @@ -154569,16 +166476,16 @@ module.exports = ScaleX; /***/ }), -/* 1018 */ +/* 1216 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathRotateAroundDistance = __webpack_require__(183); +var MathRotateAroundDistance = __webpack_require__(197); /** * Rotates an array of Game Objects around a point by the given angle and distance. @@ -154618,17 +166525,17 @@ module.exports = RotateAroundDistance; /***/ }), -/* 1019 */ +/* 1217 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundDistance = __webpack_require__(183); -var DistanceBetween = __webpack_require__(52); +var RotateAroundDistance = __webpack_require__(197); +var DistanceBetween = __webpack_require__(56); /** * Rotates each item around the given point by the given angle. @@ -154664,16 +166571,16 @@ module.exports = RotateAround; /***/ }), -/* 1020 */ +/* 1218 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `rotation` property, @@ -154705,16 +166612,16 @@ module.exports = Rotate; /***/ }), -/* 1021 */ +/* 1219 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(184); +var Random = __webpack_require__(198); /** * Takes an array of Game Objects and positions them at random locations within the Triangle. @@ -154745,16 +166652,16 @@ module.exports = RandomTriangle; /***/ }), -/* 1022 */ +/* 1220 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(187); +var Random = __webpack_require__(201); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -154783,16 +166690,16 @@ module.exports = RandomRectangle; /***/ }), -/* 1023 */ +/* 1221 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(188); +var Random = __webpack_require__(202); /** * Takes an array of Game Objects and positions them at random locations on the Line. @@ -154823,16 +166730,16 @@ module.exports = RandomLine; /***/ }), -/* 1024 */ +/* 1222 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(185); +var Random = __webpack_require__(199); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -154863,16 +166770,16 @@ module.exports = RandomEllipse; /***/ }), -/* 1025 */ +/* 1223 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Random = __webpack_require__(191); +var Random = __webpack_require__(206); /** * Takes an array of Game Objects and positions them at random locations within the Circle. @@ -154903,12 +166810,12 @@ module.exports = RandomCircle; /***/ }), -/* 1026 */ +/* 1224 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -154940,16 +166847,16 @@ module.exports = PlayAnimation; /***/ }), -/* 1027 */ +/* 1225 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BresenhamPoints = __webpack_require__(385); +var BresenhamPoints = __webpack_require__(416); /** * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. @@ -155001,18 +166908,18 @@ module.exports = PlaceOnTriangle; /***/ }), -/* 1028 */ +/* 1226 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MarchingAnts = __webpack_require__(388); -var RotateLeft = __webpack_require__(387); -var RotateRight = __webpack_require__(386); +var MarchingAnts = __webpack_require__(419); +var RotateLeft = __webpack_require__(418); +var RotateRight = __webpack_require__(417); /** * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. @@ -155059,16 +166966,16 @@ module.exports = PlaceOnRectangle; /***/ }), -/* 1029 */ +/* 1227 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetPoints = __webpack_require__(189); +var GetPoints = __webpack_require__(203); /** * Positions an array of Game Objects on evenly spaced points of a Line. @@ -155103,12 +167010,12 @@ module.exports = PlaceOnLine; /***/ }), -/* 1030 */ +/* 1228 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -155155,12 +167062,12 @@ module.exports = PlaceOnEllipse; /***/ }), -/* 1031 */ +/* 1229 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -155204,16 +167111,16 @@ module.exports = PlaceOnCircle; /***/ }), -/* 1032 */ +/* 1230 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `y` property, @@ -155245,16 +167152,16 @@ module.exports = IncY; /***/ }), -/* 1033 */ +/* 1231 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, @@ -155292,16 +167199,16 @@ module.exports = IncXY; /***/ }), -/* 1034 */ +/* 1232 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `x` property, @@ -155333,16 +167240,16 @@ module.exports = IncX; /***/ }), -/* 1035 */ +/* 1233 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `alpha` property, @@ -155374,12 +167281,151 @@ module.exports = IncAlpha; /***/ }), -/* 1036 */ +/* 1234 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Destroy Event. + * + * This event is dispatched when a Game Object instance is being destroyed. + * + * Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`. + * + * @event Phaser.GameObjects.Events#DESTROY + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object which is being destroyed. + */ +module.exports = 'destroy'; + + +/***/ }), +/* 1235 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Set Data Event. + * + * This event is dispatched by a Data Manager when a new item is added to the data store. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the addition of a new data item on a Game Object you would use: `sprite.data.on('setdata', listener)`. + * + * @event Phaser.Data.Events#SET_DATA + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'setdata'; + + +/***/ }), +/* 1236 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Data Event. + * + * This event is dispatched by a Data Manager when an item is removed from it. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the removal of a data item on a Game Object you would use: `sprite.data.on('removedata', listener)`. + * + * @event Phaser.Data.Events#REMOVE_DATA + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was removed from the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'removedata'; + + +/***/ }), +/* 1237 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Key Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the change of a specific data item from a Game Object you would use: `sprite.data.on('changedata-key', listener)`, + * where `key` is the unique string key of the data item. For example, if you have a data item stored called `gold` + * then you can listen for `sprite.data.on('changedata-gold')`. + * + * @event Phaser.Data.Events#CHANGE_DATA_KEY + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + * @param {any} previousValue - The previous item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'changedata-'; + + +/***/ }), +/* 1238 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * a change data event from a Game Object you would use: `sprite.data.on('changedata', listener)`. + * + * This event is dispatched for all items that change in the Data Manager. + * To listen for the change of a specific item, use the `CHANGE_DATA_KEY_EVENT` event. + * + * @event Phaser.Data.Events#CHANGE_DATA + * + * @param {any} parent - A reference to the object that the Data Manager responsible for this event belongs to. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The new value of the item in the Data Manager. + * @param {any} previousValue - The previous value of the item in the Data Manager. + */ +module.exports = 'changedata'; + + +/***/ }), +/* 1239 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -155713,12 +167759,12 @@ module.exports = Tint; /***/ }), -/* 1037 */ +/* 1240 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -155921,12 +167967,12 @@ module.exports = TextureCrop; /***/ }), -/* 1038 */ +/* 1241 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156051,12 +168097,12 @@ module.exports = Texture; /***/ }), -/* 1039 */ +/* 1242 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156238,16 +168284,16 @@ module.exports = Size; /***/ }), -/* 1040 */ +/* 1243 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ScaleModes = __webpack_require__(94); +var ScaleModes = __webpack_require__(101); /** * Provides methods used for getting and setting the scale of a Game Object. @@ -156309,12 +168355,12 @@ module.exports = ScaleMode; /***/ }), -/* 1041 */ +/* 1244 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156512,17 +168558,17 @@ module.exports = Origin; /***/ }), -/* 1042 */ +/* 1245 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(9); -var RotateAround = __webpack_require__(396); +var Rectangle = __webpack_require__(10); +var RotateAround = __webpack_require__(428); var Vector2 = __webpack_require__(3); /** @@ -156794,12 +168840,12 @@ module.exports = GetBounds; /***/ }), -/* 1043 */ +/* 1246 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -156942,12 +168988,12 @@ module.exports = Flip; /***/ }), -/* 1044 */ +/* 1247 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157067,12 +169113,12 @@ module.exports = Crop; /***/ }), -/* 1045 */ +/* 1248 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157216,20 +169262,500 @@ module.exports = ComputedSize; /***/ }), -/* 1046 */ +/* 1249 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Update Event. + * + * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_UPDATE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate'; + + +/***/ }), +/* 1250 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Start Event. + * + * This event is dispatched by a Sprite when an animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_START` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart'; + + +/***/ }), +/* 1251 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Restart Event. + * + * This event is dispatched by a Sprite when an animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_RESTART` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart'; + + +/***/ }), +/* 1252 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Repeat Event. + * + * This event is dispatched by a Sprite when an animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_REPEAT` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat'; + + +/***/ }), +/* 1253 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Update Event. + * + * This event is dispatched by a Sprite when a specific animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationupdate-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate-'; + + +/***/ }), +/* 1254 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Start Event. + * + * This event is dispatched by a Sprite when a specific animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationstart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart-'; + + +/***/ }), +/* 1255 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Restart Event. + * + * This event is dispatched by a Sprite when a specific animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrestart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart-'; + + +/***/ }), +/* 1256 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Repeat Event. + * + * This event is dispatched by a Sprite when a specific animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrepeat-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat-'; + + +/***/ }), +/* 1257 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Complete Event. + * + * This event is dispatched by a Sprite when a specific animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationcomplete-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete-'; + + +/***/ }), +/* 1258 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Complete Event. + * + * This event is dispatched by a Sprite when an animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_COMPLETE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete'; + + +/***/ }), +/* 1259 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Animations Event. + * + * This event is dispatched when the global Animation Manager resumes, having been previously paused. + * + * When this happens all current animations will continue updating again. + * + * @event Phaser.Animations.Events#RESUME_ALL + */ +module.exports = 'resumeall'; + + +/***/ }), +/* 1260 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Animation Event. + * + * This event is dispatched when an animation is removed from the global Animation Manager. + * + * @event Phaser.Animations.Events#REMOVE_ANIMATION + * + * @param {string} key - The key of the Animation that was removed from the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the removed Animation. + */ +module.exports = 'remove'; + + +/***/ }), +/* 1261 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Animations Event. + * + * This event is dispatched when the global Animation Manager is told to pause. + * + * When this happens all current animations will stop updating, although it doesn't necessarily mean + * that the game has paused as well. + * + * @event Phaser.Animations.Events#PAUSE_ALL + */ +module.exports = 'pauseall'; + + +/***/ }), +/* 1262 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Start Event. + * + * This event is dispatched by an Animation instance when it starts playing. + * + * Be careful with the volume of events this could generate. If a group of Sprites all play the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_START + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that started playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'start'; + + +/***/ }), +/* 1263 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Restart Event. + * + * This event is dispatched by an Animation instance when it restarts. + * + * Be careful with the volume of events this could generate. If a group of Sprites all restart the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_RESTART + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that restarted playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'restart'; + + +/***/ }), +/* 1264 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Repeat Event. + * + * This event is dispatched when a currently playing animation repeats. + * + * The event is dispatched directly from the Animation object itself. Which means that listeners + * bound to this event will be invoked every time the Animation repeats, for every Game Object that may have it. + * + * @event Phaser.Animations.Events#ANIMATION_REPEAT + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that repeated. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation was on when it repeated. + */ +module.exports = 'repeat'; + + +/***/ }), +/* 1265 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Complete Event. + * + * This event is dispatched by an Animation instance when it completes, i.e. finishes playing or is manually stopped. + * + * Be careful with the volume of events this could generate. If a group of Sprites all complete the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_COMPLETE + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'complete'; + + +/***/ }), +/* 1266 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Add Animation Event. + * + * This event is dispatched when a new animation is added to the global Animation Manager. + * + * This can happen either as a result of an animation instance being added to the Animation Manager, + * or the Animation Manager creating a new animation directly. + * + * @event Phaser.Animations.Events#ADD_ANIMATION + * + * @param {string} key - The key of the Animation that was added to the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the newly created Animation. + */ +module.exports = 'add'; + + +/***/ }), +/* 1267 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AlignIn = __webpack_require__(416); -var CONST = __webpack_require__(193); +var AlignIn = __webpack_require__(449); +var CONST = __webpack_require__(208); var GetFastValue = __webpack_require__(2); var NOOP = __webpack_require__(1); -var Zone = __webpack_require__(125); +var Zone = __webpack_require__(137); var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); @@ -157340,12 +169866,12 @@ module.exports = GridAlign; /***/ }), -/* 1047 */ +/* 1268 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157398,12 +169924,12 @@ module.exports = GetLast; /***/ }), -/* 1048 */ +/* 1269 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157456,12 +169982,12 @@ module.exports = GetFirst; /***/ }), -/* 1049 */ +/* 1270 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -157501,16 +170027,16 @@ module.exports = Call; /***/ }), -/* 1050 */ +/* 1271 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PropertyValueInc = __webpack_require__(32); +var PropertyValueInc = __webpack_require__(35); /** * Takes an array of Game Objects, or any objects that have a public `angle` property, @@ -157542,7 +170068,7 @@ module.exports = Angle; /***/ }), -/* 1051 */ +/* 1272 */ /***/ (function(module, exports) { /** @@ -157595,7 +170121,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o /***/ }), -/* 1052 */ +/* 1273 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {// References: @@ -157665,10 +170191,10 @@ if (!global.cancelAnimationFrame) { }; } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(200))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(215))) /***/ }), -/* 1053 */ +/* 1274 */ /***/ (function(module, exports) { /** @@ -157705,7 +170231,7 @@ if (!global.cancelAnimationFrame) { /***/ }), -/* 1054 */ +/* 1275 */ /***/ (function(module, exports) { // ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc @@ -157717,7 +170243,7 @@ if (!Math.trunc) { /***/ }), -/* 1055 */ +/* 1276 */ /***/ (function(module, exports) { /** @@ -157732,7 +170258,7 @@ if (!window.console) /***/ }), -/* 1056 */ +/* 1277 */ /***/ (function(module, exports) { /* Copyright 2013 Chris Wilson @@ -157919,7 +170445,7 @@ BiquadFilterNode.type and OscillatorNode.type. /***/ }), -/* 1057 */ +/* 1278 */ /***/ (function(module, exports) { /** @@ -157935,7 +170461,7 @@ if (!Array.isArray) /***/ }), -/* 1058 */ +/* 1279 */ /***/ (function(module, exports) { /** @@ -157975,42 +170501,43 @@ if (!Array.prototype.forEach) /***/ }), -/* 1059 */ +/* 1280 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(1058); -__webpack_require__(1057); -__webpack_require__(1056); -__webpack_require__(1055); -__webpack_require__(1054); -__webpack_require__(1053); -__webpack_require__(1052); -__webpack_require__(1051); +__webpack_require__(1279); +__webpack_require__(1278); +__webpack_require__(1277); +__webpack_require__(1276); +__webpack_require__(1275); +__webpack_require__(1274); +__webpack_require__(1273); +__webpack_require__(1272); /***/ }), -/* 1060 */ +/* 1281 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(126); +var Bodies = __webpack_require__(138); var Class = __webpack_require__(0); -var Common = __webpack_require__(33); -var Composite = __webpack_require__(137); -var Engine = __webpack_require__(1061); +var Common = __webpack_require__(36); +var Composite = __webpack_require__(149); +var Engine = __webpack_require__(1282); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(545); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var MatterBody = __webpack_require__(67); -var MatterEvents = __webpack_require__(195); -var MatterTileBody = __webpack_require__(504); -var MatterWorld = __webpack_require__(499); -var Vector = __webpack_require__(81); +var MatterBody = __webpack_require__(72); +var MatterEvents = __webpack_require__(210); +var MatterTileBody = __webpack_require__(544); +var MatterWorld = __webpack_require__(539); +var Vector = __webpack_require__(87); /** * @classdesc @@ -158090,8 +170617,8 @@ var World = new Class({ { var x = GetFastValue(boundsConfig, 'x', 0); var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); var thickness = GetFastValue(boundsConfig, 'thickness', 64); var left = GetFastValue(boundsConfig, 'left', true); var right = GetFastValue(boundsConfig, 'right', true); @@ -158232,12 +170759,12 @@ var World = new Class({ MatterEvents.on(engine, 'beforeUpdate', function (event) { - _this.emit('beforeupdate', event); + _this.emit(Events.BEFORE_UPDATE, event); }); MatterEvents.on(engine, 'afterUpdate', function (event) { - _this.emit('afterupdate', event); + _this.emit(Events.AFTER_UPDATE, event); }); MatterEvents.on(engine, 'collisionStart', function (event) @@ -158252,7 +170779,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionstart', event, bodyA, bodyB); + _this.emit(Events.COLLISION_START, event, bodyA, bodyB); }); MatterEvents.on(engine, 'collisionActive', function (event) @@ -158267,7 +170794,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionactive', event, bodyA, bodyB); + _this.emit(Events.COLLISION_ACTIVE, event, bodyA, bodyB); }); MatterEvents.on(engine, 'collisionEnd', function (event) @@ -158282,7 +170809,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionend', event, bodyA, bodyB); + _this.emit(Events.COLLISION_END, event, bodyA, bodyB); }); }, @@ -158313,16 +170840,16 @@ var World = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (thickness === undefined) { thickness = 128; } if (left === undefined) { left = true; } if (right === undefined) { right = true; } if (top === undefined) { top = true; } if (bottom === undefined) { bottom = true; } - this.updateWall(left, 'left', x - thickness, y, thickness, height); - this.updateWall(right, 'right', x + width, y, thickness, height); + this.updateWall(left, 'left', x - thickness, y - thickness, thickness, height + (thickness * 2)); + this.updateWall(right, 'right', x + width, y - thickness, thickness, height + (thickness * 2)); this.updateWall(top, 'top', x, y - thickness, width, thickness); this.updateWall(bottom, 'bottom', x, y + height, width, thickness); @@ -158393,7 +170920,7 @@ var World = new Class({ }, /** - * [description] + * Sets the world's gravity and gravity scale to 0. * * @method Phaser.Physics.Matter.World#disableGravity * @since 3.0.0 @@ -158410,13 +170937,13 @@ var World = new Class({ }, /** - * [description] + * Sets the world's gravity * * @method Phaser.Physics.Matter.World#setGravity * @since 3.0.0 * - * @param {number} [x=0] - [description] - * @param {number} [y=1] - [description] + * @param {number} [x=0] - The world gravity x component. + * @param {number} [y=1] - The world gravity y component. * @param {number} [scale] - [description] * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -158461,7 +170988,7 @@ var World = new Class({ }, /** - * [description] + * Adds an object to the world. * * @method Phaser.Physics.Matter.World#add * @since 3.0.0 @@ -158492,7 +171019,7 @@ var World = new Class({ { var body = (object.body) ? object.body : object; - Composite.removeBody(this.localWorld, body, deep); + Composite.remove(this.localWorld, body, deep); return this; }, @@ -158531,7 +171058,7 @@ var World = new Class({ convertTilemapLayer: function (tilemapLayer, options) { var layerData = tilemapLayer.layer; - var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, {isColliding: true}); + var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, { isColliding: true }); this.convertTiles(tiles, options); @@ -158586,7 +171113,7 @@ var World = new Class({ * @method Phaser.Physics.Matter.World#nextCategory * @since 3.0.0 * - * @return {number} [description] + * @return {number} Returns the next unique category bitfield. */ nextCategory: function () { @@ -158597,6 +171124,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Matter.World#pause + * @fires Phaser.Physics.Matter.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -158605,7 +171133,7 @@ var World = new Class({ { this.enabled = false; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -158614,6 +171142,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Matter.World#resume + * @fires Phaser.Physics.Matter.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -158622,7 +171151,7 @@ var World = new Class({ { this.enabled = true; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -159068,7 +171597,8 @@ var World = new Class({ }, /** - * [description] + * Will remove all Matter physics event listeners and clear the matter physics world, + * engine and any debug graphics, if any. * * @method Phaser.Physics.Matter.World#shutdown * @since 3.0.0 @@ -159090,7 +171620,10 @@ var World = new Class({ }, /** - * [description] + * Will remove all Matter physics event listeners and clear the matter physics world, + * engine and any debug graphics, if any. + * + * After destroying the world it cannot be re-used again. * * @method Phaser.Physics.Matter.World#destroy * @since 3.0.0 @@ -159106,7 +171639,7 @@ module.exports = World; /***/ }), -/* 1061 */ +/* 1282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159123,17 +171656,17 @@ var Engine = {}; module.exports = Engine; -var World = __webpack_require__(499); -var Sleeping = __webpack_require__(222); -var Resolver = __webpack_require__(1062); -var Pairs = __webpack_require__(1063); -var Metrics = __webpack_require__(1088); -var Grid = __webpack_require__(1064); -var Events = __webpack_require__(195); -var Composite = __webpack_require__(137); -var Constraint = __webpack_require__(194); -var Common = __webpack_require__(33); -var Body = __webpack_require__(67); +var World = __webpack_require__(539); +var Sleeping = __webpack_require__(238); +var Resolver = __webpack_require__(1283); +var Pairs = __webpack_require__(1284); +var Metrics = __webpack_require__(1309); +var Grid = __webpack_require__(1285); +var Events = __webpack_require__(210); +var Composite = __webpack_require__(149); +var Constraint = __webpack_require__(209); +var Common = __webpack_require__(36); +var Body = __webpack_require__(72); (function() { @@ -159619,7 +172152,7 @@ var Body = __webpack_require__(67); /***/ }), -/* 1062 */ +/* 1283 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159632,10 +172165,10 @@ var Resolver = {}; module.exports = Resolver; -var Vertices = __webpack_require__(76); -var Vector = __webpack_require__(81); -var Common = __webpack_require__(33); -var Bounds = __webpack_require__(80); +var Vertices = __webpack_require__(82); +var Vector = __webpack_require__(87); +var Common = __webpack_require__(36); +var Bounds = __webpack_require__(86); (function() { @@ -159975,7 +172508,7 @@ var Bounds = __webpack_require__(80); /***/ }), -/* 1063 */ +/* 1284 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159988,8 +172521,8 @@ var Pairs = {}; module.exports = Pairs; -var Pair = __webpack_require__(418); -var Common = __webpack_require__(33); +var Pair = __webpack_require__(451); +var Common = __webpack_require__(36); (function() { @@ -160140,7 +172673,7 @@ var Common = __webpack_require__(33); /***/ }), -/* 1064 */ +/* 1285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160153,9 +172686,9 @@ var Grid = {}; module.exports = Grid; -var Pair = __webpack_require__(418); -var Detector = __webpack_require__(503); -var Common = __webpack_require__(33); +var Pair = __webpack_require__(451); +var Detector = __webpack_require__(543); +var Common = __webpack_require__(36); (function() { @@ -160467,7 +173000,7 @@ var Common = __webpack_require__(33); /***/ }), -/* 1065 */ +/* 1286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160480,8 +173013,8 @@ var Matter = {}; module.exports = Matter; -var Plugin = __webpack_require__(500); -var Common = __webpack_require__(33); +var Plugin = __webpack_require__(540); +var Common = __webpack_require__(36); (function() { @@ -160559,22 +173092,22 @@ var Common = __webpack_require__(33); /***/ }), -/* 1066 */ +/* 1287 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AnimationComponent = __webpack_require__(427); +var AnimationComponent = __webpack_require__(460); var Class = __webpack_require__(0); -var Components = __webpack_require__(419); -var GameObject = __webpack_require__(19); +var Components = __webpack_require__(452); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(2); -var Pipeline = __webpack_require__(186); -var Sprite = __webpack_require__(61); +var Pipeline = __webpack_require__(200); +var Sprite = __webpack_require__(67); var Vector2 = __webpack_require__(3); /** @@ -160653,7 +173186,7 @@ var MatterSprite = new Class({ function MatterSprite (world, x, y, texture, frame, options) { - GameObject.call(this, world.scene, 'Image'); + GameObject.call(this, world.scene, 'Sprite'); this.anims = new AnimationComponent(this); @@ -160702,21 +173235,21 @@ module.exports = MatterSprite; /***/ }), -/* 1067 */ +/* 1288 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(419); -var GameObject = __webpack_require__(19); +var Components = __webpack_require__(452); +var GameObject = __webpack_require__(18); var GetFastValue = __webpack_require__(2); -var Image = __webpack_require__(87); -var Pipeline = __webpack_require__(186); +var Image = __webpack_require__(93); +var Pipeline = __webpack_require__(200); var Vector2 = __webpack_require__(3); /** @@ -160839,7 +173372,7 @@ module.exports = MatterImage; /***/ }), -/* 1068 */ +/* 1289 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160855,11 +173388,11 @@ var Composites = {}; module.exports = Composites; -var Composite = __webpack_require__(137); -var Constraint = __webpack_require__(194); -var Common = __webpack_require__(33); -var Body = __webpack_require__(67); -var Bodies = __webpack_require__(126); +var Composite = __webpack_require__(149); +var Constraint = __webpack_require__(209); +var Common = __webpack_require__(36); +var Body = __webpack_require__(72); +var Bodies = __webpack_require__(138); (function() { @@ -161172,7 +173705,7 @@ var Bodies = __webpack_require__(126); /***/ }), -/* 1069 */ +/* 1290 */ /***/ (function(module, exports) { /** @@ -161842,35 +174375,35 @@ function points_eq(a,b,precision){ /***/ }), -/* 1070 */ +/* 1291 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(126); +var Bodies = __webpack_require__(138); var Class = __webpack_require__(0); -var Composites = __webpack_require__(1068); -var Constraint = __webpack_require__(194); -var MatterGameObject = __webpack_require__(1104); -var MatterImage = __webpack_require__(1067); -var MatterSprite = __webpack_require__(1066); -var MatterTileBody = __webpack_require__(504); -var PointerConstraint = __webpack_require__(1090); +var Composites = __webpack_require__(1289); +var Constraint = __webpack_require__(209); +var MatterGameObject = __webpack_require__(1337); +var MatterImage = __webpack_require__(1288); +var MatterSprite = __webpack_require__(1287); +var MatterTileBody = __webpack_require__(544); +var PointerConstraint = __webpack_require__(1311); /** * @classdesc - * [description] + * The Matter Factory can create different types of bodies and them to a physics world. * * @class Factory * @memberof Phaser.Physics.Matter * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Matter.World} world - [description] + * @param {Phaser.Physics.Matter.World} world - The Matter World which this Factory adds to. */ var Factory = new Class({ @@ -161879,7 +174412,7 @@ var Factory = new Class({ function Factory (world) { /** - * [description] + * The Matter World which this Factory adds to. * * @name Phaser.Physics.Matter.Factory#world * @type {Phaser.Physics.Matter.World} @@ -161888,7 +174421,7 @@ var Factory = new Class({ this.world = world; /** - * [description] + * The Scene which this Factory's Matter World belongs to. * * @name Phaser.Physics.Matter.Factory#scene * @type {Phaser.Scene} @@ -161907,16 +174440,16 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid rectangular Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#rectangle * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {object} options - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} width - The width of the Body. + * @param {number} height - The height of the Body. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -161930,17 +174463,17 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid trapezoidal Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#trapezoid * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} slope - [description] - * @param {object} options - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} width - The width of the trapezoid of the Body. + * @param {number} height - The height of the trapezoid of the Body. + * @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -161954,16 +174487,16 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid circular Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#circle * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} radius - [description] - * @param {object} options - [description] - * @param {number} maxSides - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} radius - The radius of the circle. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. + * @param {number} maxSides - The maximum amount of sides to use for the polygon which will approximate this circle. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -161977,16 +174510,16 @@ var Factory = new Class({ }, /** - * [description] + * Creates a new rigid polygonal Body and adds it to the World. * * @method Phaser.Physics.Matter.Factory#polygon * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} sides - [description] - * @param {number} radius - [description] - * @param {object} options - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} sides - The number of sides the polygon will have. + * @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle. + * @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body. * * @return {MatterJS.Body} A Matter JS Body. */ @@ -162000,18 +174533,19 @@ var Factory = new Class({ }, /** - * [description] + * Creates a body using the supplied vertices (or an array containing multiple sets of vertices) and adds it to the World. + * If the vertices are convex, they will pass through as supplied. Otherwise, if the vertices are concave, they will be decomposed. Note that this process is not guaranteed to support complex sets of vertices, e.g. ones with holes. * * @method Phaser.Physics.Matter.Factory#fromVertices * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. * @param {array} vertexSets - [description] * @param {object} options - [description] - * @param {boolean} flagInternal - [description] - * @param {boolean} removeCollinear - [description] - * @param {number} minimumArea - [description] + * @param {boolean} flagInternal - Flag internal edges (coincident part edges) + * @param {boolean} removeCollinear - Whether Matter.js will discard collinear edges (to improve performance). + * @param {number} minimumArea - During decomposition discard parts that have an area less than this * * @return {MatterJS.Body} A Matter JS Body. */ @@ -162107,7 +174641,7 @@ var Factory = new Class({ * @param {number} rows - The number of rows in the pyramid. * @param {number} columnGap - The distance between each column. * @param {number} rowGap - The distance between each row. - * @param {function} callback - [description] + * @param {function} callback - The callback function to be invoked. * * @return {MatterJS.Composite} A Matter JS Composite pyramid. */ @@ -162218,7 +174752,7 @@ var Factory = new Class({ * @param {number} columnGap - The distance between each column. * @param {number} rowGap - The distance between each row. * @param {boolean} crossBrace - [description] - * @param {number} particleRadius - [description] + * @param {number} particleRadius - The radius of this circlular composite. * @param {object} particleOptions - [description] * @param {object} constraintOptions - [description] * @@ -162258,10 +174792,10 @@ var Factory = new Class({ * @method Phaser.Physics.Matter.Factory#spring * @since 3.0.0 * - * @param {MatterJS.Body} bodyA - [description] - * @param {MatterJS.Body} bodyB - [description] - * @param {number} length - [description] - * @param {number} [stiffness=1] - [description] + * @param {MatterJS.Body} bodyA - The first possible `Body` that this constraint is attached to. + * @param {MatterJS.Body} bodyB - The second possible `Body` that this constraint is attached to. + * @param {number} length - 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` + * @param {number} [stiffness=1] - 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 as a soft spring. * @param {object} [options={}] - [description] * * @return {MatterJS.Constraint} A Matter JS Constraint. @@ -162472,26 +175006,27 @@ module.exports = Factory; /***/ }), -/* 1071 */ +/* 1292 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(1077); +var Body = __webpack_require__(1298); var Class = __webpack_require__(0); -var COLLIDES = __webpack_require__(224); -var CollisionMap = __webpack_require__(1076); +var COLLIDES = __webpack_require__(240); +var CollisionMap = __webpack_require__(1297); var EventEmitter = __webpack_require__(11); +var Events = __webpack_require__(548); var GetFastValue = __webpack_require__(2); -var HasValue = __webpack_require__(85); -var Set = __webpack_require__(95); -var Solver = __webpack_require__(1108); -var TILEMAP_FORMATS = __webpack_require__(29); -var TYPE = __webpack_require__(223); +var HasValue = __webpack_require__(91); +var Set = __webpack_require__(102); +var Solver = __webpack_require__(1341); +var TILEMAP_FORMATS = __webpack_require__(31); +var TYPE = __webpack_require__(239); /** * @typedef {object} Phaser.Physics.Impact.WorldConfig @@ -162558,7 +175093,7 @@ var TYPE = __webpack_require__(223); * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Scene} scene - The Scene to which this Impact World instance belongs. * @param {Phaser.Physics.Impact.WorldConfig} config - [description] */ var World = new Class({ @@ -162729,8 +175264,8 @@ var World = new Class({ { var x = GetFastValue(boundsConfig, 'x', 0); var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); var thickness = GetFastValue(boundsConfig, 'thickness', 64); var left = GetFastValue(boundsConfig, 'left', true); var right = GetFastValue(boundsConfig, 'right', true); @@ -162801,6 +175336,20 @@ var World = new Class({ return this.collisionMap; }, + /** + * @typedef {object} CollisionOptions + * + * @property {string} [slopeTileProperty=null] - Slope IDs can be stored on tiles directly + * using Impacts tileset editor. If a tile has a property with the given slopeTileProperty string + * name, the value of that property for the tile will be used for its slope mapping. E.g. a 45 + * degree slope upward could be given a "slope" property with a value of 2. + * @property {object} [slopeMap=null] - A tile index to slope definition map. + * @property {integer} [defaultCollidingSlope=null] - If specified, the default slope ID to + * assign to a colliding tile. If not specified, the tile's index is used. + * @property {integer} [defaultNonCollidingSlope=0] - The default slope ID to assign to a + * non-colliding tile. + */ + /** * Sets the collision map for the world from a tilemap layer. Only tiles that are marked as * colliding will be used. You can specify the mapping from tiles to slope IDs in a couple of @@ -162811,16 +175360,7 @@ var World = new Class({ * @since 3.0.0 * * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemap layer to use. - * @param {object} [options] - Options for controlling the mapping from tiles to slope IDs. - * @param {string} [options.slopeTileProperty=null] - Slope IDs can be stored on tiles directly - * using Tiled's tileset editor. If a tile has a property with the given slopeTileProperty string - * name, the value of that property for the tile will be used for its slope mapping. E.g. a 45 - * degree slope upward could be given a "slope" property with a value of 2. - * @param {object} [options.slopeMap=null] - A tile index to slope definition map. - * @param {integer} [options.defaultCollidingSlope=null] - If specified, the default slope ID to - * assign to a colliding tile. If not specified, the tile's index is used. - * @param {integer} [options.defaultNonCollidingSlope=0] - The default slope ID to assign to a - * non-colliding tile. + * @param {CollisionOptions} [options] - Options for controlling the mapping from tiles to slope IDs. * * @return {Phaser.Physics.Impact.CollisionMap} The newly created CollisionMap. */ @@ -162902,8 +175442,8 @@ var World = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (thickness === undefined) { thickness = 64; } if (left === undefined) { left = true; } if (right === undefined) { right = true; } @@ -163033,6 +175573,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Impact.World#pause + * @fires Phaser.Physics.Impact.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Impact.World} This World object. @@ -163041,7 +175582,7 @@ var World = new Class({ { this.enabled = false; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -163050,6 +175591,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Impact.World#resume + * @fires Phaser.Physics.Impact.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Impact.World} This World object. @@ -163058,7 +175600,7 @@ var World = new Class({ { this.enabled = true; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -163518,18 +176060,18 @@ module.exports = World; /***/ }), -/* 1072 */ +/* 1293 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(506); -var Sprite = __webpack_require__(61); +var Components = __webpack_require__(547); +var Sprite = __webpack_require__(67); /** * @classdesc @@ -163680,18 +176222,18 @@ module.exports = ImpactSprite; /***/ }), -/* 1073 */ +/* 1294 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(506); -var Image = __webpack_require__(87); +var Components = __webpack_require__(547); +var Image = __webpack_require__(93); /** * @classdesc @@ -163735,7 +176277,7 @@ var Image = __webpack_require__(87); * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * - * @param {Phaser.Physics.Impact.World} world - [description] + * @param {Phaser.Physics.Impact.World} world - The physics world of the Impact physics system. * @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. @@ -163767,7 +176309,7 @@ var ImpactImage = new Class({ Image.call(this, world.scene, x, y, texture, frame); /** - * [description] + * The Physics Body linked to an ImpactImage. * * @name Phaser.Physics.Impact.ImpactImage#body * @type {Phaser.Physics.Impact.Body} @@ -163779,7 +176321,7 @@ var ImpactImage = new Class({ this.body.gameObject = this; /** - * [description] + * The size of the physics Body. * * @name Phaser.Physics.Impact.ImpactImage#size * @type {{x: number, y: number}} @@ -163788,7 +176330,7 @@ var ImpactImage = new Class({ this.size = this.body.size; /** - * [description] + * The X and Y offset of the Body from the left and top of the Image. * * @name Phaser.Physics.Impact.ImpactImage#offset * @type {{x: number, y: number}} @@ -163797,7 +176339,7 @@ var ImpactImage = new Class({ this.offset = this.body.offset; /** - * [description] + * The velocity, or rate of change the Body's position. Measured in pixels per second. * * @name Phaser.Physics.Impact.ImpactImage#vel * @type {{x: number, y: number}} @@ -163806,7 +176348,7 @@ var ImpactImage = new Class({ this.vel = this.body.vel; /** - * [description] + * The acceleration is the rate of change of the velocity. Measured in pixels per second squared. * * @name Phaser.Physics.Impact.ImpactImage#accel * @type {{x: number, y: number}} @@ -163815,7 +176357,7 @@ var ImpactImage = new Class({ this.accel = this.body.accel; /** - * [description] + * Friction between colliding bodies. * * @name Phaser.Physics.Impact.ImpactImage#friction * @type {{x: number, y: number}} @@ -163824,7 +176366,7 @@ var ImpactImage = new Class({ this.friction = this.body.friction; /** - * [description] + * The maximum velocity of the body. * * @name Phaser.Physics.Impact.ImpactImage#maxVel * @type {{x: number, y: number}} @@ -163839,17 +176381,17 @@ module.exports = ImpactImage; /***/ }), -/* 1074 */ +/* 1295 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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__(506); +var Components = __webpack_require__(547); /** * @classdesc @@ -163874,9 +176416,9 @@ var Components = __webpack_require__(506); * @extends Phaser.Physics.Impact.Components.Velocity * * @param {Phaser.Physics.Impact.World} world - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] + * @param {number} x - x - The horizontal position of this physics body in the world. + * @param {number} y - y - The vertical position of this physics body in the world. + * @param {number} width - The width of the physics body in the world. * @param {number} height - [description] */ var ImpactBody = new Class({ @@ -163972,19 +176514,19 @@ module.exports = ImpactBody; /***/ }), -/* 1075 */ +/* 1296 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var ImpactBody = __webpack_require__(1074); -var ImpactImage = __webpack_require__(1073); -var ImpactSprite = __webpack_require__(1072); +var ImpactBody = __webpack_require__(1295); +var ImpactImage = __webpack_require__(1294); +var ImpactSprite = __webpack_require__(1293); /** * @classdesc @@ -164129,17 +176671,17 @@ module.exports = Factory; /***/ }), -/* 1076 */ +/* 1297 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var DefaultDefs = __webpack_require__(1122); +var DefaultDefs = __webpack_require__(1355); /** * @classdesc @@ -164493,20 +177035,20 @@ module.exports = CollisionMap; /***/ }), -/* 1077 */ +/* 1298 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var COLLIDES = __webpack_require__(224); -var GetVelocity = __webpack_require__(1124); -var TYPE = __webpack_require__(223); -var UpdateMotion = __webpack_require__(1123); +var COLLIDES = __webpack_require__(240); +var GetVelocity = __webpack_require__(1360); +var TYPE = __webpack_require__(239); +var UpdateMotion = __webpack_require__(1359); /** * @callback BodyUpdateCallback @@ -164520,11 +177062,11 @@ var UpdateMotion = __webpack_require__(1123); * * @property {string} name - [description] * @property {object} size - [description] - * @property {object} pos - [description] - * @property {object} vel - [description] - * @property {object} accel - [description] - * @property {object} friction - [description] - * @property {object} maxVel - [description] + * @property {object} pos - The entity's position in the game world. + * @property {object} vel - Current velocity in pixels per second. + * @property {object} accel - Current acceleration to be added to the entity's velocity per second. E.g. an entity with a `vel.x` of 0 and `accel.x` of 10 will have a `vel.x` of 100 ten seconds later. + * @property {object} friction - Deceleration to be subtracted from the entity's velocity per second. Only applies if `accel` is 0. + * @property {object} maxVel - The maximum velocity a body can move. * @property {number} gravityFactor - [description] * @property {number} bounciness - [description] * @property {number} minBounceVelocity - [description] @@ -164959,7 +177501,7 @@ var Body = new Class({ }, /** - * [description] + * Determines whether the body collides with the `other` one or not. * * @method Phaser.Physics.Impact.Body#touches * @since 3.0.0 @@ -165002,12 +177544,12 @@ var Body = new Class({ }, /** - * [description] + * Export this body object to JSON. * * @method Phaser.Physics.Impact.Body#toJSON * @since 3.0.0 * - * @return {JSONImpactBody} [description] + * @return {JSONImpactBody} JSON representation of this body object. */ toJSON: function () { @@ -165112,13 +177654,13 @@ module.exports = Body; /***/ }), -/* 1078 */, -/* 1079 */ +/* 1299 */, +/* 1300 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165128,20 +177670,20 @@ module.exports = Body; module.exports = { - BitmapMaskPipeline: __webpack_require__(421), - ForwardDiffuseLightPipeline: __webpack_require__(420), - TextureTintPipeline: __webpack_require__(196) + BitmapMaskPipeline: __webpack_require__(454), + ForwardDiffuseLightPipeline: __webpack_require__(453), + TextureTintPipeline: __webpack_require__(211) }; /***/ }), -/* 1080 */ +/* 1301 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165151,10 +177693,10 @@ module.exports = { module.exports = { - Utils: __webpack_require__(10), - WebGLPipeline: __webpack_require__(197), - WebGLRenderer: __webpack_require__(423), - Pipelines: __webpack_require__(1079), + Utils: __webpack_require__(9), + WebGLPipeline: __webpack_require__(212), + WebGLRenderer: __webpack_require__(456), + Pipelines: __webpack_require__(1300), // Constants BYTE: 0, @@ -165167,19 +177709,32 @@ module.exports = { /***/ }), -/* 1081 */ +/* 1302 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * @callback SnapshotCallback * - * @param {HTMLImageElement} snapshot - [description] + * @param {(Phaser.Display.Color|HTMLImageElement)} snapshot - Either a Color object if a single pixel is being grabbed, or a new Image which contains a snapshot of the canvas contents. + */ + +/** + * @typedef {object} SnapshotState + * + * @property {SnapshotCallback} callback - The function to call after the snapshot is taken. + * @property {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @property {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * @property {integer} [x=0] - The x coordinate to start the snapshot from. + * @property {integer} [y=0] - The y coordinate to start the snapshot from. + * @property {integer} [width] - The width of the snapshot. + * @property {integer} [height] - The height of the snapshot. + * @property {boolean} [getPixel=false] - Is this a snapshot to get a single pixel, or an area? */ /** @@ -165188,19 +177743,19 @@ module.exports = { module.exports = { - Canvas: __webpack_require__(425), - WebGL: __webpack_require__(422) + Canvas: __webpack_require__(458), + WebGL: __webpack_require__(455) }; /***/ }), -/* 1082 */ +/* 1303 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -165210,52 +177765,41 @@ module.exports = { module.exports = { - CanvasRenderer: __webpack_require__(426), - GetBlendModes: __webpack_require__(424), - SetTransform: __webpack_require__(22) + CanvasRenderer: __webpack_require__(459), + GetBlendModes: __webpack_require__(457), + SetTransform: __webpack_require__(25) }; /***/ }), -/* 1083 */ +/* 1304 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} RendererConfig - * - * @property {boolean} clearBeforeRender - [description] - * @property {boolean} antialias - [description] - * @property {Phaser.Display.Color} backgroundColor - [description] - * @property {number} resolution - [description] - * @property {boolean} autoResize - [description] - * @property {boolean} roundPixels - [description] - */ - /** * @namespace Phaser.Renderer */ module.exports = { - Canvas: __webpack_require__(1082), - Snapshot: __webpack_require__(1081), - WebGL: __webpack_require__(1080) + Canvas: __webpack_require__(1303), + Snapshot: __webpack_require__(1302), + WebGL: __webpack_require__(1301) }; /***/ }), -/* 1084 */ +/* 1305 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(501); +var Matter = __webpack_require__(541); /** * A coordinate wrapping plugin for matter.js. @@ -165434,10 +177978,10 @@ module.exports = MatterWrap; */ /***/ }), -/* 1085 */ +/* 1306 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(501); +var Matter = __webpack_require__(541); /** * An attractors plugin for matter.js. @@ -165576,27 +178120,28 @@ module.exports = MatterAttractors; /***/ }), -/* 1086 */ +/* 1307 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(1070); +var Factory = __webpack_require__(1291); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var MatterAttractors = __webpack_require__(1085); -var MatterLib = __webpack_require__(1065); -var MatterWrap = __webpack_require__(1084); -var Merge = __webpack_require__(96); -var Plugin = __webpack_require__(500); -var PluginCache = __webpack_require__(15); -var World = __webpack_require__(1060); -var Vertices = __webpack_require__(76); +var MatterAttractors = __webpack_require__(1306); +var MatterLib = __webpack_require__(1286); +var MatterWrap = __webpack_require__(1305); +var Merge = __webpack_require__(103); +var Plugin = __webpack_require__(540); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var World = __webpack_require__(1281); +var Vertices = __webpack_require__(82); /** * @classdesc @@ -165685,8 +178230,8 @@ var MatterPhysics = new Class({ Plugin.use(MatterLib, MatterWrap); } - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -165702,7 +178247,7 @@ var MatterPhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -165724,9 +178269,9 @@ var MatterPhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -165886,9 +178431,9 @@ var MatterPhysics = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -165909,7 +178454,7 @@ var MatterPhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -165923,7 +178468,7 @@ module.exports = MatterPhysics; /***/ }), -/* 1087 */ +/* 1308 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165940,8 +178485,8 @@ var Svg = {}; module.exports = Svg; -var Bounds = __webpack_require__(80); -var Common = __webpack_require__(33); +var Bounds = __webpack_require__(86); +var Common = __webpack_require__(36); (function() { @@ -166154,7 +178699,7 @@ var Common = __webpack_require__(33); })(); /***/ }), -/* 1088 */ +/* 1309 */ /***/ (function(module, exports, __webpack_require__) { // @if DEBUG @@ -166167,8 +178712,8 @@ var Metrics = {}; module.exports = Metrics; -var Composite = __webpack_require__(137); -var Common = __webpack_require__(33); +var Composite = __webpack_require__(149); +var Common = __webpack_require__(36); (function() { @@ -166253,7 +178798,7 @@ var Common = __webpack_require__(33); /***/ }), -/* 1089 */ +/* 1310 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166268,11 +178813,11 @@ var Query = {}; module.exports = Query; -var Vector = __webpack_require__(81); -var SAT = __webpack_require__(502); -var Bounds = __webpack_require__(80); -var Bodies = __webpack_require__(126); -var Vertices = __webpack_require__(76); +var Vector = __webpack_require__(87); +var SAT = __webpack_require__(542); +var Bounds = __webpack_require__(86); +var Bodies = __webpack_require__(138); +var Vertices = __webpack_require__(82); (function() { @@ -166389,38 +178934,46 @@ var Vertices = __webpack_require__(76); /***/ }), -/* 1090 */ +/* 1311 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bounds = __webpack_require__(80); +var Bounds = __webpack_require__(86); var Class = __webpack_require__(0); -var Composite = __webpack_require__(137); -var Constraint = __webpack_require__(194); -var Detector = __webpack_require__(503); -var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(96); -var Sleeping = __webpack_require__(222); +var Composite = __webpack_require__(149); +var Constraint = __webpack_require__(209); +var Detector = __webpack_require__(543); +var Events = __webpack_require__(545); +var InputEvents = __webpack_require__(52); +var Merge = __webpack_require__(103); +var Sleeping = __webpack_require__(238); var Vector2 = __webpack_require__(3); -var Vertices = __webpack_require__(76); +var Vertices = __webpack_require__(82); /** * @classdesc - * [description] + * A Pointer Constraint is a special type of constraint that allows you to click + * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, + * and when one is pressed down it checks to see if that hit any part of any active + * body in the world. If it did, and the body has input enabled, it will begin to + * drag it until either released, or you stop it via the `stopDrag` method. + * + * You can adjust the stiffness, length and other properties of the constraint via + * the `options` object on creation. * * @class PointerConstraint * @memberof Phaser.Physics.Matter * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Physics.Matter.World} world - [description] - * @param {object} options - [description] + * @param {Phaser.Scene} scene - A reference to the Scene to which this Pointer Constraint belongs. + * @param {Phaser.Physics.Matter.World} world - A reference to the Matter World instance to which this Constraint belongs. + * @param {object} [options] - A Constraint configuration object. */ var PointerConstraint = new Class({ @@ -166447,7 +179000,8 @@ var PointerConstraint = new Class({ }; /** - * [description] + * A reference to the Scene to which this Pointer Constraint belongs. + * This is the same Scene as the Matter World instance. * * @name Phaser.Physics.Matter.PointerConstraint#scene * @type {Phaser.Scene} @@ -166456,7 +179010,7 @@ var PointerConstraint = new Class({ this.scene = scene; /** - * [description] + * A reference to the Matter World instance to which this Constraint belongs. * * @name Phaser.Physics.Matter.PointerConstraint#world * @type {Phaser.Physics.Matter.World} @@ -166465,27 +179019,18 @@ var PointerConstraint = new Class({ this.world = world; /** - * [description] + * The Camera the Pointer was interacting with when the input + * down event was processed. * * @name Phaser.Physics.Matter.PointerConstraint#camera * @type {Phaser.Cameras.Scene2D.Camera} * @since 3.0.0 */ - var camera = GetFastValue(options, 'camera', null); - - if (!camera) - { - this.camera = scene.sys.cameras.main; - } - else - { - this.camera = camera; - - delete options.camera; - } + this.camera = null; /** - * [description] + * A reference to the Input Pointer that activated this Constraint. + * This is set in the `onDown` handler. * * @name Phaser.Physics.Matter.PointerConstraint#pointer * @type {Phaser.Input.Pointer} @@ -166495,7 +179040,10 @@ var PointerConstraint = new Class({ this.pointer = null; /** - * [description] + * Is this Constraint active or not? + * + * An active constraint will be processed each update. An inactive one will be skipped. + * Use this to toggle a Pointer Constraint on and off. * * @name Phaser.Physics.Matter.PointerConstraint#active * @type {boolean} @@ -166505,7 +179053,7 @@ var PointerConstraint = new Class({ this.active = true; /** - * The transformed position. + * The internal transformed position. * * @name Phaser.Physics.Matter.PointerConstraint#position * @type {Phaser.Math.Vector2} @@ -166514,7 +179062,25 @@ var PointerConstraint = new Class({ this.position = new Vector2(); /** - * [description] + * The body that is currently being dragged, if any. + * + * @name Phaser.Physics.Matter.PointerConstraint#body + * @type {?MatterJS.Body} + * @since 3.16.2 + */ + this.body = null; + + /** + * The part of the body that was clicked on to start the drag. + * + * @name Phaser.Physics.Matter.PointerConstraint#part + * @type {?MatterJS.Body} + * @since 3.16.2 + */ + this.part = null; + + /** + * The native Matter Constraint that is used to attach to bodies. * * @name Phaser.Physics.Matter.PointerConstraint#constraint * @type {object} @@ -166522,49 +179088,90 @@ var PointerConstraint = new Class({ */ this.constraint = Constraint.create(Merge(options, defaults)); - this.world.on('beforeupdate', this.update, this); + this.world.on(Events.BEFORE_UPDATE, this.update, this); - scene.sys.input.on('pointerdown', this.onDown, this); - - scene.sys.input.on('pointerup', this.onUp, this); + scene.sys.input.on(InputEvents.POINTER_DOWN, this.onDown, this); }, /** - * [description] + * A Pointer has been pressed down onto the Scene. + * + * If this Constraint doesn't have an active Pointer then a hit test is + * run against all active bodies in the world. If one is found it is bound + * to this constraint and the drag begins. * * @method Phaser.Physics.Matter.PointerConstraint#onDown + * @fires Phaser.Physics.Matter.Events#DRAG_START * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. */ onDown: function (pointer) { - this.pointer = pointer; + if (!this.pointer) + { + if (this.getBody(pointer)) + { + this.pointer = pointer; + + this.camera = pointer.camera; + } + } }, /** - * [description] + * Scans all active bodies in the current Matter World to see if any of them + * are hit by the Pointer. The _first one_ found to hit is set as the active contraint + * body. * - * @method Phaser.Physics.Matter.PointerConstraint#onUp - * @since 3.0.0 + * @method Phaser.Physics.Matter.PointerConstraint#getBody + * @since 3.16.2 + * + * @return {boolean} `true` if a body was found and set, otherwise `false`. */ - onUp: function () + getBody: function (pointer) { - this.pointer = null; + var pos = this.position; + var constraint = this.constraint; + + pointer.camera.getWorldPoint(pointer.x, pointer.y, pos); + + var bodies = Composite.allBodies(this.world.localWorld); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + if (!body.ignorePointer && + Bounds.contains(body.bounds, pos) && + Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) + { + if (this.hitTestBody(body, pos)) + { + this.world.emit(Events.DRAG_START, this.body, this.part, this); + + return true; + } + } + } + + return false; }, /** - * [description] + * Scans the current body to determine if a part of it was clicked on. + * If a part is found the body is set as the `constraint.bodyB` property, + * as well as the `body` property of this class. The part is also set. * - * @method Phaser.Physics.Matter.PointerConstraint#getBodyPart - * @since 3.0.0 + * @method Phaser.Physics.Matter.PointerConstraint#hitTestBody + * @since 3.16.2 * - * @param {MatterJS.Body} body - [description] - * @param {Phaser.Math.Vector2} position - [description] + * @param {MatterJS.Body} body - The Matter Body to check. + * @param {Phaser.Math.Vector2} position - A translated hit test position. * - * @return {boolean} [description] + * @return {boolean} `true` if a part of the body was hit, otherwise `false`. */ - getBodyPart: function (body, position) + hitTestBody: function (body, position) { var constraint = this.constraint; @@ -166588,6 +179195,9 @@ var PointerConstraint = new Class({ Sleeping.set(body, false); + this.part = part; + this.body = body; + return true; } } @@ -166596,67 +179206,73 @@ var PointerConstraint = new Class({ }, /** - * [description] + * Internal update handler. Called in the Matter BEFORE_UPDATE step. * * @method Phaser.Physics.Matter.PointerConstraint#update + * @fires Phaser.Physics.Matter.Events#DRAG * @since 3.0.0 */ update: function () { - if (!this.active) + var body = this.body; + var pointer = this.pointer; + + if (!this.active || !pointer || !body) { return; } - var pointer = this.pointer; - var constraint = this.constraint; - - if (!pointer) + if (pointer.isDown) { - // Pointer is up / released - if (constraint.bodyB) - { - constraint.bodyB = null; - } + var pos = this.position; + var constraint = this.constraint; + + this.camera.getWorldPoint(pointer.x, pointer.y, pos); + + Sleeping.set(body, false); + + constraint.pointA.x = pos.x; + constraint.pointA.y = pos.y; + + this.world.emit(Events.DRAG, body, this); } else { - var pos = this.position; - - this.camera.getWorldPoint(pointer.x, pointer.y, pos); - - if (constraint.bodyB) - { - // Pointer is down and we have bodyB, so wake it up - Sleeping.set(constraint.bodyB, false); - - constraint.pointA.x = pos.x; - constraint.pointA.y = pos.y; - } - else - { - var bodies = Composite.allBodies(this.world.localWorld); - - // Pointer is down and no bodyB, so check if we've hit anything - for (var i = 0; i < bodies.length; i++) - { - var body = bodies[i]; - - if (!body.ignorePointer && Bounds.contains(body.bounds, pos) && - Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) - { - if (this.getBodyPart(body, pos)) - { - break; - } - } - } - } + // Pointer has been released since the last world step + this.stopDrag(); } }, /** - * [description] + * Stops the Pointer Constraint from dragging the body any further. + * + * This is called automatically if the Pointer is released while actively + * dragging a body. Or, you can call it manually to release a body from a + * constraint without having to first release the pointer. + * + * @method Phaser.Physics.Matter.PointerConstraint#stopDrag + * @fires Phaser.Physics.Matter.Events#DRAG_END + * @since 3.16.2 + */ + stopDrag: function () + { + var body = this.body; + var constraint = this.constraint; + + if (body) + { + this.world.emit(Events.DRAG_END, body, this); + + this.pointer = null; + this.body = null; + this.part = null; + + constraint.bodyB = null; + } + }, + + /** + * Destroys this Pointer Constraint instance and all of its references. * * @method Phaser.Physics.Matter.PointerConstraint#destroy * @since 3.0.0 @@ -166665,13 +179281,14 @@ var PointerConstraint = new Class({ { this.world.removeConstraint(this.constraint); + this.pointer = null; this.constraint = null; + this.body = null; + this.part = null; - this.world.off('beforeupdate', this.update); + this.world.off(Events.BEFORE_UPDATE, this.update); - this.scene.sys.input.off('pointerdown', this.onDown, this); - - this.scene.sys.input.off('pointerup', this.onUp, this); + this.scene.sys.input.off(InputEvents.POINTER_DOWN, this.onDown, this); } }); @@ -166680,16 +179297,16 @@ module.exports = PointerConstraint; /***/ }), -/* 1091 */ +/* 1312 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(67); +var Body = __webpack_require__(72); /** * [description] @@ -166717,12 +179334,12 @@ var Velocity = { }, /** - * [description] + * Sets the horizontal velocity of the physics body. * * @method Phaser.Physics.Matter.Components.Velocity#setVelocityX * @since 3.0.0 * - * @param {number} x - [description] + * @param {number} x - The horizontal velocity value. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -166736,12 +179353,12 @@ var Velocity = { }, /** - * [description] + * Sets vertical velocity of the physics body. * * @method Phaser.Physics.Matter.Components.Velocity#setVelocityY * @since 3.0.0 * - * @param {number} y - [description] + * @param {number} y - The vertical velocity value. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -166755,13 +179372,13 @@ var Velocity = { }, /** - * [description] + * Sets both the horizontal and vertical velocity of the physics body. * * @method Phaser.Physics.Matter.Components.Velocity#setVelocity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} [y=x] - [description] + * @param {number} x - The horizontal velocity value. + * @param {number} [y=x] - The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the `x` value. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -166780,19 +179397,19 @@ module.exports = Velocity; /***/ }), -/* 1092 */ +/* 1313 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(67); -var MATH_CONST = __webpack_require__(16); -var WrapAngle = __webpack_require__(199); -var WrapAngleDegrees = __webpack_require__(198); +var Body = __webpack_require__(72); +var MATH_CONST = __webpack_require__(20); +var WrapAngle = __webpack_require__(214); +var WrapAngleDegrees = __webpack_require__(213); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -166869,8 +179486,9 @@ var Transform = { set: function (value) { - var factor = 1 / this._scaleX; - + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; + this._scaleX = value; if (this._scaleX === 0) @@ -166883,7 +179501,7 @@ var Transform = { } // Reset Matter scale back to 1 (sigh) - Body.scale(this.body, factor, this._scaleY); + Body.scale(this.body, factorX, factorY); Body.scale(this.body, value, this._scaleY); } @@ -166906,7 +179524,8 @@ var Transform = { set: function (value) { - var factor = 1 / this._scaleY; + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; this._scaleY = value; @@ -166919,7 +179538,7 @@ var Transform = { this.renderFlags |= _FLAG; } - Body.scale(this.body, this._scaleX, factor); + Body.scale(this.body, factorX, factorY); Body.scale(this.body, this._scaleX, value); } @@ -167086,16 +179705,376 @@ module.exports = Transform; /***/ }), -/* 1093 */ +/* 1314 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepStartEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Body goes to sleep. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_START + * + * @param {Phaser.Physics.Matter.Events.SleepStartEvent} event - The Sleep Event object. + * @param {MatterJS.Body} body - The body that has gone to sleep. + */ +module.exports = 'sleepstart'; + + +/***/ }), +/* 1315 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepEndEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep End Event. + * + * This event is dispatched by a Matter Physics World instance when a Body stop sleeping. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_END + * + * @param {Phaser.Physics.Matter.Events.SleepEndEvent} event - The Sleep Event object. + * @param {MatterJS.Body} body - The body that has stopped sleeping. + */ +module.exports = 'sleepend'; + + +/***/ }), +/* 1316 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics World Resume Event. + * + * This event is dispatched by an Matter Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`. + * + * @event Phaser.Physics.Matter.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 1317 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics World Pause Event. + * + * This event is dispatched by an Matter Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`. + * + * @event Phaser.Physics.Matter.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 1318 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * starts dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_START + * + * @param {MatterJS.Body} body - The Body that has started being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {MatterJS.Body} part - The part of the body that was clicked on. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'dragstart'; + + +/***/ }), +/* 1319 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * is actively dragging a body. It is emitted each time the pointer moves. + * + * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG + * + * @param {MatterJS.Body} body - The Body that is being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'drag'; + + +/***/ }), +/* 1320 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag End Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * stops dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_END + * + * @param {MatterJS.Body} body - The Body that has stopped being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that was dragging the body. + */ +module.exports = 'dragend'; + + +/***/ }), +/* 1321 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionStartEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Start Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have started to collide in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_START + * + * @param {Phaser.Physics.Matter.Events.CollisionStartEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionstart'; + + +/***/ }), +/* 1322 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionEndEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision End Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have finished colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_END + * + * @param {Phaser.Physics.Matter.Events.CollisionEndEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionend'; + + +/***/ }), +/* 1323 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionActiveEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Active Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that are colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_ACTIVE + * + * @param {Phaser.Physics.Matter.Events.CollisionActiveEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionactive'; + + +/***/ }), +/* 1324 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.BeforeUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Before Update Event. + * + * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place. + * + * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#BEFORE_UPDATE + * + * @param {Phaser.Physics.Matter.Events.BeforeUpdateEvent} event - The Update Event object. + */ +module.exports = 'beforeupdate'; + + +/***/ }), +/* 1325 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.AfterUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics After Update Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved. + * + * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#AFTER_UPDATE + * + * @param {Phaser.Physics.Matter.Events.AfterUpdateEvent} event - The Update Event object. + */ +module.exports = 'afterupdate'; + + +/***/ }), +/* 1326 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MatterEvents = __webpack_require__(195); +var Events = __webpack_require__(545); +var MatterEvents = __webpack_require__(210); /** * [description] @@ -167161,7 +180140,7 @@ var Sleep = { MatterEvents.on(this.body, 'sleepStart', function (event) { - world.emit('sleepstart', event, this); + world.emit(Events.SLEEP_START, event, this); }); } else @@ -167190,7 +180169,7 @@ var Sleep = { MatterEvents.on(this.body, 'sleepEnd', function (event) { - world.emit('sleepend', event, this); + world.emit(Events.SLEEP_END, event, this); }); } else @@ -167207,7 +180186,7 @@ module.exports = Sleep; /***/ }), -/* 1094 */ +/* 1327 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167216,13 +180195,13 @@ module.exports = Sleep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(126); -var Body = __webpack_require__(67); -var Bounds = __webpack_require__(80); -var Common = __webpack_require__(33); +var Bodies = __webpack_require__(138); +var Body = __webpack_require__(72); +var Bounds = __webpack_require__(86); +var Common = __webpack_require__(36); var GetFastValue = __webpack_require__(2); -var Vector = __webpack_require__(81); -var Vertices = __webpack_require__(76); +var Vector = __webpack_require__(87); +var Vertices = __webpack_require__(82); /** * Use PhysicsEditorParser.parseBody() to build a Matter body object, based on a physics data file @@ -167384,20 +180363,20 @@ module.exports = PhysicsEditorParser; /***/ }), -/* 1095 */ +/* 1328 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bodies = __webpack_require__(126); -var Body = __webpack_require__(67); +var Bodies = __webpack_require__(138); +var Body = __webpack_require__(72); var GetFastValue = __webpack_require__(2); -var PhysicsEditorParser = __webpack_require__(1094); -var Vertices = __webpack_require__(76); +var PhysicsEditorParser = __webpack_require__(1327); +var Vertices = __webpack_require__(82); /** * [description] @@ -167410,13 +180389,13 @@ var SetBody = { // Calling any of these methods resets previous properties you may have set on the body, including plugins, mass, etc /** - * [description] + * Set the body on a Game Object to a rectangle. * * @method Phaser.Physics.Matter.Components.SetBody#setRectangle * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. * @param {object} options - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. @@ -167443,14 +180422,14 @@ var SetBody = { }, /** - * [description] + * Set the body on the Game Object to a polygon shape. * * @method Phaser.Physics.Matter.Components.SetBody#setPolygon * @since 3.0.0 * - * @param {number} radius - [description] - * @param {number} sides - [description] - * @param {object} options - [description] + * @param {number} radius - The radius of the polygon. + * @param {number} sides - The amount of sides creating the polygon. + * @param {object} options - A matterjs config object. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167460,15 +180439,15 @@ var SetBody = { }, /** - * [description] + * Creates a new matterjs trapezoid body. * * @method Phaser.Physics.Matter.Components.SetBody#setTrapezoid * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} slope - [description] - * @param {object} options - [description] + * @param {number} width - The width of the trapezoid. + * @param {number} height - The height of the trapezoid. + * @param {number} slope - The angle of slope for the trapezoid. + * @param {object} options - A matterjs config object for the body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167634,12 +180613,12 @@ module.exports = SetBody; /***/ }), -/* 1096 */ +/* 1329 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -167687,16 +180666,16 @@ module.exports = Sensor; /***/ }), -/* 1097 */ +/* 1330 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(67); +var Body = __webpack_require__(72); /** * [description] @@ -167742,20 +180721,20 @@ module.exports = Static; /***/ }), -/* 1098 */ +/* 1331 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(67); +var Body = __webpack_require__(72); var Vector2 = __webpack_require__(3); /** - * [description] + * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly. * * @name Phaser.Physics.Matter.Components.Mass * @since 3.0.0 @@ -167763,12 +180742,12 @@ var Vector2 = __webpack_require__(3); var Mass = { /** - * [description] + * Sets the mass of the Game Object's Matter Body. * * @method Phaser.Physics.Matter.Components.Mass#setMass * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new mass of the body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167780,12 +180759,12 @@ var Mass = { }, /** - * [description] + * Sets density of the body. * * @method Phaser.Physics.Matter.Components.Mass#setDensity * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new density of the body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167819,12 +180798,12 @@ module.exports = Mass; /***/ }), -/* 1099 */ +/* 1332 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -167859,17 +180838,17 @@ module.exports = Gravity; /***/ }), -/* 1100 */ +/* 1333 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly. * * @name Phaser.Physics.Matter.Components.Friction * @since 3.0.0 @@ -167877,14 +180856,14 @@ module.exports = Gravity; var Friction = { /** - * [description] + * Sets new friction values for this Game Object's Matter Body. * * @method Phaser.Physics.Matter.Components.Friction#setFriction * @since 3.0.0 * - * @param {number} value - [description] - * @param {number} [air] - [description] - * @param {number} [fstatic] - [description] + * @param {number} value - The new friction of the body, between 0 and 1, where 0 allows the Body to slide indefinitely, while 1 allows it to stop almost immediately after a force is applied. + * @param {number} [air] - If provided, the new air resistance of the Body. The higher the value, the faster the Body will slow as it moves through space. 0 means the body has no air resistance. + * @param {number} [fstatic] - If provided, the new static friction of the Body. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. 0 means the body will never "stick" when it is nearly stationary. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167906,12 +180885,12 @@ var Friction = { }, /** - * [description] + * Sets a new air resistance for this Game Object's Matter Body. A value of 0 means the Body will never slow as it moves through space. The higher the value, the faster a Body slows when moving through space. * * @method Phaser.Physics.Matter.Components.Friction#setFrictionAir * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new air resistance for the Body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167923,12 +180902,12 @@ var Friction = { }, /** - * [description] + * Sets a new static friction for this Game Object's Matter Body. A value of 0 means the Body will never "stick" when it is nearly stationary. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. * * @method Phaser.Physics.Matter.Components.Friction#setFrictionStatic * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - The new static friction for the Body. * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -167945,16 +180924,16 @@ module.exports = Friction; /***/ }), -/* 1101 */ +/* 1334 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(67); +var Body = __webpack_require__(72); /** * A component to apply force to Matter.js bodies. @@ -168093,17 +181072,17 @@ module.exports = Force; /***/ }), -/* 1102 */ +/* 1335 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly. * * @name Phaser.Physics.Matter.Components.Collision * @since 3.0.0 @@ -168111,7 +181090,7 @@ module.exports = Force; var Collision = { /** - * [description] + * Sets the collision category of this Game Object's Matter Body. This number must be a power of two between 2^0 (= 1) and 2^31. Two bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision categories are included in their collision masks (see {@link #setCollidesWith}). * * @method Phaser.Physics.Matter.Components.Collision#setCollisionCategory * @since 3.0.0 @@ -168128,7 +181107,7 @@ var Collision = { }, /** - * [description] + * Sets the collision group of this Game Object's Matter Body. If this is zero or two Matter Bodies have different values, they will collide according to the usual rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}). If two Matter Bodies have the same positive value, they will always collide; if they have the same negative value, they will never collide. * * @method Phaser.Physics.Matter.Components.Collision#setCollisionGroup * @since 3.0.0 @@ -168145,7 +181124,7 @@ var Collision = { }, /** - * [description] + * Sets the collision mask for this Game Object's Matter Body. Two Matter Bodies with different collision groups will only collide if each one includes the other's category in its mask based on a bitwise AND, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` are both true. * * @method Phaser.Physics.Matter.Components.Collision#setCollidesWith * @since 3.0.0 @@ -168181,17 +181160,17 @@ module.exports = Collision; /***/ }), -/* 1103 */ +/* 1336 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * [description] + * A component to set restitution on objects. * * @name Phaser.Physics.Matter.Components.Bounce * @since 3.0.0 @@ -168199,12 +181178,12 @@ module.exports = Collision; var Bounce = { /** - * [description] + * Sets the restitution on the physics object. * * @method Phaser.Physics.Matter.Components.Bounce#setBounce * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: `Math.max(bodyA.restitution, bodyB.restitution)` * * @return {Phaser.GameObjects.GameObject} This Game Object. */ @@ -168221,16 +181200,16 @@ module.exports = Bounce; /***/ }), -/* 1104 */ +/* 1337 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Components = __webpack_require__(419); +var Components = __webpack_require__(452); var GetFastValue = __webpack_require__(2); var Vector2 = __webpack_require__(3); @@ -168332,12 +181311,12 @@ module.exports = MatterGameObject; /***/ }), -/* 1105 */ +/* 1338 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168347,14 +181326,14 @@ module.exports = MatterGameObject; module.exports = { - Factory: __webpack_require__(1070), - Image: __webpack_require__(1067), - Matter: __webpack_require__(501), - MatterPhysics: __webpack_require__(1086), - PolyDecomp: __webpack_require__(1069), - Sprite: __webpack_require__(1066), - TileBody: __webpack_require__(504), - World: __webpack_require__(1060) + Factory: __webpack_require__(1291), + Image: __webpack_require__(1288), + Matter: __webpack_require__(541), + MatterPhysics: __webpack_require__(1307), + PolyDecomp: __webpack_require__(1290), + Sprite: __webpack_require__(1287), + TileBody: __webpack_require__(544), + World: __webpack_require__(1281) }; @@ -168421,19 +181400,19 @@ module.exports = { /***/ }), -/* 1106 */ +/* 1339 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @function Phaser.Physics.Impact.SeperateY + * @function Phaser.Physics.Impact.SeparateY * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - [description] @@ -168441,7 +181420,7 @@ module.exports = { * @param {Phaser.Physics.Impact.Body} bottom - [description] * @param {Phaser.Physics.Impact.Body} [weak] - [description] */ -var SeperateY = function (world, top, bottom, weak) +var SeparateY = function (world, top, bottom, weak) { var nudge = (top.pos.y + top.size.y - bottom.pos.y); var nudgeX; @@ -168502,23 +181481,23 @@ var SeperateY = function (world, top, bottom, weak) } }; -module.exports = SeperateY; +module.exports = SeparateY; /***/ }), -/* 1107 */ +/* 1340 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @function Phaser.Physics.Impact.SeperateX + * @function Phaser.Physics.Impact.SeparateX * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - [description] @@ -168526,7 +181505,7 @@ module.exports = SeperateY; * @param {Phaser.Physics.Impact.Body} right - [description] * @param {Phaser.Physics.Impact.Body} [weak] - [description] */ -var SeperateX = function (world, left, right, weak) +var SeparateX = function (world, left, right, weak) { var nudge = left.pos.x + left.size.x - right.pos.x; @@ -168558,32 +181537,34 @@ var SeperateX = function (world, left, right, weak) } }; -module.exports = SeperateX; +module.exports = SeparateX; /***/ }), -/* 1108 */ +/* 1341 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var COLLIDES = __webpack_require__(224); -var SeperateX = __webpack_require__(1107); -var SeperateY = __webpack_require__(1106); +var COLLIDES = __webpack_require__(240); +var Events = __webpack_require__(548); +var SeparateX = __webpack_require__(1340); +var SeparateY = __webpack_require__(1339); /** * Impact Physics Solver * * @function Phaser.Physics.Impact.Solver + * @fires Phaser.Physics.Impact.Events#COLLIDE * @since 3.0.0 * - * @param {Phaser.Physics.Impact.World} world - [description] - * @param {Phaser.Physics.Impact.Body} bodyA - [description] - * @param {Phaser.Physics.Impact.Body} bodyB - [description] + * @param {Phaser.Physics.Impact.World} world - The Impact simulation to run the solver in. + * @param {Phaser.Physics.Impact.Body} bodyA - The first body in the collision. + * @param {Phaser.Physics.Impact.Body} bodyB - The second body in the collision. */ var Solver = function (world, bodyA, bodyB) { @@ -168602,33 +181583,33 @@ var Solver = function (world, bodyA, bodyB) { if (bodyA.last.y < bodyB.last.y) { - SeperateY(world, bodyA, bodyB, weak); + SeparateY(world, bodyA, bodyB, weak); } else { - SeperateY(world, bodyB, bodyA, weak); + SeparateY(world, bodyB, bodyA, weak); } bodyA.collideWith(bodyB, 'y'); bodyB.collideWith(bodyA, 'y'); - world.emit('collide', bodyA, bodyB, 'y'); + world.emit(Events.COLLIDE, bodyA, bodyB, 'y'); } else if (bodyA.last.y + bodyA.size.y > bodyB.last.y && bodyA.last.y < bodyB.last.y + bodyB.size.y) { if (bodyA.last.x < bodyB.last.x) { - SeperateX(world, bodyA, bodyB, weak); + SeparateX(world, bodyA, bodyB, weak); } else { - SeperateX(world, bodyB, bodyA, weak); + SeparateX(world, bodyB, bodyA, weak); } bodyA.collideWith(bodyB, 'x'); bodyB.collideWith(bodyA, 'x'); - world.emit('collide', bodyA, bodyB, 'x'); + world.emit(Events.COLLIDE, bodyA, bodyB, 'x'); } }; @@ -168636,21 +181617,22 @@ module.exports = Solver; /***/ }), -/* 1109 */ +/* 1342 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(1075); +var Factory = __webpack_require__(1296); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(96); -var PluginCache = __webpack_require__(15); -var World = __webpack_require__(1071); +var Merge = __webpack_require__(103); +var PluginCache = __webpack_require__(17); +var SceneEvents = __webpack_require__(16); +var World = __webpack_require__(1292); /** * @classdesc @@ -168714,8 +181696,8 @@ var ImpactPhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -168731,7 +181713,7 @@ var ImpactPhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -168753,8 +181735,8 @@ var ImpactPhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -168816,8 +181798,8 @@ var ImpactPhysics = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -168838,7 +181820,7 @@ var ImpactPhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; @@ -168852,12 +181834,12 @@ module.exports = ImpactPhysics; /***/ }), -/* 1110 */ +/* 1343 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168952,12 +181934,12 @@ module.exports = Velocity; /***/ }), -/* 1111 */ +/* 1344 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169028,12 +182010,12 @@ module.exports = SetGameObject; /***/ }), -/* 1112 */ +/* 1345 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169078,12 +182060,12 @@ module.exports = Offset; /***/ }), -/* 1113 */ +/* 1346 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169140,12 +182122,12 @@ module.exports = Gravity; /***/ }), -/* 1114 */ +/* 1347 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169217,12 +182199,12 @@ module.exports = Friction; /***/ }), -/* 1115 */ +/* 1348 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169342,16 +182324,16 @@ module.exports = Debug; /***/ }), -/* 1116 */ +/* 1349 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var COLLIDES = __webpack_require__(224); +var COLLIDES = __webpack_require__(240); /** * @callback CollideCallback @@ -169498,16 +182480,16 @@ module.exports = Collides; /***/ }), -/* 1117 */ +/* 1350 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TYPE = __webpack_require__(223); +var TYPE = __webpack_require__(239); /** * The Impact Check Against component. @@ -169620,12 +182602,12 @@ module.exports = CheckAgainst; /***/ }), -/* 1118 */ +/* 1351 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169700,16 +182682,16 @@ module.exports = Bounce; /***/ }), -/* 1119 */ +/* 1352 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TYPE = __webpack_require__(223); +var TYPE = __webpack_require__(239); /** * The Impact Body Type component. @@ -169784,12 +182766,12 @@ module.exports = BodyType; /***/ }), -/* 1120 */ +/* 1353 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169858,12 +182840,12 @@ module.exports = BodyScale; /***/ }), -/* 1121 */ +/* 1354 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -169935,12 +182917,12 @@ module.exports = Acceleration; /***/ }), -/* 1122 */ +/* 1355 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170006,12 +182988,82 @@ module.exports = { /***/ }), -/* 1123 */ +/* 1356 */ /***/ (function(module, exports) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Resume Event. + * + * This event is dispatched by an Impact Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.impact.world.on('resume', listener)`. + * + * @event Phaser.Physics.Impact.Events#RESUME + */ +module.exports = 'resume'; + + +/***/ }), +/* 1357 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Pause Event. + * + * This event is dispatched by an Impact Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.impact.world.on('pause', listener)`. + * + * @event Phaser.Physics.Impact.Events#PAUSE + */ +module.exports = 'pause'; + + +/***/ }), +/* 1358 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Collide Event. + * + * This event is dispatched by an Impact Physics World instance if two bodies collide. + * + * Listen to it from a Scene using: `this.impact.world.on('collide', listener)`. + * + * @event Phaser.Physics.Impact.Events#COLLIDE + * + * @param {Phaser.Physics.Impact.Body} bodyA - The first body involved in the collision. + * @param {Phaser.Physics.Impact.Body} bodyB - The second body involved in the collision. + * @param {string} axis - The collision axis. Either `x` or `y`. + */ +module.exports = 'collide'; + + +/***/ }), +/* 1359 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170101,12 +183153,12 @@ module.exports = UpdateMotion; /***/ }), -/* 1124 */ +/* 1360 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170157,12 +183209,12 @@ module.exports = GetVelocity; /***/ }), -/* 1125 */ +/* 1361 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170183,27 +183235,28 @@ module.exports = GetVelocity; */ module.exports = { - Body: __webpack_require__(1077), - COLLIDES: __webpack_require__(224), - CollisionMap: __webpack_require__(1076), - Factory: __webpack_require__(1075), - Image: __webpack_require__(1073), - ImpactBody: __webpack_require__(1074), - ImpactPhysics: __webpack_require__(1109), - Sprite: __webpack_require__(1072), - TYPE: __webpack_require__(223), - World: __webpack_require__(1071) + Body: __webpack_require__(1298), + Events: __webpack_require__(548), + COLLIDES: __webpack_require__(240), + CollisionMap: __webpack_require__(1297), + Factory: __webpack_require__(1296), + Image: __webpack_require__(1294), + ImpactBody: __webpack_require__(1295), + ImpactPhysics: __webpack_require__(1342), + Sprite: __webpack_require__(1293), + TYPE: __webpack_require__(239), + World: __webpack_require__(1292) }; /***/ }), -/* 1126 */ +/* 1362 */ /***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -170213,27 +183266,27 @@ module.exports = { module.exports = { - Arcade: __webpack_require__(528), - Impact: __webpack_require__(1125), - Matter: __webpack_require__(1105) + Arcade: __webpack_require__(577), + Impact: __webpack_require__(1361), + Matter: __webpack_require__(1338) }; /***/ }), -/* 1127 */ +/* 1363 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -__webpack_require__(1059); +__webpack_require__(1280); -var CONST = __webpack_require__(26); -var Extend = __webpack_require__(20); +var CONST = __webpack_require__(28); +var Extend = __webpack_require__(19); /** * @namespace Phaser @@ -170241,35 +183294,37 @@ var Extend = __webpack_require__(20); var Phaser = { - Actions: __webpack_require__(417), - Animation: __webpack_require__(993), - Cache: __webpack_require__(992), - Cameras: __webpack_require__(991), + Actions: __webpack_require__(450), + Animations: __webpack_require__(1191), + Cache: __webpack_require__(1176), + Cameras: __webpack_require__(1173), + Core: __webpack_require__(1097), Class: __webpack_require__(0), - Create: __webpack_require__(948), - Curves: __webpack_require__(942), - Data: __webpack_require__(939), - Display: __webpack_require__(937), - DOM: __webpack_require__(908), - Events: __webpack_require__(906), - Game: __webpack_require__(904), - GameObjects: __webpack_require__(876), - Geom: __webpack_require__(274), - Input: __webpack_require__(616), - Loader: __webpack_require__(593), - Math: __webpack_require__(570), - Physics: __webpack_require__(1126), - Plugins: __webpack_require__(498), - Renderer: __webpack_require__(1083), - Scene: __webpack_require__(328), - Scenes: __webpack_require__(496), - Sound: __webpack_require__(494), - Structs: __webpack_require__(493), - Textures: __webpack_require__(492), - Tilemaps: __webpack_require__(490), - Time: __webpack_require__(441), - Tweens: __webpack_require__(439), - Utils: __webpack_require__(435) + Create: __webpack_require__(1038), + Curves: __webpack_require__(1032), + Data: __webpack_require__(1029), + Display: __webpack_require__(1027), + DOM: __webpack_require__(998), + Events: __webpack_require__(997), + Game: __webpack_require__(995), + GameObjects: __webpack_require__(902), + Geom: __webpack_require__(279), + Input: __webpack_require__(635), + Loader: __webpack_require__(601), + Math: __webpack_require__(387), + Physics: __webpack_require__(1362), + Plugins: __webpack_require__(538), + Renderer: __webpack_require__(1304), + Scale: __webpack_require__(536), + Scene: __webpack_require__(331), + Scenes: __webpack_require__(535), + Sound: __webpack_require__(533), + Structs: __webpack_require__(532), + Textures: __webpack_require__(531), + Tilemaps: __webpack_require__(529), + Time: __webpack_require__(480), + Tweens: __webpack_require__(478), + Utils: __webpack_require__(468) }; @@ -170297,7 +183352,7 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(200))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(215))) /***/ }) /******/ ]); diff --git a/dist/phaser.min.js b/dist/phaser.min.js index e6b557509..cddf08a37 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()}(window,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.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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=1127)}([function(t,e){function i(t,e,i){var n=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&n.value&&"object"==typeof n.value&&(n=n.value),!(!n||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(n))&&(void 0===n.enumerable&&(n.enumerable=!0),void 0===n.configurable&&(n.configurable=!0),n)}function n(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function s(t,e,s,r){for(var a in e)if(e.hasOwnProperty(a)){var h=i(e,a,s);if(!1!==h){if(n((r||t).prototype,a)){if(o.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=e[a]}}function r(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i0&&(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){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o=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=l},function(t,e){t.exports={getTintFromFloats:function(t,e,i,n){return((255&(255*n|0))<<24|(255&(255*t|0))<<16|(255&(255*e|0))<<8|255&(255*i|0))>>>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;no.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&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return i.unshift(this.scene.sys.displayList.getIndex(t)),i},destroy:function(t){if(void 0===t&&(t=!1),this.scene&&!this.ignoreDestroy){this.preDestroy&&this.preDestroy.call(this),this.emit("destroy",this);var e=this.scene.sys;t||(e.displayList.remove(this),e.updateList.remove(this)),this.input&&(e.input.clear(this),this.input=void 0),this.data&&(this.data.destroy(),this.data=void 0),this.body&&(this.body.destroy(),this.body=void 0),t||e.queueDepthSort(),this.active=!1,this.visible=!1,this.scene=void 0,this.parentContainer=void 0,this.removeAllListeners()}}});a.RENDER_MASK=15,t.exports=a},function(t,e,i){var n=i(8),s=function(){var t,e,i,r,o,a,h=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof h&&(c=h,h=arguments[1]||{},l=2),u===l&&(h=this,--l);l=400&&t.status<=599&&(i=!1),this.resetXHR(),this.loader.nextFile(this,i)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit("fileprogress",this,this.percentComplete))},onProcess:function(){this.state=s.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=s.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=s.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit("filecomplete",e,i,t),this.loader.emit("filecomplete-"+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});u.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},u.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=u},function(t,e){t.exports=function(t,e,i,n,s){var r=n.alpha*i.alpha;if(r<=0)return!1;var o=t._tempMatrix1.copyFromArray(n.matrix.matrix),a=t._tempMatrix2.applyITRS(i.x,i.y,i.rotation,i.scaleX,i.scaleY),h=t._tempMatrix3;return s?(o.multiplyWithOffset(s,-n.scrollX*i.scrollFactorX,-n.scrollY*i.scrollFactorY),a.e=i.x,a.f=i.y,o.multiply(a,h)):(a.e-=n.scrollX*i.scrollFactorX,a.f-=n.scrollY*i.scrollFactorY,o.multiply(a,h)),e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=r,e.save(),h.setToContext(e),!0}},function(t,e){t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},function(t,e,i){var n,s,r,o=i(26),a=i(120),h=[],l=!1;t.exports={create2D:function(t,e,i){return n(t,e,i,o.CANVAS)},create:n=function(t,e,i,n,r){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=o.CANVAS),void 0===r&&(r=!1);var c=s(n);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:n},n===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),r&&(c.parent=u),u.width=e,u.height=i,l&&n===o.CANVAS&&a.disable(u.getContext("2d")),u},createWebGL:function(t,e,i){return n(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:s=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n={VERSION:"3.15.1",BlendModes:i(66),ScaleModes:i(94),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=n},function(t,e,i){var n=i(0),s=i(14),r=i(19),o=i(54),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Transform,s.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.initPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]}});t.exports=a},function(t,e,i){var n=i(66),s=i(12),r=i(94);t.exports=function(t,e,i){e.x=s(i,"x",0),e.y=s(i,"y",0),e.depth=s(i,"depth",0),e.flipX=s(i,"flipX",!1),e.flipY=s(i,"flipY",!1);var o=s(i,"scale",null);"number"==typeof o?e.setScale(o):null!==o&&(e.scaleX=s(o,"x",1),e.scaleY=s(o,"y",1));var a=s(i,"scrollFactor",null);"number"==typeof a?e.setScrollFactor(a):null!==a&&(e.scrollFactorX=s(a,"x",1),e.scrollFactorY=s(a,"y",1)),e.rotation=s(i,"rotation",0);var h=s(i,"angle",null);null!==h&&(e.angle=h),e.alpha=s(i,"alpha",1);var l=s(i,"origin",null);if("number"==typeof l)e.setOrigin(l);else if(null!==l){var u=s(l,"x",.5),c=s(l,"y",.5);e.setOrigin(u,c)}return e.scaleMode=s(i,"scaleMode",r.DEFAULT),e.blendMode=s(i,"blendMode",n.NORMAL),e.visible=s(i,"visible",!0),s(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},function(t,e){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e){t.exports=function(t,e,i){var n=i||e.fillColor,s=e.fillAlpha,r=(16711680&n)>>>16,o=(65280&n)>>>8,a=255&n;t.fillStyle="rgba("+r+","+o+","+a+","+s+")"}},function(t,e,i){var n=i(16);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e){t.exports=function(t,e,i,n,s,r){var o;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=s;o=0;o--)t[o][e]+=i+a*n,a++;return t}},function(t,e,i){(function(e){var i={};t.exports=i,function(){i._nextId=0,i._seed=0,i._nowStartTime=+new Date,i.extend=function(t,e){var n,s;"boolean"==typeof e?(n=2,s=e):(n=1,s=!0);for(var r=n;r0;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"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},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]"===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.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;i>>16,r=(65280&i)>>>8,o=255&i;t.strokeStyle="rgba("+s+","+r+","+o+","+n+")",t.lineWidth=e.lineWidth}},function(t,e,i){var n=i(0),s=i(177),r=i(376),o=i(176),a=i(375),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=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,n)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=n,this._locked=!1,this.update(s)},setGLTo:function(t,e,i,n){return void 0===n&&(n=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=n,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,n=this.b,o=this.a;return this._color=s(e,i,n),this._color32=r(e,i,n,o),this._rgba="rgba("+e+","+i+","+n+","+o/255+")",t&&a(e,i,n,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t));return this.setTo(i,n,s)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,n=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),n=Math.max(0,Math.min(255,n-Math.round(-t/100*255))),this.setTo(e,i,n)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,n,s,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},scaleY:{get:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3];return n[0]=s*i+o*e,n[1]=r*i+a*e,n[2]=s*-e+o*i,n[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,s=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=n[0],c=n[1],d=n[2],f=n[3],p=n[4],g=n[5],v=void 0===e?this:e;return v.a=u*s+c*o,v.b=u*r+c*a,v.c=d*s+f*o,v.d=d*r+f*a,v.e=p*s+g*o+h,v.f=p*r+g*a+l,v},multiplyWithOffset:function(t,e,i){var n=this.matrix,s=t.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=e*r+i*a+n[4],u=e*o+i*h+n[5],c=s[0],d=s[1],f=s[2],p=s[3],g=s[4],v=s[5];return n[0]=c*r+d*a,n[1]=c*o+d*h,n[2]=f*r+p*a,n[3]=f*o+p*h,n[4]=g*r+v*a+l,n[5]=g*o+v*h+u,this},transform:function(t,e,i,n,s,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+n*l,o[3]=i*h+n*u,o[4]=s*a+r*l+c,o[5]=s*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],l=n[5];return i.x=t*s+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=e*s-i*n;return t[0]=s/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-s*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;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],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,s,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],s=e[2],r=e[3],o=i*i,a=n*n,h=s*s,l=r*r,u=Math.sqrt(o+h),c=Math.sqrt(a+l);return t.translateX=e[4],t.translateY=e[5],t.scaleX=u,t.scaleY=c,t.rotation=Math.acos(i/u)*(Math.atan(-s/i)<0?-1:1),t},applyITRS:function(t,e,i,n,s){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*n,r[1]=o*n,r[2]=-o*s,r[3]=a*s,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=r*c*e+-o*c*t+(-u*r+l*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=r},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){t.exports=function(t,e,i){return t.radius>0&&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){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x+t.width-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y+t.height-t.height*t.originY}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e,i){var n=i(0),s=i(18),r=i(21),o=i(7),a=i(2),h=i(4),l=i(8),u=new n({Extends:r,initialize:function(t,e,i,n,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:n,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=s.FILE_POPULATED)},onProcess:function(){if(this.state!==s.FILE_POPULATED){this.state=s.FILE_PROCESSING;var t=JSON.parse(this.xhrLoader.responseText),e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;sthis.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=h},function(t,e,i){var n=i(0),s=i(14),r=i(265),o=new n({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.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=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.loader=t,this.type=e,this.key=i,this.files=n,this.complete=!1,this.pending=n.length,this.failed=0,this.config={};for(var s=0;s=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=l},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=t.strokeTint,a=n.getTintAppendFloatAlphaAndSwap(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-s,f=h[1]-r;e.closePath||(l-=2);for(var p=2;ps||e>=i||i>s||e+i>s){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},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,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 w=i;wh&&(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=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)&&w(s,r)&&w(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=b(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)&&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 _(t.i,t.x,t.y),n=new _(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 _(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 _(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){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){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,i){var n={};t.exports=n;var s=i(76),r=i(81),o=i(222),a=i(33),h=i(80),l=i(505);!function(){n._inertiaScale=4,n._nextCollidingGroupId=1,n._nextNonCollidingGroupId=-1,n._nextCategory=1,n.create=function(e){var i={id:a.nextId(),type:"body",label:"Body",gameObject:null,parts:[],plugin:{},angle:0,vertices:s.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},previousPositionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,ignoreGravity:!1,ignorePointer:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0},lineWidth:0},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,_original:null},n=a.extend(i,e);return t(n,e),n},n.nextGroup=function(t){return t?n._nextNonCollidingGroupId--:n._nextCollidingGroupId++},n.nextCategory=function(){return n._nextCategory=n._nextCategory<<1,n._nextCategory};var t=function(t,e){e=e||{},n.set(t,{bounds:t.bounds||h.create(t.vertices),positionPrev:t.positionPrev||r.clone(t.position),anglePrev:t.anglePrev||t.angle,vertices:t.vertices,parts:t.parts||[t],isStatic:t.isStatic,isSleeping:t.isSleeping,parent:t.parent||t}),s.rotate(t.vertices,t.angle,t.position),l.rotate(t.axes,t.angle),h.update(t.bounds,t.vertices,t.velocity),n.set(t,{axes:e.axes||t.axes,area:e.area||t.area,mass:e.mass||t.mass,inertia:e.inertia||t.inertia});var i=t.isStatic?"#2e2b44":a.choose(["#006BA6","#0496FF","#FFBC42","#D81159","#8F2D56"]);t.render.fillStyle=t.render.fillStyle||i,t.render.strokeStyle=t.render.strokeStyle||"#000",t.render.sprite.xOffset+=-(t.bounds.min.x-t.position.x)/(t.bounds.max.x-t.bounds.min.x),t.render.sprite.yOffset+=-(t.bounds.min.y-t.position.y)/(t.bounds.max.y-t.bounds.min.y)};n.set=function(t,e,i){var s;for(s in"string"==typeof e&&(s=e,(e={})[s]=i),e)if(e.hasOwnProperty(s))switch(i=e[s],s){case"isStatic":n.setStatic(t,i);break;case"isSleeping":o.set(t,i);break;case"mass":n.setMass(t,i);break;case"density":n.setDensity(t,i);break;case"inertia":n.setInertia(t,i);break;case"vertices":n.setVertices(t,i);break;case"position":n.setPosition(t,i);break;case"angle":n.setAngle(t,i);break;case"velocity":n.setVelocity(t,i);break;case"angularVelocity":n.setAngularVelocity(t,i);break;case"parts":n.setParts(t,i);break;default:t[s]=i}},n.setStatic=function(t,e){for(var i=0;i0&&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,e,i,r){var o=0,a=0;r=r||t.position;for(var u=0;u0&&(o+=c.area,a+=c.inertia),c.position.x=r.x+(c.position.x-r.x)*e,c.position.y=r.y+(c.position.y-r.y)*i,h.update(c.bounds,c.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(n.setMass(t,t.density*o),n.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null)},n.update=function(t,e,i,n){var o=Math.pow(e*i*t.timeScale,2),a=1-t.frictionAir*i*t.timeScale,u=t.position.x-t.positionPrev.x,c=t.position.y-t.positionPrev.y;t.velocity.x=u*a*n+t.force.x/t.mass*o,t.velocity.y=c*a*n+t.force.y/t.mass*o,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*a*n+t.torque/t.inertia*o,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=r.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(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},n._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i=0&&y>=0&&v+y<1}},function(t,e,i){var n=i(0),s=i(173),r=i(9),o=i(3),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){var n=i(0),s=i(40),r=i(405),o=i(403),a=i(191),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){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},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,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e,i){var n={};t.exports=n;var s=i(81),r=i(33);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,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","map"),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.widthInPixels=s(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.tileHeight),this.format=s(t,"format",null),this.orientation=s(t,"orientation","orthogonal"),this.renderOrder=s(t,"renderOrder","right-down"),this.version=s(t,"version","1"),this.properties=s(t,"properties",{}),this.layers=s(t,"layers",[]),this.images=s(t,"images",[]),this.objects=s(t,"objects",{}),this.collision=s(t,"collision",{}),this.tilesets=s(t,"tilesets",[]),this.imageCollections=s(t,"imageCollections",[]),this.tiles=s(t,"tiles",[])}});t.exports=r},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","layer"),this.x=s(t,"x",0),this.y=s(t,"y",0),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.baseTileWidth=s(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=s(t,"baseTileHeight",this.tileHeight),this.widthInPixels=s(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=s(t,"alpha",1),this.visible=s(t,"visible",!0),this.properties=s(t,"properties",{}),this.indexes=s(t,"indexes",[]),this.collideIndexes=s(t,"collideIndexes",[]),this.callbacks=s(t,"callbacks",[]),this.bodies=s(t,"bodies",[]),this.data=s(t,"data",[]),this.tilemapLayer=s(t,"tilemapLayer",null)}});t.exports=r},function(t,e){t.exports=function(t,e,i){return t>=0&&t=0&&et.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){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,i){var n=i(10);t.exports=function(t,e,i,s,r,o){for(var a=n.getTintAppendFloatAlphaAndSwap(i.fillColor,i.fillAlpha*s),h=i.pathData,l=i.pathIndexes,u=0;u=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof s&&(l.x=s),"number"==typeof r&&(l.y=r),l):n?this.create(s,r,o,a,h):null},get:function(t,e,i,n,s){return this.getFirst(!1,!0,t,e,i,n,s)},getFirstAlive:function(t,e,i,n,s,r){return this.getFirst(!0,t,e,i,n,s,r)},getFirstDead:function(t,e,i,n,s,r){return this.getFirst(!1,t,e,i,n,s,r)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=t.length)){for(var i=t.length-1,n=t[e],s=e;s-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 t=this.firstgid&&t=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e,i){var n=i(0),s=i(14),r=i(19),o=i(731),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,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"),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.lengthl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(a-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){for(var i=[null],n=2;n0?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=a},function(t,e,i){var n=i(0),s=i(23),r=i(20),o=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.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(r,o,n,s)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var s=this.data,r=s.cut;r.x=i,r.y=n,r.w=t,r.h=e,r.r=i+t,r.b=n+e,s.sourceSize.w=t,s.sourceSize.h=e,s.spriteSourceSize.w=t,s.spriteSourceSize.h=e,s.radius=.5*Math.sqrt(t*t+e*e);var o=s.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,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,a.r=i+s,a.b=n+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()},setCropUVs:function(t,e,i,n,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=s(e,0,d)),g=l+(i=s(i,0,f)),v=n=s(n,0,d-e),y=r=s(r,0,f-i),m=this.data;if(m.trim){var x=m.spriteSourceSize,w=e+(n=s(n,0,u-e)),b=i+(r=s(r,0,c-i));if(!(x.rw||x.y>b)){var T=Math.max(x.x,e),S=Math.max(x.y,i),_=Math.min(x.r,w)-T,A=Math.min(x.b,b)-S;v=_,y=A,p=o?h+(u-(T-x.x)-_):h+(T-x.x),g=a?l+(c-(S-x.y)-A):l+(S-x.y),e=T,i=S,n=_,r=A}else p=0,g=0,v=0,y=0}else o&&(p=h+(u-e-n)),a&&(g=l+(c-i-r));var C=this.source.width,M=this.source.height;return t.u0=Math.max(0,p/C),t.v0=Math.max(0,g/M),t.u1=Math.min(1,(p+v)/C),t.v1=Math.min(1,(g+y)/M),t.x=e,t.y=i,t.cx=p,t.cy=g,t.cw=v,t.ch=y,t.width=n,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(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=r(!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}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(0),s=i(11),r=i(20),o=i(1),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={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},this.currentConfig=this.config,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 "+t.name+" already exists in Sound"),!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.warn("Audio Marker: "+t.name+" missing in 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!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in 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,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit("destroy",this),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)}});t.exports=a},function(t,e,i){var n=i(0),s=i(63),r=i(11),o=i(1),a=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.on("prestep",this.update,this),t.events.once("destroy",this.destroy,this)},add:o,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var r=s(e),o=i.spritemap[n];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:r})}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:o,onBlur:o,onFocus:o,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)})},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit("rate",this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit("detune",this,t)}}});t.exports=a},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){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n,s=i(92),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=function(t,e,i){return(e-t)*i+t}},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;i-y&&T>-m&&b-y&&_>-m&&Ss&&(t=s),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,s=Math.max(n,n+e.height-i);return ts&&(t=s),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=l(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,s){return this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,s?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),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){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.config=t.sys.game.config,this.sceneManager=t.sys.game.scene;var e=this.config.resolution;return this.resolution=e,this._cx=this._x*e,this._cy=this._y*e,this._cw=this._width*e,this._ch=this._height*e,this.updateSystem(),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),0===t&&(t=.001),this.zoom=t,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},update:function(){},updateSystem:function(){if(this.config){var t=0!==this._x||0!==this._y||this.config.width!==this._width||this.config.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit("cameradestroy",this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this._bounds=null,this.scene=null,this.config=null,this.sceneManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this._cx=t*this.resolution,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._cy=t*this.resolution,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this._cw=t*this.resolution,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this._ch=t*this.resolution,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoom}},displayHeight:{get:function(){return this.height/this.zoom}}});t.exports=c},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;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=new(i(0))({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once("destroy",this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;n0&&s.area(_)1?(f=o.create(r.extend({parts:p.slice(0)},n)),o.setPosition(f,{x:t,y:e}),f):p[0]}},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(0),s=i(13),r=i(5),o=i(83),a=new n({initialize:function(t,e,i){this.parent=t,this.parentIsTimeline=t.hasOwnProperty("isTimeline"),this.data=e,this.totalData=e.length,this.targets=i,this.totalTargets=i.length,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.offset=0,this.calculatedOffset=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onRepeat:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},getValue:function(){return this.data[0].current},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},isPaused:function(){return this.state===o.PAUSED},hasTarget:function(t){return-1!==this.targets.indexOf(t)},updateTo:function(t,e,i){for(var n=0;n0&&(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)),this.parent.makeActive(this))}},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.play(),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){this.state===o.ACTIVE&&void 0!==t&&this.seek(t),this.state!==o.REMOVED&&(this.state!==o.PAUSED&&this.state!==o.PENDING_ADD||(this.parent._destroy.push(this),this.parent._toProcess++),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={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1}},function(t,e){function i(t){return!!t.getStart&&"function"==typeof t.getStart}function n(t){return!!t.getEnd&&"function"==typeof t.getEnd}var s=function(t,e){var r,o,a=function(t,e,i){return i},h=function(t,e,i){return i},l=typeof e;if("number"===l)a=function(){return e};else if("string"===l){var u=e[0],c=parseFloat(e.substr(2));switch(u){case"+":a=function(t,e,i){return i+c};break;case"-":a=function(t,e,i){return i-c};break;case"*":a=function(t,e,i){return i*c};break;case"/":a=function(t,e,i){return i/c};break;default:a=function(){return parseFloat(e)}}}else"function"===l?a=e:"object"===l&&(i(o=e)||n(o))?(n(e)&&(a=e.getEnd),i(e)&&(h=e.getStart)):e.hasOwnProperty("value")&&(r=s(t,e.value));return r||(r={getEnd:a,getStart:h}),r};t.exports=s},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"targets",null);return null===e?e:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(29),s=i(77),r=i(217),o=i(209);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",n.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new s({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},function(t,e,i){var n=i(29),s=i(78),r=i(77),o=i(55);t.exports=function(t,e,i,a,h){for(var l=new s({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:n.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;p0&&(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],w=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+y)*w,this.y=(e*o+i*u+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(18),r=i(21),o=i(7),a=i(2),h=i(8),l=i(343),u=new n({Extends:r,initialize:function(t,e,i,n){var s="xml";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),s=a(o,"extension",s)}var l={type:"xml",cache:t.cacheManager.xml,extension:s,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,l)},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=l(this.xhrLoader.responseText),this.data?this.onProcessComplete():(console.warn("Invalid XMLFile: "+this.key),this.onProcessError())}});o.register("xml",function(t,e,i){if(Array.isArray(t))for(var n=0;n=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){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(0),s=i(108),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()},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,t=this.frame,this.uv[0]=t.u0,this.uv[1]=t.v0,this.uv[2]=t.u0,this.uv[3]=t.v1,this.uv[4]=t.u1,this.uv[5]=t.v1,this.uv[6]=t.u0,this.uv[7]=t.v0,this.uv[8]=t.u1,this.uv[9]=t.v1,this.uv[10]=t.u1,this.uv[11]=t.v0,this},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){for(var n=!1,s=-1,r=t.points.length-1;++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],h0&&(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(h[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(h[p],o,a));return e.restore(),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),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&&c(this.canvas),s.remove(this.canvas),this.texture.destroy()}});t.exports=p},function(t,e,i){var n=i(121),s=i(24),r=i(0),o=i(14),a=i(26),h=i(113),l=i(19),u=i(817),c=i(295),d=new r({Extends:l,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Crop,o.Depth,o.Flip,o.GetBounds,o.Mask,o.Origin,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Tint,o.Transform,o.Visible,u],initialize:function(t,e,i,r,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=32),void 0===o&&(o=32),l.call(this,t,"RenderTexture"),this.renderer=t.sys.game.renderer,this.textureManager=t.sys.textures,this.globalTint=16777215,this.globalAlpha=1,this.canvas=s.create2D(this,r,o),this.context=this.canvas.getContext("2d"),this.framebuffer=null,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(c(),this.canvas),this.frame=this.texture.get(),this._saved=!1,this.camera=new n(0,0,r,o),this.dirty=!1,this.gl=null;var h=this.renderer;if(h.type===a.WEBGL){var u=h.gl;this.gl=u,this.drawGameObject=this.batchGameObjectWebGL,this.framebuffer=h.createFramebuffer(r,o,this.frame.source.glTexture,!1)}else h.type===a.CANVAS&&(this.drawGameObject=this.batchGameObjectCanvas);this.camera.setScene(t),this.setPosition(e,i),this.setSize(r,o),this.setOrigin(0,0),this.initPipeline()},setSize:function(t,e){return this.resize(t,e)},resize:function(t,e){if(void 0===e&&(e=t),t!==this.width||e!==this.height){if(this.canvas.width=t,this.canvas.height=e,this.gl){var i=this.gl;this.renderer.deleteTexture(this.frame.source.glTexture),this.renderer.deleteFramebuffer(this.framebuffer),this.frame.source.glTexture=this.renderer.createTexture2D(0,i.NEAREST,i.NEAREST,i.CLAMP_TO_EDGE,i.CLAMP_TO_EDGE,i.RGBA,null,t,e,!1),this.framebuffer=this.renderer.createFramebuffer(t,e,this.frame.source.glTexture,!1),this.frame.glTexture=this.frame.source.glTexture}this.frame.source.width=t,this.frame.source.height=e,this.camera.setSize(t,e),this.frame.setSize(t,e),this.width=t,this.height=e}return this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e){void 0===e&&(e=1);var i=255&(t>>16|0),n=255&(t>>8|0),s=255&(0|t);if(this.gl){this.renderer.setFramebuffer(this.framebuffer);var r=this.gl;r.clearColor(i/255,n/255,s/255,e),r.clear(r.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null)}else this.context.fillStyle="rgb("+i+","+n+","+s+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height);return this},clear:function(){if(this.dirty){if(this.gl){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null)}else{var e=this.context;e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this.canvas.width,this.canvas.height),e.restore()}this.dirty=!1}return this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.gl;if(this.camera.preRender(1,1,1),r){this.renderer.setFramebuffer(this.framebuffer);var o=this.pipeline;o.projOrtho(0,this.width,0,this.height,-1e3,1e3),this.batchList(t,e,i,n,s),o.flush(),this.renderer.setFramebuffer(null),o.projOrtho(0,o.width,o.height,0,-1e3,1e3)}else this.renderer.setContext(this.context),this.batchList(t,e,i,n,s),this.renderer.setContext();return this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.gl,a=this.textureManager.getFrame(t,e);if(a){if(this.camera.preRender(1,1,1),o){this.renderer.setFramebuffer(this.framebuffer);var h=this.pipeline;h.projOrtho(0,this.width,0,this.height,-1e3,1e3),h.batchTextureFrame(a,i,n,r,s,this.camera.matrix,null),h.flush(),this.renderer.setFramebuffer(null),h.projOrtho(0,h.width,h.height,0,-1e3,1e3)}else this.batchTextureFrame(a,i,n,s,r);this.dirty=!0}return this},batchList:function(t,e,i,n,s){for(var r=0;r0?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;s-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,o=r.game.renderer;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),w.TargetCamera.setScene(this.scene),w.TargetCamera.setViewport(0,0,e,i),w.TargetCamera.scrollX=this.x,w.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var a=(n=r.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(s=a.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(o,this,0,w.TargetCamera,null,s,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});w.TargetCamera=new n,t.exports=w},function(t,e,i){var n=i(109),s=i(0),r=i(834),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a){n.call(this,t,e,i,s,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(164),s=i(66),r=i(0),o=i(14),a=i(19),h=i(9),l=i(837),u=i(309),c=i(3),d=new r({Extends:a,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.ScrollFactor,o.Transform,o.Visible,l],initialize:function(t,e,i,n){a.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._displayList=t.sys.displayList,this._sortKey="",this._sysEvents=t.sys.events,this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new h),t.setTo(this.x,this.y,0,0),this.list.length>0)for(var e=this.list,i=new h,n=0;n-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){var i,n=[null],s=this.list.slice(),r=s.length;for(i=2;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}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[],this._displayList=null}});t.exports=d},function(t,e,i){var n=i(841),s=i(838),r=i(0),o=i(14),a=i(113),h=i(19),l=i(112),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,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(),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},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]}},function(t,e){t.exports=function(t){if(!Array.isArray(t)||t.length<2||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){t&&(this.settings.data=t),this.settings.status=s.START,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this),this.events.emit("ready",this,t)},resize:function(t,e){this.events.emit("resize",t,e)},shutdown:function(t){this.events.off("transitioninit"),this.events.off("transitionstart"),this.events.off("transitioncomplete"),this.events.off("transitionout"),this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this,t)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this),this.events.removeAllListeners();for(var t=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],e=0;e=(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=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},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=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x2-t.x1,s=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=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,i){var n=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random()*Math.PI*2,s=Math.sqrt(Math.random());return e.x=t.x+s*Math.cos(i)*t.width/2,e.y=t.y+s*Math.sin(i)*t.height/2,e}},function(t,e){var i={defaultPipeline:null,pipeline:null,initPipeline:function(t){void 0===t&&(t="TextureTintPipeline");var e=this.scene.sys.game.renderer;return!!(e&&e.gl&&e.hasPipeline(t))&&(this.defaultPipeline=e.getPipeline(t),this.pipeline=this.defaultPipeline,!0)},setPipeline:function(t){var e=this.scene.sys.game.renderer;return e&&e.gl&&e.hasPipeline(t)&&(this.pipeline=e.getPipeline(t)),this},resetPipeline:function(){return this.pipeline=this.defaultPipeline,null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=i},function(t,e,i){var n=i(6);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(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},function(t,e,i){var n=i(65),s=i(6);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)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(6);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(6);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){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={};t.exports=n;var s=i(76),r=i(81),o=i(222),a=i(80),h=i(505),l=i(33);n._warming=.4,n._torqueDampen=1,n._minLength=1e-6,n.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?r.add(e.bodyA.position,e.pointA):e.pointA,n=e.bodyB?r.add(e.bodyB.position,e.pointB):e.pointB,s=r.magnitude(r.sub(i,n));e.length=void 0!==e.length?e.length:s,e.id=e.id||l.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?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,i){var n={};t.exports=n;var s=i(33);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r0){i||(i={}),n=e.split(" ");for(var l=0;l0?(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.vertexCount,r=this.topology,o=this.vertexSize,a=this.renderer,h=this.batches,l=0,u=null;if(0===h.length||0===s)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,s*o));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(a.setTexture2D(u.texture,0),n.drawArrays(r,u.first,l)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},batchSprite:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix1,s=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,l=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,g=o.cutWidth,v=o.cutHeight,y=-t.displayOriginX+f,m=-t.displayOriginY+p;if(t.isCropped){var x=t._crop;x.flipX===t.flipX&&x.flipY===t.flipY||o.updateCropUVs(x,t.flipX,t.flipY),h=x.u0,l=x.v0,c=x.u1,d=x.v1,g=x.width,v=x.height,f=x.x,p=x.y,y=-t.displayOriginX+f,m=-t.displayOriginY+p}t.flipX&&(y+=g,g*=-1),t.flipY&&(m+=v,v*=-1);var w=y+g,b=m+v;s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y,n.multiply(s,r)):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY,n.multiply(s,r));var T=r.getX(y,m),S=r.getY(y,m),_=r.getX(y,b),A=r.getY(y,b),C=r.getX(w,b),M=r.getY(w,b),P=r.getX(w,m),E=r.getY(w,m),k=u.getTintAppendFloatAlpha(t._tintTL,e.alpha*t._alphaTL),L=u.getTintAppendFloatAlpha(t._tintTR,e.alpha*t._alphaTR),F=u.getTintAppendFloatAlpha(t._tintBL,e.alpha*t._alphaBL),R=u.getTintAppendFloatAlpha(t._tintBR,e.alpha*t._alphaBR);e.roundPixels&&(T|=0,S|=0,_|=0,A|=0,C|=0,M|=0,P|=0,E|=0),this.setTexture2D(a,0);var O=t._isTinted&&t.tintFill;this.batchQuad(T,S,_,A,C,M,P,E,h,l,c,d,k,L,F,R,O)},batchQuad:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v){var y=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),y=!0);var m=this.vertexViewF32,x=this.vertexViewU32,w=this.vertexCount*this.vertexComponentCount-1;return m[++w]=t,m[++w]=e,m[++w]=h,m[++w]=l,m[++w]=v,x[++w]=d,m[++w]=i,m[++w]=n,m[++w]=h,m[++w]=c,m[++w]=v,x[++w]=p,m[++w]=s,m[++w]=r,m[++w]=u,m[++w]=c,m[++w]=v,x[++w]=g,m[++w]=t,m[++w]=e,m[++w]=h,m[++w]=l,m[++w]=v,x[++w]=d,m[++w]=s,m[++w]=r,m[++w]=u,m[++w]=c,m[++w]=v,x[++w]=g,m[++w]=o,m[++w]=a,m[++w]=u,m[++w]=l,m[++w]=v,x[++w]=f,this.vertexCount+=6,y},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f){var p=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),p=!0);var g=this.vertexViewF32,v=this.vertexViewU32,y=this.vertexCount*this.vertexComponentCount-1;return g[++y]=t,g[++y]=e,g[++y]=o,g[++y]=a,g[++y]=f,v[++y]=u,g[++y]=i,g[++y]=n,g[++y]=o,g[++y]=l,g[++y]=f,v[++y]=c,g[++y]=s,g[++y]=r,g[++y]=h,g[++y]=l,g[++y]=f,v[++y]=d,this.vertexCount+=3,p},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m,x,w,b,T,S,_,A,C,M,P,E,k){this.renderer.setPipeline(this,t);var L=this._tempMatrix1,F=this._tempMatrix2,R=this._tempMatrix3,O=y/i+C,D=m/n+M,B=(y+x)/i+C,I=(m+w)/n+M,Y=o,X=a,z=-g,N=-v;if(t.isCropped){var U=t._crop;Y=U.width,X=U.height,o=U.width,a=U.height;var V=y=U.x,G=m=U.y;c&&(V=x-U.x-U.width),d&&!e.isRenderTexture&&(G=w-U.y-U.height),O=V/i+C,D=G/n+M,B=(V+U.width)/i+C,I=(G+U.height)/n+M,z=-g+y,N=-v+m}d^=!k&&e.isRenderTexture?1:0,c&&(Y*=-1,z+=o),d&&(X*=-1,N+=a);var W=z+Y,H=N+X;F.applyITRS(s,r,u,h,l),L.copyFrom(P.matrix),E?(L.multiplyWithOffset(E,-P.scrollX*f,-P.scrollY*p),F.e=s,F.f=r,L.multiply(F,R)):(F.e-=P.scrollX*f,F.f-=P.scrollY*p,L.multiply(F,R));var j=R.getX(z,N),q=R.getY(z,N),K=R.getX(z,H),J=R.getY(z,H),Z=R.getX(W,H),Q=R.getY(W,H),$=R.getX(W,N),tt=R.getY(W,N);P.roundPixels&&(j|=0,q|=0,K|=0,J|=0,Z|=0,Q|=0,$|=0,tt|=0),this.setTexture2D(e,0),this.batchQuad(j,q,K,J,Z,Q,$,tt,O,D,B,I,b,T,S,_,A)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.setPipeline(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),f=h.getY(e,i),p=h.getX(e,c),g=h.getY(e,c),v=h.getX(l,c),y=h.getY(l,c),m=h.getX(l,i),x=h.getY(l,i);this.setTexture2D(t.glTexture,0),n=u.getTintAppendFloatAlpha(n,s),this.batchQuad(d,f,p,g,v,y,m,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0)},drawFillRect:function(t,e,i,n,s,r){var o=t+i,a=e+n,h=u.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,h,h,h,h,2)},batchFillRect:function(t,e,i,n,s,r){this.renderer.setPipeline(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),y=this.currentFrame,m=y.u0,x=y.v0,w=y.u1,b=y.v1;this.batchQuad(l,u,c,d,f,p,g,v,m,x,w,b,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.fillTint.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,y=g.v0,m=g.u1,x=g.v1;this.batchTri(l,u,c,d,f,p,v,y,m,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=s,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=this.tintEffect,f=0;f0&&H[4]?this.batchQuad(R,O,E,k,H[0],H[1],H[2],H[3],U,V,G,W,I,Y,X,z,B):(j[0]=R,j[1]=O,j[2]=E,j[3]=k,j[4]=1),h&&j[4]?this.batchQuad(M,P,L,F,j[0],j[1],j[2],j[3],U,V,G,W,I,Y,X,z,B):(H[0]=M,H[1]=P,H[2]=L,H[3]=F,H[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),s=i(10),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,this.active=!1},boot:function(){},addAttribute:function(t,e,i,n,s){return this.attributes.push({name:t,size:e,type:this.renderer.glFormats[i],normalized:n,offset:s}),this},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},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},setFloat1v:function(t,e){return this.renderer.setFloat1v(this.program,t,e),this},setFloat2v:function(t,e){return this.renderer.setFloat2v(this.program,t,e),this},setFloat3v:function(t,e){return this.renderer.setFloat3v(this.program,t,e),this},setFloat4v:function(t,e){return this.renderer.setFloat4v(this.program,t,e),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){return n(t,-180,180)}},function(t,e,i){var n=i(53);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},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,i){var n=i(0),s=i(11),r=i(97),o=i(83),a=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.isTimeline=!0,this.data=[],this.totalData=0,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},add:function(t){return this.queue(r(this,t))},queue:function(t){return this.isPlaying()||(t.parent=this,t.parentIsTimeline=!0,this.data.push(t),this.totalData=this.data.length),this},hasOffset:function(t){return null!==t.offset},isOffsetAbsolute:function(t){return"number"==typeof t},isOffsetRelative:function(t){if("string"===typeof t){var e=t[0];if("-"===e||"+"===e)return!0}return!1},getRelativeOffset:function(t,e){var i=t[0],n=parseFloat(t.substr(2)),s=e;switch(i){case"+":s+=n;break;case"-":s-=n}return Math.max(0,s)},calcDuration:function(){for(var t=0,e=0,i=0,n=0;n0?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;s0?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){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(0),s=i(14),r=i(26),o=i(19),a=i(446),h=i(103),l=i(38),u=i(10),c=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,a){o.call(this,t,"StaticTilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.culledTiles=[],this.skipCull=!1,this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=h.CullTiles,this.renderer=t.sys.game.renderer,this.vertexBuffer=[],this.bufferData=[],this.vertexViewF32=[],this.vertexViewU32=[],this.dirty=[],this.vertexCount=[],this._renderOrder=0,this._tempMatrix=new l,this.gidMap=[],this.setTilesets(n),this.setAlpha(this.layer.alpha),this.setPosition(s,a),this.setOrigin(),this.setSize(this.layer.tileWidth*this.layer.width,this.layer.tileHeight*this.layer.height),this.updateVBOData(),this.initPipeline("TextureTintPipeline"),t.sys.game.config.renderType===r.WEBGL&&t.sys.game.renderer.onContextRestored(function(){this.updateVBOData()},this)},setTilesets:function(t){var e=[],i=[],n=this.tilemap;Array.isArray(t)||(t=[t]);for(var s=0;sv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(1===p)for(o=0;o=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(2===p)for(o=u-1;o>=0;o--)for(a=0;av||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(3===p)for(o=u-1;o>=0;o--)for(a=l-1;a>=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));this.dirty[e]=!1,null===y?(y=i.createVertexBuffer(m,n.STATIC_DRAW),this.vertexBuffer[e]=y):(i.setVertexBuffer(y),n.bufferSubData(n.ARRAY_BUFFER,0,m))}return this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=a.x/n,l=a.y/s,c=(a.x+e.width)/n,d=(a.y+e.height)/s,f=this._tempMatrix,p=e.width,g=e.height,v=p/2,y=g/2,m=-v,x=-y;e.flipX&&(p*=-1,m+=e.width),e.flipY&&(g*=-1,x+=e.height);var w=m+p,b=x+g;f.applyITRS(v+e.pixelX,y+e.pixelY,e.rotation,1,1);var T=u.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),S=f.getX(m,x),_=f.getY(m,x),A=f.getX(m,b),C=f.getY(m,b),M=f.getX(w,b),P=f.getY(w,b),E=f.getX(w,x),k=f.getY(w,x);r.roundPixels&&(S|=0,_|=0,A|=0,C|=0,M|=0,P|=0,E|=0,k|=0);var L=this.vertexViewF32[o],F=this.vertexViewU32[o];return L[++t]=S,L[++t]=_,L[++t]=h,L[++t]=l,L[++t]=0,F[++t]=T,L[++t]=A,L[++t]=C,L[++t]=h,L[++t]=d,L[++t]=0,F[++t]=T,L[++t]=M,L[++t]=P,L[++t]=c,L[++t]=d,L[++t]=0,F[++t]=T,L[++t]=S,L[++t]=_,L[++t]=h,L[++t]=l,L[++t]=0,F[++t]=T,L[++t]=M,L[++t]=P,L[++t]=c,L[++t]=d,L[++t]=0,F[++t]=T,L[++t]=E,L[++t]=k,L[++t]=c,L[++t]=l,L[++t]=0,F[++t]=T,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),t>=0&&t<4){this._renderOrder=t;for(var e=0;e=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return a.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,s){return a.CreateFromTiles(t,e,i,n,s,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,s,r,o){return a.Copy(t,e,i,n,s,r,o,this.layer),this},destroy:function(){this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this)},fill:function(t,e,i,n,s,r){return a.Fill(t,e,i,n,s,r,this.layer),this},filterTiles:function(t,e,i,n,s,r,o){return a.FilterTiles(t,e,i,n,s,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,s,r,o){return a.FindTile(t,e,i,n,s,r,o,this.layer)},forEachTile:function(t,e,i,n,s,r,o){return a.ForEachTile(t,e,i,n,s,r,o,this.layer),this},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return a.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,s){return a.GetTilesWithin(t,e,i,n,s,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,s,r){return a.GetTilesWithinWorldXY(t,e,i,n,s,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return a.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,s){return a.PutTileAtWorldXY(t,e,i,n,s,this.layer)},putTilesAt:function(t,e,i,n){return a.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,s){return a.Randomize(t,e,i,n,s,this.layer),this},removeTileAt:function(t,e,i,n){return a.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,s){return a.RemoveTileAtWorldXY(t,e,i,n,s,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,s,r){return a.ReplaceByIndex(t,e,i,n,s,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i){return a.SetCollision(t,e,i,this.layer),this},setCollisionBetween:function(t,e,i,n){return a.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,s,r){return a.SetTileLocationCallback(t,e,i,n,s,r,this.layer),this},shuffle:function(t,e,i,n){return a.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,s,r){return a.SwapByIndex(t,e,i,n,s,r,this.layer),this},tileToWorldX:function(t,e){return a.TileToWorldX(t,e,this.layer)},tileToWorldY:function(t,e){return a.TileToWorldY(t,e,this.layer)},tileToWorldXY:function(t,e,i,n){return a.TileToWorldXY(t,e,i,n,this.layer)},weightedRandomize:function(t,e,i,n,s){return a.WeightedRandomize(t,e,i,n,s,this.layer),this},worldToTileX:function(t,e,i){return a.WorldToTileX(t,e,i,this.layer)},worldToTileY:function(t,e,i){return a.WorldToTileY(t,e,i,this.layer)},worldToTileXY:function(t,e,i,n,s){return a.WorldToTileXY(t,e,i,n,s,this.layer)}});t.exports=h},function(t,e,i){var n=i(0),s=i(31),r=i(208),o=i(20),a=i(29),h=i(78),l=i(242),u=i(207),c=i(55),d=i(103),f=i(99),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.renderOrder=e.renderOrder,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},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},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 Tileset Image: "+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 for Tileset: "+t),null;var u=this.tilesets[l];return u?(u.setTileSize(i,n),u.setSpacing(s,r),u.setImage(h),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),(u=new f(t,o,i,n,s,r)).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("Invalid Tilemap Layer ID: "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;fa&&(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(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","object layer"),this.opacity=s(t,"opacity",1),this.properties=s(t,"properties",{}),this.propertyTypes=s(t,"propertytypes",{}),this.type=s(t,"type","objectgroup"),this.visible=s(t,"visible",!0),this.objects=s(t,"objects",[])}});t.exports=r},function(t,e,i){var n=i(455),s=i(214),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=n(t,o);if(a.x+=e,a.y+=i,t.gid){var h=s(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?(a.ellipse=t.ellipse,a.width=t.width,a.height=t.height):t.text?(a.width=t.width,a.height=t.height,a.text=t.text):(a.rectangle=!0,a.width=t.width,a.height=t.height);return a}},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&&t-1}return!1}},function(t,e,i){var n=i(17);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l0&&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){t.exports={NONE:0,A:1,B:2,BOTH:3}},function(t,e){t.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8}},function(t,e,i){var n=i(40),s=i(0),r=i(35),o=i(39),a=i(3),h=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;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=i,this.height=n,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,this._dx=0,this._dy=0},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},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y);var s=this.gameObject;return!t&&s.frame&&(t=s.frame.realWidth),!e&&s.frame&&(e=s.frame.realHeight),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)},postUpdate:function(){},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=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(313);function s(t){if(!(this instanceof s))return new s(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=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)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=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;te._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.up=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},function(t,e,i){var n=i(35);t.exports=function(t,e,i,s){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.left=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},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,i){var n=i(40),s=i(0),r=i(35),o=i(172),a=i(9),h=i(39),l=i(3),u=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;this.world=t,this.gameObject=e,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new l,this.position=new l(e.x,e.y),this.prev=new l(e.x,e.y),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=n,this.sourceWidth=i,this.sourceHeight=n,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(n/2),this.center=new l(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new l,this.newVelocity=new l,this.deltaMax=new l,this.acceleration=new l,this.allowDrag=!0,this.drag=new l,this.allowGravity=!0,this.gravity=new l,this.bounce=new l,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new l(1e4,1e4),this.friction=new l(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.moves=!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.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.physicsType=r.DYNAMIC_BODY,this._reset=!0,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._bounds=new a},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=o(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var n=!1;if(this.syncBounds){var s=t.getBounds(this._bounds);this.width=s.width,this.height=s.height,n=!0}else{var r=Math.abs(e.scaleX),a=Math.abs(e.scaleY);this._sx===r&&this._sy===a||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*a,this._sx=r,this._sy=a,n=!0)}n&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},update:function(t){this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds();var e=this.transform;if(this.position.x=e.x+e.scaleX*(this.offset.x-e.displayOriginX),this.position.y=e.y+e.scaleY*(this.offset.y-e.displayOriginY),this.updateCenter(),this.rotation=e.rotation,this.preRotation=this.rotation,this._reset&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves){this.world.updateMotion(this,t);var i=this.velocity.x,n=this.velocity.y;this.newVelocity.set(i*t,n*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(n,i),this.speed=Math.sqrt(i*i+n*n),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit("worldbounds",this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y},postUpdate:function(){this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y,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._dx<0?this.facing=r.FACING_LEFT:this._dx>0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),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(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),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):h(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._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},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.width/2):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 void 0===t&&(t=!0),this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),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},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=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 void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=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=i(232),s=i(23),r=i(0),o=i(231),a=i(35),h=i(52),l=i(11),u=i(248),c=i(247),d=i(246),f=i(230),p=i(229),g=i(4),v=i(228),y=i(514),m=i(9),x=i(227),w=i(513),b=i(508),T=i(507),S=i(95),_=i(225),A=i(226),C=i(38),M=i(3),P=i(53),E=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.bodies=new S,this.staticBodies=new S,this.pendingDestroy=new S,this.colliders=new v,this.gravity=new M(g(e,"gravity.x",0),g(e,"gravity.y",0)),this.bounds=new m(g(e,"x",0),g(e,"y",0),g(e,"width",t.sys.game.config.width),g(e,"height",t.sys.game.config.height)),this.checkCollision={up:g(e,"checkCollision.up",!0),down:g(e,"checkCollision.down",!0),left:g(e,"checkCollision.left",!0),right:g(e,"checkCollision.right",!0)},this.fps=g(e,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=g(e,"timeScale",1),this.OVERLAP_BIAS=g(e,"overlapBias",4),this.TILE_BIAS=g(e,"tileBias",16),this.forceX=g(e,"forceX",!1),this.isPaused=g(e,"isPaused",!1),this._total=0,this.drawDebug=g(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:g(e,"debugShowBody",!0),debugShowStaticBody:g(e,"debugShowStaticBody",!0),debugShowVelocity:g(e,"debugShowVelocity",!0),bodyDebugColor:g(e,"debugBodyColor",16711935),staticBodyDebugColor:g(e,"debugStaticBodyColor",255),velocityDebugColor:g(e,"debugVelocityColor",65280)},this.maxEntries=g(e,"maxEntries",16),this.useTree=g(e,"useTree",!0),this.tree=new x(this.maxEntries),this.staticTree=new x(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new C,this._tempMatrix2=new C,this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=a.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=s;)this._elapsed-=s,i++,this.step(n);this.stepsLastFrame=i}},step:function(t){var e,i,n=this.bodies.entries,s=n.length;for(e=0;e0){var l=this.tree,u=this.staticTree;for(o=(r=s.entries).length,t=0;ta.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(u.x,u.y,l.right,l.y)-u.radius):u.y>l.bottom&&(u.xl.right&&(a=h(u.x,u.y,l.right,l.bottom)-u.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 c=t.velocity.x,d=t.velocity.y,g=t.mass,v=e.velocity.x,y=e.velocity.y,m=e.mass,x=c*Math.cos(o)+d*Math.sin(o),w=c*Math.sin(o)-d*Math.cos(o),b=v*Math.cos(o)+y*Math.sin(o),T=v*Math.sin(o)-y*Math.cos(o),S=((g-m)*x+2*m*b)/(g+m),_=(2*g*x+(m-g)*b)/(g+m);t.immovable||(t.velocity.x=(S*Math.cos(o)-w*Math.sin(o))*t.bounce.x,t.velocity.y=(w*Math.cos(o)+S*Math.sin(o))*t.bounce.y,c=t.velocity.x,d=t.velocity.y),e.immovable||(e.velocity.x=(_*Math.cos(o)-T*Math.sin(o))*e.bounce.x,e.velocity.y=(T*Math.cos(o)+_*Math.sin(o))*e.bounce.y,v=e.velocity.x,y=e.velocity.y),Math.abs(o)0&&!t.immovable&&v>c?t.velocity.x*=-1:v<0&&!e.immovable&&c0&&!t.immovable&&y>d?t.velocity.y*=-1:y<0&&!e.immovable&&dMath.PI/2&&(c<0&&!t.immovable&&v0&&!e.immovable&&c>v?e.velocity.x*=-1:d<0&&!t.immovable&&y0&&!e.immovable&&c>y&&(e.velocity.y*=-1));var A=this._frameTime;return t.immovable||(t.x+=t.velocity.x*A-a*Math.cos(o),t.y+=t.velocity.y*A-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*A+a*Math.cos(o),e.y+=e.velocity.y*A+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),t.postUpdate(),e.postUpdate(),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?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):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.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);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,h,l,u=t.body;if(0!==e.length&&u&&u.enable)if(this.useTree){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===a.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(h=d.length,o=0;oc.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,p=e.getTilesWithinWorldXY(a,h,l,u);if(0===p.length)return!1;for(var g={left:0,right:0,top:0,bottom:0},v=0;v0&&(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(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(16),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],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],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],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},zero:function(){var t=this.val;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=0,this},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){var t=this.val;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},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],s=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=s,t[11]=t[14],t[12]=n,t[13]=r,t[14]=o,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=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15],y=e*o-i*r,m=e*a-n*r,x=e*h-s*r,w=i*a-n*o,b=i*h-s*o,T=n*h-s*a,S=l*p-u*f,_=l*g-c*f,A=l*v-d*f,C=u*g-c*p,M=u*v-d*p,P=c*v-d*g,E=y*P-m*M+x*C+w*A-b*_+T*S;return E?(E=1/E,t[0]=(o*P-a*M+h*C)*E,t[1]=(n*M-i*P-s*C)*E,t[2]=(p*T-g*b+v*w)*E,t[3]=(c*b-u*T-d*w)*E,t[4]=(a*A-r*P-h*_)*E,t[5]=(e*P-n*A+s*_)*E,t[6]=(g*x-f*T-v*m)*E,t[7]=(l*T-c*x+d*m)*E,t[8]=(r*M-o*A+h*S)*E,t[9]=(i*A-e*M-s*S)*E,t[10]=(f*b-p*x+v*y)*E,t[11]=(u*x-l*b-d*y)*E,t[12]=(o*_-r*C-a*S)*E,t[13]=(e*C-i*_+n*S)*E,t[14]=(p*m-f*w-g*y)*E,t[15]=(l*w-u*m+c*y)*E,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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return t[0]=o*(c*v-d*g)-u*(a*v-h*g)+p*(a*d-h*c),t[1]=-(i*(c*v-d*g)-u*(n*v-s*g)+p*(n*d-s*c)),t[2]=i*(a*v-h*g)-o*(n*v-s*g)+p*(n*h-s*a),t[3]=-(i*(a*d-h*c)-o*(n*d-s*c)+u*(n*h-s*a)),t[4]=-(r*(c*v-d*g)-l*(a*v-h*g)+f*(a*d-h*c)),t[5]=e*(c*v-d*g)-l*(n*v-s*g)+f*(n*d-s*c),t[6]=-(e*(a*v-h*g)-r*(n*v-s*g)+f*(n*h-s*a)),t[7]=e*(a*d-h*c)-r*(n*d-s*c)+l*(n*h-s*a),t[8]=r*(u*v-d*p)-l*(o*v-h*p)+f*(o*d-h*u),t[9]=-(e*(u*v-d*p)-l*(i*v-s*p)+f*(i*d-s*u)),t[10]=e*(o*v-h*p)-r*(i*v-s*p)+f*(i*h-s*o),t[11]=-(e*(o*d-h*u)-r*(i*d-s*u)+l*(i*h-s*o)),t[12]=-(r*(u*g-c*p)-l*(o*g-a*p)+f*(o*c-a*u)),t[13]=e*(u*g-c*p)-l*(i*g-n*p)+f*(i*c-n*u),t[14]=-(e*(o*g-a*p)-r*(i*g-n*p)+f*(i*a-n*o)),t[15]=e*(o*c-a*u)-r*(i*c-n*u)+l*(i*a-n*o),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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return(e*o-i*r)*(c*v-d*g)-(e*a-n*r)*(u*v-d*p)+(e*h-s*r)*(u*g-c*p)+(i*a-n*o)*(l*v-d*f)-(i*h-s*o)*(l*g-c*f)+(n*h-s*a)*(l*p-u*f)},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=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],y=e[15],m=t.val,x=m[0],w=m[1],b=m[2],T=m[3];return e[0]=x*i+w*o+b*u+T*p,e[1]=x*n+w*a+b*c+T*g,e[2]=x*s+w*h+b*d+T*v,e[3]=x*r+w*l+b*f+T*y,x=m[4],w=m[5],b=m[6],T=m[7],e[4]=x*i+w*o+b*u+T*p,e[5]=x*n+w*a+b*c+T*g,e[6]=x*s+w*h+b*d+T*v,e[7]=x*r+w*l+b*f+T*y,x=m[8],w=m[9],b=m[10],T=m[11],e[8]=x*i+w*o+b*u+T*p,e[9]=x*n+w*a+b*c+T*g,e[10]=x*s+w*h+b*d+T*v,e[11]=x*r+w*l+b*f+T*y,x=m[12],w=m[13],b=m[14],T=m[15],e[12]=x*i+w*o+b*u+T*p,e[13]=x*n+w*a+b*c+T*g,e[14]=x*s+w*h+b*d+T*v,e[15]=x*r+w*l+b*f+T*y,this},multiplyLocal:function(t){var e=[],i=this.val,n=t.val;return e[0]=i[0]*n[0]+i[1]*n[4]+i[2]*n[8]+i[3]*n[12],e[1]=i[0]*n[1]+i[1]*n[5]+i[2]*n[9]+i[3]*n[13],e[2]=i[0]*n[2]+i[1]*n[6]+i[2]*n[10]+i[3]*n[14],e[3]=i[0]*n[3]+i[1]*n[7]+i[2]*n[11]+i[3]*n[15],e[4]=i[4]*n[0]+i[5]*n[4]+i[6]*n[8]+i[7]*n[12],e[5]=i[4]*n[1]+i[5]*n[5]+i[6]*n[9]+i[7]*n[13],e[6]=i[4]*n[2]+i[5]*n[6]+i[6]*n[10]+i[7]*n[14],e[7]=i[4]*n[3]+i[5]*n[7]+i[6]*n[11]+i[7]*n[15],e[8]=i[8]*n[0]+i[9]*n[4]+i[10]*n[8]+i[11]*n[12],e[9]=i[8]*n[1]+i[9]*n[5]+i[10]*n[9]+i[11]*n[13],e[10]=i[8]*n[2]+i[9]*n[6]+i[10]*n[10]+i[11]*n[14],e[11]=i[8]*n[3]+i[9]*n[7]+i[10]*n[11]+i[11]*n[15],e[12]=i[12]*n[0]+i[13]*n[4]+i[14]*n[8]+i[15]*n[12],e[13]=i[12]*n[1]+i[13]*n[5]+i[14]*n[9]+i[15]*n[13],e[14]=i[12]*n[2]+i[13]*n[6]+i[14]*n[10]+i[15]*n[14],e[15]=i[12]*n[3]+i[13]*n[7]+i[14]*n[11]+i[15]*n[15],this.fromArray(e)},translate:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[12]=s[0]*e+s[4]*i+s[8]*n+s[12],s[13]=s[1]*e+s[5]*i+s[9]*n+s[13],s[14]=s[2]*e+s[6]*i+s[10]*n+s[14],s[15]=s[3]*e+s[7]*i+s[11]*n+s[15],this},scale:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[0]=s[0]*e,s[1]=s[1]*e,s[2]=s[2]*e,s[3]=s[3]*e,s[4]=s[4]*i,s[5]=s[5]*i,s[6]=s[6]*i,s[7]=s[7]*i,s[8]=s[8]*n,s[9]=s[9]*n,s[10]=s[10]*n,s[11]=s[11]*n,this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,o=t.y,a=t.z,h=s*r,l=s*o;return this.fromArray([h*r+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*r,0,h*a-n*o,l*a+n*r,s*a*a+i,0,0,0,0,1]),this},rotate:function(t,e){var i=this.val,n=e.x,s=e.y,r=e.z,o=Math.sqrt(n*n+s*s+r*r);if(Math.abs(o)<1e-6)return null;n*=o=1/o,s*=o,r*=o;var a=Math.sin(t),h=Math.cos(t),l=1-h,u=i[0],c=i[1],d=i[2],f=i[3],p=i[4],g=i[5],v=i[6],y=i[7],m=i[8],x=i[9],w=i[10],b=i[11],T=n*n*l+h,S=s*n*l+r*a,_=r*n*l-s*a,A=n*s*l-r*a,C=s*s*l+h,M=r*s*l+n*a,P=n*r*l+s*a,E=s*r*l-n*a,k=r*r*l+h;return i[0]=u*T+p*S+m*_,i[1]=c*T+g*S+x*_,i[2]=d*T+v*S+w*_,i[3]=f*T+y*S+b*_,i[4]=u*A+p*C+m*M,i[5]=c*A+g*C+x*M,i[6]=d*A+v*C+w*M,i[7]=f*A+y*C+b*M,i[8]=u*P+p*E+m*k,i[9]=c*P+g*E+x*k,i[10]=d*P+v*E+w*k,i[11]=f*P+y*E+b*k,this},rotateX:function(t){var e=this.val,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},rotateY:function(t){var e=this.val,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},rotateZ:function(t){var e=this.val,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},fromRotationTranslation:function(t,e){var i=this.val,n=t.x,s=t.y,r=t.z,o=t.w,a=n+n,h=s+s,l=r+r,u=n*a,c=n*h,d=n*l,f=s*h,p=s*l,g=r*l,v=o*a,y=o*h,m=o*l;return i[0]=1-(f+g),i[1]=c+m,i[2]=d-y,i[3]=0,i[4]=c-m,i[5]=1-(u+g),i[6]=p+v,i[7]=0,i[8]=d+y,i[9]=p-v,i[10]=1-(u+f),i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},fromQuat:function(t){var e=this.val,i=t.x,n=t.y,s=t.z,r=t.w,o=i+i,a=n+n,h=s+s,l=i*o,u=i*a,c=i*h,d=n*a,f=n*h,p=s*h,g=r*o,v=r*a,y=r*h;return e[0]=1-(d+p),e[1]=u+y,e[2]=c-v,e[3]=0,e[4]=u-y,e[5]=1-(l+p),e[6]=f+g,e[7]=0,e[8]=c+v,e[9]=f-g,e[10]=1-(l+d),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},frustum:function(t,e,i,n,s,r){var o=this.val,a=1/(e-t),h=1/(n-i),l=1/(s-r);return o[0]=2*s*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*s*h,o[6]=0,o[7]=0,o[8]=(e+t)*a,o[9]=(n+i)*h,o[10]=(r+s)*l,o[11]=-1,o[12]=0,o[13]=0,o[14]=r*s*2*l,o[15]=0,this},perspective:function(t,e,i,n){var s=this.val,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},perspectiveLH:function(t,e,i,n){var s=this.val;return s[0]=2*i/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/e,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=-n/(i-n),s[11]=1,s[12]=0,s[13]=0,s[14]=i*n/(i-n),s[15]=0,this},ortho:function(t,e,i,n,s,r){var o=this.val,a=t-e,h=i-n,l=s-r;return a=0===a?a:1/a,h=0===h?h:1/h,l=0===l?l:1/l,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},lookAt:function(t,e,i){var n=this.val,s=t.x,r=t.y,o=t.z,a=i.x,h=i.y,l=i.z,u=e.x,c=e.y,d=e.z;if(Math.abs(s-u)<1e-6&&Math.abs(r-c)<1e-6&&Math.abs(o-d)<1e-6)return this.identity();var f=s-u,p=r-c,g=o-d,v=1/Math.sqrt(f*f+p*p+g*g),y=h*(g*=v)-l*(p*=v),m=l*(f*=v)-a*g,x=a*p-h*f;(v=Math.sqrt(y*y+m*m+x*x))?(y*=v=1/v,m*=v,x*=v):(y=0,m=0,x=0);var w=p*x-g*m,b=g*y-f*x,T=f*m-p*y;return(v=Math.sqrt(w*w+b*b+T*T))?(w*=v=1/v,b*=v,T*=v):(w=0,b=0,T=0),n[0]=y,n[1]=w,n[2]=f,n[3]=0,n[4]=m,n[5]=b,n[6]=p,n[7]=0,n[8]=x,n[9]=T,n[10]=g,n[11]=0,n[12]=-(y*s+m*r+x*o),n[13]=-(w*s+b*r+T*o),n[14]=-(f*s+p*r+g*o),n[15]=1,this},yawPitchRoll:function(t,e,i){this.zero(),s.zero(),r.zero();var n=this.val,o=s.val,a=r.val,h=Math.sin(i),l=Math.cos(i);return n[10]=1,n[15]=1,n[0]=l,n[1]=h,n[4]=-h,n[5]=l,h=Math.sin(e),l=Math.cos(e),o[0]=1,o[15]=1,o[5]=l,o[10]=l,o[9]=-h,o[6]=h,h=Math.sin(t),l=Math.cos(t),a[5]=1,a[15]=1,a[0]=l,a[2]=-h,a[8]=h,a[10]=l,this.multiplyLocal(s),this.multiplyLocal(r),this},setWorldMatrix:function(t,e,i,n,o){return this.yawPitchRoll(t.y,t.x,t.z),s.scaling(i.x,i.y,i.z),r.xyz(e.x,e.y,e.z),this.multiplyLocal(s),this.multiplyLocal(r),void 0!==n&&this.multiplyLocal(n),void 0!==o&&this.multiplyLocal(o),this}}),s=new n,r=new n;t.exports=n},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],w=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+w*h,e[7]=m*n+x*o+w*l,e[8]=m*s+x*a+w*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,w=n*l-r*a,b=n*u-o*a,T=s*l-r*h,S=s*u-o*h,_=r*u-o*l,A=c*v-d*g,C=c*y-f*g,M=c*m-p*g,P=d*y-f*v,E=d*m-p*v,k=f*m-p*y,L=x*k-w*E+b*P+T*M-S*C+_*A;return L?(L=1/L,i[0]=(h*k-l*E+u*P)*L,i[1]=(l*M-a*k-u*C)*L,i[2]=(a*E-h*M+u*A)*L,i[3]=(r*E-s*k-o*P)*L,i[4]=(n*k-r*M+o*C)*L,i[5]=(s*M-n*E-o*A)*L,i[6]=(v*_-y*S+m*T)*L,i[7]=(y*b-g*_-m*w)*L,i[8]=(g*S-v*b+m*x)*L,this):null}});t.exports=n},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,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e,i){var n=i(244);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),te-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)=0?t:t+2*Math.PI}},function(t,e,i){var n=i(0),s=i(18),r=i(21),o=i(7),a=i(2),h=i(8),l=new n({Extends:r,initialize:function(t,e,i,n){var s="txt";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),s=a(o,"extension",s)}var l={type:"text",cache:t.cacheManager.text,extension:s,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,l)},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("text",function(t,e,i){if(Array.isArray(t))for(var n=0;n=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),s>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",e,this,t),this.pad.emit("down",i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit("up",e,this,t),this.pad.emit("up",i,t,this))},destroy:function(){this.pad=null,this.events=null}});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=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom0){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,i){t.exports={CircleToCircle:i(703),CircleToRectangle:i(702),GetRectangleIntersection:i(701),LineToCircle:i(272),LineToLine:i(107),LineToRectangle:i(700),PointToLine:i(271),PointToLineSegment:i(699),RectangleToRectangle:i(148),RectangleToTriangle:i(698),RectangleToValues:i(697),TriangleToCircle:i(696),TriangleToLine:i(695),TriangleToTriangle:i(694)}},function(t,e,i){t.exports={Circle:i(723),Ellipse:i(713),Intersects:i(273),Line:i(693),Point:i(675),Polygon:i(661),Rectangle:i(265),Triangle:i(631)}},function(t,e,i){var n=i(0),s=i(276),r=i(10),o=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1,this.maxLights=-1},enable:function(){return-1===this.maxLights&&(this.maxLights=this.scene.sys.game.renderer.config.maxLights),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,r=t.y+t.height/2,o=(t.width+t.height)/2,a={x:0,y:0},h=t.matrix,l=this.systems.game.config.height;i.length=0;for(var u=0;u0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],o):h=new s(t,e,i,a[0],a[1],a[2],o),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=o},function(t,e,i){var n=i(0),s=i(10),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(65),s=i(6);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(6),s=i(65);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=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(0),s=i(27),r=i(59),o=i(772),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),s.call(this,t,"Triangle",new r(n,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,n,s,r){return this.geom.setTo(t,e,i,n,s,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(775),s=i(0),r=i(64),o=i(27),a=new s({Extends:o,Mixins:[n],initialize:function(t,e,i,n,s,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===s&&(s=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=s,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,s=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var l=0;l0&&r.push(i([0,0],n[0])),e=0;e1&&r.push(i([0,0],n[n.length-1])),t.setTo(r)}},function(t,e,i){var n=i(65),s=i(54);t.exports=function(t){for(var e=t.points,i=0,r=0;rc+v)){var y=g.getPoint((u-c)/v);o.push(y);break}c+=v}return o}},function(t,e,i){var n=i(9);t.exports=function(t,e){void 0===e&&(e=new n);for(var i,s=1/0,r=1/0,o=-s,a=-r,h=0;h0&&(s=-h.PI2+s%h.PI2):s>h.PI2?s=h.PI2:s<0&&(s=h.PI2+s%h.PI2);for(var u,c=[a+Math.cos(n)*i,l+Math.sin(n)*i];e<1;)u=s*e+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=s+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(n)*i,l+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},function(t,e){t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<this._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=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=i(66),s=i(0),r=i(14),o=i(301),a=i(300),h=i(822),l=i(2),u=i(162),c=i(298),d=i(85),f=i(303),p=i(297),g=i(9),v=i(110),y=i(3),m=i(53),x=new s({Mixins:[r.BlendMode,r.Mask,r.ScrollFactor,r.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=f,this.x=new h(e,"x",0),this.y=new h(e,"y",0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",4294967295),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3),this.angle=new h(e,"angle",{min:0,max:360}),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new y,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&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=i(0),s=i(31),r=i(52),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.tint=16777215,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.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.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},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);s>>16,m=(65280&p)>>>8,x=255&p,c.strokeStyle="rgba("+y+","+m+","+x+","+d+")",c.lineWidth=v,w+=3;break;case n.FILL_STYLE:g=l[w+1],f=l[w+2],y=(16711680&g)>>>16,m=(65280&g)>>>8,x=255&g,c.fillStyle="rgba("+y+","+m+","+x+","+f+")",w+=2;break;case n.BEGIN_PATH:c.beginPath();break;case n.CLOSE_PATH:c.closePath();break;case n.FILL_PATH:h||c.fill();break;case n.STROKE_PATH:h||c.stroke();break;case n.FILL_RECT:h?c.rect(l[w+1],l[w+2],l[w+3],l[w+4]):c.fillRect(l[w+1],l[w+2],l[w+3],l[w+4]),w+=4;break;case n.FILL_TRIANGLE:c.beginPath(),c.moveTo(l[w+1],l[w+2]),c.lineTo(l[w+3],l[w+4]),c.lineTo(l[w+5],l[w+6]),c.closePath(),h||c.fill(),w+=6;break;case n.STROKE_TRIANGLE:c.beginPath(),c.moveTo(l[w+1],l[w+2]),c.lineTo(l[w+3],l[w+4]),c.lineTo(l[w+5],l[w+6]),c.closePath(),h||c.stroke(),w+=6;break;case n.LINE_TO:c.lineTo(l[w+1],l[w+2]),w+=2;break;case n.MOVE_TO:c.moveTo(l[w+1],l[w+2]),w+=2;break;case n.LINE_FX_TO:c.lineTo(l[w+1],l[w+2]),w+=5;break;case n.MOVE_FX_TO:c.moveTo(l[w+1],l[w+2]),w+=5;break;case n.SAVE:c.save();break;case n.RESTORE:c.restore();break;case n.TRANSLATE:c.translate(l[w+1],l[w+2]),w+=2;break;case n.SCALE:c.scale(l[w+1],l[w+2]),w+=2;break;case n.ROTATE:c.rotate(l[w+1]),w+=1;break;case n.GRADIENT_FILL_STYLE:w+=5;break;case n.GRADIENT_LINE_STYLE:w+=6;break;case n.SET_TEXTURE:w+=2}c.restore()}}},function(t,e){t.exports=function(t){var e=t.width/2,i=t.height/2,n=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*n/(10+Math.sqrt(4-3*n)))}},function(t,e,i){var n=i(306),s=i(156),r=i(93),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(4),s=i(122),r=function(t,e,i){for(var n=[],s=0;sr;){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){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e){t.exports=function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n}},function(t,e,i){t.exports={AtlasXML:i(886),Canvas:i(885),Image:i(884),JSONArray:i(883),JSONHash:i(882),SpriteSheet:i(881),SpriteSheetFromAtlas:i(880),UnityYAML:i(879)}},function(t,e,i){var n=i(24),s=i(0),r=i(117),o=i(94),a=new s({initialize:function(t,e,i,n){var s=t.manager.game;this.renderer=s.renderer,this.texture=t,this.source=e,this.image=e,this.compressionAlgorithm=null,this.resolution=1,this.width=i||e.naturalWidth||e.width||0,this.height=n||e.naturalHeight||e.height||0,this.scaleMode=o.DEFAULT,this.isCanvas=e instanceof HTMLCanvasElement,this.isRenderTexture="RenderTexture"===e.type,this.isPowerOf2=r(this.width,this.height),this.glTexture=null,this.init(s)},init:function(t){this.renderer&&(this.renderer.gl?this.isCanvas?this.glTexture=this.renderer.canvasToTexture(this.image):this.isRenderTexture?(this.image=this.source.canvas,this.glTexture=this.renderer.createTextureFromSource(null,this.width,this.height,this.scaleMode)):this.glTexture=this.renderer.createTextureFromSource(this.image,this.width,this.height,this.scaleMode):this.isRenderTexture&&(this.image=this.source.canvas)),t.config.antialias||this.setFilter(1)},setFilter:function(t){this.renderer.gl&&this.renderer.setTextureFilter(this.glTexture,t)},update:function(){this.renderer.gl&&this.isCanvas&&(this.glTexture=this.renderer.canvasToTexture(this.image,this.glTexture))},destroy:function(){this.glTexture&&this.renderer.deleteTexture(this.glTexture),this.isCanvas&&n.remove(this.image),this.renderer=null,this.texture=null,this.source=null,this.image=null,this.glTexture=null}});t.exports=a},function(t,e,i){var n=i(24),s=i(887),r=i(0),o=i(37),a=i(26),h=i(11),l=i(357),u=i(4),c=i(316),d=i(165),f=new r({Extends:h,initialize:function(t){h.call(this),this.game=t,this.name="TextureManager",this.list={},this._tempCanvas=n.create2D(this,1,1),this._tempContext=this._tempCanvas.getContext("2d"),this._pending=0,t.events.once("boot",this.boot,this)},boot:function(){this._pending=2,this.on("onload",this.updatePending,this),this.on("onerror",this.updatePending,this),this.addBase64("__DEFAULT",this.game.config.defaultImage),this.addBase64("__MISSING",this.game.config.missingImage),this.game.events.once("destroy",this.destroy,this)},updatePending:function(){this._pending--,0===this._pending&&(this.off("onload"),this.off("onerror"),this.game.events.emit("texturesready"))},checkKey:function(t){return!this.exists(t)||(console.error("Texture key already in use: "+t),!1)},remove:function(t){if("string"==typeof t){if(!this.exists(t))return console.warn("No texture found matching key: "+t),this;t=this.get(t)}return this.list.hasOwnProperty(t.key)&&(delete this.list[t.key],t.destroy(),this.emit("removetexture",t.key)),this},addBase64:function(t,e){if(this.checkKey(t)){var i=this,n=new Image;n.onerror=function(){i.emit("onerror",t)},n.onload=function(){var e=i.create(t,n);c.Image(e,0),i.emit("addtexture",t,e),i.emit("onload",t,e)},n.src=e}return this},getBase64:function(t,e,i,s){void 0===i&&(i="image/png"),void 0===s&&(s=.92);var r="",o=this.getFrame(t,e);if(o){var a=o.canvasData,h=n.create2D(this,a.width,a.height);h.getContext("2d").drawImage(o.source.image,a.x,a.y,a.width,a.height,0,0,a.width,a.height),r=h.toDataURL(i,s),n.remove(h)}return r},addImage:function(t,e,i){var n=null;return this.checkKey(t)&&(n=this.create(t,e),c.Image(n,0),i&&n.setDataSource(i),this.emit("addtexture",t,n)),n},addRenderTexture:function(t,e){var i=null;return this.checkKey(t)&&((i=this.create(t,e)).add("__BASE",0,0,0,e.width,e.height),this.emit("addtexture",t,i)),i},generate:function(t,e){if(this.checkKey(t)){var i=n.create(this,1,1);return e.canvas=i,l(e),this.addCanvas(t,i)}return null},createCanvas:function(t,e,i){if(void 0===e&&(e=256),void 0===i&&(i=256),this.checkKey(t)){var s=n.create(this,e,i,a.CANVAS,!0);return this.addCanvas(t,s)}return null},addCanvas:function(t,e,i){void 0===i&&(i=!1);var n=null;return i?n=new s(this,t,e,e.width,e.height):this.checkKey(t)&&(n=new s(this,t,e,e.width,e.height),this.list[t]=n,this.emit("addtexture",t,n)),n},addAtlas:function(t,e,i,n){return Array.isArray(i.textures)||Array.isArray(i.frames)?this.addAtlasJSONArray(t,e,i,n):this.addAtlasJSONHash(t,e,i,n)},addAtlasJSONArray:function(t,e,i,n){var s=null;if(this.checkKey(t)){if(s=this.create(t,e),Array.isArray(i))for(var r=1===i.length,o=0;o=r.x&&t=r.y&&e=r.x&&t=r.y&&e0)&&(!!n.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)&&(!!n.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!n.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(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||this.emit("mute",this,t)}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||this.emit("volume",this,t)}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||(this.calculateRate(),this.emit("rate",this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||(this.calculateRate(),this.emit("detune",this,t))}},setDetune:function(t){return this.detune=t,this},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))}},setSeek:function(t){return this.seek=t,this},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))}},setLoop:function(t){return this.loop=t,this}});t.exports=s},function(t,e,i){var n=i(115),s=i(0),r=i(323),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(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each(function(e,i){for(var n=0;n-1&&(delete this.keys[n],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,i=t.sys,n=i.settings;t.init&&(t.init.call(t,n.data),n.status=s.INIT,n.isTransition&&i.events.emit("transitioninit",n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=s.LOADING,e.once("complete",this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>s.START&&n.settings.status<=s.RUNNING&&n.step(t,e)}},resize:function(t,e){for(var i=0;i=s.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)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.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e=0;){var a=e[o];-1!==(r=t.indexOf(a))?(n(t,r),i&&i.call(s,a)):e.pop(),o--}return e}},function(t,e,i){var n=i(0),s=i(11),r=i(7),o=i(13),a=i(5),h=i(2),l=i(15),u=i(330),c=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once("boot",this.boot,this)},boot:function(){var t,e,i,n,s,r,o,a=this.game.config,l=a.installGlobalPlugins;for(l=l.concat(this._pendingGlobal),t=0;t10&&(t=10-this.pointersTotal);for(var i=0;i0},queueTouchStart:function(t){if(this.queue.push(s.TOUCH_START,t),this._hasDownCallback){var e=this.domCallbacks;this._hasDownCallback=this.processDomCallbacks(e.downOnce,e.down,t)}},queueTouchMove:function(t){if(this.queue.push(s.TOUCH_MOVE,t),this._hasMoveCallback){var e=this.domCallbacks;this._hasMoveCallback=this.processDomCallbacks(e.moveOnce,e.move,t)}},queueTouchEnd:function(t){if(this.queue.push(s.TOUCH_END,t),this._hasUpCallback){var e=this.domCallbacks;this._hasUpCallback=this.processDomCallbacks(e.upOnce,e.up,t)}},queueTouchCancel:function(t){this.queue.push(s.TOUCH_CANCEL,t)},queueMouseDown:function(t){if(this.queue.push(s.MOUSE_DOWN,t),this._hasDownCallback){var e=this.domCallbacks;this._hasDownCallback=this.processDomCallbacks(e.downOnce,e.down,t)}},queueMouseMove:function(t){if(this.queue.push(s.MOUSE_MOVE,t),this._hasMoveCallback){var e=this.domCallbacks;this._hasMoveCallback=this.processDomCallbacks(e.moveOnce,e.move,t)}},queueMouseUp:function(t){if(this.queue.push(s.MOUSE_UP,t),this._hasUpCallback){var e=this.domCallbacks;this._hasUpCallback=this.processDomCallbacks(e.upOnce,e.up,t)}},addUpCallback:function(t,e){return void 0===e&&(e=!0),e?this.domCallbacks.upOnce.push(t):this.domCallbacks.up.push(t),this._hasUpCallback=!0,this},addDownCallback:function(t,e){return void 0===e&&(e=!0),e?this.domCallbacks.downOnce.push(t):this.domCallbacks.down.push(t),this._hasDownCallback=!0,this},addMoveCallback:function(t,e){return void 0===e&&(e=!1),e?this.domCallbacks.moveOnce.push(t):this.domCallbacks.move.push(t),this._hasMoveCallback=!0,this},inputCandidate:function(t,e){var i=t.input;if(!i||!i.enabled||!t.willRender(e))return!1;var n=!0,s=t.parentContainer;if(s)do{if(!s.willRender(e)){n=!1;break}s=s.parentContainer}while(s);return n},hitTest:function(t,e,i,n){void 0===n&&(n=this._tempHitTest);var s=this._tempPoint,r=i.scrollX,o=i.scrollY;n.length=0;var a=t.x,h=t.y;1!==i.resolution&&(a+=i._x,h+=i._y),i.getWorldPoint(a,h,s),t.worldX=s.x,t.worldY=s.y;for(var l={x:0,y:0},u=this._tempMatrix,d=this._tempMatrix2,f=0;f1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e){t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},function(t,e,i){var n=i(37);n.ColorToRGBA=i(915),n.ComponentToHex=i(346),n.GetColor=i(177),n.GetColor32=i(376),n.HexStringToColor=i(377),n.HSLToColor=i(914),n.HSVColorWheel=i(913),n.HSVToRGB=i(176),n.HueToComponent=i(345),n.IntegerToColor=i(374),n.IntegerToRGB=i(373),n.Interpolate=i(912),n.ObjectToColor=i(372),n.RandomRGB=i(911),n.RGBStringToColor=i(371),n.RGBToHSV=i(375),n.RGBToString=i(910),n.ValueToColor=i(178),t.exports=n},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","crisp-edges","-moz-crisp-edges","-webkit-optimize-contrast","optimize-contrast","pixelated"].forEach(function(e){t.style["image-rendering"]=e}),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(171),s=i(0),r=i(70),o=i(3),a=new s({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.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;ei;)n-=i;n16777215?{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(37),s=i(373);t.exports=function(t){var e=s(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(ef.right&&(p=u(p,p+(v-f.right),this.lerp.x)),yf.bottom&&(g=u(g,g+(y-f.bottom),this.lerp.y))):(p=u(p,v-l,this.lerp.x),g=u(g,y-c,this.lerp.y))}this.useBounds&&(p=this.clampX(p),g=this.clampY(g)),this.roundPixels&&(l=Math.round(l),c=Math.round(c)),this.scrollX=p,this.scrollY=g;var m=p+s,x=g+o;this.midPoint.set(m,x);var w=i/a,b=n/a;this.worldView.setTo(m-w/2,x-b/2,w,b),h.loadIdentity(),h.scale(e,e),h.translate(this.x+l,this.y+c),h.rotate(this.rotation),h.scale(a,a),h.translate(-l,-c),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=o(i,0,1),n=o(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var a=this.width/2,h=this.height/2,l=t.x-s,u=t.y-r;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},function(t,e,i){var n=i(380),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.html=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","html","obj","tilemap","xml"],e=0;ee.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=i(23),s=i(0),r=i(383),o=i(382),a=i(4),h=new s({initialize:function(t,e,i){this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,a(i,"frames",[]),a(i,"defaultTextureKey",null)),this.frameRate=a(i,"frameRate",null),this.duration=a(i,"duration",null),null===this.duration&&null===this.frameRate?(this.frameRate=24,this.duration=this.frameRate/this.frames.length*1e3):this.duration&&null===this.frameRate?this.frameRate=this.frames.length/(this.duration/1e3):this.duration=this.frames.length/this.frameRate*1e3,this.msPerFrame=1e3/this.frameRate,this.skipMissedFrames=a(i,"skipMissedFrames",!0),this.delay=a(i,"delay",0),this.repeat=a(i,"repeat",0),this.repeatDelay=a(i,"repeatDelay",0),this.yoyo=a(i,"yoyo",!1),this.showOnStart=a(i,"showOnStart",!1),this.hideOnComplete=a(i,"hideOnComplete",!1),this.paused=!1,this.manager.on("pauseall",this.pause,this),this.manager.on("resumeall",this.resume,this)},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){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 t>=0&&t0){s.isLast=!0,s.nextFrame=l[0],l[0].prevFrame=s;var v=1/(l.length-1);for(r=0;r=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,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);var i=this.frames[e];0!==e||t.forward||(i=this.getLastFrame()),t.updateFrame(i)},getFrameByProgress:function(t){return t=n(t,0,1),r(t,this.frames,"progress")},nextFrame:function(t){var e=t.currentFrame;e.isLast?t._yoyo?this.handleYoyoFrame(t,!1):t.repeatCounter>0?t._reverse&&t.forward?t.forward=!1:this.repeatAnimation(t):this.completeAnimation(t):this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t._reverse===!e&&t.repeatCounter>0)return t.forward=e,void this.repeatAnimation(t);if(t._reverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else this.completeAnimation(t)},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t._yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?t._reverse&&!t.forward?(t.currentFrame=this.getLastFrame(),this.repeatAnimation(t)):(t.forward=!0,this.repeatAnimation(t)):this.completeAnimation(t):this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.updateFrame(e),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){if(2===t._pendingStop)return this.completeAnimation(t);t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t._repeatDelay):(t.repeatCounter--,t.updateFrame(t.currentFrame[t.forward?"nextFrame":"prevFrame"]),t.isPlaying&&(this.getNextTick(t),t.pendingRepeat=!1,t.parent.emit("animationrepeat",this,t.currentFrame,t.repeatCounter,t.parent)))},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(){this.manager.off("pauseall",this.pause,this),this.manager.off("resumeall",this.resume,this),this.manager.remove(this.key);for(var t=0;t-h&&(c-=h,n+=l),f=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){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,i){var n=i(16),s=i(38),r=i(199),o=i(198),a={_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 o(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=r(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},setRandomPosition:function(t,e,i,n){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),this.x=t+Math.random()*i,this.y=e+Math.random()*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},getLocalTransformMatrix:function(t){return void 0===t&&(t=new s),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new s),void 0===e&&(e=new s);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t}};t.exports=a},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){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,i){var n=new(i(0))({initialize:function(t,e){this.geometryMask=e},setShape:function(t){this.geometryMask=t},preRenderWebGL:function(t,e,i){var n=t.gl,s=this.geometryMask;t.flush(),n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.NOTEQUAL,1,1),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),s.renderWebGL(t,s,0,i),t.flush(),n.colorMask(!0,!0,!0,!0),n.stencilFunc(n.EQUAL,1,1),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)},postRenderWebGL:function(t){var e=t.gl;t.flush(),e.disable(e.STENCIL_TEST)},preRenderCanvas:function(t,e,i){var n=this.geometryMask;t.currentContext.save(),n.renderCanvas(t,n,0,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){var i=t.sys.game.renderer;if(this.renderer=i,this.bitmapMask=e,this.maskTexture=null,this.mainTexture=null,this.dirty=!0,this.mainFramebuffer=null,this.maskFramebuffer=null,this.invertAlpha=!1,i&&i.gl){var n=i.width,s=i.height,r=0==(n&n-1)&&0==(s&s-1),o=i.gl,a=r?o.REPEAT:o.CLAMP_TO_EDGE,h=o.LINEAR;this.mainTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.maskTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.mainFramebuffer=i.createFramebuffer(n,s,this.mainTexture,!1),this.maskFramebuffer=i.createFramebuffer(n,s,this.maskTexture,!1),i.onContextRestored(function(t){var e=t.width,i=t.height,n=0==(e&e-1)&&0==(i&i-1),s=t.gl,r=n?s.REPEAT:s.CLAMP_TO_EDGE,o=s.LINEAR;this.mainTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.maskTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.mainFramebuffer=t.createFramebuffer(e,i,this.mainTexture,!1),this.maskFramebuffer=t.createFramebuffer(e,i,this.maskTexture,!1)},this)}},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BitmapMaskPipeline.beginMask(this,e,i)},postRenderWebGL:function(t){t.pipelines.BitmapMaskPipeline.endMask(this)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null;var t=this.renderer;t&&t.gl&&(t.deleteTexture(this.mainTexture),t.deleteTexture(this.maskTexture),t.deleteFramebuffer(this.mainFramebuffer),t.deleteFramebuffer(this.maskFramebuffer)),this.mainTexture=null,this.maskTexture=null,this.mainFramebuffer=null,this.maskFramebuffer=null,this.renderer=null}});t.exports=n},function(t,e,i){var n=i(394),s=i(393),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t){return void 0===t&&this.texture&&(t=this),new n(this.scene,t)},createGeometryMask:function(t){return void 0===t&&"Graphics"===this.type&&(t=this),new s(this.scene,t)}};t.exports=r},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x-e,a=t.y-i;return t.x=o*s-a*r+e,t.y=o*r+a*s+i,t}},function(t,e,i){var n=i(6);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(190),s=i(124);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=s(t)/i);for(var o=0;o=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e,i){var n=i(23),s={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,s){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=n(t,0,1),this._alphaTR=n(e,0,1),this._alphaBL=n(i,0,1),this._alphaBR=n(s,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=n(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=n(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=n(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=n(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=n(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=s},function(t,e){t.exports=function(t){return Math.PI*t.radius*2}},function(t,e,i){var n=i(402),s=i(192),r=i(93),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h>>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;e0;i--){var n=Math.floor(this.frac()*(e+1)),s=t[n];t[n]=t[i],t[i]=s}return t}});t.exports=n},function(t,e,i){var n=i(192),s=i(93),r=i(16),o=i(6);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(44),s=i(42),r=i(43),o=i(41);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(46),s=i(42),r=i(45),o=i(41);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(75),s=i(42),r=i(74),o=i(41);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(72),s=i(44),r=i(73),o=i(43);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(72),s=i(46),r=i(73),o=i(45);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(74),s=i(73);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(411),s=i(75),r=i(72);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(48),s=i(44),r=i(47),o=i(43);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(48),s=i(46),r=i(47),o=i(45);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(48),s=i(75),r=i(47),o=i(74);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(193),s=[];s[n.BOTTOM_CENTER]=i(415),s[n.BOTTOM_LEFT]=i(414),s[n.BOTTOM_RIGHT]=i(413),s[n.CENTER]=i(412),s[n.LEFT_CENTER]=i(410),s[n.RIGHT_CENTER]=i(409),s[n.TOP_CENTER]=i(408),s[n.TOP_LEFT]=i(407),s[n.TOP_RIGHT]=i(406);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e,i){t.exports={Angle:i(1050),Call:i(1049),GetFirst:i(1048),GetLast:i(1047),GridAlign:i(1046),IncAlpha:i(1035),IncX:i(1034),IncXY:i(1033),IncY:i(1032),PlaceOnCircle:i(1031),PlaceOnEllipse:i(1030),PlaceOnLine:i(1029),PlaceOnRectangle:i(1028),PlaceOnTriangle:i(1027),PlayAnimation:i(1026),PropertyValueInc:i(32),PropertyValueSet:i(25),RandomCircle:i(1025),RandomEllipse:i(1024),RandomLine:i(1023),RandomRectangle:i(1022),RandomTriangle:i(1021),Rotate:i(1020),RotateAround:i(1019),RotateAroundDistance:i(1018),ScaleX:i(1017),ScaleXY:i(1016),ScaleY:i(1015),SetAlpha:i(1014),SetBlendMode:i(1013),SetDepth:i(1012),SetHitArea:i(1011),SetOrigin:i(1010),SetRotation:i(1009),SetScale:i(1008),SetScaleX:i(1007),SetScaleY:i(1006),SetTint:i(1005),SetVisible:i(1004),SetX:i(1003),SetXY:i(1002),SetY:i(1001),ShiftPosition:i(1e3),Shuffle:i(999),SmootherStep:i(998),SmoothStep:i(997),Spread:i(996),ToggleVisible:i(995),WrapInRectangle:i(994)}},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;h0&&n>0&&s.scissor(t,this.drawingBufferHeight-e-n,i,n))},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},setPipeline:function(t,e){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(e),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==r.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,!0)},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},setBlankTexture:function(t){void 0===t&&(t=!1),!t&&0===this.currentActiveTextureUnit&&this.currentTextures[0]||this.setTexture2D(this.blankTexture.glTexture,0)},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,i=this.width,n=this.height;return t!==this.currentFramebuffer&&(t&&t.renderTexture?(i=t.renderTexture.width,n=t.renderTexture.height):this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),e.viewport(0,0,i,n),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 s=this.gl,a=s.NEAREST,h=s.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,o(e,i)&&(h=s.REPEAT),n===r.ScaleModes.LINEAR&&this.config.antialias&&(a=s.LINEAR),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,s.RGBA,t):this.createTexture2D(0,a,a,h,h,s.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){l=void 0===l||null===l||l;var u=this.gl,c=u.createTexture();return 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){var e=this.nativeTextures.indexOf(t);return-1!==e&&a(this.nativeTextures,e),this.gl.deleteTexture(t),this.currentTextures[0]===t&&this.setBlankTexture(!0),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=t._cx,i=t._cy,n=t._cw,s=t._ch,r=this.pipelines.TextureTintPipeline,o=t.backgroundColor;if(t.renderToTexture){this.flush(),this.pushScissor(e,i,n,-s),this.setFramebuffer(t.framebuffer);var a=this.gl;a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),r.projOrtho(e,n+e,i,s+i,-1e3,1e3),o.alphaGL>0&&r.drawFillRect(e,i,n+e,s+i,l.getTintFromFloats(o.redGL,o.greenGL,o.blueGL,1),o.alphaGL),t.emit("prerender",t)}else this.pushScissor(e,i,n,s),o.alphaGL>0&&r.drawFillRect(e,i,n,s,l.getTintFromFloats(o.redGL,o.greenGL,o.blueGL,1),o.alphaGL)},postRenderCamera:function(t){var e=this.pipelines.TextureTintPipeline;if(t.flashEffect.postRenderWebGL(e,l.getTintFromFloats),t.fadeEffect.postRenderWebGL(e,l.getTintFromFloats),t.dirty=!1,this.popScissor(),t.renderToTexture){e.flush(),this.setFramebuffer(null),t.emit("postrender",t),e.projOrtho(0,e.width,e.height,0,-1e3,1e3);var i=l.getTintAppendFloatAlpha;(t.pipeline?t.pipeline:e).batchTexture(t,t.glTexture,t.width,t.height,t.x,t.y,t.width,t.height,t.zoom,t.zoom,t.rotation,t.flipX,!t.flipY,1,1,0,0,0,0,t.width,t.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),t._isTinted&&t.tintFill,0,0,this.defaultCamera,null),this.setBlankTexture(!0)}},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;for(var n in this.config.clearBeforeRender&&(t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)),t.enable(t.SCISSOR_TEST),i)i[n].onPreRender();this.currentScissor=[0,0,this.width,this.height],this.scissorStack=[this.currentScissor],this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.setPipeline(this.pipelines.TextureTintPipeline)}},render:function(t,e,i,n){if(!this.contextLost){var s=e.list,o=s.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;l=0?g=-(g+d):g<0&&(g=Math.abs(g)-d)),-1===m&&(v>=0?v=-(v+f):v<0&&(v=Math.abs(v)-f))}a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y,o.multiply(a,h)):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY,o.multiply(a,h)),r.save(),h.setToContext(r),r.scale(y,m),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=s,r.drawImage(e.source.image,u,c,d,f,g,v,d/p,f/p),r.restore()}},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=u},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.once("remove",this.remove,this),this.isPlaying=!1,this.currentAnim=null,this.currentFrame=null,this._timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this._delay=0,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this.forward=!0,this._reverse=!1,this.accumulator=0,this.nextTick=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},setDelay:function(t){return void 0===t&&(t=0),this._delay=t,this.parent},getDelay:function(){return this._delay},delayedPlay:function(t,e,i){return this.play(e,!0,i),this.nextTick+=t,this.parent},getCurrentKey:function(){if(this.currentAnim)return this.currentAnim.key},load:function(t,e){return void 0===e&&(e=0),this.isPlaying&&this.stop(),this.animationManager.load(this,t,e),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.updateFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.updateFrame(t),this.parent},isPaused:{get:function(){return this._paused}},play:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!0,this._reverse=!1,this._startAnimation(t,i))},playReverse:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!1,this._reverse=!0,this._startAnimation(t,i))},_startAnimation:function(t,e){this.load(t,e);var i=this.currentAnim,n=this.parent;return this.repeatCounter=-1===this._repeat?Number.MAX_VALUE:this._repeat,i.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,i.showOnStart&&(n.visible=!0),n.emit("animationstart",this.currentAnim,this.currentFrame,n),n},reverse:function(t){return this.isPlaying&&this.currentAnim.key===t?(this._reverse=!this._reverse,this.forward=!this.forward,this.parent):this.parent},getProgress:function(){var t=this.currentFrame.progress;return this.forward||(t=1-t),t},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},remove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},getRepeat:function(){return this._repeat},setRepeat:function(t){return this._repeat=t,this.repeatCounter=0,this.parent},getRepeatDelay:function(){return this._repeatDelay},setRepeatDelay:function(t){return this._repeatDelay=t,this.parent},restart:function(t){void 0===t&&(t=!1),this.currentAnim.getFirstTick(this,t),this.forward=!0,this.isPlaying=!0,this.pendingRepeat=!1,this._paused=!1,this.updateFrame(this.currentAnim.frames[0]);var e=this.parent;return e.emit("animationrestart",this.currentAnim,this.currentFrame,e),this.parent},stop:function(){this._pendingStop=0,this.isPlaying=!1;var t=this.parent;return t.emit("animationcomplete",this.currentAnim,this.currentFrame,t),t},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopOnRepeat:function(){return this._pendingStop=2,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},setTimeScale:function(t){return void 0===t&&(t=1),this._timeScale=t,this.parent},getTimeScale:function(){return this._timeScale},getTotalFrames:function(){return this.currentAnim.frames.length},update:function(t,e){if(this.currentAnim&&this.isPlaying&&!this.currentAnim.paused){if(this.accumulator+=e*this._timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.currentAnim.completeAnimation(this);this.accumulator>=this.nextTick&&this.currentAnim.setFrame(this)}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),e.setSizeToFrame(),t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin(),e},updateFrame:function(t){var e=this.setCurrentFrame(t);if(this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;e.emit("animationupdate",i,t,e),3===this._pendingStop&&this._pendingStopValue===t&&this.currentAnim.completeAnimation(this)}},setYoyo:function(t){return void 0===t&&(t=!1),this._yoyo=t,this.parent},getYoyo:function(){return this._yoyo},destroy:function(){this.animationManager.off("remove",this.remove,this),this.animationManager=null,this.parent=null,this.currentAnim=null,this.currentFrame=null}});t.exports=n},function(t,e){t.exports=function(t){return t.split("").reverse().join("")}},function(t,e){t.exports=function(t,e){return t.replace(/%([0-9]+)/g,function(t,i){return e[Number(i)-1]})}},function(t,e,i){t.exports={Format:i(429),Pad:i(179),Reverse:i(428),UppercaseFirst:i(327),UUID:i(295)}},function(t,e,i){var n=i(63);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){t.exports=function(t,e){for(var i=0;i-1&&(e.state=a.REMOVED,s.splice(r,1)):(e.state=a.REMOVED,n.splice(r,1))}for(i.length=0,i=this._add,t=0;t-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&&(t.currentPipeline&&t.currentPipeline.vertexCount>0&&t.flush(),r.vertexBuffer=e.vertexBuffer[a],t.setPipeline(r),t.setTexture2D(s[a].glTexture,0),t.gl.drawArrays(r.topology,0,e.vertexCount[a]));r.vertexBuffer=o,r.viewIdentity(),r.modelIdentity()}},function(t,e,i){var n=i(1),s=i(1);n=i(445),s=i(444),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){t.exports=function(t,e,i,n,s){e.cull(n);var r=e.culledTiles,o=r.length;if(0!==o){var a=t._tempMatrix1,h=t._tempMatrix2,l=t._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(n.matrix);var u=t.currentContext,c=e.gidMap;u.save(),s?(a.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l),l.copyToContext(u)):(h.e-=n.scrollX*e.scrollFactorX,h.f-=n.scrollY*e.scrollFactorY,h.copyToContext(u));for(var d=n.alpha*e.alpha,f=0;f-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(20);t.exports=function(t){for(var e,i,s,r,o,a=0;a1){if(Array.isArray(l.tiles)){for(var c={},d={},f=0;f>>0;return n}},function(t,e,i){var n=i(458),s=i(2),r=i(78),o=i(214),a=i(55);t.exports=function(t,e){for(var i=[],h=0;h0){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,i){t.exports={Parse:i(217),Parse2DArray:i(133),ParseCSV:i(216),Impact:i(210),Tiled:i(215)}},function(t,e,i){var n=i(50),s=i(49),r=i(3);t.exports=function(t,e,i,o,a,h){return void 0===o&&(o=new r(0,0)),o.x=n(t,i,a,h),o.y=s(e,i,a,h),o}},function(t,e,i){var n=i(17);t.exports=function(t,e,i,s,r,o){if(void 0!==r){var a,h=n(t,e,i,s,null,o),l=0;for(a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e,i){var n=i(56),s=i(34),r=i(85);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;ae)){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(56),s=i(34),r=i(134);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;a=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;r=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);else if(2===r)for(a=x;a>=m;a--)for(o=v;o=m;a--)for(o=y;o>=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);return u.tilesDrawn=i.length,u.tilesTotal=d*f,i}},function(t,e,i){var n=i(101),s=i(100),r=i(17),o=i(220);t.exports=function(t,e,i,a,h,l){void 0===i&&(i={}),Array.isArray(t)||(t=[t]);var u=l.tilemapLayer;void 0===a&&(a=u.scene),void 0===h&&(h=a.cameras.main);var c,d=r(0,0,l.width,l.height,null,l),f=[];for(c=0;c=0&&p=0&&g=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off("update",this.step,this),t.events.emit("transitioncomplete",this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(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)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off("shutdown",this.shutdown,this),t.off("postupdate",this.step,this),t.off("transitionout")},destroy:function(){this.shutdown(),this.scene.sys.events.off("start",this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});o.register("ScenePlugin",a,"scenePlugin"),t.exports=a},function(t,e,i){var n=i(116),s=i(20),r={SceneManager:i(329),ScenePlugin:i(495),Settings:i(326),Systems:i(166)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(221),s=new(i(0))({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once("boot",this.boot,this)},boot:function(){}});t.exports=s},function(t,e,i){t.exports={BasePlugin:i(221),DefaultPlugins:i(167),PluginCache:i(15),PluginManager:i(331),ScenePlugin:i(497)}},function(t,e,i){var n={};t.exports=n;var s=i(137),r=(i(194),i(33));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){var n={};t.exports=n;var s=i(33);n._registry={},n.register=function(t){if(n.isPlugin(t)||s.warn("Plugin.register:",n.toString(t),"does not implement all required fields."),t.name in n._registry){var e=n._registry[t.name],i=n.versionParse(t.version).number,r=n.versionParse(e.version).number;i>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=i(1065);n.Body=i(67),n.Composite=i(137),n.World=i(499),n.Detector=i(503),n.Grid=i(1064),n.Pairs=i(1063),n.Pair=i(418),n.Query=i(1089),n.Resolver=i(1062),n.SAT=i(502),n.Constraint=i(194),n.Common=i(33),n.Engine=i(1061),n.Events=i(195),n.Sleeping=i(222),n.Plugin=i(500),n.Bodies=i(126),n.Composites=i(1068),n.Axes=i(505),n.Bounds=i(80),n.Svg=i(1087),n.Vector=i(81),n.Vertices=i(76),n.World.add=n.Composite.add,n.World.remove=n.Composite.remove,n.World.addComposite=n.Composite.addComposite,n.World.addBody=n.Composite.addBody,n.World.addConstraint=n.Composite.addConstraint,n.World.clear=n.Composite.clear,t.exports=n},function(t,e,i){var n={};t.exports=n;var s=i(76),r=i(81);n.collides=function(t,e,i){var o,a,h,l,u=!1;if(i){var c=t.parent,d=e.parent,f=c.speed*c.speed+c.angularSpeed*c.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;u=i&&i.collided&&f<.2,l=i}else l={collided:!1,bodyA:t,bodyB:e};if(i&&u){var p=l.axisBody,g=p===t?e:t,v=[p.axes[i.axisNumber]];if(h=n._overlapAxes(p.vertices,g.vertices,v),l.reused=!0,h.overlap<=0)return l.collided=!1,l}else{if((o=n._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return l.collided=!1,l;if((a=n._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return l.collided=!1,l;o.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))1?1:0;d1?1:0;p0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n=i(126),s=i(67),r=i(0),o=i(419),a=i(2),h=i(85),l=i(76),u=new r({Mixins:[o.Bounce,o.Collision,o.Friction,o.Gravity,o.Mass,o.Sensor,o.Sleep,o.Static],initialize:function(t,e,i){this.tile=e,this.world=t,e.physics.matterBody&&e.physics.matterBody.destroy(),e.physics.matterBody=this;var n=a(i,"body",null),s=a(i,"addToWorld",!0);if(n)this.setBody(n,s);else{var r=e.getCollisionGroup();a(r,"objects",[]).length>0?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(81),r=i(33);n.fromVertices=function(t){for(var e={},i=0;i0?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){var n=i(230);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){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,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(509);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.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,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(511);t.exports=function(t,e,i,s,r){var o=0;return t.deltaX()<0&&!t.blocked.left&&e.collideRight&&t.checkCollision.left?e.faceRight&&t.x0&&!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,i){var n=i(512),s=i(510),r=i(226);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;a--){var h=e[a],l=o(s,r,h.x,h.y);l=0;a--){var h=e[a],l=o(s,r,h.x,h.y);l>i&&(n=h,i=l)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var o=Math.atan2(i-t.y,e-t.x);return s>0&&(n=r(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(o,n),o},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),void 0===i&&(i=new c),i.setToPolar(s(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new c),i.setToPolar(t,e)},shutdown:function(){if(this.world){var t=this.systems.events;t.off("update",this.world.update,this.world),t.off("postupdate",this.world.postUpdate,this.world),t.off("shutdown",this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off("start",this.start,this),this.scene=null,this.systems=null}});u.register("ArcadePhysics",f,"arcadePhysics"),t.exports=f},function(t,e,i){var n=i(35),s=i(20),r={ArcadePhysics:i(527),Body:i(232),Collider:i(231),Factory:i(238),Group:i(235),Image:i(237),Sprite:i(104),StaticBody:i(225),StaticGroup:i(234),World:i(233)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(138),s=i(240),r=i(239),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=new(i(0))({initialize:function(t,e,i,n){this.x=0,this.y=0,this.z=0,this.w=0,"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)},clone:function(){return new n(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this.w=t.w||0,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},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||0,this.w+=t.w||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this.w-=t.w||0,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},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){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},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;o1?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,i){return Math.max(t-e,i)}},function(t,e){t.exports=function(t,e,i){return Math.min(t+e,i)}},function(t,e){t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t,e){return t/e/1e3}},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.floor(t*n)/n}},function(t,e){t.exports=function(t,e){return Math.abs(t-e)}},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.ceil(t*n)/n}},function(t,e){t.exports=function(t){for(var e=0,i=0;i0&&0==(t&t-1)}},function(t,e,i){t.exports={GetNext:i(294),IsSize:i(117),IsValue:i(549)}},function(t,e,i){var n=i(182);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){var n=i(119);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,i){var n=i(171);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return t[0]===t[i]?(e<0&&(r=Math.floor(s=i*(1+e))),n(s-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(n(-s,t[0],t[0],t[1],t[1])-t[0]):e>1?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[i=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit("start",this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on("update",this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit("progress",this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=s.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0&&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,i){var n=i(0),s=i(11),r=i(4),o=i(106),a=i(256),h=i(143),l=i(255),u=i(602),c=i(601),d=i(600),f=i(142),p=new n({Extends:s,initialize:function(t){s.call(this),this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.enabled=!0,this.target,this.keys=[],this.combos=[],this.queue=[],this.onKeyHandler,this.time=0,t.pluginEvents.once("boot",this.boot,this),t.pluginEvents.on("start",this.start,this)},boot:function(){var t=this.settings.input,e=this.scene.sys.game.config;this.enabled=r(t,"keyboard",e.inputKeyboard),this.target=r(t,"keyboard.target",e.inputKeyboardEventTarget),this.sceneInputPlugin.pluginEvents.once("destroy",this.destroy,this)},start:function(){this.enabled&&this.startListeners(),this.sceneInputPlugin.pluginEvents.once("shutdown",this.shutdown,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},startListeners:function(){var t=this,e=function(e){if(!e.defaultPrevented&&t.isActive()){t.queue.push(e);var i=t.keys[e.keyCode];i&&i.preventDefault&&e.preventDefault()}};this.onKeyHandler=e,this.target.addEventListener("keydown",e,!1),this.target.addEventListener("keyup",e,!1),this.sceneInputPlugin.pluginEvents.on("update",this.update,this)},stopListeners:function(){this.target.removeEventListener("keydown",this.onKeyHandler),this.target.removeEventListener("keyup",this.onKeyHandler),this.sceneInputPlugin.pluginEvents.off("update",this.update)},createCursorKeys:function(){return this.addKeys({up:h.UP,down:h.DOWN,left:h.LEFT,right:h.RIGHT,space:h.SPACE,shift:h.SHIFT})},addKeys:function(t){var e={};if("string"==typeof t){t=t.split(",");for(var i=0;i-1?e[i]=t:e[t.keyCode]=t,t}return"string"==typeof t&&(t=h[t.toUpperCase()]),e[t]||(e[t]=new a(t)),e[t]},removeKey:function(t){var e=this.keys;if(t instanceof a){var i=e.indexOf(t);i>-1&&(this.keys[i]=void 0)}else"string"==typeof t&&(t=h[t.toUpperCase()]);e[t]&&(e[t]=void 0)},createCombo:function(t,e){return new l(this,t,e)},checkDown:function(t,e){if(this.enabled&&t.isDown){var i=f(this.time-t.timeDown,e);if(i>t._tick)return t._tick=i,!0}return!1},update:function(t){this.time=t;var e=this.queue.length;if(this.enabled&&0!==e)for(var i=this.queue.splice(0,e),n=this.keys,s=0;s=e}}},function(t,e,i){var n=i(71),s=i(40),r=i(0),o=i(260),a=i(608),h=i(52),l=i(90),u=i(89),c=i(11),d=i(2),f=i(106),p=i(8),g=i(15),v=i(9),y=i(39),m=i(59),x=i(69),w=new r({Extends:c,initialize:function(t){c.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new c,this.enabled=!0,this.displayList,this.cameras,f.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once("destroy",this.destroy,this),this.pluginEvents.emit("boot")},start:function(){var t=this.systems.events;t.on("transitionstart",this.transitionIn,this),t.on("transitionout",this.transitionOut,this),t.on("transitioncomplete",this.transitionComplete,this),t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.once("shutdown",this.shutdown,this),this.enabled=!0,this.pluginEvents.emit("start")},preUpdate:function(){this.pluginEvents.emit("preUpdate");var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,n=e.length;if(0!==i||0!==n){for(var s=this._list,r=0;r-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._pendingRemoval.length=0,this._list=s.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},update:function(t,e){if(this.isActive()){this.pluginEvents.emit("update",t,e);var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(n=!0,this._pollTimer=this.pollRate)),n)for(var s=this.manager.pointers,r=0;r0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}}},clear:function(t){var e=t.input;if(e){this.queueForRemoval(t),e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,this.manager.resetCursor(e),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&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,s}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,s=this._eventContainer;n.cancelled=!1;for(var r=!1,o=0;o0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var a=[];for(i=0;i1&&(this.sortGameObjects(a),this.topOnly&&a.splice(1)),this._drag[t.id]=a,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&h(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)}return s.length}if(5===t.dragState){for(s=this._drag[t.id],i=0;i0){for(this.sortGameObjects(s),e=0;e0){for(this.sortGameObjects(r),e=0;e-1&&this._draggable.splice(s,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return a(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,s=!1,r=!1,a=!1;if(p(e)){var h=e;e=d(h,"hitArea",null),i=d(h,"hitAreaCallback",null),n=d(h,"draggable",!1),s=d(h,"dropZone",!1),r=d(h,"cursor",!1),a=d(h,"useHandCursor",!1);var l=d(h,"pixelPerfect",!1),u=d(h,"alphaTolerance",1);l&&(e={},i=this.makePixelPerfect(u)),e&&i||this.setHitAreaFromTexture(t)}else"function"!=typeof e||i||(i=e,e={});for(var c=0;c0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)e.x&&t.ye.y}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},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,i){var n=Math.min(t.x,e),s=Math.max(t.right,e);t.x=n,t.width=s-n;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},function(t,e){t.exports=function(t,e){var i=Math.min(t.x,e.x),n=Math.max(t.right,e.right);t.x=i,t.width=n-i;var s=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=s,t.height=r-s,t}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;on(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,i){var n=i(145);t.exports=function(t,e){var i=n(t);return ii&&(i=h.x),h.xr&&(r=h.y),h.ye.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(69),s=i(107);t.exports=function(t,e){return!!(n(t,e.getPointA())||n(t,e.getPointB())||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},function(t,e,i){var n=i(272),s=i(69);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottomt.right+r||it.bottom+r||st.right||e.rightt.bottom||e.bottom0}},function(t,e,i){var n=i(271);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){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(9),s=i(148);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=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(52);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){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(9);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){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(89);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,i){var n=i(89);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(90);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(90);n.Area=i(712),n.Circumference=i(306),n.CircumferencePoint=i(156),n.Clone=i(711),n.Contains=i(89),n.ContainsPoint=i(710),n.ContainsRect=i(709),n.CopyFrom=i(708),n.Equals=i(707),n.GetBounds=i(706),n.GetPoint=i(308),n.GetPoints=i(307),n.Offset=i(705),n.OffsetPoint=i(704),n.Random=i(185),t.exports=n},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(9);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){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e,i){var n=i(40);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,i){var n=i(40);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(71);t.exports=function(t){return new n(t.x,t.y,t.radius)}},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(71);n.Area=i(722),n.Circumference=i(402),n.CircumferencePoint=i(192),n.Clone=i(721),n.Contains=i(40),n.ContainsPoint=i(720),n.ContainsRect=i(719),n.CopyFrom=i(718),n.Equals=i(717),n.GetBounds=i(716),n.GetPoint=i(405),n.GetPoints=i(403),n.Offset=i(715),n.OffsetPoint=i(714),n.Random=i(191),t.exports=n},function(t,e,i){var n=i(0),s=i(275),r=i(15),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(28),s=i(13),r=i(12),o=i(149);s.register("quad",function(t,e){void 0===t&&(t={});var i=r(t,"x",0),s=r(t,"y",0),a=r(t,"key",null),h=r(t,"frame",null),l=new o(this.scene,i,s,a,h);return void 0!==e&&(t.add=e),n(this.scene,l,t),l})},function(t,e,i){var n=i(28),s=i(13),r=i(12),o=i(4),a=i(108);s.register("mesh",function(t,e){void 0===t&&(t={});var i=r(t,"key",null),s=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"colors",[]),u=o(t,"alphas",[]),c=o(t,"uv",[]),d=new a(this.scene,0,0,h,c,l,u,i,s);return void 0!==e&&(t.add=e),n(this.scene,d,t),d})},function(t,e,i){var n=i(149);i(5).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(108);i(5).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){t.exports=function(){}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=this.pipeline;t.setPipeline(o,e);var a=o._tempMatrix1,h=o._tempMatrix2,l=o._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(s.matrix),r?(a.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l)):(h.e-=s.scrollX*e.scrollFactorX,h.f-=s.scrollY*e.scrollFactorY,a.multiply(h,l));var u=e.frame.glTexture,c=e.vertices,d=e.uv,f=e.colors,p=e.alphas,g=c.length,v=Math.floor(.5*g);o.vertexCount+v>=o.vertexCapacity&&o.flush(),o.setTexture2D(u,0);for(var y=o.vertexViewF32,m=o.vertexViewU32,x=o.vertexCount*o.vertexComponentCount-1,w=0,b=e.tintFill,T=0;T0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.fillColor,e.fillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,M=0;M0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.altFillColor,e.altFillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,M=0;M0){var L=o.strokeTint,F=n.getTintAppendFloatAlphaAndSwap(e.outlineFillColor,e.outlineFillAlpha*d);for(L.TL=F,L.TR=F,L.BL=F,L.BR=F,C=1;Cr;h--){for(l=0;l0&&r.maxLines1&&(d+=f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(4);t.exports=function(t,e){var i=e.width,s=e.height,r=Math.floor(i/2),o=Math.floor(s/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),l=n(e,"offset.x",0),u=n(e,"offset.y",0),c=n(e,"spacing.x",0),d=n(e,"spacing.y",0),f=n(e,"lineSpacing",0),p=n(e,"charsPerRow",null);null===p&&(p=t.sys.textures.getFrame(h).width/i)>a.length&&(p=a.length);for(var g=l,v=u,y={retroFont:!0,font:h,size:i,lineHeight:s+f,chars:{}},m=0,x=0;x?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(813),s=i(20),r={Parse:i(812)};r=s(!1,r,n),t.exports=r},function(t,e){t.exports=function(t,e,i,n,s){t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a,h,e.scaleX,e.scaleY,e.rotation,e.flipX,!e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r),t.setBlankTexture(!0)}},function(t,e,i){var n=i(1),s=i(1);n=i(816),s=i(815),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){t.exports={DeathZone:i(301),EdgeZone:i(300),RandomZone:i(297)}},function(t,e){t.exports=function(t,e,i,n,s){var r=e.emitters.list,o=r.length;if(0!==o){var a=t._tempMatrix1.copyFrom(n.matrix),h=t._tempMatrix2,l=t._tempMatrix3,u=t._tempMatrix4.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);a.multiply(u);var c=n.roundPixels,d=t.currentContext;d.save();for(var f=0;f0&&(X=X%T-T):X>T?X=T:X<0&&(X=T+X%T),null===C&&(C=new o(D+Math.cos(Y)*I,B+Math.sin(Y)*I,v),S.push(C),O+=.01);O<1+N;)b=X*O+Y,x=D+Math.cos(b)*I,w=B+Math.sin(b)*I,C.points.push(new r(x,w,v)),O+=.01;b=X+Y,x=D+Math.cos(b)*I,w=B+Math.sin(b)*I,C.points.push(new r(x,w,v));break;case n.FILL_RECT:u.setTexture2D(P),u.batchFillRect(p[++E],p[++E],p[++E],p[++E],f,c);break;case n.FILL_TRIANGLE:u.setTexture2D(P),u.batchFillTriangle(p[++E],p[++E],p[++E],p[++E],p[++E],p[++E],f,c);break;case n.STROKE_TRIANGLE:u.setTexture2D(P),u.batchStrokeTriangle(p[++E],p[++E],p[++E],p[++E],p[++E],p[++E],v,f,c);break;case n.LINE_TO:null!==C?C.points.push(new r(p[++E],p[++E],v)):(C=new o(p[++E],p[++E],v),S.push(C));break;case n.MOVE_TO:C=new o(p[++E],p[++E],v),S.push(C);break;case n.SAVE:a.push(f.copyToArray());break;case n.RESTORE:f.copyFromArray(a.pop());break;case n.TRANSLATE:D=p[++E],B=p[++E],f.translate(D,B);break;case n.SCALE:D=p[++E],B=p[++E],f.scale(D,B);break;case n.ROTATE:f.rotate(p[++E]);break;case n.SET_TEXTURE:var U=p[++E],V=p[++E];u.currentFrame=U,u.setTexture2D(U.glTexture,0),u.tintEffect=V,P=U.glTexture;break;case n.CLEAR_TEXTURE:u.currentFrame=t.blankTexture,u.tintEffect=2,P=t.blankTexture.glTexture}}}},function(t,e,i){var n=i(1),s=i(1);n=i(830),s=i(305),s=i(305),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(22);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length,h=t.currentContext;if(0!==a&&n(t,h,e,s,r)){var l=e.frame,u=e.displayCallback,c=s.scrollX*e.scrollFactorX,d=s.scrollY*e.scrollFactorY,f=e.fontData.chars,p=e.fontData.lineHeight,g=0,v=0,y=0,m=0,x=null,w=0,b=0,T=0,S=0,_=0,A=0,C=null,M=0,P=e.frame.source.image,E=l.cutX,k=l.cutY,L=0,F=e.fontSize/e.fontData.size;e.cropWidth>0&&e.cropHeight>0&&(h.save(),h.beginPath(),h.rect(0,0,e.cropWidth,e.cropHeight),h.clip());for(var R=0;R0&&e.cropHeight>0&&h.restore(),h.restore()}}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length;if(0!==a){var h=this.pipeline;t.setPipeline(h,e);var l=e.cropWidth>0||e.cropHeight>0;l&&(h.flush(),t.pushScissor(e.x,e.y,e.cropWidth*e.scaleX,e.cropHeight*e.scaleY));var u=h._tempMatrix1,c=h._tempMatrix2,d=h._tempMatrix3,f=h._tempMatrix4;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(s.matrix),r?(u.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d)):(c.e-=s.scrollX*e.scrollFactorX,c.f-=s.scrollY*e.scrollFactorY,u.multiply(c,d));var p=e.frame,g=p.glTexture,v=p.cutX,y=p.cutY,m=g.width,x=g.height,w=e._isTinted&&e.tintFill,b=n.getTintAppendFloatAlpha(e._tintTL,s.alpha*e._alphaTL),T=n.getTintAppendFloatAlpha(e._tintTR,s.alpha*e._alphaTR),S=n.getTintAppendFloatAlpha(e._tintBL,s.alpha*e._alphaBL),_=n.getTintAppendFloatAlpha(e._tintBR,s.alpha*e._alphaBR);h.setTexture2D(g,0);var A,C,M=0,P=0,E=0,k=0,L=e.letterSpacing,F=0,R=0,O=0,D=0,B=e.scrollX,I=e.scrollY,Y=e.fontData,X=Y.chars,z=Y.lineHeight,N=e.fontSize/Y.size,U=0,V=e._align,G=0,W=0;e.getTextBounds(!1);var H=e._bounds.lines;1===V?W=(H.longest-H.lengths[0])/2:2===V&&(W=H.longest-H.lengths[0]);for(var j=s.roundPixels,q=e.displayCallback,K=e.callbackData,J=0;Jv&&(r=v),o>y&&(o=y);var k=v+g.xAdvance,L=y+u;aA&&(A=M),M<_&&(_=M),C++,M=0;S[C]=M,M>A&&(A=M),M<_&&(_=M);var F=i.local,R=i.global,O=i.lines;return F.x=r*m,F.y=o*m,F.width=a*m,F.height=h*m,R.x=t.x-t.displayOriginX+r*x,R.y=t.y-t.displayOriginY+o*w,R.width=a*x,R.height=h*w,O.shortest=_,O.longest=A,O.lengths=S,e&&(F.x=Math.round(F.x),F.y=Math.round(F.y),F.width=Math.round(F.width),F.height=Math.round(F.height),R.x=Math.round(R.x),R.y=Math.round(R.y),R.width=Math.round(R.width),R.height=Math.round(R.height),O.shortest=Math.round(_),O.longest=Math.round(A)),i}},function(t,e,i){var n=i(0),s=i(15),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.systems.events.once("destroy",this.destroy,this)},start:function(){var t=this.systems.events;t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.once("shutdown",this.shutdown,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;i0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e),s=t.indexOf(i);return-1!==n&&-1===s&&(t[n]=i,!0)}},function(t,e,i){var n=i(91);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return n(t,s)}},function(t,e,i){var n=i(62);t.exports=function(t,e,i,s,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(s)for(var h=0;ht.length-1)throw new Error("Index out of bounds");var r=n(t,e);return i&&i.call(s,r),r}},function(t,e,i){var n=i(314);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var s=[],r=Math.max(n((e-t)/(i||1)),0),o=0;o=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var n=t[i-1],s=t.indexOf(n);t[i]=n,t[s]=e}return t}},function(t,e,i){var n=i(62);t.exports=function(t,e,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=t.length),n(t,s,r))for(var o=s;o0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),s&&s.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),s&&s.call(r,l)}return e}},function(t,e){t.exports=function(t,e,i,n,s){if(void 0===s&&(s=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(s,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.pop(),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;a0||!this.inFocus)&&(this._coolDown--,r=Math.min(r,this._target)),r>this._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var o=0,a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),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){var i=0,n=function(t,e,n,s){var r=i-s.y-s.height;t.add(n,e,s.x,r,s.width,s.height)};t.exports=function(t,e,s){var r=t.source[e];t.add("__BASE",e,0,0,r.width,r.height),i=r.height;for(var o=s.split("\n"),a=/^[ ]*(- )*(\w+)+[: ]+(.*)/,h="",l="",u={x:0,y:0,width:0,height:0},c=0;cx||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var C=l,M=l,P=0,E=e.sourceIndex,k=0;kg||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,l-x),(v+=h+p)+h>r&&(v=f,y+=l+p)}return t}},function(t,e,i){var n=i(63);t.exports=function(t,e,i){if(i.frames){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);var r,o=i.frames;for(var a in o){var h=o[a];r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h),h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted()),r.customData=n(h)}for(var l in i)"frames"!==l&&(Array.isArray(i[l])?t.customData[l]=i[l].slice(0):t.customData[l]=i[l]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},function(t,e,i){var n=i(63);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;a=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,i){var n=i(92),s=i(118),r={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=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(0),s=i(26),r=i(340),o=i(2),a=i(4),h=i(8),l=i(16),u=i(1),c=i(167),d=i(178),f=new n({initialize:function(t){void 0===t&&(t={});this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.resolution=a(t,"resolution",1),this.parent=a(t,"parent",null),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!1),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.resolution=a(e,"resolution",this.resolution),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"mode",this.expandParent),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",s.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),l.RND.init(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMouseCapture=a(t,"input.mouse.capture",!0),this.inputTouch=a(t,"input.touch",r.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio"),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.autoResize=a(i,"autoResize",!0),this.antialias=a(i,"antialias",!0),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",!1),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.preserveDrawingBuffer=a(i,"preserveDrawingBuffer",!1),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",2e3),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",u),this.postBoot=a(t,"callbacks.postBoot",u),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path",""),this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),p=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?p=f.default:Array.isArray(f.defaultMerge)&&(p=p.concat(f.defaultMerge)))),this.defaultPlugins=p;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=s.WEBGL:window.FORCE_CANVAS&&(this.renderType=s.CANVAS))}});t.exports=f},function(t,e,i){var n=i(169),s=i(381),r=i(379),o=i(24),a=i(0),h=i(903),l=i(898),u=i(123),c=i(891),d=i(340),f=i(344),p=i(11),g=i(338),v=i(15),y=i(331),m=i(329),x=i(325),w=i(318),b=i(878),T=i(877),S=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new p,this.anims=new s(this),this.textures=new w(this),this.cache=new r(this),this.registry=new u(this),this.input=new g(this,this.config),this.scene=new m(this,this.config.sceneConfig),this.device=d,this.sound=x.create(this),this.loop=new b(this,this.config.fps),this.plugins=new y(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isOver=!0,f(this.boot.bind(this))},boot:function(){v.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),l(this),c(this),n(this.canvas,this.config.parent),this.events.emit("boot"),this.events.once("texturesready",this.texturesReady,this)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit("ready"),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),T(this);var t=this.events;t.on("hidden",this.onHidden,this),t.on("visible",this.onVisible,this),t.on("blur",this.onBlur,this),t.on("focus",this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit("prestep",t,e),i.emit("step",t,e),this.scene.update(t,e),i.emit("poststep",t,e);var n=this.renderer;n.preRender(),i.emit("prerender",n,t,e),this.scene.render(n),n.postRender(),i.emit("postrender",n,t,e)},headlessStep:function(t,e){var i=this.events;i.emit("prestep",t,e),i.emit("step",t,e),this.scene.update(t,e),i.emit("poststep",t,e),i.emit("prerender"),i.emit("postrender")},onHidden:function(){this.loop.pause(),this.events.emit("pause")},onVisible:function(){this.loop.resume(),this.events.emit("resume")},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},resize:function(t,e){this.config.width=t,this.config.height=e,this.renderer.resize(t,e),this.input.resize(),this.scene.resize(t,e),this.events.emit("resize",t,e)},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.events.emit("destroy"),this.events.removeAllListeners(),this.scene.destroy(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=S},function(t,e,i){var n=i(0),s=i(11),r=i(15),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){t.exports={EventEmitter:i(905)}},function(t,e){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,l=[],u=!1,c=-1;function d(){u&&h&&(u=!1,h.length?l=h.concat(l):c=-1,l.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=l.length;e;){for(h=l,l=[];++c1)for(var i=1;i>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e){t.exports=function(t,e){void 0===e&&(e="none");return["-webkit-","-khtml-","-moz-","-ms-",""].forEach(function(i){t.style[i+"user-select"]=e}),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},function(t,e,i){t.exports={CanvasInterpolation:i(348),CanvasPool:i(24),Smoothing:i(120),TouchAction:i(917),UserSelect:i(916)}},function(t,e){t.exports=function(t){return t.height*t.originY}},function(t,e){t.exports=function(t){return t.width*t.originX}},function(t,e,i){t.exports={CenterOn:i(411),GetBottom:i(48),GetCenterX:i(75),GetCenterY:i(72),GetLeft:i(46),GetOffsetX:i(920),GetOffsetY:i(919),GetRight:i(44),GetTop:i(42),SetBottom:i(47),SetCenterX:i(74),SetCenterY:i(73),SetLeft:i(45),SetRight:i(43),SetTop:i(41)}},function(t,e,i){var n=i(44),s=i(42),r=i(47),o=i(43);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(46),s=i(42),r=i(47),o=i(45);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)-a),t}},function(t,e,i){var n=i(75),s=i(42),r=i(47),o=i(74);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(44),s=i(42),r=i(45),o=i(41);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(72),s=i(44),r=i(73),o=i(45);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(48),s=i(44),r=i(47),o=i(45);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(42),r=i(43),o=i(41);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(72),s=i(46),r=i(73),o=i(43);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(48),s=i(46),r=i(47),o=i(43);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(48),s=i(44),r=i(43),o=i(41);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){var n=i(48),s=i(46),r=i(45),o=i(41);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)+a),t}},function(t,e,i){var n=i(48),s=i(75),r=i(74),o=i(41);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){t.exports={BottomCenter:i(933),BottomLeft:i(932),BottomRight:i(931),LeftBottom:i(930),LeftCenter:i(929),LeftTop:i(928),RightBottom:i(927),RightCenter:i(926),RightTop:i(925),TopCenter:i(924),TopLeft:i(923),TopRight:i(922)}},function(t,e,i){t.exports={BottomCenter:i(415),BottomLeft:i(414),BottomRight:i(413),Center:i(412),LeftCenter:i(410),QuickSet:i(416),RightCenter:i(409),TopCenter:i(408),TopLeft:i(407),TopRight:i(406)}},function(t,e,i){var n=i(193),s=i(20),r={In:i(935),To:i(934)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Align:i(936),Bounds:i(921),Canvas:i(918),Color:i(347),Masks:i(909)}},function(t,e,i){var n=i(0),s=i(123),r=i(15),o=new n({Extends:s,initialize:function(t){s.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once("boot",this.boot,this),t.sys.events.on("start",this.start,this)},boot:function(){this.events=this.systems.events,this.events.once("destroy",this.destroy,this)},start:function(){this.events.once("shutdown",this.shutdown,this)},shutdown:function(){this.systems.events.off("shutdown",this.shutdown,this)},destroy:function(){s.prototype.destroy.call(this),this.events.off("start",this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",o,"data"),t.exports=o},function(t,e,i){t.exports={DataManager:i(123),DataManagerPlugin:i(938)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e){this.active=!1,this.p0=new s(t,e)},getPoint:function(t,e){return void 0===e&&(e=new s),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},function(t,e,i){var n=i(0),s=i(355),r=i(353),o=i(5),a=i(352),h=i(940),l=i(351),u=i(9),c=i(349),d=i(3),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,n),h=new d(r,o),l=new d(t,e)),this.add(new s(u,a,h,l))},quadraticBezierTo:function(t,e,i,n){var s,r,o=this.getEndPoint();return t instanceof d?(s=t,r=e):(s=new d(i,n),r=new d(t,e)),this.add(new l(o,s,r))},draw:function(t,e){for(var i=0;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;e0&&(h.preRender(r,o),t.render(n,e,i,h))}},resetAll:function(){for(var t=0;t=1?1:1/e*(1+(e*t|0))}},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){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:1-Math.cos(t*Math.PI/2)}},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--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return t*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 1- --t*t*t*t}},function(t,e){t.exports=function(t){return t*t*t*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*(2-t)}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return 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 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},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,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),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},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){return--t*t*t+1}},function(t,e){t.exports=function(t){return t*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 Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},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 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){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,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,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e,i){var n=i(23),s=i(0),r=i(3),o=i(174),a=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new r,this.current=new r,this.destination=new r,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,a){void 0===i&&(i=1e3),void 0===n&&(n=o.Linear),void 0===s&&(s=!1),void 0===r&&(r=null),void 0===a&&(a=this.camera.scene);var h=this.camera;return!s&&this.isRunning?h:(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(h.scrollX,h.scrollY),this.destination.set(t,e),h.getScroll(t,e,this.current),"string"==typeof n&&o.hasOwnProperty(n)?this.ease=o[n]:"function"==typeof n&&(this.ease=n),this._elapsed=0,this._onUpdate=r,this._onUpdateScope=a,this.camera.emit("camerapanstart",this.camera,this,i,t,e),h)},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var s=this.camera;if(this._elapsed0?(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){var n=i(0),s=i(4),r=new n({initialize:function(t){this.camera=s(t,"camera",null),this.left=s(t,"left",null),this.right=s(t,"right",null),this.up=s(t,"up",null),this.down=s(t,"down",null),this.zoomIn=s(t,"zoomIn",null),this.zoomOut=s(t,"zoomOut",null),this.zoomSpeed=s(t,"zoomSpeed",.01),this.speedX=0,this.speedY=0;var e=s(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=s(t,"speed.x",0),this.speedY=s(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoom<.1&&(e.zoom=.1)):this.zoomOut&&this.zoomOut.isDown&&(e.zoom+=this.zoomSpeed)}},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={FixedKeyControl:i(989),SmoothedKeyControl:i(988)}},function(t,e,i){t.exports={Controls:i(990),Scene2D:i(987)}},function(t,e,i){t.exports={BaseCache:i(380),CacheManager:i(379)}},function(t,e,i){t.exports={Animation:i(384),AnimationFrame:i(382),AnimationManager:i(381)}},function(t,e,i){var n=i(53);t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=0;s1)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?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,_isTinted:!1,tintFill:!1,clearTint:function(){return this.setTint(16777215),this._isTinted=!1,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._isTinted=!0,this.tintFill=!1,this},setTintFill:function(t,e,i,n){return this.setTint(t,e,i,n),this.tintFill=!0,this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t),this._isTinted=!0}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t),this._isTinted=!0}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t),this._isTinted=!0}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t),this._isTinted=!0}},tint:{set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){return this._isTinted}}};t.exports=n},function(t,e){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},function(t,e){var i={texture:null,frame:null,isCropped:!1,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),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,i){var n=i(94),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={_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(9),s=i(396),r=i(3),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,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getTopRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomLeft:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBounds:function(t){var e,i,s,r,o,a,h,l;if(void 0===t&&(t=new n),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),s=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),s=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),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){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){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},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}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},function(t,e,i){var n=i(416),s=i(193),r=i(2),o=i(1),a=new(i(125))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1);t.exports=function(t,e){void 0===e&&(e={});var i=r(e,"width",-1),o=r(e,"height",-1),h=r(e,"cellWidth",1),l=r(e,"cellHeight",h),u=r(e,"position",s.TOP_LEFT),c=r(e,"x",0),d=r(e,"y",0),f=0,p=0,g=i*h,v=o*l;a.setPosition(c,d),a.setSize(h,l);for(var y=0;y>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionstart",e,i,n)}),d.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)}),d.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&&p.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&&p.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(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 p.add(this.localWorld,o),o},add:function(t){return p.add(this.localWorld,t),this},remove:function(t,e){var i=t.body?t.body:t;return o.removeBody(this.localWorld,i,e),this},removeConstraint:function(t,e){return o.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;i1?1:0;r1?1:0;s0&&u.trigger(t,"collisionStart",{pairs:w.collisionStart}),o.preSolvePosition(w.list),s=0;s0&&u.trigger(t,"collisionActive",{pairs:w.collisionActive}),w.collisionEnd.length>0&&u.trigger(t,"collisionEnd",{pairs:w.collisionEnd}),h.update(t.metrics,t),n._bodiesClearForces(y),u.trigger(t,"afterUpdate",v),t},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;sf.friction*f.frictionStatic*O*i&&(B=L,D=o.clamp(f.friction*F*i,-B,B));var I=r.cross(_,y),Y=r.cross(A,y),X=w/(g.inverseMass+v.inverseMass+g.inverseInertia*I*I+v.inverseInertia*Y*Y);if(R*=X,D*=X,E<0&&E*E>n._restingThresh*i)T.normalImpulse=0;else{var z=T.normalImpulse;T.normalImpulse=Math.min(T.normalImpulse+R,0),R=T.normalImpulse-z}if(k*k>n._restingThreshTangent*i)T.tangentImpulse=0;else{var N=T.tangentImpulse;T.tangentImpulse=o.clamp(T.tangentImpulse+D,-B,B),D=T.tangentImpulse-N}s.x=y.x*R+m.x*D,s.y=y.y*R+m.y*D,g.isStatic||g.isSleeping||(g.positionPrev.x+=s.x*g.inverseMass,g.positionPrev.y+=s.y*g.inverseMass,g.anglePrev+=r.cross(_,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(A,s)*v.inverseInertia)}}}}},function(t,e,i){var n={};t.exports=n;var s=i(418),r=i(33);n._pairMaxIdleLife=1e3,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;an._pairMaxIdleLife&&l.push(o);for(o=0;ou.bounds.max.x||p.bounds.max.yu.bounds.max.y)){var g=n._getRegion(t,p);if(!p.region||g.id!==p.region.id||s){f.broadphaseTests+=1,p.region&&!s||(p.region=g);var v=n._regionUnion(g,p.region);for(o=v.startCol;o<=v.endCol;o++)for(a=v.startRow;a<=v.endRow;a++){h=c[l=n._getBucketId(o,a)];var y=o>=g.startCol&&o<=g.endCol&&a>=g.startRow&&a<=g.endRow,m=o>=p.region.startCol&&o<=p.region.endCol&&a>=p.region.startRow&&a<=p.region.endRow;!y&&m&&m&&h&&n._bucketRemoveBody(t,h,p),(p.region===g||y&&!m||s)&&(h||(h=n._createBucket(c,l)),n._bucketAddBody(t,h,p))}p.region=g,d=!0}}}d&&(t.pairsList=n._createActivePairsList(t))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},n._regionUnion=function(t,e){var i=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 n._createRegion(i,s,r,o)},n._getRegion=function(t,e){var i=e.bounds,s=Math.floor(i.min.x/t.bucketWidth),r=Math.floor(i.max.x/t.bucketWidth),o=Math.floor(i.min.y/t.bucketHeight),a=Math.floor(i.max.y/t.bucketHeight);return n._createRegion(s,r,o,a)},n._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},n._getBucketId=function(t,e){return"C"+t+"R"+e},n._createBucket=function(t,e){return t[e]=[]},n._bucketAddBody=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(500),r=i(33);n.name="matter-js",n.version="0.14.2",n.uses=[],n.used=[],n.use=function(){s.use(n,Array.prototype.slice.call(arguments))},n.before=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathBefore(n,t,e)},n.after=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathAfter(n,t,e)}},function(t,e,i){var n=i(427),s=i(0),r=i(419),o=i(19),a=i(2),h=i(186),l=i(61),u=i(3),c=new s({Extends:l,Mixins:[r.Bounce,r.Collision,r.Force,r.Friction,r.Gravity,r.Mass,r.Sensor,r.SetBody,r.Sleep,r.Static,r.Transform,r.Velocity,h],initialize:function(t,e,i,s,r,h){o.call(this,t.scene,"Image"),this.anims=new n(this),this.setTexture(s,r),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new u(e,i);var l=a(h,"shape",null);l?this.setBody(l,h):this.setRectangle(this.width,this.height,h),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=c},function(t,e,i){var n=i(0),s=i(419),r=i(19),o=i(2),a=i(87),h=i(186),l=i(3),u=new n({Extends:a,Mixins:[s.Bounce,s.Collision,s.Force,s.Friction,s.Gravity,s.Mass,s.Sensor,s.SetBody,s.Sleep,s.Static,s.Transform,s.Velocity,h],initialize:function(t,e,i,n,s,a){r.call(this,t.scene,"Image"),this.setTexture(n,s),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new l(e,i);var h=o(a,"shape",null);h?this.setBody(h,a):this.setRectangle(this.width,this.height,a),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=u},function(t,e,i){var n={};t.exports=n;var s=i(137),r=i(194),o=i(33),a=i(67),h=i(126);n.stack=function(t,e,i,n,r,o,h){for(var l,u=s.create({label:"Stack"}),c=t,d=e,f=0,p=0;pg&&(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;l=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 F=0;FA&&(A+=e.length),_=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},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var n=t[i],s=i-1;s>=0;--s)S(n,t[s],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);return!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),!0)}};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))r.ACTIVE&&c(this,t,e))},setCollidesNever:function(t){for(var e=0;e1)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 w=Math.floor((e+v)/f);if((l>0||u===w||w<0||w>=p)&&(w=-1),u>=0&&u1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,w,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 b=s>0?o:0,T=s<0?f:0,S=Math.max(Math.floor(t.pos.x/f),0),_=Math.min(Math.ceil((t.pos.x+r)/f),p);c=Math.floor((t.pos.y+b)/f);var A=Math.floor((i+b)/f);if((l>0||c===A||A<0||A>=g)&&(A=-1),c>=0&&c1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,u,A));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-b+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),w=g/x,b=-p/x,T=y*w+m*b,S=w*T,_=b*T;return S*S+_*_>=s*s+r*r?v||p*(m-r)-g*(y-s)<.5:(t.pos.x=i+s-S,t.pos.y=n+r-_,t.collision.slope={x:p,y:g,nx:w,ny:b},!0)}return!1}});t.exports=r},function(t,e,i){var n=i(0),s=i(224),r=i(1124),o=i(223),a=i(1123),h=new n({initialize:function(t,e,i,n,r){void 0===n&&(n=16),void 0===r&&(r=n),this.world=t,this.gameObject=null,this.enabled=!0,this.parent,this.id=t.getNextID(),this.name="",this.size={x:n,y:r},this.offset={x:0,y:0},this.pos={x:e,y:i},this.last={x:e,y:i},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:t.defaults.maxVelocityX,y:t.defaults.maxVelocityY},this.standing=!1,this.gravityFactor=t.defaults.gravityFactor,this.bounciness=t.defaults.bounciness,this.minBounceVelocity=t.defaults.minBounceVelocity,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER,this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.updateCallback,this.slopeStanding={min:.767944870877505,max:2.3736477827122884}},reset:function(t,e){this.pos={x:t,y:e},this.last={x:t,y:e},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:100,y:100},this.standing=!1,this.gravityFactor=1,this.bounciness=0,this.minBounceVelocity=40,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER},update:function(t){var e=this.pos;this.last.x=e.x,this.last.y=e.y,this.vel.y+=this.world.gravity*t*this.gravityFactor,this.vel.x=r(t,this.vel.x,this.accel.x,this.friction.x,this.maxVel.x),this.vel.y=r(t,this.vel.y,this.accel.y,this.friction.y,this.maxVel.y);var i=this.vel.x*t,n=this.vel.y*t,s=this.world.collisionMap.trace(e.x,e.y,i,n,this.size.x,this.size.y);this.handleMovementTrace(s)&&a(this,s);var o=this.gameObject;o&&(o.x=e.x-this.offset.x+o.displayOriginX*o.scaleX,o.y=e.y-this.offset.y+o.displayOriginY*o.scaleY),this.updateCallback&&this.updateCallback(this)},drawDebug:function(t){var e=this.pos;if(this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.size.x,this.size.y)),this.debugShowVelocity){var i=e.x+this.size.x/2,n=e.y+this.size.y/2;t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.vel.x,n+this.vel.y)}},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},skipHash:function(){return!this.enabled||0===this.type&&0===this.checkAgainst&&0===this.collides},touches:function(t){return!(this.pos.x>=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){t.exports={BitmapMaskPipeline:i(421),ForwardDiffuseLightPipeline:i(420),TextureTintPipeline:i(196)}},function(t,e,i){t.exports={Utils:i(10),WebGLPipeline:i(197),WebGLRenderer:i(423),Pipelines:i(1079),BYTE:0,SHORT:1,UNSIGNED_BYTE:2,UNSIGNED_SHORT:3,FLOAT:4}},function(t,e,i){t.exports={Canvas:i(425),WebGL:i(422)}},function(t,e,i){t.exports={CanvasRenderer:i(426),GetBlendModes:i(424),SetTransform:i(22)}},function(t,e,i){t.exports={Canvas:i(1082),Snapshot:i(1081),WebGL:i(1080)}},function(t,e,i){var n=i(501),s={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.13.1",silent:!0,install:function(t){t.after("Engine.update",function(){s.Engine.update(this)})},Engine:{update:function(t){for(var e=t.world,i=n.Composite.allBodies(e),r=n.Composite.allComposites(e),o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y0)for(var a=s+1;a1;if(!d||t!=d.x||e!=d.y){d&&n?(f=d.x,p=d.y):(f=0,p=0);var s={x:f+t,y:p+e};!n&&d||(d=s),g.push(s),y=f+t,m=p+e}},w=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":y=t.x,m=t.y;break;case"H":y=t.x;break;case"V":m=t.y}x(y,m,t.pathSegType)}};for(n._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i1?1:0;n0))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){t.exports=function(t,e,i,n){var s=e.pos.x+e.size.x-i.pos.x;if(n){var r=e===n?i:e;n.vel.x=-n.vel.x*n.bounciness+r.vel.x;var o=t.collisionMap.trace(n.pos.x,n.pos.y,n===e?-s:s,0,n.size.x,n.size.y);n.pos.x=o.pos.x}else{var a=(e.vel.x-i.vel.x)/2;e.vel.x=-a,i.vel.x=a;var h=t.collisionMap.trace(e.pos.x,e.pos.y,-s/2,0,e.size.x,e.size.y);e.pos.x=Math.floor(h.pos.x);var l=t.collisionMap.trace(i.pos.x,i.pos.y,s/2,0,i.size.x,i.size.y);i.pos.x=Math.ceil(l.pos.x)}}},function(t,e,i){var n=i(224),s=i(1107),r=i(1106);t.exports=function(t,e,i){var o=null;e.collides===n.LITE||i.collides===n.FIXED?o=e:i.collides!==n.LITE&&e.collides!==n.FIXED||(o=i),e.last.x+e.size.x>i.last.x&&e.last.xi.last.y&&e.last.y0&&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&&o0?e-o:e+o<0?e+o:0}return n(e,-r,r)}},function(t,e,i){t.exports={Body:i(1077),COLLIDES:i(224),CollisionMap:i(1076),Factory:i(1075),Image:i(1073),ImpactBody:i(1074),ImpactPhysics:i(1109),Sprite:i(1072),TYPE:i(223),World:i(1071)}},function(t,e,i){t.exports={Arcade:i(528),Impact:i(1125),Matter:i(1105)}},function(t,e,i){(function(e){i(1059);var n=i(26),s=i(20),r={Actions:i(417),Animation:i(993),Cache:i(992),Cameras:i(991),Class:i(0),Create:i(948),Curves:i(942),Data:i(939),Display:i(937),DOM:i(908),Events:i(906),Game:i(904),GameObjects:i(876),Geom:i(274),Input:i(616),Loader:i(593),Math:i(570),Physics:i(1126),Plugins:i(498),Renderer:i(1083),Scene:i(328),Scenes:i(496),Sound:i(494),Structs:i(493),Textures:i(492),Tilemaps:i(490),Time:i(441),Tweens:i(439),Utils:i(435)};r=s(!1,r,n),t.exports=r,e.Phaser=r}).call(this,i(200))}])}); \ No newline at end of file +!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()}(window,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,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return 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=1363)}([function(t,e){function i(t,e,i){var n=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&n.value&&"object"==typeof n.value&&(n=n.value),!(!n||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(n))&&(void 0===n.enumerable&&(n.enumerable=!0),void 0===n.configurable&&(n.configurable=!0),n)}function n(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function s(t,e,s,r){for(var a in e)if(e.hasOwnProperty(a)){var h=i(e,a,s);if(!1!==h){if(n((r||t).prototype,a)){if(o.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=e[a]}}function r(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i0&&(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,n.RIGHT=new n(1,0),n.LEFT=new n(-1,0),n.UP=new n(0,-1),n.DOWN=new n(0,1),n.ONE=new n(1,1),t.exports=n},function(t,e){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o>>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;n=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=l},function(t,e,i){"use strict";var n=Object.prototype.hasOwnProperty,s="~";function r(){}function o(t,e,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new function(t,e,i){this.fn=t,this.context=e,this.once=i||!1}(i,n||t,r),a=s?s+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function h(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),h.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)n.call(t,e)&&i.push(s?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},h.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,r=i.length,o=new Array(r);no.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var u=[],c=e;c=400&&t.status<=599&&(n=!1),this.resetXHR(),this.loader.nextFile(this,n)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete))},onProcess:function(){this.state=s.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=s.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=s.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit(r.FILE_COMPLETE,e,i,t),this.loader.emit(r.FILE_KEY_COMPLETE+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});c.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},c.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=c},function(t,e){t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},function(t,e,i){var n,s,r,o=i(28),a=i(130),h=[],l=!1;t.exports={create2D:function(t,e,i){return n(t,e,i,o.CANVAS)},create:n=function(t,e,i,n,r){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=o.CANVAS),void 0===r&&(r=!1);var c=s(n);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:n},n===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),r&&(c.parent=u),u.width=e,u.height=i,l&&n===o.CANVAS&&a.disable(u.getContext("2d")),u},createWebGL:function(t,e,i){return n(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:s=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n={VERSION:"3.16.2",BlendModes:i(60),ScaleModes:i(101),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=n},function(t,e,i){var n=i(0),s=i(13),r=i(18),o=i(59),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScaleMode,s.ScrollFactor,s.Transform,s.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.initPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]}});t.exports=a},function(t,e,i){var n=i(60),s=i(12),r=i(101);t.exports=function(t,e,i){e.x=s(i,"x",0),e.y=s(i,"y",0),e.depth=s(i,"depth",0),e.flipX=s(i,"flipX",!1),e.flipY=s(i,"flipY",!1);var o=s(i,"scale",null);"number"==typeof o?e.setScale(o):null!==o&&(e.scaleX=s(o,"x",1),e.scaleY=s(o,"y",1));var a=s(i,"scrollFactor",null);"number"==typeof a?e.setScrollFactor(a):null!==a&&(e.scrollFactorX=s(a,"x",1),e.scrollFactorY=s(a,"y",1)),e.rotation=s(i,"rotation",0);var h=s(i,"angle",null);null!==h&&(e.angle=h),e.alpha=s(i,"alpha",1);var l=s(i,"origin",null);if("number"==typeof l)e.setOrigin(l);else if(null!==l){var u=s(l,"x",.5),c=s(l,"y",.5);e.setOrigin(u,c)}return e.scaleMode=s(i,"scaleMode",r.DEFAULT),e.blendMode=s(i,"blendMode",n.NORMAL),e.visible=s(i,"visible",!0),s(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},function(t,e){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e,i){var n=i(0),s=i(191),r=i(409),o=i(190),a=i(408),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=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,n)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=n,this._locked=!1,this.update(s)},setGLTo:function(t,e,i,n){return void 0===n&&(n=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=n,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,n=this.b,o=this.a;return this._color=s(e,i,n),this._color32=r(e,i,n,o),this._rgba="rgba("+e+","+i+","+n+","+o/255+")",t&&a(e,i,n,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t));return this.setTo(i,n,s)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,n=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),n=Math.max(0,Math.min(255,n-Math.round(-t/100*255))),this.setTo(e,i,n)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},function(t,e){t.exports=function(t,e,i){var n=i||e.fillColor,s=e.fillAlpha,r=(16711680&n)>>>16,o=(65280&n)>>>8,a=255&n;t.fillStyle="rgba("+r+","+o+","+a+","+s+")"}},function(t,e,i){var n=i(20);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e){t.exports=function(t,e,i,n,s,r){var o;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=s;o=0;o--)t[o][e]+=i+a*n,a++;return t}},function(t,e,i){(function(e){var i={};t.exports=i,function(){i._nextId=0,i._seed=0,i._nowStartTime=+new Date,i.extend=function(t,e){var n,s;"boolean"==typeof e?(n=2,s=e):(n=1,s=!0);for(var r=n;r0;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"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},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]"===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.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;i>>16,r=(65280&i)>>>8,o=255&i;t.strokeStyle="rgba("+s+","+r+","+o+","+n+")",t.lineWidth=e.lineWidth}},function(t,e,i){t.exports={DESTROY:i(1168),FADE_IN_COMPLETE:i(1167),FADE_IN_START:i(1166),FADE_OUT_COMPLETE:i(1165),FADE_OUT_START:i(1164),FLASH_COMPLETE:i(1163),FLASH_START:i(1162),PAN_COMPLETE:i(1161),PAN_START:i(1160),POST_RENDER:i(1159),PRE_RENDER:i(1158),SHAKE_COMPLETE:i(1157),SHAKE_START:i(1156),ZOOM_COMPLETE:i(1155),ZOOM_START:i(1154)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,n,s,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},scaleY:{get:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3];return n[0]=s*i+o*e,n[1]=r*i+a*e,n[2]=s*-e+o*i,n[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,s=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=n[0],c=n[1],d=n[2],f=n[3],p=n[4],g=n[5],v=void 0===e?this:e;return v.a=u*s+c*o,v.b=u*r+c*a,v.c=d*s+f*o,v.d=d*r+f*a,v.e=p*s+g*o+h,v.f=p*r+g*a+l,v},multiplyWithOffset:function(t,e,i){var n=this.matrix,s=t.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=e*r+i*a+n[4],u=e*o+i*h+n[5],c=s[0],d=s[1],f=s[2],p=s[3],g=s[4],v=s[5];return n[0]=c*r+d*a,n[1]=c*o+d*h,n[2]=f*r+p*a,n[3]=f*o+p*h,n[4]=g*r+v*a+l,n[5]=g*o+v*h+u,this},transform:function(t,e,i,n,s,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+n*l,o[3]=i*h+n*u,o[4]=s*a+r*l+c,o[5]=s*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,s=n[0],r=n[1],o=n[2],a=n[3],h=n[4],l=n[5];return i.x=t*s+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=e*s-i*n;return t[0]=s/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-s*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;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],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,s,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],s=e[2],r=e[3],o=i*r-n*s;if(t.translateX=e[4],t.translateY=e[5],i||n){var a=Math.sqrt(i*i+n*n);t.rotation=n>0?Math.acos(i/a):-Math.acos(i/a),t.scaleX=a,t.scaleY=o/a}else if(s||r){var h=Math.sqrt(s*s+r*r);t.rotation=.5*Math.PI-(r>0?Math.acos(-s/h):-Math.acos(s/h)),t.scaleX=o/h,t.scaleY=h}else t.rotation=0,t.scaleX=0,t.scaleY=0;return t},applyITRS:function(t,e,i,n,s){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*n,r[1]=o*n,r[2]=-o*s,r[3]=a*s,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=r*c*e+-o*c*t+(-u*r+l*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=r},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){t.exports=function(t,e,i){return t.radius>0&&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){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x+t.width-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports=function(t){return t.y+t.height-t.height*t.originY}},function(t,e,i){t.exports={BOOT:i(994),DESTROY:i(993),DRAG_END:i(992),DRAG_ENTER:i(991),DRAG:i(990),DRAG_LEAVE:i(989),DRAG_OVER:i(988),DRAG_START:i(987),DROP:i(986),GAME_OUT:i(985),GAME_OVER:i(984),GAMEOBJECT_DOWN:i(983),GAMEOBJECT_DRAG_END:i(982),GAMEOBJECT_DRAG_ENTER:i(981),GAMEOBJECT_DRAG:i(980),GAMEOBJECT_DRAG_LEAVE:i(979),GAMEOBJECT_DRAG_OVER:i(978),GAMEOBJECT_DRAG_START:i(977),GAMEOBJECT_DROP:i(976),GAMEOBJECT_MOVE:i(975),GAMEOBJECT_OUT:i(974),GAMEOBJECT_OVER:i(973),GAMEOBJECT_POINTER_DOWN:i(972),GAMEOBJECT_POINTER_MOVE:i(971),GAMEOBJECT_POINTER_OUT:i(970),GAMEOBJECT_POINTER_OVER:i(969),GAMEOBJECT_POINTER_UP:i(968),GAMEOBJECT_UP:i(967),MANAGER_BOOT:i(966),MANAGER_PROCESS:i(965),MANAGER_UPDATE:i(964),POINTER_DOWN:i(963),POINTER_DOWN_OUTSIDE:i(962),POINTER_MOVE:i(961),POINTER_OUT:i(960),POINTER_OVER:i(959),POINTER_UP:i(958),POINTER_UP_OUTSIDE:i(957),POINTERLOCK_CHANGE:i(956),PRE_UPDATE:i(955),SHUTDOWN:i(954),START:i(953),UPDATE:i(952)}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(void 0===i&&(i=r.scene.cameras.main),t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e,i){var n=i(0),s=i(15),r=i(22),o=i(7),a=i(2),h=i(4),l=i(8),u=new n({Extends:r,initialize:function(t,e,i,n,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:n,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=s.FILE_POPULATED)},onProcess:function(){if(this.state!==s.FILE_POPULATED){this.state=s.FILE_PROCESSING;var t=JSON.parse(this.xhrLoader.responseText),e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;sthis.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=h},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,ERASE:17,SOURCE_IN:18,SOURCE_OUT:19,SOURCE_ATOP:20,DESTINATION_OVER:21,DESTINATION_IN:22,DESTINATION_OUT:23,DESTINATION_ATOP:24,LIGHTER:25,COPY:26,XOR:27}},function(t,e,i){var n=i(0),s=i(13),r=i(270),o=new n({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.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},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.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return 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=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.loader=t,this.type=e,this.key=i,this.files=n,this.complete=!1,this.pending=n.length,this.failed=0,this.config={};for(var s=0;s=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=l},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=t.strokeTint,a=n.getTintAppendFloatAlphaAndSwap(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-s,f=h[1]-r;e.closePath||(l-=2);for(var p=2;ps||e>=i||i>s||e+i>s){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},function(t,e,i){t.exports={COMPLETE:i(932),DESTROY:i(931),DETUNE:i(930),GLOBAL_DETUNE:i(929),GLOBAL_MUTE:i(928),GLOBAL_RATE:i(927),GLOBAL_VOLUME:i(926),LOOP:i(925),LOOPED:i(924),MUTE:i(923),PAUSE_ALL:i(922),PAUSE:i(921),PLAY:i(920),RATE:i(919),RESUME_ALL:i(918),RESUME:i(917),SEEK:i(916),STOP_ALL:i(915),STOP:i(914),UNLOCKED:i(913),VOLUME:i(912)}},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,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||m.next===m.prev)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 T=i;Th&&(h=u),f>l&&(l=f);g=0!==(g=Math.max(h-n,l-a))?1/g:0}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=b(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)break;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.prevZ,v=t.nextZ;p&&p.z>=c&&v&&v.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;if(p=p.prevZ,v!==t.prev&&v!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&y(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;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}for(;v&&v.z<=d;){if(v!==t.prev&&v!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&y(v.prev,v,v.next)>=0)return!1;v=v.nextZ}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)&&T(s,r)&&T(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)&&T(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)&&T(t,e)&&T(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 T(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 _(t.i,t.x,t.y),n=new _(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 _(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 _(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,i){var n={};t.exports=n;var s=i(82),r=i(87),o=i(238),a=i(36),h=i(86),l=i(546);!function(){n._inertiaScale=4,n._nextCollidingGroupId=1,n._nextNonCollidingGroupId=-1,n._nextCategory=1,n.create=function(e){var i={id:a.nextId(),type:"body",label:"Body",gameObject:null,parts:[],plugin:{},angle:0,vertices:s.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},previousPositionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,ignoreGravity:!1,ignorePointer:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0},lineWidth:0},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,_original:null},n=a.extend(i,e);return t(n,e),n},n.nextGroup=function(t){return t?n._nextNonCollidingGroupId--:n._nextCollidingGroupId++},n.nextCategory=function(){return n._nextCategory=n._nextCategory<<1,n._nextCategory};var t=function(t,e){e=e||{},n.set(t,{bounds:t.bounds||h.create(t.vertices),positionPrev:t.positionPrev||r.clone(t.position),anglePrev:t.anglePrev||t.angle,vertices:t.vertices,parts:t.parts||[t],isStatic:t.isStatic,isSleeping:t.isSleeping,parent:t.parent||t}),s.rotate(t.vertices,t.angle,t.position),l.rotate(t.axes,t.angle),h.update(t.bounds,t.vertices,t.velocity),n.set(t,{axes:e.axes||t.axes,area:e.area||t.area,mass:e.mass||t.mass,inertia:e.inertia||t.inertia});var i=t.isStatic?"#2e2b44":a.choose(["#006BA6","#0496FF","#FFBC42","#D81159","#8F2D56"]);t.render.fillStyle=t.render.fillStyle||i,t.render.strokeStyle=t.render.strokeStyle||"#000",t.render.sprite.xOffset+=-(t.bounds.min.x-t.position.x)/(t.bounds.max.x-t.bounds.min.x),t.render.sprite.yOffset+=-(t.bounds.min.y-t.position.y)/(t.bounds.max.y-t.bounds.min.y)};n.set=function(t,e,i){var s;for(s in"string"==typeof e&&(s=e,(e={})[s]=i),e)if(e.hasOwnProperty(s))switch(i=e[s],s){case"isStatic":n.setStatic(t,i);break;case"isSleeping":o.set(t,i);break;case"mass":n.setMass(t,i);break;case"density":n.setDensity(t,i);break;case"inertia":n.setInertia(t,i);break;case"vertices":n.setVertices(t,i);break;case"position":n.setPosition(t,i);break;case"angle":n.setAngle(t,i);break;case"velocity":n.setVelocity(t,i);break;case"angularVelocity":n.setAngularVelocity(t,i);break;case"parts":n.setParts(t,i);break;default:t[s]=i}},n.setStatic=function(t,e){for(var i=0;i0&&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,e,i,r){var o=0,a=0;r=r||t.position;for(var u=0;u0&&(o+=c.area,a+=c.inertia),c.position.x=r.x+(c.position.x-r.x)*e,c.position.y=r.y+(c.position.y-r.y)*i,h.update(c.bounds,c.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(n.setMass(t,t.density*o),n.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null)},n.update=function(t,e,i,n){var o=Math.pow(e*i*t.timeScale,2),a=1-t.frictionAir*i*t.timeScale,u=t.position.x-t.positionPrev.x,c=t.position.y-t.positionPrev.y;t.velocity.x=u*a*n+t.force.x/t.mass*o,t.velocity.y=c*a*n+t.force.y/t.mass*o,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*a*n+t.torque/t.inertia*o,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=r.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(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},n._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i=0&&y>=0&&v+y<1}},function(t,e,i){t.exports={ADD:i(945),COMPLETE:i(944),FILE_COMPLETE:i(943),FILE_KEY_COMPLETE:i(942),FILE_LOAD_ERROR:i(941),FILE_LOAD:i(940),FILE_PROGRESS:i(939),POST_PROCESS:i(938),PROGRESS:i(937),START:i(936)}},function(t,e,i){var n=i(0),s=i(180),r=i(10),o=i(3),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){var n=i(0),s=i(43),r=i(438),o=i(437),a=i(206),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){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},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,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e,i){var n={};t.exports=n;var s=i(87),r=i(36);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,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","map"),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.widthInPixels=s(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.tileHeight),this.format=s(t,"format",null),this.orientation=s(t,"orientation","orthogonal"),this.renderOrder=s(t,"renderOrder","right-down"),this.version=s(t,"version","1"),this.properties=s(t,"properties",{}),this.layers=s(t,"layers",[]),this.images=s(t,"images",[]),this.objects=s(t,"objects",{}),this.collision=s(t,"collision",{}),this.tilesets=s(t,"tilesets",[]),this.imageCollections=s(t,"imageCollections",[]),this.tiles=s(t,"tiles",[])}});t.exports=r},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","layer"),this.x=s(t,"x",0),this.y=s(t,"y",0),this.width=s(t,"width",0),this.height=s(t,"height",0),this.tileWidth=s(t,"tileWidth",0),this.tileHeight=s(t,"tileHeight",0),this.baseTileWidth=s(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=s(t,"baseTileHeight",this.tileHeight),this.widthInPixels=s(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=s(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=s(t,"alpha",1),this.visible=s(t,"visible",!0),this.properties=s(t,"properties",{}),this.indexes=s(t,"indexes",[]),this.collideIndexes=s(t,"collideIndexes",[]),this.callbacks=s(t,"callbacks",[]),this.bodies=s(t,"bodies",[]),this.data=s(t,"data",[]),this.tilemapLayer=s(t,"tilemapLayer",null)}});t.exports=r},function(t,e){t.exports=function(t,e,i){return t>=0&&t=0&&et.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){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,i){var n=i(9);t.exports=function(t,e,i,s,r,o){for(var a=n.getTintAppendFloatAlphaAndSwap(i.fillColor,i.fillAlpha*s),h=i.pathData,l=i.pathIndexes,u=0;u=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof s&&(l.x=s),"number"==typeof r&&(l.y=r),l):n?this.create(s,r,o,a,h):null},get:function(t,e,i,n,s){return this.getFirst(!1,!0,t,e,i,n,s)},getFirstAlive:function(t,e,i,n,s,r){return this.getFirst(!0,t,e,i,n,s,r)},getFirstDead:function(t,e,i,n,s,r){return this.getFirst(!1,t,e,i,n,s,r)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=t.length)){for(var i=t.length-1,n=t[e],s=e;s-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 t=this.firstgid&&t=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e,i){var n=i(0),s=i(13),r=i(18),o=i(753),a=i(1),h=new n({Extends:r,Mixins:[s.BlendMode,s.Depth,s.GetBounds,s.Mask,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"),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.lengthl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(a-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){for(var i=[null],n=2;n0?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=a},function(t,e,i){var n=i(0),s=i(23),r=i(19),o=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.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(r,o,n,s)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var s=this.data,r=s.cut;r.x=i,r.y=n,r.w=t,r.h=e,r.r=i+t,r.b=n+e,s.sourceSize.w=t,s.sourceSize.h=e,s.spriteSourceSize.w=t,s.spriteSourceSize.h=e,s.radius=.5*Math.sqrt(t*t+e*e);var o=s.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,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,a.r=i+s,a.b=n+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()},setCropUVs:function(t,e,i,n,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=s(e,0,d)),g=l+(i=s(i,0,f)),v=n=s(n,0,d-e),y=r=s(r,0,f-i),m=this.data;if(m.trim){var x=m.spriteSourceSize,T=e+(n=s(n,0,u-e)),w=i+(r=s(r,0,c-i));if(!(x.rT||x.y>w)){var b=Math.max(x.x,e),S=Math.max(x.y,i),_=Math.min(x.r,T)-b,A=Math.min(x.b,w)-S;v=_,y=A,p=o?h+(u-(b-x.x)-_):h+(b-x.x),g=a?l+(c-(S-x.y)-A):l+(S-x.y),e=b,i=S,n=_,r=A}else p=0,g=0,v=0,y=0}else o&&(p=h+(u-e-n)),a&&(g=l+(c-i-r));var E=this.source.width,C=this.source.height;return t.u0=Math.max(0,p/E),t.v0=Math.max(0,g/C),t.u1=Math.min(1,(p+v)/E),t.v1=Math.min(1,(g+y)/C),t.x=e,t.y=i,t.cx=p,t.cy=g,t.cw=v,t.ch=y,t.width=n,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(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=r(!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}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(0),s=i(11),r=i(69),o=i(19),a=i(1),h=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={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},this.currentConfig=this.config,this.config=o(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 "+t.name+" already exists in Sound"),!1):(t=o(!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]=o(!0,this.markers[t.name],t),!0):(console.warn("Audio Marker: "+t.name+" missing in 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!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in 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=o(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:a,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit(r.DESTROY,this),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)}});t.exports=h},function(t,e,i){var n=i(0),s=i(70),r=i(11),o=i(69),a=i(26),h=i(1),l=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on(a.BLUR,function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on(a.FOCUS,function(){this.pauseOnBlur&&this.onFocus()},this),t.events.on(a.PRE_STEP,this.update,this),t.events.once(a.DESTROY,this.destroy,this)},add:h,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var r=s(e),o=i.spritemap[n];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:r})}return i},play:function(t,e){var i=this.add(t);return i.once(o.COMPLETE,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(o.COMPLETE,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(o.PAUSE_ALL,this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit(o.RESUME_ALL,this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit(o.STOP_ALL,this)},unlock:h,onBlur:h,onFocus:h,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit(o.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)})},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit(o.GLOBAL_RATE,this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.calculateRate()}),this.emit(o.GLOBAL_DETUNE,this,t)}}});t.exports=l},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){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,NUMPAD_ZERO:96,NUMPAD_ONE:97,NUMPAD_TWO:98,NUMPAD_THREE:99,NUMPAD_FOUR:100,NUMPAD_FIVE:101,NUMPAD_SIX:102,NUMPAD_SEVEN:103,NUMPAD_EIGHT:104,NUMPAD_NINE:105,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,SEMICOLON_FIREFOX:59,COLON:58,COMMA_FIREFOX_WINDOWS:60,COMMA_FIREFOX:62,BRACKET_RIGHT_FIREFOX:174,BRACKET_LEFT_FIREFOX:175}},function(t,e,i){t.exports={ADD:i(1049),ERROR:i(1048),LOAD:i(1047),READY:i(1046),REMOVE:i(1045)}},function(t,e){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n,s=i(99),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=function(t,e,i){return(e-t)*i+t}},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;iC&&wA&&bs&&(t=s),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,s=Math.max(n,n+e.height-i);return ts&&(t=s),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=u(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,s){return void 0===s&&(s=!1),this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,s?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(t){void 0===t&&(t=new h);var e=this._bounds;return t.setTo(e.x,e.y,e.width,e.height),t},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){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.sceneManager=t.sys.game.scene,this.scaleManager=t.sys.scale;var e=this.scaleManager.resolution;return this.resolution=e,this._cx=this._x*e,this._cy=this._y*e,this._cw=this._width*e,this._ch=this._height*e,this.updateSystem(),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),0===t&&(t=.001),this.zoom=t,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},update:function(){},updateSystem:function(){if(this.scaleManager){var t=0!==this._x||0!==this._y||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit(a.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this._cx=t*this.resolution,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._cy=t*this.resolution,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this._cw=t*this.resolution,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this._ch=t*this.resolution,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoom}},displayHeight:{get:function(){return this.height/this.zoom}}});t.exports=d},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;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){t.exports={DESTROY:i(1234)}},function(t,e,i){var n=i(0),s=i(420),r=new n({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once("destroy",this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;n0&&s.area(_)1?(f=o.create(r.extend({parts:p.slice(0)},n)),o.setPosition(f,{x:t,y:e}),f):p[0]}},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(0),s=i(14),r=i(5),o=i(89),a=new n({initialize:function(t,e,i){this.parent=t,this.parentIsTimeline=t.hasOwnProperty("isTimeline"),this.data=e,this.totalData=e.length,this.targets=i,this.totalTargets=i.length,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.offset=0,this.calculatedOffset=0,this.state=o.PENDING_ADD,this._pausedState=o.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onRepeat:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},getValue:function(){return this.data[0].current},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===o.ACTIVE},isPaused:function(){return this.state===o.PAUSED},hasTarget:function(t){return-1!==this.targets.indexOf(t)},updateTo:function(t,e,i){void 0===i&&(i=!1);for(var n=0;n0&&(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)return this;this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;return 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)),this.parent.makeActive(this)),this},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.play(),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}return this},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}return this},stop:function(t){return this.state===o.ACTIVE&&void 0!==t&&this.seek(t),this.state!==o.REMOVED&&(this.state!==o.PAUSED&&this.state!==o.PENDING_ADD||(this.parent._destroy.push(this),this.parent._toProcess++),this.state=o.PENDING_REMOVE),this},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={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1}},function(t,e){function i(t){return!!t.getStart&&"function"==typeof t.getStart}function n(t){return!!t.getEnd&&"function"==typeof t.getEnd}var s=function(t,e){var r,o,a=function(t,e,i){return i},h=function(t,e,i){return i},l=typeof e;if("number"===l)a=function(){return e};else if("string"===l){var u=e[0],c=parseFloat(e.substr(2));switch(u){case"+":a=function(t,e,i){return i+c};break;case"-":a=function(t,e,i){return i-c};break;case"*":a=function(t,e,i){return i*c};break;case"/":a=function(t,e,i){return i/c};break;default:a=function(){return parseFloat(e)}}}else"function"===l?a=e:"object"===l&&(i(o=e)||n(o))?(n(e)&&(a=e.getEnd),i(e)&&(h=e.getStart)):e.hasOwnProperty("value")&&(r=s(t,e.value));return r||(r={getEnd:a,getStart:h}),r};t.exports=s},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"targets",null);return null===e?e:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(31),s=i(83),r=i(233),o=i(225);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",n.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new s({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},function(t,e,i){var n=i(31),s=i(84),r=i(83),o=i(61);t.exports=function(t,e,i,a,h){for(var l=new s({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:n.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;p=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){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(0),s=i(116),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()},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,t=this.frame,this.uv[0]=t.u0,this.uv[1]=t.v0,this.uv[2]=t.u0,this.uv[3]=t.v1,this.uv[4]=t.u1,this.uv[5]=t.v1,this.uv[6]=t.u0,this.uv[7]=t.v0,this.uv[8]=t.u1,this.uv[9]=t.v1,this.uv[10]=t.u1,this.uv[11]=t.v0,this},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){for(var n=!1,s=-1,r=t.points.length-1;++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],h0&&(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(h[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(h[p],o,a));return e.restore(),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),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&&c(this.canvas),s.remove(this.canvas),this.texture.destroy()}});t.exports=p},function(t,e,i){var n=i(60),s=i(131),r=i(24),o=i(0),a=i(13),h=i(28),l=i(121),u=i(18),c=i(840),d=i(9),f=i(299),p=new o({Extends:u,Mixins:[a.Alpha,a.BlendMode,a.ComputedSize,a.Crop,a.Depth,a.Flip,a.GetBounds,a.Mask,a.Origin,a.Pipeline,a.ScaleMode,a.ScrollFactor,a.Tint,a.Transform,a.Visible,c],initialize:function(t,e,i,n,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=32),void 0===o&&(o=32),u.call(this,t,"RenderTexture"),this.renderer=t.sys.game.renderer,this.textureManager=t.sys.textures,this.globalTint=16777215,this.globalAlpha=1,this.canvas=r.create2D(this,n,o),this.context=this.canvas.getContext("2d"),this.framebuffer=null,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(f(),this.canvas),this.frame=this.texture.get(),this._saved=!1,this._eraseMode=!1,this.camera=new s(0,0,n,o),this.dirty=!1,this.gl=null;var a=this.renderer;if(a.type===h.WEBGL){var l=a.gl;this.gl=l,this.drawGameObject=this.batchGameObjectWebGL,this.framebuffer=a.createFramebuffer(n,o,this.frame.source.glTexture,!1)}else a.type===h.CANVAS&&(this.drawGameObject=this.batchGameObjectCanvas);this.camera.setScene(t),this.setPosition(e,i),this.setSize(n,o),this.setOrigin(0,0),this.initPipeline()},setSize:function(t,e){return this.resize(t,e)},resize:function(t,e){if(void 0===e&&(e=t),t!==this.width||e!==this.height){if(this.canvas.width=t,this.canvas.height=e,this.gl){var i=this.gl;this.renderer.deleteTexture(this.frame.source.glTexture),this.renderer.deleteFramebuffer(this.framebuffer),this.frame.source.glTexture=this.renderer.createTexture2D(0,i.NEAREST,i.NEAREST,i.CLAMP_TO_EDGE,i.CLAMP_TO_EDGE,i.RGBA,null,t,e,!1),this.framebuffer=this.renderer.createFramebuffer(t,e,this.frame.source.glTexture,!1),this.frame.glTexture=this.frame.source.glTexture}this.frame.source.width=t,this.frame.source.height=e,this.camera.setSize(t,e),this.frame.setSize(t,e),this.width=t,this.height=e}return this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e){void 0===e&&(e=1);var i=255&(t>>16|0),n=255&(t>>8|0),s=255&(0|t);if(this.gl){var r=this.renderer,o=this.getBounds();r.setFramebuffer(this.framebuffer,!0),this.pipeline.drawFillRect(o.x,o.y,o.right,o.bottom,d.getTintFromFloats(i/255,n/255,s/255,1),e),r.setFramebuffer(null,!0)}else this.context.fillStyle="rgba("+i+","+n+","+s+","+e+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height);return this},clear:function(){if(this.dirty){var t=this.gl;if(t){var e=this.renderer;e.setFramebuffer(this.framebuffer,!0),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),e.setFramebuffer(null,!0)}else{var i=this.context;i.save(),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.restore()}this.dirty=!1}return this},erase:function(t,e,i){this._eraseMode=!0;var s=this.renderer.currentBlendMode;return this.renderer.setBlendMode(n.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(s),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.gl;if(this.camera.preRender(1,1),r){var o=this.camera._cx,a=this.camera._cy,h=this.camera._cw,l=this.camera._ch;this.renderer.setFramebuffer(this.framebuffer,!1),this.renderer.pushScissor(o,a,h,l,l);var u=this.pipeline;u.projOrtho(0,this.width,0,this.height,-1e3,1e3),this.batchList(t,e,i,n,s),u.flush(),this.renderer.setFramebuffer(null,!1),this.renderer.popScissor(),u.projOrtho(0,u.width,u.height,0,-1e3,1e3)}else this.renderer.setContext(this.context),this.batchList(t,e,i,n,s),this.renderer.setContext();return this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.gl,a=this.textureManager.getFrame(t,e);if(a){if(this.camera.preRender(1,1),o){var h=this.camera._cx,l=this.camera._cy,u=this.camera._cw,c=this.camera._ch;this.renderer.setFramebuffer(this.framebuffer,!1),this.renderer.pushScissor(h,l,u,c,c);var d=this.pipeline;d.projOrtho(0,this.width,0,this.height,-1e3,1e3),d.batchTextureFrame(a,i,n,r,s,this.camera.matrix,null),d.flush(),this.renderer.setFramebuffer(null,!1),this.renderer.popScissor(),d.projOrtho(0,d.width,d.height,0,-1e3,1e3)}else this.batchTextureFrame(a,i,n,s,r);this.dirty=!0}return this},batchList:function(t,e,i,n,s){for(var r=0;r0?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;s-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,o=r.game.renderer;if(void 0===e&&(e=r.scale.width),void 0===i&&(i=r.scale.height),T.TargetCamera.setScene(this.scene),T.TargetCamera.setViewport(0,0,e,i),T.TargetCamera.scrollX=this.x,T.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var a=(n=r.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(s=a.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(o,this,0,T.TargetCamera,null,s,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});T.TargetCamera=new n,t.exports=T},function(t,e,i){var n=i(117),s=i(0),r=i(860),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a){n.call(this,t,e,i,s,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={parent:this,color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(174),s=i(60),r=i(0),o=i(13),a=i(133),h=i(18),l=i(10),u=i(863),c=i(313),d=i(3),f=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.ScrollFactor,o.Transform,o.Visible,u],initialize:function(t,e,i,n){h.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._displayList=t.sys.displayList,this._sortKey="",this._sysEvents=t.sys.events,this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new l),t.setTo(this.x,this.y,0,0),this.list.length>0)for(var e=this.list,i=new l,n=0;n-1},setAll:function(t,e,i,s){return n.SetAll(this.list,t,e,i,s),this},each:function(t,e){var i,n=[null],s=this.list.slice(),r=s.length;for(i=2;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}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[],this._displayList=null}});t.exports=f},function(t,e,i){var n=i(867),s=i(864),r=i(0),o=i(13),a=i(121),h=i(18),l=i(120),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,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(),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},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]}},function(t,e){t.exports=function(t){if(!Array.isArray(t)||t.length<2||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){t&&(this.settings.data=t),this.settings.status=s.START,this.settings.active=!0,this.settings.visible=!0,this.events.emit(o.START,this),this.events.emit(o.READY,this,t)},shutdown:function(t){this.events.off(o.TRANSITION_INIT),this.events.off(o.TRANSITION_START),this.events.off(o.TRANSITION_COMPLETE),this.events.off(o.TRANSITION_OUT),this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit(o.SHUTDOWN,this,t)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit(o.DESTROY,this),this.events.removeAllListeners();for(var t=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],e=0;e=0;){var a=e[o];-1!==(r=t.indexOf(a))?(n(t,r),i&&i.call(s,a)):e.pop(),o--}return e}},function(t,e,i){var n={CENTER:i(349),ORIENTATION:i(348),SCALE_MODE:i(347),ZOOM:i(346)};t.exports=n},function(t,e){t.exports=function(t,e){var i;if(e)"string"==typeof e?i=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(i=e);else if(t.parentElement)return t;return i||(i=document.body),i.appendChild(t),t}},function(t,e,i){var n=i(10);t.exports=function(t,e){if(void 0===e&&(e=new n),0===t.length)return e;for(var i,s,r,o=Number.MAX_VALUE,a=Number.MAX_VALUE,h=Number.MIN_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER,u=0;u0&&(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],T=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+y)*T,this.y=(e*o+i*u+n*p+m)*T,this.z=(e*a+i*c+n*g+x)*T,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}});n.ZERO=new n,n.RIGHT=new n(1,0,0),n.LEFT=new n(-1,0,0),n.UP=new n(0,-1,0),n.DOWN=new n(0,1,0),n.FORWARD=new n(0,0,1),n.BACK=new n(0,0,-1),n.ONE=new n(1,1,1),t.exports=n},function(t,e,i){var n=i(20);t.exports=function(t){return t*n.RAD_TO_DEG}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e){t.exports=function(t,e,i,n,s){var r=.5*(n-e),o=.5*(s-i),a=t*t;return(2*i-2*n+r+o)*(t*a)+(-3*i+3*n-2*r-o)*a+r*t+i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)=(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=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},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=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x2-t.x1,s=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=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,i){var n=i(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random()*Math.PI*2,s=Math.sqrt(Math.random());return e.x=t.x+s*Math.cos(i)*t.width/2,e.y=t.y+s*Math.sin(i)*t.height/2,e}},function(t,e){var i={defaultPipeline:null,pipeline:null,initPipeline:function(t){void 0===t&&(t="TextureTintPipeline");var e=this.scene.sys.game.renderer;return!!(e&&e.gl&&e.hasPipeline(t))&&(this.defaultPipeline=e.getPipeline(t),this.pipeline=this.defaultPipeline,!0)},setPipeline:function(t){var e=this.scene.sys.game.renderer;return e&&e.gl&&e.hasPipeline(t)&&(this.pipeline=e.getPipeline(t)),this},resetPipeline:function(){return this.pipeline=this.defaultPipeline,null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=i},function(t,e,i){var n=i(6);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(6);t.exports=function(t,e){void 0===e&&(e=new n);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},function(t,e,i){var n=i(58),s=i(6);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)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(23),s=i(0),r=i(11),o=i(136),a=i(434),h=i(433),l=i(4),u=new s({Extends:r,initialize:function(t,e,i){r.call(this),this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,l(i,"frames",[]),l(i,"defaultTextureKey",null)),this.frameRate=l(i,"frameRate",null),this.duration=l(i,"duration",null),null===this.duration&&null===this.frameRate?(this.frameRate=24,this.duration=this.frameRate/this.frames.length*1e3):this.duration&&null===this.frameRate?this.frameRate=this.frames.length/(this.duration/1e3):this.duration=this.frames.length/this.frameRate*1e3,this.msPerFrame=1e3/this.frameRate,this.skipMissedFrames=l(i,"skipMissedFrames",!0),this.delay=l(i,"delay",0),this.repeat=l(i,"repeat",0),this.repeatDelay=l(i,"repeatDelay",0),this.yoyo=l(i,"yoyo",!1),this.showOnStart=l(i,"showOnStart",!1),this.hideOnComplete=l(i,"hideOnComplete",!1),this.paused=!1,this.manager.on(o.PAUSE_ALL,this.pause,this),this.manager.on(o.RESUME_ALL,this.resume,this)},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){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 t>=0&&t0){s.isLast=!0,s.nextFrame=a[0],a[0].prevFrame=s;var v=1/(a.length-1);for(r=0;r=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,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);var i=this.frames[e];0!==e||t.forward||(i=this.getLastFrame()),t.updateFrame(i)},getFrameByProgress:function(t){return t=n(t,0,1),a(t,this.frames,"progress")},nextFrame:function(t){var e=t.currentFrame;e.isLast?t._yoyo?this.handleYoyoFrame(t,!1):t.repeatCounter>0?t._reverse&&t.forward?t.forward=!1:this.repeatAnimation(t):this.completeAnimation(t):this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t._reverse===!e&&t.repeatCounter>0)return t.forward=e,void this.repeatAnimation(t);if(t._reverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else this.completeAnimation(t)},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t._yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?t._reverse&&!t.forward?(t.currentFrame=this.getLastFrame(),this.repeatAnimation(t)):(t.forward=!0,this.repeatAnimation(t)):this.completeAnimation(t):this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.updateFrame(e),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){if(2===t._pendingStop)return this.completeAnimation(t);if(t._repeatDelay>0&&!1===t.pendingRepeat)t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t._repeatDelay;else if(t.repeatCounter--,t.updateFrame(t.currentFrame[t.forward?"nextFrame":"prevFrame"]),t.isPlaying){this.getNextTick(t),t.pendingRepeat=!1;var e=t.currentFrame,i=t.parent;this.emit(o.ANIMATION_REPEAT,this,e),i.emit(o.SPRITE_ANIMATION_KEY_REPEAT+this.key,this,e,t.repeatCounter,i),i.emit(o.SPRITE_ANIMATION_REPEAT,this,e,t.repeatCounter,i)}},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(){this.removeAllListeners(),this.manager.off(o.PAUSE_ALL,this.pause,this),this.manager.off(o.RESUME_ALL,this.resume,this),this.manager.remove(this.key);for(var t=0;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(6);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){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={};t.exports=n;var s=i(82),r=i(87),o=i(238),a=i(86),h=i(546),l=i(36);n._warming=.4,n._torqueDampen=1,n._minLength=1e-6,n.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?r.add(e.bodyA.position,e.pointA):e.pointA,n=e.bodyB?r.add(e.bodyB.position,e.pointB):e.pointB,s=r.magnitude(r.sub(i,n));e.length=void 0!==e.length?e.length:s,e.id=e.id||l.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?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,i){var n={};t.exports=n;var s=i(36);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r0){i||(i={}),n=e.split(" ");for(var l=0;l0)||!((e>0?i[n-1].textures[e-1]:i[n-1].texture)===t)},pushBatch:function(t,e){if(0===e)this.batches.push({first:this.vertexCount,texture:t,textures:[]});else{var i=[];i[e-1]=t,this.batches.push({first:this.vertexCount,texture:null,textures:i})}},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.vertexCount,r=this.topology,o=this.vertexSize,a=this.renderer,h=this.batches,l=h.length,u=0,c=null;if(0===l||0===s)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,s*o));for(var d=0;d0){for(e=0;e0){for(e=0;e0&&(a.setTexture2D(c.texture,0,!1),n.drawArrays(r,c.first,u)),this.vertexCount=0,h.length=0,this.flushLocked=!1,this},batchSprite:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix1,s=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,l=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,g=o.cutWidth,v=o.cutHeight,y=-t.displayOriginX+f,m=-t.displayOriginY+p;if(t.isCropped){var x=t._crop;x.flipX===t.flipX&&x.flipY===t.flipY||o.updateCropUVs(x,t.flipX,t.flipY),h=x.u0,l=x.v0,c=x.u1,d=x.v1,g=x.width,v=x.height,f=x.x,p=x.y,y=-t.displayOriginX+f,m=-t.displayOriginY+p}t.flipX&&(y+=g,g*=-1),t.flipY&&(m+=v,v*=-1);var T=y+g,w=m+v;s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y,n.multiply(s,r)):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY,n.multiply(s,r));var b=r.getX(y,m),S=r.getY(y,m),_=r.getX(y,w),A=r.getY(y,w),E=r.getX(T,w),C=r.getY(T,w),M=r.getX(T,m),P=r.getY(T,m),O=u.getTintAppendFloatAlpha(t._tintTL,e.alpha*t._alphaTL),R=u.getTintAppendFloatAlpha(t._tintTR,e.alpha*t._alphaTR),L=u.getTintAppendFloatAlpha(t._tintBL,e.alpha*t._alphaBL),D=u.getTintAppendFloatAlpha(t._tintBR,e.alpha*t._alphaBR);e.roundPixels&&(b=Math.round(b),S=Math.round(S),_=Math.round(_),A=Math.round(A),E=Math.round(E),C=Math.round(C),M=Math.round(M),P=Math.round(P)),this.setTexture2D(a,0);var F=t._isTinted&&t.tintFill;this.batchQuad(b,S,_,A,E,C,M,P,h,l,c,d,O,R,L,D,F,a,0)},batchQuad:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m){var x=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),x=!0,this.setTexture2D(y,m));var T=this.vertexViewF32,w=this.vertexViewU32,b=this.vertexCount*this.vertexComponentCount-1;return T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=v,w[++b]=d,T[++b]=i,T[++b]=n,T[++b]=h,T[++b]=c,T[++b]=v,w[++b]=p,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=v,w[++b]=g,T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=v,w[++b]=d,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=v,w[++b]=g,T[++b]=o,T[++b]=a,T[++b]=u,T[++b]=l,T[++b]=v,w[++b]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g){var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),this.setTexture2D(p,g),v=!0);var y=this.vertexViewF32,m=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return y[++x]=t,y[++x]=e,y[++x]=o,y[++x]=a,y[++x]=f,m[++x]=u,y[++x]=i,y[++x]=n,y[++x]=o,y[++x]=l,y[++x]=f,m[++x]=c,y[++x]=s,y[++x]=r,y[++x]=h,y[++x]=l,y[++x]=f,m[++x]=d,this.vertexCount+=3,v},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m,x,T,w,b,S,_,A,E,C,M,P,O){this.renderer.setPipeline(this,t);var R=this._tempMatrix1,L=this._tempMatrix2,D=this._tempMatrix3,F=y/i+E,k=m/n+C,I=(y+x)/i+E,B=(m+T)/n+C,Y=o,N=a,X=-g,z=-v;if(t.isCropped){var U=t._crop;Y=U.width,N=U.height,o=U.width,a=U.height;var G=y=U.x,W=m=U.y;c&&(G=x-U.x-U.width),d&&!e.isRenderTexture&&(W=T-U.y-U.height),F=G/i+E,k=W/n+C,I=(G+U.width)/i+E,B=(W+U.height)/n+C,X=-g+y,z=-v+m}d^=!O&&e.isRenderTexture?1:0,c&&(Y*=-1,X+=o),d&&(N*=-1,z+=a);var V=X+Y,H=z+N;L.applyITRS(s,r,u,h,l),R.copyFrom(M.matrix),P?(R.multiplyWithOffset(P,-M.scrollX*f,-M.scrollY*p),L.e=s,L.f=r,R.multiply(L,D)):(L.e-=M.scrollX*f,L.f-=M.scrollY*p,R.multiply(L,D));var j=D.getX(X,z),q=D.getY(X,z),K=D.getX(X,H),J=D.getY(X,H),Z=D.getX(V,H),Q=D.getY(V,H),$=D.getX(V,z),tt=D.getY(V,z);M.roundPixels&&(j=Math.round(j),q=Math.round(q),K=Math.round(K),J=Math.round(J),Z=Math.round(Z),Q=Math.round(Q),$=Math.round($),tt=Math.round(tt)),this.setTexture2D(e,0),this.batchQuad(j,q,K,J,Z,Q,$,tt,F,k,I,B,w,b,S,_,A,e,0)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.setPipeline(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),f=h.getY(e,i),p=h.getX(e,c),g=h.getY(e,c),v=h.getX(l,c),y=h.getY(l,c),m=h.getX(l,i),x=h.getY(l,i);this.setTexture2D(t.glTexture,0),n=u.getTintAppendFloatAlpha(n,s),this.batchQuad(d,f,p,g,v,y,m,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,0)},drawFillRect:function(t,e,i,n,s,r){var o=t+i,a=e+n;this.setTexture2D();var h=u.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,h,h,h,h,2)},batchFillRect:function(t,e,i,n,s,r){this.renderer.setPipeline(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),y=this.currentFrame,m=y.u0,x=y.v0,T=y.u1,w=y.v1;this.batchQuad(l,u,c,d,f,p,g,v,m,x,T,w,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.fillTint.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,y=g.v0,m=g.u1,x=g.v1;this.batchTri(l,u,c,d,f,p,v,y,m,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=s,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.setPipeline(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=this.tintEffect,f=0;f0&&H[4]?this.batchQuad(D,F,P,O,H[0],H[1],H[2],H[3],U,G,W,V,B,Y,N,X,I):(j[0]=D,j[1]=F,j[2]=P,j[3]=O,j[4]=1),h&&j[4]?this.batchQuad(C,M,R,L,j[0],j[1],j[2],j[3],U,G,W,V,B,Y,N,X,I):(H[0]=C,H[1]=M,H[2]=R,H[3]=L,H[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),s=i(9),r=new n({initialize:function(t){this.name="WebGLPipeline",this.game=t.game,this.view=t.game.canvas,this.resolution=1,this.width=0,this.height=0,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,this.active=!1},boot:function(){},addAttribute:function(t,e,i,n,s){return this.attributes.push({name:t,size:e,type:this.renderer.glFormats[i],normalized:n,offset:s}),this},shouldFlush:function(){return this.vertexCount>=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this.resolution=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},setFloat1v:function(t,e){return this.renderer.setFloat1v(this.program,t,e),this},setFloat2v:function(t,e){return this.renderer.setFloat2v(this.program,t,e),this},setFloat3v:function(t,e){return this.renderer.setFloat3v(this.program,t,e),this},setFloat4v:function(t,e){return this.renderer.setFloat4v(this.program,t,e),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(57);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n=i(57);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},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,i){t.exports={TIMELINE_COMPLETE:i(475),TIMELINE_LOOP:i(474),TIMELINE_PAUSE:i(473),TIMELINE_RESUME:i(472),TIMELINE_START:i(471),TIMELINE_UPDATE:i(470)}},function(t,e,i){var n=i(0),s=i(11),r=i(216),o=i(104),a=i(89),h=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.isTimeline=!0,this.data=[],this.totalData=0,this.useFrames=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=a.PENDING_ADD,this._pausedState=a.PENDING_ADD,this.paused=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0,this.callbacks={onComplete:null,onLoop:null,onStart:null,onUpdate:null,onYoyo:null},this.callbackScope},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return this.state===a.ACTIVE},add:function(t){return this.queue(o(this,t))},queue:function(t){return this.isPlaying()||(t.parent=this,t.parentIsTimeline=!0,this.data.push(t),this.totalData=this.data.length),this},hasOffset:function(t){return null!==t.offset},isOffsetAbsolute:function(t){return"number"==typeof t},isOffsetRelative:function(t){if("string"===typeof t){var e=t[0];if("-"===e||"+"===e)return!0}return!1},getRelativeOffset:function(t,e){var i=t[0],n=parseFloat(t.substr(2)),s=e;switch(i){case"+":s+=n;break;case"-":s-=n}return Math.max(0,s)},calcDuration:function(){for(var t=0,e=0,i=0,n=0;n0?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=a.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(r.TIMELINE_LOOP,this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=a.LOOP_DELAY):this.state=a.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=a.COMPLETE_DELAY;else{this.state=a.PENDING_REMOVE;var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit(r.TIMELINE_COMPLETE,this)}},update:function(t,e){if(this.state!==a.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 a.ACTIVE:for(var n=this.totalData,s=0;s0?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){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(0),s=i(13),r=i(28),o=i(18),a=i(485),h=i(110),l=i(41),u=i(9),c=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,a){o.call(this,t,"StaticTilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.culledTiles=[],this.skipCull=!1,this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=h.CullTiles,this.renderer=t.sys.game.renderer,this.vertexBuffer=[],this.bufferData=[],this.vertexViewF32=[],this.vertexViewU32=[],this.dirty=[],this.vertexCount=[],this._renderOrder=0,this._tempMatrix=new l,this.gidMap=[],this.setTilesets(n),this.setAlpha(this.layer.alpha),this.setPosition(s,a),this.setOrigin(),this.setSize(e.tileWidth*this.layer.width,e.tileHeight*this.layer.height),this.updateVBOData(),this.initPipeline("TextureTintPipeline"),t.sys.game.config.renderType===r.WEBGL&&t.sys.game.renderer.onContextRestored(function(){this.updateVBOData()},this)},setTilesets:function(t){var e=[],i=[],n=this.tilemap;Array.isArray(t)||(t=[t]);for(var s=0;sv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(1===p)for(o=0;o=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(2===p)for(o=u-1;o>=0;o--)for(a=0;av||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));else if(3===p)for(o=u-1;o>=0;o--)for(a=l-1;a>=0;a--)!(r=f[o][a])||r.indexv||!r.visible||(x=this.batchTile(x,r,h,c,d,t,e));this.dirty[e]=!1,null===y?(y=i.createVertexBuffer(m,n.STATIC_DRAW),this.vertexBuffer[e]=y):(i.setVertexBuffer(y),n.bufferSubData(n.ARRAY_BUFFER,0,m))}return this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=i.tileWidth,l=i.tileHeight,c=h/2,d=l/2,f=a.x/n,p=a.y/s,g=(a.x+h)/n,v=(a.y+l)/s,y=this._tempMatrix,m=-c,x=-d;e.flipX&&(h*=-1,m+=i.tileWidth),e.flipY&&(l*=-1,x+=i.tileHeight);var T=m+h,w=x+l;y.applyITRS(c+e.pixelX,d+e.pixelY,e.rotation,1,1);var b=u.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),S=y.getX(m,x),_=y.getY(m,x),A=y.getX(m,w),E=y.getY(m,w),C=y.getX(T,w),M=y.getY(T,w),P=y.getX(T,x),O=y.getY(T,x);r.roundPixels&&(S=Math.round(S),_=Math.round(_),A=Math.round(A),E=Math.round(E),C=Math.round(C),M=Math.round(M),P=Math.round(P),O=Math.round(O));var R=this.vertexViewF32[o],L=this.vertexViewU32[o];return R[++t]=S,R[++t]=_,R[++t]=f,R[++t]=p,R[++t]=0,L[++t]=b,R[++t]=A,R[++t]=E,R[++t]=f,R[++t]=v,R[++t]=0,L[++t]=b,R[++t]=C,R[++t]=M,R[++t]=g,R[++t]=v,R[++t]=0,L[++t]=b,R[++t]=S,R[++t]=_,R[++t]=f,R[++t]=p,R[++t]=0,L[++t]=b,R[++t]=C,R[++t]=M,R[++t]=g,R[++t]=v,R[++t]=0,L[++t]=b,R[++t]=P,R[++t]=O,R[++t]=g,R[++t]=p,R[++t]=0,L[++t]=b,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),t>=0&&t<4){this._renderOrder=t;for(var e=0;e=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return a.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,s){return a.CreateFromTiles(t,e,i,n,s,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,s,r,o){return a.Copy(t,e,i,n,s,r,o,this.layer),this},destroy:function(){this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this)},fill:function(t,e,i,n,s,r){return a.Fill(t,e,i,n,s,r,this.layer),this},filterTiles:function(t,e,i,n,s,r,o){return a.FilterTiles(t,e,i,n,s,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,s,r,o){return a.FindTile(t,e,i,n,s,r,o,this.layer)},forEachTile:function(t,e,i,n,s,r,o){return a.ForEachTile(t,e,i,n,s,r,o,this.layer),this},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return a.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,s){return a.GetTilesWithin(t,e,i,n,s,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,s,r){return a.GetTilesWithinWorldXY(t,e,i,n,s,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return a.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,s){return a.PutTileAtWorldXY(t,e,i,n,s,this.layer)},putTilesAt:function(t,e,i,n){return a.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,s){return a.Randomize(t,e,i,n,s,this.layer),this},removeTileAt:function(t,e,i,n){return a.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,s){return a.RemoveTileAtWorldXY(t,e,i,n,s,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,s,r){return a.ReplaceByIndex(t,e,i,n,s,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i){return a.SetCollision(t,e,i,this.layer),this},setCollisionBetween:function(t,e,i,n){return a.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,s,r){return a.SetTileLocationCallback(t,e,i,n,s,r,this.layer),this},shuffle:function(t,e,i,n){return a.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,s,r){return a.SwapByIndex(t,e,i,n,s,r,this.layer),this},tileToWorldX:function(t,e){return a.TileToWorldX(t,e,this.layer)},tileToWorldY:function(t,e){return a.TileToWorldY(t,e,this.layer)},tileToWorldXY:function(t,e,i,n){return a.TileToWorldXY(t,e,i,n,this.layer)},weightedRandomize:function(t,e,i,n,s){return a.WeightedRandomize(t,e,i,n,s,this.layer),this},worldToTileX:function(t,e,i){return a.WorldToTileX(t,e,i,this.layer)},worldToTileY:function(t,e,i){return a.WorldToTileY(t,e,i,this.layer)},worldToTileXY:function(t,e,i,n,s){return a.WorldToTileXY(t,e,i,n,s,this.layer)}});t.exports=h},function(t,e,i){var n=i(0),s=i(34),r=i(224),o=i(19),a=i(31),h=i(84),l=i(373),u=i(223),c=i(61),d=i(110),f=i(106),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.renderOrder=e.renderOrder,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},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},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 Tileset Image: "+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 for Tileset: "+t),null;var u=this.tilesets[l];return u?(u.setTileSize(i,n),u.setSpacing(s,r),u.setImage(h),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),(u=new f(t,o,i,n,s,r)).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("Invalid Tilemap Layer ID: "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;fa&&(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(2),r=new n({initialize:function(t){void 0===t&&(t={}),this.name=s(t,"name","object layer"),this.opacity=s(t,"opacity",1),this.properties=s(t,"properties",{}),this.propertyTypes=s(t,"propertytypes",{}),this.type=s(t,"type","objectgroup"),this.visible=s(t,"visible",!0),this.objects=s(t,"objects",[])}});t.exports=r},function(t,e,i){var n=i(494),s=i(230),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=n(t,o);if(a.x+=e,a.y+=i,t.gid){var h=s(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?(a.ellipse=t.ellipse,a.width=t.width,a.height=t.height):t.text?(a.width=t.width,a.height=t.height,a.text=t.text):(a.rectangle=!0,a.width=t.width,a.height=t.height);return a}},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&&t-1}return!1}},function(t,e,i){var n=i(21);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l0&&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){t.exports={NONE:0,A:1,B:2,BOTH:3}},function(t,e){t.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8}},function(t,e,i){var n=i(43),s=i(0),r=i(38),o=i(42),a=i(3),h=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;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=i,this.height=n,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,this._dx=0,this._dy=0},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},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y);var s=this.gameObject;return!t&&s.frame&&(t=s.frame.realWidth),!e&&s.frame&&(e=s.frame.realHeight),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.setPosition(t,e),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)},postUpdate:function(){},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,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),this.isCircle?t.strokeCircle(i,n,this.width/2):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=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(317);function s(t){if(!(this instanceof s))return new s(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=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)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=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;te._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.up=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},function(t,e,i){var n=i(38);t.exports=function(t,e,i,s){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType===n.STATIC_BODY&&(t.blocked.none=!1,t.blocked.left=!0),t.physicsType===n.STATIC_BODY&&(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},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,i){t.exports={COLLIDE:i(563),OVERLAP:i(562),PAUSE:i(561),RESUME:i(560),TILE_COLLIDE:i(559),TILE_OVERLAP:i(558),WORLD_BOUNDS:i(557)}},function(t,e,i){var n=i(43),s=i(0),r=i(38),o=i(248),a=i(183),h=i(10),l=i(42),u=i(3),c=new s({initialize:function(t,e){var i=e.width?e.width:64,n=e.height?e.height:64;this.world=t,this.gameObject=e,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new u,this.position=new u(e.x,e.y),this.prev=new u(e.x,e.y),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=n,this.sourceWidth=i,this.sourceHeight=n,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(n/2),this.center=new u(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new u,this.newVelocity=new u,this.deltaMax=new u,this.acceleration=new u,this.allowDrag=!0,this.drag=new u,this.allowGravity=!0,this.gravity=new u,this.bounce=new u,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new u(1e4,1e4),this.maxSpeed=-1,this.friction=new u(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.moves=!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.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.physicsType=r.DYNAMIC_BODY,this._reset=!0,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._bounds=new h},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=a(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var n=!1;if(this.syncBounds){var s=t.getBounds(this._bounds);this.width=s.width,this.height=s.height,n=!0}else{var r=Math.abs(e.scaleX),o=Math.abs(e.scaleY);this._sx===r&&this._sy===o||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*o,this._sx=r,this._sy=o,n=!0)}n&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},update:function(t){this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds();var e=this.transform;if(this.position.x=e.x+e.scaleX*(this.offset.x-e.displayOriginX),this.position.y=e.y+e.scaleY*(this.offset.y-e.displayOriginY),this.updateCenter(),this.rotation=e.rotation,this.preRotation=this.rotation,this._reset&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves){this.world.updateMotion(this,t);var i=this.velocity.x,n=this.velocity.y;this.newVelocity.set(i*t,n*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(n,i),this.speed=Math.sqrt(i*i+n*n),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit(o.WORLD_BOUNDS,this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y},postUpdate:function(){this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y,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._dx<0?this.facing=r.FACING_LEFT:this._dx>0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),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(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),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):l(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._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&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(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.width/2):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,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 void 0===t&&(t=!0),this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),this},setMaxSpeed:function(t){return this.maxSpeed=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},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=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 void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=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=c},function(t,e,i){var n=i(249),s=i(23),r=i(0),o=i(247),a=i(38),h=i(56),l=i(11),u=i(248),c=i(186),d=i(383),f=i(382),p=i(246),g=i(245),v=i(4),y=i(244),m=i(556),x=i(10),T=i(243),w=i(555),b=i(550),S=i(549),_=i(102),A=i(241),E=i(242),C=i(41),M=i(3),P=i(57),O=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.bodies=new _,this.staticBodies=new _,this.pendingDestroy=new _,this.late=new _,this._late=!1,this.colliders=new y,this.gravity=new M(v(e,"gravity.x",0),v(e,"gravity.y",0)),this.bounds=new x(v(e,"x",0),v(e,"y",0),v(e,"width",t.sys.scale.width),v(e,"height",t.sys.scale.height)),this.checkCollision={up:v(e,"checkCollision.up",!0),down:v(e,"checkCollision.down",!0),left:v(e,"checkCollision.left",!0),right:v(e,"checkCollision.right",!0)},this.fps=v(e,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=v(e,"timeScale",1),this.OVERLAP_BIAS=v(e,"overlapBias",4),this.TILE_BIAS=v(e,"tileBias",16),this.forceX=v(e,"forceX",!1),this.isPaused=v(e,"isPaused",!1),this._total=0,this.drawDebug=v(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:v(e,"debugShowBody",!0),debugShowStaticBody:v(e,"debugShowStaticBody",!0),debugShowVelocity:v(e,"debugShowVelocity",!0),bodyDebugColor:v(e,"debugBodyColor",16711935),staticBodyDebugColor:v(e,"debugStaticBodyColor",255),velocityDebugColor:v(e,"debugVelocityColor",65280)},this.maxEntries=v(e,"maxEntries",16),this.useTree=v(e,"useTree",!0),this.tree=new T(this.maxEntries),this.staticTree=new T(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new C,this._tempMatrix2=new C,this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=a.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=s;)this._elapsed-=s,i++,this.step(n);this.stepsLastFrame=i,this._late=!0}},step:function(t){var e,i,n=this.bodies.entries,s=n.length;for(e=0;e0){for(n=(e=h.entries).length,t=0;t0){var u=this.tree,c=this.staticTree;for(n=(e=o.entries).length,t=0;t-1&&t.velocity.length()>g&&t.velocity.normalize().scale(g)},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,c=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)l.right&&(a=h(c.x,c.y,l.right,l.y)-c.radius):c.y>l.bottom&&(c.xl.right&&(a=h(c.x,c.y,l.right,l.bottom)-c.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(u.OVERLAP,t.gameObject,e.gameObject,t,e),0!==a;var d=t.velocity.x,f=t.velocity.y,v=t.mass,y=e.velocity.x,m=e.velocity.y,x=e.mass,T=d*Math.cos(o)+f*Math.sin(o),w=d*Math.sin(o)-f*Math.cos(o),b=y*Math.cos(o)+m*Math.sin(o),S=y*Math.sin(o)-m*Math.cos(o),_=((v-x)*T+2*x*b)/(v+x),A=(2*v*T+(x-v)*b)/(v+x);t.immovable||(t.velocity.x=(_*Math.cos(o)-w*Math.sin(o))*t.bounce.x,t.velocity.y=(w*Math.cos(o)+_*Math.sin(o))*t.bounce.y,d=t.velocity.x,f=t.velocity.y),e.immovable||(e.velocity.x=(A*Math.cos(o)-S*Math.sin(o))*e.bounce.x,e.velocity.y=(S*Math.cos(o)+A*Math.sin(o))*e.bounce.y,y=e.velocity.x,m=e.velocity.y),Math.abs(o)0&&!t.immovable&&y>d?t.velocity.x*=-1:y<0&&!e.immovable&&d0&&!t.immovable&&m>f?t.velocity.y*=-1:m<0&&!e.immovable&&fMath.PI/2&&(d<0&&!t.immovable&&y0&&!e.immovable&&d>y?e.velocity.x*=-1:f<0&&!t.immovable&&m0&&!e.immovable&&d>m&&(e.velocity.y*=-1));var E=this._frameTime;return t.immovable||(t.x+=t.velocity.x*E-a*Math.cos(o),t.y+=t.velocity.y*E-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*E+a*Math.cos(o),e.y+=e.velocity.y*E+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit(u.COLLIDE,t.gameObject,e.gameObject,t,e),t.postUpdate(),e.postUpdate(),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?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):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.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);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,h,l,u=t.body;if(0!==e.length&&u&&u.enable)if(this.useTree){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===a.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(h=d.length,o=0;od.baseTileWidth){var f=(d.tileWidth-d.baseTileWidth)*e.scaleX;a-=f,l+=f}d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var p,g=e.getTilesWithinWorldXY(a,h,l,c);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},y=0;y=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),s>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},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=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=0&&u<=1){var c=((s-h)*(r-n)-(n-a)*(o-s))/l;return Math.abs(c)*Math.sqrt(l)<=i}return Math.sqrt((r-a)*(r-a)+(o-h)*(o-h))<=i}},function(t,e,i){var n=i(43),s=new(i(6));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,i){t.exports={CircleToCircle:i(725),CircleToRectangle:i(724),GetRectangleIntersection:i(723),LineToCircle:i(277),LineToLine:i(115),LineToRectangle:i(722),PointToLine:i(276),PointToLineSegment:i(721),RectangleToRectangle:i(158),RectangleToTriangle:i(720),RectangleToValues:i(719),TriangleToCircle:i(718),TriangleToLine:i(717),TriangleToTriangle:i(716)}},function(t,e,i){t.exports={Circle:i(745),Ellipse:i(735),Intersects:i(278),Line:i(715),Point:i(694),Polygon:i(680),Rectangle:i(270),Triangle:i(650)}},function(t,e,i){var n=i(0),s=i(281),r=i(9),o=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1,this.maxLights=-1},enable:function(){return-1===this.maxLights&&(this.maxLights=this.scene.sys.game.renderer.config.maxLights),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,r=t.y+t.height/2,o=(t.width+t.height)/2,a={x:0,y:0},h=t.matrix,l=this.systems.game.config.height;i.length=0;for(var u=0;u0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],o):h=new s(t,e,i,a[0],a[1],a[2],o),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=o},function(t,e,i){var n=i(0),s=i(9),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(58),s=i(6);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(6),s=i(58);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=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(0),s=i(29),r=i(65),o=i(795),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),s.call(this,t,"Triangle",new r(n,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,n,s,r){return this.geom.setTo(t,e,i,n,s,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(798),s=i(0),r=i(71),o=i(29),a=new s({Extends:o,Mixins:[n],initialize:function(t,e,i,n,s,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===s&&(s=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=s,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,s=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var l=0;l0&&r.push(i([0,0],n[0])),e=0;e1&&r.push(i([0,0],n[n.length-1])),t.setTo(r)}},function(t,e,i){var n=i(58),s=i(59);t.exports=function(t){for(var e=t.points,i=0,r=0;rc+v)){var y=g.getPoint((u-c)/v);o.push(y);break}c+=v}return o}},function(t,e,i){var n=i(10);t.exports=function(t,e){void 0===e&&(e=new n);for(var i,s=1/0,r=1/0,o=-s,a=-r,h=0;h0&&(s=-h.PI2+s%h.PI2):s>h.PI2?s=h.PI2:s<0&&(s=h.PI2+s%h.PI2);for(var u,c=[a+Math.cos(n)*i,l+Math.sin(n)*i];e<1;)u=s*e+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=s+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(n)*i,l+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},function(t,e){t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}},function(t,e,i){var n=i(0),s=i(34),r=i(90),o=i(4),a=i(67),h=i(89),l=i(3),u=new n({Extends:a,initialize:function(t,e,i,n,s,r){a.call(this,t,i,n,s,r),this.path=e,this.rotateToPath=!1,this.pathRotationOffset=0,this.pathOffset=new l(i,n),this.pathVector=new l,this.pathTween,this.pathConfig=null,this._prevDirection=h.PLAYING_FORWARD},setPath:function(t,e){void 0===e&&(e=this.pathConfig);var i=this.pathTween;return i&&i.isPlaying()&&i.stop(),this.path=t,e&&this.startFollow(e),this},setRotateToPath:function(t,e){return void 0===e&&(e=0),this.rotateToPath=t,this.pathRotationOffset=e,this},isFollowing:function(){var t=this.pathTween;return t&&t.isPlaying()},startFollow:function(t,e){void 0===t&&(t={}),void 0===e&&(e=0);var i=this.pathTween;i&&i.isPlaying()&&i.stop(),"number"==typeof t&&(t={duration:t}),t.from=0,t.to=1;var n=r(t,"positionOnPath",!1);this.rotateToPath=r(t,"rotateToPath",!1),this.pathRotationOffset=o(t,"rotationOffset",0);var a=o(t,"startAt",e);if(a&&(t.onStart=function(t){var e=t.data[0];e.progress=a,e.elapsed=e.duration*a;var i=e.ease(e.progress);e.current=e.start+(e.end-e.start)*i,e.target[e.key]=e.current}),this.pathTween=this.scene.sys.tweens.addCounter(t),this.path.getStartPoint(this.pathOffset),n&&(this.x=this.pathOffset.x,this.y=this.pathOffset.y),this.pathOffset.x=this.x-this.pathOffset.x,this.pathOffset.y=this.y-this.pathOffset.y,this._prevDirection=h.PLAYING_FORWARD,this.rotateToPath){var l=this.path.getPoint(.1);this.rotation=Math.atan2(l.y-this.y,l.x-this.x)+s(this.pathRotationOffset)}return this.pathConfig=t,this},pauseFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.pause(),this},resumeFollow:function(){var t=this.pathTween;return t&&t.isPaused()&&t.resume(),this},stopFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.stop(),this},preUpdate:function(t,e){this.anims.update(t,e);var i=this.pathTween;if(i){var n=i.data[0];if(n.state!==h.PLAYING_FORWARD&&n.state!==h.PLAYING_BACKWARD)return;var r=this.pathVector;this.path.getPoint(i.getValue(),r),r.add(this.pathOffset);var o=this.x,a=this.y;this.setPosition(r.x,r.y);var l=this.x-o,u=this.y-a;if(0===l&&0===u)return;if(n.state!==this._prevDirection)return void(this._prevDirection=n.state);this.rotateToPath&&(this.rotation=Math.atan2(u,l)+s(this.pathRotationOffset))}}});t.exports=u},function(t,e,i){var n=i(0),s=i(3),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){t.exports=function(t,e){for(var i=0;ithis._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=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=i(60),s=i(0),r=i(13),o=i(304),a=i(303),h=i(845),l=i(2),u=i(172),c=i(302),d=i(91),f=i(306),p=i(301),g=i(10),v=i(118),y=i(3),m=i(57),x=new s({Mixins:[r.BlendMode,r.Mask,r.ScrollFactor,r.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=f,this.x=new h(e,"x",0),this.y=new h(e,"y",0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",4294967295),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3),this.angle=new h(e,"angle",{min:0,max:360}),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new y,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&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){var u=this.deathCallback,c=this.deathCallbackScope;for(o=h-1;o>=0;o--){var d=a[o];s.splice(d.index,1),r.push(d.particle),u&&u.call(c,d.particle),d.particle.resetPosition()}}this.on&&(0===this.frequency?this.emitParticle():this.frequency>0&&(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}});t.exports=x},function(t,e,i){var n=i(0),s=i(34),r=i(56),o=new n({initialize:function(t){this.emitter=t,this.frame=null,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.tint=16777215,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},resetPosition:function(){this.x=0,this.y=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")},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.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},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);s>>16,m=(65280&p)>>>8,x=255&p,c.strokeStyle="rgba("+y+","+m+","+x+","+d+")",c.lineWidth=v,T+=3;break;case n.FILL_STYLE:g=l[T+1],f=l[T+2],y=(16711680&g)>>>16,m=(65280&g)>>>8,x=255&g,c.fillStyle="rgba("+y+","+m+","+x+","+f+")",T+=2;break;case n.BEGIN_PATH:c.beginPath();break;case n.CLOSE_PATH:c.closePath();break;case n.FILL_PATH:h||c.fill();break;case n.STROKE_PATH:h||c.stroke();break;case n.FILL_RECT:h?c.rect(l[T+1],l[T+2],l[T+3],l[T+4]):c.fillRect(l[T+1],l[T+2],l[T+3],l[T+4]),T+=4;break;case n.FILL_TRIANGLE:c.beginPath(),c.moveTo(l[T+1],l[T+2]),c.lineTo(l[T+3],l[T+4]),c.lineTo(l[T+5],l[T+6]),c.closePath(),h||c.fill(),T+=6;break;case n.STROKE_TRIANGLE:c.beginPath(),c.moveTo(l[T+1],l[T+2]),c.lineTo(l[T+3],l[T+4]),c.lineTo(l[T+5],l[T+6]),c.closePath(),h||c.stroke(),T+=6;break;case n.LINE_TO:c.lineTo(l[T+1],l[T+2]),T+=2;break;case n.MOVE_TO:c.moveTo(l[T+1],l[T+2]),T+=2;break;case n.LINE_FX_TO:c.lineTo(l[T+1],l[T+2]),T+=5;break;case n.MOVE_FX_TO:c.moveTo(l[T+1],l[T+2]),T+=5;break;case n.SAVE:c.save();break;case n.RESTORE:c.restore();break;case n.TRANSLATE:c.translate(l[T+1],l[T+2]),T+=2;break;case n.SCALE:c.scale(l[T+1],l[T+2]),T+=2;break;case n.ROTATE:c.rotate(l[T+1]),T+=1;break;case n.GRADIENT_FILL_STYLE:T+=5;break;case n.GRADIENT_LINE_STYLE:T+=6;break;case n.SET_TEXTURE:T+=2}c.restore()}}},function(t,e){t.exports=function(t){var e=t.width/2,i=t.height/2,n=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*n/(10+Math.sqrt(4-3*n)))}},function(t,e,i){var n=i(309),s=i(166),r=i(100),o=i(20);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(4),s=i(132),r=function(t,e,i){for(var n=[],s=0;se?1:0}var s=function(t,e,r,o,a){for(void 0===r&&(r=0),void 0===o&&(o=t.length-1),void 0===a&&(a=n);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));s(t,e,f,p,a)}var g=t[e],v=r,y=o;for(i(t,r,e),a(t[o],g)>0&&i(t,r,o);v0;)y--}0===a(t[r],g)?i(t,r,y):i(t,++y,o),y<=e&&(r=y+1),e<=y&&(o=y-1)}};t.exports=s},function(t,e){t.exports=function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n}},function(t,e,i){t.exports={AtlasXML:i(910),Canvas:i(909),Image:i(908),JSONArray:i(907),JSONHash:i(906),SpriteSheet:i(905),SpriteSheetFromAtlas:i(904),UnityYAML:i(903)}},function(t,e,i){var n=i(24),s=i(0),r=i(127),o=i(101),a=new s({initialize:function(t,e,i,n){var s=t.manager.game;this.renderer=s.renderer,this.texture=t,this.source=e,this.image=e,this.compressionAlgorithm=null,this.resolution=1,this.width=i||e.naturalWidth||e.width||0,this.height=n||e.naturalHeight||e.height||0,this.scaleMode=o.DEFAULT,this.isCanvas=e instanceof HTMLCanvasElement,this.isRenderTexture="RenderTexture"===e.type,this.isPowerOf2=r(this.width,this.height),this.glTexture=null,this.init(s)},init:function(t){this.renderer&&(this.renderer.gl?this.isCanvas?this.glTexture=this.renderer.canvasToTexture(this.image):this.isRenderTexture?(this.image=this.source.canvas,this.glTexture=this.renderer.createTextureFromSource(null,this.width,this.height,this.scaleMode)):this.glTexture=this.renderer.createTextureFromSource(this.image,this.width,this.height,this.scaleMode):this.isRenderTexture&&(this.image=this.source.canvas)),t.config.antialias||this.setFilter(1)},setFilter:function(t){this.renderer.gl&&this.renderer.setTextureFilter(this.glTexture,t)},update:function(){this.renderer.gl&&this.isCanvas&&(this.glTexture=this.renderer.canvasToTexture(this.image,this.glTexture))},destroy:function(){this.glTexture&&this.renderer.deleteTexture(this.glTexture),this.isCanvas&&n.remove(this.image),this.renderer=null,this.texture=null,this.source=null,this.image=null,this.glTexture=null}});t.exports=a},function(t,e,i){var n=i(24),s=i(911),r=i(0),o=i(32),a=i(28),h=i(11),l=i(126),u=i(26),c=i(361),d=i(4),f=i(319),p=i(175),g=new r({Extends:h,initialize:function(t){h.call(this),this.game=t,this.name="TextureManager",this.list={},this._tempCanvas=n.create2D(this,1,1),this._tempContext=this._tempCanvas.getContext("2d"),this._pending=0,t.events.once(u.BOOT,this.boot,this)},boot:function(){this._pending=2,this.on(l.LOAD,this.updatePending,this),this.on(l.ERROR,this.updatePending,this),this.addBase64("__DEFAULT",this.game.config.defaultImage),this.addBase64("__MISSING",this.game.config.missingImage),this.game.events.once(u.DESTROY,this.destroy,this)},updatePending:function(){this._pending--,0===this._pending&&(this.off(l.LOAD),this.off(l.ERROR),this.emit(l.READY))},checkKey:function(t){return!this.exists(t)||(console.error("Texture key already in use: "+t),!1)},remove:function(t){if("string"==typeof t){if(!this.exists(t))return console.warn("No texture found matching key: "+t),this;t=this.get(t)}return this.list.hasOwnProperty(t.key)&&(delete this.list[t.key],t.destroy(),this.emit(l.REMOVE,t.key)),this},addBase64:function(t,e){if(this.checkKey(t)){var i=this,n=new Image;n.onerror=function(){i.emit(l.ERROR,t)},n.onload=function(){var e=i.create(t,n);f.Image(e,0),i.emit(l.ADD,t,e),i.emit(l.LOAD,t,e)},n.src=e}return this},getBase64:function(t,e,i,s){void 0===i&&(i="image/png"),void 0===s&&(s=.92);var r="",o=this.getFrame(t,e);if(o){var a=o.canvasData,h=n.create2D(this,a.width,a.height);h.getContext("2d").drawImage(o.source.image,a.x,a.y,a.width,a.height,0,0,a.width,a.height),r=h.toDataURL(i,s),n.remove(h)}return r},addImage:function(t,e,i){var n=null;return this.checkKey(t)&&(n=this.create(t,e),f.Image(n,0),i&&n.setDataSource(i),this.emit(l.ADD,t,n)),n},addRenderTexture:function(t,e){var i=null;return this.checkKey(t)&&((i=this.create(t,e)).add("__BASE",0,0,0,e.width,e.height),this.emit(l.ADD,t,i)),i},generate:function(t,e){if(this.checkKey(t)){var i=n.create(this,1,1);return e.canvas=i,c(e),this.addCanvas(t,i)}return null},createCanvas:function(t,e,i){if(void 0===e&&(e=256),void 0===i&&(i=256),this.checkKey(t)){var s=n.create(this,e,i,a.CANVAS,!0);return this.addCanvas(t,s)}return null},addCanvas:function(t,e,i){void 0===i&&(i=!1);var n=null;return i?n=new s(this,t,e,e.width,e.height):this.checkKey(t)&&(n=new s(this,t,e,e.width,e.height),this.list[t]=n,this.emit(l.ADD,t,n)),n},addAtlas:function(t,e,i,n){return Array.isArray(i.textures)||Array.isArray(i.frames)?this.addAtlasJSONArray(t,e,i,n):this.addAtlasJSONHash(t,e,i,n)},addAtlasJSONArray:function(t,e,i,n){var s=null;if(this.checkKey(t)){if(s=this.create(t,e),Array.isArray(i))for(var r=1===i.length,o=0;o=r.x&&t=r.y&&e=r.x&&t=r.y&&e0)&&(!!n.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit(r.PAUSE,this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!n.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit(r.RESUME,this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!n.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit(r.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(r.COMPLETE,this);this.previousTime=s}},destroy:function(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.updateMute(),this.emit(r.MUTE,this,t))}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.updateVolume(),this.emit(r.VOLUME,this,t))}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,r.RATE,t)||(this.calculateRate(),this.emit(r.RATE,this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,r.DETUNE,t)||(this.calculateRate(),this.emit(r.DETUNE,this,t))}},setDetune:function(t){return this.detune=t,this},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(r.SEEK,this,t))}},setSeek:function(t){return this.seek=t,this},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(r.LOOP,this,t))}},setLoop:function(t){return this.loop=t,this}});t.exports=o},function(t,e,i){var n=i(123),s=i(0),r=i(69),o=i(326),a=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 o(this,t,e);return this.sounds.push(i),i},unlock:function(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each(function(e,i){for(var n=0;n-1&&(delete this.keys[n],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,i=t.sys,n=i.settings;t.init&&(t.init.call(t,n.data),n.status=s.INIT,n.isTransition&&i.events.emit(r.TRANSITION_INIT,n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=s.LOADING,e.once(h.COMPLETE,this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>s.START&&n.settings.status<=s.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=s.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)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.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(ethis._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatio0&&(t=(e=r(e,n.y))*this.aspectRatio)):(i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,n.x>0&&(e=(t=r(t,n.x))*(1/this.aspectRatio))),this._width=t,this._height=e,this},fitTo:function(t,e){return this.constrain(t,e,!0)},envelop:function(t,e){return this.constrain(t,e,!1)},setWidth:function(t){return this.setSize(t,this._height)},setHeight:function(t){return this.setSize(this._width,t)},toString:function(){return"[{ Size (width="+this._width+" height="+this._height+" aspectRatio="+this.aspectRatio+" aspectMode="+this.aspectMode+") }]"},copy:function(t){return t.setAspectMode(this.aspectMode),t.aspectRatio=this.aspectRatio,t.setSize(this.width,this.height)},destroy:function(){this._parent=null,this.snapTo=null},width:{get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},height:{get:function(){return this._height},set:function(t){this.setSize(this._width,t)}}});a.NONE=0,a.WIDTH_CONTROLS_HEIGHT=1,a.HEIGHT_CONTROLS_WIDTH=2,a.FIT=3,a.ENVELOP=4,t.exports=a},function(t,e,i){t.exports={ENTER_FULLSCREEN:i(951),FULLSCREEN_UNSUPPORTED:i(950),LEAVE_FULLSCREEN:i(949),ORIENTATION_CHANGE:i(948),RESIZE:i(947)}},function(t,e,i){var n=i(178),s=i(0),r=i(11),o=i(334),a=i(26),h=i(946),l=i(345),u=i(350),c=i(1),d=i(10),f=i(333),p=i(98),g=i(3),v=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.canvas,this.canvasBounds=new d,this.parent=null,this.parentIsWindow=!1,this.parentSize=new f,this.gameSize=new f,this.baseSize=new f,this.displaySize=new f,this.scaleMode=n.SCALE_MODE.NONE,this.resolution=1,this.zoom=1,this.displayScale=new g(1,1),this.autoRound=!1,this.autoCenter=n.CENTER.NO_CENTER,this.orientation=n.ORIENTATION.LANDSCAPE,this.fullscreen,this.fullscreenTarget=null,this._createdFullscreenTarget=!1,this._requestedFullscreenChange=!1,this.dirty=!1,this.resizeInterval=500,this._lastCheck=0,this._checkOrientation=!1,this.listeners={orientationChange:c,windowResize:c,fullScreenChange:c,fullScreenError:c}},preBoot:function(){this.parseConfig(this.game.config),this.game.events.once("boot",this.boot,this)},boot:function(){var t=this.game;this.canvas=t.canvas,this.fullscreen=t.device.fullscreen,this.scaleMode!==n.SCALE_MODE.RESIZE&&this.displaySize.setAspectMode(this.scaleMode),this.scaleMode===n.SCALE_MODE.NONE?this.resize(this.width,this.height):(this.getParentBounds(),this.parentSize.width>0&&this.parentSize.height>0&&this.displaySize.setParent(this.parentSize),this.refresh()),t.events.on(a.PRE_STEP,this.step,this),this.startListeners()},parseConfig:function(t){this.getParent(t),this.getParentBounds();var e=t.width,i=t.height,s=t.scaleMode,r=t.resolution,o=t.zoom,a=t.autoRound;if("string"==typeof e){var h=this.parentSize.width;0===h&&(h=window.innerWidth);var l=parseInt(e,10)/100;e=Math.floor(h*l)}if("string"==typeof i){var c=this.parentSize.height;0===c&&(c=window.innerHeight);var d=parseInt(i,10)/100;i=Math.floor(c*d)}this.resolution=1,this.scaleMode=s,this.autoRound=a,this.autoCenter=t.autoCenter,this.resizeInterval=t.resizeInterval,a&&(e=Math.floor(e),i=Math.floor(i)),this.gameSize.setSize(e,i),o===n.ZOOM.MAX_ZOOM&&(o=this.getMaxZoom()),this.zoom=o,this.baseSize.setSize(e*r,i*r),a&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),t.minWidth>0&&this.displaySize.setMin(t.minWidth*o,t.minHeight*o),t.maxWidth>0&&this.displaySize.setMax(t.maxWidth*o,t.maxHeight*o),this.displaySize.setSize(e,i),this.orientation=u(e,i)},getParent:function(t){var e=t.parent;if(null!==e){if(this.parent=l(e),this.parentIsWindow=this.parent===document.body,t.expandParent&&t.scaleMode!==n.SCALE_MODE.NONE){var i=this.parent.getBoundingClientRect();(this.parentIsWindow||0===i.height)&&(document.documentElement.style.height="100%",document.body.style.height="100%",i=this.parent.getBoundingClientRect(),this.parentIsWindow||0!==i.height||(this.parent.style.overflow="hidden",this.parent.style.width="100%",this.parent.style.height="100%"))}t.fullscreenTarget&&!this.fullscreenTarget&&(this.fullscreenTarget=l(t.fullscreenTarget))}},getParentBounds:function(){if(!this.parent)return!1;var t=this.parentSize,e=this.parent.getBoundingClientRect();this.parentIsWindow&&this.game.device.os.iOS&&(e.height=h(!0));var i=this.resolution,n=e.width*i,s=e.height*i;return(t.width!==n||t.height!==s)&&(t.setSize(n,s),!0)},lockOrientation:function(t){var e=screen.lockOrientation||screen.mozLockOrientation||screen.msLockOrientation;return!!e&&e(t)},setParentSize:function(t,e){return this.parentSize.setSize(t,e),this.refresh()},setGameSize:function(t,e){var i=this.autoRound,n=this.resolution;return i&&(t=Math.floor(t),e=Math.floor(e)),this.gameSize.resize(t,e),this.baseSize.resize(t*n,e*n),this.updateBounds(),this.displayScale.set(t/this.canvasBounds.width,e/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this.updateOrientation(),this.refresh()},resize:function(t,e){var i=this.zoom,n=this.resolution,s=this.autoRound;s&&(t=Math.floor(t),e=Math.floor(e)),this.gameSize.resize(t,e),this.baseSize.resize(t*n,e*n),this.displaySize.setSize(t*i*n,e*i*n),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height;var r=this.canvas.style,a=t*i,h=e*i;return s&&(a=Math.floor(a),h=Math.floor(h)),a===t&&h===e||(r.width=a+"px",r.height=h+"px"),this.getParentBounds(),this.updateCenter(),this.updateBounds(),this.displayScale.set(t/this.canvasBounds.width,e/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this.updateOrientation(),this},setZoom:function(t){return this.zoom=t,this.refresh()},setMaxZoom:function(){return this.zoom=this.getMaxZoom(),this.refresh()},refresh:function(){return this.updateScale(),this.updateBounds(),this.updateOrientation(),this.displayScale.set(this.baseSize.width/this.canvasBounds.width,this.baseSize.height/this.canvasBounds.height),this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,this.resolution),this},updateOrientation:function(){if(this._checkOrientation){this._checkOrientation=!1;var t=u(this.width,this.height);t!==this.orientation&&(this.orientation=t,this.emit(o.ORIENTATION_CHANGE,t))}},updateScale:function(){var t,e,i=this.canvas.style,s=this.gameSize.width,r=this.gameSize.height,o=this.zoom,a=this.autoRound;this.scaleMode===n.SCALE_MODE.NONE?(this.displaySize.setSize(s*o*1,r*o*1),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),o>1&&(i.width=t+"px",i.height=e+"px")):this.scaleMode===n.SCALE_MODE.RESIZE?(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),this.gameSize.setSize(this.displaySize.width,this.displaySize.height),this.baseSize.setSize(1*this.displaySize.width,1*this.displaySize.height),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),this.canvas.width=t,this.canvas.height=e):(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),t=this.displaySize.width/1,e=this.displaySize.height/1,a&&(t=Math.floor(t),e=Math.floor(e)),i.width=t+"px",i.height=e+"px"),this.getParentBounds(),this.updateCenter()},getMaxZoom:function(){var t=p(this.parentSize.width,this.gameSize.width,0,!0),e=p(this.parentSize.height,this.gameSize.height,0,!0);return Math.max(Math.min(t,e),1)},updateCenter:function(){var t=this.autoCenter;if(t!==n.CENTER.NO_CENTER){var e=this.canvas,i=e.style,s=e.getBoundingClientRect(),r=s.width,o=s.height,a=Math.floor((this.parentSize.width-r)/2),h=Math.floor((this.parentSize.height-o)/2);t===n.CENTER.CENTER_HORIZONTALLY?h=0:t===n.CENTER.CENTER_VERTICALLY&&(a=0),i.marginLeft=a+"px",i.marginTop=h+"px"}},updateBounds:function(){var t=this.canvasBounds,e=this.canvas.getBoundingClientRect();t.x=e.left+(window.pageXOffset||0)-(document.documentElement.clientLeft||0),t.y=e.top+(window.pageYOffset||0)-(document.documentElement.clientTop||0),t.width=e.width,t.height=e.height},transformX:function(t){return(t-this.canvasBounds.left)*this.displayScale.x},transformY:function(t){return(t-this.canvasBounds.top)*this.displayScale.y},startFullscreen:function(t){void 0===t&&(t={navigationUI:"hide"});var e=this.fullscreen;if(e.available){if(!e.active){var i=this.getFullscreenTarget();this._requestedFullscreenChange=!0,e.keyboard?i[e.request](Element.ALLOW_KEYBOARD_INPUT):i[e.request](t),this.getParentBounds(),this.refresh(),this.emit(o.ENTER_FULLSCREEN)}}else this.emit(o.FULLSCREEN_UNSUPPORTED)},getFullscreenTarget:function(){if(!this.fullscreenTarget){var t=document.createElement("div");t.style.margin="0",t.style.padding="0",t.style.width="100%",t.style.height="100%",this.fullscreenTarget=t,this._createdFullscreenTarget=!0}this._createdFullscreenTarget&&(this.canvas.parentNode.insertBefore(this.fullscreenTarget,this.canvas),this.fullscreenTarget.appendChild(this.canvas));return this.fullscreenTarget},stopFullscreen:function(){var t=this.fullscreen;if(!t.available)return this.emit(o.FULLSCREEN_UNSUPPORTED),!1;if(t.active&&(this._requestedFullscreenChange=!0,document[t.cancel]()),this._createdFullscreenTarget){var e=this.fullscreenTarget;if(e&&e.parentNode){var i=e.parentNode;i.insertBefore(this.canvas,e),i.removeChild(e)}}this.emit(o.LEAVE_FULLSCREEN),this.refresh()},toggleFullscreen:function(t){this.fullscreen.active?this.stopFullscreen():this.startFullscreen(t)},startListeners:function(){var t=this,e=this.listeners;if(e.orientationChange=function(){t._checkOrientation=!0,t.dirty=!0},e.windowResize=function(){t.dirty=!0},window.addEventListener("orientationchange",e.orientationChange,!1),window.addEventListener("resize",e.windowResize,!1),this.fullscreen.available){e.fullScreenChange=function(e){return t.onFullScreenChange(e)},e.fullScreenError=function(e){return t.onFullScreenError(e)};["webkit","moz",""].forEach(function(t){document.addEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.addEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.addEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.addEventListener("MSFullscreenError",e.fullScreenError,!1)}},onFullScreenChange:function(){this._requestedFullscreenChange||this.stopFullscreen(),this._requestedFullscreenChange=!1},onFullScreenError:function(){},step:function(t,e){this.parent&&(this._lastCheck+=e,(this.dirty||this._lastCheck>this.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var t=this.listeners;window.removeEventListener("orientationchange",t.orientationChange,!1),window.removeEventListener("resize",t.windowResize,!1);["webkit","moz",""].forEach(function(e){document.removeEventListener(e+"fullscreenchange",t.fullScreenChange,!1),document.removeEventListener(e+"fullscreenerror",t.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",t.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",t.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy(),this.fullscreenTarget=null},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===n.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===n.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(0),s=i(26),r=i(11),o=i(7),a=i(14),h=i(5),l=i(2),u=i(17),c=i(177),d=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once(s.BOOT,this.boot,this)},boot:function(){var t,e,i,n,r,o,a,h=this.game.config,u=h.installGlobalPlugins;for(u=u.concat(this._pendingGlobal),t=0;t-1&&e.preventDefault()}},this.onKeyUp=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.useQueue||t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}};var e=this.target;e&&(e.addEventListener("keydown",this.onKeyDown,!1),e.addEventListener("keyup",this.onKeyUp,!1),this.enabled=!0)},stopListeners:function(){var t=this.target;t.removeEventListener("keydown",this.onKeyDown,!1),t.removeEventListener("keyup",this.onKeyUp,!1),this.enabled=!1},postUpdate:function(){this.queue=[]},addCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},removeCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},clearCaptures:function(){this.captures=[],this.preventDefault=!1},destroy:function(){this.stopListeners(),this.clearCaptures(),this.queue=[],this.manager.game.events.off(r.POST_RENDER,this.postUpdate,this),this.target=null,this.enabled=!1,this.manager=null}});t.exports=l},function(t,e){t.exports={MOUSE_DOWN:0,MOUSE_MOVE:1,MOUSE_UP:2,TOUCH_START:3,TOUCH_MOVE:4,TOUCH_END:5,TOUCH_CANCEL:7,POINTER_LOCK_CHANGE:6}},function(t,e,i){var n=i(0),s=i(341),r=i(11),o=i(52),a=i(26),h=i(340),l=i(339),u=i(338),c=i(337),d=i(41),f=i(371),p=new n({initialize:function(t,e){this.game=t,this.scaleManager,this.canvas,this.config=e,this.enabled=!0,this.events=new r,this.queue=[],this.domCallbacks={up:[],down:[],move:[],upOnce:[],downOnce:[],moveOnce:[]},this.isOver=!0,this._hasUpCallback=!1,this._hasDownCallback=!1,this._hasMoveCallback=!1,this._customCursor="",this._setCursor=0,this.defaultCursor="",this.keyboard=e.inputKeyboard?new h(this):null,this.mouse=e.inputMouse?new l(this):null,this.touch=e.inputTouch?new c(this):null,this.pointers=[],this.pointersTotal=e.inputActivePointers,e.inputTouch&&1===this.pointersTotal&&(this.pointersTotal=2);for(var i=0;i<=this.pointersTotal;i++){var n=new u(this,i);n.smoothFactor=e.inputSmoothFactor,this.pointers.push(n)}this.mousePointer=e.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.dirty=!1,this.globalTopOnly=!0,this.ignoreEvents=!1,this.useQueue=e.inputQueue,this.time=0,this._updatedThisFrame=!1,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new d,this._tempMatrix2=new d,t.events.once(a.BOOT,this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.scaleManager=this.game.scale,this.events.emit(o.MANAGER_BOOT),this.useQueue?this.game.events.on(a.PRE_STEP,this.legacyUpdate,this):this.game.events.on(a.PRE_STEP,this.preStep,this),this.game.events.on(a.POST_STEP,this.postUpdate,this),this.game.events.once(a.DESTROY,this.destroy,this)},setCanvasOver:function(t){this.isOver=!0,this.events.emit(o.GAME_OVER,t)},setCanvasOut:function(t){this.isOver=!1,this.events.emit(o.GAME_OUT,t)},update:function(t){this._updatedThisFrame||(this._setCursor=0,this._updatedThisFrame=!0),this.events.emit(o.MANAGER_UPDATE),this.ignoreEvents=!1,this.dirty=!0;for(var e=this.pointers,i=0;i10&&(t=10-this.pointersTotal);for(var i=0;i0},updateInputPlugins:function(t,e){for(var i=this.game.scene.getScenes(!0,!0),n=0;ni.width?n.PORTRAIT:n.LANDSCAPE;if("number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?n.PORTRAIT:n.LANDSCAPE;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return n.PORTRAIT;if(window.matchMedia("(orientation: landscape)").matches)return n.LANDSCAPE}return e>t?n.PORTRAIT:n.LANDSCAPE}},function(t,e,i){var n=i(99);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,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e){t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},function(t,e,i){var n=i(32);n.ColorToRGBA=i(1005),n.ComponentToHex=i(353),n.GetColor=i(191),n.GetColor32=i(409),n.HexStringToColor=i(410),n.HSLToColor=i(1004),n.HSVColorWheel=i(1003),n.HSVToRGB=i(190),n.HueToComponent=i(352),n.IntegerToColor=i(407),n.IntegerToRGB=i(406),n.Interpolate=i(1002),n.ObjectToColor=i(405),n.RandomRGB=i(1001),n.RGBStringToColor=i(404),n.RGBToHSV=i(408),n.RGBToString=i(1e3),n.ValueToColor=i(192),t.exports=n},function(t,e,i){var n=i(185),s=i(0),r=i(76),o=i(3),a=new s({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.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;ei;)n-=i;n0||!this.inFocus)&&(this._coolDown--,r=Math.min(r,this._target)),r>this._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var o=0,a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},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,i){var n=i(28);t.exports=function(t){var e=t.config;if(!e.hideBanner){var i="WebGL";e.renderType===n.CANVAS?i="Canvas":e.renderType===n.HEADLESS&&(i="Headless");var s,r=e.audio,o=t.device.audio;if(s=!o.webAudio||r&&r.disableWebAudio?r&&r.noAudio||!o.webAudio&&!o.audioData?"No Audio":"HTML5 Audio":"Web Audio",t.device.browser.ie)window.console&&console.log("Phaser v"+n.VERSION+" / https://phaser.io");else{var a,h="",l=[h];Array.isArray(e.bannerBackgroundColor)?(e.bannerBackgroundColor.forEach(function(t){h=h.concat("%c "),l.push("background: "+t),a=t}),l[l.length-1]="color: "+e.bannerTextColor+"; background: "+a):(h=h.concat("%c "),l.push("color: "+e.bannerTextColor+"; background: "+e.bannerBackgroundColor)),l.push("background: #fff"),e.gameTitle&&(h=h.concat(e.gameTitle),e.gameVersion&&(h=h.concat(" v"+e.gameVersion)),e.hidePhaser||(h=h.concat(" / "))),e.hidePhaser||(h=h.concat("Phaser v"+n.VERSION+" ("+i+" | "+s+")")),h=h.concat(" %c "+e.gameURL),l[0]=h,console.log.apply(console,l)}}}},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","crisp-edges","-moz-crisp-edges","-webkit-optimize-contrast","optimize-contrast","pixelated"].forEach(function(e){t.style["image-rendering"]=e}),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(366),s=i(24),r=i(28),o=i(187);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===r.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==r.HEADLESS)if(e.renderType===r.CANVAS||e.renderType!==r.CANVAS&&!o.webGL){if(!o.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=r.CANVAS}else e.renderType=r.WEBGL;e.antialias||s.disableSmoothing();var a,h,l=t.scale.baseSize,u=l.width,c=l.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=u,t.canvas.height=c):t.canvas=s.create(t,u,c,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||n.setCrisp(t.canvas),e.renderType!==r.HEADLESS&&(a=i(459),h=i(456),e.renderType===r.WEBGL?t.renderer=new h(t):(t.renderer=new a(t),t.context=t.renderer.gameContext))}},function(t,e,i){var n=i(0),s=i(182),r=i(370),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(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(16),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],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],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],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},zero:function(){var t=this.val;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=0,this},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){var t=this.val;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},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],s=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=s,t[11]=t[14],t[12]=n,t[13]=r,t[14]=o,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=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15],y=e*o-i*r,m=e*a-n*r,x=e*h-s*r,T=i*a-n*o,w=i*h-s*o,b=n*h-s*a,S=l*p-u*f,_=l*g-c*f,A=l*v-d*f,E=u*g-c*p,C=u*v-d*p,M=c*v-d*g,P=y*M-m*C+x*E+T*A-w*_+b*S;return P?(P=1/P,t[0]=(o*M-a*C+h*E)*P,t[1]=(n*C-i*M-s*E)*P,t[2]=(p*b-g*w+v*T)*P,t[3]=(c*w-u*b-d*T)*P,t[4]=(a*A-r*M-h*_)*P,t[5]=(e*M-n*A+s*_)*P,t[6]=(g*x-f*b-v*m)*P,t[7]=(l*b-c*x+d*m)*P,t[8]=(r*C-o*A+h*S)*P,t[9]=(i*A-e*C-s*S)*P,t[10]=(f*w-p*x+v*y)*P,t[11]=(u*x-l*w-d*y)*P,t[12]=(o*_-r*E-a*S)*P,t[13]=(e*E-i*_+n*S)*P,t[14]=(p*m-f*T-g*y)*P,t[15]=(l*T-u*m+c*y)*P,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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return t[0]=o*(c*v-d*g)-u*(a*v-h*g)+p*(a*d-h*c),t[1]=-(i*(c*v-d*g)-u*(n*v-s*g)+p*(n*d-s*c)),t[2]=i*(a*v-h*g)-o*(n*v-s*g)+p*(n*h-s*a),t[3]=-(i*(a*d-h*c)-o*(n*d-s*c)+u*(n*h-s*a)),t[4]=-(r*(c*v-d*g)-l*(a*v-h*g)+f*(a*d-h*c)),t[5]=e*(c*v-d*g)-l*(n*v-s*g)+f*(n*d-s*c),t[6]=-(e*(a*v-h*g)-r*(n*v-s*g)+f*(n*h-s*a)),t[7]=e*(a*d-h*c)-r*(n*d-s*c)+l*(n*h-s*a),t[8]=r*(u*v-d*p)-l*(o*v-h*p)+f*(o*d-h*u),t[9]=-(e*(u*v-d*p)-l*(i*v-s*p)+f*(i*d-s*u)),t[10]=e*(o*v-h*p)-r*(i*v-s*p)+f*(i*h-s*o),t[11]=-(e*(o*d-h*u)-r*(i*d-s*u)+l*(i*h-s*o)),t[12]=-(r*(u*g-c*p)-l*(o*g-a*p)+f*(o*c-a*u)),t[13]=e*(u*g-c*p)-l*(i*g-n*p)+f*(i*c-n*u),t[14]=-(e*(o*g-a*p)-r*(i*g-n*p)+f*(i*a-n*o)),t[15]=e*(o*c-a*u)-r*(i*c-n*u)+l*(i*a-n*o),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],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=t[15];return(e*o-i*r)*(c*v-d*g)-(e*a-n*r)*(u*v-d*p)+(e*h-s*r)*(u*g-c*p)+(i*a-n*o)*(l*v-d*f)-(i*h-s*o)*(l*g-c*f)+(n*h-s*a)*(l*p-u*f)},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=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],y=e[15],m=t.val,x=m[0],T=m[1],w=m[2],b=m[3];return e[0]=x*i+T*o+w*u+b*p,e[1]=x*n+T*a+w*c+b*g,e[2]=x*s+T*h+w*d+b*v,e[3]=x*r+T*l+w*f+b*y,x=m[4],T=m[5],w=m[6],b=m[7],e[4]=x*i+T*o+w*u+b*p,e[5]=x*n+T*a+w*c+b*g,e[6]=x*s+T*h+w*d+b*v,e[7]=x*r+T*l+w*f+b*y,x=m[8],T=m[9],w=m[10],b=m[11],e[8]=x*i+T*o+w*u+b*p,e[9]=x*n+T*a+w*c+b*g,e[10]=x*s+T*h+w*d+b*v,e[11]=x*r+T*l+w*f+b*y,x=m[12],T=m[13],w=m[14],b=m[15],e[12]=x*i+T*o+w*u+b*p,e[13]=x*n+T*a+w*c+b*g,e[14]=x*s+T*h+w*d+b*v,e[15]=x*r+T*l+w*f+b*y,this},multiplyLocal:function(t){var e=[],i=this.val,n=t.val;return e[0]=i[0]*n[0]+i[1]*n[4]+i[2]*n[8]+i[3]*n[12],e[1]=i[0]*n[1]+i[1]*n[5]+i[2]*n[9]+i[3]*n[13],e[2]=i[0]*n[2]+i[1]*n[6]+i[2]*n[10]+i[3]*n[14],e[3]=i[0]*n[3]+i[1]*n[7]+i[2]*n[11]+i[3]*n[15],e[4]=i[4]*n[0]+i[5]*n[4]+i[6]*n[8]+i[7]*n[12],e[5]=i[4]*n[1]+i[5]*n[5]+i[6]*n[9]+i[7]*n[13],e[6]=i[4]*n[2]+i[5]*n[6]+i[6]*n[10]+i[7]*n[14],e[7]=i[4]*n[3]+i[5]*n[7]+i[6]*n[11]+i[7]*n[15],e[8]=i[8]*n[0]+i[9]*n[4]+i[10]*n[8]+i[11]*n[12],e[9]=i[8]*n[1]+i[9]*n[5]+i[10]*n[9]+i[11]*n[13],e[10]=i[8]*n[2]+i[9]*n[6]+i[10]*n[10]+i[11]*n[14],e[11]=i[8]*n[3]+i[9]*n[7]+i[10]*n[11]+i[11]*n[15],e[12]=i[12]*n[0]+i[13]*n[4]+i[14]*n[8]+i[15]*n[12],e[13]=i[12]*n[1]+i[13]*n[5]+i[14]*n[9]+i[15]*n[13],e[14]=i[12]*n[2]+i[13]*n[6]+i[14]*n[10]+i[15]*n[14],e[15]=i[12]*n[3]+i[13]*n[7]+i[14]*n[11]+i[15]*n[15],this.fromArray(e)},translate:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[12]=s[0]*e+s[4]*i+s[8]*n+s[12],s[13]=s[1]*e+s[5]*i+s[9]*n+s[13],s[14]=s[2]*e+s[6]*i+s[10]*n+s[14],s[15]=s[3]*e+s[7]*i+s[11]*n+s[15],this},translateXYZ:function(t,e,i){var n=this.val;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},scale:function(t){var e=t.x,i=t.y,n=t.z,s=this.val;return s[0]=s[0]*e,s[1]=s[1]*e,s[2]=s[2]*e,s[3]=s[3]*e,s[4]=s[4]*i,s[5]=s[5]*i,s[6]=s[6]*i,s[7]=s[7]*i,s[8]=s[8]*n,s[9]=s[9]*n,s[10]=s[10]*n,s[11]=s[11]*n,this},scaleXYZ:function(t,e,i){var n=this.val;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},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,o=t.y,a=t.z,h=s*r,l=s*o;return this.fromArray([h*r+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*r,0,h*a-n*o,l*a+n*r,s*a*a+i,0,0,0,0,1]),this},rotate:function(t,e){var i=this.val,n=e.x,s=e.y,r=e.z,o=Math.sqrt(n*n+s*s+r*r);if(Math.abs(o)<1e-6)return null;n*=o=1/o,s*=o,r*=o;var a=Math.sin(t),h=Math.cos(t),l=1-h,u=i[0],c=i[1],d=i[2],f=i[3],p=i[4],g=i[5],v=i[6],y=i[7],m=i[8],x=i[9],T=i[10],w=i[11],b=n*n*l+h,S=s*n*l+r*a,_=r*n*l-s*a,A=n*s*l-r*a,E=s*s*l+h,C=r*s*l+n*a,M=n*r*l+s*a,P=s*r*l-n*a,O=r*r*l+h;return i[0]=u*b+p*S+m*_,i[1]=c*b+g*S+x*_,i[2]=d*b+v*S+T*_,i[3]=f*b+y*S+w*_,i[4]=u*A+p*E+m*C,i[5]=c*A+g*E+x*C,i[6]=d*A+v*E+T*C,i[7]=f*A+y*E+w*C,i[8]=u*M+p*P+m*O,i[9]=c*M+g*P+x*O,i[10]=d*M+v*P+T*O,i[11]=f*M+y*P+w*O,this},rotateX:function(t){var e=this.val,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},rotateY:function(t){var e=this.val,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},rotateZ:function(t){var e=this.val,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},fromRotationTranslation:function(t,e){var i=this.val,n=t.x,s=t.y,r=t.z,o=t.w,a=n+n,h=s+s,l=r+r,u=n*a,c=n*h,d=n*l,f=s*h,p=s*l,g=r*l,v=o*a,y=o*h,m=o*l;return i[0]=1-(f+g),i[1]=c+m,i[2]=d-y,i[3]=0,i[4]=c-m,i[5]=1-(u+g),i[6]=p+v,i[7]=0,i[8]=d+y,i[9]=p-v,i[10]=1-(u+f),i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},fromQuat:function(t){var e=this.val,i=t.x,n=t.y,s=t.z,r=t.w,o=i+i,a=n+n,h=s+s,l=i*o,u=i*a,c=i*h,d=n*a,f=n*h,p=s*h,g=r*o,v=r*a,y=r*h;return e[0]=1-(d+p),e[1]=u+y,e[2]=c-v,e[3]=0,e[4]=u-y,e[5]=1-(l+p),e[6]=f+g,e[7]=0,e[8]=c+v,e[9]=f-g,e[10]=1-(l+d),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},frustum:function(t,e,i,n,s,r){var o=this.val,a=1/(e-t),h=1/(n-i),l=1/(s-r);return o[0]=2*s*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*s*h,o[6]=0,o[7]=0,o[8]=(e+t)*a,o[9]=(n+i)*h,o[10]=(r+s)*l,o[11]=-1,o[12]=0,o[13]=0,o[14]=r*s*2*l,o[15]=0,this},perspective:function(t,e,i,n){var s=this.val,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},perspectiveLH:function(t,e,i,n){var s=this.val;return s[0]=2*i/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/e,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=-n/(i-n),s[11]=1,s[12]=0,s[13]=0,s[14]=i*n/(i-n),s[15]=0,this},ortho:function(t,e,i,n,s,r){var o=this.val,a=t-e,h=i-n,l=s-r;return a=0===a?a:1/a,h=0===h?h:1/h,l=0===l?l:1/l,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},lookAt:function(t,e,i){var n=this.val,s=t.x,r=t.y,o=t.z,a=i.x,h=i.y,l=i.z,u=e.x,c=e.y,d=e.z;if(Math.abs(s-u)<1e-6&&Math.abs(r-c)<1e-6&&Math.abs(o-d)<1e-6)return this.identity();var f=s-u,p=r-c,g=o-d,v=1/Math.sqrt(f*f+p*p+g*g),y=h*(g*=v)-l*(p*=v),m=l*(f*=v)-a*g,x=a*p-h*f;(v=Math.sqrt(y*y+m*m+x*x))?(y*=v=1/v,m*=v,x*=v):(y=0,m=0,x=0);var T=p*x-g*m,w=g*y-f*x,b=f*m-p*y;return(v=Math.sqrt(T*T+w*w+b*b))?(T*=v=1/v,w*=v,b*=v):(T=0,w=0,b=0),n[0]=y,n[1]=T,n[2]=f,n[3]=0,n[4]=m,n[5]=w,n[6]=p,n[7]=0,n[8]=x,n[9]=b,n[10]=g,n[11]=0,n[12]=-(y*s+m*r+x*o),n[13]=-(T*s+w*r+b*o),n[14]=-(f*s+p*r+g*o),n[15]=1,this},yawPitchRoll:function(t,e,i){this.zero(),s.zero(),r.zero();var n=this.val,o=s.val,a=r.val,h=Math.sin(i),l=Math.cos(i);return n[10]=1,n[15]=1,n[0]=l,n[1]=h,n[4]=-h,n[5]=l,h=Math.sin(e),l=Math.cos(e),o[0]=1,o[15]=1,o[5]=l,o[10]=l,o[9]=-h,o[6]=h,h=Math.sin(t),l=Math.cos(t),a[5]=1,a[15]=1,a[0]=l,a[2]=-h,a[8]=h,a[10]=l,this.multiplyLocal(s),this.multiplyLocal(r),this},setWorldMatrix:function(t,e,i,n,o){return this.yawPitchRoll(t.y,t.x,t.z),s.scaling(i.x,i.y,i.z),r.xyz(e.x,e.y,e.z),this.multiplyLocal(s),this.multiplyLocal(r),void 0!==n&&this.multiplyLocal(n),void 0!==o&&this.multiplyLocal(o),this}}),s=new n,r=new n;t.exports=n},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],T=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+T*h,e[7]=m*n+x*o+T*l,e[8]=m*s+x*a+T*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,T=n*l-r*a,w=n*u-o*a,b=s*l-r*h,S=s*u-o*h,_=r*u-o*l,A=c*v-d*g,E=c*y-f*g,C=c*m-p*g,M=d*y-f*v,P=d*m-p*v,O=f*m-p*y,R=x*O-T*P+w*M+b*C-S*E+_*A;return R?(R=1/R,i[0]=(h*O-l*P+u*M)*R,i[1]=(l*C-a*O-u*E)*R,i[2]=(a*P-h*C+u*A)*R,i[3]=(r*P-s*O-o*M)*R,i[4]=(n*O-r*C+o*E)*R,i[5]=(s*C-n*P-o*A)*R,i[6]=(v*_-y*S+m*b)*R,i[7]=(y*w-g*_-m*T)*R,i[8]=(g*S-v*w+m*x)*R,this):null}});t.exports=n},function(t,e,i){var n=i(3);t.exports=function(t,e,i,s,r,o,a,h){void 0===h&&(h=new n);var l=Math.sin(r),u=Math.cos(r),c=u*o,d=l*o,f=-l*a,p=u*a,g=1/(c*p+f*-d);return h.x=p*g*t+-f*g*e+(s*f-i*p)*g,h.y=c*g*e+-d*g*t+(-s*c+i*d)*g,h}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},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,e){return Math.random()*(e-t)+t}},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e){t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<e-i}},function(t,e){t.exports=function(t,e,i,n){var s=t-i,r=e-n;return s*s+r*r}},function(t,e){t.exports=function(t){return(t%=2*Math.PI)>=0?t:t+2*Math.PI}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e,i){var n=i(20),s=i(19),r={Angle:i(1091),Distance:i(1083),Easing:i(1081),Fuzzy:i(1080),Interpolation:i(1077),Pow2:i(1072),Snap:i(1070),RandomDataGenerator:i(1068),Average:i(1067),Bernstein:i(381),Between:i(184),CatmullRom:i(185),CeilTo:i(1066),Clamp:i(23),DegToRad:i(34),Difference:i(1065),Factorial:i(380),FloatBetween:i(374),FloorTo:i(1064),FromPercent:i(100),GetSpeed:i(1063),IsEven:i(1062),IsEvenStrict:i(1061),Linear:i(129),MaxAdd:i(1060),MinSub:i(1059),Percent:i(1058),RadToDeg:i(183),RandomXY:i(1057),RandomXYZ:i(1056),RandomXYZW:i(1055),Rotate:i(373),RotateAround:i(428),RotateAroundDistance:i(197),RoundAwayFromZero:i(372),RoundTo:i(1054),SinCosTableGenerator:i(1053),SmootherStep:i(196),SmoothStep:i(195),TransformXY:i(371),Within:i(1052),Wrap:i(57),Vector2:i(3),Vector3:i(182),Vector4:i(1051),Matrix3:i(370),Matrix4:i(369),Quaternion:i(368),RotateVec3:i(1050)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n,s,r,o=i(24),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){t.exports={os:i(99),browser:i(128),features:i(187),input:i(1095),audio:i(1094),video:i(1093),fullscreen:i(1092),canvasFeatures:i(388)}},function(t,e,i){var n=i(0),s=i(28),r=i(389),o=i(2),a=i(4),h=i(8),l=i(387),u=i(1),c=i(181),d=i(192),f=new n({initialize:function(t){void 0===t&&(t={});this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.resolution=a(t,"resolution",1),this.parent=a(t,"parent",void 0),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!0),this.autoRound=a(t,"autoRound",!1),this.autoCenter=a(t,"autoCenter",0),this.resizeInterval=a(t,"resizeInterval",500),this.fullscreenTarget=a(t,"fullscreenTarget",null),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.resolution=a(e,"resolution",this.resolution),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"expandParent",this.expandParent),this.autoRound=a(e,"autoRound",this.autoRound),this.autoCenter=a(e,"autoCenter",this.autoCenter),this.resizeInterval=a(e,"resizeInterval",this.resizeInterval),this.fullscreenTarget=a(e,"fullscreenTarget",this.fullscreenTarget),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",s.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.customEnvironment=a(t,"customEnvironment",!1),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),l.RND=new l.RandomDataGenerator(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputKeyboardCapture=a(t,"input.keyboard.capture",[]),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMouseCapture=a(t,"input.mouse.capture",!0),this.inputTouch=a(t,"input.touch",r.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputSmoothFactor=a(t,"input.smoothFactor",0),this.inputQueue=a(t,"input.queue",!1),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio"),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.antialias=a(i,"antialias",!0),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",1!==this.zoom),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",2e3),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",u),this.postBoot=a(t,"callbacks.postBoot",u),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path",""),this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),p=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?p=f.default:Array.isArray(f.defaultMerge)&&(p=p.concat(f.defaultMerge)))),this.defaultPlugins=p;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=s.WEBGL:window.FORCE_CANVAS&&(this.renderType=s.CANVAS))}});t.exports=f},function(t,e,i){t.exports=i(1119)},function(t,e,i){t.exports={In:i(1122),Out:i(1121),InOut:i(1120)}},function(t,e,i){t.exports={In:i(1125),Out:i(1124),InOut:i(1123)}},function(t,e,i){t.exports={In:i(1128),Out:i(1127),InOut:i(1126)}},function(t,e,i){t.exports={In:i(1131),Out:i(1130),InOut:i(1129)}},function(t,e,i){t.exports=i(1132)},function(t,e,i){t.exports={In:i(1135),Out:i(1134),InOut:i(1133)}},function(t,e,i){t.exports={In:i(1138),Out:i(1137),InOut:i(1136)}},function(t,e,i){t.exports={In:i(1141),Out:i(1140),InOut:i(1139)}},function(t,e,i){t.exports={In:i(1144),Out:i(1143),InOut:i(1142)}},function(t,e,i){t.exports={In:i(1147),Out:i(1146),InOut:i(1145)}},function(t,e,i){t.exports={In:i(1150),Out:i(1149),InOut:i(1148)}},function(t,e,i){t.exports={Fade:i(1153),Flash:i(1152),Pan:i(1151),Shake:i(1118),Zoom:i(1117)}},function(t,e,i){var n=i(32);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,i){var n=i(32);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e){t.exports=function(t){return t>16777215?{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(32),s=i(406);t.exports=function(t){var e=s(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(ed.right&&(f=u(f,f+(g-d.right),this.lerp.x)),vd.bottom&&(p=u(p,p+(v-d.bottom),this.lerp.y))):(f=u(f,g-h,this.lerp.x),p=u(p,v-l,this.lerp.y))}this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.roundPixels&&(h=Math.round(h),l=Math.round(l)),this.scrollX=f,this.scrollY=p;var y=f+n,m=p+s;this.midPoint.set(y,m);var x=e/o,T=i/o;this.worldView.setTo(y-x/2,m-T/2,x,T),a.applyITRS(this.x+h,this.y+l,this.rotation,o,o),a.translate(-h,-l),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=o(i,0,1),n=o(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var a=this.width/2,h=this.height/2,l=t.x-s,u=t.y-r;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},function(t,e,i){var n=i(414),s=i(0),r=i(26),o=new s({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.html=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once(r.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","html","obj","tilemap","xml"],e=0;e-h&&(c-=h,n+=l),f=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,i){t.exports={CHANGE_DATA:i(1238),CHANGE_DATA_KEY:i(1237),REMOVE_DATA:i(1236),SET_DATA:i(1235)}},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,i){var n=i(20),s=i(41),r=i(214),o=i(213),a={_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 o(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=r(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},setRandomPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===n&&(n=this.scene.sys.scale.height),this.x=t+Math.random()*i,this.y=e+Math.random()*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},getLocalTransformMatrix:function(t){return void 0===t&&(t=new s),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new s),void 0===e&&(e=new s);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t}};t.exports=a},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){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,i){var n=new(i(0))({initialize:function(t,e){this.geometryMask=e,this.invertAlpha=!1},setShape:function(t){this.geometryMask=t},preRenderWebGL:function(t,e,i){var n=t.gl,s=this.geometryMask;t.flush(),n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.NOTEQUAL,1,1),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),s.renderWebGL(t,s,0,i),t.flush(),n.colorMask(!0,!0,!0,!0),this.invertAlpha?n.stencilFunc(n.NOTEQUAL,1,1):n.stencilFunc(n.EQUAL,1,1),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)},postRenderWebGL:function(t){var e=t.gl;t.flush(),e.disable(e.STENCIL_TEST)},preRenderCanvas:function(t,e,i){var n=this.geometryMask;t.currentContext.save(),n.renderCanvas(t,n,0,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){var i=t.sys.game.renderer;if(this.renderer=i,this.bitmapMask=e,this.maskTexture=null,this.mainTexture=null,this.dirty=!0,this.mainFramebuffer=null,this.maskFramebuffer=null,this.invertAlpha=!1,i&&i.gl){var n=i.width,s=i.height,r=0==(n&n-1)&&0==(s&s-1),o=i.gl,a=r?o.REPEAT:o.CLAMP_TO_EDGE,h=o.LINEAR;this.mainTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.maskTexture=i.createTexture2D(0,h,h,a,a,o.RGBA,null,n,s),this.mainFramebuffer=i.createFramebuffer(n,s,this.mainTexture,!1),this.maskFramebuffer=i.createFramebuffer(n,s,this.maskTexture,!1),i.onContextRestored(function(t){var e=t.width,i=t.height,n=0==(e&e-1)&&0==(i&i-1),s=t.gl,r=n?s.REPEAT:s.CLAMP_TO_EDGE,o=s.LINEAR;this.mainTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.maskTexture=t.createTexture2D(0,o,o,r,r,s.RGBA,null,e,i),this.mainFramebuffer=t.createFramebuffer(e,i,this.mainTexture,!1),this.maskFramebuffer=t.createFramebuffer(e,i,this.maskTexture,!1)},this)}},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BitmapMaskPipeline.beginMask(this,e,i)},postRenderWebGL:function(t){t.pipelines.BitmapMaskPipeline.endMask(this)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null;var t=this.renderer;t&&t.gl&&(t.deleteTexture(this.mainTexture),t.deleteTexture(this.maskTexture),t.deleteFramebuffer(this.mainFramebuffer),t.deleteFramebuffer(this.maskFramebuffer)),this.mainTexture=null,this.maskTexture=null,this.mainFramebuffer=null,this.maskFramebuffer=null,this.renderer=null}});t.exports=n},function(t,e,i){var n=i(426),s=i(425),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t){return void 0===t&&this.texture&&(t=this),new n(this.scene,t)},createGeometryMask:function(t){return void 0===t&&"Graphics"===this.type&&(t=this),new s(this.scene,t)}};t.exports=r},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x-e,a=t.y-i;return t.x=o*s-a*r+e,t.y=o*r+a*s+i,t}},function(t,e,i){var n=i(6);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(204),s=i(135);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=s(t)/i);for(var o=0;o=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},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},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t,e,i){if(!e.length)return NaN;if(1===e.length)return e[0];var n,s,r=1;if(i){if(te.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=i(23),s={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,s){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=n(t,0,1),this._alphaTR=n(e,0,1),this._alphaBL=n(i,0,1),this._alphaBR=n(s,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=n(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=n(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=n(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=n(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=n(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=s},function(t,e){t.exports=function(t){return Math.PI*t.radius*2}},function(t,e,i){var n=i(436),s=i(207),r=i(100),o=i(20);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h0&&n>0;if(o&&a){var h=o[0],l=o[1],u=o[2],c=o[3];a=h!==t||l!==e||u!==i||c!==n}a&&(this.flush(),r.scissor(t,s-e-n,i,n))},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},setPipeline:function(t,e){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(e),this.currentPipeline},rebindPipeline:function(t){var e=this.gl;e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.disable(e.STENCIL_TEST),e.clear(e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),e.viewport(0,0,this.width,this.height),this.setBlendMode(0,!0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.blankTexture.glTexture),this.currentActiveTextureUnit=0,this.currentTextures[0]=this.blankTexture.glTexture,this.currentPipeline=t,this.currentPipeline.bind(),this.currentPipeline.onBind()},clearPipeline:function(){this.flush(),this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.setBlendMode(0,!0)},setBlendMode:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.blendModes[t];return!!(e||t!==o.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t)&&(this.flush(),i.enable(i.BLEND),i.blendEquation(n.equation),n.func.length>2?i.blendFuncSeparate(n.func[0],n.func[1],n.func[2],n.func[3]):i.blendFunc(n.func[0],n.func[1]),this.currentBlendMode=t,!0)},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>17&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setBlankTexture:function(t){void 0===t&&(t=!1),!t&&0===this.currentActiveTextureUnit&&this.currentTextures[0]||this.setTexture2D(this.blankTexture.glTexture,0)},setTexture2D:function(t,e,i){void 0===i&&(i=!0);var n=this.gl;return t!==this.currentTextures[e]&&(i&&this.flush(),this.currentActiveTextureUnit!==e&&(n.activeTexture(n.TEXTURE0+e),this.currentActiveTextureUnit=e),n.bindTexture(n.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.width,s=this.height;return t!==this.currentFramebuffer&&(t&&t.renderTexture?(n=t.renderTexture.width,s=t.renderTexture.height):this.flush(),i.bindFramebuffer(i.FRAMEBUFFER,t),i.viewport(0,0,n,s),e&&(t?(this.drawingBufferHeight=s,this.pushScissor(0,0,n,s)):(this.drawingBufferHeight=this.height,this.popScissor())),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 s=this.gl,r=s.NEAREST,h=s.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,a(e,i)&&(h=s.REPEAT),n===o.ScaleModes.LINEAR&&this.config.antialias&&(r=s.LINEAR),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,r,r,h,h,s.RGBA,t):this.createTexture2D(0,r,r,h,h,s.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){l=void 0===l||null===l||l;var u=this.gl,c=u.createTexture();return 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){var e=this.nativeTextures.indexOf(t);return-1!==e&&h(this.nativeTextures,e),this.gl.deleteTexture(t),this.currentTextures[0]!==t||this.game.pendingDestroy||this.setBlankTexture(!0),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=t._cx,i=t._cy,n=t._cw,r=t._ch,o=this.pipelines.TextureTintPipeline,a=t.backgroundColor;if(t.renderToTexture){this.flush(),this.pushScissor(e,i,n,-r),this.setFramebuffer(t.framebuffer);var h=this.gl;h.clearColor(0,0,0,0),h.clear(h.COLOR_BUFFER_BIT),o.projOrtho(e,n+e,i,r+i,-1e3,1e3),a.alphaGL>0&&o.drawFillRect(e,i,n+e,r+i,c.getTintFromFloats(a.redGL,a.greenGL,a.blueGL,1),a.alphaGL),t.emit(s.PRE_RENDER,t)}else this.pushScissor(e,i,n,r),a.alphaGL>0&&o.drawFillRect(e,i,n,r,c.getTintFromFloats(a.redGL,a.greenGL,a.blueGL,1),a.alphaGL)},postRenderCamera:function(t){var e=this.pipelines.TextureTintPipeline;if(t.flashEffect.postRenderWebGL(e,c.getTintFromFloats),t.fadeEffect.postRenderWebGL(e,c.getTintFromFloats),t.dirty=!1,this.popScissor(),t.renderToTexture){e.flush(),this.setFramebuffer(null),t.emit(s.POST_RENDER,t),e.projOrtho(0,e.width,e.height,0,-1e3,1e3);var i=c.getTintAppendFloatAlpha;(t.pipeline?t.pipeline:e).batchTexture(t,t.glTexture,t.width,t.height,t.x,t.y,t.width,t.height,t.zoom,t.zoom,t.rotation,t.flipX,!t.flipY,1,1,0,0,0,0,t.width,t.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),t._isTinted&&t.tintFill,0,0,this.defaultCamera,null),this.setBlankTexture(!0)}},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.pipelines;if(t.bindFramebuffer(t.FRAMEBUFFER,null),this.config.clearBeforeRender){var i=this.config.backgroundColor;t.clearColor(i.redGL,i.greenGL,i.blueGL,i.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}for(var n in t.enable(t.SCISSOR_TEST),e)e[n].onPreRender();this.currentScissor=[0,0,this.width,this.height],this.scissorStack=[this.currentScissor],this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.setPipeline(this.pipelines.TextureTintPipeline)}},render:function(t,e,i,n){if(!this.contextLost){var s=e.list,r=s.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;l=0?g=-(g+d):g<0&&(g=Math.abs(g)-d)),-1===m&&(v>=0?v=-(v+f):v<0&&(v=Math.abs(v)-f))}a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y,o.multiply(a,h)):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY,o.multiply(a,h)),r.save(),h.setToContext(r),r.scale(y,m),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=s,r.drawImage(e.source.image,u,c,d,f,g,v,d/p,f/p),r.restore()}},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e,i){var n=i(205),s=i(0),r=i(136),o=new s({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.once(r.REMOVE_ANIMATION,this.remove,this),this.isPlaying=!1,this.currentAnim=null,this.currentFrame=null,this.nextAnim=null,this._timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this._delay=0,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this.forward=!0,this._reverse=!1,this.accumulator=0,this.nextTick=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},chain:function(t){return t instanceof n&&(t=t.key),this.nextAnim=t,this.parent},setDelay:function(t){return void 0===t&&(t=0),this._delay=t,this.parent},getDelay:function(){return this._delay},delayedPlay:function(t,e,i){return this.play(e,!0,i),this.nextTick+=t,this.parent},getCurrentKey:function(){if(this.currentAnim)return this.currentAnim.key},load:function(t,e){return void 0===e&&(e=0),this.isPlaying&&this.stop(),this.animationManager.load(this,t,e),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.updateFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.updateFrame(t),this.parent},isPaused:{get:function(){return this._paused}},play:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),t instanceof n&&(t=t.key),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!0,this._reverse=!1,this._startAnimation(t,i))},playReverse:function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=0),t instanceof n&&(t=t.key),e&&this.isPlaying&&this.currentAnim.key===t?this.parent:(this.forward=!1,this._reverse=!0,this._startAnimation(t,i))},_startAnimation:function(t,e){this.load(t,e);var i=this.currentAnim,n=this.parent;this.repeatCounter=-1===this._repeat?Number.MAX_VALUE:this._repeat,i.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,i.showOnStart&&(n.visible=!0);var s=this.currentFrame;return i.emit(r.ANIMATION_START,i,s,n),n.emit(r.SPRITE_ANIMATION_KEY_START+t,i,s,n),n.emit(r.SPRITE_ANIMATION_START,i,s,n),n},reverse:function(){return this.isPlaying&&(this._reverse=!this._reverse,this.forward=!this.forward),this.parent},getProgress:function(){var t=this.currentFrame.progress;return this.forward||(t=1-t),t},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},remove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},getRepeat:function(){return this._repeat},setRepeat:function(t){return this._repeat=t,this.repeatCounter=0,this.parent},getRepeatDelay:function(){return this._repeatDelay},setRepeatDelay:function(t){return this._repeatDelay=t,this.parent},restart:function(t){void 0===t&&(t=!1);var e=this.currentAnim;e.getFirstTick(this,t),this.forward=!0,this.isPlaying=!0,this.pendingRepeat=!1,this._paused=!1,this.updateFrame(e.frames[0]);var i=this.parent,n=this.currentFrame;return e.emit(r.ANIMATION_RESTART,e,n,i),i.emit(r.SPRITE_ANIMATION_KEY_RESTART+e.key,e,n,i),i.emit(r.SPRITE_ANIMATION_RESTART,e,n,i),this.parent},stop:function(){this._pendingStop=0,this.isPlaying=!1;var t=this.parent,e=this.currentAnim,i=this.currentFrame;if(e&&(e.emit(r.ANIMATION_COMPLETE,e,i,t),t.emit(r.SPRITE_ANIMATION_KEY_COMPLETE+e.key,e,i,t),t.emit(r.SPRITE_ANIMATION_COMPLETE,e,i,t)),this.nextAnim){var n=this.nextAnim;this.nextAnim=null,this.play(n)}return t},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopOnRepeat:function(){return this._pendingStop=2,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},setTimeScale:function(t){return void 0===t&&(t=1),this._timeScale=t,this.parent},getTimeScale:function(){return this._timeScale},getTotalFrames:function(){return this.currentAnim.frames.length},update:function(t,e){if(this.currentAnim&&this.isPlaying&&!this.currentAnim.paused){if(this.accumulator+=e*this._timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.currentAnim.completeAnimation(this);this.accumulator>=this.nextTick&&this.currentAnim.setFrame(this)}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),e.setSizeToFrame(),t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin(),e},updateFrame:function(t){var e=this.setCurrentFrame(t);if(this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;e.emit(r.SPRITE_ANIMATION_KEY_UPDATE+i.key,i,t,e),e.emit(r.SPRITE_ANIMATION_UPDATE,i,t,e),3===this._pendingStop&&this._pendingStopValue===t&&this.currentAnim.completeAnimation(this)}},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},setYoyo:function(t){return void 0===t&&(t=!1),this._yoyo=t,this.parent},getYoyo:function(){return this._yoyo},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.remove,this),this.animationManager=null,this.parent=null,this.currentAnim=null,this.currentFrame=null}});t.exports=o},function(t,e){t.exports=function(t){return t.split("").reverse().join("")}},function(t,e){t.exports=function(t,e){return t.replace(/%([0-9]+)/g,function(t,i){return e[Number(i)-1]})}},function(t,e,i){t.exports={Format:i(462),Pad:i(193),Reverse:i(461),UppercaseFirst:i(330),UUID:i(299)}},function(t,e,i){var n=i(70);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){t.exports=function(t,e){for(var i=0;i-1&&(e.state=h.REMOVED,s.splice(r,1)):(e.state=h.REMOVED,n.splice(r,1))}for(i.length=0,i=this._add,t=0;t-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&&(t.currentPipeline&&t.currentPipeline.vertexCount>0&&t.flush(),r.vertexBuffer=e.vertexBuffer[a],t.setPipeline(r),t.setTexture2D(s[a].glTexture,0),t.gl.drawArrays(r.topology,0,e.vertexCount[a]));r.vertexBuffer=o,r.viewIdentity(),r.modelIdentity()}},function(t,e,i){var n=i(1),s=i(1);n=i(484),s=i(483),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){t.exports=function(t,e,i,n,s){e.cull(n);var r=e.culledTiles,o=r.length;if(0!==o){var a=t._tempMatrix1,h=t._tempMatrix2,l=t._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(n.matrix);var u=t.currentContext,c=e.gidMap;u.save(),s?(a.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l),l.copyToContext(u)):(h.e-=n.scrollX*e.scrollFactorX,h.f-=n.scrollY*e.scrollFactorY,h.copyToContext(u));for(var d=n.alpha*e.alpha,f=0;f-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(19);t.exports=function(t){for(var e,i,s,r,o,a=0;a1){if(Array.isArray(l.tiles)){for(var c={},d={},f=0;f>>0;return n}},function(t,e,i){var n=i(497),s=i(2),r=i(84),o=i(230),a=i(61);t.exports=function(t,e){for(var i=[],h=0;h0){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,i){t.exports={Parse:i(233),Parse2DArray:i(145),ParseCSV:i(232),Impact:i(226),Tiled:i(231)}},function(t,e,i){var n=i(54),s=i(53),r=i(3);t.exports=function(t,e,i,o,a,h){return void 0===o&&(o=new r(0,0)),o.x=n(t,i,a,h),o.y=s(e,i,a,h),o}},function(t,e,i){var n=i(21);t.exports=function(t,e,i,s,r,o){if(void 0!==r){var a,h=n(t,e,i,s,null,o),l=0;for(a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e,i){var n=i(62),s=i(37),r=i(91);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;ae)){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(62),s=i(37),r=i(146);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;a=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;r=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);else if(2===r)for(a=x;a>=m;a--)for(o=v;c[a]&&o=m;a--)for(o=y;c[a]&&o>=v;o--)(h=c[a][o])&&-1!==h.index&&h.visible&&0!==h.alpha&&i.push(h);return u.tilesDrawn=i.length,u.tilesTotal=d*f,i}},function(t,e,i){var n=i(108),s=i(107),r=i(21),o=i(236);t.exports=function(t,e,i,a,h,l){void 0===i&&(i={}),Array.isArray(t)||(t=[t]);var u=l.tilemapLayer;void 0===a&&(a=u.scene),void 0===h&&(h=a.cameras.main);var c,d=r(0,0,l.width,l.height,null,l),f=[];for(c=0;c=0&&p=0&&g=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(r.UPDATE,this.step,this),t.events.emit(r.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n),this},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(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)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(r.SHUTDOWN,this.shutdown,this),t.off(r.POST_UPDATE,this.step,this),t.off(r.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});a.register("ScenePlugin",h,"scenePlugin"),t.exports=h},function(t,e,i){var n=i(124),s=i(19),r={Events:i(16),SceneManager:i(332),ScenePlugin:i(534),Settings:i(329),Systems:i(176)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(19),s=i(178),r={Center:i(349),Events:i(334),Orientation:i(348),ScaleManager:i(335),ScaleModes:i(347),Zoom:i(346)};r=n(!1,r=n(!1,r=n(!1,r=n(!1,r,s.CENTER),s.ORIENTATION),s.SCALE_MODE),s.ZOOM),t.exports=r},function(t,e,i){var n=i(237),s=i(0),r=i(16),o=new s({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){}});t.exports=o},function(t,e,i){t.exports={BasePlugin:i(237),DefaultPlugins:i(181),PluginCache:i(17),PluginManager:i(336),ScenePlugin:i(537)}},function(t,e,i){var n={};t.exports=n;var s=i(149),r=(i(209),i(36));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){var n={};t.exports=n;var s=i(36);n._registry={},n.register=function(t){if(n.isPlugin(t)||s.warn("Plugin.register:",n.toString(t),"does not implement all required fields."),t.name in n._registry){var e=n._registry[t.name],i=n.versionParse(t.version).number,r=n.versionParse(e.version).number;i>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=i(1286);n.Body=i(72),n.Composite=i(149),n.World=i(539),n.Detector=i(543),n.Grid=i(1285),n.Pairs=i(1284),n.Pair=i(451),n.Query=i(1310),n.Resolver=i(1283),n.SAT=i(542),n.Constraint=i(209),n.Common=i(36),n.Engine=i(1282),n.Events=i(210),n.Sleeping=i(238),n.Plugin=i(540),n.Bodies=i(138),n.Composites=i(1289),n.Axes=i(546),n.Bounds=i(86),n.Svg=i(1308),n.Vector=i(87),n.Vertices=i(82),n.World.add=n.Composite.add,n.World.remove=n.Composite.remove,n.World.addComposite=n.Composite.addComposite,n.World.addBody=n.Composite.addBody,n.World.addConstraint=n.Composite.addConstraint,n.World.clear=n.Composite.clear,t.exports=n},function(t,e,i){var n={};t.exports=n;var s=i(82),r=i(87);n.collides=function(t,e,i){var o,a,h,l,u=!1;if(i){var c=t.parent,d=e.parent,f=c.speed*c.speed+c.angularSpeed*c.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;u=i&&i.collided&&f<.2,l=i}else l={collided:!1,bodyA:t,bodyB:e};if(i&&u){var p=l.axisBody,g=p===t?e:t,v=[p.axes[i.axisNumber]];if(h=n._overlapAxes(p.vertices,g.vertices,v),l.reused=!0,h.overlap<=0)return l.collided=!1,l}else{if((o=n._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return l.collided=!1,l;if((a=n._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return l.collided=!1,l;o.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))1?1:0;d1?1:0;p0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n=i(138),s=i(72),r=i(0),o=i(452),a=i(2),h=i(91),l=i(82),u=new r({Mixins:[o.Bounce,o.Collision,o.Friction,o.Gravity,o.Mass,o.Sensor,o.Sleep,o.Static],initialize:function(t,e,i){this.tile=e,this.world=t,e.physics.matterBody&&e.physics.matterBody.destroy(),e.physics.matterBody=this;var n=a(i,"body",null),s=a(i,"addToWorld",!0);if(n)this.setBody(n,s);else{var r=e.getCollisionGroup();a(r,"objects",[]).length>0?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){t.exports={AFTER_UPDATE:i(1325),BEFORE_UPDATE:i(1324),COLLISION_ACTIVE:i(1323),COLLISION_END:i(1322),COLLISION_START:i(1321),DRAG_END:i(1320),DRAG:i(1319),DRAG_START:i(1318),PAUSE:i(1317),RESUME:i(1316),SLEEP_END:i(1315),SLEEP_START:i(1314)}},function(t,e,i){var n={};t.exports=n;var s=i(87),r=i(36);n.fromVertices=function(t){for(var e={},i=0;i0?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){var n=i(246);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){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,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(551);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.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,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(553);t.exports=function(t,e,i,s,r){var o=0;return t.deltaX()<0&&!t.blocked.left&&e.collideRight&&t.checkCollision.left?e.faceRight&&t.x0&&!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,i){var n=i(554),s=i(552),r=i(242);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;a--){var h=e[a],l=o(s,r,h.x,h.y);l=0;a--){var h=e[a],l=o(s,r,h.x,h.y);l>i&&(n=h,i=l)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var o=Math.atan2(i-t.y,e-t.x);return s>0&&(n=r(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(o,n),o},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),void 0===i&&(i=new d),i.setToPolar(s(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new d),i.setToPolar(t,e)},shutdown:function(){if(this.world){var t=this.systems.events;t.off(c.UPDATE,this.world.update,this.world),t.off(c.POST_UPDATE,this.world.postUpdate,this.world),t.off(c.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off(c.START,this.start,this),this.scene=null,this.systems=null}});u.register("ArcadePhysics",p,"arcadePhysics"),t.exports=p},function(t,e,i){var n=i(38),s=i(19),r={ArcadePhysics:i(576),Body:i(249),Collider:i(247),Factory:i(255),Group:i(252),Image:i(254),Sprite:i(111),StaticBody:i(241),StaticGroup:i(251),World:i(250)};r=s(!1,r,n),t.exports=r},function(t,e,i){var n=i(0),s=i(15),r=i(102),o=i(11),a=i(75),h=i(7),l=i(2),u=i(17),c=i(16),d=i(112),f=new n({Extends:o,initialize:function(t){o.call(this);var e=t.sys.game.config,i=t.sys.settings.loader;this.scene=t,this.systems=t.sys,this.cacheManager=t.sys.cache,this.textureManager=t.sys.textures,this.sceneManager=t.sys.game.scene,h.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(l(i,"baseURL",e.loaderBaseURL)),this.setPath(l(i,"path",e.loaderPath)),this.setPrefix(l(i,"prefix",e.loaderPrefix)),this.maxParallelDownloads=l(i,"maxParallelDownloads",e.loaderMaxParallelDownloads),this.xhr=d(l(i,"responseType",e.loaderResponseType),l(i,"async",e.loaderAsync),l(i,"user",e.loaderUser),l(i,"password",e.loaderPassword),l(i,"timeout",e.loaderTimeout)),this.crossOrigin=l(i,"crossOrigin",e.loaderCrossOrigin),this.totalToLoad=0,this.progress=0,this.list=new r,this.inflight=new r,this.queue=new r,this._deleteQueue=new r,this.totalFailed=0,this.totalComplete=0,this.state=s.LOADER_IDLE,t.sys.events.once(c.BOOT,this.boot,this),t.sys.events.on(c.START,this.pluginStart,this)},boot:function(){this.systems.events.once(c.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(c.SHUTDOWN,this.shutdown,this)},setBaseURL:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.baseURL=t,this},setPath:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.path=t,this},setPrefix:function(t){return void 0===t&&(t=""),this.prefix=t,this},setCORS:function(t){return this.crossOrigin=t,this},addFile:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(a.START,this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(c.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(a.PROGRESS,this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=s.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0&&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,i){var n=i(0),s=i(11),r=i(113),o=i(26),a=i(4),h=i(52),l=i(114),u=i(261),c=i(125),d=i(260),f=i(608),p=i(98),g=new n({Extends:s,initialize:function(t){s.call(this),this.game=t.systems.game,this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.manager=t.manager.keyboard,this.enabled=!0,this.keys=[],this.combos=[],t.pluginEvents.once(h.BOOT,this.boot,this),t.pluginEvents.on(h.START,this.start,this)},boot:function(){var t=this.settings.input;this.enabled=a(t,"keyboard",!0);var e=a(t,"keyboard.capture",null);e&&this.addCaptures(e),this.sceneInputPlugin.pluginEvents.once(h.DESTROY,this.destroy,this)},start:function(){this.sceneInputPlugin.manager.useQueue?this.sceneInputPlugin.pluginEvents.on(h.UPDATE,this.update,this):this.sceneInputPlugin.manager.events.on(h.MANAGER_PROCESS,this.update,this),this.sceneInputPlugin.pluginEvents.once(h.SHUTDOWN,this.shutdown,this),this.game.events.on(o.BLUR,this.resetKeys,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},addCapture:function(t){return this.manager.addCapture(t),this},removeCapture:function(t){return this.manager.removeCapture(t),this},getCaptures:function(){return this.manager.captures},enableGlobalCapture:function(){return this.manager.preventDefault=!0,this},disableGlobalCapture:function(){return this.manager.preventDefault=!1,this},clearCaptures:function(){return this.manager.clearCaptures(),this},createCursorKeys:function(){return this.addKeys({up:c.UP,down:c.DOWN,left:c.LEFT,right:c.RIGHT,space:c.SPACE,shift:c.SHIFT})},addKeys:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1);var n={};if("string"==typeof t){t=t.split(",");for(var s=0;s-1?n[s]=t:n[t.keyCode]=t,e&&this.addCapture(t.keyCode),t.setEmitOnRepeat(i),t}return"string"==typeof t&&(t=c[t.toUpperCase()]),n[t]||(n[t]=new u(t),e&&this.addCapture(t),n[t].setEmitOnRepeat(i)),n[t]},removeKey:function(t){var e=this.keys;if(t instanceof u){var i=e.indexOf(t);i>-1&&(this.keys[i]=void 0)}else"string"==typeof t&&(t=c[t.toUpperCase()]);return e[t]&&(e[t]=void 0),this},createCombo:function(t,e){return new d(this,t,e)},checkDown:function(t,e){if(this.enabled&&t.isDown){var i=p(this.time-t.timeDown,e);if(i>t._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n=e}}},function(t,e,i){var n=i(77),s=i(43),r=i(0),o=i(265),a=i(621),h=i(56),l=i(96),u=i(95),c=i(52),d=i(11),f=i(2),p=i(114),g=i(8),v=i(17),y=i(10),m=i(42),x=i(16),T=i(65),w=i(74),b=new r({Extends:d,initialize:function(t){d.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new d,this.enabled=!0,this.displayList,this.cameras,p.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],t.sys.events.once(x.BOOT,this.boot,this),t.sys.events.on(x.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(x.DESTROY,this.destroy,this),this.pluginEvents.emit(c.BOOT)},start:function(){var t=this.systems.events;t.on(x.TRANSITION_START,this.transitionIn,this),t.on(x.TRANSITION_OUT,this.transitionOut,this),t.on(x.TRANSITION_COMPLETE,this.transitionComplete,this),t.on(x.PRE_UPDATE,this.preUpdate,this),this.manager.useQueue&&t.on(x.UPDATE,this.update,this),t.once(x.SHUTDOWN,this.shutdown,this),this.manager.events.on(c.GAME_OUT,this.onGameOut,this),this.manager.events.on(c.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(c.START)},onGameOver:function(t){this.isActive()&&this.emit(c.GAME_OVER,t.timeStamp,t)},onGameOut:function(t){this.isActive()&&this.emit(c.GAME_OUT,t.timeStamp,t)},preUpdate:function(){this.pluginEvents.emit(c.PRE_UPDATE);var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,n=e.length;if(0!==i||0!==n){for(var s=this._list,r=0;r-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._pendingRemoval.length=0,this._list=s.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},update:function(t,e){if(this.isActive()){var i=this.manager;if(this.pluginEvents.emit(c.UPDATE,t,e),!i.globalTopOnly||!i.ignoreEvents){var n=i.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(n=!0,this._pollTimer=this.pollRate)),n)for(var s=this.manager.pointers,r=this.manager.pointersTotal,o=0;o0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}}},clear:function(t){var e=t.input;if(e){this.queueForRemoval(t),e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,this.manager.resetCursor(e),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&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,s}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,s=this._eventContainer;n.cancelled=!1;for(var r=!1,o=0;o0?this.setDragState(t,1):this.getDragState(t)>0&&!t.primaryDown&&t.justUp&&this.setDragState(t,5),1===this.getDragState(t)){var a=[];for(i=0;i1&&(this.sortGameObjects(a),this.topOnly&&a.splice(1)),this._drag[t.id]=a,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?this.setDragState(t,3):this.setDragState(t,2)}if(2===this.getDragState(t)&&(this.dragDistanceThreshold>0&&h(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&this.setDragState(t,3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&this.setDragState(t,3)),3===this.getDragState(t)){for(s=this._drag[t.id],i=0;i0?(n.emit(c.GAMEOBJECT_DRAG_LEAVE,t,r.target),this.emit(c.DRAG_LEAVE,t,n,r.target),r.target=l[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target)):(n.emit(c.GAMEOBJECT_DRAG_LEAVE,t,r.target),this.emit(c.DRAG_LEAVE,t,n,r.target),l[0]?(r.target=l[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target)):r.target=null)}else!r.target&&l[0]&&(r.target=l[0],n.emit(c.GAMEOBJECT_DRAG_ENTER,t,r.target),this.emit(c.DRAG_ENTER,t,n,r.target));var d=t.x-n.input.dragX,f=t.y-n.input.dragY;n.emit(c.GAMEOBJECT_DRAG,t,d,f),this.emit(c.DRAG,t,n,d,f)}return s.length}if(5===this.getDragState(t)){for(s=this._drag[t.id],i=0;i0){for(this.sortGameObjects(s),e=0;e0){for(this.sortGameObjects(r),e=0;e-1&&this._draggable.splice(s,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return a(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,s=!1,r=!1,a=!1;if(g(e)){var h=e;e=f(h,"hitArea",null),i=f(h,"hitAreaCallback",null),n=f(h,"draggable",!1),s=f(h,"dropZone",!1),r=f(h,"cursor",!1),a=f(h,"useHandCursor",!1);var l=f(h,"pixelPerfect",!1),u=f(h,"alphaTolerance",1);l&&(e={},i=this.makePixelPerfect(u)),e&&i||this.setHitAreaFromTexture(t)}else"function"!=typeof e||i||(i=e,e={});for(var c=0;c0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)e.x&&t.ye.y}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},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,i){var n=Math.min(t.x,e),s=Math.max(t.right,e);t.x=n,t.width=s-n;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},function(t,e){t.exports=function(t,e){var i=Math.min(t.x,e.x),n=Math.max(t.right,e.right);t.x=i,t.width=n-i;var s=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=s,t.height=r-s,t}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;on(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,i){var n=i(155);t.exports=function(t,e){var i=n(t);return ii&&(i=h.x),h.xr&&(r=h.y),h.ye.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(74),s=i(115);t.exports=function(t,e){return!!(n(t,e.getPointA())||n(t,e.getPointB())||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},function(t,e,i){var n=i(277),s=i(74);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottomt.right+r||it.bottom+r||st.right||e.rightt.bottom||e.bottom0}},function(t,e,i){var n=i(276);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){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(10),s=i(158);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=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(56);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){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(10);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){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(95);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,i){var n=i(95);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(96);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(96);n.Area=i(734),n.Circumference=i(309),n.CircumferencePoint=i(166),n.Clone=i(733),n.Contains=i(95),n.ContainsPoint=i(732),n.ContainsRect=i(731),n.CopyFrom=i(730),n.Equals=i(729),n.GetBounds=i(728),n.GetPoint=i(311),n.GetPoints=i(310),n.Offset=i(727),n.OffsetPoint=i(726),n.Random=i(199),t.exports=n},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e,i){var n=i(10);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){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e,i){var n=i(43);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,i){var n=i(43);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(77);t.exports=function(t){return new n(t.x,t.y,t.radius)}},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(77);n.Area=i(744),n.Circumference=i(436),n.CircumferencePoint=i(207),n.Clone=i(743),n.Contains=i(43),n.ContainsPoint=i(742),n.ContainsRect=i(741),n.CopyFrom=i(740),n.Equals=i(739),n.GetBounds=i(738),n.GetPoint=i(438),n.GetPoints=i(437),n.Offset=i(737),n.OffsetPoint=i(736),n.Random=i(206),t.exports=n},function(t,e,i){var n=i(0),s=i(280),r=i(17),o=i(16),a=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once(o.BOOT,this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on(o.SHUTDOWN,this.shutdown,this),t.on(o.DESTROY,this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",a,"lights"),t.exports=a},function(t,e,i){var n=i(30),s=i(14),r=i(12),o=i(159);s.register("quad",function(t,e){void 0===t&&(t={});var i=r(t,"x",0),s=r(t,"y",0),a=r(t,"key",null),h=r(t,"frame",null),l=new o(this.scene,i,s,a,h);return void 0!==e&&(t.add=e),n(this.scene,l,t),l})},function(t,e,i){var n=i(30),s=i(14),r=i(12),o=i(4),a=i(116);s.register("mesh",function(t,e){void 0===t&&(t={});var i=r(t,"key",null),s=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"colors",[]),u=o(t,"alphas",[]),c=o(t,"uv",[]),d=new a(this.scene,0,0,h,c,l,u,i,s);return void 0!==e&&(t.add=e),n(this.scene,d,t),d})},function(t,e,i){var n=i(159);i(5).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(116);i(5).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){t.exports=function(){}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=this.pipeline;t.setPipeline(o,e);var a=o._tempMatrix1,h=o._tempMatrix2,l=o._tempMatrix3;h.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),a.copyFrom(s.matrix),r?(a.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),h.e=e.x,h.f=e.y,a.multiply(h,l)):(h.e-=s.scrollX*e.scrollFactorX,h.f-=s.scrollY*e.scrollFactorY,a.multiply(h,l));var u=e.frame.glTexture,c=e.vertices,d=e.uv,f=e.colors,p=e.alphas,g=c.length,v=Math.floor(.5*g);o.vertexCount+v>o.vertexCapacity&&o.flush(),o.setTexture2D(u,0);for(var y=o.vertexViewF32,m=o.vertexViewU32,x=o.vertexCount*o.vertexComponentCount-1,T=0,w=e.tintFill,b=0;b0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.fillColor,e.fillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,C=0;C0)for(u=o.fillTint,c=n.getTintAppendFloatAlphaAndSwap(e.altFillColor,e.altFillAlpha*d),u.TL=c,u.TR=c,u.BL=c,u.BR=c,C=0;C0){var R=o.strokeTint,L=n.getTintAppendFloatAlphaAndSwap(e.outlineFillColor,e.outlineFillAlpha*d);for(R.TL=L,R.TR=L,R.BL=L,R.BR=L,E=1;Er;h--){for(l=0;l2?o[a++]:"",n=o[a++]||"16px",i=o[a++]||"Courier"}return i===this.fontFamily&&n===this.fontSize&&s===this.fontStyle||(this.fontFamily=i,this.fontSize=n,this.fontStyle=s,e&&this.update(!0)),this.parent},setFontFamily:function(t){return this.fontFamily!==t&&(this.fontFamily=t,this.update(!0)),this.parent},setFontStyle:function(t){return this.fontStyle!==t&&(this.fontStyle=t,this.update(!0)),this.parent},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize!==t&&(this.fontSize=t,this.update(!0)),this.parent},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.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)},setResolution:function(t){return this.resolution=t,this.update(!1)},setStroke:function(t,e){return void 0===e&&(e=this.strokeThickness),void 0===t&&0!==this.strokeThickness?(this.strokeThickness=0,this.update(!0)):this.stroke===t&&this.strokeThickness===e||(this.stroke=t,this.strokeThickness=e,this.update(!0)),this.parent},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){t.exports=function(t,e,i,n,s){""!==e.text&&t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){if(""!==e.text){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r)}}},function(t,e,i){var n=i(1),s=i(1);n=i(832),s=i(831),t.exports={renderWebGL:n,renderCanvas:s}},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.maxLines1&&(d+=f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(4);t.exports=function(t,e){var i=e.width,s=e.height,r=Math.floor(i/2),o=Math.floor(s/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),l=n(e,"offset.x",0),u=n(e,"offset.y",0),c=n(e,"spacing.x",0),d=n(e,"spacing.y",0),f=n(e,"lineSpacing",0),p=n(e,"charsPerRow",null);null===p&&(p=t.sys.textures.getFrame(h).width/i)>a.length&&(p=a.length);for(var g=l,v=u,y={retroFont:!0,font:h,size:i,lineHeight:s+f,chars:{}},m=0,x=0;x?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(836),s=i(19),r={Parse:i(835)};r=s(!1,r,n),t.exports=r},function(t,e){t.exports=function(t,e,i,n,s){t.batchSprite(e,e.frame,n,s)}},function(t,e,i){var n=i(9);t.exports=function(t,e,i,s,r){var o=e.frame,a=o.width,h=o.height,l=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,o.glTexture,a,h,e.x,e.y,a,h,e.scaleX,e.scaleY,e.rotation,e.flipX,!e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,a,h,l(e._tintTL,s.alpha*e._alphaTL),l(e._tintTR,s.alpha*e._alphaTR),l(e._tintBL,s.alpha*e._alphaBL),l(e._tintBR,s.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,s,r),t.setBlankTexture(!0)}},function(t,e,i){var n=i(1),s=i(1);n=i(839),s=i(838),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){t.exports={DeathZone:i(304),EdgeZone:i(303),RandomZone:i(301)}},function(t,e){t.exports=function(t,e,i,n,s){var r=e.emitters.list,o=r.length;if(0!==o){var a=t._tempMatrix1.copyFrom(n.matrix),h=t._tempMatrix2,l=t._tempMatrix3,u=t._tempMatrix4.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);a.multiply(u);var c=n.roundPixels,d=t.currentContext;d.save();for(var f=0;f0&&(N=N%b-b):N>b?N=b:N<0&&(N=b+N%b),null===E&&(E=new o(k+Math.cos(Y)*B,I+Math.sin(Y)*B,v),S.push(E),F+=.01);F<1+z;)w=N*F+Y,x=k+Math.cos(w)*B,T=I+Math.sin(w)*B,E.points.push(new r(x,T,v)),F+=.01;w=N+Y,x=k+Math.cos(w)*B,T=I+Math.sin(w)*B,E.points.push(new r(x,T,v));break;case n.FILL_RECT:u.setTexture2D(M),u.batchFillRect(p[++P],p[++P],p[++P],p[++P],f,c);break;case n.FILL_TRIANGLE:u.setTexture2D(M),u.batchFillTriangle(p[++P],p[++P],p[++P],p[++P],p[++P],p[++P],f,c);break;case n.STROKE_TRIANGLE:u.setTexture2D(M),u.batchStrokeTriangle(p[++P],p[++P],p[++P],p[++P],p[++P],p[++P],v,f,c);break;case n.LINE_TO:null!==E?E.points.push(new r(p[++P],p[++P],v)):(E=new o(p[++P],p[++P],v),S.push(E));break;case n.MOVE_TO:E=new o(p[++P],p[++P],v),S.push(E);break;case n.SAVE:a.push(f.copyToArray());break;case n.RESTORE:f.copyFromArray(a.pop());break;case n.TRANSLATE:k=p[++P],I=p[++P],f.translate(k,I);break;case n.SCALE:k=p[++P],I=p[++P],f.scale(k,I);break;case n.ROTATE:f.rotate(p[++P]);break;case n.SET_TEXTURE:var U=p[++P],G=p[++P];u.currentFrame=U,u.setTexture2D(U.glTexture,0),u.tintEffect=G,M=U.glTexture;break;case n.CLEAR_TEXTURE:u.currentFrame=t.blankTexture,u.tintEffect=2,M=t.blankTexture.glTexture}}}},function(t,e,i){var n=i(1),s=i(1);n=i(853),s=i(308),s=i(308),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e){},function(t,e){t.exports=function(t,e,i,n,s){var r=t.currentPipeline;t.clearPipeline();var o=t._tempMatrix1,a=t._tempMatrix2,h=t._tempMatrix3;a.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),o.copyFrom(n.matrix),s?(o.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),a.e=e.x,a.f=e.y,o.multiply(a,h)):(a.e-=n.scrollX*e.scrollFactorX,a.f-=n.scrollY*e.scrollFactorY,o.multiply(a,h)),e.render.call(e,t,n,h),t.rebindPipeline(r)}},function(t,e,i){var n=i(1),s=i(1);n=i(856),s=i(855),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(25);t.exports=function(t,e,i,s,r){var o=e.text,a=o.length,h=t.currentContext;if(0!==a&&n(t,h,e,s,r)){var l=e.frame,u=e.displayCallback,c=e.callbackData,d=s.scrollX*e.scrollFactorX,f=s.scrollY*e.scrollFactorY,p=e.fontData.chars,g=e.fontData.lineHeight,v=0,y=0,m=0,x=0,T=null,w=0,b=0,S=0,_=0,A=0,E=0,C=null,M=0,P=e.frame.source.image,O=l.cutX,R=l.cutY,L=0,D=e.fontSize/e.fontData.size;e.cropWidth>0&&e.cropHeight>0&&(h.beginPath(),h.rect(0,0,e.cropWidth,e.cropHeight),h.clip());for(var F=0;F0||e.cropHeight>0;l&&(h.flush(),t.pushScissor(e.x,e.y,e.cropWidth*e.scaleX,e.cropHeight*e.scaleY));var u=h._tempMatrix1,c=h._tempMatrix2,d=h._tempMatrix3,f=h._tempMatrix4;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(s.matrix),r?(u.multiplyWithOffset(r,-s.scrollX*e.scrollFactorX,-s.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d)):(c.e-=s.scrollX*e.scrollFactorX,c.f-=s.scrollY*e.scrollFactorY,u.multiply(c,d));var p=e.frame,g=p.glTexture,v=p.cutX,y=p.cutY,m=g.width,x=g.height,T=e._isTinted&&e.tintFill,w=n.getTintAppendFloatAlpha(e._tintTL,s.alpha*e._alphaTL),b=n.getTintAppendFloatAlpha(e._tintTR,s.alpha*e._alphaTR),S=n.getTintAppendFloatAlpha(e._tintBL,s.alpha*e._alphaBL),_=n.getTintAppendFloatAlpha(e._tintBR,s.alpha*e._alphaBR);h.setTexture2D(g,0);var A,E,C=0,M=0,P=0,O=0,R=e.letterSpacing,L=0,D=0,F=0,k=0,I=e.scrollX,B=e.scrollY,Y=e.fontData,N=Y.chars,X=Y.lineHeight,z=e.fontSize/Y.size,U=0,G=e._align,W=0,V=0;e.getTextBounds(!1);var H=e._bounds.lines;1===G?V=(H.longest-H.lengths[0])/2:2===G&&(V=H.longest-H.lengths[0]);for(var j=s.roundPixels,q=e.displayCallback,K=e.callbackData,J=0;Jv&&(r=v),o>y&&(o=y);var O=v+g.xAdvance,R=y+u;aA&&(A=C),C<_&&(_=C),E++,C=0;S[E]=C,C>A&&(A=C),C<_&&(_=C);var L=i.local,D=i.global,F=i.lines;return L.x=r*m,L.y=o*m,L.width=a*m,L.height=h*m,D.x=t.x-t.displayOriginX+r*x,D.y=t.y-t.displayOriginY+o*T,D.width=a*x,D.height=h*T,F.shortest=_,F.longest=A,F.lengths=S,e&&(L.x=Math.round(L.x),L.y=Math.round(L.y),L.width=Math.round(L.width),L.height=Math.round(L.height),D.x=Math.round(D.x),D.y=Math.round(D.y),D.width=Math.round(D.width),D.height=Math.round(D.height),F.shortest=Math.round(_),F.longest=Math.round(A)),i}},function(t,e,i){var n=i(0),s=i(17),r=i(16),o=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],t.sys.events.once(r.BOOT,this.boot,this),t.sys.events.on(r.START,this.start,this)},boot:function(){this.systems.events.once(r.DESTROY,this.destroy,this)},start:function(){var t=this.systems.events;t.on(r.PRE_UPDATE,this.preUpdate,this),t.on(r.UPDATE,this.update,this),t.once(r.SHUTDOWN,this.shutdown,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;i0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e),s=t.indexOf(i);return-1!==n&&-1===s&&(t[n]=i,!0)}},function(t,e,i){var n=i(97);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return n(t,s)}},function(t,e,i){var n=i(68);t.exports=function(t,e,i,s,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(s)for(var h=0;ht.length-1)throw new Error("Index out of bounds");var r=n(t,e);return i&&i.call(s,r),r}},function(t,e,i){var n=i(372);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var s=[],r=Math.max(n((e-t)/(i||1)),0),o=0;o=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var n=t[i-1],s=t.indexOf(n);t[i]=n,t[s]=e}return t}},function(t,e,i){var n=i(68);t.exports=function(t,e,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=t.length),n(t,s,r))for(var o=s;o0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),s&&s.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),s&&s.call(r,l)}return e}},function(t,e){t.exports=function(t,e,i,n,s){if(void 0===s&&(s=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(s,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.pop(),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;ax||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var E=l,C=l,M=0,P=e.sourceIndex,O=0;Og||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,T=0;Tr&&(m=w-r),b>o&&(x=b-o),t.add(T,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(70);t.exports=function(t,e,i){if(i.frames){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);var r,o=i.frames;for(var a in o){var h=o[a];r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h),h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted()),r.customData=n(h)}for(var l in i)"frames"!==l&&(Array.isArray(i[l])?t.customData[l]=i[l].slice(0):t.customData[l]=i[l]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},function(t,e,i){var n=i(70);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;a-1){var o=this.context.getImageData(t,e,1,1);o.data[0]=i,o.data[1]=n,o.data[2]=s,o.data[3]=r,this.context.putImageData(o,t,e)}return this},putData:function(t,e,i,n,s,r,o){return void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=t.width),void 0===o&&(o=t.height),this.context.putImageData(t,e,i,n,s,r,o),this},getData:function(t,e,i,n){return t=s(Math.floor(t),0,this.width-1),e=s(Math.floor(e),0,this.height-1),i=s(i,1,this.width-t),n=s(n,1,this.height-e),this.context.getImageData(t,e,i,n)},getPixel:function(t,e,i){i||(i=new r);var n=this.getIndex(t,e);if(n>-1){var s=this.data,o=s[n+0],a=s[n+1],h=s[n+2],l=s[n+3];i.setTo(o,a,h,l)}return i},getPixels:function(t,e,i,n){void 0===n&&(n=i),t=Math.abs(Math.round(t)),e=Math.abs(Math.round(e));for(var o=s(t,0,this.width),a=s(t+i,0,this.width),h=s(e,0,this.height),l=s(e+n,0,this.height),u=new r,c=[],d=h;d>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e){t.exports=function(t,e){void 0===e&&(e="none");return["-webkit-","-khtml-","-moz-","-ms-",""].forEach(function(i){t.style[i+"user-select"]=e}),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},function(t,e,i){t.exports={CanvasInterpolation:i(366),CanvasPool:i(24),Smoothing:i(130),TouchAction:i(1007),UserSelect:i(1006)}},function(t,e){t.exports=function(t){return t.height*t.originY}},function(t,e){t.exports=function(t){return t.width*t.originX}},function(t,e,i){t.exports={CenterOn:i(444),GetBottom:i(51),GetCenterX:i(81),GetCenterY:i(78),GetLeft:i(49),GetOffsetX:i(1010),GetOffsetY:i(1009),GetRight:i(47),GetTop:i(45),SetBottom:i(50),SetCenterX:i(80),SetCenterY:i(79),SetLeft:i(48),SetRight:i(46),SetTop:i(44)}},function(t,e,i){var n=i(47),s=i(45),r=i(50),o=i(46);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(49),s=i(45),r=i(50),o=i(48);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)-a),t}},function(t,e,i){var n=i(81),s=i(45),r=i(50),o=i(80);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)-a),t}},function(t,e,i){var n=i(47),s=i(45),r=i(48),o=i(44);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(78),s=i(47),r=i(79),o=i(48);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(51),s=i(47),r=i(50),o=i(48);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(45),r=i(46),o=i(44);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(78),s=i(49),r=i(79),o=i(46);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(51),s=i(49),r=i(50),o=i(46);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(51),s=i(47),r=i(46),o=i(44);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){var n=i(51),s=i(49),r=i(48),o=i(44);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)+a),t}},function(t,e,i){var n=i(51),s=i(81),r=i(80),o=i(44);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)+a),t}},function(t,e,i){t.exports={BottomCenter:i(1023),BottomLeft:i(1022),BottomRight:i(1021),LeftBottom:i(1020),LeftCenter:i(1019),LeftTop:i(1018),RightBottom:i(1017),RightCenter:i(1016),RightTop:i(1015),TopCenter:i(1014),TopLeft:i(1013),TopRight:i(1012)}},function(t,e,i){t.exports={BottomCenter:i(448),BottomLeft:i(447),BottomRight:i(446),Center:i(445),LeftCenter:i(443),QuickSet:i(449),RightCenter:i(442),TopCenter:i(441),TopLeft:i(440),TopRight:i(439)}},function(t,e,i){var n=i(208),s=i(19),r={In:i(1025),To:i(1024)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Align:i(1026),Bounds:i(1011),Canvas:i(1008),Color:i(354),Masks:i(999)}},function(t,e,i){var n=i(0),s=i(134),r=i(17),o=i(16),a=new n({Extends:s,initialize:function(t){s.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.events=this.systems.events,this.events.once(o.DESTROY,this.destroy,this)},start:function(){this.events.once(o.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.systems.events.off(o.SHUTDOWN,this.shutdown,this)},destroy:function(){s.prototype.destroy.call(this),this.events.off(o.START,this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",a,"data"),t.exports=a},function(t,e,i){t.exports={DataManager:i(134),DataManagerPlugin:i(1028),Events:i(420)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(t,e){this.active=!1,this.p0=new s(t,e)},getPoint:function(t,e){return void 0===e&&(e=new s),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},function(t,e,i){var n=i(0),s=i(359),r=i(358),o=i(5),a=i(357),h=i(1030),l=i(356),u=i(10),c=i(355),d=i(3),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,n),h=new d(r,o),l=new d(t,e)),this.add(new s(u,a,h,l))},quadraticBezierTo:function(t,e,i,n){var s,r,o=this.getEndPoint();return t instanceof d?(s=t,r=e):(s=new d(i,n),r=new d(t,e)),this.add(new l(o,s,r))},draw:function(t,e){for(var i=0;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;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){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},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;o1?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,i){return Math.max(t-e,i)}},function(t,e){t.exports=function(t,e,i){return Math.min(t+e,i)}},function(t,e){t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},function(t,e){t.exports=function(t,e){return t/e/1e3}},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.floor(t*n)/n}},function(t,e){t.exports=function(t,e){return Math.abs(t-e)}},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.ceil(t*n)/n}},function(t,e){t.exports=function(t){for(var e=0,i=0;i>>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;e0;e--){var i=Math.floor(this.frac()*(e+1)),n=t[i];t[i]=t[e],t[e]=n}return t}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.round(t/e),n?(i+t)/e:i+t)}},function(t,e,i){t.exports={Ceil:i(375),Floor:i(98),To:i(1069)}},function(t,e){t.exports=function(t){return t>0&&0==(t&t-1)}},function(t,e,i){t.exports={GetNext:i(376),IsSize:i(127),IsValue:i(1071)}},function(t,e,i){var n=i(196);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){var n=i(129);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,i){var n=i(185);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return t[0]===t[i]?(e<0&&(r=Math.floor(s=i*(1+e))),n(s-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(n(-s,t[0],t[0],t[1],t[1])-t[0]):e>1?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[i=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e=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,i){var n=i(99),s=i(128),r={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=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){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,l=[],u=!1,c=-1;function d(){u&&h&&(u=!1,h.length?l=h.concat(l):c=-1,l.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=l.length;e;){for(h=l,l=[];++c1)for(var i=1;i0&&(o.preRender(1),t.render(n,e,i,o))}},resetAll:function(){for(var t=0;t=1?1:1/e*(1+(e*t|0))}},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){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:1-Math.cos(t*Math.PI/2)}},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--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return t*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 1- --t*t*t*t}},function(t,e){t.exports=function(t){return t*t*t*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*(2-t)}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return 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 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},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,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),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},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){return--t*t*t+1}},function(t,e){t.exports=function(t){return t*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 Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},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 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){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,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,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e,i){var n=i(23),s=i(0),r=i(188),o=i(40),a=i(3),h=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new a,this.current=new a,this.destination=new a,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,a,h){void 0===i&&(i=1e3),void 0===n&&(n=r.Linear),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene);var l=this.camera;return!s&&this.isRunning?l:(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(l.scrollX,l.scrollY),this.destination.set(t,e),l.getScroll(t,e,this.current),"string"==typeof n&&r.hasOwnProperty(n)?this.ease=r[n]:"function"==typeof n&&(this.ease=n),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.camera.emit(o.PAN_START,this.camera,this,i,t,e),l)},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var s=this.camera;if(this._elapsed0?(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){var n=i(0),s=i(4),r=new n({initialize:function(t){this.camera=s(t,"camera",null),this.left=s(t,"left",null),this.right=s(t,"right",null),this.up=s(t,"up",null),this.down=s(t,"down",null),this.zoomIn=s(t,"zoomIn",null),this.zoomOut=s(t,"zoomOut",null),this.zoomSpeed=s(t,"zoomSpeed",.01),this.speedX=0,this.speedY=0;var e=s(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=s(t,"speed.x",0),this.speedY=s(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoom<.1&&(e.zoom=.1)):this.zoomOut&&this.zoomOut.isDown&&(e.zoom+=this.zoomSpeed)}},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={FixedKeyControl:i(1171),SmoothedKeyControl:i(1170)}},function(t,e,i){t.exports={Controls:i(1172),Scene2D:i(1169)}},function(t,e){t.exports="remove"},function(t,e){t.exports="add"},function(t,e,i){t.exports={BaseCache:i(414),CacheManager:i(412),Events:i(413)}},function(t,e){t.exports="visible"},function(t,e){t.exports="step"},function(t,e){t.exports="resume"},function(t,e){t.exports="ready"},function(t,e){t.exports="prestep"},function(t,e){t.exports="prerender"},function(t,e){t.exports="poststep"},function(t,e){t.exports="postrender"},function(t,e){t.exports="pause"},function(t,e){t.exports="hidden"},function(t,e){t.exports="focus"},function(t,e){t.exports="destroy"},function(t,e){t.exports="boot"},function(t,e){t.exports="blur"},function(t,e,i){t.exports={Animation:i(205),AnimationFrame:i(433),AnimationManager:i(415),Events:i(136)}},function(t,e,i){var n=i(57);t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=0;s1)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?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,_isTinted:!1,tintFill:!1,clearTint:function(){return this.setTint(16777215),this._isTinted=!1,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._isTinted=!0,this.tintFill=!1,this},setTintFill:function(t,e,i,n){return this.setTint(t,e,i,n),this.tintFill=!0,this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t),this._isTinted=!0}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t),this._isTinted=!0}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t),this._isTinted=!0}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t),this._isTinted=!0}},tint:{set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){return this._isTinted}}};t.exports=n},function(t,e){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},function(t,e){var i={texture:null,frame:null,isCropped:!1,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),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,i){var n=i(101),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={_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(10),s=i(428),r=i(3),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,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getTopRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomLeft:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBottomRight:function(t,e){(t||(t=new r),void 0===e&&(e=!1),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),e&&this.parentContainer)&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t);return t},getBounds:function(t){var e,i,s,r,o,a,h,l;if(void 0===t&&(t=new n),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),s=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),s=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),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){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){var i={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,n){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,n,this.flipX,this.flipY);else{var s=t;this.frame.setCropUVs(this._crop,s.x,s.y,s.width,s.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=i},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}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},function(t,e){t.exports="animationupdate"},function(t,e){t.exports="animationstart"},function(t,e){t.exports="animationrestart"},function(t,e){t.exports="animationrepeat"},function(t,e){t.exports="animationupdate-"},function(t,e){t.exports="animationstart-"},function(t,e){t.exports="animationrestart-"},function(t,e){t.exports="animationrepeat-"},function(t,e){t.exports="animationcomplete-"},function(t,e){t.exports="animationcomplete"},function(t,e){t.exports="resumeall"},function(t,e){t.exports="remove"},function(t,e){t.exports="pauseall"},function(t,e){t.exports="start"},function(t,e){t.exports="restart"},function(t,e){t.exports="repeat"},function(t,e){t.exports="complete"},function(t,e){t.exports="add"},function(t,e,i){var n=i(449),s=i(208),r=i(2),o=i(1),a=new(i(137))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1);t.exports=function(t,e){void 0===e&&(e={});var i=r(e,"width",-1),o=r(e,"height",-1),h=r(e,"cellWidth",1),l=r(e,"cellHeight",h),u=r(e,"position",s.TOP_LEFT),c=r(e,"x",0),d=r(e,"y",0),f=0,p=0,g=i*h,v=o*l;a.setPosition(c,d),a.setSize(h,l);for(var y=0;y>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit(l.COLLISION_START,e,i,n)}),f.on(e,"collisionActive",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit(l.COLLISION_ACTIVE,e,i,n)}),f.on(e,"collisionEnd",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit(l.COLLISION_END,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.scale.width),void 0===n&&(n=this.scene.sys.scale.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,s,n+2*s),this.updateWall(o,"right",t+i,e-s,s,n+2*s),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&&g.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&&g.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(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 g.add(this.localWorld,o),o},add:function(t){return g.add(this.localWorld,t),this},remove:function(t,e){var i=t.body?t.body:t;return o.remove(this.localWorld,i,e),this},removeConstraint:function(t,e){return o.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;i1?1:0;r1?1:0;s0&&u.trigger(t,"collisionStart",{pairs:T.collisionStart}),o.preSolvePosition(T.list),s=0;s0&&u.trigger(t,"collisionActive",{pairs:T.collisionActive}),T.collisionEnd.length>0&&u.trigger(t,"collisionEnd",{pairs:T.collisionEnd}),h.update(t.metrics,t),n._bodiesClearForces(y),u.trigger(t,"afterUpdate",v),t},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;sf.friction*f.frictionStatic*F*i&&(I=R,k=o.clamp(f.friction*L*i,-I,I));var B=r.cross(_,y),Y=r.cross(A,y),N=T/(g.inverseMass+v.inverseMass+g.inverseInertia*B*B+v.inverseInertia*Y*Y);if(D*=N,k*=N,P<0&&P*P>n._restingThresh*i)b.normalImpulse=0;else{var X=b.normalImpulse;b.normalImpulse=Math.min(b.normalImpulse+D,0),D=b.normalImpulse-X}if(O*O>n._restingThreshTangent*i)b.tangentImpulse=0;else{var z=b.tangentImpulse;b.tangentImpulse=o.clamp(b.tangentImpulse+k,-I,I),k=b.tangentImpulse-z}s.x=y.x*D+m.x*k,s.y=y.y*D+m.y*k,g.isStatic||g.isSleeping||(g.positionPrev.x+=s.x*g.inverseMass,g.positionPrev.y+=s.y*g.inverseMass,g.anglePrev+=r.cross(_,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(A,s)*v.inverseInertia)}}}}},function(t,e,i){var n={};t.exports=n;var s=i(451),r=i(36);n._pairMaxIdleLife=1e3,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;an._pairMaxIdleLife&&l.push(o);for(o=0;ou.bounds.max.x||p.bounds.max.yu.bounds.max.y)){var g=n._getRegion(t,p);if(!p.region||g.id!==p.region.id||s){f.broadphaseTests+=1,p.region&&!s||(p.region=g);var v=n._regionUnion(g,p.region);for(o=v.startCol;o<=v.endCol;o++)for(a=v.startRow;a<=v.endRow;a++){h=c[l=n._getBucketId(o,a)];var y=o>=g.startCol&&o<=g.endCol&&a>=g.startRow&&a<=g.endRow,m=o>=p.region.startCol&&o<=p.region.endCol&&a>=p.region.startRow&&a<=p.region.endRow;!y&&m&&m&&h&&n._bucketRemoveBody(t,h,p),(p.region===g||y&&!m||s)&&(h||(h=n._createBucket(c,l)),n._bucketAddBody(t,h,p))}p.region=g,d=!0}}}d&&(t.pairsList=n._createActivePairsList(t))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},n._regionUnion=function(t,e){var i=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 n._createRegion(i,s,r,o)},n._getRegion=function(t,e){var i=e.bounds,s=Math.floor(i.min.x/t.bucketWidth),r=Math.floor(i.max.x/t.bucketWidth),o=Math.floor(i.min.y/t.bucketHeight),a=Math.floor(i.max.y/t.bucketHeight);return n._createRegion(s,r,o,a)},n._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},n._getBucketId=function(t,e){return"C"+t+"R"+e},n._createBucket=function(t,e){return t[e]=[]},n._bucketAddBody=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(540),r=i(36);n.name="matter-js",n.version="0.14.2",n.uses=[],n.used=[],n.use=function(){s.use(n,Array.prototype.slice.call(arguments))},n.before=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathBefore(n,t,e)},n.after=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathAfter(n,t,e)}},function(t,e,i){var n=i(460),s=i(0),r=i(452),o=i(18),a=i(2),h=i(200),l=i(67),u=i(3),c=new s({Extends:l,Mixins:[r.Bounce,r.Collision,r.Force,r.Friction,r.Gravity,r.Mass,r.Sensor,r.SetBody,r.Sleep,r.Static,r.Transform,r.Velocity,h],initialize:function(t,e,i,s,r,h){o.call(this,t.scene,"Sprite"),this.anims=new n(this),this.setTexture(s,r),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new u(e,i);var l=a(h,"shape",null);l?this.setBody(l,h):this.setRectangle(this.width,this.height,h),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=c},function(t,e,i){var n=i(0),s=i(452),r=i(18),o=i(2),a=i(93),h=i(200),l=i(3),u=new n({Extends:a,Mixins:[s.Bounce,s.Collision,s.Force,s.Friction,s.Gravity,s.Mass,s.Sensor,s.SetBody,s.Sleep,s.Static,s.Transform,s.Velocity,h],initialize:function(t,e,i,n,s,a){r.call(this,t.scene,"Image"),this.setTexture(n,s),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new l(e,i);var h=o(a,"shape",null);h?this.setBody(h,a):this.setRectangle(this.width,this.height,a),this.setPosition(e,i),this.initPipeline("TextureTintPipeline")}});t.exports=u},function(t,e,i){var n={};t.exports=n;var s=i(149),r=i(209),o=i(36),a=i(72),h=i(138);n.stack=function(t,e,i,n,r,o,h){for(var l,u=s.create({label:"Stack"}),c=t,d=e,f=0,p=0;pg&&(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;l=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 L=0;LA&&(A+=e.length),_=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},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var n=t[i],s=i-1;s>=0;--s)S(n,t[s],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);return!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),!0)}};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))r.ACTIVE&&d(this,t,e))},setCollidesNever:function(t){for(var e=0;e1)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 T=Math.floor((e+v)/f);if((l>0||u===T||T<0||T>=p)&&(T=-1),u>=0&&u1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,T,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,b=s<0?f:0,S=Math.max(Math.floor(t.pos.x/f),0),_=Math.min(Math.ceil((t.pos.x+r)/f),p);c=Math.floor((t.pos.y+w)/f);var A=Math.floor((i+w)/f);if((l>0||c===A||A<0||A>=g)&&(A=-1),c>=0&&c1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,u,A));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+b;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),T=g/x,w=-p/x,b=y*T+m*w,S=T*b,_=w*b;return S*S+_*_>=s*s+r*r?v||p*(m-r)-g*(y-s)<.5:(t.pos.x=i+s-S,t.pos.y=n+r-_,t.collision.slope={x:p,y:g,nx:T,ny:w},!0)}return!1}});t.exports=r},function(t,e,i){var n=i(0),s=i(240),r=i(1360),o=i(239),a=i(1359),h=new n({initialize:function(t,e,i,n,r){void 0===n&&(n=16),void 0===r&&(r=n),this.world=t,this.gameObject=null,this.enabled=!0,this.parent,this.id=t.getNextID(),this.name="",this.size={x:n,y:r},this.offset={x:0,y:0},this.pos={x:e,y:i},this.last={x:e,y:i},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:t.defaults.maxVelocityX,y:t.defaults.maxVelocityY},this.standing=!1,this.gravityFactor=t.defaults.gravityFactor,this.bounciness=t.defaults.bounciness,this.minBounceVelocity=t.defaults.minBounceVelocity,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER,this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.updateCallback,this.slopeStanding={min:.767944870877505,max:2.3736477827122884}},reset:function(t,e){this.pos={x:t,y:e},this.last={x:t,y:e},this.vel={x:0,y:0},this.accel={x:0,y:0},this.friction={x:0,y:0},this.maxVel={x:100,y:100},this.standing=!1,this.gravityFactor=1,this.bounciness=0,this.minBounceVelocity=40,this.accelGround=0,this.accelAir=0,this.jumpSpeed=0,this.type=o.NONE,this.checkAgainst=o.NONE,this.collides=s.NEVER},update:function(t){var e=this.pos;this.last.x=e.x,this.last.y=e.y,this.vel.y+=this.world.gravity*t*this.gravityFactor,this.vel.x=r(t,this.vel.x,this.accel.x,this.friction.x,this.maxVel.x),this.vel.y=r(t,this.vel.y,this.accel.y,this.friction.y,this.maxVel.y);var i=this.vel.x*t,n=this.vel.y*t,s=this.world.collisionMap.trace(e.x,e.y,i,n,this.size.x,this.size.y);this.handleMovementTrace(s)&&a(this,s);var o=this.gameObject;o&&(o.x=e.x-this.offset.x+o.displayOriginX*o.scaleX,o.y=e.y-this.offset.y+o.displayOriginY*o.scaleY),this.updateCallback&&this.updateCallback(this)},drawDebug:function(t){var e=this.pos;if(this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.size.x,this.size.y)),this.debugShowVelocity){var i=e.x+this.size.x/2,n=e.y+this.size.y/2;t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.vel.x,n+this.vel.y)}},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},skipHash:function(){return!this.enabled||0===this.type&&0===this.checkAgainst&&0===this.collides},touches:function(t){return!(this.pos.x>=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){t.exports={BitmapMaskPipeline:i(454),ForwardDiffuseLightPipeline:i(453),TextureTintPipeline:i(211)}},function(t,e,i){t.exports={Utils:i(9),WebGLPipeline:i(212),WebGLRenderer:i(456),Pipelines:i(1300),BYTE:0,SHORT:1,UNSIGNED_BYTE:2,UNSIGNED_SHORT:3,FLOAT:4}},function(t,e,i){t.exports={Canvas:i(458),WebGL:i(455)}},function(t,e,i){t.exports={CanvasRenderer:i(459),GetBlendModes:i(457),SetTransform:i(25)}},function(t,e,i){t.exports={Canvas:i(1303),Snapshot:i(1302),WebGL:i(1301)}},function(t,e,i){var n=i(541),s={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.13.1",silent:!0,install:function(t){t.after("Engine.update",function(){s.Engine.update(this)})},Engine:{update:function(t){for(var e=t.world,i=n.Composite.allBodies(e),r=n.Composite.allComposites(e),o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y0)for(var a=s+1;a1;if(!d||t!=d.x||e!=d.y){d&&n?(f=d.x,p=d.y):(f=0,p=0);var s={x:f+t,y:p+e};!n&&d||(d=s),g.push(s),y=f+t,m=p+e}},T=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":y=t.x,m=t.y;break;case"H":y=t.x;break;case"V":m=t.y}x(y,m,t.pathSegType)}};for(n._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i1?1:0;n0))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){t.exports=function(t,e,i,n){var s=e.pos.x+e.size.x-i.pos.x;if(n){var r=e===n?i:e;n.vel.x=-n.vel.x*n.bounciness+r.vel.x;var o=t.collisionMap.trace(n.pos.x,n.pos.y,n===e?-s:s,0,n.size.x,n.size.y);n.pos.x=o.pos.x}else{var a=(e.vel.x-i.vel.x)/2;e.vel.x=-a,i.vel.x=a;var h=t.collisionMap.trace(e.pos.x,e.pos.y,-s/2,0,e.size.x,e.size.y);e.pos.x=Math.floor(h.pos.x);var l=t.collisionMap.trace(i.pos.x,i.pos.y,s/2,0,i.size.x,i.size.y);i.pos.x=Math.ceil(l.pos.x)}}},function(t,e,i){var n=i(240),s=i(548),r=i(1340),o=i(1339);t.exports=function(t,e,i){var a=null;e.collides===n.LITE||i.collides===n.FIXED?a=e:i.collides!==n.LITE&&e.collides!==n.FIXED||(a=i),e.last.x+e.size.x>i.last.x&&e.last.xi.last.y&&e.last.y0&&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&&o0?e-o:e+o<0?e+o:0}return n(e,-r,r)}},function(t,e,i){t.exports={Body:i(1298),Events:i(548),COLLIDES:i(240),CollisionMap:i(1297),Factory:i(1296),Image:i(1294),ImpactBody:i(1295),ImpactPhysics:i(1342),Sprite:i(1293),TYPE:i(239),World:i(1292)}},function(t,e,i){t.exports={Arcade:i(577),Impact:i(1361),Matter:i(1338)}},function(t,e,i){(function(e){i(1280);var n=i(28),s=i(19),r={Actions:i(450),Animations:i(1191),Cache:i(1176),Cameras:i(1173),Core:i(1097),Class:i(0),Create:i(1038),Curves:i(1032),Data:i(1029),Display:i(1027),DOM:i(998),Events:i(997),Game:i(995),GameObjects:i(902),Geom:i(279),Input:i(635),Loader:i(601),Math:i(387),Physics:i(1362),Plugins:i(538),Renderer:i(1304),Scale:i(536),Scene:i(331),Scenes:i(535),Sound:i(533),Structs:i(532),Textures:i(531),Tilemaps:i(529),Time:i(480),Tweens:i(478),Utils:i(468)};r=s(!1,r,n),t.exports=r,e.Phaser=r}).call(this,i(215))}])}); \ No newline at end of file diff --git a/package.json b/package.json index ed9da6d2d..990278119 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phaser", - "version": "3.16.0", + "version": "3.16.3", "release": "Ishikawa", "description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.", "author": "Richard Davey (http://www.photonstorm.com)", diff --git a/plugins/fbinstant/src/FacebookInstantGamesPlugin.js b/plugins/fbinstant/src/FacebookInstantGamesPlugin.js index 21ce8c54d..464c053c3 100644 --- a/plugins/fbinstant/src/FacebookInstantGamesPlugin.js +++ b/plugins/fbinstant/src/FacebookInstantGamesPlugin.js @@ -1322,7 +1322,7 @@ var FacebookInstantGamesPlugin = new Class({ */ chooseContext: function (options) { - if (!this.checkAPI('contextChoseAsync')) + if (!this.checkAPI('contextChooseAsync')) { return this; } @@ -1624,7 +1624,7 @@ var FacebookInstantGamesPlugin = new Class({ * @param {string} cta - The call to action text. * @param {object} text - The text object. * @param {string} key - The key of the texture to use as the share image. - * @param {(string|integer)} [frame] - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. + * @param {?(string|integer)} frame - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. * @param {string} template - The update template key. * @param {object} updateData - The update data object payload. * @@ -1662,7 +1662,7 @@ var FacebookInstantGamesPlugin = new Class({ * @param {string} cta - The call to action text. * @param {object} text - The text object. * @param {string} key - The key of the texture to use as the share image. - * @param {(string|integer)} [frame] - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. + * @param {?(string|integer)} frame - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. * @param {string} template - The update template key. * @param {object} updateData - The update data object payload. * @@ -1684,7 +1684,7 @@ var FacebookInstantGamesPlugin = new Class({ * @param {string} cta - The call to action text. * @param {object} text - The text object. * @param {string} key - The key of the texture to use as the share image. - * @param {(string|integer)} [frame] - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. + * @param {?(string|integer)} frame - The frame of the texture to use as the share image. Set to `null` if you don't require a frame, but do need to set session data. * @param {string} template - The update template key. * @param {object} updateData - The update data object payload. * diff --git a/plugins/fbinstant/src/Leaderboard.js b/plugins/fbinstant/src/Leaderboard.js index b20070766..722626ada 100644 --- a/plugins/fbinstant/src/Leaderboard.js +++ b/plugins/fbinstant/src/Leaderboard.js @@ -248,7 +248,7 @@ var Leaderboard = new Class({ var _this = this; - this.ref.getEntriesAsync().then(function (entries) + this.ref.getEntriesAsync(count, offset).then(function (entries) { _this.scores = []; diff --git a/src/actions/Angle.js b/src/actions/Angle.js index de7418ebc..025b28fef 100644 --- a/src/actions/Angle.js +++ b/src/actions/Angle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/Call.js b/src/actions/Call.js index d07c5381f..3e75485a1 100644 --- a/src/actions/Call.js +++ b/src/actions/Call.js @@ -1,15 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @callback CallCallback - * - * @param {Phaser.GameObjects.GameObject} item - The Game Object to run the callback on. - */ - /** * Takes an array of objects and passes each of them to the given callback. * @@ -19,7 +13,7 @@ * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array. + * @param {Phaser.Actions.Types.CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array. * @param {*} context - The scope in which the callback will be invoked. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that was passed to this Action. diff --git a/src/actions/GetFirst.js b/src/actions/GetFirst.js index 4c0beca3a..d92b81eb6 100644 --- a/src/actions/GetFirst.js +++ b/src/actions/GetFirst.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/GetLast.js b/src/actions/GetLast.js index 2dd8ad6d9..e3d1fc477 100644 --- a/src/actions/GetLast.js +++ b/src/actions/GetLast.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/GridAlign.js b/src/actions/GridAlign.js index 9790f9bb9..f45c34f8c 100644 --- a/src/actions/GridAlign.js +++ b/src/actions/GridAlign.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,20 +12,6 @@ var Zone = require('../gameobjects/zone/Zone'); var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); -/** - * @typedef {object} GridAlignConfig - * - * @property {integer} [width=-1] - The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity. - * If both this value and height are set to -1 then this value overrides it and the `height` value is ignored. - * @property {integer} [height=-1] - The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity. - * If both this value and `width` are set to -1 then `width` overrides it and this value is ignored. - * @property {integer} [cellWidth=1] - The width of the cell, in pixels, in which the item is positioned. - * @property {integer} [cellHeight=1] - The height of the cell, in pixels, in which the item is positioned. - * @property {integer} [position=0] - The alignment position. One of the Phaser.Display.Align consts such as `TOP_LEFT` or `RIGHT_CENTER`. - * @property {number} [x=0] - Optionally place the top-left of the final grid at this coordinate. - * @property {number} [y=0] - Optionally place the top-left of the final grid at this coordinate. - */ - /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, * and then aligns them based on the grid configuration given to this action. @@ -36,7 +22,7 @@ var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {GridAlignConfig} options - The GridAlign Configuration object. + * @param {Phaser.Actions.Types.GridAlignConfig} options - The GridAlign Configuration object. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ diff --git a/src/actions/IncAlpha.js b/src/actions/IncAlpha.js index 8e44666b5..f7403e535 100644 --- a/src/actions/IncAlpha.js +++ b/src/actions/IncAlpha.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/IncX.js b/src/actions/IncX.js index 3124e9f68..b5351e2fe 100644 --- a/src/actions/IncX.js +++ b/src/actions/IncX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/IncXY.js b/src/actions/IncXY.js index f825f22f8..8f4b746d0 100644 --- a/src/actions/IncXY.js +++ b/src/actions/IncXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/IncY.js b/src/actions/IncY.js index 5a019e155..9f953d819 100644 --- a/src/actions/IncY.js +++ b/src/actions/IncY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PlaceOnCircle.js b/src/actions/PlaceOnCircle.js index 5bdfd5a8d..84d2c4e14 100644 --- a/src/actions/PlaceOnCircle.js +++ b/src/actions/PlaceOnCircle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PlaceOnEllipse.js b/src/actions/PlaceOnEllipse.js index d16cc0225..19bf893a7 100644 --- a/src/actions/PlaceOnEllipse.js +++ b/src/actions/PlaceOnEllipse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PlaceOnLine.js b/src/actions/PlaceOnLine.js index 1d6881fe4..609d0061a 100644 --- a/src/actions/PlaceOnLine.js +++ b/src/actions/PlaceOnLine.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PlaceOnRectangle.js b/src/actions/PlaceOnRectangle.js index 9a112a9cb..39003367d 100644 --- a/src/actions/PlaceOnRectangle.js +++ b/src/actions/PlaceOnRectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PlaceOnTriangle.js b/src/actions/PlaceOnTriangle.js index 028a1cef0..ef47fd2c4 100644 --- a/src/actions/PlaceOnTriangle.js +++ b/src/actions/PlaceOnTriangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PlayAnimation.js b/src/actions/PlayAnimation.js index a359a4355..c409e2b75 100644 --- a/src/actions/PlayAnimation.js +++ b/src/actions/PlayAnimation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PropertyValueInc.js b/src/actions/PropertyValueInc.js index c3412af2f..511ba83ef 100644 --- a/src/actions/PropertyValueInc.js +++ b/src/actions/PropertyValueInc.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/PropertyValueSet.js b/src/actions/PropertyValueSet.js index 878f51767..db83d670f 100644 --- a/src/actions/PropertyValueSet.js +++ b/src/actions/PropertyValueSet.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RandomCircle.js b/src/actions/RandomCircle.js index c49b15358..8ad1895fb 100644 --- a/src/actions/RandomCircle.js +++ b/src/actions/RandomCircle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RandomEllipse.js b/src/actions/RandomEllipse.js index 1f3397be0..ed66284cb 100644 --- a/src/actions/RandomEllipse.js +++ b/src/actions/RandomEllipse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RandomLine.js b/src/actions/RandomLine.js index 52e2c5209..f2669f7fd 100644 --- a/src/actions/RandomLine.js +++ b/src/actions/RandomLine.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RandomRectangle.js b/src/actions/RandomRectangle.js index 687afc3fd..c69d6dabc 100644 --- a/src/actions/RandomRectangle.js +++ b/src/actions/RandomRectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RandomTriangle.js b/src/actions/RandomTriangle.js index e8e0492d3..99f1230ec 100644 --- a/src/actions/RandomTriangle.js +++ b/src/actions/RandomTriangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/Rotate.js b/src/actions/Rotate.js index 605195f18..fe4d27bc6 100644 --- a/src/actions/Rotate.js +++ b/src/actions/Rotate.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RotateAround.js b/src/actions/RotateAround.js index a8b0a7b44..02ecce4cd 100644 --- a/src/actions/RotateAround.js +++ b/src/actions/RotateAround.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/RotateAroundDistance.js b/src/actions/RotateAroundDistance.js index c503ffbd2..fa7ac259a 100644 --- a/src/actions/RotateAroundDistance.js +++ b/src/actions/RotateAroundDistance.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/ScaleX.js b/src/actions/ScaleX.js index b9ce18796..563fbf4fa 100644 --- a/src/actions/ScaleX.js +++ b/src/actions/ScaleX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/ScaleXY.js b/src/actions/ScaleXY.js index f3b66ca3a..6e5a9c671 100644 --- a/src/actions/ScaleXY.js +++ b/src/actions/ScaleXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/ScaleY.js b/src/actions/ScaleY.js index d70400cef..2ac6dd902 100644 --- a/src/actions/ScaleY.js +++ b/src/actions/ScaleY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetAlpha.js b/src/actions/SetAlpha.js index 5abb17716..ec23be7e2 100644 --- a/src/actions/SetAlpha.js +++ b/src/actions/SetAlpha.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetBlendMode.js b/src/actions/SetBlendMode.js index ee2ba3422..2e5347542 100644 --- a/src/actions/SetBlendMode.js +++ b/src/actions/SetBlendMode.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetDepth.js b/src/actions/SetDepth.js index 1b3416fc1..eec592c19 100644 --- a/src/actions/SetDepth.js +++ b/src/actions/SetDepth.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetHitArea.js b/src/actions/SetHitArea.js index 870330b67..36242d2bd 100644 --- a/src/actions/SetHitArea.js +++ b/src/actions/SetHitArea.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,7 +16,7 @@ * * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {*} hitArea - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {HitAreaCallback} hitAreaCallback - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. + * @param {Phaser.Input.Types.HitAreaCallback} hitAreaCallback - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ diff --git a/src/actions/SetOrigin.js b/src/actions/SetOrigin.js index 4e4197d84..dd70b00f6 100644 --- a/src/actions/SetOrigin.js +++ b/src/actions/SetOrigin.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetRotation.js b/src/actions/SetRotation.js index cbf0295ad..e02e21296 100644 --- a/src/actions/SetRotation.js +++ b/src/actions/SetRotation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetScale.js b/src/actions/SetScale.js index a3b1d64ed..24b8ef2f4 100644 --- a/src/actions/SetScale.js +++ b/src/actions/SetScale.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetScaleX.js b/src/actions/SetScaleX.js index 9e51f258c..d90b05c1c 100644 --- a/src/actions/SetScaleX.js +++ b/src/actions/SetScaleX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetScaleY.js b/src/actions/SetScaleY.js index 7d29c1a19..5437fb45e 100644 --- a/src/actions/SetScaleY.js +++ b/src/actions/SetScaleY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetTint.js b/src/actions/SetTint.js index 02a90772b..7f761d13a 100644 --- a/src/actions/SetTint.js +++ b/src/actions/SetTint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetVisible.js b/src/actions/SetVisible.js index 454170a88..89ce56091 100644 --- a/src/actions/SetVisible.js +++ b/src/actions/SetVisible.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetX.js b/src/actions/SetX.js index 30f209b64..8e338792f 100644 --- a/src/actions/SetX.js +++ b/src/actions/SetX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetXY.js b/src/actions/SetXY.js index 8c619ca8a..39eb79716 100644 --- a/src/actions/SetXY.js +++ b/src/actions/SetXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SetY.js b/src/actions/SetY.js index 3f238460c..e5189d0aa 100644 --- a/src/actions/SetY.js +++ b/src/actions/SetY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/ShiftPosition.js b/src/actions/ShiftPosition.js index 9ea29f67b..14e730798 100644 --- a/src/actions/ShiftPosition.js +++ b/src/actions/ShiftPosition.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/Shuffle.js b/src/actions/Shuffle.js index d27410319..5dff5b522 100644 --- a/src/actions/Shuffle.js +++ b/src/actions/Shuffle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SmoothStep.js b/src/actions/SmoothStep.js index ba341f2b4..a7d3907d6 100644 --- a/src/actions/SmoothStep.js +++ b/src/actions/SmoothStep.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/SmootherStep.js b/src/actions/SmootherStep.js index d70b56c46..6fbd663c4 100644 --- a/src/actions/SmootherStep.js +++ b/src/actions/SmootherStep.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/Spread.js b/src/actions/Spread.js index 040e7ea49..5698221ea 100644 --- a/src/actions/Spread.js +++ b/src/actions/Spread.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/ToggleVisible.js b/src/actions/ToggleVisible.js index e6cd15be9..0bcba9ddd 100644 --- a/src/actions/ToggleVisible.js +++ b/src/actions/ToggleVisible.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/WrapInRectangle.js b/src/actions/WrapInRectangle.js index 7987809b2..8cda17ac6 100644 --- a/src/actions/WrapInRectangle.js +++ b/src/actions/WrapInRectangle.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author samme - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/index.js b/src/actions/index.js index 38cc4ad7a..8e9afd819 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/actions/typedefs/CallCallback.js b/src/actions/typedefs/CallCallback.js new file mode 100644 index 000000000..9a92ffd91 --- /dev/null +++ b/src/actions/typedefs/CallCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.Actions.Types.CallCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} item - The Game Object to run the callback on. + */ diff --git a/src/actions/typedefs/GridAlignConfig.js b/src/actions/typedefs/GridAlignConfig.js new file mode 100644 index 000000000..de795ce60 --- /dev/null +++ b/src/actions/typedefs/GridAlignConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Actions.Types.GridAlignConfig + * @since 3.0.0 + * + * @property {integer} [width=-1] - The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity. + * If both this value and height are set to -1 then this value overrides it and the `height` value is ignored. + * @property {integer} [height=-1] - The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity. + * If both this value and `width` are set to -1 then `width` overrides it and this value is ignored. + * @property {integer} [cellWidth=1] - The width of the cell, in pixels, in which the item is positioned. + * @property {integer} [cellHeight=1] - The height of the cell, in pixels, in which the item is positioned. + * @property {integer} [position=0] - The alignment position. One of the Phaser.Display.Align consts such as `TOP_LEFT` or `RIGHT_CENTER`. + * @property {number} [x=0] - Optionally place the top-left of the final grid at this coordinate. + * @property {number} [y=0] - Optionally place the top-left of the final grid at this coordinate. + */ diff --git a/src/actions/typedefs/index.js b/src/actions/typedefs/index.js new file mode 100644 index 000000000..43df8c107 --- /dev/null +++ b/src/actions/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Actions.Types + */ diff --git a/src/animations/Animation.js b/src/animations/Animation.js index 1465d64e2..b3e233998 100644 --- a/src/animations/Animation.js +++ b/src/animations/Animation.js @@ -1,59 +1,17 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../math/Clamp'); var Class = require('../utils/Class'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var FindClosestInSorted = require('../utils/array/FindClosestInSorted'); var Frame = require('./AnimationFrame'); var GetValue = require('../utils/object/GetValue'); -/** - * @typedef {object} JSONAnimation - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {string} type - A frame based animation (as opposed to a bone based animation) - * @property {JSONAnimationFrame[]} frames - [description] - * @property {integer} frameRate - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} duration - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} skipMissedFrames - Skip frames if the time lags, or always advanced anyway? - * @property {integer} delay - Delay before starting playback. Value given in milliseconds. - * @property {integer} repeat - Number of times to repeat the animation (-1 for infinity) - * @property {integer} repeatDelay - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} yoyo - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} showOnStart - Should sprite.visible = true when the animation starts to play? - * @property {boolean} hideOnComplete - Should sprite.visible = false when the animation finishes? - */ - -/** - * @typedef {object} AnimationFrameConfig - * - * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {(string|number)} frame - [description] - * @property {number} [duration=0] - [description] - * @property {boolean} [visible] - [description] - */ - -/** - * @typedef {object} AnimationConfig - * - * @property {string} [key] - The key that the animation will be associated with. i.e. sprite.animations.play(key) - * @property {AnimationFrameConfig[]} [frames] - An object containing data used to generate the frames for the animation - * @property {string} [defaultTextureKey=null] - The key of the texture all frames of the animation will use. Can be overridden on a per frame basis. - * @property {integer} [frameRate] - The frame rate of playback in frames per second (default 24 if duration is null) - * @property {integer} [duration] - How long the animation should play for in milliseconds. If not given its derived from frameRate. - * @property {boolean} [skipMissedFrames=true] - Skip frames if the time lags, or always advanced anyway? - * @property {integer} [delay=0] - Delay before starting playback. Value given in milliseconds. - * @property {integer} [repeat=0] - Number of times to repeat the animation (-1 for infinity) - * @property {integer} [repeatDelay=0] - Delay before the animation repeats. Value given in milliseconds. - * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? - * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? - * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? - */ - /** * @classdesc * A Frame based Animation. @@ -70,9 +28,9 @@ var GetValue = require('../utils/object/GetValue'); * @constructor * @since 3.0.0 * - * @param {Phaser.Animations.AnimationManager} manager - [description] - * @param {string} key - [description] - * @param {AnimationConfig} config - [description] + * @param {Phaser.Animations.AnimationManager} manager - A reference to the global Animation Manager + * @param {string} key - The unique identifying string for this animation. + * @param {Phaser.Animations.Types.Animation} config - The Animation configuration. */ var Animation = new Class({ @@ -85,7 +43,7 @@ var Animation = new Class({ EventEmitter.call(this); /** - * A reference to the global Animation Manager + * A reference to the global Animation Manager. * * @name Phaser.Animations.Animation#manager * @type {Phaser.Animations.AnimationManager} @@ -94,7 +52,7 @@ var Animation = new Class({ this.manager = manager; /** - * The unique identifying string for this animation + * The unique identifying string for this animation. * * @name Phaser.Animations.Animation#key * @type {string} @@ -113,7 +71,7 @@ var Animation = new Class({ this.type = 'frame'; /** - * Extract all the frame data into the frames array + * Extract all the frame data into the frames array. * * @name Phaser.Animations.Animation#frames * @type {Phaser.Animations.AnimationFrame[]} @@ -207,7 +165,7 @@ var Animation = new Class({ this.repeat = GetValue(config, 'repeat', 0); /** - * The delay in ms before the a repeat playthrough starts. + * The delay in ms before the a repeat play starts. * * @name Phaser.Animations.Animation#repeatDelay * @type {integer} @@ -217,7 +175,7 @@ var Animation = new Class({ this.repeatDelay = GetValue(config, 'repeatDelay', 0); /** - * Should the animation yoyo? (reverse back down to the start) before repeating? + * Should the animation yoyo (reverse back down to the start) before repeating? * * @name Phaser.Animations.Animation#yoyo * @type {boolean} @@ -227,7 +185,7 @@ var Animation = new Class({ this.yoyo = GetValue(config, 'yoyo', false); /** - * Should sprite.visible = true when the animation starts to play? + * Should the GameObject's `visible` property be set to `true` when the animation starts to play? * * @name Phaser.Animations.Animation#showOnStart * @type {boolean} @@ -237,7 +195,7 @@ var Animation = new Class({ this.showOnStart = GetValue(config, 'showOnStart', false); /** - * Should sprite.visible = false when the animation finishes? + * Should the GameObject's `visible` property be set to `false` when the animation finishes? * * @name Phaser.Animations.Animation#hideOnComplete * @type {boolean} @@ -256,8 +214,8 @@ var Animation = new Class({ */ this.paused = false; - this.manager.on('pauseall', this.pause, this); - this.manager.on('resumeall', this.resume, this); + this.manager.on(Events.PAUSE_ALL, this.pause, this); + this.manager.on(Events.RESUME_ALL, this.resume, this); }, /** @@ -266,7 +224,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#addFrame * @since 3.0.0 * - * @param {(string|AnimationFrameConfig[])} config - [description] + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} config - [description] * * @return {Phaser.Animations.Animation} This Animation object. */ @@ -281,8 +239,8 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#addFrameAt * @since 3.0.0 * - * @param {integer} index - [description] - * @param {(string|AnimationFrameConfig[])} config - [description] + * @param {integer} index - The index to insert the frame at within the animation. + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} config - [description] * * @return {Phaser.Animations.Animation} This Animation object. */ @@ -395,7 +353,7 @@ var Animation = new Class({ * @since 3.0.0 * * @param {Phaser.Textures.TextureManager} textureManager - [description] - * @param {(string|AnimationFrameConfig[])} frames - [description] + * @param {(string|Phaser.Animations.Types.AnimationFrame[])} frames - [description] * @param {string} [defaultTextureKey] - [description] * * @return {Phaser.Animations.AnimationFrame[]} [description] @@ -774,6 +732,9 @@ var Animation = new Class({ * [description] * * @method Phaser.Animations.Animation#repeatAnimation + * @fires Phaser.Animations.Events#ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT * @since 3.0.0 * * @param {Phaser.GameObjects.Components.Animation} component - [description] @@ -806,11 +767,11 @@ var Animation = new Class({ var frame = component.currentFrame; var parent = component.parent; - this.emit('repeat', this, frame); + this.emit(Events.ANIMATION_REPEAT, this, frame); - parent.emit('animationrepeat-' + this.key, this, frame, component.repeatCounter, parent); + parent.emit(Events.SPRITE_ANIMATION_KEY_REPEAT + this.key, this, frame, component.repeatCounter, parent); - parent.emit('animationrepeat', this, frame, component.repeatCounter, parent); + parent.emit(Events.SPRITE_ANIMATION_REPEAT, this, frame, component.repeatCounter, parent); } } }, @@ -842,7 +803,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#toJSON * @since 3.0.0 * - * @return {JSONAnimation} [description] + * @return {Phaser.Animations.Types.JSONAnimation} [description] */ toJSON: function () { @@ -954,8 +915,8 @@ var Animation = new Class({ { this.removeAllListeners(); - this.manager.off('pauseall', this.pause, this); - this.manager.off('resumeall', this.resume, this); + this.manager.off(Events.PAUSE_ALL, this.pause, this); + this.manager.off(Events.RESUME_ALL, this.resume, this); this.manager.remove(this.key); diff --git a/src/animations/AnimationFrame.js b/src/animations/AnimationFrame.js index f0994a31f..957528055 100644 --- a/src/animations/AnimationFrame.js +++ b/src/animations/AnimationFrame.js @@ -1,19 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); -/** - * @typedef {object} JSONAnimationFrame - * - * @property {string} key - The key of the Texture this AnimationFrame uses. - * @property {(string|integer)} frame - The key of the Frame within the Texture that this AnimationFrame uses. - * @property {number} duration - Additional time (in ms) that this frame should appear for during playback. - */ - /** * @classdesc * A single frame in an Animation sequence. @@ -149,7 +141,7 @@ var AnimationFrame = new Class({ * @method Phaser.Animations.AnimationFrame#toJSON * @since 3.0.0 * - * @return {JSONAnimationFrame} The AnimationFrame data. + * @return {Phaser.Animations.Types.JSONAnimationFrame} The AnimationFrame data. */ toJSON: function () { diff --git a/src/animations/AnimationManager.js b/src/animations/AnimationManager.js index 3f7d4055f..ffdf7f49e 100644 --- a/src/animations/AnimationManager.js +++ b/src/animations/AnimationManager.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,16 +8,11 @@ var Animation = require('./Animation'); var Class = require('../utils/Class'); var CustomMap = require('../structs/Map'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); +var GameEvents = require('../core/events'); var GetValue = require('../utils/object/GetValue'); var Pad = require('../utils/string/Pad'); -/** - * @typedef {object} JSONAnimationManager - * - * @property {JSONAnimation[]} anims - An array of all Animations added to the Animation Manager. - * @property {number} globalTimeScale - The global time scale of the Animation Manager. - */ - /** * @classdesc * The Animation Manager. @@ -109,27 +104,28 @@ var AnimationManager = new Class({ */ this.name = 'AnimationManager'; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** * Registers event listeners after the Game boots. * * @method Phaser.Animations.AnimationManager#boot + * @listens Phaser.Core.Events#DESTROY * @since 3.0.0 */ boot: function () { this.textureManager = this.game.textures; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** * Adds an existing Animation to the Animation Manager. * * @method Phaser.Animations.AnimationManager#add - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * * @param {string} key - The key under which the Animation should be added. The Animation will be updated with it. Must be unique. @@ -141,7 +137,8 @@ var AnimationManager = new Class({ { if (this.anims.has(key)) { - console.warn('Animation with key', key, 'already exists'); + console.warn('Animation key exists: ' + key); + return; } @@ -149,7 +146,7 @@ var AnimationManager = new Class({ this.anims.set(key, animation); - this.emit('add', key, animation); + this.emit(Events.ADD_ANIMATION, key, animation); return this; }, @@ -185,10 +182,10 @@ var AnimationManager = new Class({ * If you wish to re-use an existing key, call `AnimationManager.remove` first, then this method. * * @method Phaser.Animations.AnimationManager#create - * @fires AddAnimationEvent + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {AnimationConfig} config - The configuration settings for the Animation. + * @param {Phaser.Animations.Types.Animation} config - The configuration settings for the Animation. * * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` is the key is already in use. */ @@ -208,7 +205,7 @@ var AnimationManager = new Class({ this.anims.set(key, anim); - this.emit('add', key, anim); + this.emit(Events.ADD_ANIMATION, key, anim); } } @@ -221,7 +218,7 @@ var AnimationManager = new Class({ * @method Phaser.Animations.AnimationManager#fromJSON * @since 3.0.0 * - * @param {(string|JSONAnimationManager|JSONAnimation)} data - The JSON object to parse. + * @param {(string|Phaser.Animations.Types.JSONAnimations|Phaser.Animations.Types.JSONAnimation)} data - The JSON object to parse. * @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added. * * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. @@ -264,18 +261,6 @@ var AnimationManager = new Class({ return output; }, - /** - * @typedef {object} GenerateFrameNamesConfig - * - * @property {string} [prefix=''] - The string to append to every resulting frame name if using a range or an array of `frames`. - * @property {integer} [start=0] - If `frames` is not provided, the number of the first frame to return. - * @property {integer} [end=0] - If `frames` is not provided, the number of the last frame to return. - * @property {string} [suffix=''] - The string to append to every resulting frame name if using a range or an array of `frames`. - * @property {integer} [zeroPad=0] - The minimum expected lengths of each resulting frame's number. Numbers will be left-padded with zeroes until they are this long, then prepended and appended to create the resulting frame name. - * @property {AnimationFrameConfig[]} [outputArray=[]] - The array to append the created configuration objects to. - * @property {boolean} [frames=false] - If provided as an array, the range defined by `start` and `end` will be ignored and these frame numbers will be used. - */ - /** * [description] * @@ -283,9 +268,9 @@ var AnimationManager = new Class({ * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNamesConfig} [config] - The configuration object for the animation frame names. + * @param {Phaser.Animations.Types.GenerateFrameNames} [config] - The configuration object for the animation frame names. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNames: function (key, config) { @@ -352,27 +337,17 @@ var AnimationManager = new Class({ }, /** - * @typedef {object} GenerateFrameNumbersConfig + * Generate an array of {@link Phaser.Animations.Types.AnimationFrame} objects from a texture key and configuration object. * - * @property {integer} [start=0] - The starting frame of the animation. - * @property {integer} [end=-1] - The ending frame of the animation. - * @property {(boolean|integer)} [first=false] - A frame to put at the beginning of the animation, before `start` or `outputArray` or `frames`. - * @property {AnimationFrameConfig[]} [outputArray=[]] - An array to concatenate the output onto. - * @property {(boolean|integer[])} [frames=false] - A custom sequence of frames. - */ - - /** - * Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object. - * - * Generates objects with numbered frame names, as configured by the given {@link GenerateFrameNumbersConfig}. + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Animations.Types.GenerateFrameNumbers}. * * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 * * @param {string} key - The key for the texture containing the animation frames. - * @param {GenerateFrameNumbersConfig} config - The configuration object for the animation frames. + * @param {Phaser.Animations.Types.GenerateFrameNumbers} config - The configuration object for the animation frames. * - * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects. + * @return {Phaser.Animations.Types.AnimationFrame[]} The array of {@link Phaser.Animations.Types.AnimationFrame} objects. */ generateFrameNumbers: function (key, config) { @@ -415,7 +390,12 @@ var AnimationManager = new Class({ endFrame = texture.frameTotal; } - for (i = startFrame; i <= endFrame; i++) + var diff = (startFrame < endFrame) ? 1 : -1; + + // Adjust because we use i !== end in the for loop + endFrame += diff; + + for (i = startFrame; i !== endFrame; i += diff) { if (texture.has(i)) { @@ -470,7 +450,7 @@ var AnimationManager = new Class({ * Pause all animations. * * @method Phaser.Animations.AnimationManager#pauseAll - * @fires PauseAllAnimationEvent + * @fires Phaser.Animations.Events#PAUSE_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -481,7 +461,7 @@ var AnimationManager = new Class({ { this.paused = true; - this.emit('pauseall'); + this.emit(Events.PAUSE_ALL); } return this; @@ -524,7 +504,7 @@ var AnimationManager = new Class({ * Remove an animation. * * @method Phaser.Animations.AnimationManager#remove - * @fires RemoveAnimationEvent + * @fires Phaser.Animations.Events#REMOVE_ANIMATION * @since 3.0.0 * * @param {string} key - The key of the animation to remove. @@ -537,7 +517,7 @@ var AnimationManager = new Class({ if (anim) { - this.emit('remove', key, anim); + this.emit(Events.REMOVE_ANIMATION, key, anim); this.anims.delete(key); } @@ -549,7 +529,7 @@ var AnimationManager = new Class({ * Resume all paused animations. * * @method Phaser.Animations.AnimationManager#resumeAll - * @fires ResumeAllAnimationEvent + * @fires Phaser.Animations.Events#RESUME_ALL * @since 3.0.0 * * @return {Phaser.Animations.AnimationManager} This Animation Manager. @@ -560,7 +540,7 @@ var AnimationManager = new Class({ { this.paused = false; - this.emit('resumeall'); + this.emit(Events.RESUME_ALL); } return this; @@ -614,7 +594,7 @@ var AnimationManager = new Class({ * * @param {string} key - [description] * - * @return {JSONAnimationManager} [description] + * @return {Phaser.Animations.Types.JSONAnimations} [description] */ toJSON: function (key) { diff --git a/src/animations/events/ADD_ANIMATION_EVENT.js b/src/animations/events/ADD_ANIMATION_EVENT.js new file mode 100644 index 000000000..915903bda --- /dev/null +++ b/src/animations/events/ADD_ANIMATION_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Add Animation Event. + * + * This event is dispatched when a new animation is added to the global Animation Manager. + * + * This can happen either as a result of an animation instance being added to the Animation Manager, + * or the Animation Manager creating a new animation directly. + * + * @event Phaser.Animations.Events#ADD_ANIMATION + * @since 3.0.0 + * + * @param {string} key - The key of the Animation that was added to the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the newly created Animation. + */ +module.exports = 'add'; diff --git a/src/animations/events/ANIMATION_COMPLETE_EVENT.js b/src/animations/events/ANIMATION_COMPLETE_EVENT.js new file mode 100644 index 000000000..0cf453c9b --- /dev/null +++ b/src/animations/events/ANIMATION_COMPLETE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Complete Event. + * + * This event is dispatched by an Animation instance when it completes, i.e. finishes playing or is manually stopped. + * + * Be careful with the volume of events this could generate. If a group of Sprites all complete the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_COMPLETE + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'complete'; diff --git a/src/animations/events/ANIMATION_REPEAT_EVENT.js b/src/animations/events/ANIMATION_REPEAT_EVENT.js new file mode 100644 index 000000000..7f9b9d396 --- /dev/null +++ b/src/animations/events/ANIMATION_REPEAT_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Repeat Event. + * + * This event is dispatched when a currently playing animation repeats. + * + * The event is dispatched directly from the Animation object itself. Which means that listeners + * bound to this event will be invoked every time the Animation repeats, for every Game Object that may have it. + * + * @event Phaser.Animations.Events#ANIMATION_REPEAT + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that repeated. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation was on when it repeated. + */ +module.exports = 'repeat'; diff --git a/src/animations/events/ANIMATION_RESTART_EVENT.js b/src/animations/events/ANIMATION_RESTART_EVENT.js new file mode 100644 index 000000000..23a6f3e04 --- /dev/null +++ b/src/animations/events/ANIMATION_RESTART_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Restart Event. + * + * This event is dispatched by an Animation instance when it restarts. + * + * Be careful with the volume of events this could generate. If a group of Sprites all restart the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_RESTART + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that restarted playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'restart'; diff --git a/src/animations/events/ANIMATION_START_EVENT.js b/src/animations/events/ANIMATION_START_EVENT.js new file mode 100644 index 000000000..dfb06b2a2 --- /dev/null +++ b/src/animations/events/ANIMATION_START_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Animation Start Event. + * + * This event is dispatched by an Animation instance when it starts playing. + * + * Be careful with the volume of events this could generate. If a group of Sprites all play the same + * animation at the same time, this event will invoke its handler for each one of them. + * + * @event Phaser.Animations.Events#ANIMATION_START + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that started playing. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'start'; diff --git a/src/animations/events/PAUSE_ALL_EVENT.js b/src/animations/events/PAUSE_ALL_EVENT.js new file mode 100644 index 000000000..0cdbcefd2 --- /dev/null +++ b/src/animations/events/PAUSE_ALL_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Animations Event. + * + * This event is dispatched when the global Animation Manager is told to pause. + * + * When this happens all current animations will stop updating, although it doesn't necessarily mean + * that the game has paused as well. + * + * @event Phaser.Animations.Events#PAUSE_ALL + * @since 3.0.0 + */ +module.exports = 'pauseall'; diff --git a/src/animations/events/REMOVE_ANIMATION_EVENT.js b/src/animations/events/REMOVE_ANIMATION_EVENT.js new file mode 100644 index 000000000..ca0f88ba4 --- /dev/null +++ b/src/animations/events/REMOVE_ANIMATION_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Animation Event. + * + * This event is dispatched when an animation is removed from the global Animation Manager. + * + * @event Phaser.Animations.Events#REMOVE_ANIMATION + * @since 3.0.0 + * + * @param {string} key - The key of the Animation that was removed from the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the removed Animation. + */ +module.exports = 'remove'; diff --git a/src/animations/events/RESUME_ALL_EVENT.js b/src/animations/events/RESUME_ALL_EVENT.js new file mode 100644 index 000000000..1a8cc968f --- /dev/null +++ b/src/animations/events/RESUME_ALL_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Animations Event. + * + * This event is dispatched when the global Animation Manager resumes, having been previously paused. + * + * When this happens all current animations will continue updating again. + * + * @event Phaser.Animations.Events#RESUME_ALL + * @since 3.0.0 + */ +module.exports = 'resumeall'; diff --git a/src/animations/events/SPRITE_ANIMATION_COMPLETE_EVENT.js b/src/animations/events/SPRITE_ANIMATION_COMPLETE_EVENT.js new file mode 100644 index 000000000..b20af287c --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_COMPLETE_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Complete Event. + * + * This event is dispatched by a Sprite when an animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_COMPLETE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_COMPLETE + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete'; diff --git a/src/animations/events/SPRITE_ANIMATION_KEY_COMPLETE_EVENT.js b/src/animations/events/SPRITE_ANIMATION_KEY_COMPLETE_EVENT.js new file mode 100644 index 000000000..7492c5b36 --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_KEY_COMPLETE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Complete Event. + * + * This event is dispatched by a Sprite when a specific animation finishes playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationcomplete-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_COMPLETE + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation completed on. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation completed. + */ +module.exports = 'animationcomplete-'; diff --git a/src/animations/events/SPRITE_ANIMATION_KEY_REPEAT_EVENT.js b/src/animations/events/SPRITE_ANIMATION_KEY_REPEAT_EVENT.js new file mode 100644 index 000000000..079a49755 --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_KEY_REPEAT_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Repeat Event. + * + * This event is dispatched by a Sprite when a specific animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrepeat-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat-'; diff --git a/src/animations/events/SPRITE_ANIMATION_KEY_RESTART_EVENT.js b/src/animations/events/SPRITE_ANIMATION_KEY_RESTART_EVENT.js new file mode 100644 index 000000000..b18f6506e --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_KEY_RESTART_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Restart Event. + * + * This event is dispatched by a Sprite when a specific animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationrestart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_RESTART + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart-'; diff --git a/src/animations/events/SPRITE_ANIMATION_KEY_START_EVENT.js b/src/animations/events/SPRITE_ANIMATION_KEY_START_EVENT.js new file mode 100644 index 000000000..745c6b538 --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_KEY_START_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Start Event. + * + * This event is dispatched by a Sprite when a specific animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationstart-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_START + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart-'; diff --git a/src/animations/events/SPRITE_ANIMATION_KEY_UPDATE_EVENT.js b/src/animations/events/SPRITE_ANIMATION_KEY_UPDATE_EVENT.js new file mode 100644 index 000000000..4a186235c --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_KEY_UPDATE_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Key Update Event. + * + * This event is dispatched by a Sprite when a specific animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate-key', listener)` where `key` is the key of + * the animation. For example, if you had an animation with the key 'explode' you should listen for `animationupdate-explode`. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate-'; diff --git a/src/animations/events/SPRITE_ANIMATION_REPEAT_EVENT.js b/src/animations/events/SPRITE_ANIMATION_REPEAT_EVENT.js new file mode 100644 index 000000000..6e4816738 --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_REPEAT_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Repeat Event. + * + * This event is dispatched by a Sprite when an animation repeats playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_REPEAT` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that is repeating on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {integer} repeatCount - The number of times the Animation has repeated so far. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated playing. + */ +module.exports = 'animationrepeat'; diff --git a/src/animations/events/SPRITE_ANIMATION_RESTART_EVENT.js b/src/animations/events/SPRITE_ANIMATION_RESTART_EVENT.js new file mode 100644 index 000000000..85e3ef0f9 --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_RESTART_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Restart Event. + * + * This event is dispatched by a Sprite when an animation restarts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationrestart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_RESTART` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_RESTART + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was restarted on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation restarted with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted playing. + */ +module.exports = 'animationrestart'; diff --git a/src/animations/events/SPRITE_ANIMATION_START_EVENT.js b/src/animations/events/SPRITE_ANIMATION_START_EVENT.js new file mode 100644 index 000000000..110068c46 --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_START_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Start Event. + * + * This event is dispatched by a Sprite when an animation starts playing on it. + * + * Listen for it on the Sprite using `sprite.on('animationstart', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_START` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_START + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that was started on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame that the Animation started with. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started playing. + */ +module.exports = 'animationstart'; diff --git a/src/animations/events/SPRITE_ANIMATION_UPDATE_EVENT.js b/src/animations/events/SPRITE_ANIMATION_UPDATE_EVENT.js new file mode 100644 index 000000000..0e33b73de --- /dev/null +++ b/src/animations/events/SPRITE_ANIMATION_UPDATE_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sprite Animation Update Event. + * + * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame, + * based on the animation frame rate and other factors like `timeScale` and `delay`. + * + * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` + * + * This same event is dispatched for all animations. To listen for a specific animation, use the `SPRITE_ANIMATION_KEY_UPDATE` event. + * + * @event Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE + * @since 3.16.1 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated on the Sprite. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + */ +module.exports = 'animationupdate'; diff --git a/src/animations/events/index.js b/src/animations/events/index.js new file mode 100644 index 000000000..4f4e55f27 --- /dev/null +++ b/src/animations/events/index.js @@ -0,0 +1,32 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Animations.Events + */ + +module.exports = { + + ADD_ANIMATION: require('./ADD_ANIMATION_EVENT'), + ANIMATION_COMPLETE: require('./ANIMATION_COMPLETE_EVENT'), + ANIMATION_REPEAT: require('./ANIMATION_REPEAT_EVENT'), + ANIMATION_RESTART: require('./ANIMATION_RESTART_EVENT'), + ANIMATION_START: require('./ANIMATION_START_EVENT'), + PAUSE_ALL: require('./PAUSE_ALL_EVENT'), + REMOVE_ANIMATION: require('./REMOVE_ANIMATION_EVENT'), + RESUME_ALL: require('./RESUME_ALL_EVENT'), + SPRITE_ANIMATION_COMPLETE: require('./SPRITE_ANIMATION_COMPLETE_EVENT'), + SPRITE_ANIMATION_KEY_COMPLETE: require('./SPRITE_ANIMATION_KEY_COMPLETE_EVENT'), + SPRITE_ANIMATION_KEY_REPEAT: require('./SPRITE_ANIMATION_KEY_REPEAT_EVENT'), + SPRITE_ANIMATION_KEY_RESTART: require('./SPRITE_ANIMATION_KEY_RESTART_EVENT'), + SPRITE_ANIMATION_KEY_START: require('./SPRITE_ANIMATION_KEY_START_EVENT'), + SPRITE_ANIMATION_KEY_UPDATE: require('./SPRITE_ANIMATION_KEY_UPDATE_EVENT'), + SPRITE_ANIMATION_REPEAT: require('./SPRITE_ANIMATION_REPEAT_EVENT'), + SPRITE_ANIMATION_RESTART: require('./SPRITE_ANIMATION_RESTART_EVENT'), + SPRITE_ANIMATION_START: require('./SPRITE_ANIMATION_START_EVENT'), + SPRITE_ANIMATION_UPDATE: require('./SPRITE_ANIMATION_UPDATE_EVENT') + +}; diff --git a/src/animations/index.js b/src/animations/index.js index 044320c70..df26b5575 100644 --- a/src/animations/index.js +++ b/src/animations/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ module.exports = { Animation: require('./Animation'), AnimationFrame: require('./AnimationFrame'), - AnimationManager: require('./AnimationManager') + AnimationManager: require('./AnimationManager'), + Events: require('./events') }; diff --git a/src/animations/typedefs/Animation.js b/src/animations/typedefs/Animation.js new file mode 100644 index 000000000..ca215e344 --- /dev/null +++ b/src/animations/typedefs/Animation.js @@ -0,0 +1,17 @@ +/** + * @typedef {object} Phaser.Animations.Types.Animation + * @since 3.0.0 + * + * @property {string} [key] - The key that the animation will be associated with. i.e. sprite.animations.play(key) + * @property {Phaser.Animations.Types.AnimationFrame[]} [frames] - An object containing data used to generate the frames for the animation + * @property {string} [defaultTextureKey=null] - The key of the texture all frames of the animation will use. Can be overridden on a per frame basis. + * @property {integer} [frameRate] - The frame rate of playback in frames per second (default 24 if duration is null) + * @property {integer} [duration] - How long the animation should play for in milliseconds. If not given its derived from frameRate. + * @property {boolean} [skipMissedFrames=true] - Skip frames if the time lags, or always advanced anyway? + * @property {integer} [delay=0] - Delay before starting playback. Value given in milliseconds. + * @property {integer} [repeat=0] - Number of times to repeat the animation (-1 for infinity) + * @property {integer} [repeatDelay=0] - Delay before the animation repeats. Value given in milliseconds. + * @property {boolean} [yoyo=false] - Should the animation yoyo? (reverse back down to the start) before repeating? + * @property {boolean} [showOnStart=false] - Should sprite.visible = true when the animation starts to play? + * @property {boolean} [hideOnComplete=false] - Should sprite.visible = false when the animation finishes? + */ diff --git a/src/animations/typedefs/AnimationFrame.js b/src/animations/typedefs/AnimationFrame.js new file mode 100644 index 000000000..43411bdd5 --- /dev/null +++ b/src/animations/typedefs/AnimationFrame.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Animations.Types.AnimationFrame + * @since 3.0.0 + * + * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) + * @property {(string|number)} frame - [description] + * @property {number} [duration=0] - [description] + * @property {boolean} [visible] - [description] + */ diff --git a/src/animations/typedefs/GenerateFrameNames.js b/src/animations/typedefs/GenerateFrameNames.js new file mode 100644 index 000000000..0688690c3 --- /dev/null +++ b/src/animations/typedefs/GenerateFrameNames.js @@ -0,0 +1,12 @@ +/** + * @typedef {object} Phaser.Animations.Types.GenerateFrameNames + * @since 3.0.0 + * + * @property {string} [prefix=''] - The string to append to every resulting frame name if using a range or an array of `frames`. + * @property {integer} [start=0] - If `frames` is not provided, the number of the first frame to return. + * @property {integer} [end=0] - If `frames` is not provided, the number of the last frame to return. + * @property {string} [suffix=''] - The string to append to every resulting frame name if using a range or an array of `frames`. + * @property {integer} [zeroPad=0] - The minimum expected lengths of each resulting frame's number. Numbers will be left-padded with zeroes until they are this long, then prepended and appended to create the resulting frame name. + * @property {Phaser.Animations.Types.AnimationFrame[]} [outputArray=[]] - The array to append the created configuration objects to. + * @property {boolean} [frames=false] - If provided as an array, the range defined by `start` and `end` will be ignored and these frame numbers will be used. + */ diff --git a/src/animations/typedefs/GenerateFrameNumbers.js b/src/animations/typedefs/GenerateFrameNumbers.js new file mode 100644 index 000000000..71cf395ed --- /dev/null +++ b/src/animations/typedefs/GenerateFrameNumbers.js @@ -0,0 +1,10 @@ +/** + * @typedef {object} Phaser.Animations.Types.GenerateFrameNumbers + * @since 3.0.0 + * + * @property {integer} [start=0] - The starting frame of the animation. + * @property {integer} [end=-1] - The ending frame of the animation. + * @property {(boolean|integer)} [first=false] - A frame to put at the beginning of the animation, before `start` or `outputArray` or `frames`. + * @property {Phaser.Animations.Types.AnimationFrame[]} [outputArray=[]] - An array to concatenate the output onto. + * @property {(boolean|integer[])} [frames=false] - A custom sequence of frames. + */ diff --git a/src/animations/typedefs/JSONAnimation.js b/src/animations/typedefs/JSONAnimation.js new file mode 100644 index 000000000..5d342f4ef --- /dev/null +++ b/src/animations/typedefs/JSONAnimation.js @@ -0,0 +1,17 @@ +/** + * @typedef {object} Phaser.Animations.Types.JSONAnimation + * @since 3.0.0 + * + * @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key) + * @property {string} type - A frame based animation (as opposed to a bone based animation) + * @property {Phaser.Animations.Types.JSONAnimationFrame[]} frames - [description] + * @property {integer} frameRate - The frame rate of playback in frames per second (default 24 if duration is null) + * @property {integer} duration - How long the animation should play for in milliseconds. If not given its derived from frameRate. + * @property {boolean} skipMissedFrames - Skip frames if the time lags, or always advanced anyway? + * @property {integer} delay - Delay before starting playback. Value given in milliseconds. + * @property {integer} repeat - Number of times to repeat the animation (-1 for infinity) + * @property {integer} repeatDelay - Delay before the animation repeats. Value given in milliseconds. + * @property {boolean} yoyo - Should the animation yoyo? (reverse back down to the start) before repeating? + * @property {boolean} showOnStart - Should sprite.visible = true when the animation starts to play? + * @property {boolean} hideOnComplete - Should sprite.visible = false when the animation finishes? + */ diff --git a/src/animations/typedefs/JSONAnimationFrame.js b/src/animations/typedefs/JSONAnimationFrame.js new file mode 100644 index 000000000..b7182e592 --- /dev/null +++ b/src/animations/typedefs/JSONAnimationFrame.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Animations.Types.JSONAnimationFrame + * @since 3.0.0 + * + * @property {string} key - The key of the Texture this AnimationFrame uses. + * @property {(string|integer)} frame - The key of the Frame within the Texture that this AnimationFrame uses. + * @property {number} duration - Additional time (in ms) that this frame should appear for during playback. + */ diff --git a/src/animations/typedefs/JSONAnimations.js b/src/animations/typedefs/JSONAnimations.js new file mode 100644 index 000000000..fbda4a596 --- /dev/null +++ b/src/animations/typedefs/JSONAnimations.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Animations.Types.JSONAnimations + * @since 3.0.0 + * + * @property {Phaser.Animations.Types.JSONAnimation[]} anims - An array of all Animations added to the Animation Manager. + * @property {number} globalTimeScale - The global time scale of the Animation Manager. + */ diff --git a/src/animations/typedefs/index.js b/src/animations/typedefs/index.js new file mode 100644 index 000000000..af26b2693 --- /dev/null +++ b/src/animations/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Animations.Types + */ diff --git a/src/boot/Config.js b/src/boot/Config.js deleted file mode 100644 index 5502ba94e..000000000 --- a/src/boot/Config.js +++ /dev/null @@ -1,746 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = require('../utils/Class'); -var CONST = require('../const'); -var Device = require('../device'); -var GetFastValue = require('../utils/object/GetFastValue'); -var GetValue = require('../utils/object/GetValue'); -var IsPlainObject = require('../utils/object/IsPlainObject'); -var PhaserMath = require('../math/'); -var NOOP = require('../utils/NOOP'); -var DefaultPlugins = require('../plugins/DefaultPlugins'); -var ValueToColor = require('../display/color/ValueToColor'); - -/** - * This callback type is completely empty, a no-operation. - * - * @callback NOOP - */ - -/** - * @callback BootCallback - * - * @param {Phaser.Game} game - The game. - */ - -/** - * Config object containing various sound settings. - * - * @typedef {object} AudioConfig - * - * @property {boolean} [disableWebAudio=false] - Use HTML5 Audio instead of Web Audio. - * @property {AudioContext} [context] - An existing Web Audio context. - * @property {boolean} [noAudio=false] - Disable all audio output. - * - * @see Phaser.Sound.SoundManagerCreator - */ - -/** - * @typedef {object} InputConfig - * - * @property {(boolean|KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. - * @property {(boolean|MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. - * @property {(boolean|TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. - * @property {(boolean|GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. - * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. - * @property {number} [smoothFactor=0] - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. - */ - -/** - * @typedef {object} MouseInputConfig - * - * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether mouse input events have `preventDefault` called on them. - */ - -/** - * @typedef {object} KeyboardInputConfig - * - * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. - * @property {?integer} [capture] - `preventDefault` will be called on every non-modified key which has a key code in this array. By default it is empty. - */ - -/** - * @typedef {object} TouchInputConfig - * - * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. - * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. - */ - -/** - * @typedef {object} GamepadInputConfig - * - * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. - */ - -/** - * @typedef {object} BannerConfig - * - * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. - * @property {string} [text='#ffffff'] - The color of the banner text. - * @property {string[]} [background] - The background colors of the banner. - */ - -/** - * @typedef {object} FPSConfig - * - * @property {integer} [min=5] - The minimum acceptable rendering rate, in frames per second. - * @property {integer} [target=60] - The optimum rendering rate, in frames per second. - * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. - * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. - * @property {integer} [panicMax=120] - The amount of frames the time step counts before we trust the delta values again. - */ - -/** - * @typedef {object} RenderConfig - * - * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. - * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. - * @property {boolean} [autoResize=true] - Automatically resize the Game Canvas if you resize the renderer. - * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. - * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. - * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. - * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. - * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. - * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. - * @property {integer} [batchSize=2000] - The default WebGL batch size. - * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - -/** - * @typedef {object} ScaleConfig - * - * @property {(integer|string)} [width=1024] - The base width of your game. - * @property {(integer|string)} [height=768] - The base height of your game. - * @property {integer} [zoom=1] - The zoom value of the game canvas. - * @property {number} [resolution=1] - The rendering resolution of the canvas. - * @property {(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {integer} [mode=0] - The scale mode to apply to the canvas. SHOW_ALL, EXACT_FIT, USER_SCALE, or RESIZE. - * @property {integer} [minWidth] - The minimum width the canvas can be scaled down to. - * @property {integer} [minHeight] - The minimum height the canvas can be scaled down to. - * @property {integer} [maxWidth] - The maximum width the canvas can be scaled up to. - * @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to. - */ - -/** - * @typedef {object} CallbacksConfig - * - * @property {BootCallback} [preBoot=NOOP] - A function to run at the start of the boot sequence. - * @property {BootCallback} [postBoot=NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. - */ - -/** - * @typedef {object} LoaderConfig - * - * @property {string} [baseURL] - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. - * @property {string} [path] - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. - * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. - * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. - * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. - * @property {boolean} [async=true] - Should the XHR request use async or not? - * @property {string} [user] - Optional username for all XHR requests. - * @property {string} [password] - Optional password for all XHR requests. - * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. - */ - -/** - * @typedef {object} DOMContainerConfig - * - * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. - * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. - */ - -/** - * @typedef {object} ImagesConfig - * - * @property {string} [default] - URL to use for the 'default' texture. - * @property {string} [missing] - URL to use for the 'missing' texture. - */ - -/** - * @typedef {object} PhysicsConfig - * - * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. - * @property {ArcadeWorldConfig} [arcade] - Arcade Physics configuration. - * @property {Phaser.Physics.Impact.WorldConfig} [impact] - Impact Physics configuration. - * @property {object} [matter] - Matter Physics configuration. - */ - -/** - * @typedef {object} PluginObjectItem - * - * @property {string} [key] - A key to identify the plugin in the Plugin Manager. - * @property {*} [plugin] - The plugin itself. Usually a class/constructor. - * @property {boolean} [start] - Whether the plugin should be started automatically. - * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). - * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). - * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @property {*} [data] - Arbitrary data passed to the plugin's init() method. - * - * @example - * // Global plugin - * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } - * @example - * // Scene plugin - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - */ - -/** - * @typedef {object} PluginObject - * - * @property {?PluginObjectItem[]} [global] - Global plugins to install. - * @property {?PluginObjectItem[]} [scene] - Scene plugins to install. - * @property {string[]} [default] - The default set of scene plugins (names). - * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. - */ - -/** - * @typedef {object} GameConfig - * - * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. - * @property {(integer|string)} [height=768] - The height of the game, in game pixels. - * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. - * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. - * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. - * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If null (the default) or if the named element doesn't exist, the game canvas is inserted directly into the document body. - * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. - * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. - * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. - * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. - * @property {string[]} [seed] - Seed for the random number generator. - * @property {string} [title=''] - The title of the game. Shown in the browser console. - * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. - * @property {string} [version=''] - The version of the game. Shown in the browser console. - * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. - * @property {(boolean|InputConfig)} [input] - Input configuration, or `false` to disable all game input. - * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). - * @property {(boolean|BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. - * @property {DOMContainerConfig} [dom] - The DOM Container configuration object. - * @property {FPSConfig} [fps] - Game loop configuration. - * @property {RenderConfig} [render] - Game renderer configuration. - * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. - * @property {CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. - * @property {LoaderConfig} [loader] - Loader configuration. - * @property {ImagesConfig} [images] - Images configuration. - * @property {object} [physics] - Physics configuration. - * @property {PluginObject|PluginObjectItem[]} [plugins] - Plugins to install. - */ - -/** - * @classdesc - * The active game configuration settings, parsed from a {@link GameConfig} object. - * - * @class Config - * @memberof Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. - * - * @see Phaser.Game#config - */ -var Config = new Class({ - - initialize: - - function Config (config) - { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; - - var defaultBannerTextColor = '#ffffff'; - - /** - * @const {(integer|string)} Phaser.Boot.Config#width - The width of the underlying canvas, in pixels. - */ - this.width = GetValue(config, 'width', 1024); - - /** - * @const {(integer|string)} Phaser.Boot.Config#height - The height of the underlying canvas, in pixels. - */ - this.height = GetValue(config, 'height', 768); - - /** - * @const {number} Phaser.Boot.Config#zoom - The zoom factor, as used by the Scale Manager. - */ - this.zoom = GetValue(config, 'zoom', 1); - - /** - * @const {number} Phaser.Boot.Config#resolution - The canvas device pixel resolution. - */ - this.resolution = GetValue(config, 'resolution', 1); - - /** - * @const {?*} Phaser.Boot.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. - */ - this.parent = GetValue(config, 'parent', null); - - /** - * @const {integer} Phaser.Boot.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. - */ - this.scaleMode = GetValue(config, 'scaleMode', 0); - - /** - * @const {boolean} Phaser.Boot.Config#expandParent - Is the Scale Manager allowed to adjust the size of the parent container? - */ - this.expandParent = GetValue(config, 'expandParent', false); - - /** - * @const {integer} Phaser.Boot.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. - */ - this.minWidth = GetValue(config, 'minWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. - */ - this.maxWidth = GetValue(config, 'maxWidth', 0); - - /** - * @const {integer} Phaser.Boot.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. - */ - this.minHeight = GetValue(config, 'minHeight', 0); - - /** - * @const {integer} Phaser.Boot.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. - */ - this.maxHeight = GetValue(config, 'maxHeight', 0); - - // Scale Manager - Anything set in here over-rides anything set above - - var scaleConfig = GetValue(config, 'scale', null); - - if (scaleConfig) - { - this.width = GetValue(scaleConfig, 'width', this.width); - this.height = GetValue(scaleConfig, 'height', this.height); - this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); - this.parent = GetValue(scaleConfig, 'parent', this.parent); - this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); - this.expandParent = GetValue(scaleConfig, 'mode', this.expandParent); - this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); - this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); - this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); - this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); - } - - /** - * @const {number} Phaser.Boot.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) - */ - this.renderType = GetValue(config, 'type', CONST.AUTO); - - /** - * @const {?HTMLCanvasElement} Phaser.Boot.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. - */ - this.canvas = GetValue(config, 'canvas', null); - - /** - * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Boot.Config#context - Force Phaser to use your own Canvas context instead of creating one. - */ - this.context = GetValue(config, 'context', null); - - /** - * @const {?string} Phaser.Boot.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. - */ - this.canvasStyle = GetValue(config, 'canvasStyle', null); - - /** - * @const {boolean} Phaser.Boot.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. - */ - this.customEnvironment = GetValue(config, 'customEnvironment', false); - - /** - * @const {?object} Phaser.Boot.Config#sceneConfig - The default Scene configuration object. - */ - this.sceneConfig = GetValue(config, 'scene', null); - - /** - * @const {string[]} Phaser.Boot.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. - */ - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - - PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); - - /** - * @const {string} Phaser.Boot.Config#gameTitle - The title of the game. - */ - this.gameTitle = GetValue(config, 'title', ''); - - /** - * @const {string} Phaser.Boot.Config#gameURL - The URL of the game. - */ - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - - /** - * @const {string} Phaser.Boot.Config#gameVersion - The version of the game. - */ - this.gameVersion = GetValue(config, 'version', ''); - - /** - * @const {boolean} Phaser.Boot.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. - */ - this.autoFocus = GetValue(config, 'autoFocus', true); - - // DOM Element Container - - /** - * @const {?boolean} Phaser.Boot.Config#domCreateContainer - EXPERIMENTAL: Do not currently use. - */ - this.domCreateContainer = GetValue(config, 'dom.createContainer', false); - - /** - * @const {?boolean} Phaser.Boot.Config#domBehindCanvas - EXPERIMENTAL: Do not currently use. - */ - this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); - - // Input - - /** - * @const {boolean} Phaser.Boot.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. - */ - this.inputKeyboard = GetValue(config, 'input.keyboard', true); - - /** - * @const {*} Phaser.Boot.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. - */ - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); - - /** - * @const {?integer[]} Phaser.Boot.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. - */ - this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); - - /** - * @const {(boolean|object)} Phaser.Boot.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. - */ - this.inputMouse = GetValue(config, 'input.mouse', true); - - /** - * @const {?*} Phaser.Boot.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. - */ - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. - */ - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. - */ - this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); - - /** - * @const {?*} Phaser.Boot.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. - */ - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - - /** - * @const {boolean} Phaser.Boot.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. - */ - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); - - /** - * @const {integer} Phaser.Boot.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. - */ - this.inputActivePointers = GetValue(config, 'input.activePointers', 1); - - /** - * @const {integer} Phaser.Boot.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. - */ - this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); - - /** - * @const {boolean} Phaser.Boot.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. - */ - this.inputGamepad = GetValue(config, 'input.gamepad', false); - - /** - * @const {*} Phaser.Boot.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. - */ - this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); - - /** - * @const {boolean} Phaser.Boot.Config#disableContextMenu - Set to `true` to disable the right-click context menu. - */ - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - - /** - * @const {AudioConfig} Phaser.Boot.Config#audio - The Audio Configuration object. - */ - this.audio = GetValue(config, 'audio'); - - // If you do: { banner: false } it won't display any banner at all - - /** - * @const {boolean} Phaser.Boot.Config#hideBanner - Don't write the banner line to the console.log. - */ - this.hideBanner = (GetValue(config, 'banner', null) === false); - - /** - * @const {boolean} Phaser.Boot.Config#hidePhaser - Omit Phaser's name and version from the banner. - */ - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - - /** - * @const {string} Phaser.Boot.Config#bannerTextColor - The color of the banner text. - */ - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - - /** - * @const {string[]} Phaser.Boot.Config#bannerBackgroundColor - The background colors of the banner. - */ - this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); - - if (this.gameTitle === '' && this.hidePhaser) - { - this.hideBanner = true; - } - - /** - * @const {?FPSConfig} Phaser.Boot.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. - */ - this.fps = GetValue(config, 'fps', null); - - // Renderer Settings - // These can either be in a `render` object within the Config, or specified on their own - - var renderConfig = GetValue(config, 'render', config); - - /** - * @const {boolean} Phaser.Boot.Config#autoResize - Automatically resize the Game Canvas if you resize the renderer. - */ - this.autoResize = GetValue(renderConfig, 'autoResize', true); - - /** - * @const {boolean} Phaser.Boot.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. - */ - this.antialias = GetValue(renderConfig, 'antialias', true); - - /** - * @const {boolean} Phaser.Boot.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. - */ - this.roundPixels = GetValue(renderConfig, 'roundPixels', false); - - /** - * @const {boolean} Phaser.Boot.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). - */ - this.pixelArt = GetValue(renderConfig, 'pixelArt', false); - - if (this.pixelArt) - { - this.antialias = false; - this.roundPixels = true; - } - - /** - * @const {boolean} Phaser.Boot.Config#transparent - Whether the game canvas will have a transparent background. - */ - this.transparent = GetValue(renderConfig, 'transparent', false); - - /** - * @const {boolean} Phaser.Boot.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. - */ - this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); - - /** - * @const {boolean} Phaser.Boot.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. - */ - this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); - - /** - * @const {boolean} Phaser.Boot.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. - */ - this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); - - /** - * @const {string} Phaser.Boot.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. - */ - this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); - - /** - * @const {integer} Phaser.Boot.Config#batchSize - The default WebGL Batch size. - */ - this.batchSize = GetValue(renderConfig, 'batchSize', 2000); - - /** - * @const {integer} Phaser.Boot.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - this.maxLights = GetValue(renderConfig, 'maxLights', 10); - - var bgc = GetValue(config, 'backgroundColor', 0); - - /** - * @const {Phaser.Display.Color} Phaser.Boot.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. - */ - this.backgroundColor = ValueToColor(bgc); - - if (bgc === 0 && this.transparent) - { - this.backgroundColor.alpha = 0; - } - - /** - * @const {BootCallback} Phaser.Boot.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. - */ - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); - - /** - * @const {BootCallback} Phaser.Boot.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. - */ - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); - - /** - * @const {PhysicsConfig} Phaser.Boot.Config#physics - The Physics Configuration object. - */ - this.physics = GetValue(config, 'physics', {}); - - /** - * @const {(boolean|string)} Phaser.Boot.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. - */ - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); - - /** - * @const {string} Phaser.Boot.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. - */ - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. - */ - this.loaderPath = GetValue(config, 'loader.path', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). - */ - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); - - /** - * @const {(string|undefined)} Phaser.Boot.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. - */ - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - - /** - * @const {string} Phaser.Boot.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. - */ - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - - /** - * @const {boolean} Phaser.Boot.Config#loaderAsync - Should the XHR request use async or not? - */ - this.loaderAsync = GetValue(config, 'loader.async', true); - - /** - * @const {string} Phaser.Boot.Config#loaderUser - Optional username for all XHR requests. - */ - this.loaderUser = GetValue(config, 'loader.user', ''); - - /** - * @const {string} Phaser.Boot.Config#loaderPassword - Optional password for all XHR requests. - */ - this.loaderPassword = GetValue(config, 'loader.password', ''); - - /** - * @const {integer} Phaser.Boot.Config#loaderTimeout - Optional XHR timeout value, in ms. - */ - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); - - /* - * Allows `plugins` property to either be an array, in which case it just replaces - * the default plugins like previously, or a config object. - * - * plugins: { - * global: [ - * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, - * ], - * scene: [ - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - * ], - * default: [], OR - * defaultMerge: [ - * 'ModPlayer' - * ] - * } - */ - - /** - * @const {any} Phaser.Boot.Config#installGlobalPlugins - An array of global plugins to be installed. - */ - this.installGlobalPlugins = []; - - /** - * @const {any} Phaser.Boot.Config#installScenePlugins - An array of Scene level plugins to be installed. - */ - this.installScenePlugins = []; - - var plugins = GetValue(config, 'plugins', null); - var defaultPlugins = DefaultPlugins.DefaultScene; - - if (plugins) - { - // Old 3.7 array format? - if (Array.isArray(plugins)) - { - this.defaultPlugins = plugins; - } - else if (IsPlainObject(plugins)) - { - this.installGlobalPlugins = GetFastValue(plugins, 'global', []); - this.installScenePlugins = GetFastValue(plugins, 'scene', []); - - if (Array.isArray(plugins.default)) - { - defaultPlugins = plugins.default; - } - else if (Array.isArray(plugins.defaultMerge)) - { - defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); - } - } - } - - /** - * @const {any} Phaser.Boot.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). - */ - this.defaultPlugins = defaultPlugins; - - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - - /** - * @const {string} Phaser.Boot.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. - */ - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - - /** - * @const {string} Phaser.Boot.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. - */ - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); - - if (window) - { - if (window.FORCE_WEBGL) - { - this.renderType = CONST.WEBGL; - } - else if (window.FORCE_CANVAS) - { - this.renderType = CONST.CANVAS; - } - } - } - -}); - -module.exports = Config; diff --git a/src/cache/BaseCache.js b/src/cache/BaseCache.js index e87d7e514..8a96ea971 100644 --- a/src/cache/BaseCache.js +++ b/src/cache/BaseCache.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var CustomMap = require('../structs/Map'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); /** * @classdesc @@ -48,23 +49,12 @@ var BaseCache = new Class({ this.events = new EventEmitter(); }, - /** - * 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} cache - The BaseCache to which the object was added. - * @param {string} key - The key of the object added to the cache. - * @param {*} object - 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 + * @fires Phaser.Cache.Events#ADD * @since 3.0.0 * * @param {string} key - The unique key by which the data added to the cache will be referenced. @@ -76,7 +66,7 @@ var BaseCache = new Class({ { this.entries.set(key, data); - this.events.emit('add', this, key, data); + this.events.emit(Events.ADD, this, key, data); return this; }, @@ -128,17 +118,6 @@ var BaseCache = new Class({ 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} cache - The BaseCache from which the object was removed. - * @param {string} key - The key of the object removed from the cache. - * @param {*} object - The object that was removed from the cache. - */ - /** * Removes and item from this cache based on the given key. * @@ -147,7 +126,7 @@ var BaseCache = new Class({ * 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 + * @fires Phaser.Cache.Events#REMOVE * @since 3.0.0 * * @param {string} key - The unique key of the item to remove from the cache. @@ -162,7 +141,7 @@ var BaseCache = new Class({ { this.entries.delete(key); - this.events.emit('remove', this, key, entry.data); + this.events.emit(Events.REMOVE, this, key, entry.data); } return this; diff --git a/src/cache/CacheManager.js b/src/cache/CacheManager.js index 08981c353..8d18f9e26 100644 --- a/src/cache/CacheManager.js +++ b/src/cache/CacheManager.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseCache = require('./BaseCache'); var Class = require('../utils/Class'); +var GameEvents = require('../core/events'); /** * @classdesc @@ -149,7 +150,7 @@ var CacheManager = new Class({ */ this.custom = {}; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** diff --git a/src/cache/events/ADD_EVENT.js b/src/cache/events/ADD_EVENT.js new file mode 100644 index 000000000..aae9276e1 --- /dev/null +++ b/src/cache/events/ADD_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Add Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time a new object is added to it. + * + * @event Phaser.Cache.Events#ADD + * @since 3.0.0 + * + * @param {Phaser.Cache.BaseCache} cache - The cache to which the object was added. + * @param {string} key - The key of the object added to the cache. + * @param {*} object - A reference to the object that was added to the cache. + */ +module.exports = 'add'; diff --git a/src/cache/events/REMOVE_EVENT.js b/src/cache/events/REMOVE_EVENT.js new file mode 100644 index 000000000..ed2fce337 --- /dev/null +++ b/src/cache/events/REMOVE_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Cache Remove Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time an object is removed from it. + * + * @event Phaser.Cache.Events#REMOVE + * @since 3.0.0 + * + * @param {Phaser.Cache.BaseCache} cache - The cache from which the object was removed. + * @param {string} key - The key of the object removed from the cache. + * @param {*} object - A reference to the object that was removed from the cache. + */ +module.exports = 'remove'; diff --git a/src/cache/events/index.js b/src/cache/events/index.js new file mode 100644 index 000000000..9343b86fb --- /dev/null +++ b/src/cache/events/index.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cache.Events + */ + +module.exports = { + + ADD: require('./ADD_EVENT'), + REMOVE: require('./REMOVE_EVENT') + +}; diff --git a/src/cache/index.js b/src/cache/index.js index be726d7f1..d2b93872d 100644 --- a/src/cache/index.js +++ b/src/cache/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,6 +11,7 @@ module.exports = { BaseCache: require('./BaseCache'), - CacheManager: require('./CacheManager') + CacheManager: require('./CacheManager'), + Events: require('./events') }; diff --git a/src/cameras/2d/BaseCamera.js b/src/cameras/2d/BaseCamera.js index a72025e33..97a167e57 100644 --- a/src/cameras/2d/BaseCamera.js +++ b/src/cameras/2d/BaseCamera.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,36 +8,12 @@ var Class = require('../../utils/Class'); var Components = require('../../gameobjects/components'); var DegToRad = require('../../math/DegToRad'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var Rectangle = require('../../geom/rectangle/Rectangle'); var TransformMatrix = require('../../gameobjects/components/TransformMatrix'); var ValueToColor = require('../../display/color/ValueToColor'); var Vector2 = require('../../math/Vector2'); -/** - * @typedef {object} JSONCameraBounds - * @property {number} x - The horizontal position of camera - * @property {number} y - The vertical position of camera - * @property {number} width - The width size of camera - * @property {number} height - The height size of camera - */ - -/** - * @typedef {object} JSONCamera - * - * @property {string} name - The name of the camera - * @property {number} x - The horizontal position of camera - * @property {number} y - The vertical position of camera - * @property {number} width - The width size of camera - * @property {number} height - The height size of camera - * @property {number} zoom - The zoom of camera - * @property {number} rotation - The rotation of camera - * @property {boolean} roundPixels - The round pixels st status of camera - * @property {number} scrollX - The horizontal scroll of camera - * @property {number} scrollY - The vertical scroll of camera - * @property {string} backgroundColor - The background color of camera - * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera - */ - /** * @classdesc * A Base Camera class. @@ -119,14 +95,13 @@ var BaseCamera = new Class({ this.sceneManager; /** - * A reference to the Game Config. + * A reference to the Game Scale Manager. * - * @name Phaser.Cameras.Scene2D.BaseCamera#config - * @type {object} - * @readonly - * @since 3.12.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 */ - this.config; + this.scaleManager; /** * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. @@ -150,11 +125,14 @@ var BaseCamera = new Class({ this.name = ''; /** + * This property is un-used in v3.16. + * * The resolution of the Game, used in most Camera calculations. * * @name Phaser.Cameras.Scene2D.BaseCamera#resolution * @type {number} * @readonly + * @deprecated * @since 3.12.0 */ this.resolution = 1; @@ -900,10 +878,9 @@ var BaseCamera = new Class({ * @protected * @since 3.0.0 * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. + * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (baseScale, resolution) + preRender: function (resolution) { var width = this.width; var height = this.height; @@ -911,7 +888,7 @@ var BaseCamera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * baseScale; + var zoom = this.zoom * resolution; var matrix = this.matrix; var originX = width * this.originX; @@ -953,11 +930,7 @@ var BaseCamera = new Class({ displayHeight ); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); }, @@ -1081,7 +1054,7 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor * @since 3.0.0 * - * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. + * @param {(string|number|Phaser.Display.Types.InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. * * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance. */ @@ -1277,10 +1250,10 @@ var BaseCamera = new Class({ this.scene = scene; - this.config = scene.sys.game.config; this.sceneManager = scene.sys.game.scene; + this.scaleManager = scene.sys.scale; - var res = this.config.resolution; + var res = this.scaleManager.resolution; this.resolution = res; @@ -1425,7 +1398,7 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON * @since 3.0.0 * - * @return {JSONCamera} A well-formed object suitable for conversion to JSON. + * @return {Phaser.Cameras.Scene2D.Types.JSONCamera} A well-formed object suitable for conversion to JSON. */ toJSON: function () { @@ -1480,12 +1453,12 @@ var BaseCamera = new Class({ */ updateSystem: function () { - if (!this.config) + if (!this.scaleManager) { return; } - var custom = (this._x !== 0 || this._y !== 0 || this.config.width !== this._width || this.config.height !== this._height); + var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.height !== this._height); var sceneManager = this.sceneManager; @@ -1504,13 +1477,6 @@ var BaseCamera = new Class({ this._customViewport = custom; }, - /** - * This event is fired when a camera is destroyed by the Camera Manager. - * - * @event CameraDestroyEvent - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. - */ - /** * Destroys this Camera instance and its internal properties and references. * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. @@ -1521,12 +1487,12 @@ var BaseCamera = new Class({ * rather than calling this method directly. * * @method Phaser.Cameras.Scene2D.BaseCamera#destroy - * @fires CameraDestroyEvent + * @fires Phaser.Cameras.Scene2D.Events#DESTROY * @since 3.0.0 */ destroy: function () { - this.emit('cameradestroy', this); + this.emit(Events.DESTROY, this); this.removeAllListeners(); @@ -1543,7 +1509,7 @@ var BaseCamera = new Class({ this._bounds = null; this.scene = null; - this.config = null; + this.scaleManager = null; this.sceneManager = null; }, diff --git a/src/cameras/2d/Camera.js b/src/cameras/2d/Camera.js index 6f7b26a36..f10b49cee 100644 --- a/src/cameras/2d/Camera.js +++ b/src/cameras/2d/Camera.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -254,7 +254,7 @@ var Camera = new Class({ * * This is only set if Phaser is running with the WebGL Renderer. * - * @name Phaser.Cameras.Scene2D.Camera#framebuffer + * @name Phaser.Cameras.Scene2D.Camera#glTexture * @type {?WebGLTexture} * @since 3.13.0 */ @@ -496,6 +496,8 @@ var Camera = new Class({ * Fades the Camera in from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeIn + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -518,6 +520,8 @@ var Camera = new Class({ * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades. * * @method Phaser.Cameras.Scene2D.Camera#fadeOut + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.3.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -539,6 +543,8 @@ var Camera = new Class({ * Fades the Camera from the given color to transparent over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fadeFrom + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.5.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -561,6 +567,8 @@ var Camera = new Class({ * Fades the Camera from transparent to the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#fade + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.0.0 * * @param {integer} [duration=1000] - The duration of the effect in milliseconds. @@ -583,6 +591,8 @@ var Camera = new Class({ * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#flash + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.0.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -605,6 +615,8 @@ var Camera = new Class({ * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Camera#shake + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.0.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. @@ -626,13 +638,15 @@ var Camera = new Class({ * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#pan + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -673,12 +687,14 @@ var Camera = new Class({ * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Camera#zoomTo + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. @@ -698,10 +714,9 @@ var Camera = new Class({ * @protected * @since 3.0.0 * - * @param {number} baseScale - The base scale, as set in the Camera Manager. - * @param {number} resolution - The game resolution. + * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (baseScale, resolution) + preRender: function (resolution) { var width = this.width; var height = this.height; @@ -709,7 +724,7 @@ var Camera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * baseScale; + var zoom = this.zoom * resolution; var matrix = this.matrix; var originX = width * this.originX; @@ -791,11 +806,7 @@ var Camera = new Class({ displayHeight ); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); this.shakeEffect.preRender(); @@ -975,7 +986,7 @@ var Camera = new Class({ * cameras are stored in a pool, ready for recycling later, and calling this directly will prevent that. * * @method Phaser.Cameras.Scene2D.Camera#destroy - * @fires CameraDestroyEvent + * @fires Phaser.Cameras.Scene2D.Events#DESTROY * @since 3.0.0 */ destroy: function () diff --git a/src/cameras/2d/CameraManager.js b/src/cameras/2d/CameraManager.js index 12ded64d3..4b3390464 100644 --- a/src/cameras/2d/CameraManager.js +++ b/src/cameras/2d/CameraManager.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,27 +9,7 @@ var Class = require('../../utils/Class'); var GetFastValue = require('../../utils/object/GetFastValue'); var PluginCache = require('../../plugins/PluginCache'); var RectangleContains = require('../../geom/rectangle/Contains'); - -/** - * @typedef {object} InputJSONCameraObject - * - * @property {string} [name=''] - The name of the Camera. - * @property {integer} [x=0] - The horizontal position of the Camera viewport. - * @property {integer} [y=0] - The vertical position of the Camera viewport. - * @property {integer} [width] - The width of the Camera viewport. - * @property {integer} [height] - The height of the Camera viewport. - * @property {number} [zoom=1] - The default zoom level of the Camera. - * @property {number} [rotation=0] - The rotation of the Camera, in radians. - * @property {boolean} [roundPixels=false] - Should the Camera round pixels before rendering? - * @property {number} [scrollX=0] - The horizontal scroll position of the Camera. - * @property {number} [scrollY=0] - The vertical scroll position of the Camera. - * @property {(false|string)} [backgroundColor=false] - A CSS color string controlling the Camera background color. - * @property {?object} [bounds] - Defines the Camera bounds. - * @property {number} [bounds.x=0] - The top-left extent of the Camera bounds. - * @property {number} [bounds.y=0] - The top-left extent of the Camera bounds. - * @property {number} [bounds.width] - The width of the Camera bounds. - * @property {number} [bounds.height] - The height of the Camera bounds. - */ +var SceneEvents = require('../../scene/events'); /** * @classdesc @@ -134,17 +114,8 @@ var CameraManager = new Class({ */ this.main; - /** - * This scale affects all cameras. It's used by the Scale Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#baseScale - * @type {number} - * @since 3.0.0 - */ - this.baseScale = 1; - - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -153,6 +124,7 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#boot * @private + * @listens Phaser.Scenes.Events#DESTROY * @since 3.5.1 */ boot: function () @@ -172,7 +144,7 @@ var CameraManager = new Class({ this.main = this.cameras[0]; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -182,6 +154,8 @@ var CameraManager = new Class({ * * @method Phaser.Cameras.Scene2D.CameraManager#start * @private + * @listens Phaser.Scenes.Events#UPDATE + * @listens Phaser.Scenes.Events#SHUTDOWN * @since 3.5.0 */ start: function () @@ -206,8 +180,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -243,8 +217,8 @@ var CameraManager = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (makeMain === undefined) { makeMain = false; } if (name === undefined) { name = ''; } @@ -396,12 +370,12 @@ var CameraManager = new Class({ /** * Populates this Camera Manager based on the given configuration object, or an array of config objects. * - * See the `InputJSONCameraObject` documentation for details of the object structure. + * See the `Phaser.Cameras.Scene2D.Types.CameraConfig` documentation for details of the object structure. * * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON * @since 3.0.0 * - * @param {(InputJSONCameraObject|InputJSONCameraObject[])} config - A Camera configuration object, or an array of them, to be added to this Camera Manager. + * @param {(Phaser.Cameras.Scene2D.Types.CameraConfig|Phaser.Cameras.Scene2D.Types.CameraConfig[])} config - A Camera configuration object, or an array of them, to be added to this Camera Manager. * * @return {Phaser.Cameras.Scene2D.CameraManager} This Camera Manager instance. */ @@ -412,8 +386,8 @@ var CameraManager = new Class({ config = [ config ]; } - var gameWidth = this.scene.sys.game.config.width; - var gameHeight = this.scene.sys.game.config.height; + var gameWidth = this.scene.sys.scale.width; + var gameHeight = this.scene.sys.scale.height; for (var i = 0; i < config.length; i++) { @@ -598,8 +572,6 @@ var CameraManager = new Class({ { var scene = this.scene; var cameras = this.cameras; - var baseScale = this.baseScale; - var resolution = renderer.config.resolution; for (var i = 0; i < this.cameras.length; i++) { @@ -607,7 +579,8 @@ var CameraManager = new Class({ if (camera.visible && camera.alpha > 0) { - camera.preRender(baseScale, resolution); + // Hard-coded to 1 for now + camera.preRender(1); renderer.render(scene, children, interpolation, camera); } @@ -646,14 +619,14 @@ var CameraManager = new Class({ * @protected * @since 3.0.0 * - * @param {number} timestep - The timestep value. - * @param {number} delta - The delta value since the last frame. + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - update: function (timestep, delta) + update: function (time, delta) { for (var i = 0; i < this.cameras.length; i++) { - this.cameras[i].update(timestep, delta); + this.cameras[i].update(time, delta); } }, @@ -695,8 +668,8 @@ var CameraManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -711,7 +684,7 @@ var CameraManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/cameras/2d/effects/Fade.js b/src/cameras/2d/effects/Fade.js index e87c21c7e..bf0ce21fd 100644 --- a/src/cameras/2d/effects/Fade.js +++ b/src/cameras/2d/effects/Fade.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../../../math/Clamp'); var Class = require('../../../utils/Class'); +var Events = require('../events'); /** * @classdesc @@ -152,18 +153,11 @@ var Fade = new Class({ */ this._elapsed = 0; - /** - * @callback CameraFadeCallback - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. - * @param {number} progress - The progress of the effect. A value between 0 and 1. - */ - /** * This callback is invoked every frame for the duration of the effect. * * @name Phaser.Cameras.Scene2D.Effects.Fade#_onUpdate - * @type {?CameraFadeCallback} + * @type {?Phaser.Cameras.Scene2D.Types.CameraFadeCallback} * @private * @default null * @since 3.5.0 @@ -181,54 +175,12 @@ var Fade = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the fade in effect begins to run on a camera. - * - * @event CameraFadeInStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade out effect begins to run on a camera. - * - * @event CameraFadeOutStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the fade in effect completes. - * - * @event CameraFadeInCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - - /** - * This event is fired when the fade out effect completes. - * - * @event CameraFadeOutCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ - /** * Fades the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Fade#start - * @fires CameraFadeInStartEvent - * @fires CameraFadeInCompleteEvent - * @fires CameraFadeOutStartEvent - * @fires CameraFadeOutCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START * @since 3.5.0 * * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) @@ -237,7 +189,7 @@ var Fade = new Class({ * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * @param {Phaser.Cameras.Scene2D.Types.CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. * @@ -275,7 +227,7 @@ var Fade = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - var eventName = (direction) ? 'camerafadeoutstart' : 'camerafadeinstart'; + var eventName = (direction) ? Events.FADE_OUT_START : Events.FADE_IN_START; this.camera.emit(eventName, this.camera, this, duration, red, green, blue); @@ -378,6 +330,8 @@ var Fade = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Fade#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -388,7 +342,7 @@ var Fade = new Class({ this.isRunning = false; this.isComplete = true; - var eventName = (this.direction) ? 'camerafadeoutcomplete' : 'camerafadeincomplete'; + var eventName = (this.direction) ? Events.FADE_OUT_COMPLETE : Events.FADE_IN_COMPLETE; this.camera.emit(eventName, this.camera, this); }, diff --git a/src/cameras/2d/effects/Flash.js b/src/cameras/2d/effects/Flash.js index bc30d261d..20b4832e2 100644 --- a/src/cameras/2d/effects/Flash.js +++ b/src/cameras/2d/effects/Flash.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../../../math/Clamp'); var Class = require('../../../utils/Class'); +var Events = require('../events'); /** * @classdesc @@ -127,18 +128,11 @@ var Flash = new Class({ */ this._elapsed = 0; - /** - * @callback CameraFlashCallback - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. - * @param {number} progress - The progress of the effect. A value between 0 and 1. - */ - /** * This callback is invoked every frame for the duration of the effect. * * @name Phaser.Cameras.Scene2D.Effects.Flash#_onUpdate - * @type {?CameraFlashCallback} + * @type {?Phaser.Cameras.Scene2D.Types.CameraFlashCallback} * @private * @default null * @since 3.5.0 @@ -156,32 +150,12 @@ var Flash = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the flash effect begins to run on a camera. - * - * @event CameraFlashStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. - */ - - /** - * This event is fired when the flash effect completes. - * - * @event CameraFlashCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - */ - /** * Flashes the Camera to or from the given color over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Flash#start - * @fires CameraFlashStartEvent - * @fires CameraFlashCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 * * @param {integer} [duration=250] - The duration of the effect in milliseconds. @@ -189,7 +163,7 @@ var Flash = new Class({ * @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. * @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * @param {Phaser.Cameras.Scene2D.Types.CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. * @@ -224,7 +198,7 @@ var Flash = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('cameraflashstart', this.camera, this, duration, red, green, blue); + this.camera.emit(Events.FLASH_START, this.camera, this, duration, red, green, blue); return this.camera; }, @@ -325,6 +299,7 @@ var Flash = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Flash#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -334,7 +309,7 @@ var Flash = new Class({ this.isRunning = false; - this.camera.emit('cameraflashcomplete', this.camera, this); + this.camera.emit(Events.FLASH_COMPLETE, this.camera, this); }, /** diff --git a/src/cameras/2d/effects/Pan.js b/src/cameras/2d/effects/Pan.js index 655bd0ad9..47cd85ed3 100644 --- a/src/cameras/2d/effects/Pan.js +++ b/src/cameras/2d/effects/Pan.js @@ -1,13 +1,14 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../../../math/Clamp'); var Class = require('../../../utils/Class'); -var Vector2 = require('../../../math/Vector2'); var EaseMap = require('../../../math/easing/EaseMap'); +var Events = require('../events'); +var Vector2 = require('../../../math/Vector2'); /** * @classdesc @@ -122,20 +123,11 @@ var Pan = new Class({ */ this._elapsed = 0; - /** - * @callback CameraPanCallback - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. - * @param {number} progress - The progress of the effect. A value between 0 and 1. - * @param {number} x - The Camera's new scrollX coordinate. - * @param {number} y - The Camera's new scrollY coordinate. - */ - /** * This callback is invoked every frame for the duration of the effect. * * @name Phaser.Cameras.Scene2D.Effects.Pan#_onUpdate - * @type {?CameraPanCallback} + * @type {?Phaser.Cameras.Scene2D.Types.CameraPanCallback} * @private * @default null * @since 3.11.0 @@ -153,40 +145,21 @@ var Pan = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the pan effect begins to run on a camera. - * - * @event CameraPanStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} x - The destination scroll x coordinate. - * @param {number} y - The destination scroll y coordinate. - */ - - /** - * This event is fired when the pan effect completes. - * - * @event CameraPanCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - */ - /** * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, * over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Pan#start - * @fires CameraPanStartEvent - * @fires CameraPanCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. - * @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. + * @param {Phaser.Cameras.Scene2D.Types.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * the current camera scroll x coordinate and the current camera scroll y coordinate. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. @@ -236,7 +209,7 @@ var Pan = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerapanstart', this.camera, this, duration, x, y); + this.camera.emit(Events.PAN_START, this.camera, this, duration, x, y); return cam; }, @@ -298,6 +271,7 @@ var Pan = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Pan#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -307,7 +281,7 @@ var Pan = new Class({ this.isRunning = false; - this.camera.emit('camerapancomplete', this.camera, this); + this.camera.emit(Events.PAN_COMPLETE, this.camera, this); }, /** diff --git a/src/cameras/2d/effects/Shake.js b/src/cameras/2d/effects/Shake.js index 009064a47..bf981f675 100644 --- a/src/cameras/2d/effects/Shake.js +++ b/src/cameras/2d/effects/Shake.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../../../math/Clamp'); var Class = require('../../../utils/Class'); +var Events = require('../events'); var Vector2 = require('../../../math/Vector2'); /** @@ -117,18 +118,11 @@ var Shake = new Class({ */ this._offsetY = 0; - /** - * @callback CameraShakeCallback - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. - * @param {number} progress - The progress of the effect. A value between 0 and 1. - */ - /** * This callback is invoked every frame for the duration of the effect. * * @name Phaser.Cameras.Scene2D.Effects.Shake#_onUpdate - * @type {?CameraShakeCallback} + * @type {?Phaser.Cameras.Scene2D.Types.CameraShakeCallback} * @private * @default null * @since 3.5.0 @@ -146,36 +140,18 @@ var Shake = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the shake effect begins to run on a camera. - * - * @event CameraShakeStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} intensity - The intensity of the effect. - */ - - /** - * This event is fired when the shake effect completes. - * - * @event CameraShakeCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - */ - /** * Shakes the Camera by the given intensity over the duration specified. * * @method Phaser.Cameras.Scene2D.Effects.Shake#start - * @fires CameraShakeStartEvent - * @fires CameraShakeCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 * * @param {integer} [duration=100] - The duration of the effect in milliseconds. * @param {number} [intensity=0.05] - The intensity of the shake. * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. - * @param {CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * @param {Phaser.Cameras.Scene2D.Types.CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. * @@ -214,7 +190,7 @@ var Shake = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerashakestart', this.camera, this, duration, intensity); + this.camera.emit(Events.SHAKE_START, this.camera, this, duration, intensity); return this.camera; }, @@ -284,6 +260,7 @@ var Shake = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Shake#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 */ effectComplete: function () @@ -296,7 +273,7 @@ var Shake = new Class({ this.isRunning = false; - this.camera.emit('camerashakecomplete', this.camera, this); + this.camera.emit(Events.SHAKE_COMPLETE, this.camera, this); }, /** diff --git a/src/cameras/2d/effects/Zoom.js b/src/cameras/2d/effects/Zoom.js index 4ff38bfc5..2daaf3a55 100644 --- a/src/cameras/2d/effects/Zoom.js +++ b/src/cameras/2d/effects/Zoom.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../../../math/Clamp'); var Class = require('../../../utils/Class'); var EaseMap = require('../../../math/easing/EaseMap'); +var Events = require('../events'); /** * @classdesc @@ -108,19 +109,11 @@ var Zoom = new Class({ */ this._elapsed = 0; - /** - * @callback CameraZoomCallback - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. - * @param {number} progress - The progress of the effect. A value between 0 and 1. - * @param {number} zoom - The Camera's new zoom value. - */ - /** * This callback is invoked every frame for the duration of the effect. * * @name Phaser.Cameras.Scene2D.Effects.Zoom#_onUpdate - * @type {?CameraZoomCallback} + * @type {?Phaser.Cameras.Scene2D.Types.CameraZoomCallback} * @private * @default null * @since 3.11.0 @@ -138,37 +131,19 @@ var Zoom = new Class({ this._onUpdateScope; }, - /** - * This event is fired when the Zoom effect begins to run on a camera. - * - * @event CameraZoomStartEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {number} zoom - The destination zoom value. - */ - - /** - * This event is fired when the Zoom effect completes. - * - * @event CameraZoomCompleteEvent - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - */ - /** * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#start - * @fires CameraZoomStartEvent - * @fires CameraZoomCompleteEvent + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. * @param {integer} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. - * @param {CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. + * @param {Phaser.Cameras.Scene2D.Types.CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, * and the current camera zoom value. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. @@ -215,7 +190,7 @@ var Zoom = new Class({ this._onUpdate = callback; this._onUpdateScope = context; - this.camera.emit('camerazoomstart', this.camera, this, duration, zoom); + this.camera.emit(Events.ZOOM_START, this.camera, this, duration, zoom); return cam; }, @@ -266,6 +241,7 @@ var Zoom = new Class({ * Called internally when the effect completes. * * @method Phaser.Cameras.Scene2D.Effects.Zoom#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE * @since 3.11.0 */ effectComplete: function () @@ -275,7 +251,7 @@ var Zoom = new Class({ this.isRunning = false; - this.camera.emit('camerazoomcomplete', this.camera, this); + this.camera.emit(Events.ZOOM_COMPLETE, this.camera, this); }, /** diff --git a/src/cameras/2d/effects/index.js b/src/cameras/2d/effects/index.js index 749ddb241..5d43357af 100644 --- a/src/cameras/2d/effects/index.js +++ b/src/cameras/2d/effects/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/cameras/2d/events/DESTROY_EVENT.js b/src/cameras/2d/events/DESTROY_EVENT.js new file mode 100644 index 000000000..4e7ccef3b --- /dev/null +++ b/src/cameras/2d/events/DESTROY_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Destroy Camera Event. + * + * This event is dispatched by a Camera instance when it is destroyed by the Camera Manager. + * + * @event Phaser.Cameras.Scene2D.Events#DESTROY + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. + */ +module.exports = 'cameradestroy'; diff --git a/src/cameras/2d/events/FADE_IN_COMPLETE_EVENT.js b/src/cameras/2d/events/FADE_IN_COMPLETE_EVENT.js new file mode 100644 index 000000000..6c699eaa0 --- /dev/null +++ b/src/cameras/2d/events/FADE_IN_COMPLETE_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Complete Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeincomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeincomplete'; diff --git a/src/cameras/2d/events/FADE_IN_START_EVENT.js b/src/cameras/2d/events/FADE_IN_START_EVENT.js new file mode 100644 index 000000000..331056cc1 --- /dev/null +++ b/src/cameras/2d/events/FADE_IN_START_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade In Start Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeinstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeinstart'; diff --git a/src/cameras/2d/events/FADE_OUT_COMPLETE_EVENT.js b/src/cameras/2d/events/FADE_OUT_COMPLETE_EVENT.js new file mode 100644 index 000000000..df9f1d145 --- /dev/null +++ b/src/cameras/2d/events/FADE_OUT_COMPLETE_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Complete Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutcomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeoutcomplete'; diff --git a/src/cameras/2d/events/FADE_OUT_START_EVENT.js b/src/cameras/2d/events/FADE_OUT_START_EVENT.js new file mode 100644 index 000000000..290b93717 --- /dev/null +++ b/src/cameras/2d/events/FADE_OUT_START_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Fade Out Start Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'camerafadeoutstart'; diff --git a/src/cameras/2d/events/FLASH_COMPLETE_EVENT.js b/src/cameras/2d/events/FLASH_COMPLETE_EVENT.js new file mode 100644 index 000000000..dff2f2096 --- /dev/null +++ b/src/cameras/2d/events/FLASH_COMPLETE_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Complete Event. + * + * This event is dispatched by a Camera instance when the Flash Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + */ +module.exports = 'cameraflashcomplete'; diff --git a/src/cameras/2d/events/FLASH_START_EVENT.js b/src/cameras/2d/events/FLASH_START_EVENT.js new file mode 100644 index 000000000..5d0b8a7da --- /dev/null +++ b/src/cameras/2d/events/FLASH_START_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Flash Start Event. + * + * This event is dispatched by a Camera instance when the Flash Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_START + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {integer} red - The red color channel value. + * @param {integer} green - The green color channel value. + * @param {integer} blue - The blue color channel value. + */ +module.exports = 'cameraflashstart'; diff --git a/src/cameras/2d/events/PAN_COMPLETE_EVENT.js b/src/cameras/2d/events/PAN_COMPLETE_EVENT.js new file mode 100644 index 000000000..a8273d628 --- /dev/null +++ b/src/cameras/2d/events/PAN_COMPLETE_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Complete Event. + * + * This event is dispatched by a Camera instance when the Pan Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + */ +module.exports = 'camerapancomplete'; diff --git a/src/cameras/2d/events/PAN_START_EVENT.js b/src/cameras/2d/events/PAN_START_EVENT.js new file mode 100644 index 000000000..c1cf21472 --- /dev/null +++ b/src/cameras/2d/events/PAN_START_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pan Start Event. + * + * This event is dispatched by a Camera instance when the Pan Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#PAN_START + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} x - The destination scroll x coordinate. + * @param {number} y - The destination scroll y coordinate. + */ +module.exports = 'camerapanstart'; diff --git a/src/cameras/2d/events/POST_RENDER_EVENT.js b/src/cameras/2d/events/POST_RENDER_EVENT.js new file mode 100644 index 000000000..69abc8261 --- /dev/null +++ b/src/cameras/2d/events/POST_RENDER_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Post-Render Event. + * + * This event is dispatched by a Camera instance after is has finished rendering. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('postrender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#POST_RENDER + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that has finished rendering to a texture. + */ +module.exports = 'postrender'; diff --git a/src/cameras/2d/events/PRE_RENDER_EVENT.js b/src/cameras/2d/events/PRE_RENDER_EVENT.js new file mode 100644 index 000000000..a69314388 --- /dev/null +++ b/src/cameras/2d/events/PRE_RENDER_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Pre-Render Event. + * + * This event is dispatched by a Camera instance when it is about to render. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('prerender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#PRE_RENDER + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that is about to render to a texture. + */ +module.exports = 'prerender'; diff --git a/src/cameras/2d/events/SHAKE_COMPLETE_EVENT.js b/src/cameras/2d/events/SHAKE_COMPLETE_EVENT.js new file mode 100644 index 000000000..0c9475f06 --- /dev/null +++ b/src/cameras/2d/events/SHAKE_COMPLETE_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Complete Event. + * + * This event is dispatched by a Camera instance when the Shake Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + */ +module.exports = 'camerashakecomplete'; diff --git a/src/cameras/2d/events/SHAKE_START_EVENT.js b/src/cameras/2d/events/SHAKE_START_EVENT.js new file mode 100644 index 000000000..cf397624b --- /dev/null +++ b/src/cameras/2d/events/SHAKE_START_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Shake Start Event. + * + * This event is dispatched by a Camera instance when the Shake Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_START + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} intensity - The intensity of the effect. + */ +module.exports = 'camerashakestart'; diff --git a/src/cameras/2d/events/ZOOM_COMPLETE_EVENT.js b/src/cameras/2d/events/ZOOM_COMPLETE_EVENT.js new file mode 100644 index 000000000..a722e8dfd --- /dev/null +++ b/src/cameras/2d/events/ZOOM_COMPLETE_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Complete Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect completes. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + */ +module.exports = 'camerazoomcomplete'; diff --git a/src/cameras/2d/events/ZOOM_START_EVENT.js b/src/cameras/2d/events/ZOOM_START_EVENT.js new file mode 100644 index 000000000..3e6d0cad0 --- /dev/null +++ b/src/cameras/2d/events/ZOOM_START_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Camera Zoom Start Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect starts. + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_START + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + * @param {integer} duration - The duration of the effect. + * @param {number} zoom - The destination zoom value. + */ +module.exports = 'camerazoomstart'; diff --git a/src/cameras/2d/events/index.js b/src/cameras/2d/events/index.js new file mode 100644 index 000000000..991fd0eb7 --- /dev/null +++ b/src/cameras/2d/events/index.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ + +module.exports = { + + DESTROY: require('./DESTROY_EVENT'), + FADE_IN_COMPLETE: require('./FADE_IN_COMPLETE_EVENT'), + FADE_IN_START: require('./FADE_IN_START_EVENT'), + FADE_OUT_COMPLETE: require('./FADE_OUT_COMPLETE_EVENT'), + FADE_OUT_START: require('./FADE_OUT_START_EVENT'), + FLASH_COMPLETE: require('./FLASH_COMPLETE_EVENT'), + FLASH_START: require('./FLASH_START_EVENT'), + PAN_COMPLETE: require('./PAN_COMPLETE_EVENT'), + PAN_START: require('./PAN_START_EVENT'), + POST_RENDER: require('./POST_RENDER_EVENT'), + PRE_RENDER: require('./PRE_RENDER_EVENT'), + SHAKE_COMPLETE: require('./SHAKE_COMPLETE_EVENT'), + SHAKE_START: require('./SHAKE_START_EVENT'), + ZOOM_COMPLETE: require('./ZOOM_COMPLETE_EVENT'), + ZOOM_START: require('./ZOOM_START_EVENT') + +}; diff --git a/src/cameras/2d/index.js b/src/cameras/2d/index.js index 183da084c..00f618cd5 100644 --- a/src/cameras/2d/index.js +++ b/src/cameras/2d/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ module.exports = { Camera: require('./Camera'), CameraManager: require('./CameraManager'), - Effects: require('./effects') + Effects: require('./effects'), + Events: require('./events') }; diff --git a/src/cameras/2d/typedefs/CameraConfig.js b/src/cameras/2d/typedefs/CameraConfig.js new file mode 100644 index 000000000..ba14d7b0f --- /dev/null +++ b/src/cameras/2d/typedefs/CameraConfig.js @@ -0,0 +1,21 @@ +/** + * @typedef {object} Phaser.Cameras.Scene2D.Types.CameraConfig + * @since 3.0.0 + * + * @property {string} [name=''] - The name of the Camera. + * @property {integer} [x=0] - The horizontal position of the Camera viewport. + * @property {integer} [y=0] - The vertical position of the Camera viewport. + * @property {integer} [width] - The width of the Camera viewport. + * @property {integer} [height] - The height of the Camera viewport. + * @property {number} [zoom=1] - The default zoom level of the Camera. + * @property {number} [rotation=0] - The rotation of the Camera, in radians. + * @property {boolean} [roundPixels=false] - Should the Camera round pixels before rendering? + * @property {number} [scrollX=0] - The horizontal scroll position of the Camera. + * @property {number} [scrollY=0] - The vertical scroll position of the Camera. + * @property {(false|string)} [backgroundColor=false] - A CSS color string controlling the Camera background color. + * @property {?object} [bounds] - Defines the Camera bounds. + * @property {number} [bounds.x=0] - The top-left extent of the Camera bounds. + * @property {number} [bounds.y=0] - The top-left extent of the Camera bounds. + * @property {number} [bounds.width] - The width of the Camera bounds. + * @property {number} [bounds.height] - The height of the Camera bounds. + */ diff --git a/src/cameras/2d/typedefs/CameraFadeCallback.js b/src/cameras/2d/typedefs/CameraFadeCallback.js new file mode 100644 index 000000000..ccbc50ed8 --- /dev/null +++ b/src/cameras/2d/typedefs/CameraFadeCallback.js @@ -0,0 +1,7 @@ +/** + * @callback Phaser.Cameras.Scene2D.Types.CameraFadeCallback + * @since 3.5.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. + * @param {number} progress - The progress of the effect. A value between 0 and 1. + */ diff --git a/src/cameras/2d/typedefs/CameraFlashCallback.js b/src/cameras/2d/typedefs/CameraFlashCallback.js new file mode 100644 index 000000000..790610495 --- /dev/null +++ b/src/cameras/2d/typedefs/CameraFlashCallback.js @@ -0,0 +1,7 @@ +/** + * @callback Phaser.Cameras.Scene2D.Types.CameraFlashCallback + * @since 3.5.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. + * @param {number} progress - The progress of the effect. A value between 0 and 1. + */ diff --git a/src/cameras/2d/typedefs/CameraPanCallback.js b/src/cameras/2d/typedefs/CameraPanCallback.js new file mode 100644 index 000000000..8658dacc8 --- /dev/null +++ b/src/cameras/2d/typedefs/CameraPanCallback.js @@ -0,0 +1,9 @@ +/** + * @callback Phaser.Cameras.Scene2D.Types.CameraPanCallback + * @since 3.5.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. + * @param {number} progress - The progress of the effect. A value between 0 and 1. + * @param {number} x - The Camera's new scrollX coordinate. + * @param {number} y - The Camera's new scrollY coordinate. + */ diff --git a/src/cameras/2d/typedefs/CameraShakeCallback.js b/src/cameras/2d/typedefs/CameraShakeCallback.js new file mode 100644 index 000000000..5da0aa28f --- /dev/null +++ b/src/cameras/2d/typedefs/CameraShakeCallback.js @@ -0,0 +1,7 @@ +/** + * @callback Phaser.Cameras.Scene2D.Types.CameraShakeCallback + * @since 3.5.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. + * @param {number} progress - The progress of the effect. A value between 0 and 1. + */ diff --git a/src/cameras/2d/typedefs/CameraZoomCallback.js b/src/cameras/2d/typedefs/CameraZoomCallback.js new file mode 100644 index 000000000..5393bb139 --- /dev/null +++ b/src/cameras/2d/typedefs/CameraZoomCallback.js @@ -0,0 +1,8 @@ +/** + * @callback Phaser.Cameras.Scene2D.Types.CameraZoomCallback + * @since 3.11.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. + * @param {number} progress - The progress of the effect. A value between 0 and 1. + * @param {number} zoom - The Camera's new zoom value. + */ diff --git a/src/cameras/2d/typedefs/JSONCamera.js b/src/cameras/2d/typedefs/JSONCamera.js new file mode 100644 index 000000000..8eb43e440 --- /dev/null +++ b/src/cameras/2d/typedefs/JSONCamera.js @@ -0,0 +1,17 @@ +/** + * @typedef {object} Phaser.Cameras.Scene2D.Types.JSONCamera + * @since 3.0.0 + * + * @property {string} name - The name of the camera + * @property {number} x - The horizontal position of camera + * @property {number} y - The vertical position of camera + * @property {number} width - The width size of camera + * @property {number} height - The height size of camera + * @property {number} zoom - The zoom of camera + * @property {number} rotation - The rotation of camera + * @property {boolean} roundPixels - The round pixels st status of camera + * @property {number} scrollX - The horizontal scroll of camera + * @property {number} scrollY - The vertical scroll of camera + * @property {string} backgroundColor - The background color of camera + * @property {(Phaser.Cameras.Scene2D.Types.JSONCameraBounds|undefined)} [bounds] - The bounds of camera + */ diff --git a/src/cameras/2d/typedefs/JSONCameraBounds.js b/src/cameras/2d/typedefs/JSONCameraBounds.js new file mode 100644 index 000000000..1c598c704 --- /dev/null +++ b/src/cameras/2d/typedefs/JSONCameraBounds.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Cameras.Scene2D.Types.JSONCameraBounds + * @since 3.0.0 + * + * @property {number} x - The horizontal position of camera + * @property {number} y - The vertical position of camera + * @property {number} width - The width size of camera + * @property {number} height - The height size of camera + */ diff --git a/src/cameras/2d/typedefs/index.js b/src/cameras/2d/typedefs/index.js new file mode 100644 index 000000000..e204e8c19 --- /dev/null +++ b/src/cameras/2d/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Types + */ diff --git a/src/cameras/controls/FixedKeyControl.js b/src/cameras/controls/FixedKeyControl.js index 9fc25858a..fbcc6b7c9 100644 --- a/src/cameras/controls/FixedKeyControl.js +++ b/src/cameras/controls/FixedKeyControl.js @@ -1,26 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var GetValue = require('../../utils/object/GetValue'); -/** - * @typedef {object} FixedKeyControlConfig - * - * @property {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera that this Control will update. - * @property {Phaser.Input.Keyboard.Key} [left] - The Key to be pressed that will move the Camera left. - * @property {Phaser.Input.Keyboard.Key} [right] - The Key to be pressed that will move the Camera right. - * @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up. - * @property {Phaser.Input.Keyboard.Key} [down] - The Key to be pressed that will move the Camera down. - * @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in. - * @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out. - * @property {number} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * @property {(number|{x:number,y:number})} [speed=0] - The horizontal and vertical speed the camera will move. - */ - /** * @classdesc * A Fixed Key Camera Control. @@ -45,7 +31,7 @@ var GetValue = require('../../utils/object/GetValue'); * @constructor * @since 3.0.0 * - * @param {FixedKeyControlConfig} config - The Fixed Key Control configuration object. + * @param {Phaser.Cameras.Controls.Types.FixedKeyControlConfig} config - The Fixed Key Control configuration object. */ var FixedKeyControl = new Class({ diff --git a/src/cameras/controls/SmoothedKeyControl.js b/src/cameras/controls/SmoothedKeyControl.js index 3a0115777..0c694c4c4 100644 --- a/src/cameras/controls/SmoothedKeyControl.js +++ b/src/cameras/controls/SmoothedKeyControl.js @@ -1,27 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var GetValue = require('../../utils/object/GetValue'); -/** - * @typedef {object} SmoothedKeyControlConfig - * - * @property {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera that this Control will update. - * @property {Phaser.Input.Keyboard.Key} [left] - The Key to be pressed that will move the Camera left. - * @property {Phaser.Input.Keyboard.Key} [right] - The Key to be pressed that will move the Camera right. - * @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up. - * @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in. - * @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out. - * @property {number} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * @property {(number|{x:number,y:number})} [acceleration=0] - The horizontal and vertical acceleration the camera will move. - * @property {(number|{x:number,y:number})} [drag=0] - The horizontal and vertical drag applied to the camera when it is moving. - * @property {(number|{x:number,y:number})} [maxSpeed=0] - The maximum horizontal and vertical speed the camera will move. - */ - /** * @classdesc * A Smoothed Key Camera Control. @@ -30,7 +15,6 @@ var GetValue = require('../../utils/object/GetValue'); * Unlike the Fixed Camera Control you can also provide physics values for acceleration, drag and maxSpeed for smoothing effects. * * ```javascript - * * var controlConfig = { * camera: this.cameras.main, * left: cursors.left, @@ -53,7 +37,7 @@ var GetValue = require('../../utils/object/GetValue'); * @constructor * @since 3.0.0 * - * @param {SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. + * @param {Phaser.Cameras.Controls.Types.SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. */ var SmoothedKeyControl = new Class({ diff --git a/src/cameras/controls/index.js b/src/cameras/controls/index.js index 81217c624..cbe03e116 100644 --- a/src/cameras/controls/index.js +++ b/src/cameras/controls/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/cameras/controls/typedefs/FixedKeyControlConfig.js b/src/cameras/controls/typedefs/FixedKeyControlConfig.js new file mode 100644 index 000000000..238758c77 --- /dev/null +++ b/src/cameras/controls/typedefs/FixedKeyControlConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Cameras.Controls.Types.FixedKeyControlConfig + * @since 3.0.0 + * + * @property {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera that this Control will update. + * @property {Phaser.Input.Keyboard.Key} [left] - The Key to be pressed that will move the Camera left. + * @property {Phaser.Input.Keyboard.Key} [right] - The Key to be pressed that will move the Camera right. + * @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up. + * @property {Phaser.Input.Keyboard.Key} [down] - The Key to be pressed that will move the Camera down. + * @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in. + * @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out. + * @property {number} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * @property {(number|{x:number,y:number})} [speed=0] - The horizontal and vertical speed the camera will move. + */ diff --git a/src/cameras/controls/typedefs/SmoothedKeyControlConfig.js b/src/cameras/controls/typedefs/SmoothedKeyControlConfig.js new file mode 100644 index 000000000..a5a5c9f8a --- /dev/null +++ b/src/cameras/controls/typedefs/SmoothedKeyControlConfig.js @@ -0,0 +1,15 @@ +/** + * @typedef {object} Phaser.Cameras.Controls.Types.SmoothedKeyControlConfig + * @since 3.0.0 + * + * @property {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera that this Control will update. + * @property {Phaser.Input.Keyboard.Key} [left] - The Key to be pressed that will move the Camera left. + * @property {Phaser.Input.Keyboard.Key} [right] - The Key to be pressed that will move the Camera right. + * @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up. + * @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in. + * @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out. + * @property {number} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * @property {(number|{x:number,y:number})} [acceleration=0] - The horizontal and vertical acceleration the camera will move. + * @property {(number|{x:number,y:number})} [drag=0] - The horizontal and vertical drag applied to the camera when it is moving. + * @property {(number|{x:number,y:number})} [maxSpeed=0] - The maximum horizontal and vertical speed the camera will move. + */ diff --git a/src/cameras/controls/typedefs/index.js b/src/cameras/controls/typedefs/index.js new file mode 100644 index 000000000..9e7f641d9 --- /dev/null +++ b/src/cameras/controls/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Controls.Types + */ diff --git a/src/cameras/index.js b/src/cameras/index.js index 31f161f3a..efc41ef42 100644 --- a/src/cameras/index.js +++ b/src/cameras/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/const.js b/src/const.js index c2060cd7c..a481ea353 100644 --- a/src/const.js +++ b/src/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,11 +16,11 @@ var CONST = { * Phaser Release Version * * @name Phaser.VERSION - * @readonly + * @const * @type {string} * @since 3.0.0 */ - VERSION: '3.16.0 Beta 4', + VERSION: '3.17.0', BlendModes: require('./renderer/BlendModes'), @@ -30,7 +30,7 @@ var CONST = { * AUTO Detect Renderer. * * @name Phaser.AUTO - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -40,7 +40,7 @@ var CONST = { * Canvas Renderer. * * @name Phaser.CANVAS - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -50,7 +50,7 @@ var CONST = { * WebGL Renderer. * * @name Phaser.WEBGL - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -60,7 +60,7 @@ var CONST = { * Headless Renderer. * * @name Phaser.HEADLESS - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -71,7 +71,7 @@ var CONST = { * to help you remember what the value is doing in your code. * * @name Phaser.FOREVER - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -81,7 +81,7 @@ var CONST = { * Direction constant. * * @name Phaser.NONE - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -91,7 +91,7 @@ var CONST = { * Direction constant. * * @name Phaser.UP - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -101,7 +101,7 @@ var CONST = { * Direction constant. * * @name Phaser.DOWN - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -111,7 +111,7 @@ var CONST = { * Direction constant. * * @name Phaser.LEFT - * @readonly + * @const * @type {integer} * @since 3.0.0 */ @@ -121,7 +121,7 @@ var CONST = { * Direction constant. * * @name Phaser.RIGHT - * @readonly + * @const * @type {integer} * @since 3.0.0 */ diff --git a/src/core/Config.js b/src/core/Config.js new file mode 100644 index 000000000..db84b34b3 --- /dev/null +++ b/src/core/Config.js @@ -0,0 +1,560 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = require('../utils/Class'); +var CONST = require('../const'); +var Device = require('../device'); +var GetFastValue = require('../utils/object/GetFastValue'); +var GetValue = require('../utils/object/GetValue'); +var IsPlainObject = require('../utils/object/IsPlainObject'); +var PhaserMath = require('../math/'); +var NOOP = require('../utils/NOOP'); +var DefaultPlugins = require('../plugins/DefaultPlugins'); +var ValueToColor = require('../display/color/ValueToColor'); + +/** + * @classdesc + * The active game configuration settings, parsed from a {@link GameConfig} object. + * + * @class Config + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Core.Types.GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * + * @see Phaser.Game#config + */ +var Config = new Class({ + + initialize: + + function Config (config) + { + if (config === undefined) { config = {}; } + + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; + + var defaultBannerTextColor = '#ffffff'; + + /** + * @const {(integer|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + */ + this.width = GetValue(config, 'width', 1024); + + /** + * @const {(integer|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + */ + this.height = GetValue(config, 'height', 768); + + /** + * @const {(Phaser.Scale.ZoomType|integer)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + */ + this.zoom = GetValue(config, 'zoom', 1); + + /** + * @const {number} Phaser.Core.Config#resolution - The canvas device pixel resolution. Currently un-used. + */ + this.resolution = GetValue(config, 'resolution', 1); + + /** + * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. + */ + this.parent = GetValue(config, 'parent', undefined); + + /** + * @const {Phaser.Scale.ScaleModeType} Phaser.Core.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. + */ + this.scaleMode = GetValue(config, 'scaleMode', 0); + + /** + * @const {boolean} Phaser.Core.Config#expandParent - Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%? + */ + this.expandParent = GetValue(config, 'expandParent', true); + + /** + * @const {integer} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + */ + this.autoRound = GetValue(config, 'autoRound', false); + + /** + * @const {Phaser.Scale.CenterType} Phaser.Core.Config#autoCenter - Automatically center the canvas within the parent? + */ + this.autoCenter = GetValue(config, 'autoCenter', 0); + + /** + * @const {integer} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + */ + this.resizeInterval = GetValue(config, 'resizeInterval', 500); + + /** + * @const {?(HTMLElement|string)} Phaser.Core.Config#fullscreenTarget - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); + + /** + * @const {integer} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minWidth = GetValue(config, 'minWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxWidth = GetValue(config, 'maxWidth', 0); + + /** + * @const {integer} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minHeight = GetValue(config, 'minHeight', 0); + + /** + * @const {integer} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxHeight = GetValue(config, 'maxHeight', 0); + + // Scale Manager - Anything set in here over-rides anything set above + + var scaleConfig = GetValue(config, 'scale', null); + + if (scaleConfig) + { + this.width = GetValue(scaleConfig, 'width', this.width); + this.height = GetValue(scaleConfig, 'height', this.height); + this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); + this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); + this.parent = GetValue(scaleConfig, 'parent', this.parent); + this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); + this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); + this.autoRound = GetValue(scaleConfig, 'autoRound', this.autoRound); + this.autoCenter = GetValue(scaleConfig, 'autoCenter', this.autoCenter); + this.resizeInterval = GetValue(scaleConfig, 'resizeInterval', this.resizeInterval); + this.fullscreenTarget = GetValue(scaleConfig, 'fullscreenTarget', this.fullscreenTarget); + this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); + this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); + this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); + this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); + } + + /** + * @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) + */ + this.renderType = GetValue(config, 'type', CONST.AUTO); + + /** + * @const {?HTMLCanvasElement} Phaser.Core.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. + */ + this.canvas = GetValue(config, 'canvas', null); + + /** + * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Core.Config#context - Force Phaser to use your own Canvas context instead of creating one. + */ + this.context = GetValue(config, 'context', null); + + /** + * @const {?string} Phaser.Core.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. + */ + this.canvasStyle = GetValue(config, 'canvasStyle', null); + + /** + * @const {boolean} Phaser.Core.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. + */ + this.customEnvironment = GetValue(config, 'customEnvironment', false); + + /** + * @const {?object} Phaser.Core.Config#sceneConfig - The default Scene configuration object. + */ + this.sceneConfig = GetValue(config, 'scene', null); + + /** + * @const {string[]} Phaser.Core.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. + */ + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + + PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); + + /** + * @const {string} Phaser.Core.Config#gameTitle - The title of the game. + */ + this.gameTitle = GetValue(config, 'title', ''); + + /** + * @const {string} Phaser.Core.Config#gameURL - The URL of the game. + */ + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); + + /** + * @const {string} Phaser.Core.Config#gameVersion - The version of the game. + */ + this.gameVersion = GetValue(config, 'version', ''); + + /** + * @const {boolean} Phaser.Core.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. + */ + this.autoFocus = GetValue(config, 'autoFocus', true); + + // DOM Element Container + + /** + * @const {?boolean} Phaser.Core.Config#domCreateContainer - EXPERIMENTAL: Do not currently use. + */ + this.domCreateContainer = GetValue(config, 'dom.createContainer', false); + + /** + * @const {?boolean} Phaser.Core.Config#domBehindCanvas - EXPERIMENTAL: Do not currently use. + */ + this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); + + // Input + + /** + * @const {boolean} Phaser.Core.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. + */ + this.inputKeyboard = GetValue(config, 'input.keyboard', true); + + /** + * @const {*} Phaser.Core.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. + */ + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + + /** + * @const {?integer[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + */ + this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); + + /** + * @const {(boolean|object)} Phaser.Core.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. + */ + this.inputMouse = GetValue(config, 'input.mouse', true); + + /** + * @const {?*} Phaser.Core.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. + */ + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. + */ + this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + + /** + * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. + */ + this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); + + /** + * @const {?*} Phaser.Core.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. + */ + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + + /** + * @const {boolean} Phaser.Core.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. + */ + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + + /** + * @const {integer} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + */ + this.inputActivePointers = GetValue(config, 'input.activePointers', 1); + + /** + * @const {integer} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + */ + this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); + + /** + * @const {boolean} Phaser.Core.Config#inputQueue - Should Phaser use a queued input system for native DOM Events or not? + */ + this.inputQueue = GetValue(config, 'input.queue', false); + + /** + * @const {boolean} Phaser.Core.Config#inputWindowEvents - Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire. + */ + this.inputWindowEvents = GetValue(config, 'input.windowEvents', true); + + /** + * @const {boolean} Phaser.Core.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. + */ + this.inputGamepad = GetValue(config, 'input.gamepad', false); + + /** + * @const {*} Phaser.Core.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. + */ + this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); + + /** + * @const {boolean} Phaser.Core.Config#disableContextMenu - Set to `true` to disable the right-click context menu. + */ + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + + /** + * @const {Phaser.Core.Types.AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. + */ + this.audio = GetValue(config, 'audio'); + + // If you do: { banner: false } it won't display any banner at all + + /** + * @const {boolean} Phaser.Core.Config#hideBanner - Don't write the banner line to the console.log. + */ + this.hideBanner = (GetValue(config, 'banner', null) === false); + + /** + * @const {boolean} Phaser.Core.Config#hidePhaser - Omit Phaser's name and version from the banner. + */ + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + + /** + * @const {string} Phaser.Core.Config#bannerTextColor - The color of the banner text. + */ + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + + /** + * @const {string[]} Phaser.Core.Config#bannerBackgroundColor - The background colors of the banner. + */ + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } + + /** + * @const {?Phaser.Core.Types.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + */ + this.fps = GetValue(config, 'fps', null); + + // Renderer Settings + // These can either be in a `render` object within the Config, or specified on their own + + var renderConfig = GetValue(config, 'render', config); + + /** + * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + */ + this.antialias = GetValue(renderConfig, 'antialias', true); + + /** + * @const {boolean} Phaser.Core.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + */ + this.roundPixels = GetValue(renderConfig, 'roundPixels', false); + + /** + * @const {boolean} Phaser.Core.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). + */ + this.pixelArt = GetValue(renderConfig, 'pixelArt', this.zoom !== 1); + + if (this.pixelArt) + { + this.antialias = false; + this.roundPixels = true; + } + + /** + * @const {boolean} Phaser.Core.Config#transparent - Whether the game canvas will have a transparent background. + */ + this.transparent = GetValue(renderConfig, 'transparent', false); + + /** + * @const {boolean} Phaser.Core.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. + */ + this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); + + /** + * @const {boolean} Phaser.Core.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. + */ + this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); + + /** + * @const {boolean} Phaser.Core.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + */ + this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); + + /** + * @const {string} Phaser.Core.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + */ + this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); + + /** + * @const {integer} Phaser.Core.Config#batchSize - The default WebGL Batch size. + */ + this.batchSize = GetValue(renderConfig, 'batchSize', 2000); + + /** + * @const {integer} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + this.maxLights = GetValue(renderConfig, 'maxLights', 10); + + var bgc = GetValue(config, 'backgroundColor', 0); + + /** + * @const {Phaser.Display.Color} Phaser.Core.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. + */ + this.backgroundColor = ValueToColor(bgc); + + if (bgc === 0 && this.transparent) + { + this.backgroundColor.alpha = 0; + } + + /** + * @const {Phaser.Core.Types.BootCallback} Phaser.Core.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. + */ + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); + + /** + * @const {Phaser.Core.Types.BootCallback} Phaser.Core.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + + /** + * @const {Phaser.Core.Types.PhysicsConfig} Phaser.Core.Config#physics - The Physics Configuration object. + */ + this.physics = GetValue(config, 'physics', {}); + + /** + * @const {(boolean|string)} Phaser.Core.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. + */ + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + + /** + * @const {string} Phaser.Core.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + */ + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + */ + this.loaderPath = GetValue(config, 'loader.path', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + */ + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); + + /** + * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + */ + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + + /** + * @const {string} Phaser.Core.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. + */ + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + + /** + * @const {boolean} Phaser.Core.Config#loaderAsync - Should the XHR request use async or not? + */ + this.loaderAsync = GetValue(config, 'loader.async', true); + + /** + * @const {string} Phaser.Core.Config#loaderUser - Optional username for all XHR requests. + */ + this.loaderUser = GetValue(config, 'loader.user', ''); + + /** + * @const {string} Phaser.Core.Config#loaderPassword - Optional password for all XHR requests. + */ + this.loaderPassword = GetValue(config, 'loader.password', ''); + + /** + * @const {integer} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + */ + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + + /* + * Allows `plugins` property to either be an array, in which case it just replaces + * the default plugins like previously, or a config object. + * + * plugins: { + * global: [ + * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, + * ], + * scene: [ + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + * ], + * default: [], OR + * defaultMerge: [ + * 'ModPlayer' + * ] + * } + */ + + /** + * @const {any} Phaser.Core.Config#installGlobalPlugins - An array of global plugins to be installed. + */ + this.installGlobalPlugins = []; + + /** + * @const {any} Phaser.Core.Config#installScenePlugins - An array of Scene level plugins to be installed. + */ + this.installScenePlugins = []; + + var plugins = GetValue(config, 'plugins', null); + var defaultPlugins = DefaultPlugins.DefaultScene; + + if (plugins) + { + // Old 3.7 array format? + if (Array.isArray(plugins)) + { + this.defaultPlugins = plugins; + } + else if (IsPlainObject(plugins)) + { + this.installGlobalPlugins = GetFastValue(plugins, 'global', []); + this.installScenePlugins = GetFastValue(plugins, 'scene', []); + + if (Array.isArray(plugins.default)) + { + defaultPlugins = plugins.default; + } + else if (Array.isArray(plugins.defaultMerge)) + { + defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); + } + } + } + + /** + * @const {any} Phaser.Core.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). + */ + this.defaultPlugins = defaultPlugins; + + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + + /** + * @const {string} Phaser.Core.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. + */ + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + + /** + * @const {string} Phaser.Core.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. + */ + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + + if (window) + { + if (window.FORCE_WEBGL) + { + this.renderType = CONST.WEBGL; + } + else if (window.FORCE_CANVAS) + { + this.renderType = CONST.CANVAS; + } + } + } + +}); + +module.exports = Config; diff --git a/src/boot/CreateRenderer.js b/src/core/CreateRenderer.js similarity index 91% rename from src/boot/CreateRenderer.js rename to src/core/CreateRenderer.js index 76c37eb82..c46931930 100644 --- a/src/boot/CreateRenderer.js +++ b/src/core/CreateRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,7 +14,7 @@ var Features = require('../device/Features'); * * 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 + * @function Phaser.Core.CreateRenderer * @since 3.0.0 * * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. @@ -56,17 +56,22 @@ var CreateRenderer = function (game) CanvasPool.disableSmoothing(); } + var baseSize = game.scale.baseSize; + + var width = baseSize.width; + var height = baseSize.height; + // Does the game config provide its own canvas element to use? if (config.canvas) { game.canvas = config.canvas; - game.canvas.width = game.scale.canvasWidth; - game.canvas.height = game.scale.canvasHeight; + game.canvas.width = width; + game.canvas.height = height; } else { - game.canvas = CanvasPool.create(game, game.scale.canvasWidth, game.scale.canvasHeight, config.renderType); + game.canvas = CanvasPool.create(game, width, height, config.renderType); } // Does the game config provide some canvas css styles to use? diff --git a/src/boot/DebugHeader.js b/src/core/DebugHeader.js similarity index 97% rename from src/boot/DebugHeader.js rename to src/core/DebugHeader.js index cd3cc37fb..eafc9ad2f 100644 --- a/src/boot/DebugHeader.js +++ b/src/core/DebugHeader.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,7 +11,7 @@ var CONST = require('../const'); * * You can customize or disable the header via the Game Config object. * - * @function Phaser.Boot.DebugHeader + * @function Phaser.Core.DebugHeader * @since 3.0.0 * * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. diff --git a/src/boot/Game.js b/src/core/Game.js similarity index 74% rename from src/boot/Game.js rename to src/core/Game.js index a286c8d65..bbd5d7293 100644 --- a/src/boot/Game.js +++ b/src/core/Game.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,19 +16,21 @@ var DebugHeader = require('./DebugHeader'); var Device = require('../device'); var DOMContentLoaded = require('../dom/DOMContentLoaded'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var InputManager = require('../input/InputManager'); var PluginCache = require('../plugins/PluginCache'); var PluginManager = require('../plugins/PluginManager'); -var ScaleManager = require('../dom/ScaleManager'); +var ScaleManager = require('../scale/ScaleManager'); var SceneManager = require('../scene/SceneManager'); var SoundManagerCreator = require('../sound/SoundManagerCreator'); +var TextureEvents = require('../textures/events'); var TextureManager = require('../textures/TextureManager'); var TimeStep = require('./TimeStep'); var VisibilityHandler = require('./VisibilityHandler'); if (typeof EXPERIMENTAL) { - var CreateDOMContainer = require('./CreateDOMContainer'); + var CreateDOMContainer = require('../dom/CreateDOMContainer'); } if (typeof PLUGIN_FBINSTANT) @@ -49,9 +51,13 @@ if (typeof PLUGIN_FBINSTANT) * @class Game * @memberof Phaser * @constructor + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE * @since 3.0.0 * - * @param {GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * @param {Phaser.Core.Types.GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. */ var Game = new Class({ @@ -65,7 +71,7 @@ var Game = new Class({ * 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} + * @type {Phaser.Core.Config} * @readonly * @since 3.0.0 */ @@ -229,11 +235,11 @@ var Game = new Class({ /** * An instance of the Scale Manager. * - * The Scale Manager is a global system responsible for handling game scaling events. + * The Scale Manager is a global system responsible for handling scaling of the game canvas. * * @name Phaser.Game#scale - * @type {Phaser.Boot.ScaleManager} - * @since 3.15.0 + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 */ this.scale = new ScaleManager(this, this.config); @@ -255,7 +261,7 @@ var Game = new Class({ * them and calculating delta values. It then automatically calls the game step. * * @name Phaser.Game#loop - * @type {Phaser.Boot.TimeStep} + * @type {Phaser.Core.TimeStep} * @since 3.0.0 */ this.loop = new TimeStep(this, this.config.fps); @@ -333,15 +339,6 @@ var Game = new Class({ DOMContentLoaded(this.boot.bind(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. @@ -349,7 +346,8 @@ var Game = new Class({ * * @method Phaser.Game#boot * @protected - * @fires Phaser.Game#boot + * @fires Phaser.Core.Events#BOOT + * @listens Phaser.Textures.Events#READY * @since 3.0.0 */ boot: function () @@ -377,11 +375,11 @@ var Game = new Class({ 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 internal event when done: - this.events.once('texturesready', this.texturesReady, this); + this.textures.once(TextureEvents.READY, this.texturesReady, this); + + this.events.emit(Events.BOOT); }, /** @@ -396,7 +394,7 @@ var Game = new Class({ texturesReady: function () { // Start all the other systems - this.events.emit('ready'); + this.events.emit(Events.READY); this.start(); }, @@ -429,77 +427,12 @@ var Game = new Class({ var eventEmitter = this.events; - eventEmitter.on('hidden', this.onHidden, this); - eventEmitter.on('visible', this.onVisible, this); - eventEmitter.on('blur', this.onBlur, this); - eventEmitter.on('focus', this.onFocus, this); + eventEmitter.on(Events.HIDDEN, this.onHidden, this); + eventEmitter.on(Events.VISIBLE, this.onVisible, this); + eventEmitter.on(Events.BLUR, this.onBlur, this); + eventEmitter.on(Events.FOCUS, this.onFocus, this); }, - /** - * Game Pre-Step event. - * - * Listen for it using the event type `prestep`. - * - * This event is dispatched before the main Step starts. - * By this point none of the Scene updates have happened. - * Hook into it from plugins or systems that need to update before the Scene Manager does. - * - * @event Phaser.Game#prestepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Step event. - * - * Listen for it using the event type `step`. - * - * This event is dispatched after Pre-Step and before the Scene Manager steps. - * Hook into it from plugins or systems that need to update before the Scene Manager does, but after core Systems. - * - * @event Phaser.Game#stepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Post-Step event. - * - * Listen for it using the event type `poststep`. - * - * This event is dispatched after the Scene Manager has updated. - * Hook into it from plugins or systems that need to do things before the render starts. - * - * @event Phaser.Game#poststepEvent - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - - /** - * Game Pre-Render event. - * - * Listen for it using the event type `prerender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - - /** - * Game Post-Render event. - * - * Listen for it using the event type `postrender`. - * - * 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.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer. - */ - /** * 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.) @@ -509,11 +442,11 @@ var Game = new Class({ * 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#prestepEvent - * @fires Phaser.Game#stepEvent - * @fires Phaser.Game#poststepEvent - * @fires Phaser.Game#prerenderEvent - * @fires Phaser.Game#postrenderEvent + * @fires Phaser.Core.Events#PRE_STEP_EVENT + * @fires Phaser.Core.Events#STEP_EVENT + * @fires Phaser.Core.Events#POST_STEP_EVENT + * @fires Phaser.Core.Events#PRE_RENDER_EVENT + * @fires Phaser.Core.Events#POST_RENDER_EVENT * @since 3.0.0 * * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. @@ -530,11 +463,11 @@ var Game = new Class({ // Global Managers like Input and Sound update in the prestep - eventEmitter.emit('prestep', time, delta); + eventEmitter.emit(Events.PRE_STEP, time, delta); // This is mostly meant for user-land code and plugins - eventEmitter.emit('step', time, delta); + eventEmitter.emit(Events.STEP, time, delta); // Update the Scene Manager and all active Scenes @@ -542,7 +475,7 @@ var Game = new Class({ // Our final event before rendering starts - eventEmitter.emit('poststep', time, delta); + eventEmitter.emit(Events.POST_STEP, time, delta); var renderer = this.renderer; @@ -550,7 +483,7 @@ var Game = new Class({ renderer.preRender(); - eventEmitter.emit('prerender', renderer, time, delta); + eventEmitter.emit(Events.PRE_RENDER, renderer, time, delta); // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. @@ -562,7 +495,7 @@ var Game = new Class({ // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. - eventEmitter.emit('postrender', renderer, time, delta); + eventEmitter.emit(Events.POST_RENDER, renderer, time, delta); }, /** @@ -589,73 +522,53 @@ var Game = new Class({ // Global Managers - eventEmitter.emit('prestep', time, delta); + eventEmitter.emit(Events.PRE_STEP, time, delta); - eventEmitter.emit('step', time, delta); + eventEmitter.emit(Events.STEP, time, delta); // Scenes this.scene.update(time, delta); - eventEmitter.emit('poststep', time, delta); + eventEmitter.emit(Events.POST_STEP, time, delta); // Render - eventEmitter.emit('prerender'); + eventEmitter.emit(Events.PRE_RENDER); - eventEmitter.emit('postrender'); + eventEmitter.emit(Events.POST_RENDER); }, - /** - * Game Pause event. - * - * Listen for it using the event type `pause`. - * - * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. - * - * @event Phaser.Game#pauseEvent - */ - /** * 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 + * @fires Phaser.Core.Events#PAUSE * @since 3.0.0 */ onHidden: function () { this.loop.pause(); - this.events.emit('pause'); + this.events.emit(Events.PAUSE); }, - /** - * Game Resume event. - * - * Listen for it using the event type `resume`. - * - * 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.Game#onVisible * @protected - * @fires Phaser.Game#resumeEvent + * @fires Phaser.Core.Events#RESUME * @since 3.0.0 */ onVisible: function () { this.loop.resume(); - this.events.emit('resume'); + this.events.emit(Events.RESUME); }, /** @@ -688,50 +601,6 @@ var Game = new Class({ this.loop.focus(); }, - /** - * Game Resize event. - * - * Listen for it using the event type `resize`. - * - * @event Phaser.Game#resizeEvent - * @param {number} width - The new width of the Game. - * @param {number} height - The new height of the Game. - */ - - /** - * Updates the Game Config with the new width and height values given. - * Then resizes the Renderer and Input Manager scale. - * - * @method Phaser.Game#resize - * @fires Phaser.Game#resizeEvent - * @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; - - if (typeof EXPERIMENTAL) - { - if (this.domContainer) - { - this.domContainer.style.width = width + 'px'; - this.domContainer.style.height = height + 'px'; - } - } - - this.renderer.resize(width, height); - - this.input.resize(); - - this.scene.resize(width, height); - - this.events.emit('resize', width, height); - }, - /** * Returns the current game frame. * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. @@ -760,14 +629,6 @@ var Game = new Class({ return this.loop.frame.time; }, - /** - * Game Destroy event. - * - * Listen for it using the event type `destroy`. - * - * @event Phaser.Game#destroyEvent - */ - /** * Flags this Game instance as needing to be destroyed on the next frame. * It will wait until the current frame has completed and then call `runDestroy` internally. @@ -776,7 +637,7 @@ var Game = new Class({ * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. * * @method Phaser.Game#destroy - * @fires Phaser.Game#destroyEvent + * @fires Phaser.Core.Events#DESTROY * @since 3.0.0 * * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. @@ -801,7 +662,7 @@ var Game = new Class({ */ runDestroy: function () { - this.events.emit('destroy'); + this.events.emit(Events.DESTROY); this.events.removeAllListeners(); @@ -837,8 +698,8 @@ var Game = new Class({ }); +module.exports = Game; + /** * "Computers are good at following instructions, but not at reading your mind." - Donald Knuth */ - -module.exports = Game; diff --git a/src/boot/TimeStep.js b/src/core/TimeStep.js similarity index 86% rename from src/boot/TimeStep.js rename to src/core/TimeStep.js index e3da9403f..5123754e4 100644 --- a/src/boot/TimeStep.js +++ b/src/core/TimeStep.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -20,25 +20,17 @@ var RequestAnimationFrame = require('../dom/RequestAnimationFrame'); // http://www.testufo.com/#test=animation-time-graph -/** - * @callback TimeStepCallback - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} average - The Delta Average. - * @param {number} interpolation - Interpolation - how far between what is expected and where we are? - */ - /** * @classdesc * [description] * * @class TimeStep - * @memberof Phaser.Boot + * @memberof Phaser.Core * @constructor * @since 3.0.0 * * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. - * @param {FPSConfig} config + * @param {Phaser.Core.Types.FPSConfig} config */ var TimeStep = new Class({ @@ -49,7 +41,7 @@ var TimeStep = new Class({ /** * A reference to the Phaser.Game instance. * - * @name Phaser.Boot.TimeStep#game + * @name Phaser.Core.TimeStep#game * @type {Phaser.Game} * @readonly * @since 3.0.0 @@ -59,7 +51,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#raf + * @name Phaser.Core.TimeStep#raf * @type {Phaser.DOM.RequestAnimationFrame} * @readonly * @since 3.0.0 @@ -69,7 +61,7 @@ var TimeStep = new Class({ /** * A flag that is set once the TimeStep has started running and toggled when it stops. * - * @name Phaser.Boot.TimeStep#started + * @name Phaser.Core.TimeStep#started * @type {boolean} * @readonly * @default false @@ -83,7 +75,7 @@ var TimeStep = new Class({ * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if * the TimeStep is actually stopped, not just paused. * - * @name Phaser.Boot.TimeStep#running + * @name Phaser.Core.TimeStep#running * @type {boolean} * @readonly * @default false @@ -94,7 +86,7 @@ var TimeStep = new Class({ /** * The minimum fps rate you want the Time Step to run at. * - * @name Phaser.Boot.TimeStep#minFps + * @name Phaser.Core.TimeStep#minFps * @type {integer} * @default 5 * @since 3.0.0 @@ -108,7 +100,7 @@ var TimeStep = new Class({ * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step * is spiraling out of control. * - * @name Phaser.Boot.TimeStep#targetFps + * @name Phaser.Core.TimeStep#targetFps * @type {integer} * @default 60 * @since 3.0.0 @@ -119,7 +111,7 @@ var TimeStep = new Class({ * The minFps value in ms. * Defaults to 200ms between frames (i.e. super slow!) * - * @name Phaser.Boot.TimeStep#_min + * @name Phaser.Core.TimeStep#_min * @type {number} * @private * @since 3.0.0 @@ -130,7 +122,7 @@ var TimeStep = new Class({ * The targetFps value in ms. * Defaults to 16.66ms between frames (i.e. normal) * - * @name Phaser.Boot.TimeStep#_target + * @name Phaser.Core.TimeStep#_target * @type {number} * @private * @since 3.0.0 @@ -140,7 +132,7 @@ var TimeStep = new Class({ /** * An exponential moving average of the frames per second. * - * @name Phaser.Boot.TimeStep#actualFps + * @name Phaser.Core.TimeStep#actualFps * @type {integer} * @readonly * @default 60 @@ -151,7 +143,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#nextFpsUpdate + * @name Phaser.Core.TimeStep#nextFpsUpdate * @type {integer} * @readonly * @default 0 @@ -162,7 +154,7 @@ var TimeStep = new Class({ /** * The number of frames processed this second. * - * @name Phaser.Boot.TimeStep#framesThisSecond + * @name Phaser.Core.TimeStep#framesThisSecond * @type {integer} * @readonly * @default 0 @@ -173,8 +165,8 @@ var TimeStep = new Class({ /** * A callback to be invoked each time the Time Step steps. * - * @name Phaser.Boot.TimeStep#callback - * @type {TimeStepCallback} + * @name Phaser.Core.TimeStep#callback + * @type {Phaser.Core.Types.TimeStepCallback} * @default NOOP * @since 3.0.0 */ @@ -184,7 +176,7 @@ var TimeStep = new Class({ * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. * - * @name Phaser.Boot.TimeStep#forceSetTimeOut + * @name Phaser.Core.TimeStep#forceSetTimeOut * @type {boolean} * @readonly * @default false @@ -195,7 +187,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#time + * @name Phaser.Core.TimeStep#time * @type {integer} * @default 0 * @since 3.0.0 @@ -205,7 +197,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#startTime + * @name Phaser.Core.TimeStep#startTime * @type {integer} * @default 0 * @since 3.0.0 @@ -215,7 +207,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#lastTime + * @name Phaser.Core.TimeStep#lastTime * @type {integer} * @default 0 * @since 3.0.0 @@ -225,7 +217,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#frame + * @name Phaser.Core.TimeStep#frame * @type {integer} * @readonly * @default 0 @@ -236,7 +228,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#inFocus + * @name Phaser.Core.TimeStep#inFocus * @type {boolean} * @readonly * @default true @@ -247,7 +239,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#_pauseTime + * @name Phaser.Core.TimeStep#_pauseTime * @type {integer} * @private * @default 0 @@ -258,7 +250,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#_coolDown + * @name Phaser.Core.TimeStep#_coolDown * @type {integer} * @private * @default 0 @@ -269,7 +261,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#delta + * @name Phaser.Core.TimeStep#delta * @type {integer} * @default 0 * @since 3.0.0 @@ -279,7 +271,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#deltaIndex + * @name Phaser.Core.TimeStep#deltaIndex * @type {integer} * @default 0 * @since 3.0.0 @@ -289,7 +281,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#deltaHistory + * @name Phaser.Core.TimeStep#deltaHistory * @type {integer[]} * @since 3.0.0 */ @@ -298,7 +290,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#deltaSmoothingMax + * @name Phaser.Core.TimeStep#deltaSmoothingMax * @type {integer} * @default 10 * @since 3.0.0 @@ -308,7 +300,7 @@ var TimeStep = new Class({ /** * [description] * - * @name Phaser.Boot.TimeStep#panicMax + * @name Phaser.Core.TimeStep#panicMax * @type {integer} * @default 120 * @since 3.0.0 @@ -320,7 +312,7 @@ var TimeStep = new Class({ * Unlike with `delta` no smoothing, capping, or averaging is applied to this value. * So please be careful when using this value in calculations. * - * @name Phaser.Boot.TimeStep#rawDelta + * @name Phaser.Core.TimeStep#rawDelta * @type {number} * @default 0 * @since 3.0.0 @@ -331,7 +323,7 @@ var TimeStep = new Class({ /** * Called when the DOM window.onBlur event triggers. * - * @method Phaser.Boot.TimeStep#blur + * @method Phaser.Core.TimeStep#blur * @since 3.0.0 */ blur: function () @@ -342,7 +334,7 @@ var TimeStep = new Class({ /** * Called when the DOM window.onFocus event triggers. * - * @method Phaser.Boot.TimeStep#focus + * @method Phaser.Core.TimeStep#focus * @since 3.0.0 */ focus: function () @@ -355,7 +347,7 @@ var TimeStep = new Class({ /** * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) * - * @method Phaser.Boot.TimeStep#pause + * @method Phaser.Core.TimeStep#pause * @since 3.0.0 */ pause: function () @@ -366,7 +358,7 @@ var TimeStep = new Class({ /** * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) * - * @method Phaser.Boot.TimeStep#resume + * @method Phaser.Core.TimeStep#resume * @since 3.0.0 */ resume: function () @@ -379,7 +371,7 @@ var TimeStep = new Class({ /** * [description] * - * @method Phaser.Boot.TimeStep#resetDelta + * @method Phaser.Core.TimeStep#resetDelta * @since 3.0.0 */ resetDelta: function () @@ -409,10 +401,10 @@ var TimeStep = new Class({ * Starts the Time Step running, if it is not already doing so. * Called automatically by the Game Boot process. * - * @method Phaser.Boot.TimeStep#start + * @method Phaser.Core.TimeStep#start * @since 3.0.0 * - * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. + * @param {Phaser.Core.Types.TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. */ start: function (callback) { @@ -443,7 +435,7 @@ var TimeStep = new Class({ * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. * You generally should never call this method directly. * - * @method Phaser.Boot.TimeStep#step + * @method Phaser.Core.TimeStep#step * @since 3.0.0 * * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. @@ -566,7 +558,7 @@ var TimeStep = new Class({ /** * Manually calls TimeStep.step, passing in the performance.now value to it. * - * @method Phaser.Boot.TimeStep#tick + * @method Phaser.Core.TimeStep#tick * @since 3.0.0 */ tick: function () @@ -577,7 +569,7 @@ var TimeStep = new Class({ /** * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. * - * @method Phaser.Boot.TimeStep#sleep + * @method Phaser.Core.TimeStep#sleep * @since 3.0.0 */ sleep: function () @@ -594,7 +586,7 @@ var TimeStep = new Class({ * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. * The `seamless` argument controls if the wake-up should adjust the start time or not. * - * @method Phaser.Boot.TimeStep#wake + * @method Phaser.Core.TimeStep#wake * @since 3.0.0 * * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. @@ -620,10 +612,10 @@ var TimeStep = new Class({ /** * Stops the TimeStep running. * - * @method Phaser.Boot.TimeStep#stop + * @method Phaser.Core.TimeStep#stop * @since 3.0.0 * - * @return {Phaser.Boot.TimeStep} The TimeStep object. + * @return {Phaser.Core.TimeStep} The TimeStep object. */ stop: function () { @@ -639,7 +631,7 @@ var TimeStep = new Class({ * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null * any objects. * - * @method Phaser.Boot.TimeStep#destroy + * @method Phaser.Core.TimeStep#destroy * @since 3.0.0 */ destroy: function () diff --git a/src/boot/VisibilityHandler.js b/src/core/VisibilityHandler.js similarity index 60% rename from src/boot/VisibilityHandler.js rename to src/core/VisibilityHandler.js index 35413c259..f1974a085 100644 --- a/src/boot/VisibilityHandler.js +++ b/src/core/VisibilityHandler.js @@ -1,51 +1,21 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * Visibility Handler hidden event. - * - * The document in which the Game is embedded has entered a hidden state. - * - * @event Phaser.Boot.VisibilityHandler#hidden - */ - -/** - * Visibility Handler visible event. - * - * The document in which the Game is embedded has entered a visible state. - * - * @event Phaser.Boot.VisibilityHandler#visible - */ - -/** - * Visibility Handler blur event. - * - * The window in which the Game is embedded has entered a blurred state. - * - * @event Phaser.Boot.VisibilityHandler#blur - */ - -/** - * Visibility Handler focus event. - * - * The window in which the Game is embedded has entered a focused state. - * - * @event Phaser.Boot.VisibilityHandler#focus - */ +var Events = require('./events'); /** * The Visibility Handler is responsible for listening out for document level visibility change events. * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses * the provided Event Emitter and fires the related events. * - * @function Phaser.Boot.VisibilityHandler - * @fires Phaser.Boot.VisibilityHandler#hidden - * @fires Phaser.Boot.VisibilityHandler#visible - * @fires Phaser.Boot.VisibilityHandler#blur - * @fires Phaser.Boot.VisibilityHandler#focus + * @function Phaser.Core.VisibilityHandler + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE * @since 3.0.0 * * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. @@ -82,11 +52,11 @@ var VisibilityHandler = function (game) { if (document.hidden || event.type === 'pause') { - eventEmitter.emit('hidden'); + eventEmitter.emit(Events.HIDDEN); } else { - eventEmitter.emit('visible'); + eventEmitter.emit(Events.VISIBLE); } }; @@ -97,12 +67,12 @@ var VisibilityHandler = function (game) window.onblur = function () { - eventEmitter.emit('blur'); + eventEmitter.emit(Events.BLUR); }; window.onfocus = function () { - eventEmitter.emit('focus'); + eventEmitter.emit(Events.FOCUS); }; // Automatically give the window focus unless config says otherwise diff --git a/src/core/events/BLUR_EVENT.js b/src/core/events/BLUR_EVENT.js new file mode 100644 index 000000000..a593be872 --- /dev/null +++ b/src/core/events/BLUR_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Blur Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps + * tab, or if they simply remove focus from the browser to another app. + * + * @event Phaser.Core.Events#BLUR + * @since 3.0.0 + */ +module.exports = 'blur'; diff --git a/src/core/events/BOOT_EVENT.js b/src/core/events/BOOT_EVENT.js new file mode 100644 index 000000000..ffad7b2f6 --- /dev/null +++ b/src/core/events/BOOT_EVENT.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Boot Event. + * + * This event is dispatched when the Phaser Game instance 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.Core.Events#BOOT + * @since 3.0.0 + */ +module.exports = 'boot'; diff --git a/src/core/events/DESTROY_EVENT.js b/src/core/events/DESTROY_EVENT.js new file mode 100644 index 000000000..9dd0cad47 --- /dev/null +++ b/src/core/events/DESTROY_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Destroy Event. + * + * This event is dispatched when the game instance has been told to destroy itself. + * Lots of internal systems listen to this event in order to clear themselves out. + * Custom plugins and game code should also do the same. + * + * @event Phaser.Core.Events#DESTROY + * @since 3.0.0 + */ +module.exports = 'destroy'; diff --git a/src/core/events/FOCUS_EVENT.js b/src/core/events/FOCUS_EVENT.js new file mode 100644 index 000000000..ecc181b55 --- /dev/null +++ b/src/core/events/FOCUS_EVENT.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Focus Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it. + * + * @event Phaser.Core.Events#FOCUS + * @since 3.0.0 + */ +module.exports = 'focus'; diff --git a/src/core/events/HIDDEN_EVENT.js b/src/core/events/HIDDEN_EVENT.js new file mode 100644 index 000000000..101a26a11 --- /dev/null +++ b/src/core/events/HIDDEN_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Hidden Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted. + * + * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which + * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something + * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games) + * + * @event Phaser.Core.Events#HIDDEN + * @since 3.0.0 + */ +module.exports = 'hidden'; diff --git a/src/core/events/PAUSE_EVENT.js b/src/core/events/PAUSE_EVENT.js new file mode 100644 index 000000000..999cfd9a0 --- /dev/null +++ b/src/core/events/PAUSE_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PAUSE + * @since 3.0.0 + */ +module.exports = 'pause'; diff --git a/src/core/events/POST_RENDER_EVENT.js b/src/core/events/POST_RENDER_EVENT.js new file mode 100644 index 000000000..1c105f99a --- /dev/null +++ b/src/core/events/POST_RENDER_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Render Event. + * + * This event is dispatched right at the end of the render process. + * + * Every Scene will have rendered and been drawn to the canvas by the time this event is fired. + * Use it for any last minute post-processing before the next game step begins. + * + * @event Phaser.Core.Events#POST_RENDER + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'postrender'; diff --git a/src/core/events/POST_STEP_EVENT.js b/src/core/events/POST_STEP_EVENT.js new file mode 100644 index 000000000..9bc5fd472 --- /dev/null +++ b/src/core/events/POST_STEP_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Post-Step Event. + * + * This event is dispatched after the Scene Manager has updated. + * Hook into it from plugins or systems that need to do things before the render starts. + * + * @event Phaser.Core.Events#POST_STEP + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'poststep'; diff --git a/src/core/events/PRE_RENDER_EVENT.js b/src/core/events/PRE_RENDER_EVENT.js new file mode 100644 index 000000000..e0376ff58 --- /dev/null +++ b/src/core/events/PRE_RENDER_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The 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.Core.Events#PRE_RENDER + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'prerender'; diff --git a/src/core/events/PRE_STEP_EVENT.js b/src/core/events/PRE_STEP_EVENT.js new file mode 100644 index 000000000..cdc74874f --- /dev/null +++ b/src/core/events/PRE_STEP_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Pre-Step Event. + * + * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. + * Hook into it from plugins or systems that need to update before the Scene Manager does. + * + * @event Phaser.Core.Events#PRE_STEP + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'prestep'; diff --git a/src/core/events/READY_EVENT.js b/src/core/events/READY_EVENT.js new file mode 100644 index 000000000..dfe7b3916 --- /dev/null +++ b/src/core/events/READY_EVENT.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Ready Event. + * + * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, + * and all local systems are now able to start. + * + * @event Phaser.Core.Events#READY + * @since 3.0.0 + */ +module.exports = 'ready'; diff --git a/src/core/events/RESUME_EVENT.js b/src/core/events/RESUME_EVENT.js new file mode 100644 index 000000000..64bc9d234 --- /dev/null +++ b/src/core/events/RESUME_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Resume Event. + * + * This event is dispatched when the game loop leaves a paused state and resumes running. + * + * @event Phaser.Core.Events#RESUME + * @since 3.0.0 + */ +module.exports = 'resume'; diff --git a/src/core/events/STEP_EVENT.js b/src/core/events/STEP_EVENT.js new file mode 100644 index 000000000..4f5ede316 --- /dev/null +++ b/src/core/events/STEP_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Step Event. + * + * This event is dispatched after the Game Pre-Step and before the Scene Manager steps. + * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have. + * + * @event Phaser.Core.Events#STEP + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'step'; diff --git a/src/core/events/VISIBLE_EVENT.js b/src/core/events/VISIBLE_EVENT.js new file mode 100644 index 000000000..6ded8f73c --- /dev/null +++ b/src/core/events/VISIBLE_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Visible Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a visible state, previously having been hidden. + * + * Only browsers that support the Visibility API will cause this event to be emitted. + * + * @event Phaser.Core.Events#VISIBLE + * @since 3.0.0 + */ +module.exports = 'visible'; diff --git a/src/core/events/index.js b/src/core/events/index.js new file mode 100644 index 000000000..4b3d33235 --- /dev/null +++ b/src/core/events/index.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Core.Events + */ + +module.exports = { + + BLUR: require('./BLUR_EVENT'), + BOOT: require('./BOOT_EVENT'), + DESTROY: require('./DESTROY_EVENT'), + FOCUS: require('./FOCUS_EVENT'), + HIDDEN: require('./HIDDEN_EVENT'), + PAUSE: require('./PAUSE_EVENT'), + POST_RENDER: require('./POST_RENDER_EVENT'), + POST_STEP: require('./POST_STEP_EVENT'), + PRE_RENDER: require('./PRE_RENDER_EVENT'), + PRE_STEP: require('./PRE_STEP_EVENT'), + READY: require('./READY_EVENT'), + RESUME: require('./RESUME_EVENT'), + STEP: require('./STEP_EVENT'), + VISIBLE: require('./VISIBLE_EVENT') + +}; diff --git a/src/boot/index.js b/src/core/index.js similarity index 78% rename from src/boot/index.js rename to src/core/index.js index 47767812f..0c7ca64b8 100644 --- a/src/boot/index.js +++ b/src/core/index.js @@ -1,11 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.Boot + * @namespace Phaser.Core */ module.exports = { @@ -13,7 +13,7 @@ module.exports = { Config: require('./Config'), CreateRenderer: require('./CreateRenderer'), DebugHeader: require('./DebugHeader'), - PluginManager: require('./PluginManager'), + Events: require('./events'), TimeStep: require('./TimeStep'), VisibilityHandler: require('./VisibilityHandler') diff --git a/src/core/typedefs/AudioConfig.js b/src/core/typedefs/AudioConfig.js new file mode 100644 index 000000000..a4d6d3e4f --- /dev/null +++ b/src/core/typedefs/AudioConfig.js @@ -0,0 +1,12 @@ +/** + * Config object containing various sound settings. + * + * @typedef {object} Phaser.Core.Types.AudioConfig + * @since 3.0.0 + * + * @property {boolean} [disableWebAudio=false] - Use HTML5 Audio instead of Web Audio. + * @property {AudioContext} [context] - An existing Web Audio context. + * @property {boolean} [noAudio=false] - Disable all audio output. + * + * @see Phaser.Sound.SoundManagerCreator + */ diff --git a/src/core/typedefs/BannerConfig.js b/src/core/typedefs/BannerConfig.js new file mode 100644 index 000000000..48adcb401 --- /dev/null +++ b/src/core/typedefs/BannerConfig.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Core.Types.BannerConfig + * @since 3.0.0 + * + * @property {boolean} [hidePhaser=false] - Omit Phaser's name and version from the banner. + * @property {string} [text='#ffffff'] - The color of the banner text. + * @property {string[]} [background] - The background colors of the banner. + */ diff --git a/src/core/typedefs/BootCallback.js b/src/core/typedefs/BootCallback.js new file mode 100644 index 000000000..28c228a0a --- /dev/null +++ b/src/core/typedefs/BootCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.Core.Types.BootCallback + * @since 3.0.0 + * + * @param {Phaser.Game} game - The game. + */ diff --git a/src/core/typedefs/CallbacksConfig.js b/src/core/typedefs/CallbacksConfig.js new file mode 100644 index 000000000..8ecd3acfe --- /dev/null +++ b/src/core/typedefs/CallbacksConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.CallbacksConfig + * @since 3.0.0 + * + * @property {Phaser.Core.Types.BootCallback} [preBoot=Phaser.Core.Types.NOOP] - A function to run at the start of the boot sequence. + * @property {Phaser.Core.Types.BootCallback} [postBoot=Phaser.Core.Types.NOOP] - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. + */ diff --git a/src/core/typedefs/DOMContainerConfig.js b/src/core/typedefs/DOMContainerConfig.js new file mode 100644 index 000000000..0d8ab7d38 --- /dev/null +++ b/src/core/typedefs/DOMContainerConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.DOMContainerConfig + * @since 3.12.0 + * + * @property {boolean} [createContainer=false] - Create a div element in which DOM Elements will be contained. You must also provide a parent. + * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. + */ diff --git a/src/core/typedefs/FPSConfig.js b/src/core/typedefs/FPSConfig.js new file mode 100644 index 000000000..e7b3d5d02 --- /dev/null +++ b/src/core/typedefs/FPSConfig.js @@ -0,0 +1,10 @@ +/** + * @typedef {object} Phaser.Core.Types.FPSConfig + * @since 3.0.0 + * + * @property {integer} [min=5] - The minimum acceptable rendering rate, in frames per second. + * @property {integer} [target=60] - The optimum rendering rate, in frames per second. + * @property {boolean} [forceSetTimeOut=false] - Use setTimeout instead of requestAnimationFrame to run the game loop. + * @property {integer} [deltaHistory=10] - Calculate the average frame delta from this many consecutive frame intervals. + * @property {integer} [panicMax=120] - The amount of frames the time step counts before we trust the delta values again. + */ diff --git a/src/core/typedefs/GameConfig.js b/src/core/typedefs/GameConfig.js new file mode 100644 index 000000000..016f67ed5 --- /dev/null +++ b/src/core/typedefs/GameConfig.js @@ -0,0 +1,34 @@ +/** + * @typedef {object} Phaser.Core.Types.GameConfig + * @since 3.0.0 + * + * @property {(integer|string)} [width=1024] - The width of the game, in game pixels. + * @property {(integer|string)} [height=768] - The height of the game, in game pixels. + * @property {number} [zoom=1] - Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. + * @property {number} [resolution=1] - The size of each game pixel, in canvas pixels. Values larger than 1 are "high" resolution. + * @property {number} [type=CONST.AUTO] - Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. + * @property {(HTMLElement|string)} [parent=null] - The DOM element that will contain the game canvas, or its `id`. If undefined or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one. + * @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phaser's default styles. + * @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one. + * @property {object} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. + * @property {string[]} [seed] - Seed for the random number generator. + * @property {string} [title=''] - The title of the game. Shown in the browser console. + * @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console. + * @property {string} [version=''] - The version of the game. Shown in the browser console. + * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. + * @property {(boolean|Phaser.Core.Types.InputConfig)} [input] - Input configuration, or `false` to disable all game input. + * @property {boolean} [disableContextMenu=false] - Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). + * @property {(boolean|Phaser.Core.Types.BannerConfig)} [banner=false] - Configuration for the banner printed in the browser console when the game starts. + * @property {Phaser.Core.Types.DOMContainerConfig} [dom] - The DOM Container configuration object. + * @property {Phaser.Core.Types.FPSConfig} [fps] - Game loop configuration. + * @property {Phaser.Core.Types.RenderConfig} [render] - Game renderer configuration. + * @property {(string|number)} [backgroundColor=0x000000] - The background color of the game canvas. The default is black. + * @property {Phaser.Core.Types.CallbacksConfig} [callbacks] - Optional callbacks to run before or after game boot. + * @property {Phaser.Core.Types.LoaderConfig} [loader] - Loader configuration. + * @property {Phaser.Core.Types.ImagesConfig} [images] - Images configuration. + * @property {Phaser.Core.Types.PhysicsConfig} [physics] - Physics configuration. + * @property {Phaser.Core.Types.PluginObject|Phaser.Core.Types.PluginObjectItem[]} [plugins] - Plugins to install. + * @property {Phaser.Core.Types.ScaleConfig} [scale] - The Scale Manager configuration. + * @property {Phaser.Core.Types.AudioConfig} [audio] - The Audio Configuration object. + */ diff --git a/src/core/typedefs/GamepadInputConfig.js b/src/core/typedefs/GamepadInputConfig.js new file mode 100644 index 000000000..5ec51a7df --- /dev/null +++ b/src/core/typedefs/GamepadInputConfig.js @@ -0,0 +1,6 @@ +/** + * @typedef {object} Phaser.Core.Types.GamepadInputConfig + * @since 3.0.0 + * + * @property {*} [target=window] - Where the Gamepad Manager listens for gamepad input events. + */ diff --git a/src/core/typedefs/ImagesConfig.js b/src/core/typedefs/ImagesConfig.js new file mode 100644 index 000000000..1b6f04970 --- /dev/null +++ b/src/core/typedefs/ImagesConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.ImagesConfig + * @since 3.0.0 + * + * @property {string} [default] - URL to use for the 'default' texture. + * @property {string} [missing] - URL to use for the 'missing' texture. + */ diff --git a/src/core/typedefs/InputConfig.js b/src/core/typedefs/InputConfig.js new file mode 100644 index 000000000..56cdf65c6 --- /dev/null +++ b/src/core/typedefs/InputConfig.js @@ -0,0 +1,13 @@ +/** + * @typedef {object} Phaser.Core.Types.InputConfig + * @since 3.0.0 + * + * @property {(boolean|Phaser.Core.Types.KeyboardInputConfig)} [keyboard=true] - Keyboard input configuration. `true` uses the default configuration and `false` disables keyboard input. + * @property {(boolean|Phaser.Core.Types.MouseInputConfig)} [mouse=true] - Mouse input configuration. `true` uses the default configuration and `false` disables mouse input. + * @property {(boolean|Phaser.Core.Types.TouchInputConfig)} [touch=true] - Touch input configuration. `true` uses the default configuration and `false` disables touch input. + * @property {(boolean|Phaser.Core.Types.GamepadInputConfig)} [gamepad=false] - Gamepad input configuration. `true` enables gamepad input. + * @property {integer} [activePointers=1] - The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. + * @property {number} [smoothFactor=0] - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + * @property {boolean} [inputQueue=false] - Should Phaser use a queued input system for native DOM Events or not? + * @property {boolean} [windowEvents=true] - Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire. + */ diff --git a/src/core/typedefs/KeyboardInputConfig.js b/src/core/typedefs/KeyboardInputConfig.js new file mode 100644 index 000000000..bb6acb6c8 --- /dev/null +++ b/src/core/typedefs/KeyboardInputConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.KeyboardInputConfig + * @since 3.0.0 + * + * @property {*} [target=window] - Where the Keyboard Manager listens for keyboard input events. + * @property {?integer[]} [capture] - `preventDefault` will be called on every non-modified key which has a key code in this array. By default it is empty. + */ diff --git a/src/core/typedefs/LoaderConfig.js b/src/core/typedefs/LoaderConfig.js new file mode 100644 index 000000000..e38f3a6b2 --- /dev/null +++ b/src/core/typedefs/LoaderConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Core.Types.LoaderConfig + * @since 3.0.0 + * + * @property {string} [baseURL] - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. + * @property {string} [path] - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. + * @property {integer} [maxParallelDownloads=32] - The maximum number of resources the loader will start loading at once. + * @property {(string|undefined)} [crossOrigin=undefined] - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + * @property {string} [responseType] - The response type of the XHR request, e.g. `blob`, `text`, etc. + * @property {boolean} [async=true] - Should the XHR request use async or not? + * @property {string} [user] - Optional username for all XHR requests. + * @property {string} [password] - Optional password for all XHR requests. + * @property {integer} [timeout=0] - Optional XHR timeout value, in ms. + */ diff --git a/src/core/typedefs/MouseInputConfig.js b/src/core/typedefs/MouseInputConfig.js new file mode 100644 index 000000000..92cb80797 --- /dev/null +++ b/src/core/typedefs/MouseInputConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.MouseInputConfig + * @since 3.0.0 + * + * @property {*} [target=null] - Where the Mouse Manager listens for mouse input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether mouse input events have `preventDefault` called on them. + */ diff --git a/src/core/typedefs/NOOP.js b/src/core/typedefs/NOOP.js new file mode 100644 index 000000000..c17e8bdd8 --- /dev/null +++ b/src/core/typedefs/NOOP.js @@ -0,0 +1,6 @@ +/** + * This callback type is completely empty, a no-operation. + * + * @callback Phaser.Core.Types.NOOP + * @since 3.0.0 + */ diff --git a/src/core/typedefs/PhysicsConfig.js b/src/core/typedefs/PhysicsConfig.js new file mode 100644 index 000000000..d4d30d763 --- /dev/null +++ b/src/core/typedefs/PhysicsConfig.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Core.Types.PhysicsConfig + * @since 3.0.0 + * + * @property {string} [default] - The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. + * @property {Phaser.Physics.Arcade.Types.ArcadeWorldConfig} [arcade] - Arcade Physics configuration. + * @property {Phaser.Physics.Impact.Types.WorldConfig} [impact] - Impact Physics configuration. + * @property {MatterWorldConfig} [matter] - Matter Physics configuration. + */ diff --git a/src/core/typedefs/PluginObject.js b/src/core/typedefs/PluginObject.js new file mode 100644 index 000000000..3589b6e00 --- /dev/null +++ b/src/core/typedefs/PluginObject.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Core.Types.PluginObject + * @since 3.8.0 + * + * @property {?Phaser.Core.Types.PluginObjectItem[]} [global] - Global plugins to install. + * @property {?Phaser.Core.Types.PluginObjectItem[]} [scene] - Scene plugins to install. + * @property {string[]} [default] - The default set of scene plugins (names). + * @property {string[]} [defaultMerge] - Plugins to *add* to the default set of scene plugins. + */ diff --git a/src/core/typedefs/PluginObjectItem.js b/src/core/typedefs/PluginObjectItem.js new file mode 100644 index 000000000..fa8723870 --- /dev/null +++ b/src/core/typedefs/PluginObjectItem.js @@ -0,0 +1,19 @@ +/** + * @typedef {object} Phaser.Core.Types.PluginObjectItem + * @since 3.8.0 + * + * @property {string} [key] - A key to identify the plugin in the Plugin Manager. + * @property {*} [plugin] - The plugin itself. Usually a class/constructor. + * @property {boolean} [start] - Whether the plugin should be started automatically. + * @property {string} [systemKey] - For a scene plugin, add the plugin to the scene's systems object under this key (`this.sys.KEY`, from the scene). + * @property {string} [sceneKey] - For a scene plugin, add the plugin to the scene object under this key (`this.KEY`, from the scene). + * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @property {*} [data] - Arbitrary data passed to the plugin's init() method. + * + * @example + * // Global plugin + * { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } } + * @example + * // Scene plugin + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + */ diff --git a/src/core/typedefs/RenderConfig.js b/src/core/typedefs/RenderConfig.js new file mode 100644 index 000000000..489c173cf --- /dev/null +++ b/src/core/typedefs/RenderConfig.js @@ -0,0 +1,15 @@ +/** + * @typedef {object} Phaser.Core.Types.RenderConfig + * @since 3.0.0 + * + * @property {boolean} [antialias=true] - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + * @property {boolean} [pixelArt=false] - Sets `antialias` and `roundPixels` to true. This is the best setting for pixel-art games. + * @property {boolean} [roundPixels=false] - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + * @property {boolean} [transparent=false] - Whether the game canvas will be transparent. + * @property {boolean} [clearBeforeRender=true] - Whether the game canvas will be cleared between each rendering frame. + * @property {boolean} [premultipliedAlpha=true] - In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. + * @property {boolean} [failIfMajorPerformanceCaveat=false] - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + * @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + * @property {integer} [batchSize=2000] - The default WebGL batch size. + * @property {integer} [maxLights=10] - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ diff --git a/src/core/typedefs/ScaleConfig.js b/src/core/typedefs/ScaleConfig.js new file mode 100644 index 000000000..44ce116fc --- /dev/null +++ b/src/core/typedefs/ScaleConfig.js @@ -0,0 +1,18 @@ +/** + * @typedef {object} Phaser.Core.Types.ScaleConfig + * @since 3.16.0 + * + * @property {(integer|string)} [width=1024] - The base width of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(integer|string)} [height=768] - The base height of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. + * @property {(Phaser.Scale.ZoomType|integer)} [zoom=1] - The zoom value of the game canvas. + * @property {number} [resolution=1] - The rendering resolution of the canvas. This is reserved for future use and is currently ignored. + * @property {?(HTMLElement|string)} [parent] - The DOM element that will contain the game canvas, or its `id`. If undefined, or if the named element doesn't exist, the game canvas is inserted directly into the document body. If `null` no parent will be used and you are responsible for adding the canvas to your environment. + * @property {boolean} [expandParent=true] - Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%? + * @property {Phaser.Scale.ScaleModeType} [mode=Phaser.Scale.ScaleModes.NONE] - The scale mode. + * @property {WidthHeight} [min] - The minimum width and height the canvas can be scaled down to. + * @property {WidthHeight} [max] - The maximum width the canvas can be scaled up to. + * @property {boolean} [autoRound=false] - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * @property {Phaser.Scale.CenterType} [autoCenter=Phaser.Scale.Center.NO_CENTER] - Automatically center the canvas within the parent? + * @property {integer} [resizeInterval=500] - How many ms should elapse before checking if the browser size has changed? + * @property {?(HTMLElement|string)} [fullscreenTarget] - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ diff --git a/src/core/typedefs/TimeStepCallback.js b/src/core/typedefs/TimeStepCallback.js new file mode 100644 index 000000000..7b8112fd1 --- /dev/null +++ b/src/core/typedefs/TimeStepCallback.js @@ -0,0 +1,8 @@ +/** + * @callback Phaser.Core.Types.TimeStepCallback + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} average - The Delta Average. + * @param {number} interpolation - Interpolation - how far between what is expected and where we are? + */ diff --git a/src/core/typedefs/TouchInputConfig.js b/src/core/typedefs/TouchInputConfig.js new file mode 100644 index 000000000..fbf55dbd7 --- /dev/null +++ b/src/core/typedefs/TouchInputConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.TouchInputConfig + * @since 3.0.0 + * + * @property {*} [target=null] - Where the Touch Manager listens for touch input events. The default is the game canvas. + * @property {boolean} [capture=true] - Whether touch input events have preventDefault() called on them. + */ diff --git a/src/core/typedefs/WidthHeight.js b/src/core/typedefs/WidthHeight.js new file mode 100644 index 000000000..5a03966c5 --- /dev/null +++ b/src/core/typedefs/WidthHeight.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Core.Types.WidthHeight + * @since 3.16.0 + * + * @property {integer} [width=0] - The width. + * @property {integer} [height=0] - The height. + */ diff --git a/src/core/typedefs/index.js b/src/core/typedefs/index.js new file mode 100644 index 000000000..118055e88 --- /dev/null +++ b/src/core/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Core.Types + */ diff --git a/src/create/GenerateTexture.js b/src/create/GenerateTexture.js index 6c02aff22..f5ff49786 100644 --- a/src/create/GenerateTexture.js +++ b/src/create/GenerateTexture.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,34 +8,13 @@ var Arne16 = require('./palettes/Arne16'); var CanvasPool = require('../display/canvas/CanvasPool'); var GetValue = require('../utils/object/GetValue'); -/** - * @callback GenerateTextureRendererCallback - * - * @param {HTMLCanvasElement} canvas - [description] - * @param {CanvasRenderingContext2D} context - [description] - */ - -/** - * @typedef {object} GenerateTextureConfig - * - * @property {array} [data=[]] - [description] - * @property {HTMLCanvasElement} [canvas=null] - [description] - * @property {Palette} [palette=Arne16] - [description] - * @property {number} [pixelWidth=1] - The width of each 'pixel' in the generated texture. - * @property {number} [pixelHeight=1] - The height of each 'pixel' in the generated texture. - * @property {boolean} [resizeCanvas=true] - [description] - * @property {boolean} [clearCanvas=true] - [description] - * @property {GenerateTextureRendererCallback} [preRender] - [description] - * @property {GenerateTextureRendererCallback} [postRender] - [description] - */ - /** * [description] * * @function Phaser.Create.GenerateTexture * @since 3.0.0 * - * @param {GenerateTextureConfig} config - [description] + * @param {Phaser.Create.Types.GenerateTextureConfig} config - [description] * * @return {HTMLCanvasElement} [description] */ diff --git a/src/create/index.js b/src/create/index.js index e107cdfaf..c75c844c9 100644 --- a/src/create/index.js +++ b/src/create/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/create/palettes/Arne16.js b/src/create/palettes/Arne16.js index ba8590cd5..847a6f0e9 100644 --- a/src/create/palettes/Arne16.js +++ b/src/create/palettes/Arne16.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ * @name Phaser.Create.Palettes.ARNE16 * @since 3.0.0 * - * @type {Palette} + * @type {Phaser.Create.Types.Palette} */ module.exports = { 0: '#000', diff --git a/src/create/palettes/C64.js b/src/create/palettes/C64.js index f3c50fef9..5e854afd8 100644 --- a/src/create/palettes/C64.js +++ b/src/create/palettes/C64.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ * @name Phaser.Create.Palettes.C64 * @since 3.0.0 * - * @type {Palette} + * @type {Phaser.Create.Types.Palette} */ module.exports = { 0: '#000', diff --git a/src/create/palettes/CGA.js b/src/create/palettes/CGA.js index 3e12b6b73..c10db90fc 100644 --- a/src/create/palettes/CGA.js +++ b/src/create/palettes/CGA.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ * @name Phaser.Create.Palettes.CGA * @since 3.0.0 * - * @type {Palette} + * @type {Phaser.Create.Types.Palette} */ module.exports = { 0: '#000', diff --git a/src/create/palettes/JMP.js b/src/create/palettes/JMP.js index c911ed8c0..f29e01ade 100644 --- a/src/create/palettes/JMP.js +++ b/src/create/palettes/JMP.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ * @name Phaser.Create.Palettes.JMP * @since 3.0.0 * - * @type {Palette} + * @type {Phaser.Create.Types.Palette} */ module.exports = { 0: '#000', diff --git a/src/create/palettes/MSX.js b/src/create/palettes/MSX.js index e3d0351fc..de38aba25 100644 --- a/src/create/palettes/MSX.js +++ b/src/create/palettes/MSX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ * @name Phaser.Create.Palettes.MSX * @since 3.0.0 * - * @type {Palette} + * @type {Phaser.Create.Types.Palette} */ module.exports = { 0: '#000', diff --git a/src/create/palettes/index.js b/src/create/palettes/index.js index 0b70efb27..abf71e18a 100644 --- a/src/create/palettes/index.js +++ b/src/create/palettes/index.js @@ -1,30 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} Palette - * - * @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. - */ - /** * @namespace Phaser.Create.Palettes */ diff --git a/src/create/typedefs/GenerateTextureConfig.js b/src/create/typedefs/GenerateTextureConfig.js new file mode 100644 index 000000000..e919e97a1 --- /dev/null +++ b/src/create/typedefs/GenerateTextureConfig.js @@ -0,0 +1,22 @@ +/** + * @callback Phaser.Create.Types.GenerateTextureCallback + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - [description] + * @param {CanvasRenderingContext2D} context - [description] + */ + +/** + * @typedef {object} Phaser.Create.Types.GenerateTextureConfig + * @since 3.0.0 + * + * @property {array} [data=[]] - [description] + * @property {HTMLCanvasElement} [canvas=null] - [description] + * @property {Phaser.Create.Types.Palette} [palette=Arne16] - [description] + * @property {number} [pixelWidth=1] - The width of each 'pixel' in the generated texture. + * @property {number} [pixelHeight=1] - The height of each 'pixel' in the generated texture. + * @property {boolean} [resizeCanvas=true] - [description] + * @property {boolean} [clearCanvas=true] - [description] + * @property {Phaser.Create.Types.GenerateTextureCallback} [preRender] - [description] + * @property {Phaser.Create.Types.GenerateTextureCallback} [postRender] - [description] + */ diff --git a/src/create/typedefs/Palette.js b/src/create/typedefs/Palette.js new file mode 100644 index 000000000..9d4a8557e --- /dev/null +++ b/src/create/typedefs/Palette.js @@ -0,0 +1,21 @@ +/** + * @typedef {object} Phaser.Create.Types.Palette + * @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. + */ diff --git a/src/create/typedefs/index.js b/src/create/typedefs/index.js new file mode 100644 index 000000000..548421ff9 --- /dev/null +++ b/src/create/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Create.Types + */ diff --git a/src/curves/CubicBezierCurve.js b/src/curves/CubicBezierCurve.js index 87e187307..440b54161 100644 --- a/src/curves/CubicBezierCurve.js +++ b/src/curves/CubicBezierCurve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -179,7 +179,7 @@ var CubicBezierCurve = new Class({ * @method Phaser.Curves.CubicBezier#toJSON * @since 3.0.0 * - * @return {JSONCurve} The JSON object containing this curve data. + * @return {Phaser.Curves.Types.JSONCurve} The JSON object containing this curve data. */ toJSON: function () { @@ -202,7 +202,7 @@ var CubicBezierCurve = new Class({ * @function Phaser.Curves.CubicBezier.fromJSON * @since 3.0.0 * - * @param {JSONCurve} data - The JSON object containing this curve data. + * @param {Phaser.Curves.Types.JSONCurve} data - The JSON object containing this curve data. * * @return {Phaser.Curves.CubicBezier} The curve generated from the JSON object. */ diff --git a/src/curves/Curve.js b/src/curves/Curve.js index 9e6d672c1..3821c816b 100644 --- a/src/curves/Curve.js +++ b/src/curves/Curve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/curves/EllipseCurve.js b/src/curves/EllipseCurve.js index a08e10f26..82239bc56 100644 --- a/src/curves/EllipseCurve.js +++ b/src/curves/EllipseCurve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,33 +13,6 @@ var GetValue = require('../utils/object/GetValue'); var RadToDeg = require('../math/RadToDeg'); var Vector2 = require('../math/Vector2'); -/** - * @typedef {object} JSONEllipseCurve - * - * @property {string} type - The of the curve. - * @property {number} x - The x coordinate of the ellipse. - * @property {number} y - The y coordinate of the ellipse. - * @property {number} xRadius - The horizontal radius of ellipse. - * @property {number} yRadius - The vertical radius of ellipse. - * @property {integer} startAngle - The start angle of the ellipse, in degrees. - * @property {integer} endAngle - The end angle of the ellipse, in degrees. - * @property {boolean} clockwise - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false) - * @property {integer} rotation - The rotation of ellipse, in degrees. - */ - -/** - * @typedef {object} EllipseCurveConfig - * - * @property {number} [x=0] - The x coordinate of the ellipse. - * @property {number} [y=0] - The y coordinate of the ellipse. - * @property {number} [xRadius=0] - The horizontal radius of the ellipse. - * @property {number} [yRadius=0] - The vertical radius of the ellipse. - * @property {integer} [startAngle=0] - The start angle of the ellipse, in degrees. - * @property {integer} [endAngle=360] - The end angle of the ellipse, in degrees. - * @property {boolean} [clockwise=false] - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false) - * @property {integer} [rotation=0] - The rotation of the ellipse, in degrees. - */ - /** * @classdesc * An Elliptical Curve derived from the Base Curve class. @@ -52,7 +25,7 @@ var Vector2 = require('../math/Vector2'); * @constructor * @since 3.0.0 * - * @param {(number|EllipseCurveConfig)} [x=0] - The x coordinate of the ellipse, or an Ellipse Curve configuration object. + * @param {(number|Phaser.Curves.Types.EllipseCurveConfig)} [x=0] - The x coordinate of the ellipse, or an Ellipse Curve configuration object. * @param {number} [y=0] - The y coordinate of the ellipse. * @param {number} [xRadius=0] - The horizontal radius of ellipse. * @param {number} [yRadius=0] - The vertical radius of ellipse. @@ -608,7 +581,7 @@ var EllipseCurve = new Class({ * @method Phaser.Curves.Ellipse#toJSON * @since 3.0.0 * - * @return {JSONEllipseCurve} The JSON object containing this curve data. + * @return {Phaser.Curves.Types.JSONEllipseCurve} The JSON object containing this curve data. */ toJSON: function () { @@ -633,7 +606,7 @@ var EllipseCurve = new Class({ * @function Phaser.Curves.Ellipse.fromJSON * @since 3.0.0 * - * @param {JSONEllipseCurve} data - The JSON object containing this curve data. + * @param {Phaser.Curves.Types.JSONEllipseCurve} data - The JSON object containing this curve data. * * @return {Phaser.Curves.Ellipse} The ellipse curve constructed from the configuration object. */ diff --git a/src/curves/LineCurve.js b/src/curves/LineCurve.js index c5d53e2de..1e40e257a 100644 --- a/src/curves/LineCurve.js +++ b/src/curves/LineCurve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -213,7 +213,7 @@ var LineCurve = new Class({ * @method Phaser.Curves.Line#toJSON * @since 3.0.0 * - * @return {JSONCurve} The JSON object containing this curve data. + * @return {Phaser.Curves.Types.JSONCurve} The JSON object containing this curve data. */ toJSON: function () { @@ -234,7 +234,7 @@ var LineCurve = new Class({ * @function Phaser.Curves.Line.fromJSON * @since 3.0.0 * - * @param {JSONCurve} data - The JSON object containing this curve data. + * @param {Phaser.Curves.Types.JSONCurve} data - The JSON object containing this curve data. * * @return {Phaser.Curves.Line} A new LineCurve object. */ diff --git a/src/curves/QuadraticBezierCurve.js b/src/curves/QuadraticBezierCurve.js index d33d97211..6da613acf 100644 --- a/src/curves/QuadraticBezierCurve.js +++ b/src/curves/QuadraticBezierCurve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -168,7 +168,7 @@ var QuadraticBezier = new Class({ * @method Phaser.Curves.QuadraticBezier#toJSON * @since 3.2.0 * - * @return {JSONCurve} The JSON object containing this curve data. + * @return {Phaser.Curves.Types.JSONCurve} The JSON object containing this curve data. */ toJSON: function () { @@ -190,7 +190,7 @@ var QuadraticBezier = new Class({ * @function Phaser.Curves.QuadraticBezier.fromJSON * @since 3.2.0 * - * @param {JSONCurve} data - The JSON object containing this curve data. + * @param {Phaser.Curves.Types.JSONCurve} data - The JSON object containing this curve data. * * @return {Phaser.Curves.QuadraticBezier} The created curve instance. */ diff --git a/src/curves/SplineCurve.js b/src/curves/SplineCurve.js index d7411944a..3185f8535 100644 --- a/src/curves/SplineCurve.js +++ b/src/curves/SplineCurve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -181,7 +181,7 @@ var SplineCurve = new Class({ * @method Phaser.Curves.Spline#toJSON * @since 3.0.0 * - * @return {JSONCurve} The JSON object containing this curve data. + * @return {Phaser.Curves.Types.JSONCurve} The JSON object containing this curve data. */ toJSON: function () { @@ -207,7 +207,7 @@ var SplineCurve = new Class({ * @function Phaser.Curves.Spline.fromJSON * @since 3.0.0 * - * @param {JSONCurve} data - The JSON object containing this curve data. + * @param {Phaser.Curves.Types.JSONCurve} data - The JSON object containing this curve data. * * @return {Phaser.Curves.Spline} [description] */ diff --git a/src/curves/index.js b/src/curves/index.js index bae8ecf7d..b7d955d1f 100644 --- a/src/curves/index.js +++ b/src/curves/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,13 +8,6 @@ * @namespace Phaser.Curves */ -/** - * @typedef {object} JSONCurve - * - * @property {string} type - The of the curve - * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` - */ - module.exports = { Path: require('./path/Path'), diff --git a/src/curves/path/MoveTo.js b/src/curves/path/MoveTo.js index 635868efb..28a08655c 100644 --- a/src/curves/path/MoveTo.js +++ b/src/curves/path/MoveTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -117,7 +117,7 @@ var MoveTo = new Class({ * @method Phaser.Curves.MoveTo#toJSON * @since 3.0.0 * - * @return {JSONCurve} A primitive object with the curve's type and only point. + * @return {Phaser.Curves.Types.JSONCurve} A primitive object with the curve's type and only point. */ toJSON: function () { diff --git a/src/curves/path/Path.js b/src/curves/path/Path.js index a97ef3a48..352e86300 100644 --- a/src/curves/path/Path.js +++ b/src/curves/path/Path.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,28 +17,20 @@ var Rectangle = require('../../geom/rectangle/Rectangle'); var SplineCurve = require('../SplineCurve'); var Vector2 = require('../../math/Vector2'); -/** - * @typedef {object} JSONPath - * - * @property {string} type - The of the curve. - * @property {number} x - The X coordinate of the curve's starting point. - * @property {number} y - The Y coordinate of the path's starting point. - * @property {boolean} autoClose - The path is auto closed. - * @property {JSONCurve[]} curves - The list of the curves - */ - /** * @classdesc - * A Path combines multiple Curves into one continuous compound curve. It does not matter how many Curves are in the Path or what type they are. + * A Path combines multiple Curves into one continuous compound curve. + * It does not matter how many Curves are in the Path or what type they are. * - * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. + * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not + * have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. * * @class Path * @memberof Phaser.Curves * @constructor * @since 3.0.0 * - * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link JSONPath}. + * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link Phaser.Curves.Types.JSONPath}. * @param {number} [y=0] - The Y coordinate of the Path's starting point. */ var Path = new Class({ @@ -339,12 +331,12 @@ var Path = new Class({ /** * Creates a Path from a Path Configuration object. * - * The provided object should be a {@link JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. + * The provided object should be a {@link Phaser.Curves.Types.JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. * * @method Phaser.Curves.Path#fromJSON * @since 3.0.0 * - * @param {object} data - The JSON object containing the Path data. + * @param {Phaser.Curves.Types.JSONPath} data - The JSON object containing the Path data. * * @return {Phaser.Curves.Path} This Path object. */ @@ -768,7 +760,7 @@ var Path = new Class({ * @method Phaser.Curves.Path#toJSON * @since 3.0.0 * - * @return {JSONPath} [description] + * @return {Phaser.Curves.Types.JSONPath} [description] */ toJSON: function () { diff --git a/src/curves/typedefs/EllipseCurveConfig.js b/src/curves/typedefs/EllipseCurveConfig.js new file mode 100644 index 000000000..b72286209 --- /dev/null +++ b/src/curves/typedefs/EllipseCurveConfig.js @@ -0,0 +1,12 @@ +/** + * @typedef {object} Phaser.Curves.Types.EllipseCurveConfig + * + * @property {number} [x=0] - The x coordinate of the ellipse. + * @property {number} [y=0] - The y coordinate of the ellipse. + * @property {number} [xRadius=0] - The horizontal radius of the ellipse. + * @property {number} [yRadius=0] - The vertical radius of the ellipse. + * @property {integer} [startAngle=0] - The start angle of the ellipse, in degrees. + * @property {integer} [endAngle=360] - The end angle of the ellipse, in degrees. + * @property {boolean} [clockwise=false] - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false) + * @property {integer} [rotation=0] - The rotation of the ellipse, in degrees. + */ diff --git a/src/curves/typedefs/JSONCurve.js b/src/curves/typedefs/JSONCurve.js new file mode 100644 index 000000000..4efae149c --- /dev/null +++ b/src/curves/typedefs/JSONCurve.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Curves.Types.JSONCurve + * @since 3.0.0 + * + * @property {string} type - The of the curve + * @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]` + */ diff --git a/src/curves/typedefs/JSONEllipseCurve.js b/src/curves/typedefs/JSONEllipseCurve.js new file mode 100644 index 000000000..4eb249bb4 --- /dev/null +++ b/src/curves/typedefs/JSONEllipseCurve.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Curves.Types.JSONEllipseCurve + * @since 3.0.0 + * + * @property {string} type - The of the curve. + * @property {number} x - The x coordinate of the ellipse. + * @property {number} y - The y coordinate of the ellipse. + * @property {number} xRadius - The horizontal radius of ellipse. + * @property {number} yRadius - The vertical radius of ellipse. + * @property {integer} startAngle - The start angle of the ellipse, in degrees. + * @property {integer} endAngle - The end angle of the ellipse, in degrees. + * @property {boolean} clockwise - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false) + * @property {integer} rotation - The rotation of ellipse, in degrees. + */ diff --git a/src/curves/typedefs/JSONPath.js b/src/curves/typedefs/JSONPath.js new file mode 100644 index 000000000..68f328a3e --- /dev/null +++ b/src/curves/typedefs/JSONPath.js @@ -0,0 +1,10 @@ +/** + * @typedef {object} Phaser.Curves.Types.JSONPath + * @since 3.0.0 + * + * @property {string} type - The of the curve. + * @property {number} x - The X coordinate of the curve's starting point. + * @property {number} y - The Y coordinate of the path's starting point. + * @property {boolean} autoClose - The path is auto closed. + * @property {Phaser.Curves.Types.JSONCurve[]} curves - The list of the curves + */ diff --git a/src/curves/typedefs/index.js b/src/curves/typedefs/index.js new file mode 100644 index 000000000..551d05895 --- /dev/null +++ b/src/curves/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Curves.Types + */ diff --git a/src/data/DataManager.js b/src/data/DataManager.js index 59d7927eb..d62070908 100644 --- a/src/data/DataManager.js +++ b/src/data/DataManager.js @@ -1,10 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); +var Events = require('./events'); /** * @callback DataEachCallback @@ -17,7 +18,7 @@ var Class = require('../utils/Class'); /** * @classdesc - * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * The Data Manager 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. * @@ -239,13 +240,16 @@ var DataManager = new Class({ * When the value is first set, a `setdata` event is emitted. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. * * @method Phaser.Data.DataManager#set + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. @@ -279,6 +283,9 @@ var DataManager = new Class({ * Internal value setter, called automatically by the `set` method. * * @method Phaser.Data.DataManager#setValue + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @private * @since 3.10.0 * @@ -324,8 +331,8 @@ var DataManager = new Class({ var previousValue = list[key]; list[key] = value; - events.emit('changedata', parent, key, value, previousValue); - events.emit('changedata_' + key, parent, value, previousValue); + events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); + events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); } } @@ -333,7 +340,7 @@ var DataManager = new Class({ list[key] = data; - events.emit('setdata', parent, key, data); + events.emit(Events.SET_DATA, parent, key, data); } return this; @@ -378,6 +385,9 @@ var DataManager = new Class({ * will emit a `changedata` event. * * @method Phaser.Data.DataManager#merge + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * * @param {Object.} data - The data to merge. @@ -414,6 +424,7 @@ var DataManager = new Class({ * ``` * * @method Phaser.Data.DataManager#remove + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.0.0 * * @param {(string|string[])} key - The key to remove, or an array of keys to remove. @@ -447,6 +458,7 @@ var DataManager = new Class({ * * @method Phaser.Data.DataManager#removeValue * @private + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.10.0 * * @param {string} key - The key to set the value for. @@ -462,7 +474,7 @@ var DataManager = new Class({ delete this.list[key]; delete this.values[key]; - this.events.emit('removedata', this.parent, key, data); + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); } return this; @@ -472,6 +484,7 @@ var DataManager = new Class({ * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. * * @method Phaser.Data.DataManager#pop + * @fires Phaser.Data.Events#REMOVE_DATA * @since 3.0.0 * * @param {string} key - The key of the value to retrieve and delete. @@ -489,7 +502,7 @@ var DataManager = new Class({ delete this.list[key]; delete this.values[key]; - this.events.emit('removedata', this, key, data); + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); } return data; @@ -562,9 +575,9 @@ var DataManager = new Class({ { this.reset(); - this.events.off('changedata'); - this.events.off('setdata'); - this.events.off('removedata'); + this.events.off(Events.CHANGE_DATA); + this.events.off(Events.SET_DATA); + this.events.off(Events.REMOVE_DATA); this.parent = null; }, diff --git a/src/data/DataManagerPlugin.js b/src/data/DataManagerPlugin.js index 0c261f09e..089f46f02 100644 --- a/src/data/DataManagerPlugin.js +++ b/src/data/DataManagerPlugin.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var DataManager = require('./DataManager'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); /** * @classdesc @@ -50,8 +51,8 @@ var DataManagerPlugin = new Class({ */ this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -66,7 +67,7 @@ var DataManagerPlugin = new Class({ { this.events = this.systems.events; - this.events.once('destroy', this.destroy, this); + this.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -80,7 +81,7 @@ var DataManagerPlugin = new Class({ */ start: function () { - this.events.once('shutdown', this.shutdown, this); + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -93,7 +94,7 @@ var DataManagerPlugin = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -107,7 +108,7 @@ var DataManagerPlugin = new Class({ { DataManager.prototype.destroy.call(this); - this.events.off('start', this.start, this); + this.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/data/events/CHANGE_DATA_EVENT.js b/src/data/events/CHANGE_DATA_EVENT.js new file mode 100644 index 000000000..6ef96e18f --- /dev/null +++ b/src/data/events/CHANGE_DATA_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * a change data event from a Game Object you would use: `sprite.data.on('changedata', listener)`. + * + * This event is dispatched for all items that change in the Data Manager. + * To listen for the change of a specific item, use the `CHANGE_DATA_KEY_EVENT` event. + * + * @event Phaser.Data.Events#CHANGE_DATA + * @since 3.0.0 + * + * @param {any} parent - A reference to the object that the Data Manager responsible for this event belongs to. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The new value of the item in the Data Manager. + * @param {any} previousValue - The previous value of the item in the Data Manager. + */ +module.exports = 'changedata'; diff --git a/src/data/events/CHANGE_DATA_KEY_EVENT.js b/src/data/events/CHANGE_DATA_KEY_EVENT.js new file mode 100644 index 000000000..1dbf768e4 --- /dev/null +++ b/src/data/events/CHANGE_DATA_KEY_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Change Data Key Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the change of a specific data item from a Game Object you would use: `sprite.data.on('changedata-key', listener)`, + * where `key` is the unique string key of the data item. For example, if you have a data item stored called `gold` + * then you can listen for `sprite.data.on('changedata-gold')`. + * + * @event Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.16.1 + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + * @param {any} previousValue - The previous item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'changedata-'; diff --git a/src/data/events/REMOVE_DATA_EVENT.js b/src/data/events/REMOVE_DATA_EVENT.js new file mode 100644 index 000000000..ca8f76fd1 --- /dev/null +++ b/src/data/events/REMOVE_DATA_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Remove Data Event. + * + * This event is dispatched by a Data Manager when an item is removed from it. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the removal of a data item on a Game Object you would use: `sprite.data.on('removedata', listener)`. + * + * @event Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was removed from the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'removedata'; diff --git a/src/data/events/SET_DATA_EVENT.js b/src/data/events/SET_DATA_EVENT.js new file mode 100644 index 000000000..73770f796 --- /dev/null +++ b/src/data/events/SET_DATA_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Set Data Event. + * + * This event is dispatched by a Data Manager when a new item is added to the data store. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the addition of a new data item on a Game Object you would use: `sprite.data.on('setdata', listener)`. + * + * @event Phaser.Data.Events#SET_DATA + * @since 3.0.0 + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'setdata'; diff --git a/src/data/events/index.js b/src/data/events/index.js new file mode 100644 index 000000000..49d59f3b9 --- /dev/null +++ b/src/data/events/index.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data.Events + */ + +module.exports = { + + CHANGE_DATA: require('./CHANGE_DATA_EVENT'), + CHANGE_DATA_KEY: require('./CHANGE_DATA_KEY_EVENT'), + REMOVE_DATA: require('./REMOVE_DATA_EVENT'), + SET_DATA: require('./SET_DATA_EVENT') + +}; diff --git a/src/data/index.js b/src/data/index.js index 4b4d1b707..809580b37 100644 --- a/src/data/index.js +++ b/src/data/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,6 +11,7 @@ module.exports = { DataManager: require('./DataManager'), - DataManagerPlugin: require('./DataManagerPlugin') + DataManagerPlugin: require('./DataManagerPlugin'), + Events: require('./events') }; diff --git a/src/device/Audio.js b/src/device/Audio.js index c9ab6d080..5370cc08c 100644 --- a/src/device/Audio.js +++ b/src/device/Audio.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/device/Browser.js b/src/device/Browser.js index ff56a82ff..17fcc482d 100644 --- a/src/device/Browser.js +++ b/src/device/Browser.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/device/CanvasFeatures.js b/src/device/CanvasFeatures.js index afdf7bf26..4f8bc4788 100644 --- a/src/device/CanvasFeatures.js +++ b/src/device/CanvasFeatures.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/device/Features.js b/src/device/Features.js index f18ae1829..fbf29f7f7 100644 --- a/src/device/Features.js +++ b/src/device/Features.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -78,7 +78,7 @@ function checkIsLittleEndian () function init () { - Features.canvas = !!window['CanvasRenderingContext2D'] || OS.cocoonJS; + Features.canvas = !!window['CanvasRenderingContext2D']; try { @@ -102,11 +102,6 @@ function init () { 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); diff --git a/src/device/Fullscreen.js b/src/device/Fullscreen.js index 060ad34c3..a9688580e 100644 --- a/src/device/Fullscreen.js +++ b/src/device/Fullscreen.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -29,27 +29,30 @@ var Fullscreen = { /** * Checks for support of the Full Screen API. +* +* @ignore */ function init () { var i; - var fs = [ - 'requestFullscreen', - 'requestFullScreen', - 'webkitRequestFullscreen', - 'webkitRequestFullScreen', - 'msRequestFullscreen', - 'msRequestFullScreen', - 'mozRequestFullScreen', - 'mozRequestFullscreen' - ]; + var suffix1 = 'Fullscreen'; + var suffix2 = 'FullScreen'; - var element = document.createElement('div'); + var fs = [ + 'request' + suffix1, + 'request' + suffix2, + 'webkitRequest' + suffix1, + 'webkitRequest' + suffix2, + 'msRequest' + suffix1, + 'msRequest' + suffix2, + 'mozRequest' + suffix2, + 'mozRequest' + suffix1 + ]; for (i = 0; i < fs.length; i++) { - if (element[fs[i]]) + if (document.documentElement[fs[i]]) { Fullscreen.available = true; Fullscreen.request = fs[i]; @@ -58,14 +61,14 @@ function init () } var cfs = [ - 'cancelFullScreen', - 'exitFullscreen', - 'webkitCancelFullScreen', - 'webkitExitFullscreen', - 'msCancelFullScreen', - 'msExitFullscreen', - 'mozCancelFullScreen', - 'mozExitFullscreen' + 'cancel' + suffix2, + 'exit' + suffix1, + 'webkitCancel' + suffix2, + 'webkitExit' + suffix1, + 'msCancel' + suffix2, + 'msExit' + suffix1, + 'mozCancel' + suffix2, + 'mozExit' + suffix1 ]; if (Fullscreen.available) @@ -81,11 +84,14 @@ function init () } // Keyboard Input? - if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT']) + // Safari 5.1 says it supports fullscreen keyboard, but is lying. + if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT'] && !(/ Version\/5\.1(?:\.\d+)? Safari\//).test(navigator.userAgent)) { Fullscreen.keyboard = true; } + Object.defineProperty(Fullscreen, 'active', { get: function () { return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } }); + return Fullscreen; } diff --git a/src/device/Input.js b/src/device/Input.js index 4a4e3ed8e..6bdbebfdf 100644 --- a/src/device/Input.js +++ b/src/device/Input.js @@ -1,10 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = require('./OS'); var Browser = require('./Browser'); /** @@ -47,24 +46,21 @@ function init () Input.gamepads = true; } - if (!OS.cocoonJS) + // See https://developer.mozilla.org/en-US/docs/Web/Events/wheel + if ('onwheel' in window || (Browser.ie && 'WheelEvent' in window)) { - // See https://developer.mozilla.org/en-US/docs/Web/Events/wheel - if ('onwheel' in window || (Browser.ie && 'WheelEvent' in window)) - { - // DOM3 Wheel Event: FF 17+, IE 9+, Chrome 31+, Safari 7+ - Input.wheelEvent = 'wheel'; - } - else if ('onmousewheel' in window) - { - // Non-FF legacy: IE 6-9, Chrome 1-31, Safari 5-7. - Input.wheelEvent = 'mousewheel'; - } - else if (Browser.firefox && 'MouseScrollEvent' in window) - { - // FF prior to 17. This should probably be scrubbed. - Input.wheelEvent = 'DOMMouseScroll'; - } + // DOM3 Wheel Event: FF 17+, IE 9+, Chrome 31+, Safari 7+ + Input.wheelEvent = 'wheel'; + } + else if ('onmousewheel' in window) + { + // Non-FF legacy: IE 6-9, Chrome 1-31, Safari 5-7. + Input.wheelEvent = 'mousewheel'; + } + else if (Browser.firefox && 'MouseScrollEvent' in window) + { + // FF prior to 17. This should probably be scrubbed. + Input.wheelEvent = 'DOMMouseScroll'; } return Input; diff --git a/src/device/OS.js b/src/device/OS.js index 9cbe11aca..195d260d8 100644 --- a/src/device/OS.js +++ b/src/device/OS.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,8 +15,6 @@ * * @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? @@ -40,8 +38,6 @@ var OS = { android: false, chromeOS: false, - cocoonJS: false, - cocoonJSApp: false, cordova: false, crosswalk: false, desktop: false, @@ -151,20 +147,6 @@ function init () 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; diff --git a/src/device/Video.js b/src/device/Video.js index 7cd90c50a..eb18934eb 100644 --- a/src/device/Video.js +++ b/src/device/Video.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/device/index.js b/src/device/index.js index c68305a90..b786a75dd 100644 --- a/src/device/index.js +++ b/src/device/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/const.js b/src/display/align/const.js index fc8a2f33f..3d90de464 100644 --- a/src/display/align/const.js +++ b/src/display/align/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/BottomCenter.js b/src/display/align/in/BottomCenter.js index a8dd75e57..979a9e4b5 100644 --- a/src/display/align/in/BottomCenter.js +++ b/src/display/align/in/BottomCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/BottomLeft.js b/src/display/align/in/BottomLeft.js index 4d227916a..aaa0422dd 100644 --- a/src/display/align/in/BottomLeft.js +++ b/src/display/align/in/BottomLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/BottomRight.js b/src/display/align/in/BottomRight.js index 786b679d8..22c51970d 100644 --- a/src/display/align/in/BottomRight.js +++ b/src/display/align/in/BottomRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/Center.js b/src/display/align/in/Center.js index a90e9c569..77ecca3ed 100644 --- a/src/display/align/in/Center.js +++ b/src/display/align/in/Center.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/LeftCenter.js b/src/display/align/in/LeftCenter.js index 87a36ff1d..5441cc16e 100644 --- a/src/display/align/in/LeftCenter.js +++ b/src/display/align/in/LeftCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/QuickSet.js b/src/display/align/in/QuickSet.js index 2dddce5ff..d8f93d728 100644 --- a/src/display/align/in/QuickSet.js +++ b/src/display/align/in/QuickSet.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/RightCenter.js b/src/display/align/in/RightCenter.js index b7cc8a311..305b07d02 100644 --- a/src/display/align/in/RightCenter.js +++ b/src/display/align/in/RightCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/TopCenter.js b/src/display/align/in/TopCenter.js index b8e741335..3d3e9e162 100644 --- a/src/display/align/in/TopCenter.js +++ b/src/display/align/in/TopCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/TopLeft.js b/src/display/align/in/TopLeft.js index 361366074..3b73c6390 100644 --- a/src/display/align/in/TopLeft.js +++ b/src/display/align/in/TopLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/TopRight.js b/src/display/align/in/TopRight.js index 0c1fa2933..27d987799 100644 --- a/src/display/align/in/TopRight.js +++ b/src/display/align/in/TopRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/in/index.js b/src/display/align/in/index.js index 76097cb44..e49b3bac8 100644 --- a/src/display/align/in/index.js +++ b/src/display/align/in/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/index.js b/src/display/align/index.js index f9ffd56d3..b45df1cff 100644 --- a/src/display/align/index.js +++ b/src/display/align/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/BottomCenter.js b/src/display/align/to/BottomCenter.js index 53f36f39d..51be44929 100644 --- a/src/display/align/to/BottomCenter.js +++ b/src/display/align/to/BottomCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/BottomLeft.js b/src/display/align/to/BottomLeft.js index 98f4676e5..8caa4f764 100644 --- a/src/display/align/to/BottomLeft.js +++ b/src/display/align/to/BottomLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/BottomRight.js b/src/display/align/to/BottomRight.js index 21a6d2b91..bcd687d5a 100644 --- a/src/display/align/to/BottomRight.js +++ b/src/display/align/to/BottomRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/LeftBottom.js b/src/display/align/to/LeftBottom.js index e30837903..46b05c4e8 100644 --- a/src/display/align/to/LeftBottom.js +++ b/src/display/align/to/LeftBottom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/LeftCenter.js b/src/display/align/to/LeftCenter.js index a2fe0ab98..895859b91 100644 --- a/src/display/align/to/LeftCenter.js +++ b/src/display/align/to/LeftCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/LeftTop.js b/src/display/align/to/LeftTop.js index 906ca7e25..fb0565eed 100644 --- a/src/display/align/to/LeftTop.js +++ b/src/display/align/to/LeftTop.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/RightBottom.js b/src/display/align/to/RightBottom.js index 409f5c921..a7637a16c 100644 --- a/src/display/align/to/RightBottom.js +++ b/src/display/align/to/RightBottom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/RightCenter.js b/src/display/align/to/RightCenter.js index 167fbd879..4165bb957 100644 --- a/src/display/align/to/RightCenter.js +++ b/src/display/align/to/RightCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/RightTop.js b/src/display/align/to/RightTop.js index fd1f1b131..142389a5d 100644 --- a/src/display/align/to/RightTop.js +++ b/src/display/align/to/RightTop.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/TopCenter.js b/src/display/align/to/TopCenter.js index c5991a8c9..302a3f968 100644 --- a/src/display/align/to/TopCenter.js +++ b/src/display/align/to/TopCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/TopLeft.js b/src/display/align/to/TopLeft.js index c8f1208c1..72c8e8319 100644 --- a/src/display/align/to/TopLeft.js +++ b/src/display/align/to/TopLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/TopRight.js b/src/display/align/to/TopRight.js index 83151e677..98db72b92 100644 --- a/src/display/align/to/TopRight.js +++ b/src/display/align/to/TopRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/align/to/index.js b/src/display/align/to/index.js index 914810b7e..18aceb8b2 100644 --- a/src/display/align/to/index.js +++ b/src/display/align/to/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/CenterOn.js b/src/display/bounds/CenterOn.js index 5f1e64020..3b629a67d 100644 --- a/src/display/bounds/CenterOn.js +++ b/src/display/bounds/CenterOn.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetBottom.js b/src/display/bounds/GetBottom.js index 5d62ed2d5..3a840f045 100644 --- a/src/display/bounds/GetBottom.js +++ b/src/display/bounds/GetBottom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetCenterX.js b/src/display/bounds/GetCenterX.js index b8f90d31c..d9cdc1574 100644 --- a/src/display/bounds/GetCenterX.js +++ b/src/display/bounds/GetCenterX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetCenterY.js b/src/display/bounds/GetCenterY.js index 9bc2083ba..91713861b 100644 --- a/src/display/bounds/GetCenterY.js +++ b/src/display/bounds/GetCenterY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetLeft.js b/src/display/bounds/GetLeft.js index 88f42b523..239e821d9 100644 --- a/src/display/bounds/GetLeft.js +++ b/src/display/bounds/GetLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetOffsetX.js b/src/display/bounds/GetOffsetX.js index 0881891a2..b921ec470 100644 --- a/src/display/bounds/GetOffsetX.js +++ b/src/display/bounds/GetOffsetX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetOffsetY.js b/src/display/bounds/GetOffsetY.js index 379ca9413..c777c3315 100644 --- a/src/display/bounds/GetOffsetY.js +++ b/src/display/bounds/GetOffsetY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetRight.js b/src/display/bounds/GetRight.js index ea879523a..0024d3020 100644 --- a/src/display/bounds/GetRight.js +++ b/src/display/bounds/GetRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/GetTop.js b/src/display/bounds/GetTop.js index 4ee77ada8..19610275b 100644 --- a/src/display/bounds/GetTop.js +++ b/src/display/bounds/GetTop.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/SetBottom.js b/src/display/bounds/SetBottom.js index f0d7ffa4e..99611d0b2 100644 --- a/src/display/bounds/SetBottom.js +++ b/src/display/bounds/SetBottom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/SetCenterX.js b/src/display/bounds/SetCenterX.js index 7d6bdd17c..d6cf64fe0 100644 --- a/src/display/bounds/SetCenterX.js +++ b/src/display/bounds/SetCenterX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/SetCenterY.js b/src/display/bounds/SetCenterY.js index d282f2801..8938bf381 100644 --- a/src/display/bounds/SetCenterY.js +++ b/src/display/bounds/SetCenterY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/SetLeft.js b/src/display/bounds/SetLeft.js index 377a8cad3..9d0cc84ed 100644 --- a/src/display/bounds/SetLeft.js +++ b/src/display/bounds/SetLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/SetRight.js b/src/display/bounds/SetRight.js index 4b026f12e..2b071a29e 100644 --- a/src/display/bounds/SetRight.js +++ b/src/display/bounds/SetRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/SetTop.js b/src/display/bounds/SetTop.js index 23b054dc3..088b5cd42 100644 --- a/src/display/bounds/SetTop.js +++ b/src/display/bounds/SetTop.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/bounds/index.js b/src/display/bounds/index.js index 859662dd3..ea6bb2aa6 100644 --- a/src/display/bounds/index.js +++ b/src/display/bounds/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/canvas/CanvasInterpolation.js b/src/display/canvas/CanvasInterpolation.js index ac7160c5b..d7addb1c7 100644 --- a/src/display/canvas/CanvasInterpolation.js +++ b/src/display/canvas/CanvasInterpolation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/canvas/CanvasPool.js b/src/display/canvas/CanvasPool.js index 1c4e23856..dd201c67e 100644 --- a/src/display/canvas/CanvasPool.js +++ b/src/display/canvas/CanvasPool.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/canvas/Smoothing.js b/src/display/canvas/Smoothing.js index f85e21c96..29975281d 100644 --- a/src/display/canvas/Smoothing.js +++ b/src/display/canvas/Smoothing.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/canvas/TouchAction.js b/src/display/canvas/TouchAction.js index 7ecd4a3f7..cb5e7c8aa 100644 --- a/src/display/canvas/TouchAction.js +++ b/src/display/canvas/TouchAction.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/canvas/UserSelect.js b/src/display/canvas/UserSelect.js index 4e8b5ac1d..4301da902 100644 --- a/src/display/canvas/UserSelect.js +++ b/src/display/canvas/UserSelect.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/canvas/index.js b/src/display/canvas/index.js index e01a74626..3b8482a15 100644 --- a/src/display/canvas/index.js +++ b/src/display/canvas/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/Color.js b/src/display/color/Color.js index bdb25d499..80c0e2e6c 100644 --- a/src/display/color/Color.js +++ b/src/display/color/Color.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,6 +10,10 @@ var GetColor32 = require('./GetColor32'); var HSVToRGB = require('./HSVToRGB'); var RGBToHSV = require('./RGBToHSV'); +/** + * @namespace Phaser.Display.Color + */ + /** * @classdesc * The Color class holds a single color value and allows for easy modification and reading of it. @@ -258,7 +262,7 @@ var Color = new Class({ * @method Phaser.Display.Color#setFromRGB * @since 3.0.0 * - * @param {InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255. + * @param {Phaser.Display.Types.InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255. * * @return {Phaser.Display.Color} This Color object. */ diff --git a/src/display/color/ColorToRGBA.js b/src/display/color/ColorToRGBA.js index 60044a7aa..5c9fd4740 100644 --- a/src/display/color/ColorToRGBA.js +++ b/src/display/color/ColorToRGBA.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,7 +12,7 @@ * * @param {number} color - A color value, optionally including the alpha value. * - * @return {ColorObject} An object containing the parsed color values. + * @return {Phaser.Display.Types.ColorObject} An object containing the parsed color values. */ var ColorToRGBA = function (color) { diff --git a/src/display/color/ComponentToHex.js b/src/display/color/ComponentToHex.js index ec3f125a6..66e3ad97e 100644 --- a/src/display/color/ComponentToHex.js +++ b/src/display/color/ComponentToHex.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/GetColor.js b/src/display/color/GetColor.js index 8b25b9d4e..1dfd35410 100644 --- a/src/display/color/GetColor.js +++ b/src/display/color/GetColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/GetColor32.js b/src/display/color/GetColor32.js index 8f3a13a4f..f4a664f2c 100644 --- a/src/display/color/GetColor32.js +++ b/src/display/color/GetColor32.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/HSLToColor.js b/src/display/color/HSLToColor.js index 6ede1fdd5..4d2252add 100644 --- a/src/display/color/HSLToColor.js +++ b/src/display/color/HSLToColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/HSVColorWheel.js b/src/display/color/HSVColorWheel.js index db1bac2cc..b0a39a57c 100644 --- a/src/display/color/HSVColorWheel.js +++ b/src/display/color/HSVColorWheel.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var HSVToRGB = require('./HSVToRGB'); * @param {number} [s=1] - The saturation, in the range 0 - 1. * @param {number} [v=1] - The value, in the range 0 - 1. * - * @return {ColorObject[]} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. + * @return {Phaser.Display.Types.ColorObject[]} 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) { diff --git a/src/display/color/HSVToRGB.js b/src/display/color/HSVToRGB.js index 84e7c63cb..aa2530e69 100644 --- a/src/display/color/HSVToRGB.js +++ b/src/display/color/HSVToRGB.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,9 +18,9 @@ var GetColor = require('./GetColor'); * @param {number} h - The hue, in the range 0 - 1. This is the base color. * @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. * @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black. - * @param {(ColorObject|Phaser.Display.Color)} [out] - A Color object to store the results in. If not given a new ColorObject will be created. + * @param {(Phaser.Display.Types.ColorObject|Phaser.Display.Color)} [out] - A Color object to store the results in. If not given a new ColorObject will be created. * - * @return {(ColorObject|Phaser.Display.Color)} An object with the red, green and blue values set in the r, g and b properties. + * @return {(Phaser.Display.Types.ColorObject|Phaser.Display.Color)} An object with the red, green and blue values set in the r, g and b properties. */ var HSVToRGB = function (h, s, v, out) { diff --git a/src/display/color/HexStringToColor.js b/src/display/color/HexStringToColor.js index ebace58db..6cf62ce0c 100644 --- a/src/display/color/HexStringToColor.js +++ b/src/display/color/HexStringToColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/HueToComponent.js b/src/display/color/HueToComponent.js index adca7ffba..d5f9009ac 100644 --- a/src/display/color/HueToComponent.js +++ b/src/display/color/HueToComponent.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/IntegerToColor.js b/src/display/color/IntegerToColor.js index 0ccb44e89..368006c81 100644 --- a/src/display/color/IntegerToColor.js +++ b/src/display/color/IntegerToColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/IntegerToRGB.js b/src/display/color/IntegerToRGB.js index 37e48e6b9..1d9fef43b 100644 --- a/src/display/color/IntegerToRGB.js +++ b/src/display/color/IntegerToRGB.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,7 +14,7 @@ * * @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. + * @return {Phaser.Display.Types.ColorObject} An object with the red, green and blue values set in the r, g and b properties. */ var IntegerToRGB = function (color) { diff --git a/src/display/color/Interpolate.js b/src/display/color/Interpolate.js index 06f2dcfa8..803d09db5 100644 --- a/src/display/color/Interpolate.js +++ b/src/display/color/Interpolate.js @@ -1,15 +1,14 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Linear = require('../../math/Linear'); /** - * Interpolates color values - * * @namespace Phaser.Display.Color.Interpolate + * @memberof Phaser.Display.Color * @since 3.0.0 */ @@ -17,6 +16,8 @@ var Linear = require('../../math/Linear'); * Interpolates between the two given color ranges over the length supplied. * * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static * @since 3.0.0 * * @param {number} r1 - Red value. @@ -28,7 +29,7 @@ var Linear = require('../../math/Linear'); * @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. + * @return {Phaser.Display.Types.ColorObject} An object containing the interpolated color values. */ var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) { @@ -48,6 +49,8 @@ var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) * Interpolates between the two given color objects over the length supplied. * * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @memberof Phaser.Display.Color.Interpolate + * @static * @since 3.0.0 * * @param {Phaser.Display.Color} color1 - The first Color object. @@ -55,7 +58,7 @@ var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) * @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. + * @return {Phaser.Display.Types.ColorObject} An object containing the interpolated color values. */ var ColorWithColor = function (color1, color2, length, index) { @@ -69,6 +72,8 @@ var ColorWithColor = function (color1, color2, length, index) * Interpolates between the Color object and color values over the length supplied. * * @function Phaser.Display.Color.Interpolate.ColorWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static * @since 3.0.0 * * @param {Phaser.Display.Color} color1 - The first Color object. @@ -78,7 +83,7 @@ var ColorWithColor = function (color1, color2, length, index) * @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. + * @return {Phaser.Display.Types.ColorObject} An object containing the interpolated color values. */ var ColorWithRGB = function (color, r, g, b, length, index) { diff --git a/src/display/color/ObjectToColor.js b/src/display/color/ObjectToColor.js index fd93fd88b..0d5f87c95 100644 --- a/src/display/color/ObjectToColor.js +++ b/src/display/color/ObjectToColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,7 +12,7 @@ var Color = require('./Color'); * @function Phaser.Display.Color.ObjectToColor * @since 3.0.0 * - * @param {InputColorObject} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. + * @param {Phaser.Display.Types.InputColorObject} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. * * @return {Phaser.Display.Color} A Color object. */ diff --git a/src/display/color/RGBStringToColor.js b/src/display/color/RGBStringToColor.js index 17521867f..75d370caf 100644 --- a/src/display/color/RGBStringToColor.js +++ b/src/display/color/RGBStringToColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/RGBToHSV.js b/src/display/color/RGBToHSV.js index d7f0ef5a8..60797816f 100644 --- a/src/display/color/RGBToHSV.js +++ b/src/display/color/RGBToHSV.js @@ -1,17 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} HSVColorObject - * - * @property {number} h - The hue color value. A number between 0 and 1 - * @property {number} s - The saturation color value. A number between 0 and 1 - * @property {number} v - The lightness color value. A number between 0 and 1 - */ - /** * Converts an RGB color value to HSV (hue, saturation and value). * Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space. @@ -24,9 +16,9 @@ * @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 {(HSVColorObject|Phaser.Display.Color)} [out] - An object to store the color values in. If not given an HSV Color Object will be created. + * @param {(Phaser.Display.Types.HSVColorObject|Phaser.Display.Color)} [out] - An object to store the color values in. If not given an HSV Color Object will be created. * - * @return {(HSVColorObject|Phaser.Display.Color)} An object with the properties `h`, `s` and `v` set. + * @return {(Phaser.Display.Types.HSVColorObject|Phaser.Display.Color)} An object with the properties `h`, `s` and `v` set. */ var RGBToHSV = function (r, g, b, out) { diff --git a/src/display/color/RGBToString.js b/src/display/color/RGBToString.js index 834fb3ea1..8ac968b2d 100644 --- a/src/display/color/RGBToString.js +++ b/src/display/color/RGBToString.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/RandomRGB.js b/src/display/color/RandomRGB.js index f27642df9..5c8d0e9a5 100644 --- a/src/display/color/RandomRGB.js +++ b/src/display/color/RandomRGB.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/color/ValueToColor.js b/src/display/color/ValueToColor.js index dfe110e65..4b590418d 100644 --- a/src/display/color/ValueToColor.js +++ b/src/display/color/ValueToColor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,7 +16,7 @@ var RGBStringToColor = require('./RGBStringToColor'); * @function Phaser.Display.Color.ValueToColor * @since 3.0.0 * - * @param {(string|number|InputColorObject)} input - The source color value to convert. + * @param {(string|number|Phaser.Display.Types.InputColorObject)} input - The source color value to convert. * * @return {Phaser.Display.Color} A Color object. */ diff --git a/src/display/color/index.js b/src/display/color/index.js index b2568cfea..8bfa0132c 100644 --- a/src/display/color/index.js +++ b/src/display/color/index.js @@ -1,26 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} InputColorObject - * - * @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. - */ - -/** - * @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. - */ - var Color = require('./Color'); Color.ColorToRGBA = require('./ColorToRGBA'); diff --git a/src/display/index.js b/src/display/index.js index 749f5e097..a2069cbb8 100644 --- a/src/display/index.js +++ b/src/display/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,5 +15,5 @@ module.exports = { Canvas: require('./canvas'), Color: require('./color'), Masks: require('./mask') - + }; diff --git a/src/display/mask/BitmapMask.js b/src/display/mask/BitmapMask.js index c05829fe1..4b7c74b07 100644 --- a/src/display/mask/BitmapMask.js +++ b/src/display/mask/BitmapMask.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,15 +8,30 @@ var Class = require('../../utils/Class'); /** * @classdesc - * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. Unlike the Geometry Mask, which is a clipping path, a Bitmask Mask behaves like an alpha mask, not a clipping path. It is only available when using the WebGL Renderer. + * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. + * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, + * not a clipping path. It is only available when using the WebGL Renderer. * - * A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the Bitmap Mask doesn't matter. + * A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). + * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha + * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the + * Bitmap Mask doesn't matter. * - * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects. A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the corresponding pixel in the mask. + * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an + * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means + * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects + * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the + * corresponding pixel in the mask. * - * The Bitmap Mask's location matches the location of its Game Object, not the location of the masked objects. Moving or transforming the underlying Game Object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask. + * The Bitmap Mask's location matches the location of its Game Object, not the location of the + * masked objects. Moving or transforming the underlying Game Object will change the mask + * (and affect the visibility of any masked objects), whereas moving or transforming a masked object + * will not affect the mask. * - * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a Scene's display list, it will only be used for the mask and its full texture will not be directly visible. Adding the underlying Game Object to a Scene will not cause any problems - it will render as a normal Game Object and will also serve as a mask. + * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a + * Scene's display list, it will only be used for the mask and its full texture will not be directly + * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will + * render as a normal Game Object and will also serve as a mask. * * @class BitmapMask * @memberof Phaser.Display.Masks diff --git a/src/display/mask/GeometryMask.js b/src/display/mask/GeometryMask.js index 017643949..d2979cfa3 100644 --- a/src/display/mask/GeometryMask.js +++ b/src/display/mask/GeometryMask.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,11 +8,21 @@ var Class = require('../../utils/Class'); /** * @classdesc - * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect a visible pixel from the geometry mask. The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity). - * - * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and alpha of the pixel from the Geometry Mask do not matter. - * - * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. Moving or transforming the underlying Graphics object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask. You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed in front of all masked objects which has its own visual properties and, naturally, respects the camera's visual properties, but isn't affected by and doesn't follow the masked objects by itself. + * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect + * a visible pixel from the geometry mask. The mask is essentially a clipping path which can only + * make a masked pixel fully visible or fully invisible without changing its alpha (opacity). + * + * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) + * should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed + * if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and + * alpha of the pixel from the Geometry Mask do not matter. + * + * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. + * Moving or transforming the underlying Graphics object will change the mask (and affect the visibility + * of any masked objects), whereas moving or transforming a masked object will not affect the mask. + * You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed + * in front of all masked objects which has its own visual properties and, naturally, respects the camera's + * visual properties, but isn't affected by and doesn't follow the masked objects by itself. * * @class GeometryMask * @memberof Phaser.Display.Masks @@ -36,6 +46,16 @@ var GeometryMask = new Class({ * @since 3.0.0 */ this.geometryMask = graphicsGeometry; + + /** + * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels + * drawn to the Geometry Mask. + * + * @name Phaser.Display.Masks.GeometryMask#invertAlpha + * @type {boolean} + * @since 3.16.0 + */ + this.invertAlpha = false; }, /** @@ -77,12 +97,22 @@ var GeometryMask = new Class({ gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); + geometryMask.renderWebGL(renderer, geometryMask, 0, camera); + renderer.flush(); // Use stencil buffer to affect next rendering object gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, 1, 1); + + if (this.invertAlpha) + { + gl.stencilFunc(gl.NOTEQUAL, 1, 1); + } + else + { + gl.stencilFunc(gl.EQUAL, 1, 1); + } + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); }, @@ -140,7 +170,7 @@ var GeometryMask = new Class({ /** * Destroys this GeometryMask and nulls any references it holds. - * + * * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, * so be sure to call `clearMask` on any Game Object using it, before destroying it. * diff --git a/src/display/mask/index.js b/src/display/mask/index.js index 2a2802661..17a360bf8 100644 --- a/src/display/mask/index.js +++ b/src/display/mask/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/display/typedefs/ColorObject.js b/src/display/typedefs/ColorObject.js new file mode 100644 index 000000000..eb81e626a --- /dev/null +++ b/src/display/typedefs/ColorObject.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Display.Types.ColorObject + * @since 3.0.0 + * + * @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. + */ diff --git a/src/display/typedefs/HSVColorObject.js b/src/display/typedefs/HSVColorObject.js new file mode 100644 index 000000000..e2f645ffd --- /dev/null +++ b/src/display/typedefs/HSVColorObject.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Display.Types.HSVColorObject + * @since 3.0.0 + * + * @property {number} h - The hue color value. A number between 0 and 1 + * @property {number} s - The saturation color value. A number between 0 and 1 + * @property {number} v - The lightness color value. A number between 0 and 1 + */ diff --git a/src/display/typedefs/InputColorObject.js b/src/display/typedefs/InputColorObject.js new file mode 100644 index 000000000..26ad68b53 --- /dev/null +++ b/src/display/typedefs/InputColorObject.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Display.Types.InputColorObject + * @since 3.0.0 + * + * @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. + */ diff --git a/src/display/typedefs/index.js b/src/display/typedefs/index.js new file mode 100644 index 000000000..b25505407 --- /dev/null +++ b/src/display/typedefs/index.js @@ -0,0 +1,3 @@ +/** + * @namespace Phaser.Display.Types + */ diff --git a/src/dom/AddToDOM.js b/src/dom/AddToDOM.js index 934887b14..92b7b1ec3 100644 --- a/src/dom/AddToDOM.js +++ b/src/dom/AddToDOM.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,14 +13,11 @@ * * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. * @param {(string|HTMLElement)} [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] - Whether or not to hide overflowing content inside the parent. * * @return {HTMLElement} The element that was added to the DOM. */ -var AddToDOM = function (element, parent, overflowHidden) +var AddToDOM = function (element, parent) { - if (overflowHidden === undefined) { overflowHidden = true; } - var target; if (parent) @@ -47,11 +44,6 @@ var AddToDOM = function (element, parent, overflowHidden) target = document.body; } - if (overflowHidden && target.style) - { - target.style.overflow = 'hidden'; - } - target.appendChild(element); return element; diff --git a/src/dom/Calibrate.js b/src/dom/Calibrate.js deleted file mode 100644 index bc3395262..000000000 --- a/src/dom/Calibrate.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Calibrate = function (coords, cushion) -{ - if (cushion === undefined) { cushion = 0; } - - var output = { - width: 0, - height: 0, - left: 0, - right: 0, - top: 0, - bottom: 0 - }; - - output.width = (output.right = coords.right + cushion) - (output.left = coords.left - cushion); - output.height = (output.bottom = coords.bottom + cushion) - (output.top = coords.top - cushion); - - return output; -}; - -module.exports = Calibrate; diff --git a/src/dom/ClientHeight.js b/src/dom/ClientHeight.js deleted file mode 100644 index 614bc6337..000000000 --- a/src/dom/ClientHeight.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var ClientHeight = function () -{ - return Math.max(window.innerHeight, document.documentElement.clientHeight); -}; - -module.exports = ClientHeight; diff --git a/src/dom/ClientWidth.js b/src/dom/ClientWidth.js deleted file mode 100644 index a3d94709d..000000000 --- a/src/dom/ClientWidth.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var ClientWidth = function () -{ - return Math.max(window.innerWidth, document.documentElement.clientWidth); -}; - -module.exports = ClientWidth; diff --git a/src/boot/CreateDOMContainer.js b/src/dom/CreateDOMContainer.js similarity index 95% rename from src/boot/CreateDOMContainer.js rename to src/dom/CreateDOMContainer.js index 923d689e5..645d693b9 100644 --- a/src/boot/CreateDOMContainer.js +++ b/src/dom/CreateDOMContainer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/dom/DOMContentLoaded.js b/src/dom/DOMContentLoaded.js index 9cf51deb0..2a240fb54 100644 --- a/src/dom/DOMContentLoaded.js +++ b/src/dom/DOMContentLoaded.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -42,7 +42,7 @@ var DOMContentLoaded = function (callback) { window.setTimeout(check, 20); } - else if (OS.cordova && !OS.cocoonJS) + else if (OS.cordova) { // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready document.addEventListener('deviceready', check, false); diff --git a/src/dom/DocumentBounds.js b/src/dom/DocumentBounds.js deleted file mode 100644 index 89a2680a8..000000000 --- a/src/dom/DocumentBounds.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = require('../utils/Class'); -var Rectangle = require('../geom/rectangle/Rectangle'); - -var DocumentBounds = new Class({ - - Extends: Rectangle, - - initialize: - - function DocumentBounds () - { - Rectangle.call(this); - }, - - width: { - get: function () - { - var d = document.documentElement; - - return Math.max(d.clientWidth, d.offsetWidth, d.scrollWidth); - } - }, - - height: { - get: function () - { - var d = document.documentElement; - - return Math.max(d.clientHeight, d.offsetHeight, d.scrollHeight); - } - } - -}); - -module.exports = new DocumentBounds(); diff --git a/src/dom/GetAspectRatio.js b/src/dom/GetAspectRatio.js deleted file mode 100644 index 347076009..000000000 --- a/src/dom/GetAspectRatio.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetBounds = require('./GetBounds'); -var VisualBounds = require('./VisualBounds'); - -var GetAspectRatio = function (object) -{ - object = (object === null) ? VisualBounds : (object.nodeType === 1) ? GetBounds(object) : object; - - var w = object.width; - var h = object.height; - - if (typeof w === 'function') - { - w = w.call(object); - } - - if (typeof h === 'function') - { - h = h.call(object); - } - - return w / h; -}; - -module.exports = GetAspectRatio; diff --git a/src/dom/GetBounds.js b/src/dom/GetBounds.js deleted file mode 100644 index 697ab4004..000000000 --- a/src/dom/GetBounds.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Calibrate = require('./Calibrate'); - -var GetBounds = function (element, cushion) -{ - if (cushion === undefined) { cushion = 0; } - - element = (element && !element.nodeType) ? element[0] : element; - - if (!element || element.nodeType !== 1) - { - return false; - } - else - { - return Calibrate(element.getBoundingClientRect(), cushion); - } -}; - -module.exports = GetBounds; diff --git a/src/dom/GetInnerHeight.js b/src/dom/GetInnerHeight.js new file mode 100644 index 000000000..c3f15f3b5 --- /dev/null +++ b/src/dom/GetInnerHeight.js @@ -0,0 +1,53 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Attempts to determine the document inner height across iOS and standard devices. + * Based on code by @tylerjpeterson + * + * @function Phaser.DOM.GetInnerHeight + * @since 3.16.0 + * + * @param {boolean} iOS - Is this running on iOS? + * + * @return {number} The inner height value. + */ +var GetInnerHeight = function (iOS) +{ + + if (!iOS) + { + return window.innerHeight; + } + + var axis = Math.abs(window.orientation); + + var size = { w: 0, h: 0 }; + + var ruler = document.createElement('div'); + + ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); + + document.documentElement.appendChild(ruler); + + size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; + size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; + + document.documentElement.removeChild(ruler); + + ruler = null; + + if (Math.abs(window.orientation) !== 90) + { + return size.h; + } + else + { + return size.w; + } +}; + +module.exports = GetInnerHeight; diff --git a/src/dom/GetOffset.js b/src/dom/GetOffset.js deleted file mode 100644 index 9e21f4ce9..000000000 --- a/src/dom/GetOffset.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Vec2 = require('../math/Vector2'); -var VisualBounds = require('./VisualBounds'); - -var GetOffset = function (element, point) -{ - if (point === undefined) { point = new Vec2(); } - - var box = element.getBoundingClientRect(); - - var scrollTop = VisualBounds.y; - var scrollLeft = VisualBounds.x; - - var clientTop = document.documentElement.clientTop; - var clientLeft = document.documentElement.clientLeft; - - point.x = box.left + scrollLeft - clientLeft; - point.y = box.top + scrollTop - clientTop; - - return point; -}; - -module.exports = GetOffset; diff --git a/src/dom/GetScreenOrientation.js b/src/dom/GetScreenOrientation.js index e1961a89b..7e8d6a8f8 100644 --- a/src/dom/GetScreenOrientation.js +++ b/src/dom/GetScreenOrientation.js @@ -1,15 +1,26 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var VisualBounds = require('./VisualBounds'); +var CONST = require('../scale/const'); -var GetScreenOrientation = function (primaryFallback) +/** + * Attempts to determine the screen orientation using the Orientation API. + * + * @function Phaser.DOM.GetScreenOrientation + * @since 3.16.0 + * + * @param {number} width - The width of the viewport. + * @param {number} height - The height of the viewport. + * + * @return {string} The orientation. + */ +var GetScreenOrientation = function (width, height) { var screen = window.screen; - var orientation = screen.orientation || screen.mozOrientation || screen.msOrientation; + var orientation = (screen) ? screen.orientation || screen.mozOrientation || screen.msOrientation : false; if (orientation && typeof orientation.type === 'string') { @@ -22,35 +33,28 @@ var GetScreenOrientation = function (primaryFallback) return orientation; } - var PORTRAIT = 'portrait-primary'; - var LANDSCAPE = 'landscape-primary'; - - if (primaryFallback === 'screen') + if (screen) { - return (screen.height > screen.width) ? PORTRAIT : LANDSCAPE; + return (screen.height > screen.width) ? CONST.PORTRAIT : CONST.LANDSCAPE; } - else if (primaryFallback === 'viewport') - { - return (VisualBounds.height > VisualBounds.width) ? PORTRAIT : LANDSCAPE; - } - else if (primaryFallback === 'window.orientation' && typeof window.orientation === 'number') + else if (typeof window.orientation === 'number') { // This may change by device based on "natural" orientation. - return (window.orientation === 0 || window.orientation === 180) ? PORTRAIT : LANDSCAPE; + return (window.orientation === 0 || window.orientation === 180) ? CONST.PORTRAIT : CONST.LANDSCAPE; } else if (window.matchMedia) { if (window.matchMedia('(orientation: portrait)').matches) { - return PORTRAIT; + return CONST.PORTRAIT; } else if (window.matchMedia('(orientation: landscape)').matches) { - return LANDSCAPE; + return CONST.LANDSCAPE; } } - - return (VisualBounds.height > VisualBounds.width) ? PORTRAIT : LANDSCAPE; + + return (height > width) ? CONST.PORTRAIT : CONST.LANDSCAPE; }; module.exports = GetScreenOrientation; diff --git a/src/dom/GetTarget.js b/src/dom/GetTarget.js new file mode 100644 index 000000000..c1caae482 --- /dev/null +++ b/src/dom/GetTarget.js @@ -0,0 +1,45 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Attempts to get the target DOM element based on the given value, which can be either + * a string, in which case it will be looked-up by ID, or an element node. If nothing + * can be found it will return a reference to the document.body. + * + * @function Phaser.DOM.GetTarget + * @since 3.16.0 + * + * @param {HTMLElement} element - The DOM element to look-up. + */ +var GetTarget = function (element) +{ + var target; + + if (element !== '') + { + if (typeof element === 'string') + { + // Hopefully an element ID + target = document.getElementById(element); + } + else if (element && element.nodeType === 1) + { + // Quick test for a HTMLElement + target = element; + } + } + + // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. + if (!target) + { + // Use the full window + target = document.body; + } + + return target; +}; + +module.exports = GetTarget; diff --git a/src/dom/InLayoutViewport.js b/src/dom/InLayoutViewport.js deleted file mode 100644 index 6b7de36b5..000000000 --- a/src/dom/InLayoutViewport.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetBounds = require('./GetBounds'); -var LayoutBounds = require('./LayoutBounds'); - -var InLayoutViewport = function (element, cushion) -{ - var r = GetBounds(element, cushion); - - return !!r && r.bottom >= 0 && r.right >= 0 && r.top <= LayoutBounds.width && r.left <= LayoutBounds.height; -}; - -module.exports = InLayoutViewport; diff --git a/src/dom/LayoutBounds.js b/src/dom/LayoutBounds.js deleted file mode 100644 index ef710b57f..000000000 --- a/src/dom/LayoutBounds.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = require('../utils/Class'); -var ClientHeight = require('./ClientHeight'); -var ClientWidth = require('./ClientWidth'); -var Rectangle = require('../geom/rectangle/Rectangle'); - -var LayoutBounds = new Class({ - - Extends: Rectangle, - - initialize: - - function LayoutBounds () - { - Rectangle.call(this); - }, - - init: function (isDesktop) - { - if (isDesktop) - { - Object.defineProperty(this, 'width', { get: ClientWidth }); - Object.defineProperty(this, 'height', { get: ClientHeight }); - } - else - { - Object.defineProperty(this, 'width', { - get: function () - { - var a = document.documentElement.clientWidth; - var b = window.innerWidth; - - return a < b ? b : a; // max - } - }); - - Object.defineProperty(this, 'height', { - get: function () - { - var a = document.documentElement.clientHeight; - var b = window.innerHeight; - - return a < b ? b : a; // max - } - }); - } - } - -}); - -module.exports = new LayoutBounds(); diff --git a/src/dom/ParseXML.js b/src/dom/ParseXML.js index 6278b1320..1db1cddfd 100644 --- a/src/dom/ParseXML.js +++ b/src/dom/ParseXML.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/dom/RemoveFromDOM.js b/src/dom/RemoveFromDOM.js index e13d2bca8..243b929bf 100644 --- a/src/dom/RemoveFromDOM.js +++ b/src/dom/RemoveFromDOM.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/dom/RequestAnimationFrame.js b/src/dom/RequestAnimationFrame.js index e101a0e8c..43f8eae28 100644 --- a/src/dom/RequestAnimationFrame.js +++ b/src/dom/RequestAnimationFrame.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/dom/ScaleManager.js b/src/dom/ScaleManager.js deleted file mode 100644 index e73061802..000000000 --- a/src/dom/ScaleManager.js +++ /dev/null @@ -1,387 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = require('../utils/Class'); -var CONST = require('./const'); -var NOOP = require('../utils/NOOP'); -var Rectangle = require('../geom/rectangle/Rectangle'); -var Size = require('../structs/Size'); -var SnapFloor = require('../math/snap/SnapFloor'); -var Vec2 = require('../math/Vector2'); - -/** - * @classdesc - * TODO - * - * @class ScaleManager - * @memberof Phaser.DOM - * @constructor - * @since 3.15.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance. - * @param {any} config - */ -var ScaleManager = new Class({ - - initialize: - - function ScaleManager (game) - { - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.DOM.ScaleManager#game - * @type {Phaser.Game} - * @readonly - * @since 3.15.0 - */ - this.game = game; - - this.scaleMode = 0; - - // The base game size, as requested in the game config - this.gameSize = new Size(); - - // The canvas size, which is the base game size * zoom * resolution - this.canvasSize = new Size(); - - // this.width = 0; - // this.height = 0; - - // this.canvasWidth = 0; - // this.canvasHeight = 0; - - this.resolution = 1; - this.zoom = 1; - - // The actual displayed canvas size (after refactoring in CSS depending on the scale mode, parent, etc) - this.displaySize = new Size(); - - // this.displayWidth = 0; - // this.displayHeight = 0; - - // The scale factor between the base game size and the displayed size - this.scale = new Vec2(1); - - this.parent; - this.parentIsWindow; - this.parentScale = new Vec2(1); - this.parentBounds = new Rectangle(); - - this.minSize = new Vec2(); - this.maxSize = new Vec2(); - - this.trackParent = false; - this.canExpandParent = false; - - this.allowFullScreen = false; - - this.snap = new Vec2(1, 1); - - this.listeners = { - - orientationChange: NOOP, - windowResize: NOOP, - fullScreenChange: NOOP, - fullScreenError: NOOP - - }; - - }, - - preBoot: function () - { - // Parse the config to get the scaling values we need - // console.log('preBoot'); - - this.setParent(this.game.config.parent); - - this.parseConfig(this.game.config); - - this.game.events.once('boot', this.boot, this); - }, - - boot: function () - { - // console.log('boot'); - - this.setScaleMode(this.scaleMode); - - this.game.events.on('prestep', this.step, this); - }, - - parseConfig: function (config) - { - var width = config.width; - var height = config.height; - var resolution = config.resolution; - var scaleMode = config.scaleMode; - var zoom = config.zoom; - - if (typeof width === 'string') - { - this.parentScale.x = parseInt(width, 10) / 100; - width = this.parentBounds.width * this.parentScale.x; - } - - if (typeof height === 'string') - { - this.parentScale.y = parseInt(height, 10) / 100; - height = this.parentBounds.height * this.parentScale.y; - } - - this.width = width; - this.height = height; - - this.canvasWidth = (width * zoom) * resolution; - this.canvasHeight = (height * zoom) * resolution; - - this.resolution = resolution; - - this.zoom = zoom; - - this.canExpandParent = config.expandParent; - - this.scaleMode = scaleMode; - - // console.log(config); - - this.minSize.set(config.minWidth, config.minHeight); - this.maxSize.set(config.maxWidth, config.maxHeight); - }, - - setScaleMode: function (scaleMode) - { - this.scaleMode = scaleMode; - - if (scaleMode === CONST.EXACT) - { - return; - } - - var canvas = this.game.canvas; - var gameStyle = canvas.style; - - var parent = this.parent; - var parentStyle = parent.style; - - - switch (scaleMode) - { - case CONST.FILL: - - gameStyle.objectFit = 'fill'; - gameStyle.width = '100%'; - gameStyle.height = '100%'; - - if (this.canExpandParent) - { - parentStyle.height = '100%'; - - if (this.parentIsWindow) - { - document.getElementsByTagName('html')[0].style.height = '100%'; - } - } - - break; - - case CONST.CONTAIN: - - gameStyle.objectFit = 'contain'; - gameStyle.width = '100%'; - gameStyle.height = '100%'; - - if (this.canExpandParent) - { - parentStyle.height = '100%'; - - if (this.parentIsWindow) - { - document.getElementsByTagName('html')[0].style.height = '100%'; - } - } - - break; - } - - var min = this.minSize; - var max = this.maxSize; - - if (min.x > 0) - { - gameStyle.minWidth = min.x.toString() + 'px'; - } - - if (min.y > 0) - { - gameStyle.minHeight = min.y.toString() + 'px'; - } - - if (max.x > 0) - { - gameStyle.maxWidth = max.x.toString() + 'px'; - } - - if (max.y > 0) - { - gameStyle.maxHeight = max.y.toString() + 'px'; - } - }, - - setParent: function (parent) - { - var target; - - if (parent !== '') - { - if (typeof parent === 'string') - { - // Hopefully an element ID - target = document.getElementById(parent); - } - else if (parent && parent.nodeType === 1) - { - // Quick test for a HTMLElement - target = parent; - } - } - - // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. - if (!target) - { - // Use the full window - this.parent = document.body; - this.parentIsWindow = true; - } - else - { - this.parent = target; - this.parentIsWindow = false; - } - - this.getParentBounds(); - }, - - getParentBounds: function () - { - var DOMRect = this.parent.getBoundingClientRect(); - - this.parentBounds.setSize(DOMRect.width, DOMRect.height); - }, - - startListeners: function () - { - var _this = this; - var listeners = this.listeners; - - listeners.orientationChange = function (event) - { - return _this.onOrientationChange(event); - }; - - listeners.windowResize = function (event) - { - return _this.onWindowResize(event); - }; - - window.addEventListener('orientationchange', listeners.orientationChange, false); - window.addEventListener('resize', listeners.windowResize, false); - - if (this.allowFullScreen) - { - listeners.fullScreenChange = function (event) - { - return _this.onFullScreenChange(event); - }; - - listeners.fullScreenError = function (event) - { - return _this.onFullScreenError(event); - }; - - var vendors = [ 'webkit', 'moz', '' ]; - - vendors.forEach(function (prefix) - { - document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); - document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); - }); - - // MS Specific - document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); - document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); - } - }, - - getInnerHeight: function () - { - // Based on code by @tylerjpeterson - - if (!this.game.device.os.iOS) - { - return window.innerHeight; - } - - var axis = Math.abs(window.orientation); - - var size = { w: 0, h: 0 }; - - var ruler = document.createElement('div'); - - ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); - - document.documentElement.appendChild(ruler); - - size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; - size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; - - document.documentElement.removeChild(ruler); - - ruler = null; - - if (Math.abs(window.orientation) !== 90) - { - return size.h; - } - else - { - return size.w; - } - }, - - step: function () - { - // canvas.clientWidth and clientHeight = canvas size when scaled with 100% object-fit, ignoring borders, margin, etc - }, - - stopListeners: function () - { - var listeners = this.listeners; - - window.removeEventListener('orientationchange', listeners.orientationChange, false); - window.removeEventListener('resize', listeners.windowResize, false); - - var vendors = [ 'webkit', 'moz', '' ]; - - vendors.forEach(function (prefix) - { - document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); - document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); - }); - - // MS Specific - document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); - document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); - }, - - destroy: function () - { - } - -}); - -module.exports = ScaleManager; diff --git a/src/dom/VisualBounds.js b/src/dom/VisualBounds.js deleted file mode 100644 index 52971998f..000000000 --- a/src/dom/VisualBounds.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = require('../utils/Class'); -var ClientHeight = require('./ClientHeight'); -var ClientWidth = require('./ClientWidth'); -var Rectangle = require('../geom/rectangle/Rectangle'); - -// All target browsers should support page[XY]Offset. -var ScrollX = (window && ('pageXOffset' in window)) ? function () { return window.pageXOffset; } : function () { return document.documentElement.scrollLeft; }; -var ScrollY = (window && ('pageYOffset' in window)) ? function () { return window.pageYOffset; } : function () { return document.documentElement.scrollTop; }; - -var VisualBounds = new Class({ - - Extends: Rectangle, - - initialize: - - function VisualBounds () - { - Rectangle.call(this); - }, - - x: { - get: ScrollX - }, - - y: { - get: ScrollY - }, - - init: function (isDesktop) - { - if (isDesktop) - { - Object.defineProperty(this, 'width', { get: ClientWidth }); - Object.defineProperty(this, 'height', { get: ClientHeight }); - } - else - { - Object.defineProperty(this, 'width', { - get: function () - { - return window.innerWidth; - } - }); - - Object.defineProperty(this, 'height', { - get: function () - { - return window.innerHeight; - } - }); - } - } - -}); - -module.exports = new VisualBounds(); diff --git a/src/dom/_ScaleManager.js b/src/dom/_ScaleManager.js deleted file mode 100644 index 4148c381e..000000000 --- a/src/dom/_ScaleManager.js +++ /dev/null @@ -1,1447 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Clamp = require('../math/Clamp'); -var Class = require('../utils/Class'); -var CONST = require('./const'); -var GetOffset = require('./GetOffset'); -var GetScreenOrientation = require('./GetScreenOrientation'); -var LayoutBounds = require('./LayoutBounds'); -var Rectangle = require('../geom/rectangle/Rectangle'); -var SameDimensions = require('../geom/rectangle/SameDimensions'); -var Vec2 = require('../math/Vector2'); -var VisualBounds = require('./VisualBounds'); - -/** - * @classdesc - * TODO - * - * @class ScaleManager - * @memberof Phaser.DOM - * @constructor - * @since 3.15.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance. - * @param {any} config - */ -var ScaleManager = new Class({ - - initialize: - - function ScaleManager (game, config) - { - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.DOM.ScaleManager#game - * @type {Phaser.Game} - * @readonly - * @since 3.15.0 - */ - this.game = game; - - this.config = config; - - this.width = 0; - - this.height = 0; - - this.minWidth = null; - - this.maxWidth = null; - - this.minHeight = null; - - this.maxHeight = null; - - this.offset = new Vec2(); - - this.forceLandscape = false; - - this.forcePortrait = false; - - this.incorrectOrientation = false; - - this._pageAlignHorizontally = false; - - this._pageAlignVertically = false; - - this.hasPhaserSetFullScreen = false; - - this.fullScreenTarget = null; - - this._createdFullScreenTarget = null; - - this.screenOrientation; - - this.scaleFactor = new Vec2(1, 1); - - this.scaleFactorInversed = new Vec2(1, 1); - - this.margin = { left: 0, top: 0, right: 0, bottom: 0, x: 0, y: 0 }; - - this.bounds = new Rectangle(); - - this.aspectRatio = 0; - - this.sourceAspectRatio = 0; - - this.event = null; - - this.windowConstraints = { - right: 'layout', - bottom: '' - }; - - this.compatibility = { - supportsFullScreen: false, - orientationFallback: null, - noMargins: false, - scrollTo: null, - canExpandParent: true, - clickTrampoline: '' - }; - - this._scaleMode = Phaser.ScaleManager.NO_SCALE; - - this._fullScreenScaleMode = Phaser.ScaleManager.NO_SCALE; - - this.parentIsWindow = false; - - this.parentNode = null; - - this.parentScaleFactor = new Vec2(1, 1); - - this.trackParentInterval = 2000; - - this.onResize = null; - - this.onResizeContext = null; - - this._pendingScaleMode = game.config.scaleMode; - - this._fullScreenRestore = null; - - this._gameSize = new Rectangle(); - - this._userScaleFactor = new Vec2(1, 1); - - this._userScaleTrim = new Vec2(0, 0); - - this._lastUpdate = 0; - - this._updateThrottle = 0; - - this._updateThrottleReset = 1000; - - this._parentBounds = new Rectangle(); - - this._tempBounds = new Rectangle(); - - this._lastReportedCanvasSize = new Rectangle(); - - this._lastReportedGameSize = new Rectangle(); - - this._booted = false; - }, - - preBoot: function () - { - console.log('%c preBoot ', 'background: #000; color: #ffff00'); - - // Configure device-dependent compatibility - - var game = this.game; - var device = game.device; - var os = game.device.os; - var compat = this.compatibility; - - compat.supportsFullScreen = device.fullscreen.available && !os.cocoonJS; - - // We can't do anything about the status bars in iPads, web apps or desktops - if (!os.iPad && !os.webApp && !os.desktop) - { - if (os.android && !device.browser.chrome) - { - compat.scrollTo = new Vec2(0, 1); - } - else - { - compat.scrollTo = new Vec2(0, 0); - } - } - - if (os.desktop) - { - compat.orientationFallback = 'screen'; - compat.clickTrampoline = 'when-not-mouse'; - } - else - { - compat.orientationFallback = ''; - compat.clickTrampoline = ''; - } - - // Configure event listeners - - var _this = this; - - this._orientationChange = function (event) - { - return _this.orientationChange(event); - }; - - this._windowResize = function (event) - { - return _this.windowResize(event); - }; - - window.addEventListener('orientationchange', this._orientationChange, false); - window.addEventListener('resize', this._windowResize, false); - - if (compat.supportsFullScreen) - { - this._fullScreenChange = function (event) - { - return _this.fullScreenChange(event); - }; - - this._fullScreenError = function (event) - { - return _this.fullScreenError(event); - }; - - var vendors = [ 'webkit', 'moz', '' ]; - - vendors.forEach(function (prefix) - { - document.addEventListener(prefix + 'fullscreenchange', this._fullScreenChange, false); - document.addEventListener(prefix + 'fullscreenerror', this._fullScreenError, false); - }); - - // MS Specific - document.addEventListener('MSFullscreenChange', this._fullScreenChange, false); - document.addEventListener('MSFullscreenError', this._fullScreenError, false); - } - - // Set-up the Bounds - var isDesktop = os.desktop && (document.documentElement.clientWidth <= window.innerWidth) && (document.documentElement.clientHeight <= window.innerHeight); - - console.log('isDesktop', isDesktop, os.desktop); - - VisualBounds.init(isDesktop); - LayoutBounds.init(isDesktop); - - this.setupScale(game.config.width, game.config.height); - - // Same as calling setGameSize: - this._gameSize.setTo(0, 0, game.config.width, game.config.height); - - game.events.once('boot', this.boot, this); - }, - - // Called once added to the DOM, not before - boot: function () - { - console.log('%c boot ', 'background: #000; color: #ffff00', this.width, this.height); - - var game = this.game; - var compat = this.compatibility; - - // Initialize core bounds - - GetOffset(game.canvas, this.offset); - - this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height); - - // Don't use updateOrientationState so events are not fired - this.screenOrientation = GetScreenOrientation(compat.orientationFallback); - - this._booted = true; - - if (this._pendingScaleMode !== null) - { - this.scaleMode = this._pendingScaleMode; - - this._pendingScaleMode = null; - } - - this.updateLayout(); - - this.signalSizeChange(); - - // Make sure to sync the parent bounds to the current local rect, or we'll expand forever - this.getParentBounds(this._parentBounds); - - game.events.on('resume', this.gameResumed, this); - game.events.on('prestep', this.step, this); - }, - - setupScale: function (width, height) - { - console.log('%c setupScale ', 'background: #000; color: #ffff00', width, height); - - var target; - var rect = new Rectangle(); - - var parent = this.config.parent; - - if (parent !== '') - { - if (typeof parent === 'string') - { - // Hopefully an element ID - target = document.getElementById(parent); - } - else if (parent && parent.nodeType === 1) - { - // Quick test for a HTMLElement - target = parent; - } - } - - // Fallback, covers an invalid ID and a non HTMLElement object - if (!target) - { - // Use the full window - this.parentNode = null; - this.parentIsWindow = true; - - rect.width = VisualBounds.width; - rect.height = VisualBounds.height; - - console.log('parentIsWindow', VisualBounds.width, VisualBounds.height); - - this.offset.set(0, 0); - } - else - { - this.parentNode = target; - this.parentIsWindow = false; - - this.getParentBounds(this._parentBounds, this.parentNode); - - rect.width = this._parentBounds.width; - rect.height = this._parentBounds.height; - - this.offset.set(this._parentBounds.x, this._parentBounds.y); - } - - var newWidth = 0; - var newHeight = 0; - - if (typeof width === 'number') - { - newWidth = width; - } - else - { - // Percentage based - this.parentScaleFactor.x = parseInt(width, 10) / 100; - - newWidth = rect.width * this.parentScaleFactor.x; - } - - if (typeof height === 'number') - { - newHeight = height; - } - else - { - // Percentage based - this.parentScaleFactor.y = parseInt(height, 10) / 100; - - newHeight = rect.height * this.parentScaleFactor.y; - } - - newWidth = Math.floor(newWidth); - newHeight = Math.floor(newHeight); - - this._gameSize.setTo(0, 0, newWidth, newHeight); - - this.updateDimensions(newWidth, newHeight, false); - - console.log('pn', this.parentNode); - console.log('pw', this.parentIsWindow); - console.log('pb', this._parentBounds); - console.log('new size', newWidth, newHeight); - }, - - setGameSize: function (width, height) - { - console.log('%c setGameSize ', 'background: #000; color: #ffff00', width, height); - - this._gameSize.setTo(0, 0, width, height); - - if (this.currentScaleMode !== CONST.RESIZE) - { - this.updateDimensions(width, height, true); - } - - this.queueUpdate(true); - }, - - setUserScale: function (hScale, vScale, hTrim, vTrim, queueUpdate, force) - { - if (hTrim === undefined) { hTrim = 0; } - if (vTrim === undefined) { vTrim = 0; } - if (queueUpdate === undefined) { queueUpdate = true; } - if (force === undefined) { force = true; } - - this._userScaleFactor.setTo(hScale, vScale); - this._userScaleTrim.setTo(hTrim, vTrim); - - if (queueUpdate) - { - this.queueUpdate(force); - } - }, - - gameResumed: function () - { - this.queueUpdate(true); - }, - - setResizeCallback: function (callback, context) - { - this.onResize = callback; - this.onResizeContext = context; - }, - - signalSizeChange: function () - { - if (!SameDimensions(this, this._lastReportedCanvasSize) || !SameDimensions(this.game, this._lastReportedGameSize)) - { - var width = this.width; - var height = this.height; - - this._lastReportedCanvasSize.setTo(0, 0, width, height); - this._lastReportedGameSize.setTo(0, 0, this.game.config.width, this.game.config.height); - - // this.onSizeChange.dispatch(this, width, height); - - // Per StateManager#onResizeCallback, it only occurs when in RESIZE mode. - if (this.currentScaleMode === CONST.RESIZE) - { - this.game.resize(width, height); - } - } - }, - - setMinMax: function (minWidth, minHeight, maxWidth, maxHeight) - { - this.minWidth = minWidth; - this.minHeight = minHeight; - - if (maxWidth) - { - this.maxWidth = maxWidth; - } - - if (maxHeight) - { - this.maxHeight = maxHeight; - } - }, - - step: function (time) - { - if (time < (this._lastUpdate + this._updateThrottle)) - { - return; - } - - var prevThrottle = this._updateThrottle; - - this._updateThrottleReset = (prevThrottle >= 400) ? 0 : 100; - - GetOffset(this.game.canvas, this.offset); - - var prevWidth = this._parentBounds.width; - var prevHeight = this._parentBounds.height; - - var bounds = this.getParentBounds(this._parentBounds); - - var boundsChanged = (bounds.width !== prevWidth || bounds.height !== prevHeight); - - // Always invalidate on a newly detected orientation change - var orientationChanged = this.updateOrientationState(); - - if (boundsChanged || orientationChanged) - { - console.log('%c bc ', 'background: #000; color: #ffff00', boundsChanged, bounds.width, prevWidth, bounds.height, prevHeight); - - if (this.onResize) - { - this.onResize.call(this.onResizeContext, this, bounds); - } - - this.updateLayout(); - - this.signalSizeChange(); - - // Make sure to sync the parent bounds to the current local rect, or we'll expand forever - this.getParentBounds(this._parentBounds); - - console.log('%c new bounds ', 'background: #000; color: #ffff00', this._parentBounds.width, this._parentBounds.height); - } - - // Next throttle, eg. 25, 50, 100, 200... - var throttle = this._updateThrottle * 2; - - // Don't let an update be too eager about resetting the throttle. - if (this._updateThrottle < prevThrottle) - { - throttle = Math.min(prevThrottle, this._updateThrottleReset); - } - - this._updateThrottle = Clamp(throttle, 25, this.trackParentInterval); - - this._lastUpdate = time; - }, - - updateDimensions: function (width, height, resize) - { - this.width = width * this.parentScaleFactor.x; - this.height = height * this.parentScaleFactor.y; - - this.config.width = this.width; - this.config.height = this.height; - - this.sourceAspectRatio = this.width / this.height; - - this.updateScalingAndBounds(); - - if (resize) - { - this.game.resize(this.width, this.height); - } - }, - - updateScalingAndBounds: function () - { - var game = this.game; - var config = this.config; - - this.scaleFactor.x = config.width / this.width; - this.scaleFactor.y = config.height / this.height; - - this.scaleFactorInversed.x = this.width / config.width; - this.scaleFactorInversed.y = this.height / config.height; - - this.aspectRatio = this.width / this.height; - - // This can be invoked in boot pre-canvas - if (game.canvas) - { - GetOffset(game.canvas, this.offset); - } - - this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height); - - // Can be invoked in boot pre-input - if (game.input && game.input.scale) - { - // game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y); - } - }, - - forceLandscape: function () - { - this.forceLandscape = true; - this.forcePortrait = false; - - this.queueUpdate(true); - }, - - forcePortrait: function () - { - this.forceLandscape = false; - this.forcePortrait = true; - - this.queueUpdate(true); - - }, - - classifyOrientation: function (orientation) - { - if (orientation === 'portrait-primary' || orientation === 'portrait-secondary') - { - return 'portrait'; - } - else if (orientation === 'landscape-primary' || orientation === 'landscape-secondary') - { - return 'landscape'; - } - else - { - return null; - } - }, - - updateOrientationState: function () - { - var previousOrientation = this.screenOrientation; - var previouslyIncorrect = this.incorrectOrientation; - - this.screenOrientation = GetScreenOrientation(this.compatibility.orientationFallback); - - this.incorrectOrientation = (this.forceLandscape && !this.isLandscape) || (this.forcePortrait && !this.isPortrait); - - var changed = (previousOrientation !== this.screenOrientation); - var correctnessChanged = (previouslyIncorrect !== this.incorrectOrientation); - - if (correctnessChanged) - { - if (this.incorrectOrientation) - { - // this.enterIncorrectOrientation.dispatch(); - } - else - { - // this.leaveIncorrectOrientation.dispatch(); - } - } - - if (changed || correctnessChanged) - { - // this.onOrientationChange.dispatch(this, previousOrientation, previouslyIncorrect); - } - - return (changed || correctnessChanged); - }, - - orientationChange: function (event) - { - this.event = event; - - this.queueUpdate(true); - }, - - windowResize: function (event) - { - this.event = event; - - this.queueUpdate(true); - }, - - scrollTop: function () - { - var scrollTo = this.compatibility.scrollTo; - - if (scrollTo) - { - window.scrollTo(scrollTo.x, scrollTo.y); - } - }, - - refresh: function () - { - this.scrollTop(); - - this.queueUpdate(true); - }, - - updateLayout: function () - { - var scaleMode = this.currentScaleMode; - - if (scaleMode === CONST.RESIZE) - { - this.reflowGame(); - return; - } - - this.scrollTop(); - - if (this.incorrectOrientation) - { - this.setMaximum(); - } - else if (scaleMode === CONST.EXACT_FIT) - { - this.setExactFit(); - } - else if (scaleMode === CONST.SHOW_ALL) - { - if (!this.isFullScreen && this.boundingParent && this.compatibility.canExpandParent) - { - // Try to expand parent out, but choosing maximizing dimensions. - // Then select minimize dimensions which should then honor parent maximum bound applications. - this.setShowAll(true); - this.resetCanvas(); - this.setShowAll(); - } - else - { - this.setShowAll(); - } - } - else if (scaleMode === CONST.NO_SCALE) - { - this.width = this.config.width; - this.height = this.config.height; - } - else if (scaleMode === CONST.USER_SCALE) - { - this.width = (this.config.width * this._userScaleFactor.x) - this._userScaleTrim.x; - this.height = (this.config.height * this._userScaleFactor.y) - this._userScaleTrim.y; - } - - if (!this.compatibility.canExpandParent && (scaleMode === CONST.SHOW_ALL || scaleMode === CONST.USER_SCALE)) - { - var bounds = this.getParentBounds(this._tempBounds); - - this.width = Math.min(this.width, bounds.width); - this.height = Math.min(this.height, bounds.height); - } - - // Always truncate / force to integer - this.width = this.width | 0; - this.height = this.height | 0; - - this.reflowCanvas(); - }, - - getParentBounds: function (bounds, parentNode) - { - // console.log('%c getParentBounds ', 'background: #000; color: #ff00ff'); - - if (bounds === undefined) { bounds = new Rectangle(); } - if (parentNode === undefined) { parentNode = this.boundingParent; } - - var visualBounds = VisualBounds; - var layoutBounds = LayoutBounds; - - if (!parentNode) - { - bounds.setTo(0, 0, visualBounds.width, visualBounds.height); - // console.log('b1', bounds); - } - else - { - // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect - var clientRect = parentNode.getBoundingClientRect(); - var parentRect = (parentNode.offsetParent) ? parentNode.offsetParent.getBoundingClientRect() : parentNode.getBoundingClientRect(); - - bounds.setTo(clientRect.left - parentRect.left, clientRect.top - parentRect.top, clientRect.width, clientRect.height); - - var wc = this.windowConstraints; - var windowBounds; - - if (wc.right) - { - windowBounds = (wc.right === 'layout') ? layoutBounds : visualBounds; - bounds.right = Math.min(bounds.right, windowBounds.width); - } - - if (wc.bottom) - { - windowBounds = (wc.bottom === 'layout') ? layoutBounds : visualBounds; - bounds.bottom = Math.min(bounds.bottom, windowBounds.height); - } - } - - bounds.setTo(Math.round(bounds.x), Math.round(bounds.y), Math.round(bounds.width), Math.round(bounds.height)); - - // console.log(parentNode.offsetParent); - // console.log(clientRect); - // console.log(parentRect); - // console.log(clientRect.left - parentRect.left, clientRect.top - parentRect.top, clientRect.width, clientRect.height); - // console.log('gpb', bounds); - - return bounds; - }, - - align: function (horizontal, vertical) - { - if (horizontal !== null) - { - this.pageAlignHorizontally = horizontal; - } - - if (vertical !== null) - { - this.pageAlignVertically = vertical; - } - }, - - alignCanvas: function (horizontal, vertical) - { - var parentBounds = this.getParentBounds(this._tempBounds); - var canvas = this.game.canvas; - var margin = this.margin; - - var canvasBounds; - var currentEdge; - var targetEdge; - var offset; - - if (horizontal) - { - margin.left = margin.right = 0; - - canvasBounds = canvas.getBoundingClientRect(); - - if (this.width < parentBounds.width && !this.incorrectOrientation) - { - currentEdge = canvasBounds.left - parentBounds.x; - targetEdge = (parentBounds.width / 2) - (this.width / 2); - - targetEdge = Math.max(targetEdge, 0); - - offset = targetEdge - currentEdge; - - margin.left = Math.round(offset); - } - - canvas.style.marginLeft = margin.left + 'px'; - - if (margin.left !== 0) - { - margin.right = -(parentBounds.width - canvasBounds.width - margin.left); - canvas.style.marginRight = margin.right + 'px'; - } - } - - if (vertical) - { - margin.top = margin.bottom = 0; - - canvasBounds = canvas.getBoundingClientRect(); - - if (this.height < parentBounds.height && !this.incorrectOrientation) - { - currentEdge = canvasBounds.top - parentBounds.y; - targetEdge = (parentBounds.height / 2) - (this.height / 2); - - targetEdge = Math.max(targetEdge, 0); - - offset = targetEdge - currentEdge; - - margin.top = Math.round(offset); - } - - canvas.style.marginTop = margin.top + 'px'; - - if (margin.top !== 0) - { - margin.bottom = -(parentBounds.height - canvasBounds.height - margin.top); - canvas.style.marginBottom = margin.bottom + 'px'; - } - } - - // margin.x = margin.left; - // margin.y = margin.top; - }, - - reflowGame: function () - { - this.resetCanvas('', ''); - - var bounds = this.getParentBounds(this._tempBounds); - - this.updateDimensions(bounds.width, bounds.height, true); - }, - - reflowCanvas: function () - { - if (!this.incorrectOrientation) - { - this.width = Clamp(this.width, this.minWidth || 0, this.maxWidth || this.width); - this.height = Clamp(this.height, this.minHeight || 0, this.maxHeight || this.height); - } - - this.resetCanvas(); - - if (!this.compatibility.noMargins) - { - if (this.isFullScreen && this._createdFullScreenTarget) - { - this.alignCanvas(true, true); - } - else - { - this.alignCanvas(this.pageAlignHorizontally, this.pageAlignVertically); - } - } - - this.updateScalingAndBounds(); - }, - - resetCanvas: function (cssWidth, cssHeight) - { - if (cssWidth === undefined) { cssWidth = this.width + 'px'; } - if (cssHeight === undefined) { cssHeight = this.height + 'px'; } - - var canvas = this.game.canvas; - - if (!this.compatibility.noMargins) - { - canvas.style.marginLeft = ''; - canvas.style.marginTop = ''; - canvas.style.marginRight = ''; - canvas.style.marginBottom = ''; - } - - canvas.style.width = cssWidth; - canvas.style.height = cssHeight; - }, - - queueUpdate: function (force) - { - if (force) - { - this._parentBounds.width = 0; - this._parentBounds.height = 0; - this._lastUpdate = 0; - } - - this._updateThrottle = this._updateThrottleReset; - }, - - setMaximum: function () - { - this.width = VisualBounds.width; - this.height = VisualBounds.height; - }, - - setShowAll: function (expanding) - { - var bounds = this.getParentBounds(this._tempBounds); - - var width = bounds.width; - var height = bounds.height; - - var multiplier; - - if (expanding) - { - multiplier = Math.max((height / this.game.height), (width / this.game.width)); - } - else - { - multiplier = Math.min((height / this.game.height), (width / this.game.width)); - } - - this.width = Math.round(this.game.width * multiplier); - this.height = Math.round(this.game.height * multiplier); - }, - - setExactFit: function () - { - var bounds = this.getParentBounds(this._tempBounds); - - this.width = bounds.width; - this.height = bounds.height; - - if (this.isFullScreen) - { - // Max/min not honored fullscreen - return; - } - - if (this.maxWidth) - { - this.width = Math.min(this.width, this.maxWidth); - } - - if (this.maxHeight) - { - this.height = Math.min(this.height, this.maxHeight); - } - }, - - createFullScreenTarget: function () - { - var fsTarget = document.createElement('div'); - - fsTarget.style.margin = '0'; - fsTarget.style.padding = '0'; - fsTarget.style.background = '#000'; - - return fsTarget; - }, - - startFullScreen: function (antialias, allowTrampoline) - { - if (this.isFullScreen) - { - return false; - } - - if (!this.compatibility.supportsFullScreen) - { - // Error is called in timeout to emulate the real fullscreenerror event better - var _this = this; - - setTimeout(function () - { - _this.fullScreenError(); - }, 10); - - return; - } - - if (this.compatibility.clickTrampoline === 'when-not-mouse') - { - var input = this.game.input; - - /* - if (input.activePointer && - input.activePointer !== input.mousePointer && - (allowTrampoline || allowTrampoline !== false)) - { - input.activePointer.addClickTrampoline('startFullScreen', this.startFullScreen, this, [ antialias, false ]); - return; - } - */ - } - - /* - if (antialias !== undefined && this.game.renderType === CONST.CANVAS) - { - this.game.stage.smoothed = antialias; - } - */ - - var fsTarget = this.fullScreenTarget; - - if (!fsTarget) - { - this.cleanupCreatedTarget(); - - this._createdFullScreenTarget = this.createFullScreenTarget(); - - fsTarget = this._createdFullScreenTarget; - } - - var initData = { targetElement: fsTarget }; - - this.hasPhaserSetFullScreen = true; - - // this.onFullScreenInit.dispatch(this, initData); - - if (this._createdFullScreenTarget) - { - // Move the Display canvas inside of the target and add the target to the DOM - // (the target has to be added for the Fullscreen API to work) - var canvas = this.game.canvas; - var parent = canvas.parentNode; - - parent.insertBefore(fsTarget, canvas); - - fsTarget.appendChild(canvas); - } - - if (this.game.device.fullscreen.keyboard) - { - fsTarget[this.game.device.fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); - } - else - { - fsTarget[this.game.device.fullscreen.request](); - } - - return true; - }, - - stopFullScreen: function () - { - if (!this.isFullScreen || !this.compatibility.supportsFullScreen) - { - return false; - } - - this.hasPhaserSetFullScreen = false; - - document[this.game.device.fullscreen.cancel](); - - return true; - }, - - cleanupCreatedTarget: function () - { - var fsTarget = this._createdFullScreenTarget; - - if (fsTarget && fsTarget.parentNode) - { - // Make sure to cleanup synthetic target for sure; - // swap the canvas back to the parent. - var parent = fsTarget.parentNode; - - parent.insertBefore(this.game.canvas, fsTarget); - - parent.removeChild(fsTarget); - } - - this._createdFullScreenTarget = null; - }, - - prepScreenMode: function (enteringFullscreen) - { - var createdTarget = !!this._createdFullScreenTarget; - var fsTarget = this._createdFullScreenTarget || this.fullScreenTarget; - - if (enteringFullscreen) - { - if (createdTarget || this.fullScreenScaleMode === Phaser.ScaleManager.EXACT_FIT) - { - // Resize target, as long as it's not the canvas - if (fsTarget !== this.game.canvas) - { - this._fullScreenRestore = { - targetWidth: fsTarget.style.width, - targetHeight: fsTarget.style.height - }; - - fsTarget.style.width = '100%'; - fsTarget.style.height = '100%'; - } - } - } - else - { - // Have restore information - if (this._fullScreenRestore) - { - fsTarget.style.width = this._fullScreenRestore.targetWidth; - fsTarget.style.height = this._fullScreenRestore.targetHeight; - - this._fullScreenRestore = null; - } - - // Always reset to game size - this.updateDimensions(this._gameSize.width, this._gameSize.height, true); - - this.resetCanvas(); - } - }, - - fullScreenChange: function (event) - { - this.event = event; - - if (this.isFullScreen) - { - this.prepScreenMode(true); - - this.updateLayout(); - this.queueUpdate(true); - } - else - { - this.prepScreenMode(false); - - this.cleanupCreatedTarget(); - - this.updateLayout(); - this.queueUpdate(true); - } - - // this.onFullScreenChange.dispatch(this, this.width, this.height); - }, - - fullScreenError: function (event) - { - this.event = event; - - this.cleanupCreatedTarget(); - - console.warn('ScaleManager: requestFullscreen call or browser failed'); - - // this.onFullScreenError.dispatch(this); - }, - - /* - centerDisplay: function () - { - var height = this.height; - var gameWidth = 0; - var gameHeight = 0; - - this.parentNode.style.display = 'flex'; - this.parentNode.style.height = height + 'px'; - - this.canvas.style.margin = 'auto'; - this.canvas.style.width = gameWidth + 'px'; - this.canvas.style.height = gameHeight + 'px'; - }, - */ - - /* - iOS10 Resize hack. Thanks, Apple. - - I._onWindowResize = function(a) { - if (this._lastReportedWidth != document.body.offsetWidth) { - this._lastReportedWidth = document.body.offsetWidth; - if (this._isAutoPlaying && this._cancelAutoPlayOnInteraction) { - this.stopAutoPlay(a) - } - window.clearTimeout(this._onResizeDebouncedTimeout); - this._onResizeDebouncedTimeout = setTimeout(this._onResizeDebounced, 500); - aj._onWindowResize.call(this, a) - } - }; - */ - - /* - resize: function () - { - let scale = Math.min(window.innerWidth / canvas.width, window.innerHeight / canvas.height); - let orientation = 'left'; - let extra = (this.mobile) ? 'margin-left: -50%': ''; - let margin = window.innerWidth / 2 - (canvas.width / 2) * scale; - - canvas.setAttribute('style', '-ms-transform-origin: ' + orientation + ' top; -webkit-transform-origin: ' + orientation + ' top;' + - ' -moz-transform-origin: ' + orientation + ' top; -o-transform-origin: ' + orientation + ' top; transform-origin: ' + orientation + ' top;' + - ' -ms-transform: scale(' + scale + '); -webkit-transform: scale3d(' + scale + ', 1);' + - ' -moz-transform: scale(' + scale + '); -o-transform: scale(' + scale + '); transform: scale(' + scale + ');' + - ' display: block; margin-left: ' + margin + 'px;' - ); - }, - */ - - getInnerHeight: function () - { - // Based on code by @tylerjpeterson - - if (!this.game.device.os.iOS) - { - return window.innerHeight; - } - - var axis = Math.abs(window.orientation); - - var size = { w: 0, h: 0 }; - - var ruler = document.createElement('div'); - - ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); - - document.documentElement.appendChild(ruler); - - size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; - size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; - - document.documentElement.removeChild(ruler); - - ruler = null; - - if (Math.abs(window.orientation) !== 90) - { - return size.h; - } - else - { - return size.w; - } - }, - - /** - * Destroys the ScaleManager. - * - * @method Phaser.DOM.ScaleManager#destroy - * @since 3.15.0 - */ - destroy: function () - { - this.game.events.off('resume', this.gameResumed, this); - - window.removeEventListener('orientationchange', this._orientationChange, false); - window.removeEventListener('resize', this._windowResize, false); - - if (this.compatibility.supportsFullScreen) - { - var vendors = [ 'webkit', 'moz', '' ]; - - vendors.forEach(function (prefix) - { - document.removeEventListener(prefix + 'fullscreenchange', this._fullScreenChange, false); - document.removeEventListener(prefix + 'fullscreenerror', this._fullScreenError, false); - }); - - // MS Specific - document.removeEventListener('MSFullscreenChange', this._fullScreenChange, false); - document.removeEventListener('MSFullscreenError', this._fullScreenError, false); - } - - this.game = null; - }, - - boundingParent: { - - get: function () - { - if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) - { - return null; - } - - var parentNode = this.game.canvas && this.game.canvas.parentNode; - - return parentNode || null; - } - }, - - scaleMode: { - - get: function () - { - return this._scaleMode; - }, - - set: function (value) - { - if (value !== this._scaleMode) - { - if (!this.isFullScreen) - { - this.updateDimensions(this._gameSize.width, this._gameSize.height, true); - this.queueUpdate(true); - } - - this._scaleMode = value; - } - - return this._scaleMode; - } - - }, - - fullScreenScaleMode: { - - get: function () - { - return this._fullScreenScaleMode; - }, - - set: function (value) - { - if (value !== this._fullScreenScaleMode) - { - // If in fullscreen then need a wee bit more work - if (this.isFullScreen) - { - this.prepScreenMode(false); - - this._fullScreenScaleMode = value; - - this.prepScreenMode(true); - - this.queueUpdate(true); - } - else - { - this._fullScreenScaleMode = value; - } - } - - return this._fullScreenScaleMode; - } - - }, - - currentScaleMode: { - - get: function () - { - return (this.isFullScreen) ? this._fullScreenScaleMode : this._scaleMode; - } - - }, - - pageAlignHorizontally: { - - get: function () - { - return this._pageAlignHorizontally; - }, - - set: function (value) - { - - if (value !== this._pageAlignHorizontally) - { - this._pageAlignHorizontally = value; - - this.queueUpdate(true); - } - - } - - }, - - pageAlignVertically: { - - get: function () - { - return this._pageAlignVertically; - }, - - set: function (value) - { - if (value !== this._pageAlignVertically) - { - this._pageAlignVertically = value; - this.queueUpdate(true); - } - - } - - }, - - isFullScreen: { - - get: function () - { - return !!(document.fullscreenElement || - document.webkitFullscreenElement || - document.mozFullScreenElement || - document.msFullscreenElement); - } - - }, - - isPortrait: { - - get: function () - { - return (this.classifyOrientation(this.screenOrientation) === 'portrait'); - } - - }, - - isLandscape: { - - get: function () - { - return (this.classifyOrientation(this.screenOrientation) === 'landscape'); - } - - }, - - isGamePortrait: { - - get: function () - { - return (this.height > this.width); - } - - }, - - isGameLandscape: { - - get: function () - { - return (this.width > this.height); - } - - } - -}); - -module.exports = ScaleManager; diff --git a/src/dom/const.js b/src/dom/const.js deleted file mode 100644 index 591849fe0..000000000 --- a/src/dom/const.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Phaser ScaleManager Modes. - * - * @name Phaser.DOM.ScaleModes - * @enum {integer} - * @memberof Phaser - * @readonly - * @since 3.15.0 - */ - -module.exports = { - - /** - * - * - * @name Phaser.DOM.EXACT - * @since 3.15.0 - */ - EXACT: 0, - - /** - * - * - * @name Phaser.DOM.FILL - * @since 3.15.0 - */ - FILL: 1, - - /** - * - * - * @name Phaser.DOM.CONTAIN - * @since 3.15.0 - */ - CONTAIN: 2, - - /** - * - * - * @name Phaser.DOM.RESIZE - * @since 3.15.0 - */ - RESIZE: 3 - -}; diff --git a/src/dom/index.js b/src/dom/index.js index 0a685cfef..b01be6257 100644 --- a/src/dom/index.js +++ b/src/dom/index.js @@ -1,12 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Extend = require('../utils/object/Extend'); -var ScaleModes = require('./const'); - /** * @namespace Phaser.DOM */ @@ -14,26 +11,13 @@ var ScaleModes = require('./const'); var Dom = { AddToDOM: require('./AddToDOM'), - Calibrate: require('./Calibrate'), - ClientHeight: require('./ClientHeight'), - ClientWidth: require('./ClientWidth'), - DocumentBounds: require('./DocumentBounds'), DOMContentLoaded: require('./DOMContentLoaded'), - GetAspectRatio: require('./GetAspectRatio'), - GetBounds: require('./GetBounds'), - GetOffset: require('./GetOffset'), GetScreenOrientation: require('./GetScreenOrientation'), - InLayoutViewport: require('./InLayoutViewport'), + GetTarget: require('./GetTarget'), ParseXML: require('./ParseXML'), RemoveFromDOM: require('./RemoveFromDOM'), - RequestAnimationFrame: require('./RequestAnimationFrame'), - ScaleManager: require('./ScaleManager'), - VisualBounds: require('./VisualBounds'), - - ScaleModes: ScaleModes + RequestAnimationFrame: require('./RequestAnimationFrame') }; -Dom = Extend(false, Dom, ScaleModes); - module.exports = Dom; diff --git a/src/events/EventEmitter.js b/src/events/EventEmitter.js index 1150c7c57..6310f9171 100644 --- a/src/events/EventEmitter.js +++ b/src/events/EventEmitter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/events/index.js b/src/events/index.js index 197a44298..ef66927d2 100644 --- a/src/events/index.js +++ b/src/events/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/BuildGameObject.js b/src/gameobjects/BuildGameObject.js index 220be37d3..c20299f94 100644 --- a/src/gameobjects/BuildGameObject.js +++ b/src/gameobjects/BuildGameObject.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,26 +8,6 @@ var BlendModes = require('../renderer/BlendModes'); var GetAdvancedValue = require('../utils/object/GetAdvancedValue'); var ScaleModes = require('../renderer/ScaleModes'); -/** - * @typedef {object} GameObjectConfig - * - * @property {number} [x=0] - The x position of the Game Object. - * @property {number} [y=0] - The y position of the Game Object. - * @property {number} [depth=0] - The depth of the GameObject. - * @property {boolean} [flipX=false] - The horizontally flipped state of the Game Object. - * @property {boolean} [flipY=false] - The vertically flipped state of the Game Object. - * @property {?(number|object)} [scale=null] - The scale of the GameObject. - * @property {?(number|object)} [scrollFactor=null] - The scroll factor of the GameObject. - * @property {number} [rotation=0] - The rotation angle of the Game Object, in radians. - * @property {?number} [angle=null] - The rotation angle of the Game Object, in degrees. - * @property {number} [alpha=1] - The alpha (opacity) of the Game Object. - * @property {?(number|object)} [origin=null] - The origin of the Game Object. - * @property {number} [scaleMode=ScaleModes.DEFAULT] - The scale mode of the GameObject. - * @property {number} [blendMode=BlendModes.DEFAULT] - The blend mode of the GameObject. - * @property {boolean} [visible=true] - The visible state of the Game Object. - * @property {boolean} [add=true] - Add the GameObject to the scene. - */ - /** * Builds a Game Object using the provided configuration object. * @@ -36,7 +16,7 @@ var ScaleModes = require('../renderer/ScaleModes'); * * @param {Phaser.Scene} scene - A reference to the Scene. * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. - * @param {GameObjectConfig} config - The config to build the GameObject with. + * @param {Phaser.GameObjects.Types.GameObjectConfig} config - The config to build the GameObject with. * * @return {Phaser.GameObjects.GameObject} The built Game Object. */ diff --git a/src/gameobjects/BuildGameObjectAnimation.js b/src/gameobjects/BuildGameObjectAnimation.js index 48a8c7b1d..150d52e2b 100644 --- a/src/gameobjects/BuildGameObjectAnimation.js +++ b/src/gameobjects/BuildGameObjectAnimation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/DisplayList.js b/src/gameobjects/DisplayList.js index cd748104f..b3d9b5e7f 100644 --- a/src/gameobjects/DisplayList.js +++ b/src/gameobjects/DisplayList.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var List = require('../structs/List'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); var StableSort = require('../utils/array/StableSort'); /** @@ -63,8 +64,8 @@ var DisplayList = new Class({ */ this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -77,7 +78,7 @@ var DisplayList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -91,7 +92,7 @@ var DisplayList = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -170,7 +171,7 @@ var DisplayList = new Class({ this.list.length = 0; - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -185,7 +186,7 @@ var DisplayList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/gameobjects/GameObject.js b/src/gameobjects/GameObject.js index c2f168223..21558ff10 100644 --- a/src/gameobjects/GameObject.js +++ b/src/gameobjects/GameObject.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,6 +8,7 @@ var Class = require('../utils/Class'); var ComponentsToJSON = require('./components/ToJSON'); var DataManager = require('../data/DataManager'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); /** * @classdesc @@ -66,7 +67,7 @@ var GameObject = new Class({ * If you need to store complex data about your Game Object, look at using the Data Component instead. * * @name Phaser.GameObjects.GameObject#state - * @type {{integer|string}} + * @type {(integer|string)} * @since 3.16.0 */ this.state = 0; @@ -158,7 +159,7 @@ var GameObject = new Class({ * Not usually set directly. Instead call `GameObject.setInteractive()`. * * @name Phaser.GameObjects.GameObject#input - * @type {?Phaser.Input.InteractiveObject} + * @type {?Phaser.Input.Types.InteractiveObject} * @default null * @since 3.0.0 */ @@ -303,7 +304,7 @@ var GameObject = new Class({ * When the value is first set, a `setdata` event is emitted from this Game Object. * * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata_PlayerLives`. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. * * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. @@ -385,8 +386,8 @@ var GameObject = new Class({ * @method Phaser.GameObjects.GameObject#setInteractive * @since 3.0.0 * - * @param {(Phaser.Input.InputConfiguration|any)} [shape] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {HitAreaCallback} [callback] - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. + * @param {(Phaser.Input.Types.InputConfiguration|any)} [shape] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. * @param {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target? * * @return {this} This GameObject. @@ -474,7 +475,7 @@ var GameObject = new Class({ * @method Phaser.GameObjects.GameObject#toJSON * @since 3.0.0 * - * @return {JSONGameObject} A JSON representation of the Game Object. + * @return {Phaser.GameObjects.Types.JSONGameObject} A JSON representation of the Game Object. */ toJSON: function () { @@ -555,7 +556,7 @@ var GameObject = new Class({ * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. * * @method Phaser.GameObjects.GameObject#destroy - * @fires Phaser.GameObjects.GameObject#destroyEvent + * @fires Phaser.GameObjects.Events#DESTROY * @since 3.0.0 * * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown? @@ -575,7 +576,7 @@ var GameObject = new Class({ this.preDestroy.call(this); } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); var sys = this.scene.sys; @@ -632,8 +633,3 @@ var GameObject = new Class({ GameObject.RENDER_MASK = 15; module.exports = GameObject; - -/** - * The Game Object will be destroyed. - * @event Phaser.GameObjects.GameObject#destroyEvent - */ diff --git a/src/gameobjects/GameObjectCreator.js b/src/gameobjects/GameObjectCreator.js index a37932c38..9b7f82db5 100644 --- a/src/gameobjects/GameObjectCreator.js +++ b/src/gameobjects/GameObjectCreator.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); /** * @classdesc @@ -69,8 +70,8 @@ var GameObjectCreator = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -86,7 +87,7 @@ var GameObjectCreator = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -100,7 +101,7 @@ var GameObjectCreator = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -113,7 +114,7 @@ var GameObjectCreator = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -128,7 +129,7 @@ var GameObjectCreator = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/gameobjects/GameObjectFactory.js b/src/gameobjects/GameObjectFactory.js index 6303fe0b9..7ca86e0c5 100644 --- a/src/gameobjects/GameObjectFactory.js +++ b/src/gameobjects/GameObjectFactory.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); /** * @classdesc @@ -68,8 +69,8 @@ var GameObjectFactory = new Class({ */ this.updateList; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -85,7 +86,7 @@ var GameObjectFactory = new Class({ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -99,7 +100,7 @@ var GameObjectFactory = new Class({ */ start: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -140,7 +141,7 @@ var GameObjectFactory = new Class({ */ shutdown: function () { - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -155,7 +156,7 @@ var GameObjectFactory = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/gameobjects/UpdateList.js b/src/gameobjects/UpdateList.js index 101f5a932..84ef1c3c9 100644 --- a/src/gameobjects/UpdateList.js +++ b/src/gameobjects/UpdateList.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); /** * @classdesc @@ -79,8 +80,8 @@ var UpdateList = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -93,7 +94,7 @@ var UpdateList = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -109,9 +110,9 @@ var UpdateList = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -281,9 +282,9 @@ var UpdateList = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -297,7 +298,7 @@ var UpdateList = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/gameobjects/bitmaptext/GetBitmapTextSize.js b/src/gameobjects/bitmaptext/GetBitmapTextSize.js index 852afa350..e81fe95e7 100644 --- a/src/gameobjects/bitmaptext/GetBitmapTextSize.js +++ b/src/gameobjects/bitmaptext/GetBitmapTextSize.js @@ -1,38 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} BitmapTextSize - * - * @property {GlobalBitmapTextSize} global - The position and size of the BitmapText, taking into account the position and scale of the Game Object. - * @property {LocalBitmapTextSize} local - The position and size of the BitmapText, taking just the font size into account. - */ - -/** - * The position and size of the Bitmap Text in global space, taking into account the Game Object's scale and world position. - * - * @typedef {object} GlobalBitmapTextSize - * - * @property {number} x - The x position of the BitmapText, taking into account the x position and scale of the Game Object. - * @property {number} y - The y position of the BitmapText, taking into account the y position and scale of the Game Object. - * @property {number} width - The width of the BitmapText, taking into account the x scale of the Game Object. - * @property {number} height - The height of the BitmapText, taking into account the y scale of the Game Object. - */ - -/** - * The position and size of the Bitmap Text in local space, taking just the font size into account. - * - * @typedef {object} LocalBitmapTextSize - * - * @property {number} x - The x position of the BitmapText. - * @property {number} y - The y position of the BitmapText. - * @property {number} width - The width of the BitmapText. - * @property {number} height - The height of the BitmapText. - */ - /** * Calculate the position, width and height of a BitmapText Game Object. * @@ -51,7 +22,7 @@ * @param {boolean} [round] - Whether to round the results to the nearest integer. * @param {object} [out] - Optional object to store the results in, to save constant object creation. * - * @return {BitmapTextSize} The calculated position, width and height of the BitmapText. + * @return {Phaser.GameObjects.BitmapText.Types.BitmapTextSize} The calculated position, width and height of the BitmapText. */ var GetBitmapTextSize = function (src, round, out) { diff --git a/src/gameobjects/bitmaptext/ParseFromAtlas.js b/src/gameobjects/bitmaptext/ParseFromAtlas.js index 40c2089cf..d4bc05a1b 100644 --- a/src/gameobjects/bitmaptext/ParseFromAtlas.js +++ b/src/gameobjects/bitmaptext/ParseFromAtlas.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/ParseRetroFont.js b/src/gameobjects/bitmaptext/ParseRetroFont.js index 7aeb4c2ea..8a1ab6a5a 100644 --- a/src/gameobjects/bitmaptext/ParseRetroFont.js +++ b/src/gameobjects/bitmaptext/ParseRetroFont.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,7 +14,7 @@ var GetValue = require('../../utils/object/GetValue'); * @since 3.0.0 * * @param {Phaser.Scene} scene - A reference to the Phaser Scene. - * @param {Phaser.GameObjects.RetroFont.Config} config - The font configuration object. + * @param {Phaser.GameObjects.BitmapText.Types.RetroFontConfig} config - The font configuration object. * * @return {object} A parsed Bitmap Font data entry for the Bitmap Font cache. */ diff --git a/src/gameobjects/bitmaptext/ParseXMLBitmapFont.js b/src/gameobjects/bitmaptext/ParseXMLBitmapFont.js index 50cb87201..902dd3bb9 100644 --- a/src/gameobjects/bitmaptext/ParseXMLBitmapFont.js +++ b/src/gameobjects/bitmaptext/ParseXMLBitmapFont.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -33,7 +33,7 @@ function getValue (node, attribute) * @param {integer} [ySpacing=0] - The y-axis spacing to add to the line height. * @param {Phaser.Textures.Frame} [frame] - The texture frame to take into account while parsing. * - * @return {BitmapFontData} The parsed Bitmap Font data. + * @return {Phaser.GameObjects.BitmapText.Types.BitmapFontData} The parsed Bitmap Font data. */ var ParseXMLBitmapFont = function (xml, xSpacing, ySpacing, frame) { diff --git a/src/gameobjects/bitmaptext/RetroFont.js b/src/gameobjects/bitmaptext/RetroFont.js index a54ddb67a..70f13ac01 100644 --- a/src/gameobjects/bitmaptext/RetroFont.js +++ b/src/gameobjects/bitmaptext/RetroFont.js @@ -1,27 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var RETRO_FONT_CONST = require('./const'); var Extend = require('../../utils/object/Extend'); -/** - * @typedef {object} Phaser.GameObjects.RetroFont.Config - * - * @property {string} image - The key of the image containing the font. - * @property {number} offset.x - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here. - * @property {number} offset.y - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here. - * @property {number} width - The width of each character in the font set. - * @property {number} height - The height of each character in the font set. - * @property {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements. - * @property {number} charsPerRow - The number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth. - * @property {number} spacing.x - If the characters in the font set have horizontal spacing between them set the required amount here. - * @property {number} spacing.y - If the characters in the font set have vertical spacing between them set the required amount here. - * @property {number} lineSpacing - The amount of vertical space to add to the line height of the font. -*/ - /** * @namespace Phaser.GameObjects.RetroFont * @since 3.6.0 diff --git a/src/gameobjects/bitmaptext/const.js b/src/gameobjects/bitmaptext/const.js index 29a2cc93c..377931ed9 100644 --- a/src/gameobjects/bitmaptext/const.js +++ b/src/gameobjects/bitmaptext/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js index 150978ba2..22112779e 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,28 +8,6 @@ var BitmapText = require('../static/BitmapText'); var Class = require('../../../utils/Class'); var Render = require('./DynamicBitmapTextRender'); -/** - * @typedef {object} DisplayCallbackConfig - * - * @property {Phaser.GameObjects.DynamicBitmapText} parent - The Dynamic Bitmap Text object that owns this character being rendered. - * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. Always zero in Canvas. - * @property {number} index - The index of the character being rendered. - * @property {number} charCode - The character code of the character being rendered. - * @property {number} x - The x position of the character being rendered. - * @property {number} y - The y position of the character being rendered. - * @property {number} scale - The scale of the character being rendered. - * @property {number} rotation - The rotation of the character being rendered. - * @property {any} data - Custom data stored with the character being rendered. - */ - -/** - * @callback DisplayCallback - * - * @param {DisplayCallbackConfig} display - Settings of the character that is about to be rendered. - * - * @return {{x:number, y:number, scale:number, rotation:number}} Altered position, scale and rotation values for the character that is about to be rendered. - */ - /** * @classdesc * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. @@ -132,7 +110,7 @@ var DynamicBitmapText = new Class({ * A callback that alters how each character of the Bitmap Text is rendered. * * @name Phaser.GameObjects.DynamicBitmapText#displayCallback - * @type {DisplayCallback} + * @type {Phaser.GameObjects.BitmapText.Types.DisplayCallback} * @since 3.0.0 */ this.displayCallback; @@ -146,7 +124,7 @@ var DynamicBitmapText = new Class({ * should shallow copy it, as it's updated and re-used for every glyph in the text. * * @name Phaser.GameObjects.DynamicBitmapText#callbackData - * @type {DisplayCallbackConfig} + * @type {Phaser.GameObjects.BitmapText.Types.DisplayCallbackConfig} * @since 3.11.0 */ this.callbackData = { @@ -190,7 +168,7 @@ var DynamicBitmapText = new Class({ /** * Set a callback that alters how each character of the Bitmap Text is rendered. * - * The callback receives a {@link DisplayCallbackConfig} object that contains information about the character that's + * The callback receives a {@link Phaser.GameObjects.BitmapText.Types.DisplayCallbackConfig} object that contains information about the character that's * about to be rendered. * * It should return an object with `x`, `y`, `scale` and `rotation` properties that will be used instead of the @@ -199,7 +177,7 @@ var DynamicBitmapText = new Class({ * @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback * @since 3.0.0 * - * @param {DisplayCallback} callback - The display callback to set. + * @param {Phaser.GameObjects.BitmapText.Types.DisplayCallback} callback - The display callback to set. * * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object. */ diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCanvasRenderer.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCanvasRenderer.js index e1a053256..14e53f290 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCanvasRenderer.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js index 4179c3dba..702908d61 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,15 +9,6 @@ var BuildGameObject = require('../../BuildGameObject'); var GameObjectCreator = require('../../GameObjectCreator'); var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue'); -/** - * @typedef {object} BitmapTextConfig - * @extends GameObjectConfig - * - * @property {string} [font=''] - The key of the font to use from the BitmapFont cache. - * @property {string} [text=''] - The string, or array of strings, to be set as the content of this Bitmap Text. - * @property {(number|false)} [size=false] - The font size to set. - */ - /** * Creates a new Dynamic Bitmap Text Game Object and returns it. * @@ -26,7 +17,7 @@ var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue'); * @method Phaser.GameObjects.GameObjectCreator#dynamicBitmapText * @since 3.0.0 *² - * @param {BitmapTextConfig} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.GameObjects.BitmapText.Types.BitmapTextConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created. diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory.js index a72bc2b27..a6bda7642 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextRender.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextRender.js index c215ea84c..369c401a1 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextRender.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextWebGLRenderer.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextWebGLRenderer.js index 1dfa986f5..da06c8a16 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextWebGLRenderer.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/static/BitmapText.js b/src/gameobjects/bitmaptext/static/BitmapText.js index 93cb0c7ba..5616af08c 100644 --- a/src/gameobjects/bitmaptext/static/BitmapText.js +++ b/src/gameobjects/bitmaptext/static/BitmapText.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,48 +11,6 @@ var GetBitmapTextSize = require('../GetBitmapTextSize'); var ParseFromAtlas = require('../ParseFromAtlas'); var Render = require('./BitmapTextRender'); -/** - * The font data for an individual character of a Bitmap Font. - * - * Describes the character's position, size, offset and kerning. - * - * @typedef {object} BitmapFontCharacterData - * - * @property {number} x - The x position of the character. - * @property {number} y - The y position of the character. - * @property {number} width - The width of the character. - * @property {number} height - The height of the character. - * @property {number} centerX - The center x position of the character. - * @property {number} centerY - The center y position of the character. - * @property {number} xOffset - The x offset of the character. - * @property {number} yOffset - The y offset of the character. - * @property {object} data - Extra data for the character. - * @property {Object.} kerning - Kerning values, keyed by character code. - */ - -/** - * Bitmap Font data that can be used by a BitmapText Game Object. - * - * @typedef {object} BitmapFontData - * - * @property {string} font - The name of the font. - * @property {number} size - The size of the font. - * @property {number} lineHeight - The line height of the font. - * @property {boolean} retroFont - Whether this font is a retro font (monospace). - * @property {Object.} chars - The character data of the font, keyed by character code. Each character datum includes a position, size, offset and more. - */ - -/** - * @typedef {object} JSONBitmapText - * @extends {JSONGameObject} - * - * @property {string} font - The name of the font. - * @property {string} text - The text that this Bitmap Text displays. - * @property {number} fontSize - The size of the font. - * @property {number} letterSpacing - Adds / Removes spacing between characters. - * @property {integer} align - The alignment of the text in a multi-line BitmapText object. - */ - /** * @classdesc * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. @@ -148,7 +106,7 @@ var BitmapText = new Class({ * The data of the Bitmap Font used by this Bitmap Text. * * @name Phaser.GameObjects.BitmapText#fontData - * @type {BitmapFontData} + * @type {Phaser.GameObjects.BitmapText.Types.BitmapFontData} * @readonly * @since 3.0.0 */ @@ -210,7 +168,7 @@ var BitmapText = new Class({ * An object that describes the size of this Bitmap Text. * * @name Phaser.GameObjects.BitmapText#_bounds - * @type {BitmapTextSize} + * @type {Phaser.GameObjects.BitmapText.Types.BitmapTextSize} * @private * @since 3.0.0 */ @@ -383,7 +341,7 @@ var BitmapText = new Class({ * * @param {boolean} [round] - Whether to round the results to the nearest integer. * - * @return {BitmapTextSize} An object that describes the size of this Bitmap Text. + * @return {Phaser.GameObjects.BitmapText.Types.BitmapTextSize} An object that describes the size of this Bitmap Text. */ getTextBounds: function (round) { @@ -589,7 +547,7 @@ var BitmapText = new Class({ * @method Phaser.GameObjects.BitmapText#toJSON * @since 3.0.0 * - * @return {JSONBitmapText} A JSON representation of this Bitmap Text. + * @return {Phaser.GameObjects.BitmapText.Types.JSONBitmapText} A JSON representation of this Bitmap Text. */ toJSON: function () { @@ -639,6 +597,25 @@ BitmapText.ALIGN_CENTER = 1; */ BitmapText.ALIGN_RIGHT = 2; +/** + * Parse an XML Bitmap Font from an Atlas. + * + * Adds the parsed Bitmap Font data to the cache with the `fontName` key. + * + * @name Phaser.GameObjects.BitmapText.ParseFromAtlas + * @type {function} + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for. + * @param {string} fontName - The key of the font to add to the Bitmap Font cache. + * @param {string} textureKey - The key of the BitmapFont's texture. + * @param {string} frameKey - The key of the BitmapFont texture's frame. + * @param {string} xmlKey - The key of the XML data of the font to parse. + * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. + * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * + * @return {boolean} Whether the parsing was successful or not. + */ BitmapText.ParseFromAtlas = ParseFromAtlas; module.exports = BitmapText; diff --git a/src/gameobjects/bitmaptext/static/BitmapTextCanvasRenderer.js b/src/gameobjects/bitmaptext/static/BitmapTextCanvasRenderer.js index 366da02b5..ac3c745de 100644 --- a/src/gameobjects/bitmaptext/static/BitmapTextCanvasRenderer.js +++ b/src/gameobjects/bitmaptext/static/BitmapTextCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/static/BitmapTextCreator.js b/src/gameobjects/bitmaptext/static/BitmapTextCreator.js index dee0c9618..2d0754743 100644 --- a/src/gameobjects/bitmaptext/static/BitmapTextCreator.js +++ b/src/gameobjects/bitmaptext/static/BitmapTextCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,7 +18,7 @@ var GetValue = require('../../../utils/object/GetValue'); * @method Phaser.GameObjects.GameObjectCreator#bitmapText * @since 3.0.0 * - * @param {BitmapTextConfig} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.GameObjects.BitmapText.Types.BitmapTextConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. diff --git a/src/gameobjects/bitmaptext/static/BitmapTextFactory.js b/src/gameobjects/bitmaptext/static/BitmapTextFactory.js index 9d95d525b..b5564d988 100644 --- a/src/gameobjects/bitmaptext/static/BitmapTextFactory.js +++ b/src/gameobjects/bitmaptext/static/BitmapTextFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/static/BitmapTextRender.js b/src/gameobjects/bitmaptext/static/BitmapTextRender.js index 6c20f118f..c00557695 100644 --- a/src/gameobjects/bitmaptext/static/BitmapTextRender.js +++ b/src/gameobjects/bitmaptext/static/BitmapTextRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/static/BitmapTextWebGLRenderer.js b/src/gameobjects/bitmaptext/static/BitmapTextWebGLRenderer.js index 8d95f99b0..454a0e5e3 100644 --- a/src/gameobjects/bitmaptext/static/BitmapTextWebGLRenderer.js +++ b/src/gameobjects/bitmaptext/static/BitmapTextWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/bitmaptext/typedefs/BitmapFontCharacterData.js b/src/gameobjects/bitmaptext/typedefs/BitmapFontCharacterData.js new file mode 100644 index 000000000..1e45bf4cf --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/BitmapFontCharacterData.js @@ -0,0 +1,19 @@ +/** + * The font data for an individual character of a Bitmap Font. + * + * Describes the character's position, size, offset and kerning. + * + * @typedef {object} Phaser.GameObjects.BitmapText.Types.BitmapFontCharacterData + * @since 3.0.0 + * + * @property {number} x - The x position of the character. + * @property {number} y - The y position of the character. + * @property {number} width - The width of the character. + * @property {number} height - The height of the character. + * @property {number} centerX - The center x position of the character. + * @property {number} centerY - The center y position of the character. + * @property {number} xOffset - The x offset of the character. + * @property {number} yOffset - The y offset of the character. + * @property {object} data - Extra data for the character. + * @property {Object.} kerning - Kerning values, keyed by character code. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/BitmapFontData.js b/src/gameobjects/bitmaptext/typedefs/BitmapFontData.js new file mode 100644 index 000000000..051958f26 --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/BitmapFontData.js @@ -0,0 +1,12 @@ +/** + * Bitmap Font data that can be used by a BitmapText Game Object. + * + * @typedef {object} Phaser.GameObjects.BitmapText.Types.BitmapFontData + * @since 3.0.0 + * + * @property {string} font - The name of the font. + * @property {number} size - The size of the font. + * @property {number} lineHeight - The line height of the font. + * @property {boolean} retroFont - Whether this font is a retro font (monospace). + * @property {Object.} chars - The character data of the font, keyed by character code. Each character datum includes a position, size, offset and more. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/BitmapTextConfig.js b/src/gameobjects/bitmaptext/typedefs/BitmapTextConfig.js new file mode 100644 index 000000000..2db851dd7 --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/BitmapTextConfig.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.GameObjects.BitmapText.Types.BitmapTextConfig + * @extends Phaser.GameObjects.Types.GameObjectConfig + * @since 3.0.0 + * + * @property {string} [font=''] - The key of the font to use from the BitmapFont cache. + * @property {string} [text=''] - The string, or array of strings, to be set as the content of this Bitmap Text. + * @property {(number|false)} [size=false] - The font size to set. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/BitmapTextSize.js b/src/gameobjects/bitmaptext/typedefs/BitmapTextSize.js new file mode 100644 index 000000000..842130bcd --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/BitmapTextSize.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.GameObjects.BitmapText.Types.BitmapTextSize + * @since 3.0.0 + * + * @property {Phaser.GameObjects.BitmapText.Types.GlobalBitmapTextSize} global - The position and size of the BitmapText, taking into account the position and scale of the Game Object. + * @property {Phaser.GameObjects.BitmapText.Types.LocalBitmapTextSize} local - The position and size of the BitmapText, taking just the font size into account. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js b/src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js new file mode 100644 index 000000000..dbb1976a4 --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/DisplayCallbackConfig.js @@ -0,0 +1,22 @@ +/** + * @typedef {object} Phaser.GameObjects.BitmapText.Types.DisplayCallbackConfig + * @since 3.0.0 + * + * @property {Phaser.GameObjects.DynamicBitmapText} parent - The Dynamic Bitmap Text object that owns this character being rendered. + * @property {Phaser.GameObjects.BitmapText.Types.TintConfig} tint - The tint of the character being rendered. Always zero in Canvas. + * @property {number} index - The index of the character being rendered. + * @property {number} charCode - The character code of the character being rendered. + * @property {number} x - The x position of the character being rendered. + * @property {number} y - The y position of the character being rendered. + * @property {number} scale - The scale of the character being rendered. + * @property {number} rotation - The rotation of the character being rendered. + * @property {any} data - Custom data stored with the character being rendered. + */ + +/** + * @callback Phaser.GameObjects.BitmapText.Types.DisplayCallback + * + * @param {Phaser.GameObjects.BitmapText.Types.DisplayCallbackConfig} display - Settings of the character that is about to be rendered. + * + * @return {Phaser.GameObjects.BitmapText.Types.DisplayCallbackConfig} Altered position, scale and rotation values for the character that is about to be rendered. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/GlobalBitmapTextSize.js b/src/gameobjects/bitmaptext/typedefs/GlobalBitmapTextSize.js new file mode 100644 index 000000000..6624295bd --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/GlobalBitmapTextSize.js @@ -0,0 +1,11 @@ +/** + * The position and size of the Bitmap Text in global space, taking into account the Game Object's scale and world position. + * + * @typedef {object} Phaser.GameObjects.BitmapText.Types.GlobalBitmapTextSize + * @since 3.0.0 + * + * @property {number} x - The x position of the BitmapText, taking into account the x position and scale of the Game Object. + * @property {number} y - The y position of the BitmapText, taking into account the y position and scale of the Game Object. + * @property {number} width - The width of the BitmapText, taking into account the x scale of the Game Object. + * @property {number} height - The height of the BitmapText, taking into account the y scale of the Game Object. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/JSONBitmapText.js b/src/gameobjects/bitmaptext/typedefs/JSONBitmapText.js new file mode 100644 index 000000000..0e762c91e --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/JSONBitmapText.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.GameObjects.BitmapText.Types.JSONBitmapText + * @extends {Phaser.GameObjects.Types.JSONGameObject} + * @since 3.0.0 + * + * @property {string} font - The name of the font. + * @property {string} text - The text that this Bitmap Text displays. + * @property {number} fontSize - The size of the font. + * @property {number} letterSpacing - Adds / Removes spacing between characters. + * @property {integer} align - The alignment of the text in a multi-line BitmapText object. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/LocalBitmapTextSize.js b/src/gameobjects/bitmaptext/typedefs/LocalBitmapTextSize.js new file mode 100644 index 000000000..43810faa6 --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/LocalBitmapTextSize.js @@ -0,0 +1,11 @@ +/** + * The position and size of the Bitmap Text in local space, taking just the font size into account. + * + * @typedef {object} Phaser.GameObjects.BitmapText.Types.LocalBitmapTextSize + * @since 3.0.0 + * + * @property {number} x - The x position of the BitmapText. + * @property {number} y - The y position of the BitmapText. + * @property {number} width - The width of the BitmapText. + * @property {number} height - The height of the BitmapText. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/RetroFontConfig.js b/src/gameobjects/bitmaptext/typedefs/RetroFontConfig.js new file mode 100644 index 000000000..a518d4d5e --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/RetroFontConfig.js @@ -0,0 +1,15 @@ +/** + * @typedef {object} Phaser.GameObjects.BitmapText.Types.RetroFontConfig + * @since 3.6.0 + * + * @property {string} image - The key of the image containing the font. + * @property {number} offset.x - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here. + * @property {number} offset.y - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here. + * @property {number} width - The width of each character in the font set. + * @property {number} height - The height of each character in the font set. + * @property {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements. + * @property {number} charsPerRow - The number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth. + * @property {number} spacing.x - If the characters in the font set have horizontal spacing between them set the required amount here. + * @property {number} spacing.y - If the characters in the font set have vertical spacing between them set the required amount here. + * @property {number} lineSpacing - The amount of vertical space to add to the line height of the font. +*/ diff --git a/src/gameobjects/bitmaptext/typedefs/TintConfig.js b/src/gameobjects/bitmaptext/typedefs/TintConfig.js new file mode 100644 index 000000000..dece44d75 --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/TintConfig.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.GameObjects.BitmapText.Types.TintConfig + * @since 3.0.0 + * + * @property {number} topLeft - The top left tint value. Always zero in canvas. + * @property {number} topRight - The top right tint value. Always zero in canvas. + * @property {number} bottomLeft - The bottom left tint value. Always zero in canvas. + * @property {number} bottomRight - The bottom right tint value. Always zero in canvas. + */ diff --git a/src/gameobjects/bitmaptext/typedefs/index.js b/src/gameobjects/bitmaptext/typedefs/index.js new file mode 100644 index 000000000..3b25a1e94 --- /dev/null +++ b/src/gameobjects/bitmaptext/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.BitmapText.Types + */ diff --git a/src/gameobjects/blitter/Blitter.js b/src/gameobjects/blitter/Blitter.js index f774bff65..dd74fb7ba 100644 --- a/src/gameobjects/blitter/Blitter.js +++ b/src/gameobjects/blitter/Blitter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,9 +13,9 @@ var GameObject = require('../GameObject'); var List = require('../../structs/List'); /** - * @callback Phaser.GameObjects.Blitter.CreateCallback + * @callback CreateCallback * - * @param {Phaser.GameObjects.Blitter.Bob} bob - The Bob that was created by the Blitter. + * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. * @param {integer} index - The position of the Bob within the Blitter display list. */ @@ -93,7 +93,7 @@ var Blitter = new Class({ * This List contains all of the Bob objects created by the Blitter. * * @name Phaser.GameObjects.Blitter#children - * @type {Phaser.Structs.List.} + * @type {Phaser.Structs.List.} * @since 3.0.0 */ this.children = new List(); @@ -103,7 +103,7 @@ var Blitter = new Class({ * The array is re-populated whenever the dirty flag is set. * * @name Phaser.GameObjects.Blitter#renderList - * @type {Phaser.GameObjects.Blitter.Bob[]} + * @type {Phaser.GameObjects.Bob[]} * @default [] * @private * @since 3.0.0 @@ -136,7 +136,7 @@ var Blitter = new Class({ * @param {boolean} [visible=true] - Should the created Bob render or not? * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. * - * @return {Phaser.GameObjects.Blitter.Bob} The newly created Bob object. + * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ create: function (x, y, frame, visible, index) { @@ -167,12 +167,12 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#createFromCallback * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. + * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. * @param {integer} quantity - The quantity of Bob objects to create. * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createFromCallback: function (callback, quantity, frame, visible) { @@ -203,7 +203,7 @@ var Blitter = new Class({ * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. */ createMultiple: function (quantity, frame, visible) { @@ -235,7 +235,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#childCanRender * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter.Bob} child - The Bob to check for rendering. + * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering. * * @return {boolean} Returns `true` if the given child can render, otherwise `false`. */ @@ -251,7 +251,7 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#getRenderList * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that will be rendered this frame. + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame. */ getRenderList: function () { diff --git a/src/gameobjects/blitter/BlitterCanvasRenderer.js b/src/gameobjects/blitter/BlitterCanvasRenderer.js index 09ee942a0..08320cc26 100644 --- a/src/gameobjects/blitter/BlitterCanvasRenderer.js +++ b/src/gameobjects/blitter/BlitterCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/blitter/BlitterCreator.js b/src/gameobjects/blitter/BlitterCreator.js index f3a19a1e7..4013c2555 100644 --- a/src/gameobjects/blitter/BlitterCreator.js +++ b/src/gameobjects/blitter/BlitterCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/blitter/BlitterFactory.js b/src/gameobjects/blitter/BlitterFactory.js index 7eddee64d..3b3998a8d 100644 --- a/src/gameobjects/blitter/BlitterFactory.js +++ b/src/gameobjects/blitter/BlitterFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/blitter/BlitterRender.js b/src/gameobjects/blitter/BlitterRender.js index 63b50ec36..a019338fb 100644 --- a/src/gameobjects/blitter/BlitterRender.js +++ b/src/gameobjects/blitter/BlitterRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/blitter/BlitterWebGLRenderer.js b/src/gameobjects/blitter/BlitterWebGLRenderer.js index cd9c3cbf9..da0baccd3 100644 --- a/src/gameobjects/blitter/BlitterWebGLRenderer.js +++ b/src/gameobjects/blitter/BlitterWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/blitter/Bob.js b/src/gameobjects/blitter/Bob.js index 008aa8ae9..0b61d9c59 100644 --- a/src/gameobjects/blitter/Bob.js +++ b/src/gameobjects/blitter/Bob.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -23,7 +23,7 @@ var Class = require('../../utils/Class'); * handled via the Blitter parent. * * @class Bob - * @memberof Phaser.GameObjects.Blitter + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -42,7 +42,7 @@ var Bob = new Class({ /** * The Blitter object that this Bob belongs to. * - * @name Phaser.GameObjects.Blitter.Bob#parent + * @name Phaser.GameObjects.Bob#parent * @type {Phaser.GameObjects.Blitter} * @since 3.0.0 */ @@ -51,7 +51,7 @@ var Bob = new Class({ /** * The x position of this Bob, relative to the x position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#x + * @name Phaser.GameObjects.Bob#x * @type {number} * @since 3.0.0 */ @@ -60,7 +60,7 @@ var Bob = new Class({ /** * The y position of this Bob, relative to the y position of the Blitter. * - * @name Phaser.GameObjects.Blitter.Bob#y + * @name Phaser.GameObjects.Bob#y * @type {number} * @since 3.0.0 */ @@ -70,7 +70,7 @@ var Bob = new Class({ * The frame that the Bob uses to render with. * To change the frame use the `Bob.setFrame` method. * - * @name Phaser.GameObjects.Blitter.Bob#frame + * @name Phaser.GameObjects.Bob#frame * @type {Phaser.Textures.Frame} * @protected * @since 3.0.0 @@ -80,7 +80,7 @@ var Bob = new Class({ /** * A blank object which can be used to store data related to this Bob in. * - * @name Phaser.GameObjects.Blitter.Bob#data + * @name Phaser.GameObjects.Bob#data * @type {object} * @default {} * @since 3.0.0 @@ -90,7 +90,7 @@ var Bob = new Class({ /** * The visible state of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_visible + * @name Phaser.GameObjects.Bob#_visible * @type {boolean} * @private * @since 3.0.0 @@ -100,7 +100,7 @@ var Bob = new Class({ /** * The alpha value of this Bob. * - * @name Phaser.GameObjects.Blitter.Bob#_alpha + * @name Phaser.GameObjects.Bob#_alpha * @type {number} * @private * @default 1 @@ -113,7 +113,7 @@ var Bob = new Class({ * A Bob that is flipped horizontally will render inversed on the horizontal axis. * Flipping always takes place from the middle of the texture. * - * @name Phaser.GameObjects.Blitter.Bob#flipX + * @name Phaser.GameObjects.Bob#flipX * @type {boolean} * @since 3.0.0 */ @@ -124,7 +124,7 @@ var Bob = new Class({ * A Bob 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. * - * @name Phaser.GameObjects.Blitter.Bob#flipY + * @name Phaser.GameObjects.Bob#flipY * @type {boolean} * @since 3.0.0 */ @@ -136,12 +136,12 @@ var Bob = new Class({ * The frame must be part of the Texture the parent Blitter is using. * If no value is given it will use the default frame of the Blitter parent. * - * @method Phaser.GameObjects.Blitter.Bob#setFrame + * @method Phaser.GameObjects.Bob#setFrame * @since 3.0.0 * * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFrame: function (frame) { @@ -160,10 +160,10 @@ var Bob = new Class({ /** * Resets the horizontal and vertical flipped state of this Bob back to their default un-flipped state. * - * @method Phaser.GameObjects.Blitter.Bob#resetFlip + * @method Phaser.GameObjects.Bob#resetFlip * @since 3.0.0 * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ resetFlip: function () { @@ -180,14 +180,14 @@ var Bob = new Class({ * * Also resets the flipX and flipY values, sets alpha back to 1 and visible to true. * - * @method Phaser.GameObjects.Blitter.Bob#reset + * @method Phaser.GameObjects.Bob#reset * @since 3.0.0 * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ reset: function (x, y, frame) { @@ -213,12 +213,12 @@ var Bob = new Class({ /** * Sets the horizontal flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipX + * @method Phaser.GameObjects.Bob#setFlipX * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipX: function (value) { @@ -230,12 +230,12 @@ var Bob = new Class({ /** * Sets the vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlipY + * @method Phaser.GameObjects.Bob#setFlipY * @since 3.0.0 * * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlipY: function (value) { @@ -247,13 +247,13 @@ var Bob = new Class({ /** * Sets the horizontal and vertical flipped state of this Bob. * - * @method Phaser.GameObjects.Blitter.Bob#setFlip + * @method Phaser.GameObjects.Bob#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.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setFlip: function (x, y) { @@ -268,12 +268,12 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setVisible + * @method Phaser.GameObjects.Bob#setVisible * @since 3.0.0 * * @param {boolean} value - The visible state of the Game Object. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setVisible: function (value) { @@ -288,12 +288,12 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @method Phaser.GameObjects.Blitter.Bob#setAlpha + * @method Phaser.GameObjects.Bob#setAlpha * @since 3.0.0 * * @param {number} value - The alpha value used for this Bob. Between 0 and 1. * - * @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object. + * @return {Phaser.GameObjects.Bob} This Bob Game Object. */ setAlpha: function (value) { @@ -306,7 +306,7 @@ var Bob = new Class({ * Destroys this Bob instance. * Removes itself from the Blitter and clears the parent, frame and data properties. * - * @method Phaser.GameObjects.Blitter.Bob#destroy + * @method Phaser.GameObjects.Bob#destroy * @since 3.0.0 */ destroy: function () @@ -325,7 +325,7 @@ var Bob = new Class({ * * An invisible Bob will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#visible + * @name Phaser.GameObjects.Bob#visible * @type {boolean} * @since 3.0.0 */ @@ -349,7 +349,7 @@ var Bob = new Class({ * * A Bob with alpha 0 will skip rendering. * - * @name Phaser.GameObjects.Blitter.Bob#alpha + * @name Phaser.GameObjects.Bob#alpha * @type {number} * @since 3.0.0 */ diff --git a/src/gameobjects/components/Alpha.js b/src/gameobjects/components/Alpha.js index 0f32a9173..24cebc09f 100644 --- a/src/gameobjects/components/Alpha.js +++ b/src/gameobjects/components/Alpha.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,7 +13,7 @@ var _FLAG = 2; // 0010 * 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 + * @namespace Phaser.GameObjects.Components.Alpha * @since 3.0.0 */ diff --git a/src/gameobjects/components/Animation.js b/src/gameobjects/components/Animation.js index eda08efb2..fc238f2e3 100644 --- a/src/gameobjects/components/Animation.js +++ b/src/gameobjects/components/Animation.js @@ -1,89 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseAnimation = require('../../animations/Animation'); var Class = require('../../utils/Class'); - -/** - * This event is dispatched when an animation starts playing. - * - * Listen for it on the Game Object: `sprite.on('animationstart', listener)` - * - * You can also listen for a specific animation by appending a hyphen and its key to the event name. For example, - * if you have an animation called `explode`, you can listen for `sprite.on('animationstart-explode', listener)`. - * - * You can also listen for the `start` event from the Animation itself: `animation.on('start', listener)`. - * - * @event Phaser.GameObjects.Components.Animation#onStartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation restarts. - * - * Listen for it on the Game Object: `sprite.on('animationrestart', listener)` - * - * You can also listen for a specific animation by appending a hyphen and its key to the event name. For example, - * if you have an animation called `explode`, you can listen for `sprite.on('animationrestart-explode', listener)`. - * - * You can also listen for the `restart` event from the Animation itself: `animation.on('restart', listener)`. - * - * @event Phaser.GameObjects.Components.Animation#onRestartEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation repeats. - * - * Listen for it on the Game Object: `sprite.on('animationrepeat', listener)` - * - * You can also listen for a specific animation by appending a hyphen and its key to the event name. For example, - * if you have an animation called `explode`, you can listen for `sprite.on('animationrepeat-explode', listener)`. - * - * @event Phaser.GameObjects.Components.Animation#onRepeatEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {integer} repeatCount - The number of times this animation has repeated. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation updates. This happens when the animation frame changes, - * based on the animation frame rate and other factors like timeScale and delay. - * - * Listen for it on the Game Object: `sprite.on('animationupdate', listener)` - * - * You can also listen for a specific animation by appending a hyphen and its key to the event name. For example, - * if you have an animation called `explode`, you can listen for `sprite.on('animationupdate-explode', listener)`. - * - * @event Phaser.GameObjects.Components.Animation#onUpdateEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ - -/** - * This event is dispatched when an animation completes playing, either naturally or via Animation.stop. - * - * Listen for it on the Game Object: `sprite.on('animationcomplete', listener)` - * - * You can also listen for a specific animation by appending a hyphen and its key to the event name. For example, - * if you have an animation called `explode`, you can listen for `sprite.on('animationcomplete-explode', listener)`. - * - * You can also listen for the `complete` event from the Animation itself: `animation.on('complete', listener)`. - * - * @event Phaser.GameObjects.Components.Animation#onCompleteEvent - * @param {Phaser.Animations.Animation} animation - Reference to the currently playing animation. - * @param {Phaser.Animations.AnimationFrame} frame - Reference to the current Animation Frame. - * @param {Phaser.GameObjects.Sprite} gameObject - Reference to the Game Object on which the event occurred. - */ +var Events = require('../../animations/events'); /** * @classdesc @@ -122,7 +45,7 @@ var Animation = new Class({ */ this.animationManager = parent.scene.sys.anims; - this.animationManager.once('remove', this.remove, this); + this.animationManager.once(Events.REMOVE_ANIMATION, this.remove, this); /** * Is an animation currently playing or not? @@ -276,9 +199,10 @@ var Animation = new Class({ * An Internal trigger that's play the animation in reverse mode ('true') or not ('false'), * needed because forward can be changed by yoyo feature. * - * @name Phaser.GameObjects.Components.Animation#forward + * @name Phaser.GameObjects.Components.Animation#_reverse * @type {boolean} * @default false + * @private * @since 3.12.0 */ this._reverse = false; @@ -580,7 +504,7 @@ var Animation = new Class({ * @since 3.0.0 * * @param {(string|Phaser.Animations.Animation)} key - The string-based key of the animation to play, as defined previously in the Animation Manager. Or an Animation instance. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * @param {boolean} [ignoreIfPlaying=false] - If this animation is already playing then ignore this call. * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. @@ -644,7 +568,9 @@ var Animation = new Class({ * Load an Animation and fires 'onStartEvent' event, extracted from 'play' method. * * @method Phaser.GameObjects.Components.Animation#_startAnimation - * @fires Phaser.GameObjects.Components.Animation#onStartEvent + * @fires Phaser.Animations.Events#START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_START_KEY_ANIMATION_EVENT * @since 3.12.0 * * @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager. @@ -674,11 +600,11 @@ var Animation = new Class({ var frame = this.currentFrame; - anim.emit('start', anim, frame); + anim.emit(Events.ANIMATION_START, anim, frame, gameObject); - gameObject.emit('animationstart-' + key, anim, frame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_START + key, anim, frame, gameObject); - gameObject.emit('animationstart', anim, frame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_START, anim, frame, gameObject); return gameObject; }, @@ -844,7 +770,9 @@ var Animation = new Class({ * Restarts the current animation from its beginning, optionally including its delay value. * * @method Phaser.GameObjects.Components.Animation#restart - * @fires Phaser.GameObjects.Components.Animation#onRestartEvent + * @fires Phaser.Animations.Events#RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_ANIMATION_EVENT + * @fires Phaser.Animations.Events#SPRITE_RESTART_KEY_ANIMATION_EVENT * @since 3.0.0 * * @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting. @@ -870,11 +798,11 @@ var Animation = new Class({ var gameObject = this.parent; var frame = this.currentFrame; - anim.emit('restart', anim, frame); + anim.emit(Events.ANIMATION_RESTART, anim, frame, gameObject); - gameObject.emit('animationrestart-' + anim.key, anim, frame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_RESTART + anim.key, anim, frame, gameObject); - gameObject.emit('animationrestart', anim, frame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_RESTART, anim, frame, gameObject); return this.parent; }, @@ -904,11 +832,11 @@ var Animation = new Class({ if (anim) { - anim.emit('complete', anim, frame); + anim.emit(Events.ANIMATION_COMPLETE, anim, frame, gameObject); - gameObject.emit('animationcomplete-' + anim.key, anim, frame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_COMPLETE + anim.key, anim, frame, gameObject); - gameObject.emit('animationcomplete', anim, frame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_COMPLETE, anim, frame, gameObject); } if (this.nextAnim) @@ -1101,7 +1029,8 @@ var Animation = new Class({ * Internal frame change handler. * * @method Phaser.GameObjects.Components.Animation#updateFrame - * @fires Phaser.GameObjects.Components.Animation#onUpdateEvent + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE_EVENT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE_EVENT * @private * @since 3.0.0 * @@ -1120,9 +1049,9 @@ var Animation = new Class({ var anim = this.currentAnim; - gameObject.emit('animationupdate-' + anim.key, anim, animationFrame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_KEY_UPDATE + anim.key, anim, animationFrame, gameObject); - gameObject.emit('animationupdate', anim, animationFrame, gameObject); + gameObject.emit(Events.SPRITE_ANIMATION_UPDATE, anim, animationFrame, gameObject); if (this._pendingStop === 3 && this._pendingStopValue === animationFrame) { @@ -1219,7 +1148,7 @@ var Animation = new Class({ */ destroy: function () { - this.animationManager.off('remove', this.remove, this); + this.animationManager.off(Events.REMOVE_ANIMATION, this.remove, this); this.animationManager = null; this.parent = null; diff --git a/src/gameobjects/components/BlendMode.js b/src/gameobjects/components/BlendMode.js index f535a15ab..6a80c6fdc 100644 --- a/src/gameobjects/components/BlendMode.js +++ b/src/gameobjects/components/BlendMode.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var BlendModes = require('../../renderer/BlendModes'); * 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 + * @namespace Phaser.GameObjects.Components.BlendMode * @since 3.0.0 */ diff --git a/src/gameobjects/components/ComputedSize.js b/src/gameobjects/components/ComputedSize.js index 0b37a71d4..25ed5192a 100644 --- a/src/gameobjects/components/ComputedSize.js +++ b/src/gameobjects/components/ComputedSize.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * Provides methods used for calculating and setting the size of a non-Frame based Game Object. * Should be applied as a mixin and not used directly. * - * @name Phaser.GameObjects.Components.ComputedSize + * @namespace Phaser.GameObjects.Components.ComputedSize * @since 3.0.0 */ diff --git a/src/gameobjects/components/Crop.js b/src/gameobjects/components/Crop.js index daf70baba..9d2902625 100644 --- a/src/gameobjects/components/Crop.js +++ b/src/gameobjects/components/Crop.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for getting and setting the texture of a Game Object. * - * @name Phaser.GameObjects.Components.Crop + * @namespace Phaser.GameObjects.Components.Crop * @since 3.12.0 */ diff --git a/src/gameobjects/components/Depth.js b/src/gameobjects/components/Depth.js index f5e49ed41..d816caffd 100644 --- a/src/gameobjects/components/Depth.js +++ b/src/gameobjects/components/Depth.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * 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 + * @namespace Phaser.GameObjects.Components.Depth * @since 3.0.0 */ diff --git a/src/gameobjects/components/Flip.js b/src/gameobjects/components/Flip.js index dd1a3e690..119d1a2e2 100644 --- a/src/gameobjects/components/Flip.js +++ b/src/gameobjects/components/Flip.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * Provides methods used for visually flipping a Game Object. * Should be applied as a mixin and not used directly. * - * @name Phaser.GameObjects.Components.Flip + * @namespace Phaser.GameObjects.Components.Flip * @since 3.0.0 */ diff --git a/src/gameobjects/components/GetBounds.js b/src/gameobjects/components/GetBounds.js index ba2a0224b..23c4c0373 100644 --- a/src/gameobjects/components/GetBounds.js +++ b/src/gameobjects/components/GetBounds.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,7 +12,7 @@ var Vector2 = require('../../math/Vector2'); * 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 + * @namespace Phaser.GameObjects.Components.GetBounds * @since 3.0.0 */ diff --git a/src/gameobjects/components/Mask.js b/src/gameobjects/components/Mask.js index edbf03e3a..d5b9c2230 100644 --- a/src/gameobjects/components/Mask.js +++ b/src/gameobjects/components/Mask.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var GeometryMask = require('../../display/mask/GeometryMask'); /** * Provides methods used for getting and setting the mask of a Game Object. * - * @name Phaser.GameObjects.Components.Mask + * @namespace Phaser.GameObjects.Components.Mask * @since 3.0.0 */ diff --git a/src/gameobjects/components/Origin.js b/src/gameobjects/components/Origin.js index 75fc1a7db..9a01669be 100644 --- a/src/gameobjects/components/Origin.js +++ b/src/gameobjects/components/Origin.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ * Display values contain the calculated pixel values. * Should be applied as a mixin and not used directly. * - * @name Phaser.GameObjects.Components.Origin + * @namespace Phaser.GameObjects.Components.Origin * @since 3.0.0 */ diff --git a/src/gameobjects/components/Pipeline.js b/src/gameobjects/components/Pipeline.js index ecf550dff..2eda90a7f 100644 --- a/src/gameobjects/components/Pipeline.js +++ b/src/gameobjects/components/Pipeline.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the WebGL rendering pipeline of a Game Object. * - * @name Phaser.GameObjects.Components.Pipeline + * @namespace Phaser.GameObjects.Components.Pipeline * @webglOnly * @since 3.0.0 */ diff --git a/src/gameobjects/components/ScaleMode.js b/src/gameobjects/components/ScaleMode.js index ee0a78650..70c046f85 100644 --- a/src/gameobjects/components/ScaleMode.js +++ b/src/gameobjects/components/ScaleMode.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,7 +9,7 @@ var ScaleModes = require('../../renderer/ScaleModes'); /** * Provides methods used for getting and setting the scale of a Game Object. * - * @name Phaser.GameObjects.Components.ScaleMode + * @namespace Phaser.GameObjects.Components.ScaleMode * @since 3.0.0 */ diff --git a/src/gameobjects/components/ScrollFactor.js b/src/gameobjects/components/ScrollFactor.js index a90fe7861..a7ff7cee5 100644 --- a/src/gameobjects/components/ScrollFactor.js +++ b/src/gameobjects/components/ScrollFactor.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 + * @namespace Phaser.GameObjects.Components.ScrollFactor * @since 3.0.0 */ diff --git a/src/gameobjects/components/Size.js b/src/gameobjects/components/Size.js index c9850bb1d..7356da809 100644 --- a/src/gameobjects/components/Size.js +++ b/src/gameobjects/components/Size.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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 + * @namespace Phaser.GameObjects.Components.Size * @since 3.0.0 */ diff --git a/src/gameobjects/components/Texture.js b/src/gameobjects/components/Texture.js index e887fa496..3ec271eac 100644 --- a/src/gameobjects/components/Texture.js +++ b/src/gameobjects/components/Texture.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var _FLAG = 8; // 1000 /** * Provides methods used for getting and setting the texture of a Game Object. * - * @name Phaser.GameObjects.Components.Texture + * @namespace Phaser.GameObjects.Components.Texture * @since 3.0.0 */ diff --git a/src/gameobjects/components/TextureCrop.js b/src/gameobjects/components/TextureCrop.js index 273e2cbba..aa1748dd7 100644 --- a/src/gameobjects/components/TextureCrop.js +++ b/src/gameobjects/components/TextureCrop.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var _FLAG = 8; // 1000 /** * Provides methods used for getting and setting the texture of a Game Object. * - * @name Phaser.GameObjects.Components.TextureCrop + * @namespace Phaser.GameObjects.Components.TextureCrop * @since 3.0.0 */ diff --git a/src/gameobjects/components/Tint.js b/src/gameobjects/components/Tint.js index 478172ece..6db344b5e 100644 --- a/src/gameobjects/components/Tint.js +++ b/src/gameobjects/components/Tint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,7 +18,7 @@ var GetColor = function (value) * 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 + * @namespace Phaser.GameObjects.Components.Tint * @webglOnly * @since 3.0.0 */ diff --git a/src/gameobjects/components/ToJSON.js b/src/gameobjects/components/ToJSON.js index 3391a43bb..b1e44021d 100644 --- a/src/gameobjects/components/ToJSON.js +++ b/src/gameobjects/components/ToJSON.js @@ -1,34 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} JSONGameObject - * - * @property {string} name - The name of this Game Object. - * @property {string} type - A textual representation of this Game Object, i.e. `sprite`. - * @property {number} x - The x position of this Game Object. - * @property {number} y - The y position of this Game Object. - * @property {object} scale - The scale of this Game Object - * @property {number} scale.x - The horizontal scale of this Game Object. - * @property {number} scale.y - The vertical scale of this Game Object. - * @property {object} origin - The origin of this Game Object. - * @property {number} origin.x - The horizontal origin of this Game Object. - * @property {number} origin.y - The vertical origin of this Game Object. - * @property {boolean} flipX - The horizontally flipped state of the Game Object. - * @property {boolean} flipY - The vertically flipped state of the Game Object. - * @property {number} rotation - The angle of this Game Object in radians. - * @property {number} alpha - The alpha value of the Game Object. - * @property {boolean} visible - The visible state of the Game Object. - * @property {integer} scaleMode - The Scale Mode being used by this Game Object. - * @property {(integer|string)} blendMode - Sets the Blend Mode being used by this Game Object. - * @property {string} textureKey - The texture key of this Game Object. - * @property {string} frameKey - The frame key of this Game Object. - * @property {object} data - The data of this Game Object. - */ - /** * Build a JSON representation of the given Game Object. * @@ -39,7 +14,7 @@ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. * - * @return {JSONGameObject} A JSON representation of the Game Object. + * @return {Phaser.GameObjects.Types.JSONGameObject} A JSON representation of the Game Object. */ var ToJSON = function (gameObject) { diff --git a/src/gameobjects/components/Transform.js b/src/gameobjects/components/Transform.js index 89b5629aa..683432656 100644 --- a/src/gameobjects/components/Transform.js +++ b/src/gameobjects/components/Transform.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var _FLAG = 4; // 0100 /** * Provides methods used for getting and setting the position, scale and rotation of a Game Object. * - * @name Phaser.GameObjects.Components.Transform + * @namespace Phaser.GameObjects.Components.Transform * @since 3.0.0 */ @@ -258,8 +258,8 @@ var Transform = { { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } this.x = x + (Math.random() * width); this.y = y + (Math.random() * height); diff --git a/src/gameobjects/components/TransformMatrix.js b/src/gameobjects/components/TransformMatrix.js index ab9ac0c02..4e4960ba5 100644 --- a/src/gameobjects/components/TransformMatrix.js +++ b/src/gameobjects/components/TransformMatrix.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/components/Visible.js b/src/gameobjects/components/Visible.js index 259b7b1fa..5df0ff96c 100644 --- a/src/gameobjects/components/Visible.js +++ b/src/gameobjects/components/Visible.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,7 +11,7 @@ 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 + * @namespace Phaser.GameObjects.Components.Visible * @since 3.0.0 */ diff --git a/src/gameobjects/components/index.js b/src/gameobjects/components/index.js index b6b038642..7885145ff 100644 --- a/src/gameobjects/components/index.js +++ b/src/gameobjects/components/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/container/Container.js b/src/gameobjects/container/Container.js index 61396731c..85bb56f0c 100644 --- a/src/gameobjects/container/Container.js +++ b/src/gameobjects/container/Container.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,6 +9,7 @@ var ArrayUtils = require('../../utils/array'); var BlendModes = require('../../renderer/BlendModes'); var Class = require('../../utils/Class'); var Components = require('../components'); +var Events = require('../events'); var GameObject = require('../GameObject'); var Rectangle = require('../../geom/rectangle/Rectangle'); var Render = require('./ContainerRender'); @@ -363,7 +364,7 @@ var Container = new Class({ */ addHandler: function (gameObject) { - gameObject.once('destroy', this.remove, this); + gameObject.once(Events.DESTROY, this.remove, this); if (this.exclusive) { @@ -389,7 +390,7 @@ var Container = new Class({ */ removeHandler: function (gameObject) { - gameObject.off('destroy', this.remove); + gameObject.off(Events.DESTROY, this.remove); if (this.exclusive) { @@ -524,36 +525,28 @@ var Container = new Class({ * @since 3.4.0 * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.GameObjects.Container} This Container instance. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - ArrayUtils.StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal sort handler method. - * - * @method Phaser.GameObjects.Container#sortHandler - * @private - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} childA - The first child to sort. - * @param {Phaser.GameObjects.GameObject} childB - The second child to sort. - * - * @return {integer} The sort results. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + ArrayUtils.StableSort.inplace(this.list, handler); + + return this; }, /** @@ -601,8 +594,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getFirst * @since 3.4.0 * - * @param {string} [property] - The property to test on each Game Object in the Container. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {string} property - The property to test on each Game Object in the Container. + * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. * @param {integer} [startIndex=0] - An optional start index to search from. * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) * diff --git a/src/gameobjects/container/ContainerCanvasRenderer.js b/src/gameobjects/container/ContainerCanvasRenderer.js index 02bafdaf2..79bce6fc1 100644 --- a/src/gameobjects/container/ContainerCanvasRenderer.js +++ b/src/gameobjects/container/ContainerCanvasRenderer.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/container/ContainerCreator.js b/src/gameobjects/container/ContainerCreator.js index 956c40f41..450c54214 100644 --- a/src/gameobjects/container/ContainerCreator.js +++ b/src/gameobjects/container/ContainerCreator.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/container/ContainerFactory.js b/src/gameobjects/container/ContainerFactory.js index dbd61522b..eeaf18cf9 100644 --- a/src/gameobjects/container/ContainerFactory.js +++ b/src/gameobjects/container/ContainerFactory.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/container/ContainerRender.js b/src/gameobjects/container/ContainerRender.js index 4efe4a74b..820fb1d12 100644 --- a/src/gameobjects/container/ContainerRender.js +++ b/src/gameobjects/container/ContainerRender.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/container/ContainerWebGLRenderer.js b/src/gameobjects/container/ContainerWebGLRenderer.js index f59066313..d25bbe161 100644 --- a/src/gameobjects/container/ContainerWebGLRenderer.js +++ b/src/gameobjects/container/ContainerWebGLRenderer.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/domelement/CSSBlendModes.js b/src/gameobjects/domelement/CSSBlendModes.js index ea33d0fb2..abd5df316 100644 --- a/src/gameobjects/domelement/CSSBlendModes.js +++ b/src/gameobjects/domelement/CSSBlendModes.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/domelement/DOMElement.js b/src/gameobjects/domelement/DOMElement.js index 2e40120cc..8ff937393 100644 --- a/src/gameobjects/domelement/DOMElement.js +++ b/src/gameobjects/domelement/DOMElement.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/domelement/DOMElementCSSRenderer.js b/src/gameobjects/domelement/DOMElementCSSRenderer.js index 9d006574d..111f226ca 100644 --- a/src/gameobjects/domelement/DOMElementCSSRenderer.js +++ b/src/gameobjects/domelement/DOMElementCSSRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/domelement/DOMElementFactory.js b/src/gameobjects/domelement/DOMElementFactory.js index 4d46fc994..32a20d39e 100644 --- a/src/gameobjects/domelement/DOMElementFactory.js +++ b/src/gameobjects/domelement/DOMElementFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/domelement/DOMElementRender.js b/src/gameobjects/domelement/DOMElementRender.js index 8dd2c34fc..0437add11 100644 --- a/src/gameobjects/domelement/DOMElementRender.js +++ b/src/gameobjects/domelement/DOMElementRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/events/DESTROY_EVENT.js b/src/gameobjects/events/DESTROY_EVENT.js new file mode 100644 index 000000000..f43db2f91 --- /dev/null +++ b/src/gameobjects/events/DESTROY_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Destroy Event. + * + * This event is dispatched when a Game Object instance is being destroyed. + * + * Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`. + * + * @event Phaser.GameObjects.Events#DESTROY + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object which is being destroyed. + */ +module.exports = 'destroy'; diff --git a/src/gameobjects/events/index.js b/src/gameobjects/events/index.js new file mode 100644 index 000000000..1758afafc --- /dev/null +++ b/src/gameobjects/events/index.js @@ -0,0 +1,11 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { DESTROY: require('./DESTROY_EVENT') }; diff --git a/src/gameobjects/extern/Extern.js b/src/gameobjects/extern/Extern.js index f39a7d2f6..57f1e9661 100644 --- a/src/gameobjects/extern/Extern.js +++ b/src/gameobjects/extern/Extern.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,7 +11,21 @@ var ExternRender = require('./ExternRender'); /** * @classdesc - * An Extern Game Object. + * An Extern Game Object is a special type of Game Object that allows you to pass + * rendering off to a 3rd party. + * + * When you create an Extern and place it in the display list of a Scene, the renderer will + * process the list as usual. When it finds an Extern it will flush the current batch, + * clear down the pipeline and prepare a transform matrix which your render function can + * take advantage of, if required. + * + * The WebGL context is then left is a 'clean' state, ready for you to bind your own shaders, + * or draw to it, whatever you wish to do. Once you've finished, you should free-up any + * of your resources. The Extern will then rebind the Phaser pipeline and carry on + * rendering the display list. + * + * Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of + * them are used during rendering unless you take advantage of them in your own render code. * * @class Extern * @extends Phaser.GameObjects.GameObject @@ -72,7 +86,7 @@ var Extern = new Class({ // override this! // Arguments: renderer, camera, calcMatrix } - + }); module.exports = Extern; diff --git a/src/gameobjects/extern/ExternFactory.js b/src/gameobjects/extern/ExternFactory.js index 1f064d6ba..b98907aa6 100644 --- a/src/gameobjects/extern/ExternFactory.js +++ b/src/gameobjects/extern/ExternFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,11 +15,6 @@ var GameObjectFactory = require('../GameObjectFactory'); * @method Phaser.GameObjects.GameObjectFactory#extern * @since 3.16.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. - * * @return {Phaser.GameObjects.Extern} The Game Object that was created. */ GameObjectFactory.register('extern', function () diff --git a/src/gameobjects/extern/ExternRender.js b/src/gameobjects/extern/ExternRender.js index 3d1da6bdd..47c2c07fc 100644 --- a/src/gameobjects/extern/ExternRender.js +++ b/src/gameobjects/extern/ExternRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/extern/ExternWebGLRenderer.js b/src/gameobjects/extern/ExternWebGLRenderer.js index 313bc68b8..af5897667 100644 --- a/src/gameobjects/extern/ExternWebGLRenderer.js +++ b/src/gameobjects/extern/ExternWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/graphics/Commands.js b/src/gameobjects/graphics/Commands.js index f74fb3d18..c1efee88e 100644 --- a/src/gameobjects/graphics/Commands.js +++ b/src/gameobjects/graphics/Commands.js @@ -1,13 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 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, diff --git a/src/gameobjects/graphics/Graphics.js b/src/gameobjects/graphics/Graphics.js index 2d6399838..6190f8faa 100644 --- a/src/gameobjects/graphics/Graphics.js +++ b/src/gameobjects/graphics/Graphics.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -23,44 +23,6 @@ var GetValue = require('../../utils/object/GetValue'); var MATH_CONST = require('../../math/const'); var Render = require('./GraphicsRender'); -/** - * Graphics line style (or stroke style) settings. - * - * @typedef {object} GraphicsLineStyle - * - * @property {number} [width] - The stroke width. - * @property {number} [color] - The stroke color. - * @property {number} [alpha] - The stroke alpha. - */ - -/** - * Graphics fill style settings. - * - * @typedef {object} GraphicsFillStyle - * - * @property {number} [color] - The fill color. - * @property {number} [alpha] - The fill alpha. - */ - -/** - * Graphics style settings. - * - * @typedef {object} GraphicsStyles - * - * @property {GraphicsLineStyle} [lineStyle] - The style applied to shape outlines. - * @property {GraphicsFillStyle} [fillStyle] - The style applied to shape areas. - */ - -/** - * Options for the Graphics game Object. - * - * @typedef {object} GraphicsOptions - * @extends GraphicsStyles - * - * @property {number} [x] - The x coordinate of the Graphics. - * @property {number} [y] - The y coordinate of the Graphics. - */ - /** * @classdesc * A Graphics object is a way to draw primitive shapes to your game. Primitives include forms of geometry, such as @@ -118,7 +80,7 @@ var Render = require('./GraphicsRender'); * @extends Phaser.GameObjects.Components.ScrollFactor * * @param {Phaser.Scene} scene - The Scene to which this Graphics object belongs. - * @param {GraphicsOptions} [options] - Options that set the position and default style of this Graphics object. + * @param {Phaser.GameObjects.Graphics.Types.Options} [options] - Options that set the position and default style of this Graphics object. */ var Graphics = new Class({ @@ -247,7 +209,7 @@ var Graphics = new Class({ * @method Phaser.GameObjects.Graphics#setDefaultStyles * @since 3.0.0 * - * @param {GraphicsStyles} options - The styles to set as defaults. + * @param {Phaser.GameObjects.Graphics.Types.Styles} options - The styles to set as defaults. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -740,11 +702,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(Phaser.GameObjects.Graphics.Types.RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -790,11 +748,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners - * @param {number} [radius.tl = 20] Top left - * @param {number} [radius.tr = 20] Top right - * @param {number} [radius.br = 20] Bottom right - * @param {number} [radius.bl = 20] Bottom left + * @param {(Phaser.GameObjects.Graphics.Types.RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. * * @return {Phaser.GameObjects.Graphics} This Game Object. */ @@ -1486,8 +1440,8 @@ var Graphics = new Class({ var sys = this.scene.sys; var renderer = sys.game.renderer; - if (width === undefined) { width = sys.game.config.width; } - if (height === undefined) { height = sys.game.config.height; } + if (width === undefined) { width = sys.scale.width; } + if (height === undefined) { height = sys.scale.height; } Graphics.TargetCamera.setScene(this.scene); Graphics.TargetCamera.setViewport(0, 0, width, height); diff --git a/src/gameobjects/graphics/GraphicsCanvasRenderer.js b/src/gameobjects/graphics/GraphicsCanvasRenderer.js index 40f438790..8e39b2f82 100644 --- a/src/gameobjects/graphics/GraphicsCanvasRenderer.js +++ b/src/gameobjects/graphics/GraphicsCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/graphics/GraphicsCreator.js b/src/gameobjects/graphics/GraphicsCreator.js index 962ab60f7..4ab2a45de 100644 --- a/src/gameobjects/graphics/GraphicsCreator.js +++ b/src/gameobjects/graphics/GraphicsCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/graphics/GraphicsFactory.js b/src/gameobjects/graphics/GraphicsFactory.js index 760913a64..c4f35035a 100644 --- a/src/gameobjects/graphics/GraphicsFactory.js +++ b/src/gameobjects/graphics/GraphicsFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var GameObjectFactory = require('../GameObjectFactory'); * @method Phaser.GameObjects.GameObjectFactory#graphics * @since 3.0.0 * - * @param {GraphicsOptions} [config] - The Graphics configuration. + * @param {Phaser.GameObjects.Graphics.Types.Options} [config] - The Graphics configuration. * * @return {Phaser.GameObjects.Graphics} The Game Object that was created. */ diff --git a/src/gameobjects/graphics/GraphicsRender.js b/src/gameobjects/graphics/GraphicsRender.js index 945d8c3fc..93369005c 100644 --- a/src/gameobjects/graphics/GraphicsRender.js +++ b/src/gameobjects/graphics/GraphicsRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/graphics/GraphicsWebGLRenderer.js b/src/gameobjects/graphics/GraphicsWebGLRenderer.js index a5495f928..bffa28652 100644 --- a/src/gameobjects/graphics/GraphicsWebGLRenderer.js +++ b/src/gameobjects/graphics/GraphicsWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -47,12 +47,12 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca return; } - var pipeline = this.pipeline; + var pipeline = renderer.currentPipeline; var camMatrix = pipeline._tempMatrix1; var graphicsMatrix = pipeline._tempMatrix2; var currentMatrix = pipeline._tempMatrix4; - + renderer.setPipeline(pipeline); currentMatrix.loadIdentity(); diff --git a/src/gameobjects/graphics/typedefs/FillStyle.js b/src/gameobjects/graphics/typedefs/FillStyle.js new file mode 100644 index 000000000..ce9018170 --- /dev/null +++ b/src/gameobjects/graphics/typedefs/FillStyle.js @@ -0,0 +1,9 @@ +/** + * Graphics fill style settings. + * + * @typedef {object} Phaser.GameObjects.Graphics.Types.FillStyle + * @since 3.0.0 + * + * @property {number} [color] - The fill color. + * @property {number} [alpha] - The fill alpha. + */ diff --git a/src/gameobjects/graphics/typedefs/LineStyle.js b/src/gameobjects/graphics/typedefs/LineStyle.js new file mode 100644 index 000000000..a9e4c89e4 --- /dev/null +++ b/src/gameobjects/graphics/typedefs/LineStyle.js @@ -0,0 +1,10 @@ +/** + * Graphics line style (or stroke style) settings. + * + * @typedef {object} Phaser.GameObjects.Graphics.Types.LineStyle + * @since 3.0.0 + * + * @property {number} [width] - The stroke width. + * @property {number} [color] - The stroke color. + * @property {number} [alpha] - The stroke alpha. + */ diff --git a/src/gameobjects/graphics/typedefs/Options.js b/src/gameobjects/graphics/typedefs/Options.js new file mode 100644 index 000000000..75bab7504 --- /dev/null +++ b/src/gameobjects/graphics/typedefs/Options.js @@ -0,0 +1,10 @@ +/** + * Options for the Graphics game Object. + * + * @typedef {object} Phaser.GameObjects.Graphics.Types.Options + * @extends Phaser.GameObjects.Graphics.Types.Styles + * @since 3.0.0 + * + * @property {number} [x] - The x coordinate of the Graphics. + * @property {number} [y] - The y coordinate of the Graphics. + */ diff --git a/src/gameobjects/graphics/typedefs/RoundedRectRadius.js b/src/gameobjects/graphics/typedefs/RoundedRectRadius.js new file mode 100644 index 000000000..68bda0cc9 --- /dev/null +++ b/src/gameobjects/graphics/typedefs/RoundedRectRadius.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.GameObjects.Graphics.Types.RoundedRectRadius + * @since 3.11.0 + * + * @property {number} [tl=20] - Top left + * @property {number} [tr=20] - Top right + * @property {number} [br=20] - Bottom right + * @property {number} [bl=20] - Bottom left + */ diff --git a/src/gameobjects/graphics/typedefs/Styles.js b/src/gameobjects/graphics/typedefs/Styles.js new file mode 100644 index 000000000..f94858de5 --- /dev/null +++ b/src/gameobjects/graphics/typedefs/Styles.js @@ -0,0 +1,9 @@ +/** + * Graphics style settings. + * + * @typedef {object} Phaser.GameObjects.Graphics.Types.Styles + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Graphics.Types.LineStyle} [lineStyle] - The style applied to shape outlines. + * @property {Phaser.GameObjects.Graphics.Types.FillStyle} [fillStyle] - The style applied to shape areas. + */ diff --git a/src/gameobjects/graphics/typedefs/index.js b/src/gameobjects/graphics/typedefs/index.js new file mode 100644 index 000000000..dcabcc9ce --- /dev/null +++ b/src/gameobjects/graphics/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Graphics.Types + */ diff --git a/src/gameobjects/group/Group.js b/src/gameobjects/group/Group.js index 57f2ebc05..cf2af3ba9 100644 --- a/src/gameobjects/group/Group.js +++ b/src/gameobjects/group/Group.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Actions = require('../../actions/'); var Class = require('../../utils/Class'); +var Events = require('../events'); var GetFastValue = require('../../utils/object/GetFastValue'); var GetValue = require('../../utils/object/GetValue'); var IsPlainObject = require('../../utils/object/IsPlainObject'); @@ -14,99 +15,8 @@ var Set = require('../../structs/Set'); var Sprite = require('../sprite/Sprite'); /** - * @callback GroupCallback - * - * @param {Phaser.GameObjects.GameObject} item - A group member - */ - -/** - * @callback GroupMultipleCreateCallback - * - * @param {Phaser.GameObjects.GameObject[]} items - The newly created group members - */ - -/** - * @typedef {object} GroupConfig - * - * @property {?GroupClassTypeConstructor} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. - * @property {?boolean} [active=true] - Sets {@link Phaser.GameObjects.Group#active}. - * @property {?number} [maxSize=-1] - Sets {@link Phaser.GameObjects.Group#maxSize}. - * @property {?string} [defaultKey=null] - Sets {@link Phaser.GameObjects.Group#defaultKey}. - * @property {?(string|integer)} [defaultFrame=null] - Sets {@link Phaser.GameObjects.Group#defaultFrame}. - * @property {?boolean} [runChildUpdate=false] - Sets {@link Phaser.GameObjects.Group#runChildUpdate}. - * @property {?GroupCallback} [createCallback=null] - Sets {@link Phaser.GameObjects.Group#createCallback}. - * @property {?GroupCallback} [removeCallback=null] - Sets {@link Phaser.GameObjects.Group#removeCallback}. - * @property {?GroupMultipleCreateCallback} [createMultipleCallback=null] - Sets {@link Phaser.GameObjects.Group#createMultipleCallback}. - */ - -/** - * @typedef {object} GroupCreateConfig - * - * The total number of objects created will be - * - * key.length * frame.length * frameQuantity * (yoyo ? 2 : 1) * (1 + repeat) - * - * In the simplest case, 1 + `repeat` objects will be created. - * - * If `max` is positive, then the total created will not exceed `max`. - * - * `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used. - * - * @property {?GroupClassTypeConstructor} [classType] - The class of each new Game Object. - * @property {string} [key] - The texture key of each new Game Object. - * @property {?(string|integer)} [frame=null] - The texture frame of each new Game Object. - * @property {?boolean} [visible=true] - The visible state of each new Game Object. - * @property {?boolean} [active=true] - The active state of each new Game Object. - * @property {?number} [repeat=0] - The number of times each `key` × `frame` combination will be *repeated* (after the first combination). - * @property {?boolean} [randomKey=false] - Select a `key` at random. - * @property {?boolean} [randomFrame=false] - Select a `frame` at random. - * @property {?boolean} [yoyo=false] - Select keys and frames by moving forward then backward through `key` and `frame`. - * @property {?number} [frameQuantity=1] - The number of times each `frame` should be combined with one `key`. - * @property {?number} [max=0] - The maximum number of new Game Objects to create. 0 is no maximum. - * @property {?object} [setXY] - * @property {?number} [setXY.x=0] - The horizontal position of each new Game Object. - * @property {?number} [setXY.y=0] - The vertical position of each new Game Object. - * @property {?number} [setXY.stepX=0] - Increment each Game Object's horizontal position from the previous by this amount, starting from `setXY.x`. - * @property {?number} [setXY.stepY=0] - Increment each Game Object's vertical position from the previous by this amount, starting from `setXY.y`. - * @property {?object} [setRotation] - * @property {?number} [setRotation.value=0] - Rotation of each new Game Object. - * @property {?number} [setRotation.step=0] - Increment each Game Object's rotation from the previous by this amount, starting at `setRotation.value`. - * @property {?object} [setScale] - * @property {?number} [setScale.x=0] - The horizontal scale of each new Game Object. - * @property {?number} [setScale.y=0] - The vertical scale of each new Game Object. - * @property {?number} [setScale.stepX=0] - Increment each Game Object's horizontal scale from the previous by this amount, starting from `setScale.x`. - * @property {?number} [setScale.stepY=0] - Increment each Game object's vertical scale from the previous by this amount, starting from `setScale.y`. - * @property {?object} [setAlpha] - * @property {?number} [setAlpha.value=0] - The alpha value of each new Game Object. - * @property {?number} [setAlpha.step=0] - Increment each Game Object's alpha from the previous by this amount, starting from `setAlpha.value`. - * @property {?*} [hitArea] - A geometric shape that defines the hit area for the Game Object. - * @property {?HitAreaCallback} [hitAreaCallback] - A callback to be invoked when the Game Object is interacted with. - * @property {?(false|GridAlignConfig)} [gridAlign=false] - Align the new Game Objects in a grid using these settings. - * - * @see Phaser.Actions.GridAlign - * @see Phaser.Actions.SetAlpha - * @see Phaser.Actions.SetHitArea - * @see Phaser.Actions.SetRotation - * @see Phaser.Actions.SetScale - * @see Phaser.Actions.SetXY - * @see Phaser.GameObjects.Group#createFromConfig - * @see Phaser.Utils.Array.Range - */ - -/** - * A constructor function (class) that can be assigned to `classType`. - * @callback GroupClassTypeConstructor - * @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. - * - * @see Phaser.GameObjects.Group#classType - */ - -/** - * @classdesc A Group is a way for you to create, manipulate, or recycle similar Game Objects. + * @classdesc + * A Group is a way for you to create, manipulate, or recycle similar Game Objects. * * Group membership is non-exclusive. A Game Object can belong to several groups, one group, or none. * @@ -117,8 +27,8 @@ var Sprite = require('../sprite/Sprite'); * @constructor * @since 3.0.0 * @param {Phaser.Scene} scene - The scene this group belongs to. - * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {GroupConfig|GroupCreateConfig} [config] - Settings for this group. If `key` is set, Phaser.GameObjects.Group#createMultiple is also called with these settings. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} [config] - Settings for this group. If `key` is set, Phaser.GameObjects.Group#createMultiple is also called with these settings. * * @see Phaser.Physics.Arcade.Group * @see Phaser.Physics.Arcade.StaticGroup @@ -197,7 +107,7 @@ var Group = new Class({ * The class to create new group members from. * * @name Phaser.GameObjects.Group#classType - * @type {GroupClassTypeConstructor} + * @type {Phaser.GameObjects.Group.Types.GroupClassTypeConstructor} * @since 3.0.0 * @default Phaser.GameObjects.Sprite */ @@ -259,7 +169,7 @@ var Group = new Class({ * A function to be called when adding or creating group members. * * @name Phaser.GameObjects.Group#createCallback - * @type {?GroupCallback} + * @type {?Phaser.GameObjects.Group.Types.GroupCallback} * @since 3.0.0 */ this.createCallback = GetFastValue(config, 'createCallback', null); @@ -268,7 +178,7 @@ var Group = new Class({ * A function to be called when removing group members. * * @name Phaser.GameObjects.Group#removeCallback - * @type {?GroupCallback} + * @type {?Phaser.GameObjects.Group.Types.GroupCallback} * @since 3.0.0 */ this.removeCallback = GetFastValue(config, 'removeCallback', null); @@ -277,7 +187,7 @@ var Group = new Class({ * A function to be called when creating several group members at once. * * @name Phaser.GameObjects.Group#createMultipleCallback - * @type {?GroupMultipleCreateCallback} + * @type {?Phaser.GameObjects.Group.Types.GroupMultipleCreateCallback} * @since 3.0.0 */ this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null); @@ -347,7 +257,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#createMultiple * @since 3.0.0 * - * @param {GroupCreateConfig|GroupCreateConfig[]} config - Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn. + * @param {Phaser.GameObjects.Group.Types.GroupCreateConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig[]} config - Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn. * * @return {any[]} The newly created Game Objects. */ @@ -384,7 +294,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#createFromConfig * @since 3.0.0 * - * @param {GroupCreateConfig} options - Creation settings. + * @param {Phaser.GameObjects.Group.Types.GroupCreateConfig} options - Creation settings. * * @return {any[]} The newly created Game Objects. */ @@ -572,7 +482,7 @@ var Group = new Class({ } } - child.on('destroy', this.remove, this); + child.on(Events.DESTROY, this.remove, this); return this; }, @@ -636,7 +546,7 @@ var Group = new Class({ this.removeCallback.call(this, child); } - child.off('destroy', this.remove, this); + child.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -679,7 +589,7 @@ var Group = new Class({ { var gameObject = children.entries[i]; - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); if (destroyChild) { @@ -1211,7 +1121,7 @@ var Group = new Class({ var gameObject = children.entries[i]; // Remove the event hook first or it'll go all recursive hell on us - gameObject.off('destroy', this.remove, this); + gameObject.off(Events.DESTROY, this.remove, this); gameObject.destroy(); } diff --git a/src/gameobjects/group/GroupCreator.js b/src/gameobjects/group/GroupCreator.js index 0569852ea..5c063d258 100644 --- a/src/gameobjects/group/GroupCreator.js +++ b/src/gameobjects/group/GroupCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var Group = require('./Group'); * @method Phaser.GameObjects.GameObjectCreator#group * @since 3.0.0 * - * @param {GroupConfig|GroupCreateConfig} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} config - The configuration object this Game Object will use to create itself. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ diff --git a/src/gameobjects/group/GroupFactory.js b/src/gameobjects/group/GroupFactory.js index 3367ba1e7..06f0d5a01 100644 --- a/src/gameobjects/group/GroupFactory.js +++ b/src/gameobjects/group/GroupFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,8 +15,8 @@ var GameObjectFactory = require('../GameObjectFactory'); * @method Phaser.GameObjects.GameObjectFactory#group * @since 3.0.0 * - * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument. - * @param {GroupConfig|GroupCreateConfig} [config] - A Group Configuration object. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument. + * @param {Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} [config] - A Group Configuration object. * * @return {Phaser.GameObjects.Group} The Game Object that was created. */ diff --git a/src/gameobjects/group/typedefs/GroupCallback.js b/src/gameobjects/group/typedefs/GroupCallback.js new file mode 100644 index 000000000..8c774f018 --- /dev/null +++ b/src/gameobjects/group/typedefs/GroupCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.GameObjects.Group.Types.GroupCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} item - A group member + */ diff --git a/src/gameobjects/group/typedefs/GroupClassTypeConstructor.js b/src/gameobjects/group/typedefs/GroupClassTypeConstructor.js new file mode 100644 index 000000000..5a1389247 --- /dev/null +++ b/src/gameobjects/group/typedefs/GroupClassTypeConstructor.js @@ -0,0 +1,14 @@ +/** + * A constructor function (class) that can be assigned to `classType`. + * + * @callback Phaser.GameObjects.Group.Types.GroupClassTypeConstructor + * @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 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. + * + * @see Phaser.GameObjects.Group#classType + */ diff --git a/src/gameobjects/group/typedefs/GroupConfig.js b/src/gameobjects/group/typedefs/GroupConfig.js new file mode 100644 index 000000000..ef64ed19f --- /dev/null +++ b/src/gameobjects/group/typedefs/GroupConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.GameObjects.Group.Types.GroupConfig + * @since 3.0.0 + * + * @property {?Phaser.GameObjects.Group.Types.GroupClassTypeConstructor} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}. + * @property {?boolean} [active=true] - Sets {@link Phaser.GameObjects.Group#active}. + * @property {?number} [maxSize=-1] - Sets {@link Phaser.GameObjects.Group#maxSize}. + * @property {?string} [defaultKey=null] - Sets {@link Phaser.GameObjects.Group#defaultKey}. + * @property {?(string|integer)} [defaultFrame=null] - Sets {@link Phaser.GameObjects.Group#defaultFrame}. + * @property {?boolean} [runChildUpdate=false] - Sets {@link Phaser.GameObjects.Group#runChildUpdate}. + * @property {?Phaser.GameObjects.Group.Types.GroupCallback} [createCallback=null] - Sets {@link Phaser.GameObjects.Group#createCallback}. + * @property {?Phaser.GameObjects.Group.Types.GroupCallback} [removeCallback=null] - Sets {@link Phaser.GameObjects.Group#removeCallback}. + * @property {?Phaser.GameObjects.Group.Types.GroupMultipleCreateCallback} [createMultipleCallback=null] - Sets {@link Phaser.GameObjects.Group#createMultipleCallback}. + */ diff --git a/src/gameobjects/group/typedefs/GroupCreateConfig.js b/src/gameobjects/group/typedefs/GroupCreateConfig.js new file mode 100644 index 000000000..7698ea265 --- /dev/null +++ b/src/gameobjects/group/typedefs/GroupCreateConfig.js @@ -0,0 +1,54 @@ +/** + * The total number of objects created will be + * + * key.length * frame.length * frameQuantity * (yoyo ? 2 : 1) * (1 + repeat) + * + * In the simplest case, 1 + `repeat` objects will be created. + * + * If `max` is positive, then the total created will not exceed `max`. + * + * `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used. + * + * @typedef {object} Phaser.GameObjects.Group.Types.GroupCreateConfig + * @since 3.0.0 + * + * @property {?Phaser.GameObjects.Group.Types.GroupClassTypeConstructor} [classType] - The class of each new Game Object. + * @property {string} [key] - The texture key of each new Game Object. + * @property {?(string|integer)} [frame=null] - The texture frame of each new Game Object. + * @property {?boolean} [visible=true] - The visible state of each new Game Object. + * @property {?boolean} [active=true] - The active state of each new Game Object. + * @property {?number} [repeat=0] - The number of times each `key` × `frame` combination will be *repeated* (after the first combination). + * @property {?boolean} [randomKey=false] - Select a `key` at random. + * @property {?boolean} [randomFrame=false] - Select a `frame` at random. + * @property {?boolean} [yoyo=false] - Select keys and frames by moving forward then backward through `key` and `frame`. + * @property {?number} [frameQuantity=1] - The number of times each `frame` should be combined with one `key`. + * @property {?number} [max=0] - The maximum number of new Game Objects to create. 0 is no maximum. + * @property {?object} [setXY] + * @property {?number} [setXY.x=0] - The horizontal position of each new Game Object. + * @property {?number} [setXY.y=0] - The vertical position of each new Game Object. + * @property {?number} [setXY.stepX=0] - Increment each Game Object's horizontal position from the previous by this amount, starting from `setXY.x`. + * @property {?number} [setXY.stepY=0] - Increment each Game Object's vertical position from the previous by this amount, starting from `setXY.y`. + * @property {?object} [setRotation] + * @property {?number} [setRotation.value=0] - Rotation of each new Game Object. + * @property {?number} [setRotation.step=0] - Increment each Game Object's rotation from the previous by this amount, starting at `setRotation.value`. + * @property {?object} [setScale] + * @property {?number} [setScale.x=0] - The horizontal scale of each new Game Object. + * @property {?number} [setScale.y=0] - The vertical scale of each new Game Object. + * @property {?number} [setScale.stepX=0] - Increment each Game Object's horizontal scale from the previous by this amount, starting from `setScale.x`. + * @property {?number} [setScale.stepY=0] - Increment each Game object's vertical scale from the previous by this amount, starting from `setScale.y`. + * @property {?object} [setAlpha] + * @property {?number} [setAlpha.value=0] - The alpha value of each new Game Object. + * @property {?number} [setAlpha.step=0] - Increment each Game Object's alpha from the previous by this amount, starting from `setAlpha.value`. + * @property {?*} [hitArea] - A geometric shape that defines the hit area for the Game Object. + * @property {?Phaser.Input.Types.HitAreaCallback} [hitAreaCallback] - A callback to be invoked when the Game Object is interacted with. + * @property {?(false|Phaser.Actions.Types.GridAlignConfig)} [gridAlign=false] - Align the new Game Objects in a grid using these settings. + * + * @see Phaser.Actions.GridAlign + * @see Phaser.Actions.SetAlpha + * @see Phaser.Actions.SetHitArea + * @see Phaser.Actions.SetRotation + * @see Phaser.Actions.SetScale + * @see Phaser.Actions.SetXY + * @see Phaser.GameObjects.Group#createFromConfig + * @see Phaser.Utils.Array.Range + */ diff --git a/src/gameobjects/group/typedefs/GroupMultipleCreateCallback.js b/src/gameobjects/group/typedefs/GroupMultipleCreateCallback.js new file mode 100644 index 000000000..b033fb49f --- /dev/null +++ b/src/gameobjects/group/typedefs/GroupMultipleCreateCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.GameObjects.Group.Types.GroupMultipleCreateCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject[]} items - The newly created group members + */ diff --git a/src/gameobjects/group/typedefs/index.js b/src/gameobjects/group/typedefs/index.js new file mode 100644 index 000000000..6cd3abdcd --- /dev/null +++ b/src/gameobjects/group/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Group.Types + */ diff --git a/src/gameobjects/image/Image.js b/src/gameobjects/image/Image.js index ba209160d..a2c45c3e2 100644 --- a/src/gameobjects/image/Image.js +++ b/src/gameobjects/image/Image.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/image/ImageCanvasRenderer.js b/src/gameobjects/image/ImageCanvasRenderer.js index 9e1661dd0..e86e10728 100644 --- a/src/gameobjects/image/ImageCanvasRenderer.js +++ b/src/gameobjects/image/ImageCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/image/ImageCreator.js b/src/gameobjects/image/ImageCreator.js index c225e5a42..8dd9589d7 100644 --- a/src/gameobjects/image/ImageCreator.js +++ b/src/gameobjects/image/ImageCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/image/ImageFactory.js b/src/gameobjects/image/ImageFactory.js index 8282051de..64a0e1f14 100644 --- a/src/gameobjects/image/ImageFactory.js +++ b/src/gameobjects/image/ImageFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/image/ImageRender.js b/src/gameobjects/image/ImageRender.js index 5c506c0f4..6acd91f53 100644 --- a/src/gameobjects/image/ImageRender.js +++ b/src/gameobjects/image/ImageRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/image/ImageWebGLRenderer.js b/src/gameobjects/image/ImageWebGLRenderer.js index 107630c80..40c2e190b 100644 --- a/src/gameobjects/image/ImageWebGLRenderer.js +++ b/src/gameobjects/image/ImageWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/index.js b/src/gameobjects/index.js index 1b2bff03c..5f458a0c3 100644 --- a/src/gameobjects/index.js +++ b/src/gameobjects/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,6 +10,8 @@ var GameObjects = { + Events: require('./events'), + DisplayList: require('./DisplayList'), GameObjectCreator: require('./GameObjectCreator'), GameObjectFactory: require('./GameObjectFactory'), diff --git a/src/gameobjects/lights/Light.js b/src/gameobjects/lights/Light.js index 09cff68db..8bd0bacbf 100644 --- a/src/gameobjects/lights/Light.js +++ b/src/gameobjects/lights/Light.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/lights/LightsManager.js b/src/gameobjects/lights/LightsManager.js index 7333af5ae..fde3b997a 100644 --- a/src/gameobjects/lights/LightsManager.js +++ b/src/gameobjects/lights/LightsManager.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/lights/LightsPlugin.js b/src/gameobjects/lights/LightsPlugin.js index 5eb3fcbaf..090823f1d 100644 --- a/src/gameobjects/lights/LightsPlugin.js +++ b/src/gameobjects/lights/LightsPlugin.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var LightsManager = require('./LightsManager'); var PluginCache = require('../../plugins/PluginCache'); +var SceneEvents = require('../../scene/events'); /** * @classdesc @@ -66,7 +67,7 @@ var LightsPlugin = new Class({ if (!scene.sys.settings.isBooted) { - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); } LightsManager.call(this); @@ -82,8 +83,8 @@ var LightsPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); + eventEmitter.on(SceneEvents.SHUTDOWN, this.shutdown, this); + eventEmitter.on(SceneEvents.DESTROY, this.destroy, this); }, /** diff --git a/src/gameobjects/mesh/Mesh.js b/src/gameobjects/mesh/Mesh.js index 5094b7785..4395732ba 100644 --- a/src/gameobjects/mesh/Mesh.js +++ b/src/gameobjects/mesh/Mesh.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,6 +8,7 @@ var Class = require('../../utils/Class'); var Components = require('../components'); var GameObject = require('../GameObject'); var MeshRender = require('./MeshRender'); +var NOOP = require('../../utils/NOOP'); /** * @classdesc @@ -152,7 +153,16 @@ var Mesh = new Class({ this.setPosition(x, y); this.setSizeToFrame(); this.initPipeline(); - } + }, + + /** + * This method is left intentionally empty and does not do anything. + * It is retained to allow a Mesh or Quad to be added to a Container. + * + * @method Phaser.GameObjects.Mesh#setAlpha + * @since 3.17.0 + */ + setAlpha: NOOP }); diff --git a/src/gameobjects/mesh/MeshCanvasRenderer.js b/src/gameobjects/mesh/MeshCanvasRenderer.js index 16b51b25a..3e8493111 100644 --- a/src/gameobjects/mesh/MeshCanvasRenderer.js +++ b/src/gameobjects/mesh/MeshCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/mesh/MeshCreator.js b/src/gameobjects/mesh/MeshCreator.js index c957e11d3..8deb82055 100644 --- a/src/gameobjects/mesh/MeshCreator.js +++ b/src/gameobjects/mesh/MeshCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/mesh/MeshFactory.js b/src/gameobjects/mesh/MeshFactory.js index aa021e351..50d190249 100644 --- a/src/gameobjects/mesh/MeshFactory.js +++ b/src/gameobjects/mesh/MeshFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/mesh/MeshRender.js b/src/gameobjects/mesh/MeshRender.js index 25ec35685..772ddbd13 100644 --- a/src/gameobjects/mesh/MeshRender.js +++ b/src/gameobjects/mesh/MeshRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/mesh/MeshWebGLRenderer.js b/src/gameobjects/mesh/MeshWebGLRenderer.js index 434f1877d..f6fa8d087 100644 --- a/src/gameobjects/mesh/MeshWebGLRenderer.js +++ b/src/gameobjects/mesh/MeshWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/EmitterOp.js b/src/gameobjects/particles/EmitterOp.js index 92b597070..a4ab862ee 100644 --- a/src/gameobjects/particles/EmitterOp.js +++ b/src/gameobjects/particles/EmitterOp.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,84 +10,6 @@ var GetEaseFunction = require('../../tweens/builders/GetEaseFunction'); var GetFastValue = require('../../utils/object/GetFastValue'); var Wrap = require('../../math/Wrap'); -/** - * The returned value sets what the property will be at the START of the particle's life, on emit. - * @callback EmitterOpOnEmitCallback - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The name of the property. - * @param {number} value - The current value of the property. - * - * @return {number} The new value of the property. - */ - -/** - * The returned value updates the property for the duration of the particle's life. - * @callback EmitterOpOnUpdateCallback - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The name of the property. - * @param {number} t - The normalized lifetime of the particle, between 0 (start) and 1 (end). - * @param {number} value - The current value of the property. - * - * @return {number} The new value of the property. - */ - -/** - * Defines an operation yielding a random value within a range. - * @typedef {object} EmitterOpRandomConfig - * - * @property {number[]} random - The minimum and maximum values, as [min, max]. - */ - -/** - * Defines an operation yielding a random value within a range. - * @typedef {object} EmitterOpRandomMinMaxConfig - * - * @property {number} min - The minimum value. - * @property {number} max - The maximum value. - */ - -/** - * Defines an operation yielding a random value within a range. - * @typedef {object} EmitterOpRandomStartEndConfig - * - * @property {number} start - The starting value. - * @property {number} end - The ending value. - * @property {boolean} random - If false, this becomes {@link EmitterOpEaseConfig}. - */ - -/** - * Defines an operation yielding a value incremented continuously across a range. - * @typedef {object} EmitterOpEaseConfig - * - * @property {number} start - The starting value. - * @property {number} end - The ending value. - * @property {string} [ease='Linear'] - The name of the easing function. - */ - -/** - * Defines an operation yielding a value incremented by steps across a range. - * @typedef {object} EmitterOpSteppedConfig - * - * @property {number} start - The starting value. - * @property {number} end - The ending value. - * @property {number} steps - The number of steps between start and end. - */ - -/** - * @typedef {object} EmitterOpCustomEmitConfig - * - * @property {EmitterOpOnEmitCallback} onEmit - A callback that is invoked each time the emitter emits a particle. - */ - -/** - * @typedef {object} EmitterOpCustomUpdateConfig - * - * @property {EmitterOpOnEmitCallback} [onEmit] - A callback that is invoked each time the emitter emits a particle. - * @property {EmitterOpOnUpdateCallback} onUpdate - A callback that is invoked each time the emitter updates. - */ - /** * @classdesc * A Particle Emitter property. @@ -99,7 +21,7 @@ var Wrap = require('../../math/Wrap'); * @constructor * @since 3.0.0 * - * @param {ParticleEmitterConfig} config - Settings for the Particle Emitter that owns this property. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig} config - Settings for the Particle Emitter that owns this property. * @param {string} key - The name of the property. * @param {number} defaultValue - The default value of the property. * @param {boolean} [emitOnly=false] - Whether the property can only be modified when a Particle is emitted. @@ -211,7 +133,7 @@ var EmitterOp = new Class({ * The callback to run for Particles when they are emitted from the Particle Emitter. * * @name Phaser.GameObjects.Particles.EmitterOp#onEmit - * @type {EmitterOpOnEmitCallback} + * @type {Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback} * @since 3.0.0 */ this.onEmit = this.defaultEmit; @@ -220,7 +142,7 @@ var EmitterOp = new Class({ * The callback to run for Particles when they are updated. * * @name Phaser.GameObjects.Particles.EmitterOp#onUpdate - * @type {EmitterOpOnUpdateCallback} + * @type {Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback} * @since 3.0.0 */ this.onUpdate = this.defaultUpdate; @@ -236,7 +158,7 @@ var EmitterOp = new Class({ * @method Phaser.GameObjects.Particles.EmitterOp#loadConfig * @since 3.0.0 * - * @param {ParticleEmitterConfig} [config] - Settings for the Particle Emitter that owns this property. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig} [config] - Settings for the Particle Emitter that owns this property. * @param {string} [newKey] - The new key to use for this property, if any. */ loadConfig: function (config, newKey) @@ -501,7 +423,7 @@ var EmitterOp = new Class({ * @param {string} key - The name of the property. * @param {number} [value] - The current value of the property. * - * @return {number} The new value of hte property. + * @return {number} The new value of the property. */ defaultEmit: function (particle, key, value) { diff --git a/src/gameobjects/particles/GravityWell.js b/src/gameobjects/particles/GravityWell.js index 3f21466e4..e0b371738 100644 --- a/src/gameobjects/particles/GravityWell.js +++ b/src/gameobjects/particles/GravityWell.js @@ -1,22 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var GetFastValue = require('../../utils/object/GetFastValue'); -/** - * @typedef {object} GravityWellConfig - * - * @property {number} [x=0] - The x coordinate of the Gravity Well, in world space. - * @property {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @property {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. - * @property {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. - * @property {number} [gravity=50] - The gravitational force of this Gravity Well. - */ - /** * @classdesc * The GravityWell action applies a force on the particle to draw it towards, or repel it from, a single point. @@ -30,7 +20,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @constructor * @since 3.0.0 * - * @param {(number|GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. + * @param {(number|Phaser.GameObjects.Particles.Types.GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. * @param {number} [y=0] - The y coordinate of the Gravity Well, in world space. * @param {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. * @param {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. diff --git a/src/gameobjects/particles/Particle.js b/src/gameobjects/particles/Particle.js index cfdd5e800..3024c49f2 100644 --- a/src/gameobjects/particles/Particle.js +++ b/src/gameobjects/particles/Particle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index 71b3f3567..b1e02341e 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -21,131 +21,6 @@ var StableSort = require('../../utils/array/StableSort'); var Vector2 = require('../../math/Vector2'); var Wrap = require('../../math/Wrap'); -/** - * @callback ParticleEmitterCallback - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle associated with the call. - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - This particle emitter associated with the call. - */ - -/** - * @callback ParticleDeathCallback - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle that died. -*/ - -/** - * @typedef {object} ParticleEmitterBounds - * - * @property {number} x - The left edge of the rectangle. - * @property {number} y - The top edge of the rectangle. - * @property {number} width - The width of the rectangle. - * @property {number} height - The height of the rectangle. - * - * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds - */ - -/** - * @typedef {object} ParticleEmitterBoundsAlt - * - * @property {number} x - The left edge of the rectangle. - * @property {number} y - The top edge of the rectangle. - * @property {number} w - The width of the rectangle. - * @property {number} h - The height of the rectangle. - * - * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds - */ - -/** - * @typedef {object} ParticleEmitterDeathZoneConfig - * - * @property {DeathZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.DeathZone#source}. - * @property {string} [type='onEnter'] - 'onEnter' or 'onLeave'. - */ - -/** - * @typedef {object} ParticleEmitterEdgeZoneConfig - * - * @property {EdgeZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.EdgeZone#source}. - * @property {string} type - 'edge'. - * @property {integer} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. - * @property {number} [stepRate] - The distance between each particle. When set, `quantity` is implied and should be set to 0. - * @property {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. - * @property {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. - */ - -/** - * @typedef {object} ParticleEmitterRandomZoneConfig - * - * @property {RandomZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.RandomZone#source}. - * @property {string} [type] - 'random'. - */ - -/** - * @typedef {object} ParticleEmitterConfig - * - * @property {boolean} [active] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#active}. - * @property {integer} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. - * @property {*} [callbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope} and {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. - * @property {boolean} [collideBottom] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideBottom}. - * @property {boolean} [collideLeft] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideLeft}. - * @property {boolean} [collideRight] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideRight}. - * @property {boolean} [collideTop] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideTop}. - * @property {boolean} [deathCallback] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. - * @property {*} [deathCallbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope}. - * @property {function} [emitCallback] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. - * @property {*} [emitCallbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. - * @property {Phaser.GameObjects.GameObject} [follow] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#follow}. - * @property {number} [frequency] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency}. - * @property {number} [gravityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#gravityX}. - * @property {number} [gravityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#gravityY}. - * @property {integer} [maxParticles] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxParticles}. - * @property {string} [name] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#name}. - * @property {boolean} [on] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#on}. - * @property {boolean} [particleBringToTop] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop}. - * @property {Phaser.GameObjects.Particles.Particle} [particleClass] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleClass}. - * @property {boolean} [radial] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#radial}. - * @property {number} [timeScale] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#timeScale}. - * @property {boolean} [trackVisible] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#trackVisible}. - * @property {boolean} [visible] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#visible}. - * @property {number|number[]|EmitterOpOnEmitCallback|object} [accelerationX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationX} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [accelerationY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationY} (emit only). - * @property {number|number[]|EmitterOpOnUpdateCallback|object} [alpha] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#alpha}. - * @property {number|number[]|EmitterOpOnEmitCallback|object} [angle] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#angle} (emit only) - * @property {number|number[]|EmitterOpOnEmitCallback|object} [bounce] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#bounce} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [delay] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#delay} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [lifespan] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#lifespan} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [maxVelocityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [maxVelocityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [moveToX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToX} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [moveToY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToY} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [quantity] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity} (emit only). - * @property {number|number[]|EmitterOpOnUpdateCallback|object} [rotate] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#rotate}. - * @property {number|number[]|EmitterOpOnUpdateCallback|object} [scale] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setScale}. - * @property {number|number[]|EmitterOpOnUpdateCallback|object} [scaleX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleX}. - * @property {number|number[]|EmitterOpOnUpdateCallback|object} [scaleY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleY}. - * @property {number|number[]|EmitterOpOnEmitCallback|object} [speed] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setSpeed} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [speedX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedX} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [speedY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedY} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [tint] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#tint}. - * @property {number|number[]|EmitterOpOnEmitCallback|object} [x] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#x} (emit only). - * @property {number|number[]|EmitterOpOnEmitCallback|object} [y] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#y} (emit only). - * @property {object} [emitZone] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone}. - * @property {ParticleEmitterBounds|ParticleEmitterBoundsAlt} [bounds] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setBounds}. - * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. - * @property {number} [followOffset.x] - x-coordinate of the offset. - * @property {number} [followOffset.y] - y-coordinate of the offset. - * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frames] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. - */ - -/** - * @typedef {object} ParticleEmitterFrameConfig - * - * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]} [frames] - One or more texture frames. - * @property {boolean} [cycle] - Whether texture frames will be assigned consecutively (true) or at random (false). - * @property {integer} [quantity] - The number of consecutive particles receiving each texture frame, when `cycle` is true. - */ - /** * @classdesc * A particle emitter represents a single particle stream. @@ -162,7 +37,7 @@ var Wrap = require('../../math/Wrap'); * @extends Phaser.GameObjects.Components.Visible * * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} manager - The Emitter Manager this Emitter belongs to. - * @param {ParticleEmitterConfig} config - Settings for this emitter. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig} config - Settings for this emitter. */ var ParticleEmitter = new Class({ @@ -548,7 +423,7 @@ var ParticleEmitter = new Class({ * A function to call when a particle is emitted. * * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback - * @type {?ParticleEmitterCallback} + * @type {?Phaser.GameObjects.Particles.Types.ParticleEmitterCallback} * @default null * @since 3.0.0 */ @@ -568,7 +443,7 @@ var ParticleEmitter = new Class({ * A function to call when a particle dies. * * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback - * @type {?ParticleDeathCallback} + * @type {?Phaser.GameObjects.Particles.Types.ParticleDeathCallback} * @default null * @since 3.0.0 */ @@ -893,7 +768,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#fromJSON * @since 3.0.0 * - * @param {ParticleEmitterConfig} config - Settings for this emitter. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig} config - Settings for this emitter. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1130,7 +1005,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrame * @since 3.0.0 * - * @param {(array|string|integer|ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. + * @param {(array|string|integer|Phaser.GameObjects.Particles.Types.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. * @param {boolean} [pickRandom=true] - Whether frames should be assigned at random from `frames`. * @param {integer} [quantity=1] - The number of consecutive particles that will receive each frame. * @@ -1207,8 +1082,8 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} x - The x-coordinate of the particle origin. - * @param {number|float[]|EmitterOpOnEmitCallback|object} y - The y-coordinate of the particle origin. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} x - The x-coordinate of the particle origin. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} y - The y-coordinate of the particle origin. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1228,7 +1103,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setBounds * @since 3.0.0 * - * @param {(number|ParticleEmitterBounds|ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle. + * @param {(number|Phaser.GameObjects.Particles.Types.ParticleEmitterBounds|Phaser.GameObjects.Particles.Types.ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle. * @param {number} y - The y-coordinate of the top edge of the boundary. * @param {number} width - The width of the boundary. * @param {number} height - The height of the boundary. @@ -1266,7 +1141,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1287,7 +1162,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1311,7 +1186,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1332,7 +1207,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1349,7 +1224,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1366,7 +1241,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setScale * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1437,7 +1312,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnUpdateCallback|object} value - A value between 0 (transparent) and 1 (opaque). + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} value - A value between 0 (transparent) and 1 (opaque). * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1454,7 +1329,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1471,7 +1346,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1488,7 +1363,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} value - The particle lifespan, in ms. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} value - The particle lifespan, in ms. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1505,7 +1380,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity * @since 3.0.0 * - * @param {number|float[]|EmitterOpOnEmitCallback|object} quantity - The number of particles to release at each flow cycle or explosion. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} quantity - The number of particles to release at each flow cycle or explosion. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1524,7 +1399,7 @@ var ParticleEmitter = new Class({ * @since 3.0.0 * * @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode. - * @param {number|float[]|EmitterOpOnEmitCallback|object} [quantity] - The number of particles to release at each flow cycle or explosion. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [quantity] - The number of particles to release at each flow cycle or explosion. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1545,14 +1420,14 @@ var ParticleEmitter = new Class({ /** * Sets or removes the {@link Phaser.GameObjects.Particles.ParticleEmitter#emitZone}. * - * An {@link ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges. Its {@link EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link EdgeZoneSourceCallback getPoints} method. + * An {@link Phaser.GameObjects.Particles.Types.ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges. Its {@link EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.GameObjects.Particles.Types.EdgeZoneSourceCallback getPoints} method. * - * A {@link ParticleEmitterRandomZoneConfig RandomZone} places randomly within its interior. Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link RandomZoneSourceCallback getRandomPoint} method. + * A {@link Phaser.GameObjects.Particles.Types.ParticleEmitterRandomZoneConfig RandomZone} places randomly within its interior. Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.GameObjects.Particles.Types.RandomZoneSourceCallback getRandomPoint} method. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone * @since 3.0.0 * - * @param {ParticleEmitterEdgeZoneConfig|ParticleEmitterRandomZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current emit zone. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterEdgeZoneConfig|Phaser.GameObjects.Particles.Types.ParticleEmitterRandomZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current emit zone. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1601,7 +1476,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone * @since 3.0.0 * - * @param {ParticleEmitterDeathZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterDeathZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1711,7 +1586,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit * @since 3.0.0 * - * @param {ParticleEmitterCallback} callback - The function. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterCallback} callback - The function. * @param {*} [context] - The calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. @@ -1743,7 +1618,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath * @since 3.0.0 * - * @param {ParticleDeathCallback} callback - The function. + * @param {Phaser.GameObjects.Particles.Types.ParticleDeathCallback} callback - The function. * @param {*} [context] - The function's calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. @@ -1796,7 +1671,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive * @since 3.0.0 * - * @param {ParticleEmitterCallback} callback - The function. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterCallback} callback - The function. * @param {*} context - The function's calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. @@ -1821,7 +1696,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead * @since 3.0.0 * - * @param {ParticleEmitterCallback} callback - The function. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterCallback} callback - The function. * @param {*} context - The function's calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. @@ -1931,7 +1806,7 @@ var ParticleEmitter = new Class({ * @since 3.0.0 * * @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms. - * @param {number|float[]|EmitterOpOnEmitCallback|object} [count=1] - The number of particles to emit at each flow cycle. + * @param {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [count=1] - The number of particles to emit at each flow cycle. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ diff --git a/src/gameobjects/particles/ParticleEmitterManager.js b/src/gameobjects/particles/ParticleEmitterManager.js index 9b50a5973..10c92b365 100644 --- a/src/gameobjects/particles/ParticleEmitterManager.js +++ b/src/gameobjects/particles/ParticleEmitterManager.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -30,7 +30,7 @@ var Render = require('./ParticleManagerRender'); * @param {Phaser.Scene} scene - The Scene to which this Emitter Manager belongs. * @param {string} texture - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager. * @param {(string|integer)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. - * @param {ParticleEmitterConfig|ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig|Phaser.GameObjects.Particles.Types.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. */ var ParticleEmitterManager = new Class({ @@ -266,7 +266,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createEmitter * @since 3.0.0 * - * @param {ParticleEmitterConfig} config - Configuration settings for the Particle Emitter to create. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig} config - Configuration settings for the Particle Emitter to create. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter that was created. */ @@ -296,7 +296,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createGravityWell * @since 3.0.0 * - * @param {GravityWellConfig} config - Configuration settings for the Gravity Well to create. + * @param {Phaser.GameObjects.Particles.Types.GravityWellConfig} config - Configuration settings for the Gravity Well to create. * * @return {Phaser.GameObjects.Particles.GravityWell} The Gravity Well that was created. */ diff --git a/src/gameobjects/particles/ParticleManagerCanvasRenderer.js b/src/gameobjects/particles/ParticleManagerCanvasRenderer.js index 0772e03dd..e050aba86 100644 --- a/src/gameobjects/particles/ParticleManagerCanvasRenderer.js +++ b/src/gameobjects/particles/ParticleManagerCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/ParticleManagerCreator.js b/src/gameobjects/particles/ParticleManagerCreator.js index 0e29c7fac..240076430 100644 --- a/src/gameobjects/particles/ParticleManagerCreator.js +++ b/src/gameobjects/particles/ParticleManagerCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/ParticleManagerFactory.js b/src/gameobjects/particles/ParticleManagerFactory.js index 785b296b2..a553b8ec3 100644 --- a/src/gameobjects/particles/ParticleManagerFactory.js +++ b/src/gameobjects/particles/ParticleManagerFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var ParticleEmitterManager = require('./ParticleEmitterManager'); * * @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|object)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {ParticleEmitterConfig|ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. + * @param {Phaser.GameObjects.Particles.Types.ParticleEmitterConfig|Phaser.GameObjects.Particles.Types.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. * * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} The Game Object that was created. */ diff --git a/src/gameobjects/particles/ParticleManagerRender.js b/src/gameobjects/particles/ParticleManagerRender.js index 3a7284ba3..0683b3a21 100644 --- a/src/gameobjects/particles/ParticleManagerRender.js +++ b/src/gameobjects/particles/ParticleManagerRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/ParticleManagerWebGLRenderer.js b/src/gameobjects/particles/ParticleManagerWebGLRenderer.js index 809e07e66..ad8614d81 100644 --- a/src/gameobjects/particles/ParticleManagerWebGLRenderer.js +++ b/src/gameobjects/particles/ParticleManagerWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/index.js b/src/gameobjects/particles/index.js index 1a45ef616..622ea3067 100644 --- a/src/gameobjects/particles/index.js +++ b/src/gameobjects/particles/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/particles/typedefs/DeathZoneSource.js b/src/gameobjects/particles/typedefs/DeathZoneSource.js new file mode 100644 index 000000000..3e2d1393c --- /dev/null +++ b/src/gameobjects/particles/typedefs/DeathZoneSource.js @@ -0,0 +1,12 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.DeathZoneSource + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.DeathZoneSourceCallback} contains + * + * @see Phaser.Geom.Circle + * @see Phaser.Geom.Ellipse + * @see Phaser.Geom.Polygon + * @see Phaser.Geom.Rectangle + * @see Phaser.Geom.Triangle + */ diff --git a/src/gameobjects/particles/typedefs/DeathZoneSourceCallback.js b/src/gameobjects/particles/typedefs/DeathZoneSourceCallback.js new file mode 100644 index 000000000..9ebaf6d6a --- /dev/null +++ b/src/gameobjects/particles/typedefs/DeathZoneSourceCallback.js @@ -0,0 +1,9 @@ +/** + * @callback Phaser.GameObjects.Particles.Types.DeathZoneSourceCallback + * @since 3.0.0 + * + * @param {number} x - The x coordinate of the particle to check against this source area. + * @param {number} y - The y coordinate of the particle to check against this source area. + * + * @return {boolean} - True if the coordinates are within the source area. + */ diff --git a/src/gameobjects/particles/typedefs/EdgeZoneSource.js b/src/gameobjects/particles/typedefs/EdgeZoneSource.js new file mode 100644 index 000000000..37a6f1e5f --- /dev/null +++ b/src/gameobjects/particles/typedefs/EdgeZoneSource.js @@ -0,0 +1,15 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.EdgeZoneSource + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.EdgeZoneSourceCallback} getPoints - A function placing points on the sources edge or edges. + * + * @see Phaser.Curves.Curve + * @see Phaser.Curves.Path + * @see Phaser.Geom.Circle + * @see Phaser.Geom.Ellipse + * @see Phaser.Geom.Line + * @see Phaser.Geom.Polygon + * @see Phaser.Geom.Rectangle + * @see Phaser.Geom.Triangle + */ diff --git a/src/gameobjects/particles/typedefs/EdgeZoneSourceCallback.js b/src/gameobjects/particles/typedefs/EdgeZoneSourceCallback.js new file mode 100644 index 000000000..dedcbcefb --- /dev/null +++ b/src/gameobjects/particles/typedefs/EdgeZoneSourceCallback.js @@ -0,0 +1,9 @@ +/** + * @callback Phaser.GameObjects.Particles.Types.EdgeZoneSourceCallback + * @since 3.0.0 + * + * @param {integer} quantity - The number of particles to place on the source edge. If 0, `stepRate` should be used instead. + * @param {number} [stepRate] - The distance between each particle. When set, `quantity` is implied and should be set to `0`. + * + * @return {Phaser.Geom.Point[]} - The points placed on the source edge. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpCustomEmitConfig.js b/src/gameobjects/particles/typedefs/EmitterOpCustomEmitConfig.js new file mode 100644 index 000000000..512afae1a --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpCustomEmitConfig.js @@ -0,0 +1,6 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpCustomEmitConfig + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback} onEmit - A callback that is invoked each time the emitter emits a particle. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpCustomUpdateConfig.js b/src/gameobjects/particles/typedefs/EmitterOpCustomUpdateConfig.js new file mode 100644 index 000000000..468711ee9 --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpCustomUpdateConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpCustomUpdateConfig + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback} [onEmit] - A callback that is invoked each time the emitter emits a particle. + * @property {Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback} onUpdate - A callback that is invoked each time the emitter updates. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpEaseConfig.js b/src/gameobjects/particles/typedefs/EmitterOpEaseConfig.js new file mode 100644 index 000000000..6fbcb29b1 --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpEaseConfig.js @@ -0,0 +1,10 @@ +/** + * Defines an operation yielding a value incremented continuously across a range. + * + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpEaseConfig + * @since 3.0.0 + * + * @property {number} start - The starting value. + * @property {number} end - The ending value. + * @property {string} [ease='Linear'] - The name of the easing function. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpOnEmitCallback.js b/src/gameobjects/particles/typedefs/EmitterOpOnEmitCallback.js new file mode 100644 index 000000000..bc458407d --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpOnEmitCallback.js @@ -0,0 +1,12 @@ +/** + * The returned value sets what the property will be at the START of the particle's life, on emit. + * + * @callback Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} value - The current value of the property. + * + * @return {number} The new value of the property. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpOnUpdateCallback.js b/src/gameobjects/particles/typedefs/EmitterOpOnUpdateCallback.js new file mode 100644 index 000000000..8e34fc9d7 --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpOnUpdateCallback.js @@ -0,0 +1,13 @@ +/** + * The returned value updates the property for the duration of the particle's life. + * + * @callback Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} t - The normalized lifetime of the particle, between 0 (start) and 1 (end). + * @param {number} value - The current value of the property. + * + * @return {number} The new value of the property. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpRandomConfig.js b/src/gameobjects/particles/typedefs/EmitterOpRandomConfig.js new file mode 100644 index 000000000..c2855d06a --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpRandomConfig.js @@ -0,0 +1,8 @@ +/** + * Defines an operation yielding a random value within a range. + * + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpRandomConfig + * @since 3.0.0 + * + * @property {number[]} random - The minimum and maximum values, as [min, max]. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpRandomMinMaxConfig.js b/src/gameobjects/particles/typedefs/EmitterOpRandomMinMaxConfig.js new file mode 100644 index 000000000..a61415dae --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpRandomMinMaxConfig.js @@ -0,0 +1,9 @@ +/** + * Defines an operation yielding a random value within a range. + * + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpRandomMinMaxConfig + * @since 3.0.0 + * + * @property {number} min - The minimum value. + * @property {number} max - The maximum value. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpRandomStartEndConfig.js b/src/gameobjects/particles/typedefs/EmitterOpRandomStartEndConfig.js new file mode 100644 index 000000000..4aa3e37de --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpRandomStartEndConfig.js @@ -0,0 +1,10 @@ +/** + * Defines an operation yielding a random value within a range. + * + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpRandomStartEndConfig + * @since 3.0.0 + * + * @property {number} start - The starting value. + * @property {number} end - The ending value. + * @property {boolean} random - If false, this becomes {@link EmitterOpEaseConfig}. + */ diff --git a/src/gameobjects/particles/typedefs/EmitterOpSteppedConfig.js b/src/gameobjects/particles/typedefs/EmitterOpSteppedConfig.js new file mode 100644 index 000000000..e642d09ef --- /dev/null +++ b/src/gameobjects/particles/typedefs/EmitterOpSteppedConfig.js @@ -0,0 +1,10 @@ +/** + * Defines an operation yielding a value incremented by steps across a range. + * + * @typedef {object} Phaser.GameObjects.Particles.Types.EmitterOpSteppedConfig + * @since 3.0.0 + * + * @property {number} start - The starting value. + * @property {number} end - The ending value. + * @property {number} steps - The number of steps between start and end. + */ diff --git a/src/gameobjects/particles/typedefs/GravityWellConfig.js b/src/gameobjects/particles/typedefs/GravityWellConfig.js new file mode 100644 index 000000000..df0b7670e --- /dev/null +++ b/src/gameobjects/particles/typedefs/GravityWellConfig.js @@ -0,0 +1,10 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.GravityWellConfig + * @since 3.0.0 + * + * @property {number} [x=0] - The x coordinate of the Gravity Well, in world space. + * @property {number} [y=0] - The y coordinate of the Gravity Well, in world space. + * @property {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @property {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. + * @property {number} [gravity=50] - The gravitational force of this Gravity Well. + */ diff --git a/src/gameobjects/particles/typedefs/ParticleDeathCallback.js b/src/gameobjects/particles/typedefs/ParticleDeathCallback.js new file mode 100644 index 000000000..585291720 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleDeathCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.GameObjects.Particles.Types.ParticleDeathCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle that died. +*/ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterBounds.js b/src/gameobjects/particles/typedefs/ParticleEmitterBounds.js new file mode 100644 index 000000000..04d7c7985 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterBounds.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterBounds + * @since 3.0.0 + * + * @property {number} x - The left edge of the rectangle. + * @property {number} y - The top edge of the rectangle. + * @property {number} width - The width of the rectangle. + * @property {number} height - The height of the rectangle. + * + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterBoundsAlt.js b/src/gameobjects/particles/typedefs/ParticleEmitterBoundsAlt.js new file mode 100644 index 000000000..0c93a0e87 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterBoundsAlt.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterBoundsAlt + * @since 3.0.0 + * + * @property {number} x - The left edge of the rectangle. + * @property {number} y - The top edge of the rectangle. + * @property {number} w - The width of the rectangle. + * @property {number} h - The height of the rectangle. + * + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterCallback.js b/src/gameobjects/particles/typedefs/ParticleEmitterCallback.js new file mode 100644 index 000000000..5443bd675 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterCallback.js @@ -0,0 +1,7 @@ +/** + * @callback Phaser.GameObjects.Particles.Types.ParticleEmitterCallback + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle associated with the call. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - This particle emitter associated with the call. + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js new file mode 100644 index 000000000..592ba0a50 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js @@ -0,0 +1,57 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterConfig + * @since 3.0.0 + * + * @property {boolean} [active] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#active}. + * @property {(Phaser.BlendModes|string)} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. + * @property {*} [callbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope} and {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. + * @property {boolean} [collideBottom] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideBottom}. + * @property {boolean} [collideLeft] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideLeft}. + * @property {boolean} [collideRight] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideRight}. + * @property {boolean} [collideTop] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideTop}. + * @property {boolean} [deathCallback] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. + * @property {*} [deathCallbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope}. + * @property {function} [emitCallback] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. + * @property {*} [emitCallbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. + * @property {Phaser.GameObjects.GameObject} [follow] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#follow}. + * @property {number} [frequency] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency}. + * @property {number} [gravityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#gravityX}. + * @property {number} [gravityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#gravityY}. + * @property {integer} [maxParticles] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxParticles}. + * @property {string} [name] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#name}. + * @property {boolean} [on] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#on}. + * @property {boolean} [particleBringToTop] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop}. + * @property {Phaser.GameObjects.Particles.Particle} [particleClass] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleClass}. + * @property {boolean} [radial] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#radial}. + * @property {number} [timeScale] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#timeScale}. + * @property {boolean} [trackVisible] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#trackVisible}. + * @property {boolean} [visible] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#visible}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [accelerationX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationX} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [accelerationY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationY} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} [alpha] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#alpha}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [angle] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#angle} (emit only) + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [bounce] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#bounce} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [delay] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#delay} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [lifespan] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#lifespan} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [maxVelocityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [maxVelocityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [moveToX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToX} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [moveToY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToY} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [quantity] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} [rotate] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#rotate}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} [scale] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setScale}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} [scaleX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleX}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnUpdateCallback|object} [scaleY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleY}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [speed] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setSpeed} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [speedX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedX} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [speedY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedY} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [tint] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#tint}. + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [x] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#x} (emit only). + * @property {number|number[]|Phaser.GameObjects.Particles.Types.EmitterOpOnEmitCallback|object} [y] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#y} (emit only). + * @property {object} [emitZone] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone}. + * @property {Phaser.GameObjects.Particles.Types.ParticleEmitterBounds|Phaser.GameObjects.Particles.Types.ParticleEmitterBoundsAlt} [bounds] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setBounds}. + * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. + * @property {number} [followOffset.x] - x-coordinate of the offset. + * @property {number} [followOffset.y] - y-coordinate of the offset. + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|Phaser.GameObjects.Particles.Types.ParticleEmitterFrameConfig} [frame] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterDeathZoneConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterDeathZoneConfig.js new file mode 100644 index 000000000..a484515c0 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterDeathZoneConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterDeathZoneConfig + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.DeathZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.DeathZone#source}. + * @property {string} [type='onEnter'] - 'onEnter' or 'onLeave'. + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterEdgeZoneConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterEdgeZoneConfig.js new file mode 100644 index 000000000..8d59d2770 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterEdgeZoneConfig.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterEdgeZoneConfig + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.EdgeZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.EdgeZone#source}. + * @property {string} type - 'edge'. + * @property {integer} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * @property {number} [stepRate] - The distance between each particle. When set, `quantity` is implied and should be set to 0. + * @property {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. + * @property {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterFrameConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterFrameConfig.js new file mode 100644 index 000000000..6dcf3b9e7 --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterFrameConfig.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterFrameConfig + * @since 3.0.0 + * + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]} [frames] - One or more texture frames. + * @property {boolean} [cycle] - Whether texture frames will be assigned consecutively (true) or at random (false). + * @property {integer} [quantity] - The number of consecutive particles receiving each texture frame, when `cycle` is true. + */ diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterRandomZoneConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterRandomZoneConfig.js new file mode 100644 index 000000000..f017528dd --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterRandomZoneConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.ParticleEmitterRandomZoneConfig + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.RandomZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.RandomZone#source}. + * @property {string} [type] - 'random'. + */ diff --git a/src/gameobjects/particles/typedefs/RandomZoneSource.js b/src/gameobjects/particles/typedefs/RandomZoneSource.js new file mode 100644 index 000000000..5f0aa29e7 --- /dev/null +++ b/src/gameobjects/particles/typedefs/RandomZoneSource.js @@ -0,0 +1,13 @@ +/** + * @typedef {object} Phaser.GameObjects.Particles.Types.RandomZoneSource + * @since 3.0.0 + * + * @property {Phaser.GameObjects.Particles.Types.RandomZoneSourceCallback} getRandomPoint - A function modifying its point argument. + * + * @see Phaser.Geom.Circle + * @see Phaser.Geom.Ellipse + * @see Phaser.Geom.Line + * @see Phaser.Geom.Polygon + * @see Phaser.Geom.Rectangle + * @see Phaser.Geom.Triangle + */ diff --git a/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js b/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js new file mode 100644 index 000000000..f1ffff2e9 --- /dev/null +++ b/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.GameObjects.Particles.Types.RandomZoneSourceCallback + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} point - A point to modify. + */ diff --git a/src/gameobjects/particles/typedefs/index.js b/src/gameobjects/particles/typedefs/index.js new file mode 100644 index 000000000..ce2c049c9 --- /dev/null +++ b/src/gameobjects/particles/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Particles.Types + */ diff --git a/src/gameobjects/particles/zones/DeathZone.js b/src/gameobjects/particles/zones/DeathZone.js index fa18e68e1..52f692ea8 100644 --- a/src/gameobjects/particles/zones/DeathZone.js +++ b/src/gameobjects/particles/zones/DeathZone.js @@ -1,32 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../../utils/Class'); -/** - * @callback DeathZoneSourceCallback - * - * @param {number} x - The x coordinate of the particle to check against this source area. - * @param {number} y - The y coordinate of the particle to check against this source area. - * - * @return {boolean} - True if the coordinates are within the source area. - */ - -/** - * @typedef {object} DeathZoneSource - * - * @property {DeathZoneSourceCallback} contains - * - * @see Phaser.Geom.Circle - * @see Phaser.Geom.Ellipse - * @see Phaser.Geom.Polygon - * @see Phaser.Geom.Rectangle - * @see Phaser.Geom.Triangle - */ - /** * @classdesc * A Death Zone. @@ -41,7 +20,7 @@ var Class = require('../../../utils/Class'); * @constructor * @since 3.0.0 * - * @param {DeathZoneSource} source - An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. + * @param {Phaser.GameObjects.Particles.Types.DeathZoneSource} source - An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. * @param {boolean} killOnEnter - Should the Particle be killed when it enters the zone? `true` or leaves it? `false` */ var DeathZone = new Class({ @@ -55,7 +34,7 @@ var DeathZone = new Class({ * This could be a Geometry shape, such as `Phaser.Geom.Circle`, or your own custom object. * * @name Phaser.GameObjects.Particles.Zones.DeathZone#source - * @type {DeathZoneSource} + * @type {Phaser.GameObjects.Particles.Types.DeathZoneSource} * @since 3.0.0 */ this.source = source; diff --git a/src/gameobjects/particles/zones/EdgeZone.js b/src/gameobjects/particles/zones/EdgeZone.js index 05ae162f2..4aa68d214 100644 --- a/src/gameobjects/particles/zones/EdgeZone.js +++ b/src/gameobjects/particles/zones/EdgeZone.js @@ -1,35 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../../utils/Class'); -/** - * @callback EdgeZoneSourceCallback - * - * @param {integer} quantity - The number of particles to place on the source edge. If 0, `stepRate` should be used instead. - * @param {number} [stepRate] - The distance between each particle. When set, `quantity` is implied and should be set to `0`. - * - * @return {Phaser.Geom.Point[]} - The points placed on the source edge. - */ - -/** - * @typedef {object} EdgeZoneSource - * - * @property {EdgeZoneSourceCallback} getPoints - A function placing points on the source's edge or edges. - * - * @see Phaser.Curves.Curve - * @see Phaser.Curves.Path - * @see Phaser.Geom.Circle - * @see Phaser.Geom.Ellipse - * @see Phaser.Geom.Line - * @see Phaser.Geom.Polygon - * @see Phaser.Geom.Rectangle - * @see Phaser.Geom.Triangle - */ - /** * @classdesc * A zone that places particles on a shape's edges. @@ -39,7 +15,7 @@ var Class = require('../../../utils/Class'); * @constructor * @since 3.0.0 * - * @param {EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. + * @param {Phaser.GameObjects.Particles.Types.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. * @param {integer} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. * @param {number} stepRate - The distance between each particle. When set, `quantity` is implied and should be set to 0. * @param {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. @@ -58,7 +34,7 @@ var EdgeZone = new Class({ * An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. * * @name Phaser.GameObjects.Particles.Zones.EdgeZone#source - * @type {EdgeZoneSource|RandomZoneSource} + * @type {Phaser.GameObjects.Particles.Types.EdgeZoneSource|Phaser.GameObjects.Particles.Types.RandomZoneSource} * @since 3.0.0 */ this.source = source; diff --git a/src/gameobjects/particles/zones/RandomZone.js b/src/gameobjects/particles/zones/RandomZone.js index 34f8d33a7..739faa0b5 100644 --- a/src/gameobjects/particles/zones/RandomZone.js +++ b/src/gameobjects/particles/zones/RandomZone.js @@ -1,31 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../../utils/Class'); var Vector2 = require('../../../math/Vector2'); -/** - * @callback RandomZoneSourceCallback - * - * @param {Phaser.Math.Vector2} point - A point to modify. - */ - -/** - * @typedef {object} RandomZoneSource - * - * @property {RandomZoneSourceCallback} getRandomPoint - A function modifying its point argument. - * - * @see Phaser.Geom.Circle - * @see Phaser.Geom.Ellipse - * @see Phaser.Geom.Line - * @see Phaser.Geom.Polygon - * @see Phaser.Geom.Rectangle - * @see Phaser.Geom.Triangle - */ - /** * @classdesc * A zone that places particles randomly within a shape's area. @@ -35,7 +16,7 @@ var Vector2 = require('../../../math/Vector2'); * @constructor * @since 3.0.0 * - * @param {RandomZoneSource} source - An object instance with a `getRandomPoint(point)` method. + * @param {Phaser.GameObjects.Particles.Types.RandomZoneSource} source - An object instance with a `getRandomPoint(point)` method. */ var RandomZone = new Class({ @@ -47,7 +28,7 @@ var RandomZone = new Class({ * An object instance with a `getRandomPoint(point)` method. * * @name Phaser.GameObjects.Particles.Zones.RandomZone#source - * @type {RandomZoneSource} + * @type {Phaser.GameObjects.Particles.Types.RandomZoneSource} * @since 3.0.0 */ this.source = source; diff --git a/src/gameobjects/particles/zones/index.js b/src/gameobjects/particles/zones/index.js index eaa5d7bd9..629976e51 100644 --- a/src/gameobjects/particles/zones/index.js +++ b/src/gameobjects/particles/zones/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/pathfollower/PathFollower.js b/src/gameobjects/pathfollower/PathFollower.js index 07c9c6706..24f8f142b 100644 --- a/src/gameobjects/pathfollower/PathFollower.js +++ b/src/gameobjects/pathfollower/PathFollower.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,20 +12,6 @@ var Sprite = require('../sprite/Sprite'); var TWEEN_CONST = require('../../tweens/tween/const'); var Vector2 = require('../../math/Vector2'); -/** - * Settings for a PathFollower. - * - * @typedef {object} PathConfig - * - * @property {number} duration - The duration of the path follow. - * @property {number} from - The start position of the path follow, between 0 and 1. - * @property {number} to - The end position of the path follow, between 0 and 1. - * @property {boolean} [positionOnPath=false] - Whether to position the PathFollower on the Path using its path offset. - * @property {boolean} [rotateToPath=false] - Should the PathFollower automatically rotate to point in the direction of the Path? - * @property {number} [rotationOffset=0] - If the PathFollower is rotating to match the Path, this value is added to the rotation value. This allows you to rotate objects to a path but control the angle of the rotation as well. - * @property {number} [startAt=0] - Current start position of the path follow, between 0 and 1. - */ - /** * @classdesc * A PathFollower Game Object. @@ -125,7 +111,7 @@ var PathFollower = new Class({ * Settings for the PathFollower. * * @name Phaser.GameObjects.PathFollower#pathConfig - * @type {?PathConfig} + * @type {?Phaser.GameObjects.PathFollower.Types.PathConfig} * @default null * @since 3.0.0 */ @@ -145,13 +131,13 @@ var PathFollower = new Class({ /** * Set the Path that this PathFollower should follow. * - * Optionally accepts {@link PathConfig} settings. + * Optionally accepts {@link Phaser.GameObjects.PathFollower.Types.PathConfig} settings. * * @method Phaser.GameObjects.PathFollower#setPath * @since 3.0.0 * * @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time. - * @param {PathConfig} [config] - Settings for the PathFollower. + * @param {Phaser.GameObjects.PathFollower.Types.PathConfig} [config] - Settings for the PathFollower. * * @return {Phaser.GameObjects.PathFollower} This Game Object. */ @@ -221,7 +207,7 @@ var PathFollower = new Class({ * @method Phaser.GameObjects.PathFollower#startFollow * @since 3.3.0 * - * @param {(number|PathConfig)} [config={}] - The duration of the follow, or a PathFollower config object. + * @param {(number|Phaser.GameObjects.PathFollower.Types.PathConfig)} [config={}] - The duration of the follow, or a PathFollower config object. * @param {number} [startAt=0] - Optional start position of the follow, between 0 and 1. * * @return {Phaser.GameObjects.PathFollower} This Game Object. diff --git a/src/gameobjects/pathfollower/PathFollowerFactory.js b/src/gameobjects/pathfollower/PathFollowerFactory.js index b2698205c..742979975 100644 --- a/src/gameobjects/pathfollower/PathFollowerFactory.js +++ b/src/gameobjects/pathfollower/PathFollowerFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/pathfollower/typedefs/PathConfig.js b/src/gameobjects/pathfollower/typedefs/PathConfig.js new file mode 100644 index 000000000..3e8fed1e6 --- /dev/null +++ b/src/gameobjects/pathfollower/typedefs/PathConfig.js @@ -0,0 +1,14 @@ +/** + * Settings for a PathFollower. + * + * @typedef {object} Phaser.GameObjects.PathFollower.Types.PathConfig + * @since 3.0.0 + * + * @property {number} duration - The duration of the path follow. + * @property {number} from - The start position of the path follow, between 0 and 1. + * @property {number} to - The end position of the path follow, between 0 and 1. + * @property {boolean} [positionOnPath=false] - Whether to position the PathFollower on the Path using its path offset. + * @property {boolean} [rotateToPath=false] - Should the PathFollower automatically rotate to point in the direction of the Path? + * @property {number} [rotationOffset=0] - If the PathFollower is rotating to match the Path, this value is added to the rotation value. This allows you to rotate objects to a path but control the angle of the rotation as well. + * @property {number} [startAt=0] - Current start position of the path follow, between 0 and 1. + */ diff --git a/src/gameobjects/pathfollower/typedefs/index.js b/src/gameobjects/pathfollower/typedefs/index.js new file mode 100644 index 000000000..b79002819 --- /dev/null +++ b/src/gameobjects/pathfollower/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.PathFollower.Types + */ diff --git a/src/gameobjects/quad/Quad.js b/src/gameobjects/quad/Quad.js index 955e778a2..51bf889c3 100644 --- a/src/gameobjects/quad/Quad.js +++ b/src/gameobjects/quad/Quad.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/quad/QuadCreator.js b/src/gameobjects/quad/QuadCreator.js index e182a0687..62a87d85c 100644 --- a/src/gameobjects/quad/QuadCreator.js +++ b/src/gameobjects/quad/QuadCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/quad/QuadFactory.js b/src/gameobjects/quad/QuadFactory.js index 67cc239fd..1600ee1e7 100644 --- a/src/gameobjects/quad/QuadFactory.js +++ b/src/gameobjects/quad/QuadFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/rendertexture/RenderTexture.js b/src/gameobjects/rendertexture/RenderTexture.js index 173824565..5b245b52d 100644 --- a/src/gameobjects/rendertexture/RenderTexture.js +++ b/src/gameobjects/rendertexture/RenderTexture.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -23,6 +23,11 @@ var UUID = require('../../utils/string/UUID'); * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads. + * + * Note that under WebGL a FrameBuffer, which is what the Render Texture uses internally, cannot be anti-aliased. This means + * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this + * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that + * to the Render Texture. * * @class RenderTexture * @extends Phaser.GameObjects.GameObject @@ -255,7 +260,7 @@ var RenderTexture = new Class({ /** * Sets the size of this Game Object. * - * @method Phaser.GameObjects.Components.Size#setSize + * @method Phaser.GameObjects.RenderTexture#setSize * @since 3.0.0 * * @param {number} width - The width of this Game Object. @@ -424,7 +429,7 @@ var RenderTexture = new Class({ renderer.setFramebuffer(this.framebuffer, true); - renderer.pipelines.TextureTintPipeline.drawFillRect( + this.pipeline.drawFillRect( bounds.x, bounds.y, bounds.right, bounds.bottom, Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1), alpha @@ -460,7 +465,7 @@ var RenderTexture = new Class({ var renderer = this.renderer; renderer.setFramebuffer(this.framebuffer, true); - + gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); diff --git a/src/gameobjects/rendertexture/RenderTextureCanvasRenderer.js b/src/gameobjects/rendertexture/RenderTextureCanvasRenderer.js index ea7e7c2ee..e322c3200 100644 --- a/src/gameobjects/rendertexture/RenderTextureCanvasRenderer.js +++ b/src/gameobjects/rendertexture/RenderTextureCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/rendertexture/RenderTextureCreator.js b/src/gameobjects/rendertexture/RenderTextureCreator.js index 65ee4bfb1..f91fdc872 100644 --- a/src/gameobjects/rendertexture/RenderTextureCreator.js +++ b/src/gameobjects/rendertexture/RenderTextureCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,15 +9,6 @@ var GameObjectCreator = require('../GameObjectCreator'); var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); var RenderTexture = require('./RenderTexture'); -/** - * @typedef {object} RenderTextureConfig - * - * @property {number} [x=0] - The x coordinate of the RenderTexture's position. - * @property {number} [y=0] - The y coordinate of the RenderTexture's position. - * @property {number} [width=32] - The width of the RenderTexture. - * @property {number} [height=32] - The height of the RenderTexture. - */ - /** * Creates a new Render Texture Game Object and returns it. * @@ -26,7 +17,7 @@ var RenderTexture = require('./RenderTexture'); * @method Phaser.GameObjects.GameObjectCreator#renderTexture * @since 3.2.0 * - * @param {RenderTextureConfig} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.GameObjects.RenderTexture.Types.RenderTextureConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. diff --git a/src/gameobjects/rendertexture/RenderTextureFactory.js b/src/gameobjects/rendertexture/RenderTextureFactory.js index 98a5b496a..6609d06bd 100644 --- a/src/gameobjects/rendertexture/RenderTextureFactory.js +++ b/src/gameobjects/rendertexture/RenderTextureFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/rendertexture/RenderTextureRender.js b/src/gameobjects/rendertexture/RenderTextureRender.js index de3636eb2..8bc3fff75 100644 --- a/src/gameobjects/rendertexture/RenderTextureRender.js +++ b/src/gameobjects/rendertexture/RenderTextureRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/rendertexture/RenderTextureWebGLRenderer.js b/src/gameobjects/rendertexture/RenderTextureWebGLRenderer.js index e3343b6ac..64bc14328 100644 --- a/src/gameobjects/rendertexture/RenderTextureWebGLRenderer.js +++ b/src/gameobjects/rendertexture/RenderTextureWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/rendertexture/typedefs/RenderTextureConfig.js b/src/gameobjects/rendertexture/typedefs/RenderTextureConfig.js new file mode 100644 index 000000000..f71cbd428 --- /dev/null +++ b/src/gameobjects/rendertexture/typedefs/RenderTextureConfig.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.GameObjects.RenderTexture.Types.RenderTextureConfig + * @since 3.2.0 + * + * @property {number} [x=0] - The x coordinate of the RenderTextures position. + * @property {number} [y=0] - The y coordinate of the RenderTextures position. + * @property {number} [width=32] - The width of the RenderTexture. + * @property {number} [height=32] - The height of the RenderTexture. + */ diff --git a/src/gameobjects/rendertexture/typedefs/index.js b/src/gameobjects/rendertexture/typedefs/index.js new file mode 100644 index 000000000..f00b0045a --- /dev/null +++ b/src/gameobjects/rendertexture/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.RenderTexture.Types + */ diff --git a/src/gameobjects/shape/FillPathWebGL.js b/src/gameobjects/shape/FillPathWebGL.js index ff7b10835..2ff03827c 100644 --- a/src/gameobjects/shape/FillPathWebGL.js +++ b/src/gameobjects/shape/FillPathWebGL.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/FillStyleCanvas.js b/src/gameobjects/shape/FillStyleCanvas.js index e00efa68a..3d6bd10b7 100644 --- a/src/gameobjects/shape/FillStyleCanvas.js +++ b/src/gameobjects/shape/FillStyleCanvas.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/LineStyleCanvas.js b/src/gameobjects/shape/LineStyleCanvas.js index 8d72787f8..c257cf541 100644 --- a/src/gameobjects/shape/LineStyleCanvas.js +++ b/src/gameobjects/shape/LineStyleCanvas.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/Shape.js b/src/gameobjects/shape/Shape.js index c30870331..657767fb9 100644 --- a/src/gameobjects/shape/Shape.js +++ b/src/gameobjects/shape/Shape.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/StrokePathWebGL.js b/src/gameobjects/shape/StrokePathWebGL.js index 1039e123a..24dd70ec2 100644 --- a/src/gameobjects/shape/StrokePathWebGL.js +++ b/src/gameobjects/shape/StrokePathWebGL.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/arc/Arc.js b/src/gameobjects/shape/arc/Arc.js index 9bd229661..eee80843d 100644 --- a/src/gameobjects/shape/arc/Arc.js +++ b/src/gameobjects/shape/arc/Arc.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/arc/ArcCanvasRenderer.js b/src/gameobjects/shape/arc/ArcCanvasRenderer.js index 188410c0b..c4e42ebe6 100644 --- a/src/gameobjects/shape/arc/ArcCanvasRenderer.js +++ b/src/gameobjects/shape/arc/ArcCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/arc/ArcFactory.js b/src/gameobjects/shape/arc/ArcFactory.js index 0a1e905f3..1ac8ae195 100644 --- a/src/gameobjects/shape/arc/ArcFactory.js +++ b/src/gameobjects/shape/arc/ArcFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/arc/ArcRender.js b/src/gameobjects/shape/arc/ArcRender.js index 99d67f98a..948821677 100644 --- a/src/gameobjects/shape/arc/ArcRender.js +++ b/src/gameobjects/shape/arc/ArcRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/arc/ArcWebGLRenderer.js b/src/gameobjects/shape/arc/ArcWebGLRenderer.js index 900303cf9..41139557d 100644 --- a/src/gameobjects/shape/arc/ArcWebGLRenderer.js +++ b/src/gameobjects/shape/arc/ArcWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/curve/Curve.js b/src/gameobjects/shape/curve/Curve.js index 75e8579d3..5516d10af 100644 --- a/src/gameobjects/shape/curve/Curve.js +++ b/src/gameobjects/shape/curve/Curve.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/curve/CurveCanvasRenderer.js b/src/gameobjects/shape/curve/CurveCanvasRenderer.js index 05a2e4a65..909420ba8 100644 --- a/src/gameobjects/shape/curve/CurveCanvasRenderer.js +++ b/src/gameobjects/shape/curve/CurveCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/curve/CurveFactory.js b/src/gameobjects/shape/curve/CurveFactory.js index b39443974..3a86d736d 100644 --- a/src/gameobjects/shape/curve/CurveFactory.js +++ b/src/gameobjects/shape/curve/CurveFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/curve/CurveRender.js b/src/gameobjects/shape/curve/CurveRender.js index 3b132d2bd..a1a2b32b2 100644 --- a/src/gameobjects/shape/curve/CurveRender.js +++ b/src/gameobjects/shape/curve/CurveRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/curve/CurveWebGLRenderer.js b/src/gameobjects/shape/curve/CurveWebGLRenderer.js index 810d7eee5..f777c859b 100644 --- a/src/gameobjects/shape/curve/CurveWebGLRenderer.js +++ b/src/gameobjects/shape/curve/CurveWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/ellipse/Ellipse.js b/src/gameobjects/shape/ellipse/Ellipse.js index 7d7878772..e0a5d3c34 100644 --- a/src/gameobjects/shape/ellipse/Ellipse.js +++ b/src/gameobjects/shape/ellipse/Ellipse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/ellipse/EllipseCanvasRenderer.js b/src/gameobjects/shape/ellipse/EllipseCanvasRenderer.js index 5336a0518..54e3e0f36 100644 --- a/src/gameobjects/shape/ellipse/EllipseCanvasRenderer.js +++ b/src/gameobjects/shape/ellipse/EllipseCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/ellipse/EllipseFactory.js b/src/gameobjects/shape/ellipse/EllipseFactory.js index 405805b6f..2cf79541d 100644 --- a/src/gameobjects/shape/ellipse/EllipseFactory.js +++ b/src/gameobjects/shape/ellipse/EllipseFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/ellipse/EllipseRender.js b/src/gameobjects/shape/ellipse/EllipseRender.js index a1b587318..2e550b1f6 100644 --- a/src/gameobjects/shape/ellipse/EllipseRender.js +++ b/src/gameobjects/shape/ellipse/EllipseRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/ellipse/EllipseWebGLRenderer.js b/src/gameobjects/shape/ellipse/EllipseWebGLRenderer.js index bc184dd0d..10e103275 100644 --- a/src/gameobjects/shape/ellipse/EllipseWebGLRenderer.js +++ b/src/gameobjects/shape/ellipse/EllipseWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/grid/Grid.js b/src/gameobjects/shape/grid/Grid.js index 357e066b7..c8255deca 100644 --- a/src/gameobjects/shape/grid/Grid.js +++ b/src/gameobjects/shape/grid/Grid.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/grid/GridCanvasRenderer.js b/src/gameobjects/shape/grid/GridCanvasRenderer.js index 3f4ceeb7a..a978f37ef 100644 --- a/src/gameobjects/shape/grid/GridCanvasRenderer.js +++ b/src/gameobjects/shape/grid/GridCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/grid/GridFactory.js b/src/gameobjects/shape/grid/GridFactory.js index 1e1d63d67..3e9853490 100644 --- a/src/gameobjects/shape/grid/GridFactory.js +++ b/src/gameobjects/shape/grid/GridFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/grid/GridRender.js b/src/gameobjects/shape/grid/GridRender.js index 4da95f739..62bd16f52 100644 --- a/src/gameobjects/shape/grid/GridRender.js +++ b/src/gameobjects/shape/grid/GridRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/grid/GridWebGLRenderer.js b/src/gameobjects/shape/grid/GridWebGLRenderer.js index 5b0041599..5039dfc26 100644 --- a/src/gameobjects/shape/grid/GridWebGLRenderer.js +++ b/src/gameobjects/shape/grid/GridWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isobox/IsoBox.js b/src/gameobjects/shape/isobox/IsoBox.js index c03238cc1..8e0cc8dd8 100644 --- a/src/gameobjects/shape/isobox/IsoBox.js +++ b/src/gameobjects/shape/isobox/IsoBox.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isobox/IsoBoxCanvasRenderer.js b/src/gameobjects/shape/isobox/IsoBoxCanvasRenderer.js index f94dc0d80..d65addb1c 100644 --- a/src/gameobjects/shape/isobox/IsoBoxCanvasRenderer.js +++ b/src/gameobjects/shape/isobox/IsoBoxCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isobox/IsoBoxFactory.js b/src/gameobjects/shape/isobox/IsoBoxFactory.js index 4a1ad7aa8..fbc4daef0 100644 --- a/src/gameobjects/shape/isobox/IsoBoxFactory.js +++ b/src/gameobjects/shape/isobox/IsoBoxFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isobox/IsoBoxRender.js b/src/gameobjects/shape/isobox/IsoBoxRender.js index 670611434..20f1598d8 100644 --- a/src/gameobjects/shape/isobox/IsoBoxRender.js +++ b/src/gameobjects/shape/isobox/IsoBoxRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isobox/IsoBoxWebGLRenderer.js b/src/gameobjects/shape/isobox/IsoBoxWebGLRenderer.js index 42489779c..9dc5dbdb9 100644 --- a/src/gameobjects/shape/isobox/IsoBoxWebGLRenderer.js +++ b/src/gameobjects/shape/isobox/IsoBoxWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isotriangle/IsoTriangle.js b/src/gameobjects/shape/isotriangle/IsoTriangle.js index e71b96de0..81556f2b6 100644 --- a/src/gameobjects/shape/isotriangle/IsoTriangle.js +++ b/src/gameobjects/shape/isotriangle/IsoTriangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isotriangle/IsoTriangleCanvasRenderer.js b/src/gameobjects/shape/isotriangle/IsoTriangleCanvasRenderer.js index cbd1a64e5..0a5776b56 100644 --- a/src/gameobjects/shape/isotriangle/IsoTriangleCanvasRenderer.js +++ b/src/gameobjects/shape/isotriangle/IsoTriangleCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isotriangle/IsoTriangleFactory.js b/src/gameobjects/shape/isotriangle/IsoTriangleFactory.js index 17b99dde7..22853a031 100644 --- a/src/gameobjects/shape/isotriangle/IsoTriangleFactory.js +++ b/src/gameobjects/shape/isotriangle/IsoTriangleFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isotriangle/IsoTriangleRender.js b/src/gameobjects/shape/isotriangle/IsoTriangleRender.js index ded1fc5d0..9fdb70159 100644 --- a/src/gameobjects/shape/isotriangle/IsoTriangleRender.js +++ b/src/gameobjects/shape/isotriangle/IsoTriangleRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/isotriangle/IsoTriangleWebGLRenderer.js b/src/gameobjects/shape/isotriangle/IsoTriangleWebGLRenderer.js index a6fa0d04b..bb27dd67d 100644 --- a/src/gameobjects/shape/isotriangle/IsoTriangleWebGLRenderer.js +++ b/src/gameobjects/shape/isotriangle/IsoTriangleWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/line/Line.js b/src/gameobjects/shape/line/Line.js index e639d9a72..cb0fb35cc 100644 --- a/src/gameobjects/shape/line/Line.js +++ b/src/gameobjects/shape/line/Line.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/line/LineCanvasRenderer.js b/src/gameobjects/shape/line/LineCanvasRenderer.js index 231d4d0dc..2b1bc99d5 100644 --- a/src/gameobjects/shape/line/LineCanvasRenderer.js +++ b/src/gameobjects/shape/line/LineCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/line/LineFactory.js b/src/gameobjects/shape/line/LineFactory.js index 90c0e7d5c..02498b666 100644 --- a/src/gameobjects/shape/line/LineFactory.js +++ b/src/gameobjects/shape/line/LineFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/line/LineRender.js b/src/gameobjects/shape/line/LineRender.js index 38051e196..2d55995da 100644 --- a/src/gameobjects/shape/line/LineRender.js +++ b/src/gameobjects/shape/line/LineRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/line/LineWebGLRenderer.js b/src/gameobjects/shape/line/LineWebGLRenderer.js index 21ad80026..dc83b9150 100644 --- a/src/gameobjects/shape/line/LineWebGLRenderer.js +++ b/src/gameobjects/shape/line/LineWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/polygon/Polygon.js b/src/gameobjects/shape/polygon/Polygon.js index bbbe48ba9..de2f06776 100644 --- a/src/gameobjects/shape/polygon/Polygon.js +++ b/src/gameobjects/shape/polygon/Polygon.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/polygon/PolygonCanvasRenderer.js b/src/gameobjects/shape/polygon/PolygonCanvasRenderer.js index bf447b96e..7e7e08b0d 100644 --- a/src/gameobjects/shape/polygon/PolygonCanvasRenderer.js +++ b/src/gameobjects/shape/polygon/PolygonCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/polygon/PolygonFactory.js b/src/gameobjects/shape/polygon/PolygonFactory.js index bf886a8fb..5ca2576c3 100644 --- a/src/gameobjects/shape/polygon/PolygonFactory.js +++ b/src/gameobjects/shape/polygon/PolygonFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/polygon/PolygonRender.js b/src/gameobjects/shape/polygon/PolygonRender.js index f764840bc..dd739b836 100644 --- a/src/gameobjects/shape/polygon/PolygonRender.js +++ b/src/gameobjects/shape/polygon/PolygonRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/polygon/PolygonWebGLRenderer.js b/src/gameobjects/shape/polygon/PolygonWebGLRenderer.js index 8bc09d393..877c85cca 100644 --- a/src/gameobjects/shape/polygon/PolygonWebGLRenderer.js +++ b/src/gameobjects/shape/polygon/PolygonWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/rectangle/Rectangle.js b/src/gameobjects/shape/rectangle/Rectangle.js index 9254034b9..c7fca5589 100644 --- a/src/gameobjects/shape/rectangle/Rectangle.js +++ b/src/gameobjects/shape/rectangle/Rectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/rectangle/RectangleCanvasRenderer.js b/src/gameobjects/shape/rectangle/RectangleCanvasRenderer.js index 3f4ceeb7a..a978f37ef 100644 --- a/src/gameobjects/shape/rectangle/RectangleCanvasRenderer.js +++ b/src/gameobjects/shape/rectangle/RectangleCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/rectangle/RectangleFactory.js b/src/gameobjects/shape/rectangle/RectangleFactory.js index 01960308b..d47fbe4a5 100644 --- a/src/gameobjects/shape/rectangle/RectangleFactory.js +++ b/src/gameobjects/shape/rectangle/RectangleFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/rectangle/RectangleRender.js b/src/gameobjects/shape/rectangle/RectangleRender.js index d6203ed39..9a2f6080b 100644 --- a/src/gameobjects/shape/rectangle/RectangleRender.js +++ b/src/gameobjects/shape/rectangle/RectangleRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/rectangle/RectangleWebGLRenderer.js b/src/gameobjects/shape/rectangle/RectangleWebGLRenderer.js index c04729c79..ead086b3d 100644 --- a/src/gameobjects/shape/rectangle/RectangleWebGLRenderer.js +++ b/src/gameobjects/shape/rectangle/RectangleWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -68,7 +68,7 @@ var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, c fillTint.BR = fillTintColor; pipeline.setTexture2D(); - + pipeline.batchFillRect( -dx, -dy, diff --git a/src/gameobjects/shape/star/Star.js b/src/gameobjects/shape/star/Star.js index 38b648f2c..e6151cbf3 100644 --- a/src/gameobjects/shape/star/Star.js +++ b/src/gameobjects/shape/star/Star.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/star/StarCanvasRenderer.js b/src/gameobjects/shape/star/StarCanvasRenderer.js index 287976bc6..68448663b 100644 --- a/src/gameobjects/shape/star/StarCanvasRenderer.js +++ b/src/gameobjects/shape/star/StarCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/star/StarFactory.js b/src/gameobjects/shape/star/StarFactory.js index 9910605f2..3810f2641 100644 --- a/src/gameobjects/shape/star/StarFactory.js +++ b/src/gameobjects/shape/star/StarFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/star/StarRender.js b/src/gameobjects/shape/star/StarRender.js index 189d9d6f6..811025c85 100644 --- a/src/gameobjects/shape/star/StarRender.js +++ b/src/gameobjects/shape/star/StarRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/star/StarWebGLRenderer.js b/src/gameobjects/shape/star/StarWebGLRenderer.js index 1cfee8e3f..6d9d55f98 100644 --- a/src/gameobjects/shape/star/StarWebGLRenderer.js +++ b/src/gameobjects/shape/star/StarWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/triangle/Triangle.js b/src/gameobjects/shape/triangle/Triangle.js index 5b09ee332..b4e27f966 100644 --- a/src/gameobjects/shape/triangle/Triangle.js +++ b/src/gameobjects/shape/triangle/Triangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/triangle/TriangleCanvasRenderer.js b/src/gameobjects/shape/triangle/TriangleCanvasRenderer.js index 25bc48a67..11d4361b1 100644 --- a/src/gameobjects/shape/triangle/TriangleCanvasRenderer.js +++ b/src/gameobjects/shape/triangle/TriangleCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/triangle/TriangleFactory.js b/src/gameobjects/shape/triangle/TriangleFactory.js index 0d92e65ec..6f1fc8fe8 100644 --- a/src/gameobjects/shape/triangle/TriangleFactory.js +++ b/src/gameobjects/shape/triangle/TriangleFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/triangle/TriangleRender.js b/src/gameobjects/shape/triangle/TriangleRender.js index 9f78d38db..975b9c2f6 100644 --- a/src/gameobjects/shape/triangle/TriangleRender.js +++ b/src/gameobjects/shape/triangle/TriangleRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/shape/triangle/TriangleWebGLRenderer.js b/src/gameobjects/shape/triangle/TriangleWebGLRenderer.js index eb4c43e6c..a158a9ac2 100644 --- a/src/gameobjects/shape/triangle/TriangleWebGLRenderer.js +++ b/src/gameobjects/shape/triangle/TriangleWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/sprite/Sprite.js b/src/gameobjects/sprite/Sprite.js index 04f922573..7193b04a4 100644 --- a/src/gameobjects/sprite/Sprite.js +++ b/src/gameobjects/sprite/Sprite.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -144,7 +144,7 @@ var Sprite = new Class({ * @method Phaser.GameObjects.Sprite#toJSON * @since 3.0.0 * - * @return {JSONGameObject} A JSON representation of the Game Object. + * @return {Phaser.GameObjects.Types.JSONGameObject} A JSON representation of the Game Object. */ toJSON: function () { diff --git a/src/gameobjects/sprite/SpriteCanvasRenderer.js b/src/gameobjects/sprite/SpriteCanvasRenderer.js index 9bc589bba..381634a3c 100644 --- a/src/gameobjects/sprite/SpriteCanvasRenderer.js +++ b/src/gameobjects/sprite/SpriteCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/sprite/SpriteCreator.js b/src/gameobjects/sprite/SpriteCreator.js index af40df5b3..a0b45291b 100644 --- a/src/gameobjects/sprite/SpriteCreator.js +++ b/src/gameobjects/sprite/SpriteCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,14 +10,6 @@ var GameObjectCreator = require('../GameObjectCreator'); var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); var Sprite = require('./Sprite'); -/** - * @typedef {object} SpriteConfig - * @extends GameObjectConfig - * - * @property {string} [key] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @property {(number|string)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ - /** * Creates a new Sprite Game Object and returns it. * @@ -26,7 +18,7 @@ var Sprite = require('./Sprite'); * @method Phaser.GameObjects.GameObjectCreator#sprite * @since 3.0.0 * - * @param {SpriteConfig} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.GameObjects.Sprite.Types.SpriteConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Sprite} The Game Object that was created. diff --git a/src/gameobjects/sprite/SpriteFactory.js b/src/gameobjects/sprite/SpriteFactory.js index 64096275d..4e00fc108 100644 --- a/src/gameobjects/sprite/SpriteFactory.js +++ b/src/gameobjects/sprite/SpriteFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/sprite/SpriteRender.js b/src/gameobjects/sprite/SpriteRender.js index 8b5216a46..76ecd8002 100644 --- a/src/gameobjects/sprite/SpriteRender.js +++ b/src/gameobjects/sprite/SpriteRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/sprite/SpriteWebGLRenderer.js b/src/gameobjects/sprite/SpriteWebGLRenderer.js index aa114612d..de157fea2 100644 --- a/src/gameobjects/sprite/SpriteWebGLRenderer.js +++ b/src/gameobjects/sprite/SpriteWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/sprite/typedefs/SpriteConfig.js b/src/gameobjects/sprite/typedefs/SpriteConfig.js new file mode 100644 index 000000000..2f8bb903b --- /dev/null +++ b/src/gameobjects/sprite/typedefs/SpriteConfig.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.GameObjects.Sprite.Types.SpriteConfig + * @extends Phaser.GameObjects.Types.GameObjectConfig + * @since 3.0.0 + * + * @property {string} [key] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @property {(number|string)} [frame] - An optional frame from the Texture this Game Object is rendering with. + */ diff --git a/src/gameobjects/sprite/typedefs/index.js b/src/gameobjects/sprite/typedefs/index.js new file mode 100644 index 000000000..b08aa9504 --- /dev/null +++ b/src/gameobjects/sprite/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Sprite.Types + */ diff --git a/src/gameobjects/text/GetTextSize.js b/src/gameobjects/text/GetTextSize.js index 333eb95f6..945fe419b 100644 --- a/src/gameobjects/text/GetTextSize.js +++ b/src/gameobjects/text/GetTextSize.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,7 +11,7 @@ * @since 3.0.0 * * @param {Phaser.GameObjects.Text} text - The Text object to calculate the size from. - * @param {BitmapTextMetrics} size - The Text metrics to use when calculating the size. + * @param {Phaser.GameObjects.Text.Types.TextMetrics} size - The Text metrics to use when calculating the size. * @param {array} lines - The lines of text to calculate the size from. * * @return {object} An object containing dimensions of the Text object. diff --git a/src/gameobjects/text/MeasureText.js b/src/gameobjects/text/MeasureText.js index f4855ddea..605b67625 100644 --- a/src/gameobjects/text/MeasureText.js +++ b/src/gameobjects/text/MeasureText.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,7 +12,7 @@ var CanvasPool = require('../../display/canvas/CanvasPool'); * @function Phaser.GameObjects.Text.MeasureText * @since 3.0.0 * - * @param {Phaser.GameObjects.Text.TextStyle} textStyle - The TextStyle object to measure. + * @param {Phaser.GameObjects.TextStyle} textStyle - The TextStyle object to measure. * * @return {object} An object containing the ascent, descent and fontSize of the TextStyle. */ diff --git a/src/gameobjects/text/TextStyle.js b/src/gameobjects/text/TextStyle.js index bb9ab95b8..6ef58d7d5 100644 --- a/src/gameobjects/text/TextStyle.js +++ b/src/gameobjects/text/TextStyle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -51,22 +51,16 @@ var propertyMap = { wordWrapUseAdvanced: [ 'wordWrap.useAdvancedWrap', false ] }; -/** - * Font metrics for a Text Style object. - * - * @typedef {object} BitmapTextMetrics - * - * @property {number} ascent - The ascent of the font. - * @property {number} descent - The descent of the font. - * @property {number} fontSize - The size of the font. - */ - /** * @classdesc - * Style settings for a Text object. + * A TextStyle class manages all of the style settings for a Text object. + * + * Text Game Objects create a TextStyle instance automatically, which is + * accessed via the `Text.style` property. You do not normally need to + * instantiate one yourself. * * @class TextStyle - * @memberof Phaser.GameObjects.Text + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * @@ -82,7 +76,7 @@ var TextStyle = new Class({ /** * The Text object that this TextStyle is styling. * - * @name Phaser.GameObjects.Text.TextStyle#parent + * @name Phaser.GameObjects.TextStyle#parent * @type {Phaser.GameObjects.Text} * @since 3.0.0 */ @@ -91,7 +85,7 @@ var TextStyle = new Class({ /** * The font family. * - * @name Phaser.GameObjects.Text.TextStyle#fontFamily + * @name Phaser.GameObjects.TextStyle#fontFamily * @type {string} * @default 'Courier' * @since 3.0.0 @@ -101,7 +95,7 @@ var TextStyle = new Class({ /** * The font size. * - * @name Phaser.GameObjects.Text.TextStyle#fontSize + * @name Phaser.GameObjects.TextStyle#fontSize * @type {string} * @default '16px' * @since 3.0.0 @@ -111,7 +105,7 @@ var TextStyle = new Class({ /** * The font style. * - * @name Phaser.GameObjects.Text.TextStyle#fontStyle + * @name Phaser.GameObjects.TextStyle#fontStyle * @type {string} * @since 3.0.0 */ @@ -120,7 +114,7 @@ var TextStyle = new Class({ /** * The background color. * - * @name Phaser.GameObjects.Text.TextStyle#backgroundColor + * @name Phaser.GameObjects.TextStyle#backgroundColor * @type {string} * @since 3.0.0 */ @@ -129,7 +123,7 @@ var TextStyle = new Class({ /** * The text fill color. * - * @name Phaser.GameObjects.Text.TextStyle#color + * @name Phaser.GameObjects.TextStyle#color * @type {string} * @default '#fff' * @since 3.0.0 @@ -139,7 +133,7 @@ var TextStyle = new Class({ /** * The text stroke color. * - * @name Phaser.GameObjects.Text.TextStyle#stroke + * @name Phaser.GameObjects.TextStyle#stroke * @type {string} * @default '#fff' * @since 3.0.0 @@ -149,7 +143,7 @@ var TextStyle = new Class({ /** * The text stroke thickness. * - * @name Phaser.GameObjects.Text.TextStyle#strokeThickness + * @name Phaser.GameObjects.TextStyle#strokeThickness * @type {number} * @default 0 * @since 3.0.0 @@ -159,7 +153,7 @@ var TextStyle = new Class({ /** * The horizontal shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetX + * @name Phaser.GameObjects.TextStyle#shadowOffsetX * @type {number} * @default 0 * @since 3.0.0 @@ -169,7 +163,7 @@ var TextStyle = new Class({ /** * The vertical shadow offset. * - * @name Phaser.GameObjects.Text.TextStyle#shadowOffsetY + * @name Phaser.GameObjects.TextStyle#shadowOffsetY * @type {number} * @default 0 * @since 3.0.0 @@ -179,7 +173,7 @@ var TextStyle = new Class({ /** * The shadow color. * - * @name Phaser.GameObjects.Text.TextStyle#shadowColor + * @name Phaser.GameObjects.TextStyle#shadowColor * @type {string} * @default '#000' * @since 3.0.0 @@ -189,7 +183,7 @@ var TextStyle = new Class({ /** * The shadow blur radius. * - * @name Phaser.GameObjects.Text.TextStyle#shadowBlur + * @name Phaser.GameObjects.TextStyle#shadowBlur * @type {number} * @default 0 * @since 3.0.0 @@ -199,7 +193,7 @@ var TextStyle = new Class({ /** * Whether shadow stroke is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowStroke + * @name Phaser.GameObjects.TextStyle#shadowStroke * @type {boolean} * @default false * @since 3.0.0 @@ -209,7 +203,7 @@ var TextStyle = new Class({ /** * Whether shadow fill is enabled or not. * - * @name Phaser.GameObjects.Text.TextStyle#shadowFill + * @name Phaser.GameObjects.TextStyle#shadowFill * @type {boolean} * @default false * @since 3.0.0 @@ -219,7 +213,7 @@ var TextStyle = new Class({ /** * The text alignment. * - * @name Phaser.GameObjects.Text.TextStyle#align + * @name Phaser.GameObjects.TextStyle#align * @type {string} * @default 'left' * @since 3.0.0 @@ -229,7 +223,7 @@ var TextStyle = new Class({ /** * The maximum number of lines to draw. * - * @name Phaser.GameObjects.Text.TextStyle#maxLines + * @name Phaser.GameObjects.TextStyle#maxLines * @type {integer} * @default 0 * @since 3.0.0 @@ -241,7 +235,7 @@ var TextStyle = new Class({ * * `0` means no fixed with. * - * @name Phaser.GameObjects.Text.TextStyle#fixedWidth + * @name Phaser.GameObjects.TextStyle#fixedWidth * @type {number} * @default 0 * @since 3.0.0 @@ -253,7 +247,7 @@ var TextStyle = new Class({ * * `0` means no fixed height. * - * @name Phaser.GameObjects.Text.TextStyle#fixedHeight + * @name Phaser.GameObjects.TextStyle#fixedHeight * @type {number} * @default 0 * @since 3.0.0 @@ -264,7 +258,7 @@ var TextStyle = new Class({ * The resolution the text is rendered to its internal canvas at. * The default is 0, which means it will use the resolution set in the Game Config. * - * @name Phaser.GameObjects.Text.TextStyle#resolution + * @name Phaser.GameObjects.TextStyle#resolution * @type {number} * @default 0 * @since 3.12.0 @@ -274,7 +268,7 @@ var TextStyle = new Class({ /** * Whether the text should render right to left. * - * @name Phaser.GameObjects.Text.TextStyle#rtl + * @name Phaser.GameObjects.TextStyle#rtl * @type {boolean} * @default false * @since 3.0.0 @@ -284,7 +278,7 @@ var TextStyle = new Class({ /** * The test string to use when measuring the font. * - * @name Phaser.GameObjects.Text.TextStyle#testString + * @name Phaser.GameObjects.TextStyle#testString * @type {string} * @default '|MÉqgy' * @since 3.0.0 @@ -294,7 +288,7 @@ var TextStyle = new Class({ /** * The amount of horizontal padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineX + * @name Phaser.GameObjects.TextStyle#baselineX * @type {number} * @default 1.2 * @since 3.3.0 @@ -304,7 +298,7 @@ var TextStyle = new Class({ /** * The amount of vertical padding adding to the width of the text when calculating the font metrics. * - * @name Phaser.GameObjects.Text.TextStyle#baselineY + * @name Phaser.GameObjects.TextStyle#baselineY * @type {number} * @default 1.4 * @since 3.3.0 @@ -314,7 +308,7 @@ var TextStyle = new Class({ /** * The font style, size and family. * - * @name Phaser.GameObjects.Text.TextStyle#_font + * @name Phaser.GameObjects.TextStyle#_font * @type {string} * @private * @since 3.0.0 @@ -354,7 +348,7 @@ var TextStyle = new Class({ * backgroundColor: '#ff00ff' * }); * - * @method Phaser.GameObjects.Text.TextStyle#setStyle + * @method Phaser.GameObjects.TextStyle#setStyle * @since 3.0.0 * * @param {object} style - The style settings to set. @@ -420,7 +414,7 @@ var TextStyle = new Class({ /** * Synchronize the font settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncFont + * @method Phaser.GameObjects.TextStyle#syncFont * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -434,7 +428,7 @@ var TextStyle = new Class({ /** * Synchronize the text style settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncStyle + * @method Phaser.GameObjects.TextStyle#syncStyle * @since 3.0.0 * * @param {HTMLCanvasElement} canvas - The Canvas Element. @@ -455,7 +449,7 @@ var TextStyle = new Class({ /** * Synchronize the shadow settings to the given Canvas Rendering Context. * - * @method Phaser.GameObjects.Text.TextStyle#syncShadow + * @method Phaser.GameObjects.TextStyle#syncShadow * @since 3.0.0 * * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. @@ -482,7 +476,7 @@ var TextStyle = new Class({ /** * Update the style settings for the parent Text object. * - * @method Phaser.GameObjects.Text.TextStyle#update + * @method Phaser.GameObjects.TextStyle#update * @since 3.0.0 * * @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics. @@ -509,7 +503,7 @@ var TextStyle = new Class({ * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. * - * @method Phaser.GameObjects.Text.TextStyle#setFont + * @method Phaser.GameObjects.TextStyle#setFont * @since 3.0.0 * * @param {(string|object)} font - The font family or font settings to set. @@ -560,7 +554,7 @@ var TextStyle = new Class({ /** * Set the font family. * - * @method Phaser.GameObjects.Text.TextStyle#setFontFamily + * @method Phaser.GameObjects.TextStyle#setFontFamily * @since 3.0.0 * * @param {string} family - The font family. @@ -582,7 +576,7 @@ var TextStyle = new Class({ /** * Set the font style. * - * @method Phaser.GameObjects.Text.TextStyle#setFontStyle + * @method Phaser.GameObjects.TextStyle#setFontStyle * @since 3.0.0 * * @param {string} style - The font style. @@ -604,7 +598,7 @@ var TextStyle = new Class({ /** * Set the font size. * - * @method Phaser.GameObjects.Text.TextStyle#setFontSize + * @method Phaser.GameObjects.TextStyle#setFontSize * @since 3.0.0 * * @param {(number|string)} size - The font size. @@ -631,7 +625,7 @@ var TextStyle = new Class({ /** * Set the test string to use when measuring the font. * - * @method Phaser.GameObjects.Text.TextStyle#setTestString + * @method Phaser.GameObjects.TextStyle#setTestString * @since 3.0.0 * * @param {string} string - The test string to use when measuring the font. @@ -650,7 +644,7 @@ var TextStyle = new Class({ * * Pass in `0` for either of these parameters to disable fixed width or height respectively. * - * @method Phaser.GameObjects.Text.TextStyle#setFixedSize + * @method Phaser.GameObjects.TextStyle#setFixedSize * @since 3.0.0 * * @param {number} width - The fixed width to set. @@ -679,7 +673,7 @@ var TextStyle = new Class({ /** * Set the background color. * - * @method Phaser.GameObjects.Text.TextStyle#setBackgroundColor + * @method Phaser.GameObjects.TextStyle#setBackgroundColor * @since 3.0.0 * * @param {string} color - The background color. @@ -696,7 +690,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setFill + * @method Phaser.GameObjects.TextStyle#setFill * @since 3.0.0 * * @param {string} color - The text fill color. @@ -713,7 +707,7 @@ var TextStyle = new Class({ /** * Set the text fill color. * - * @method Phaser.GameObjects.Text.TextStyle#setColor + * @method Phaser.GameObjects.TextStyle#setColor * @since 3.0.0 * * @param {string} color - The text fill color. @@ -736,7 +730,7 @@ var TextStyle = new Class({ * * Please use with caution, as the more high res Text you have, the more memory it uses up. * - * @method Phaser.GameObjects.Text.TextStyle#setResolution + * @method Phaser.GameObjects.TextStyle#setResolution * @since 3.12.0 * * @param {number} value - The resolution for this Text object to use. @@ -753,7 +747,7 @@ var TextStyle = new Class({ /** * Set the stroke settings. * - * @method Phaser.GameObjects.Text.TextStyle#setStroke + * @method Phaser.GameObjects.TextStyle#setStroke * @since 3.0.0 * * @param {string} color - The stroke color. @@ -789,7 +783,7 @@ var TextStyle = new Class({ * Calling this method always re-measures the parent Text object, * so only call it when you actually change the shadow settings. * - * @method Phaser.GameObjects.Text.TextStyle#setShadow + * @method Phaser.GameObjects.TextStyle#setShadow * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -823,7 +817,7 @@ var TextStyle = new Class({ /** * Set the shadow offset. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowOffset + * @method Phaser.GameObjects.TextStyle#setShadowOffset * @since 3.0.0 * * @param {number} [x=0] - The horizontal shadow offset. @@ -845,7 +839,7 @@ var TextStyle = new Class({ /** * Set the shadow color. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowColor + * @method Phaser.GameObjects.TextStyle#setShadowColor * @since 3.0.0 * * @param {string} [color='#000'] - The shadow color. @@ -864,7 +858,7 @@ var TextStyle = new Class({ /** * Set the shadow blur radius. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowBlur + * @method Phaser.GameObjects.TextStyle#setShadowBlur * @since 3.0.0 * * @param {number} [blur=0] - The shadow blur radius. @@ -883,7 +877,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow stroke. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowStroke + * @method Phaser.GameObjects.TextStyle#setShadowStroke * @since 3.0.0 * * @param {boolean} enabled - Whether shadow stroke is enabled or not. @@ -900,7 +894,7 @@ var TextStyle = new Class({ /** * Enable or disable shadow fill. * - * @method Phaser.GameObjects.Text.TextStyle#setShadowFill + * @method Phaser.GameObjects.TextStyle#setShadowFill * @since 3.0.0 * * @param {boolean} enabled - Whether shadow fill is enabled or not. @@ -919,7 +913,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by width. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapWidth + * @method Phaser.GameObjects.TextStyle#setWordWrapWidth * @since 3.0.0 * * @param {number} width - The maximum width of a line in pixels. Set to null to remove wrapping. @@ -944,7 +938,7 @@ var TextStyle = new Class({ * * Pass in null to remove wrapping by callback. * - * @method Phaser.GameObjects.Text.TextStyle#setWordWrapCallback + * @method Phaser.GameObjects.TextStyle#setWordWrapCallback * @since 3.0.0 * * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the @@ -970,7 +964,7 @@ var TextStyle = new Class({ * * Expects values like `'left'`, `'right'`, `'center'` or `'justified'`. * - * @method Phaser.GameObjects.Text.TextStyle#setAlign + * @method Phaser.GameObjects.TextStyle#setAlign * @since 3.0.0 * * @param {string} align - The text alignment. @@ -989,7 +983,7 @@ var TextStyle = new Class({ /** * Set the maximum number of lines to draw. * - * @method Phaser.GameObjects.Text.TextStyle#setMaxLines + * @method Phaser.GameObjects.TextStyle#setMaxLines * @since 3.0.0 * * @param {integer} [max=0] - The maximum number of lines to draw. @@ -1008,7 +1002,7 @@ var TextStyle = new Class({ /** * Get the current text metrics. * - * @method Phaser.GameObjects.Text.TextStyle#getTextMetrics + * @method Phaser.GameObjects.TextStyle#getTextMetrics * @since 3.0.0 * * @return {BitmapTextMetrics} The text metrics. @@ -1027,7 +1021,7 @@ var TextStyle = new Class({ /** * Build a JSON representation of this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#toJSON + * @method Phaser.GameObjects.TextStyle#toJSON * @since 3.0.0 * * @return {object} A JSON representation of this Text Style. @@ -1049,7 +1043,7 @@ var TextStyle = new Class({ /** * Destroy this Text Style. * - * @method Phaser.GameObjects.Text.TextStyle#destroy + * @method Phaser.GameObjects.TextStyle#destroy * @since 3.0.0 */ destroy: function () diff --git a/src/gameobjects/text/static/Text.js b/src/gameobjects/text/static/Text.js index 023b2b18f..7762f2857 100644 --- a/src/gameobjects/text/static/Text.js +++ b/src/gameobjects/text/static/Text.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -27,6 +27,21 @@ var TextStyle = require('../TextStyle'); * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes, either + * when creating the Text object, or when setting the font via `setFont` or `setFontFamily`. I.e.: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: '"Roboto Condensed"' }); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: 'Verdana, "Times New Roman", Tahoma, serif' }); + * ``` * * You can only display fonts that are currently loaded and available to the browser: therefore fonts must * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, @@ -138,7 +153,7 @@ var Text = new Class({ * Manages the style of this Text object. * * @name Phaser.GameObjects.Text#style - * @type {Phaser.GameObjects.Text.TextStyle} + * @type {Phaser.GameObjects.TextStyle} * @since 3.0.0 */ this.style = new TextStyle(this, style); @@ -629,6 +644,20 @@ var Text = new Class({ * * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` * properties of that object are set. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFont * @since 3.0.0 @@ -644,6 +673,20 @@ var Text = new Class({ /** * Set the font family. + * + * **Important:** If the font you wish to use has a space or digit in its name, such as + * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes: + * + * ```javascript + * Text.setFont('"Roboto Condensed"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Verdana, "Times New Roman", Tahoma, serif'); + * ``` * * @method Phaser.GameObjects.Text#setFontFamily * @since 3.0.0 @@ -1231,7 +1274,7 @@ var Text = new Class({ * @method Phaser.GameObjects.Text#toJSON * @since 3.0.0 * - * @return {JSONGameObject} A JSON representation of the Text object. + * @return {Phaser.GameObjects.Types.JSONGameObject} A JSON representation of the Text object. */ toJSON: function () { @@ -1275,6 +1318,30 @@ var Text = new Class({ this.texture.destroy(); } + /** + * 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.Text#originX + * @type {number} + * @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.Text#originY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + }); module.exports = Text; diff --git a/src/gameobjects/text/static/TextCanvasRenderer.js b/src/gameobjects/text/static/TextCanvasRenderer.js index 81dda0128..cc75ac50f 100644 --- a/src/gameobjects/text/static/TextCanvasRenderer.js +++ b/src/gameobjects/text/static/TextCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/text/static/TextCreator.js b/src/gameobjects/text/static/TextCreator.js index 2e87b8e90..505263ce6 100644 --- a/src/gameobjects/text/static/TextCreator.js +++ b/src/gameobjects/text/static/TextCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/text/static/TextFactory.js b/src/gameobjects/text/static/TextFactory.js index 2d9909ea7..a6740bf5e 100644 --- a/src/gameobjects/text/static/TextFactory.js +++ b/src/gameobjects/text/static/TextFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/text/static/TextRender.js b/src/gameobjects/text/static/TextRender.js index 8f0d118f9..400a80ee8 100644 --- a/src/gameobjects/text/static/TextRender.js +++ b/src/gameobjects/text/static/TextRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/text/static/TextWebGLRenderer.js b/src/gameobjects/text/static/TextWebGLRenderer.js index a7fdafef8..2591c6b3e 100644 --- a/src/gameobjects/text/static/TextWebGLRenderer.js +++ b/src/gameobjects/text/static/TextWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/text/typedefs/TextMetrics.js b/src/gameobjects/text/typedefs/TextMetrics.js new file mode 100644 index 000000000..df18719ce --- /dev/null +++ b/src/gameobjects/text/typedefs/TextMetrics.js @@ -0,0 +1,10 @@ +/** + * Font metrics for a Text Style object. + * + * @typedef {object} Phaser.GameObjects.Text.Types.TextMetrics + * @since 3.0.0 + * + * @property {number} ascent - The ascent of the font. + * @property {number} descent - The descent of the font. + * @property {number} fontSize - The size of the font. + */ diff --git a/src/gameobjects/text/typedefs/index.js b/src/gameobjects/text/typedefs/index.js new file mode 100644 index 000000000..46bcf8da0 --- /dev/null +++ b/src/gameobjects/text/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Text.Types + */ diff --git a/src/gameobjects/tilesprite/TileSprite.js b/src/gameobjects/tilesprite/TileSprite.js index 2efc54e20..3db5ca47c 100644 --- a/src/gameobjects/tilesprite/TileSprite.js +++ b/src/gameobjects/tilesprite/TileSprite.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -24,8 +24,8 @@ var _FLAG = 8; // 1000 * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and * are designed so that you can create game backdrops using seamless textures as a source. * - * You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background - * that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition` + * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background + * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. @@ -376,22 +376,18 @@ var TileSprite = new Class({ * @method Phaser.GameObjects.TileSprite#setTileScale * @since 3.12.0 * - * @param {number} [x] - The horizontal scale of the tiling texture. - * @param {number} [y] - The vertical scale of the tiling texture. + * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value. + * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value. * * @return {this} This Tile Sprite instance. */ setTileScale: function (x, y) { - if (x !== undefined) - { - this.tileScaleX = x; - } + if (x === undefined) { x = this.tileScaleX; } + if (y === undefined) { y = x; } - if (y !== undefined) - { - this.tileScaleY = y; - } + this.tileScaleX = x; + this.tileScaleY = y; return this; }, @@ -405,7 +401,7 @@ var TileSprite = new Class({ */ updateTileTexture: function () { - if (!this.dirty) + if (!this.dirty || !this.renderer) { return; } diff --git a/src/gameobjects/tilesprite/TileSpriteCanvasRenderer.js b/src/gameobjects/tilesprite/TileSpriteCanvasRenderer.js index f412d9b99..ba1940635 100644 --- a/src/gameobjects/tilesprite/TileSpriteCanvasRenderer.js +++ b/src/gameobjects/tilesprite/TileSpriteCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/tilesprite/TileSpriteCreator.js b/src/gameobjects/tilesprite/TileSpriteCreator.js index cb29ef0d5..c7b233032 100644 --- a/src/gameobjects/tilesprite/TileSpriteCreator.js +++ b/src/gameobjects/tilesprite/TileSpriteCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,18 +9,6 @@ var GameObjectCreator = require('../GameObjectCreator'); var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); var TileSprite = require('./TileSprite'); -/** - * @typedef {object} TileSprite - * @extends GameObjectConfig - * - * @property {number} [x=0] - The x coordinate of the Tile Sprite. - * @property {number} [y=0] - The y coordinate of the Tile Sprite. - * @property {integer} [width=512] - The width of the Tile Sprite. If zero it will use the size of the texture frame. - * @property {integer} [height=512] - The height of the Tile Sprite. If zero it will use the size of the texture frame. - * @property {string} [key=''] - The key of the Texture this Tile Sprite will use to render with, as stored in the Texture Manager. - * @property {string} [frame=''] - An optional frame from the Texture this Tile Sprite is rendering with. - */ - /** * Creates a new TileSprite Game Object and returns it. * @@ -29,7 +17,7 @@ var TileSprite = require('./TileSprite'); * @method Phaser.GameObjects.GameObjectCreator#tileSprite * @since 3.0.0 * - * @param {TileSprite} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.GameObjects.TileSprite.Types.TileSpriteConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. @@ -56,5 +44,3 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) return tile; }); - -// When registering a factory function 'this' refers to the GameObjectCreator context. diff --git a/src/gameobjects/tilesprite/TileSpriteFactory.js b/src/gameobjects/tilesprite/TileSpriteFactory.js index 4b4795792..3b388a758 100644 --- a/src/gameobjects/tilesprite/TileSpriteFactory.js +++ b/src/gameobjects/tilesprite/TileSpriteFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/tilesprite/TileSpriteRender.js b/src/gameobjects/tilesprite/TileSpriteRender.js index 6c6a24244..a975dd722 100644 --- a/src/gameobjects/tilesprite/TileSpriteRender.js +++ b/src/gameobjects/tilesprite/TileSpriteRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/tilesprite/TileSpriteWebGLRenderer.js b/src/gameobjects/tilesprite/TileSpriteWebGLRenderer.js index 171a055c1..49278dd9d 100644 --- a/src/gameobjects/tilesprite/TileSpriteWebGLRenderer.js +++ b/src/gameobjects/tilesprite/TileSpriteWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/tilesprite/typedefs/TileSpriteConfig.js b/src/gameobjects/tilesprite/typedefs/TileSpriteConfig.js new file mode 100644 index 000000000..a0867cdd0 --- /dev/null +++ b/src/gameobjects/tilesprite/typedefs/TileSpriteConfig.js @@ -0,0 +1,12 @@ +/** + * @typedef {object} Phaser.GameObjects.TileSprite.Types.TileSpriteConfig + * @extends Phaser.GameObjects.Types.GameObjectConfig + * @since 3.0.0 + * + * @property {number} [x=0] - The x coordinate of the Tile Sprite. + * @property {number} [y=0] - The y coordinate of the Tile Sprite. + * @property {integer} [width=512] - The width of the Tile Sprite. If zero it will use the size of the texture frame. + * @property {integer} [height=512] - The height of the Tile Sprite. If zero it will use the size of the texture frame. + * @property {string} [key=''] - The key of the Texture this Tile Sprite will use to render with, as stored in the Texture Manager. + * @property {string} [frame=''] - An optional frame from the Texture this Tile Sprite is rendering with. + */ diff --git a/src/gameobjects/tilesprite/typedefs/index.js b/src/gameobjects/tilesprite/typedefs/index.js new file mode 100644 index 000000000..659247577 --- /dev/null +++ b/src/gameobjects/tilesprite/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.TileSprite.Types + */ diff --git a/src/gameobjects/typedefs/GameObjectConfig.js b/src/gameobjects/typedefs/GameObjectConfig.js new file mode 100644 index 000000000..844d0a2e1 --- /dev/null +++ b/src/gameobjects/typedefs/GameObjectConfig.js @@ -0,0 +1,20 @@ +/** + * @typedef {object} Phaser.GameObjects.Types.GameObjectConfig + * @since 3.0.0 + * + * @property {number} [x=0] - The x position of the Game Object. + * @property {number} [y=0] - The y position of the Game Object. + * @property {number} [depth=0] - The depth of the GameObject. + * @property {boolean} [flipX=false] - The horizontally flipped state of the Game Object. + * @property {boolean} [flipY=false] - The vertically flipped state of the Game Object. + * @property {?(number|object)} [scale=null] - The scale of the GameObject. + * @property {?(number|object)} [scrollFactor=null] - The scroll factor of the GameObject. + * @property {number} [rotation=0] - The rotation angle of the Game Object, in radians. + * @property {?number} [angle=null] - The rotation angle of the Game Object, in degrees. + * @property {number} [alpha=1] - The alpha (opacity) of the Game Object. + * @property {?(number|object)} [origin=null] - The origin of the Game Object. + * @property {number} [scaleMode=ScaleModes.DEFAULT] - The scale mode of the GameObject. + * @property {number} [blendMode=BlendModes.DEFAULT] - The blend mode of the GameObject. + * @property {boolean} [visible=true] - The visible state of the Game Object. + * @property {boolean} [add=true] - Add the GameObject to the scene. + */ diff --git a/src/gameobjects/typedefs/JSONGameObject.js b/src/gameobjects/typedefs/JSONGameObject.js new file mode 100644 index 000000000..c16bd409a --- /dev/null +++ b/src/gameobjects/typedefs/JSONGameObject.js @@ -0,0 +1,25 @@ +/** + * @typedef {object} Phaser.GameObjects.Types.JSONGameObject + * @since 3.0.0 + * + * @property {string} name - The name of this Game Object. + * @property {string} type - A textual representation of this Game Object, i.e. `sprite`. + * @property {number} x - The x position of this Game Object. + * @property {number} y - The y position of this Game Object. + * @property {object} scale - The scale of this Game Object + * @property {number} scale.x - The horizontal scale of this Game Object. + * @property {number} scale.y - The vertical scale of this Game Object. + * @property {object} origin - The origin of this Game Object. + * @property {number} origin.x - The horizontal origin of this Game Object. + * @property {number} origin.y - The vertical origin of this Game Object. + * @property {boolean} flipX - The horizontally flipped state of the Game Object. + * @property {boolean} flipY - The vertically flipped state of the Game Object. + * @property {number} rotation - The angle of this Game Object in radians. + * @property {number} alpha - The alpha value of the Game Object. + * @property {boolean} visible - The visible state of the Game Object. + * @property {integer} scaleMode - The Scale Mode being used by this Game Object. + * @property {(integer|string)} blendMode - Sets the Blend Mode being used by this Game Object. + * @property {string} textureKey - The texture key of this Game Object. + * @property {string} frameKey - The frame key of this Game Object. + * @property {object} data - The data of this Game Object. + */ diff --git a/src/gameobjects/typedefs/index.js b/src/gameobjects/typedefs/index.js new file mode 100644 index 000000000..c5e349d8a --- /dev/null +++ b/src/gameobjects/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Types + */ diff --git a/src/gameobjects/zone/Zone.js b/src/gameobjects/zone/Zone.js index 674b3e600..4c71ccd02 100644 --- a/src/gameobjects/zone/Zone.js +++ b/src/gameobjects/zone/Zone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -236,7 +236,7 @@ var Zone = new Class({ * @since 3.0.0 * * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. - * @param {HitAreaCallback} callback - A function that will return `true` if the given x/y coords it is sent are within the shape. + * @param {Phaser.Input.Types.HitAreaCallback} 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. */ @@ -266,6 +266,18 @@ var Zone = new Class({ { }, + /** + * A NOOP method so you can pass a Zone to a Container in Canvas. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setBlendMode + * @private + * @since 3.16.2 + */ + setBlendMode: function () + { + }, + /** * A Zone does not render. * diff --git a/src/gameobjects/zone/ZoneCreator.js b/src/gameobjects/zone/ZoneCreator.js index 5f6fa426c..463640e80 100644 --- a/src/gameobjects/zone/ZoneCreator.js +++ b/src/gameobjects/zone/ZoneCreator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/gameobjects/zone/ZoneFactory.js b/src/gameobjects/zone/ZoneFactory.js index 3b73a5502..3cc638671 100644 --- a/src/gameobjects/zone/ZoneFactory.js +++ b/src/gameobjects/zone/ZoneFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Area.js b/src/geom/circle/Area.js index 00b8fb924..73098f809 100644 --- a/src/geom/circle/Area.js +++ b/src/geom/circle/Area.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Circle.js b/src/geom/circle/Circle.js index 6e3ddb503..ff7e8c1a3 100644 --- a/src/geom/circle/Circle.js +++ b/src/geom/circle/Circle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Circumference.js b/src/geom/circle/Circumference.js index f5ddec5b1..822bc1746 100644 --- a/src/geom/circle/Circumference.js +++ b/src/geom/circle/Circumference.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/CircumferencePoint.js b/src/geom/circle/CircumferencePoint.js index ae1ea4006..1f7fc43d7 100644 --- a/src/geom/circle/CircumferencePoint.js +++ b/src/geom/circle/CircumferencePoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Clone.js b/src/geom/circle/Clone.js index 6958cb09b..2708dc269 100644 --- a/src/geom/circle/Clone.js +++ b/src/geom/circle/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Contains.js b/src/geom/circle/Contains.js index 0843cca0f..33a830433 100644 --- a/src/geom/circle/Contains.js +++ b/src/geom/circle/Contains.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/ContainsPoint.js b/src/geom/circle/ContainsPoint.js index 4e1af1e50..3cae5e476 100644 --- a/src/geom/circle/ContainsPoint.js +++ b/src/geom/circle/ContainsPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/ContainsRect.js b/src/geom/circle/ContainsRect.js index c19d8ede1..d9630d1e5 100644 --- a/src/geom/circle/ContainsRect.js +++ b/src/geom/circle/ContainsRect.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/CopyFrom.js b/src/geom/circle/CopyFrom.js index 69198c36c..a507bdd81 100644 --- a/src/geom/circle/CopyFrom.js +++ b/src/geom/circle/CopyFrom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Equals.js b/src/geom/circle/Equals.js index c2c900e71..cbb67ba28 100644 --- a/src/geom/circle/Equals.js +++ b/src/geom/circle/Equals.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/GetBounds.js b/src/geom/circle/GetBounds.js index b0d543c7f..ae10466c4 100644 --- a/src/geom/circle/GetBounds.js +++ b/src/geom/circle/GetBounds.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/GetPoint.js b/src/geom/circle/GetPoint.js index 424847bb6..b050f2876 100644 --- a/src/geom/circle/GetPoint.js +++ b/src/geom/circle/GetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/GetPoints.js b/src/geom/circle/GetPoints.js index 50decbfdc..9a3e79d7f 100644 --- a/src/geom/circle/GetPoints.js +++ b/src/geom/circle/GetPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Offset.js b/src/geom/circle/Offset.js index da053ed88..a06969089 100644 --- a/src/geom/circle/Offset.js +++ b/src/geom/circle/Offset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/OffsetPoint.js b/src/geom/circle/OffsetPoint.js index fb3585e73..b1de023b7 100644 --- a/src/geom/circle/OffsetPoint.js +++ b/src/geom/circle/OffsetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/Random.js b/src/geom/circle/Random.js index ffd39aa91..7a9c005b2 100644 --- a/src/geom/circle/Random.js +++ b/src/geom/circle/Random.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/circle/index.js b/src/geom/circle/index.js index 668395ab5..bfbca09bb 100644 --- a/src/geom/circle/index.js +++ b/src/geom/circle/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Area.js b/src/geom/ellipse/Area.js index 876846c75..706956a91 100644 --- a/src/geom/ellipse/Area.js +++ b/src/geom/ellipse/Area.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Circumference.js b/src/geom/ellipse/Circumference.js index d00739b1b..12bdeb1ab 100644 --- a/src/geom/ellipse/Circumference.js +++ b/src/geom/ellipse/Circumference.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/CircumferencePoint.js b/src/geom/ellipse/CircumferencePoint.js index 23ba284ce..9bf439389 100644 --- a/src/geom/ellipse/CircumferencePoint.js +++ b/src/geom/ellipse/CircumferencePoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Clone.js b/src/geom/ellipse/Clone.js index d6345a8c4..8f481c54a 100644 --- a/src/geom/ellipse/Clone.js +++ b/src/geom/ellipse/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Contains.js b/src/geom/ellipse/Contains.js index b686451d3..b35a27d43 100644 --- a/src/geom/ellipse/Contains.js +++ b/src/geom/ellipse/Contains.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/ContainsPoint.js b/src/geom/ellipse/ContainsPoint.js index 07731ff55..ff2f6a56c 100644 --- a/src/geom/ellipse/ContainsPoint.js +++ b/src/geom/ellipse/ContainsPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/ContainsRect.js b/src/geom/ellipse/ContainsRect.js index 9c114891b..ee714d48a 100644 --- a/src/geom/ellipse/ContainsRect.js +++ b/src/geom/ellipse/ContainsRect.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/CopyFrom.js b/src/geom/ellipse/CopyFrom.js index f300a93d1..c02673b48 100644 --- a/src/geom/ellipse/CopyFrom.js +++ b/src/geom/ellipse/CopyFrom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Ellipse.js b/src/geom/ellipse/Ellipse.js index 558fd53d4..21461223c 100644 --- a/src/geom/ellipse/Ellipse.js +++ b/src/geom/ellipse/Ellipse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Equals.js b/src/geom/ellipse/Equals.js index 3b41c599f..b1342e4e4 100644 --- a/src/geom/ellipse/Equals.js +++ b/src/geom/ellipse/Equals.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/GetBounds.js b/src/geom/ellipse/GetBounds.js index c6ae3b10b..a849860a1 100644 --- a/src/geom/ellipse/GetBounds.js +++ b/src/geom/ellipse/GetBounds.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/GetPoint.js b/src/geom/ellipse/GetPoint.js index e840f1a45..19310cc7d 100644 --- a/src/geom/ellipse/GetPoint.js +++ b/src/geom/ellipse/GetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/GetPoints.js b/src/geom/ellipse/GetPoints.js index f88055639..0b9fa6f6d 100644 --- a/src/geom/ellipse/GetPoints.js +++ b/src/geom/ellipse/GetPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Offset.js b/src/geom/ellipse/Offset.js index 8ad86aa8a..49ae26de5 100644 --- a/src/geom/ellipse/Offset.js +++ b/src/geom/ellipse/Offset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/OffsetPoint.js b/src/geom/ellipse/OffsetPoint.js index ea04efd58..31cde0958 100644 --- a/src/geom/ellipse/OffsetPoint.js +++ b/src/geom/ellipse/OffsetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/Random.js b/src/geom/ellipse/Random.js index 01f069a20..a85b2d5ac 100644 --- a/src/geom/ellipse/Random.js +++ b/src/geom/ellipse/Random.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/ellipse/index.js b/src/geom/ellipse/index.js index c563f94a3..fbd3459f1 100644 --- a/src/geom/ellipse/index.js +++ b/src/geom/ellipse/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/index.js b/src/geom/index.js index 2f0bdc8b6..3397c1205 100644 --- a/src/geom/index.js +++ b/src/geom/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/CircleToCircle.js b/src/geom/intersects/CircleToCircle.js index 50490db71..2a0efcf2a 100644 --- a/src/geom/intersects/CircleToCircle.js +++ b/src/geom/intersects/CircleToCircle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/CircleToRectangle.js b/src/geom/intersects/CircleToRectangle.js index bc734ab57..2221cffe9 100644 --- a/src/geom/intersects/CircleToRectangle.js +++ b/src/geom/intersects/CircleToRectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/GetRectangleIntersection.js b/src/geom/intersects/GetRectangleIntersection.js index d4a001d45..3282acf85 100644 --- a/src/geom/intersects/GetRectangleIntersection.js +++ b/src/geom/intersects/GetRectangleIntersection.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/LineToCircle.js b/src/geom/intersects/LineToCircle.js index de0425ddd..61c896f80 100644 --- a/src/geom/intersects/LineToCircle.js +++ b/src/geom/intersects/LineToCircle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/LineToLine.js b/src/geom/intersects/LineToLine.js index 1b00b05ad..f615fc1e3 100644 --- a/src/geom/intersects/LineToLine.js +++ b/src/geom/intersects/LineToLine.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/LineToRectangle.js b/src/geom/intersects/LineToRectangle.js index f28b420e6..3197da67b 100644 --- a/src/geom/intersects/LineToRectangle.js +++ b/src/geom/intersects/LineToRectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/PointToLine.js b/src/geom/intersects/PointToLine.js index c29a6ed11..a9d678583 100644 --- a/src/geom/intersects/PointToLine.js +++ b/src/geom/intersects/PointToLine.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Florian Mertens - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/PointToLineSegment.js b/src/geom/intersects/PointToLineSegment.js index 70c5d1030..2a2b79866 100644 --- a/src/geom/intersects/PointToLineSegment.js +++ b/src/geom/intersects/PointToLineSegment.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/RectangleToRectangle.js b/src/geom/intersects/RectangleToRectangle.js index b9b0d5422..0c615f52b 100644 --- a/src/geom/intersects/RectangleToRectangle.js +++ b/src/geom/intersects/RectangleToRectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/RectangleToTriangle.js b/src/geom/intersects/RectangleToTriangle.js index 45833b43c..7c62ddfa9 100644 --- a/src/geom/intersects/RectangleToTriangle.js +++ b/src/geom/intersects/RectangleToTriangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/RectangleToValues.js b/src/geom/intersects/RectangleToValues.js index 75b592fb1..e71022ba9 100644 --- a/src/geom/intersects/RectangleToValues.js +++ b/src/geom/intersects/RectangleToValues.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/TriangleToCircle.js b/src/geom/intersects/TriangleToCircle.js index 76a811a54..0dbff8cce 100644 --- a/src/geom/intersects/TriangleToCircle.js +++ b/src/geom/intersects/TriangleToCircle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/TriangleToLine.js b/src/geom/intersects/TriangleToLine.js index e5c649bb0..657e2b06f 100644 --- a/src/geom/intersects/TriangleToLine.js +++ b/src/geom/intersects/TriangleToLine.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/TriangleToTriangle.js b/src/geom/intersects/TriangleToTriangle.js index f4846c475..58e744e3e 100644 --- a/src/geom/intersects/TriangleToTriangle.js +++ b/src/geom/intersects/TriangleToTriangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/intersects/index.js b/src/geom/intersects/index.js index bd938860d..a3622a9bf 100644 --- a/src/geom/intersects/index.js +++ b/src/geom/intersects/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Angle.js b/src/geom/line/Angle.js index 49d9697b8..3c4b58958 100644 --- a/src/geom/line/Angle.js +++ b/src/geom/line/Angle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/BresenhamPoints.js b/src/geom/line/BresenhamPoints.js index 9563d4aa6..7ee40c1a5 100644 --- a/src/geom/line/BresenhamPoints.js +++ b/src/geom/line/BresenhamPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/CenterOn.js b/src/geom/line/CenterOn.js index 0422f7d6a..a633ec725 100644 --- a/src/geom/line/CenterOn.js +++ b/src/geom/line/CenterOn.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Clone.js b/src/geom/line/Clone.js index c5417254d..92f015ae0 100644 --- a/src/geom/line/Clone.js +++ b/src/geom/line/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/CopyFrom.js b/src/geom/line/CopyFrom.js index bc505534d..124b1e0d8 100644 --- a/src/geom/line/CopyFrom.js +++ b/src/geom/line/CopyFrom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Equals.js b/src/geom/line/Equals.js index bde547f03..f4b6725bc 100644 --- a/src/geom/line/Equals.js +++ b/src/geom/line/Equals.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Extend.js b/src/geom/line/Extend.js new file mode 100644 index 000000000..ad50a2383 --- /dev/null +++ b/src/geom/line/Extend.js @@ -0,0 +1,52 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Length = require('./Length'); + +/** + * Extends the start and end points of a Line by the given amounts. + * + * The amounts can be positive or negative. Positive points will increase the length of the line, + * while negative ones will decrease it. + * + * If no `right` value is provided it will extend the length of the line equally in both directions. + * + * Pass a value of zero to leave the start or end point unchanged. + * + * @function Phaser.Geom.Line.Extend + * @since 3.16.0 + * + * @param {Phaser.Geom.Line} line - The line instance to extend. + * @param {number} left - The amount to extend the start of the line by. + * @param {number} [right] - The amount to extend the end of the line by. If not given it will be set to the `left` value. + * + * @return {Phaser.Geom.Line} The modified Line instance. + */ +var Extend = function (line, left, right) +{ + if (right === undefined) { right = left; } + + var length = Length(line); + + var slopX = line.x2 - line.x1; + var slopY = line.y2 - line.y1; + + if (left) + { + line.x1 = line.x1 - slopX / length * left; + line.y1 = line.y1 - slopY / length * left; + } + + if (right) + { + line.x2 = line.x2 + slopX / length * right; + line.y2 = line.y2 + slopY / length * right; + } + + return line; +}; + +module.exports = Extend; diff --git a/src/geom/line/GetMidPoint.js b/src/geom/line/GetMidPoint.js index 0cd3d91c8..70bd8c4bb 100644 --- a/src/geom/line/GetMidPoint.js +++ b/src/geom/line/GetMidPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/GetNearestPoint.js b/src/geom/line/GetNearestPoint.js index a42c48048..9074bfa05 100644 --- a/src/geom/line/GetNearestPoint.js +++ b/src/geom/line/GetNearestPoint.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Florian Mertens - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/GetNormal.js b/src/geom/line/GetNormal.js index a82513f43..24ebaaf40 100644 --- a/src/geom/line/GetNormal.js +++ b/src/geom/line/GetNormal.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/GetPoint.js b/src/geom/line/GetPoint.js index 2269a05d6..4226208b7 100644 --- a/src/geom/line/GetPoint.js +++ b/src/geom/line/GetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/GetPoints.js b/src/geom/line/GetPoints.js index 153a82d58..516a300f5 100644 --- a/src/geom/line/GetPoints.js +++ b/src/geom/line/GetPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/GetShortestDistance.js b/src/geom/line/GetShortestDistance.js index 74b9c2adf..2ee6e8892 100644 --- a/src/geom/line/GetShortestDistance.js +++ b/src/geom/line/GetShortestDistance.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Florian Mertens - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Height.js b/src/geom/line/Height.js index a594cc34c..f2c93be87 100644 --- a/src/geom/line/Height.js +++ b/src/geom/line/Height.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Length.js b/src/geom/line/Length.js index 9906c464d..bfd1f7edb 100644 --- a/src/geom/line/Length.js +++ b/src/geom/line/Length.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Line.js b/src/geom/line/Line.js index 16d20635d..3d9e4222d 100644 --- a/src/geom/line/Line.js +++ b/src/geom/line/Line.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/NormalAngle.js b/src/geom/line/NormalAngle.js index ac1b7644e..f8f138a55 100644 --- a/src/geom/line/NormalAngle.js +++ b/src/geom/line/NormalAngle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/NormalX.js b/src/geom/line/NormalX.js index 58d97dc04..aa73d3492 100644 --- a/src/geom/line/NormalX.js +++ b/src/geom/line/NormalX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/NormalY.js b/src/geom/line/NormalY.js index ae7960ce5..8b7c0c26d 100644 --- a/src/geom/line/NormalY.js +++ b/src/geom/line/NormalY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Offset.js b/src/geom/line/Offset.js index 47570898c..5b73d01e9 100644 --- a/src/geom/line/Offset.js +++ b/src/geom/line/Offset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/PerpSlope.js b/src/geom/line/PerpSlope.js index f37bac9b7..f9463a7e1 100644 --- a/src/geom/line/PerpSlope.js +++ b/src/geom/line/PerpSlope.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Random.js b/src/geom/line/Random.js index 8fc8af9d2..4c7190c6f 100644 --- a/src/geom/line/Random.js +++ b/src/geom/line/Random.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/ReflectAngle.js b/src/geom/line/ReflectAngle.js index 67016d76b..a165dd88c 100644 --- a/src/geom/line/ReflectAngle.js +++ b/src/geom/line/ReflectAngle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Rotate.js b/src/geom/line/Rotate.js index f32275b52..9afddf9f8 100644 --- a/src/geom/line/Rotate.js +++ b/src/geom/line/Rotate.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/RotateAroundPoint.js b/src/geom/line/RotateAroundPoint.js index 5f61e2d78..65807fab5 100644 --- a/src/geom/line/RotateAroundPoint.js +++ b/src/geom/line/RotateAroundPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/RotateAroundXY.js b/src/geom/line/RotateAroundXY.js index eda890dd5..1c5997ac5 100644 --- a/src/geom/line/RotateAroundXY.js +++ b/src/geom/line/RotateAroundXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/SetToAngle.js b/src/geom/line/SetToAngle.js index c8ecef76e..010372576 100644 --- a/src/geom/line/SetToAngle.js +++ b/src/geom/line/SetToAngle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Slope.js b/src/geom/line/Slope.js index fd7ff63c9..b79247824 100644 --- a/src/geom/line/Slope.js +++ b/src/geom/line/Slope.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/Width.js b/src/geom/line/Width.js index b2fee05cb..b8d84c6ce 100644 --- a/src/geom/line/Width.js +++ b/src/geom/line/Width.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/line/index.js b/src/geom/line/index.js index 9097da263..9d6d2551f 100644 --- a/src/geom/line/index.js +++ b/src/geom/line/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ Line.CenterOn = require('./CenterOn'); Line.Clone = require('./Clone'); Line.CopyFrom = require('./CopyFrom'); Line.Equals = require('./Equals'); +Line.Extend = require('./Extend'); Line.GetMidPoint = require('./GetMidPoint'); Line.GetNearestPoint = require('./GetNearestPoint'); Line.GetNormal = require('./GetNormal'); diff --git a/src/geom/point/Ceil.js b/src/geom/point/Ceil.js index ee4cd185e..874842561 100644 --- a/src/geom/point/Ceil.js +++ b/src/geom/point/Ceil.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Clone.js b/src/geom/point/Clone.js index a437b9a35..7c10693e4 100644 --- a/src/geom/point/Clone.js +++ b/src/geom/point/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/CopyFrom.js b/src/geom/point/CopyFrom.js index 0caa36d18..67c755ae5 100644 --- a/src/geom/point/CopyFrom.js +++ b/src/geom/point/CopyFrom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Equals.js b/src/geom/point/Equals.js index 31fc7a568..671c48273 100644 --- a/src/geom/point/Equals.js +++ b/src/geom/point/Equals.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Floor.js b/src/geom/point/Floor.js index 7b8c62602..eba47218b 100644 --- a/src/geom/point/Floor.js +++ b/src/geom/point/Floor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/GetCentroid.js b/src/geom/point/GetCentroid.js index 6c7c3e1eb..000110600 100644 --- a/src/geom/point/GetCentroid.js +++ b/src/geom/point/GetCentroid.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/GetMagnitude.js b/src/geom/point/GetMagnitude.js index 56f84d7a2..6668abab2 100644 --- a/src/geom/point/GetMagnitude.js +++ b/src/geom/point/GetMagnitude.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/GetMagnitudeSq.js b/src/geom/point/GetMagnitudeSq.js index 7e8997f70..0c6e8657a 100644 --- a/src/geom/point/GetMagnitudeSq.js +++ b/src/geom/point/GetMagnitudeSq.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/GetRectangleFromPoints.js b/src/geom/point/GetRectangleFromPoints.js index 0ee9a5a67..6ea58f79c 100644 --- a/src/geom/point/GetRectangleFromPoints.js +++ b/src/geom/point/GetRectangleFromPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Interpolate.js b/src/geom/point/Interpolate.js index f474cc3c2..042fce543 100644 --- a/src/geom/point/Interpolate.js +++ b/src/geom/point/Interpolate.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Invert.js b/src/geom/point/Invert.js index 92fb3ac36..788cfdfe3 100644 --- a/src/geom/point/Invert.js +++ b/src/geom/point/Invert.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Negative.js b/src/geom/point/Negative.js index 8790b179d..adcc02cca 100644 --- a/src/geom/point/Negative.js +++ b/src/geom/point/Negative.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Point.js b/src/geom/point/Point.js index db6a4e289..cc0bc5abc 100644 --- a/src/geom/point/Point.js +++ b/src/geom/point/Point.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/Project.js b/src/geom/point/Project.js index 24d59c522..c284e9a51 100644 --- a/src/geom/point/Project.js +++ b/src/geom/point/Project.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/ProjectUnit.js b/src/geom/point/ProjectUnit.js index e2a00c65a..0d5c86592 100644 --- a/src/geom/point/ProjectUnit.js +++ b/src/geom/point/ProjectUnit.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/SetMagnitude.js b/src/geom/point/SetMagnitude.js index 8b0332536..f535e0a3f 100644 --- a/src/geom/point/SetMagnitude.js +++ b/src/geom/point/SetMagnitude.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/point/index.js b/src/geom/point/index.js index 8a0a572c3..5bb99cc2e 100644 --- a/src/geom/point/index.js +++ b/src/geom/point/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Clone.js b/src/geom/polygon/Clone.js index 4519c5d23..1c1110a4d 100644 --- a/src/geom/polygon/Clone.js +++ b/src/geom/polygon/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Contains.js b/src/geom/polygon/Contains.js index d8bf485ee..8c910577b 100644 --- a/src/geom/polygon/Contains.js +++ b/src/geom/polygon/Contains.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/ContainsPoint.js b/src/geom/polygon/ContainsPoint.js index 4952a442e..7f7f515f0 100644 --- a/src/geom/polygon/ContainsPoint.js +++ b/src/geom/polygon/ContainsPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Earcut.js b/src/geom/polygon/Earcut.js index 9a190b56c..51f37b64a 100644 --- a/src/geom/polygon/Earcut.js +++ b/src/geom/polygon/Earcut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/GetAABB.js b/src/geom/polygon/GetAABB.js index 9a00558c3..89f718c70 100644 --- a/src/geom/polygon/GetAABB.js +++ b/src/geom/polygon/GetAABB.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/GetNumberArray.js b/src/geom/polygon/GetNumberArray.js index 939894fe8..383369bc6 100644 --- a/src/geom/polygon/GetNumberArray.js +++ b/src/geom/polygon/GetNumberArray.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/GetPoints.js b/src/geom/polygon/GetPoints.js index b085de8bb..d13a01eec 100644 --- a/src/geom/polygon/GetPoints.js +++ b/src/geom/polygon/GetPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Perimeter.js b/src/geom/polygon/Perimeter.js index b72faf4b8..306feec7b 100644 --- a/src/geom/polygon/Perimeter.js +++ b/src/geom/polygon/Perimeter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Polygon.js b/src/geom/polygon/Polygon.js index 48a59072a..dcfea214e 100644 --- a/src/geom/polygon/Polygon.js +++ b/src/geom/polygon/Polygon.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Reverse.js b/src/geom/polygon/Reverse.js index 8cbee3ba5..80966f7bb 100644 --- a/src/geom/polygon/Reverse.js +++ b/src/geom/polygon/Reverse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/polygon/Smooth.js b/src/geom/polygon/Smooth.js index 3577b1135..c9920d8b8 100644 --- a/src/geom/polygon/Smooth.js +++ b/src/geom/polygon/Smooth.js @@ -1,10 +1,13 @@ /** * @author Richard Davey * @author Igor Ognichenko - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @ignore + */ var copy = function (out, a) { out[0] = a[0]; diff --git a/src/geom/polygon/index.js b/src/geom/polygon/index.js index 09d0901ee..14899654c 100644 --- a/src/geom/polygon/index.js +++ b/src/geom/polygon/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Area.js b/src/geom/rectangle/Area.js index e90f8d7a1..405c5479d 100644 --- a/src/geom/rectangle/Area.js +++ b/src/geom/rectangle/Area.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Ceil.js b/src/geom/rectangle/Ceil.js index 024a6df57..b088d3c73 100644 --- a/src/geom/rectangle/Ceil.js +++ b/src/geom/rectangle/Ceil.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/CeilAll.js b/src/geom/rectangle/CeilAll.js index 2da4ec7ce..7a07e7b35 100644 --- a/src/geom/rectangle/CeilAll.js +++ b/src/geom/rectangle/CeilAll.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/CenterOn.js b/src/geom/rectangle/CenterOn.js index 77f6993ec..2784ab6cd 100644 --- a/src/geom/rectangle/CenterOn.js +++ b/src/geom/rectangle/CenterOn.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Clone.js b/src/geom/rectangle/Clone.js index 3b849e3b8..03c42ad58 100644 --- a/src/geom/rectangle/Clone.js +++ b/src/geom/rectangle/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Contains.js b/src/geom/rectangle/Contains.js index ec91694a1..d74ac79b2 100644 --- a/src/geom/rectangle/Contains.js +++ b/src/geom/rectangle/Contains.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/ContainsPoint.js b/src/geom/rectangle/ContainsPoint.js index b67d57804..8de1d9026 100644 --- a/src/geom/rectangle/ContainsPoint.js +++ b/src/geom/rectangle/ContainsPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/ContainsRect.js b/src/geom/rectangle/ContainsRect.js index 3733890bd..ccb13e93b 100644 --- a/src/geom/rectangle/ContainsRect.js +++ b/src/geom/rectangle/ContainsRect.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/CopyFrom.js b/src/geom/rectangle/CopyFrom.js index 6d8fc320a..1a815de2c 100644 --- a/src/geom/rectangle/CopyFrom.js +++ b/src/geom/rectangle/CopyFrom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Decompose.js b/src/geom/rectangle/Decompose.js index 3e819290a..91e35fdc7 100644 --- a/src/geom/rectangle/Decompose.js +++ b/src/geom/rectangle/Decompose.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Equals.js b/src/geom/rectangle/Equals.js index 51f7957ef..1f0c55a03 100644 --- a/src/geom/rectangle/Equals.js +++ b/src/geom/rectangle/Equals.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/FitInside.js b/src/geom/rectangle/FitInside.js index 4064fa6b0..3fd9270a9 100644 --- a/src/geom/rectangle/FitInside.js +++ b/src/geom/rectangle/FitInside.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/FitOutside.js b/src/geom/rectangle/FitOutside.js index be7941bef..d0f87ad4c 100644 --- a/src/geom/rectangle/FitOutside.js +++ b/src/geom/rectangle/FitOutside.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Floor.js b/src/geom/rectangle/Floor.js index 24bfa9a39..a4d09c192 100644 --- a/src/geom/rectangle/Floor.js +++ b/src/geom/rectangle/Floor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/FloorAll.js b/src/geom/rectangle/FloorAll.js index 0083257ac..cfde0c3bb 100644 --- a/src/geom/rectangle/FloorAll.js +++ b/src/geom/rectangle/FloorAll.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/FromPoints.js b/src/geom/rectangle/FromPoints.js index c7312d5c8..395360946 100644 --- a/src/geom/rectangle/FromPoints.js +++ b/src/geom/rectangle/FromPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/GetAspectRatio.js b/src/geom/rectangle/GetAspectRatio.js index 96050b7ba..7761b3cda 100644 --- a/src/geom/rectangle/GetAspectRatio.js +++ b/src/geom/rectangle/GetAspectRatio.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/GetCenter.js b/src/geom/rectangle/GetCenter.js index e0d425fdc..26426b9b2 100644 --- a/src/geom/rectangle/GetCenter.js +++ b/src/geom/rectangle/GetCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/GetPoint.js b/src/geom/rectangle/GetPoint.js index c02b57f6c..d02f87201 100644 --- a/src/geom/rectangle/GetPoint.js +++ b/src/geom/rectangle/GetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/GetPoints.js b/src/geom/rectangle/GetPoints.js index a4b4c63f1..1bd981c2a 100644 --- a/src/geom/rectangle/GetPoints.js +++ b/src/geom/rectangle/GetPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/GetSize.js b/src/geom/rectangle/GetSize.js index 331dc1aaf..c7cb2b0a4 100644 --- a/src/geom/rectangle/GetSize.js +++ b/src/geom/rectangle/GetSize.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Inflate.js b/src/geom/rectangle/Inflate.js index 13ad813ae..db1373b56 100644 --- a/src/geom/rectangle/Inflate.js +++ b/src/geom/rectangle/Inflate.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Intersection.js b/src/geom/rectangle/Intersection.js index f39bdd48b..27095074a 100644 --- a/src/geom/rectangle/Intersection.js +++ b/src/geom/rectangle/Intersection.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/MarchingAnts.js b/src/geom/rectangle/MarchingAnts.js index 1cae2dc5f..e111d6c1b 100644 --- a/src/geom/rectangle/MarchingAnts.js +++ b/src/geom/rectangle/MarchingAnts.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/MergePoints.js b/src/geom/rectangle/MergePoints.js index d9eb01650..96a4ba8b0 100644 --- a/src/geom/rectangle/MergePoints.js +++ b/src/geom/rectangle/MergePoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/MergeRect.js b/src/geom/rectangle/MergeRect.js index 6b45e6d60..89f37e3a9 100644 --- a/src/geom/rectangle/MergeRect.js +++ b/src/geom/rectangle/MergeRect.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/MergeXY.js b/src/geom/rectangle/MergeXY.js index d8fbecbcc..c5c040371 100644 --- a/src/geom/rectangle/MergeXY.js +++ b/src/geom/rectangle/MergeXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Offset.js b/src/geom/rectangle/Offset.js index 452527db4..a25f9546a 100644 --- a/src/geom/rectangle/Offset.js +++ b/src/geom/rectangle/Offset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/OffsetPoint.js b/src/geom/rectangle/OffsetPoint.js index 09862a794..6b05925a3 100644 --- a/src/geom/rectangle/OffsetPoint.js +++ b/src/geom/rectangle/OffsetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Overlaps.js b/src/geom/rectangle/Overlaps.js index cae6a6eaa..ee92eb75c 100644 --- a/src/geom/rectangle/Overlaps.js +++ b/src/geom/rectangle/Overlaps.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Perimeter.js b/src/geom/rectangle/Perimeter.js index 859ad0ef1..3e9a2de09 100644 --- a/src/geom/rectangle/Perimeter.js +++ b/src/geom/rectangle/Perimeter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/PerimeterPoint.js b/src/geom/rectangle/PerimeterPoint.js index 5f7f85026..8531a8d14 100644 --- a/src/geom/rectangle/PerimeterPoint.js +++ b/src/geom/rectangle/PerimeterPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Random.js b/src/geom/rectangle/Random.js index 248a69dc5..c32146572 100644 --- a/src/geom/rectangle/Random.js +++ b/src/geom/rectangle/Random.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/RandomOutside.js b/src/geom/rectangle/RandomOutside.js index 841bd61bb..045343c1c 100644 --- a/src/geom/rectangle/RandomOutside.js +++ b/src/geom/rectangle/RandomOutside.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Rectangle.js b/src/geom/rectangle/Rectangle.js index 86caaf565..f84befb85 100644 --- a/src/geom/rectangle/Rectangle.js +++ b/src/geom/rectangle/Rectangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/SameDimensions.js b/src/geom/rectangle/SameDimensions.js index 98b7a0f06..750ff0b05 100644 --- a/src/geom/rectangle/SameDimensions.js +++ b/src/geom/rectangle/SameDimensions.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Scale.js b/src/geom/rectangle/Scale.js index 69dfd007c..98f54ab59 100644 --- a/src/geom/rectangle/Scale.js +++ b/src/geom/rectangle/Scale.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/Union.js b/src/geom/rectangle/Union.js index a082e1963..2535fbab7 100644 --- a/src/geom/rectangle/Union.js +++ b/src/geom/rectangle/Union.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/rectangle/index.js b/src/geom/rectangle/index.js index 93b7db954..e5a0e1907 100644 --- a/src/geom/rectangle/index.js +++ b/src/geom/rectangle/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Area.js b/src/geom/triangle/Area.js index 83c255fdd..635aa9a01 100644 --- a/src/geom/triangle/Area.js +++ b/src/geom/triangle/Area.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/BuildEquilateral.js b/src/geom/triangle/BuildEquilateral.js index d869452ef..67a297626 100644 --- a/src/geom/triangle/BuildEquilateral.js +++ b/src/geom/triangle/BuildEquilateral.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/BuildFromPolygon.js b/src/geom/triangle/BuildFromPolygon.js index 60b10cfa5..ad82dc430 100644 --- a/src/geom/triangle/BuildFromPolygon.js +++ b/src/geom/triangle/BuildFromPolygon.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/BuildRight.js b/src/geom/triangle/BuildRight.js index 6a0beaec2..d3178e25a 100644 --- a/src/geom/triangle/BuildRight.js +++ b/src/geom/triangle/BuildRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/CenterOn.js b/src/geom/triangle/CenterOn.js index 0337ef4e0..23a0a6780 100644 --- a/src/geom/triangle/CenterOn.js +++ b/src/geom/triangle/CenterOn.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Centroid.js b/src/geom/triangle/Centroid.js index 14378be58..b3a6e7061 100644 --- a/src/geom/triangle/Centroid.js +++ b/src/geom/triangle/Centroid.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/CircumCenter.js b/src/geom/triangle/CircumCenter.js index c1a69e70e..740030bd8 100644 --- a/src/geom/triangle/CircumCenter.js +++ b/src/geom/triangle/CircumCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/CircumCircle.js b/src/geom/triangle/CircumCircle.js index ce7e8e28d..19590dcea 100644 --- a/src/geom/triangle/CircumCircle.js +++ b/src/geom/triangle/CircumCircle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Clone.js b/src/geom/triangle/Clone.js index cb2489f27..b305e3720 100644 --- a/src/geom/triangle/Clone.js +++ b/src/geom/triangle/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Contains.js b/src/geom/triangle/Contains.js index 529863ccf..e1ef648db 100644 --- a/src/geom/triangle/Contains.js +++ b/src/geom/triangle/Contains.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/ContainsArray.js b/src/geom/triangle/ContainsArray.js index 54b7de23a..e3a72154a 100644 --- a/src/geom/triangle/ContainsArray.js +++ b/src/geom/triangle/ContainsArray.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/ContainsPoint.js b/src/geom/triangle/ContainsPoint.js index d01f366ff..426a1c93c 100644 --- a/src/geom/triangle/ContainsPoint.js +++ b/src/geom/triangle/ContainsPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/CopyFrom.js b/src/geom/triangle/CopyFrom.js index 06e6f46a6..d247210d4 100644 --- a/src/geom/triangle/CopyFrom.js +++ b/src/geom/triangle/CopyFrom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Decompose.js b/src/geom/triangle/Decompose.js index 45e7dcc1b..26ed1d49a 100644 --- a/src/geom/triangle/Decompose.js +++ b/src/geom/triangle/Decompose.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Equals.js b/src/geom/triangle/Equals.js index 1e90b0d2a..c3f1e1eda 100644 --- a/src/geom/triangle/Equals.js +++ b/src/geom/triangle/Equals.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/GetPoint.js b/src/geom/triangle/GetPoint.js index bebb585cb..3e31f0395 100644 --- a/src/geom/triangle/GetPoint.js +++ b/src/geom/triangle/GetPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/GetPoints.js b/src/geom/triangle/GetPoints.js index 1cca3f016..d24627bb6 100644 --- a/src/geom/triangle/GetPoints.js +++ b/src/geom/triangle/GetPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/InCenter.js b/src/geom/triangle/InCenter.js index 9032d7db2..92e83b1f4 100644 --- a/src/geom/triangle/InCenter.js +++ b/src/geom/triangle/InCenter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Offset.js b/src/geom/triangle/Offset.js index 59a2b1a2a..81fb77a17 100644 --- a/src/geom/triangle/Offset.js +++ b/src/geom/triangle/Offset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Perimeter.js b/src/geom/triangle/Perimeter.js index 1464b024c..42fd800d1 100644 --- a/src/geom/triangle/Perimeter.js +++ b/src/geom/triangle/Perimeter.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Random.js b/src/geom/triangle/Random.js index 77293c234..ef109ed3f 100644 --- a/src/geom/triangle/Random.js +++ b/src/geom/triangle/Random.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Rotate.js b/src/geom/triangle/Rotate.js index ce346325b..134db82aa 100644 --- a/src/geom/triangle/Rotate.js +++ b/src/geom/triangle/Rotate.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/RotateAroundPoint.js b/src/geom/triangle/RotateAroundPoint.js index 2ce76f027..cd6ee9216 100644 --- a/src/geom/triangle/RotateAroundPoint.js +++ b/src/geom/triangle/RotateAroundPoint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/RotateAroundXY.js b/src/geom/triangle/RotateAroundXY.js index 1a82350c4..c0faca7e1 100644 --- a/src/geom/triangle/RotateAroundXY.js +++ b/src/geom/triangle/RotateAroundXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/Triangle.js b/src/geom/triangle/Triangle.js index e7127e361..4de62290c 100644 --- a/src/geom/triangle/Triangle.js +++ b/src/geom/triangle/Triangle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/geom/triangle/index.js b/src/geom/triangle/index.js index a305f7cd9..d16240b55 100644 --- a/src/geom/triangle/index.js +++ b/src/geom/triangle/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/CreateInteractiveObject.js b/src/input/CreateInteractiveObject.js index a8ef0f61a..10dcfde48 100644 --- a/src/input/CreateInteractiveObject.js +++ b/src/input/CreateInteractiveObject.js @@ -1,41 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @callback HitAreaCallback - * - * @param {any} hitArea - The hit area object. - * @param {number} x - The translated x coordinate of the hit test event. - * @param {number} y - The translated y coordinate of the hit test event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that invoked the hit test. - * - * @return {boolean} `true` if the coordinates fall within the space of the hitArea, otherwise `false`. - */ - -/** - * @typedef {object} Phaser.Input.InteractiveObject - * - * @property {Phaser.GameObjects.GameObject} gameObject - The Game Object to which this Interactive Object is bound. - * @property {boolean} enabled - Is this Interactive Object currently enabled for input events? - * @property {boolean} draggable - Is this Interactive Object draggable? Enable with `InputPlugin.setDraggable`. - * @property {boolean} dropZone - Is this Interactive Object a drag-targets drop zone? Set when the object is created. - * @property {(boolean|string)} cursor - Should this Interactive Object change the cursor (via css) when over? (desktop only) - * @property {?Phaser.GameObjects.GameObject} target - An optional drop target for a draggable Interactive Object. - * @property {Phaser.Cameras.Scene2D.Camera} camera - The most recent Camera to be tested against this Interactive Object. - * @property {any} hitArea - The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle. - * @property {HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests. - * @property {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @property {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @property {(0|1|2)} dragState - The current drag state of this Interactive Object. 0 = Not being dragged, 1 = being checked for drag, or 2 = being actively dragged. - * @property {number} dragStartX - The x coordinate that the Pointer started dragging this Interactive Object from. - * @property {number} dragStartY - The y coordinate that the Pointer started dragging this Interactive Object from. - * @property {number} dragX - The x coordinate that this Interactive Object is currently being dragged to. - * @property {number} dragY - The y coordinate that this Interactive Object is currently being dragged to. - */ - /** * Creates a new Interactive Object. * @@ -48,9 +16,9 @@ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to which this Interactive Object is bound. * @param {any} hitArea - The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle. - * @param {HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests. + * @param {Phaser.Input.Types.HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests. * - * @return {Phaser.Input.InteractiveObject} The new Interactive Object. + * @return {Phaser.Input.Types.InteractiveObject} The new Interactive Object. */ var CreateInteractiveObject = function (gameObject, hitArea, hitAreaCallback) { diff --git a/src/input/CreatePixelPerfectHandler.js b/src/input/CreatePixelPerfectHandler.js index 983727510..7d7d7eedb 100644 --- a/src/input/CreatePixelPerfectHandler.js +++ b/src/input/CreatePixelPerfectHandler.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/InputManager.js b/src/input/InputManager.js index f968fe9df..32b44c6fb 100644 --- a/src/input/InputManager.js +++ b/src/input/InputManager.js @@ -1,16 +1,17 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var CONST = require('./const'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); +var GameEvents = require('../core/events'); var Keyboard = require('./keyboard/KeyboardManager'); var Mouse = require('./mouse/MouseManager'); var Pointer = require('./Pointer'); -var Rectangle = require('../geom/rectangle/Rectangle'); var Touch = require('./touch/TouchManager'); var TransformMatrix = require('../gameobjects/components/TransformMatrix'); var TransformXY = require('../math/TransformXY'); @@ -54,6 +55,16 @@ var InputManager = new Class({ */ this.game = game; + /** + * A reference to the global Game Scale Manager. + * Used for all bounds checks and pointer scaling. + * + * @name Phaser.Input.InputManager#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scaleManager; + /** * The Canvas that is used for all DOM event input listeners. * @@ -67,7 +78,7 @@ var InputManager = new Class({ * The Game Configuration object, as set during the game boot. * * @name Phaser.Input.InputManager#config - * @type {Phaser.Boot.Config} + * @type {Phaser.Core.Config} * @since 3.0.0 */ this.config = config; @@ -97,6 +108,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#queue * @type {array} * @default [] + * @deprecated * @since 3.0.0 */ this.queue = []; @@ -107,6 +119,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#domCallbacks * @private * @type {object} + * @deprecated * @since 3.10.0 */ this.domCallbacks = { up: [], down: [], move: [], upOnce: [], downOnce: [], moveOnce: [] }; @@ -122,22 +135,13 @@ var InputManager = new Class({ */ this.isOver = true; - /** - * isOver state change property. - * - * @name Phaser.Input.InputManager#_emitIsOverEvent - * @type {boolean} - * @private - * @since 3.16.0 - */ - this._emitIsOverEvent = false; - /** * Are there any up callbacks defined? * * @name Phaser.Input.InputManager#_hasUpCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasUpCallback = false; @@ -148,6 +152,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasDownCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasDownCallback = false; @@ -158,6 +163,7 @@ var InputManager = new Class({ * @name Phaser.Input.InputManager#_hasMoveCallback * @private * @type {boolean} + * @deprecated * @since 3.10.0 */ this._hasMoveCallback = false; @@ -298,15 +304,6 @@ var InputManager = new Class({ */ this.dirty = false; - /** - * The Scale factor being applied to input coordinates. - * - * @name Phaser.Input.InputManager#scale - * @type { { x:number, y:number } } - * @since 3.0.0 - */ - this.scale = { x: 1, y: 1 }; - /** * If the top-most Scene in the Scene List receives an input it will stop input from * propagating any lower down the scene list, i.e. if you have a UI Scene at the top @@ -332,19 +329,49 @@ var InputManager = new Class({ this.ignoreEvents = false; /** - * The bounds of the Input Manager, used for pointer hit test calculations. + * Use the internal event queue or not? + * + * Set this via the Game Config with the `inputQueue` property. + * + * Phaser 3.15.1 and earlier used a event queue by default. + * + * This was changed in version 3.16 to use an immediate-mode system. + * The previous queue based version remains and is left under this flag for backwards + * compatibility. This flag, along with the legacy system, will be removed in a future version. * - * @name Phaser.Input.InputManager#bounds - * @type {Phaser.Geom.Rectangle} - * @since 3.0.0 + * @name Phaser.Input.InputManager#useQueue + * @type {boolean} + * @default false + * @since 3.16.0 */ - this.bounds = new Rectangle(); + this.useQueue = config.inputQueue; + + /** + * The time this Input Manager was last updated. + * This value is populated by the Game Step each frame. + * + * @name Phaser.Input.InputManager#time + * @type {number} + * @readonly + * @since 3.16.2 + */ + this.time = 0; + + /** + * Internal property that tracks frame event state. + * + * @name Phaser.Input.InputManager#_updatedThisFrame + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._updatedThisFrame = false; /** * A re-cycled point-like object to store hit test values in. * * @name Phaser.Input.InputManager#_tempPoint - * @type {{x:number,y:number}} + * @type {{x:number, y:number}} * @private * @since 3.0.0 */ @@ -381,7 +408,7 @@ var InputManager = new Class({ */ this._tempMatrix2 = new TransformMatrix(); - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -390,111 +417,131 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#boot * @protected + * @fires Phaser.Input.Events#MANAGER_BOOT * @since 3.0.0 */ boot: function () { this.canvas = this.game.canvas; - this.updateBounds(); + this.scaleManager = this.game.scale; - this.events.emit('boot'); + this.events.emit(Events.MANAGER_BOOT); - this.game.events.on('prestep', this.update, this); - this.game.events.on('poststep', this.postUpdate, this); - this.game.events.once('destroy', this.destroy, this); - }, + if (this.useQueue) + { + this.game.events.on(GameEvents.PRE_STEP, this.legacyUpdate, this); + } + else + { + this.game.events.on(GameEvents.PRE_STEP, this.preStep, this); + } - /** - * Updates the Input Manager bounds rectangle to match the bounding client rectangle of the - * canvas element being used to track input events. - * - * @method Phaser.Input.InputManager#updateBounds - * @since 3.0.0 - */ - updateBounds: function () - { - var bounds = this.bounds; + this.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); - 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; - }, - - /** - * Resizes the Input Manager internal values, including the bounds and scale factor. - * - * @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; + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** * Internal canvas state change, called automatically by the Mouse Manager. * * @method Phaser.Input.InputManager#setCanvasOver + * @fires Phaser.Input.Events#GAME_OVER * @private * @since 3.16.0 * - * @param {number} event - The DOM Event. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ setCanvasOver: function (event) { this.isOver = true; - this._emitIsOverEvent = event; + this.events.emit(Events.GAME_OVER, event); }, /** * Internal canvas state change, called automatically by the Mouse Manager. * * @method Phaser.Input.InputManager#setCanvasOut + * @fires Phaser.Input.Events#GAME_OUT * @private * @since 3.16.0 * - * @param {number} event - The DOM Event. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ setCanvasOut: function (event) { this.isOver = false; - this._emitIsOverEvent = event; + this.events.emit(Events.GAME_OUT, event); }, /** - * Internal update loop, called automatically by the Game Step. + * Internal update method, called automatically when a DOM input event is received. * * @method Phaser.Input.InputManager#update * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE * @since 3.0.0 * * @param {number} time - The time stamp value of this game step. */ update: function (time) { + if (!this._updatedThisFrame) + { + this._setCursor = 0; + + this._updatedThisFrame = true; + } + + this.events.emit(Events.MANAGER_UPDATE); + + this.ignoreEvents = false; + + this.dirty = true; + + var pointers = this.pointers; + + for (var i = 0; i < this.pointersTotal; i++) + { + pointers[i].reset(time); + } + }, + + /** + * Internal update, called automatically by the Game Step. + * + * @method Phaser.Input.InputManager#preStep + * @private + * @since 3.16.2 + * + * @param {number} time - The time stamp value of this game step. + */ + preStep: function (time) + { + this.time = time; + }, + + /** + * Internal update loop, called automatically by the Game Step when using the legacy event queue. + * + * @method Phaser.Input.InputManager#legacyUpdate + * @private + * @fires Phaser.Input.Events#MANAGER_UPDATE + * @since 3.16.0 + * + * @param {number} time - The time stamp value of this game step. + */ + legacyUpdate: function (time) + { + this.time = time; + var i; this._setCursor = 0; - this.events.emit('update'); + this.events.emit(Events.MANAGER_UPDATE); this.ignoreEvents = false; @@ -521,11 +568,6 @@ var InputManager = new Class({ this.dirty = true; - this.updateBounds(); - - this.scale.x = this.game.config.width / this.bounds.width; - this.scale.y = this.game.config.height / this.bounds.height; - // Clears the queue array, and also means we don't work on array data that could potentially // be modified during the processing phase var queue = this.queue.splice(0, len); @@ -568,7 +610,7 @@ var InputManager = new Class({ break; case CONST.POINTER_LOCK_CHANGE: - this.events.emit('pointerlockchange', event, this.mouse.locked); + this.events.emit(Events.POINTERLOCK_CHANGE, event, this.mouse.locked); break; } } @@ -597,8 +639,9 @@ var InputManager = new Class({ this.canvas.style.cursor = this.defaultCursor; } - // Reset the isOver event - this._emitIsOverEvent = null; + this.dirty = false; + + this._updatedThisFrame = false; }, /** @@ -647,7 +690,7 @@ var InputManager = new Class({ * @private * @since 3.10.0 * - * @param {Phaser.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. + * @param {Phaser.Input.Types.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ setCursor: function (interactiveObject) { @@ -667,7 +710,7 @@ var InputManager = new Class({ * @private * @since 3.10.0 * - * @param {Phaser.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. + * @param {Phaser.Input.Types.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ resetCursor: function (interactiveObject) { @@ -690,10 +733,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ startPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -706,11 +752,17 @@ var InputManager = new Class({ if (!pointer.active) { pointer.touchstart(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -722,10 +774,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ updatePointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -738,11 +793,17 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchmove(changedTouch, time); + this.activePointer = pointer; + + changed.push(pointer); + break; } } } + + return changed; }, // For touch end its a list of the touch points that have been removed from the surface @@ -758,10 +819,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ stopPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -774,10 +838,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -789,10 +858,13 @@ var InputManager = new Class({ * * @param {TouchEvent} event - The native DOM event to be processed. * @param {number} time - The time stamp value of this game step. + * + * @return {Phaser.Input.Pointer[]} An array containing all the Pointer instances that were modified by this event. */ cancelPointer: function (event, time) { var pointers = this.pointers; + var changed = []; for (var c = 0; c < event.changedTouches.length; c++) { @@ -805,10 +877,15 @@ var InputManager = new Class({ if (pointer.active && pointer.identifier === changedTouch.identifier) { pointer.touchend(changedTouch, time); + + changed.push(pointer); + break; } } } + + return changed; }, /** @@ -863,6 +940,7 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#processDomCallbacks * @private + * @deprecated * @since 3.10.0 * * @param {array} once - The isOnce callbacks to invoke. @@ -885,11 +963,35 @@ var InputManager = new Class({ every[i](event); } - once = []; - return (every.length > 0); }, + /** + * Internal method that gets a list of all the active Input Plugins in the game + * and updates each of them in turn, in reverse order (top to bottom), to allow + * for DOM top-level event handling simulation. + * + * @method Phaser.Input.InputManager#updateInputPlugins + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + updateInputPlugins: function (time, delta) + { + var scenes = this.game.scene.getScenes(true, true); + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene.sys.input) + { + scene.sys.input.update(time, delta); + } + } + }, + /** * Queues a touch start event, as passed in by the TouchManager. * Also dispatches any DOM callbacks for this event. @@ -902,13 +1004,31 @@ var InputManager = new Class({ */ queueTouchStart: function (event) { - this.queue.push(CONST.TOUCH_START, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_START, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.startPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -924,13 +1044,31 @@ var InputManager = new Class({ */ queueTouchMove: function (event) { - this.queue.push(CONST.TOUCH_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.updatePointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -946,13 +1084,31 @@ var InputManager = new Class({ */ queueTouchEnd: function (event) { - this.queue.push(CONST.TOUCH_END, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.TOUCH_END, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.stopPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -968,7 +1124,23 @@ var InputManager = new Class({ */ queueTouchCancel: function (event) { - this.queue.push(CONST.TOUCH_CANCEL, event); + if (this.useQueue) + { + this.queue.push(CONST.TOUCH_CANCEL, event); + } + else if (this.enabled) + { + this.update(event.timeStamp); + + var changed = this.cancelPointer(event, event.timeStamp); + + changed.forEach(function (pointer) + { + pointer.updateMotion(); + }); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); + } }, /** @@ -983,13 +1155,28 @@ var InputManager = new Class({ */ queueMouseDown: function (event) { - this.queue.push(CONST.MOUSE_DOWN, event); - - if (this._hasDownCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_DOWN, event); - this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + if (this._hasDownCallback) + { + var callbacks = this.domCallbacks; + + this._hasDownCallback = this.processDomCallbacks(callbacks.downOnce, callbacks.down, event); + + callbacks.downOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.down(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -1005,13 +1192,28 @@ var InputManager = new Class({ */ queueMouseMove: function (event) { - this.queue.push(CONST.MOUSE_MOVE, event); - - if (this._hasMoveCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_MOVE, event); - this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + if (this._hasMoveCallback) + { + var callbacks = this.domCallbacks; + + this._hasMoveCallback = this.processDomCallbacks(callbacks.moveOnce, callbacks.move, event); + + callbacks.moveOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.move(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, @@ -1027,17 +1229,36 @@ var InputManager = new Class({ */ queueMouseUp: function (event) { - this.queue.push(CONST.MOUSE_UP, event); - - if (this._hasUpCallback) + if (this.useQueue) { - var callbacks = this.domCallbacks; + this.queue.push(CONST.MOUSE_UP, event); - this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + if (this._hasUpCallback) + { + var callbacks = this.domCallbacks; + + this._hasUpCallback = this.processDomCallbacks(callbacks.upOnce, callbacks.up, event); + + callbacks.upOnce = []; + } + } + else if (this.enabled) + { + this.update(event.timeStamp); + + this.mousePointer.up(event, event.timeStamp); + + this.mousePointer.updateMotion(); + + this.updateInputPlugins(event.timeStamp, this.game.loop.delta); } }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -1060,6 +1281,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -1086,6 +1308,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -1108,6 +1334,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -1134,6 +1361,10 @@ var InputManager = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -1156,6 +1387,7 @@ var InputManager = new Class({ * solve. * * @method Phaser.Input.InputManager#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -1358,7 +1590,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#pointWithinInteractiveObject * @since 3.0.0 * - * @param {Phaser.Input.InteractiveObject} object - The Interactive Object to check against. + * @param {Phaser.Input.Types.InteractiveObject} object - The Interactive Object to check against. * @param {number} x - The translated x coordinate for the hit test. * @param {number} y - The translated y coordinate for the hit test. * @@ -1402,8 +1634,8 @@ var InputManager = new Class({ p1.y = p0.y; // Translate coordinates - var x = (pageX - this.bounds.left) * this.scale.x; - var y = (pageY - this.bounds.top) * this.scale.y; + var x = this.scaleManager.transformX(pageX); + var y = this.scaleManager.transformY(pageY); var a = pointer.smoothFactor; @@ -1421,88 +1653,6 @@ var InputManager = new Class({ } }, - /** - * Transforms the pageX value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformX - * @since 3.0.0 - * - * @param {number} pageX - The DOM pageX value. - * - * @return {number} The translated value. - */ - transformX: function (pageX) - { - return (pageX - this.bounds.left) * this.scale.x; - }, - - /** - * Transforms the pageY value into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformY - * @since 3.0.0 - * - * @param {number} pageY - The DOM pageY value. - * - * @return {number} The translated value. - */ - transformY: function (pageY) - { - return (pageY - this.bounds.top) * this.scale.y; - }, - - /** - * Returns the left offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetX - * @since 3.0.0 - * - * @return {number} The left bounds value. - */ - getOffsetX: function () - { - return this.bounds.left; - }, - - /** - * Returns the top offset of the Input bounds. - * - * @method Phaser.Input.InputManager#getOffsetY - * @since 3.0.0 - * - * @return {number} The top bounds value. - */ - getOffsetY: function () - { - return this.bounds.top; - }, - - /** - * Returns the horizontal Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleX - * @since 3.0.0 - * - * @return {number} The horizontal scale factor of the input. - */ - getScaleX: function () - { - return this.game.config.width / this.bounds.width; - }, - - /** - * Returns the vertical Input Scale value. - * - * @method Phaser.Input.InputManager#getScaleY - * @since 3.0.0 - * - * @return {number} The vertical scale factor of the input. - */ - getScaleY: function () - { - return this.game.config.height / this.bounds.height; - }, - /** * Destroys the Input Manager and all of its systems. * diff --git a/src/input/InputPlugin.js b/src/input/InputPlugin.js index 46c698604..9643443fa 100644 --- a/src/input/InputPlugin.js +++ b/src/input/InputPlugin.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ var CreatePixelPerfectHandler = require('./CreatePixelPerfectHandler'); var DistanceBetween = require('../math/distance/DistanceBetween'); var Ellipse = require('../geom/ellipse/Ellipse'); var EllipseContains = require('../geom/ellipse/Contains'); +var Events = require('./events'); var EventEmitter = require('eventemitter3'); var GetFastValue = require('../utils/object/GetFastValue'); var InputPluginCache = require('./InputPluginCache'); @@ -19,6 +20,7 @@ var IsPlainObject = require('../utils/object/IsPlainObject'); var PluginCache = require('../plugins/PluginCache'); var Rectangle = require('../geom/rectangle/Rectangle'); var RectangleContains = require('../geom/rectangle/Contains'); +var SceneEvents = require('../scene/events'); var Triangle = require('../geom/triangle/Triangle'); var TriangleContains = require('../geom/triangle/Contains'); @@ -87,7 +89,7 @@ var InputPlugin = new Class({ * A reference to the Scene Systems Settings. * * @name Phaser.Input.InputPlugin#settings - * @type {Phaser.Scenes.Settings.Object} + * @type {Phaser.Scenes.Types.SettingsObject} * @since 3.5.0 */ this.settings = scene.sys.settings; @@ -207,7 +209,7 @@ var InputPlugin = new Class({ * Internal event propagation callback container. * * @name Phaser.Input.InputPlugin#_eventContainer - * @type {object} + * @type {Phaser.Input.Types.EventData} * @private * @since 3.13.0 */ @@ -324,6 +326,16 @@ var InputPlugin = new Class({ */ this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; + /** + * A array containing the dragStates, for this Scene, index by the Pointer ID. + * + * @name Phaser.Input.InputPlugin#_dragState + * @type {integer[]} + * @private + * @since 3.16.0 + */ + this._dragState = []; + /** * A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID. * @@ -344,8 +356,8 @@ var InputPlugin = new Class({ */ this._validTypes = [ 'onDown', 'onUp', 'onOver', 'onOut', 'onMove', 'onDragStart', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDrop' ]; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -353,6 +365,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#boot + * @fires Phaser.Input.Events#BOOT * @private * @since 3.5.1 */ @@ -362,10 +375,10 @@ var InputPlugin = new Class({ this.displayList = this.systems.displayList; - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); // Registered input plugins listen for this - this.pluginEvents.emit('boot'); + this.pluginEvents.emit(Events.BOOT); }, /** @@ -374,6 +387,7 @@ var InputPlugin = new Class({ * Do not invoke it directly. * * @method Phaser.Input.InputPlugin#start + * @fires Phaser.Input.Events#START * @private * @since 3.5.0 */ @@ -381,18 +395,60 @@ var InputPlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('transitionstart', this.transitionIn, this); - eventEmitter.on('transitionout', this.transitionOut, this); - eventEmitter.on('transitioncomplete', this.transitionComplete, this); - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); + eventEmitter.on(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.once('shutdown', this.shutdown, this); + if (this.manager.useQueue) + { + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + } + + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + + this.manager.events.on(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.on(Events.GAME_OVER, this.onGameOver, this); this.enabled = true; + // Populate the pointer drag states + this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + // Registered input plugins listen for this - this.pluginEvents.emit('start'); + this.pluginEvents.emit(Events.START); + }, + + /** + * Game Over handler. + * + * @method Phaser.Input.InputPlugin#onGameOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.2 + */ + onGameOver: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OVER, event.timeStamp, event); + } + }, + + /** + * Game Out handler. + * + * @method Phaser.Input.InputPlugin#onGameOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.2 + */ + onGameOut: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OUT, event.timeStamp, event); + } }, /** @@ -400,13 +456,14 @@ var InputPlugin = new Class({ * deleting old Game Objects. * * @method Phaser.Input.InputPlugin#preUpdate + * @fires Phaser.Input.Events#PRE_UPDATE * @private * @since 3.0.0 */ preUpdate: function () { // Registered input plugins listen for this - this.pluginEvents.emit('preupdate'); + this.pluginEvents.emit(Events.PRE_UPDATE); var removeList = this._pendingRemoval; var insertList = this._pendingInsertion; @@ -463,6 +520,7 @@ var InputPlugin = new Class({ * Called automatically by the Scene Systems step. * * @method Phaser.Input.InputPlugin#update + * @fires Phaser.Input.Events#UPDATE * @private * @since 3.0.0 * @@ -478,7 +536,7 @@ var InputPlugin = new Class({ var manager = this.manager; - this.pluginEvents.emit('update', time, delta); + this.pluginEvents.emit(Events.UPDATE, time, delta); // Another Scene above this one has already consumed the input events, or we're in transition if (manager.globalTopOnly && manager.ignoreEvents) @@ -486,13 +544,6 @@ var InputPlugin = new Class({ return; } - if (manager._emitIsOverEvent) - { - var event = (manager.isOver) ? 'gameover' : 'gameout'; - - this.emit(event, time, manager._emitIsOverEvent); - } - var runUpdate = (manager.dirty || this.pollRate === 0); if (this.pollRate > -1) @@ -514,8 +565,9 @@ var InputPlugin = new Class({ } var pointers = this.manager.pointers; + var pointersTotal = this.manager.pointersTotal; - for (var i = 0; i < this.manager.pointersTotal; i++) + for (var i = 0; i < pointersTotal; i++) { var pointer = pointers[i]; @@ -544,8 +596,11 @@ var InputPlugin = new Class({ var total = this.processDragEvents(pointer, time); - // TODO: Enable for touch - if (!pointer.wasTouch) + // TODO: Enable for touch - the method needs recoding to take ALL pointers at once + // and process them all together, in the same batch, otherwise the justOut and stillOver + // arrays will get corrupted in multi-touch enabled games. For now, we'll enable it for + // single touch games (which is probably the majority anyway). + if (pointersTotal < 3 || !pointer.wasTouch) { total += this.processOverOutEvents(pointer); } @@ -668,8 +723,8 @@ var InputPlugin = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to be enabled for input. - * @param {(Phaser.Input.InputConfiguration|any)} [shape] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {HitAreaCallback} [callback] - The 'contains' function to invoke to check if the pointer is within the hit area. + * @param {(Phaser.Input.Types.InputConfiguration|any)} [shape] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The 'contains' function to invoke to check if the pointer is within the hit area. * @param {boolean} [dropZone=false] - Is this Game Object a drop zone or not? * * @return {Phaser.Input.InputPlugin} This Input Plugin. @@ -755,10 +810,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processDownEvents * @private - * @fires Phaser.GameObjects.GameObject#pointerdownEvent - * @fires Phaser.Input.InputPlugin#gameobjectdownEvent - * @fires Phaser.Input.InputPlugin#pointerdownEvent - * @fires Phaser.Input.InputPlugin#pointerdownoutsideEvent + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. @@ -789,7 +844,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointerdown', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_DOWN, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -797,7 +852,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectdown', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_DOWN, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -809,34 +864,86 @@ var InputPlugin = new Class({ // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - var type = (pointer.downElement === this.manager.game.canvas) ? 'pointerdown' : 'pointerdownoutside'; - - // Contains ALL Game Objects currently up in the array - this.emit(type, pointer, currentlyOver); + if (pointer.downElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_DOWN, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_DOWN_OUTSIDE, pointer); + } } return total; }, + /** + * Returns the drag state of the given Pointer for this Input Plugin. + * + * The state will be one of the following: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#getDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. + * + * @return {integer} The drag state of the given Pointer. + */ + getDragState: function (pointer) + { + return this._dragState[pointer.id]; + }, + + /** + * Sets the drag state of the given Pointer for this Input Plugin. + * + * The state must be one of the following values: + * + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist + * + * @method Phaser.Input.InputPlugin#setDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. + * @param {integer} state - The drag state value. An integer between 0 and 5. + */ + setDragState: function (pointer, state) + { + this._dragState[pointer.id] = state; + }, + /** * An internal method that handles the Pointer drag events. * * @method Phaser.Input.InputPlugin#processDragEvents * @private - * @fires Phaser.GameObjects.GameObject#dragendEvent - * @fires Phaser.GameObjects.GameObject#dragenterEvent - * @fires Phaser.GameObjects.GameObject#dragEvent - * @fires Phaser.GameObjects.GameObject#dragleaveEvent - * @fires Phaser.GameObjects.GameObject#dragoverEvent - * @fires Phaser.GameObjects.GameObject#dragstartEvent - * @fires Phaser.GameObjects.GameObject#dropEvent - * @fires Phaser.Input.InputPlugin#dragendEvent - * @fires Phaser.Input.InputPlugin#dragenterEvent - * @fires Phaser.Input.InputPlugin#dragEvent - * @fires Phaser.Input.InputPlugin#dragleaveEvent - * @fires Phaser.Input.InputPlugin#dragoverEvent - * @fires Phaser.Input.InputPlugin#dragstartEvent - * @fires Phaser.Input.InputPlugin#dropEvent + * @fires Phaser.Input.Events#DRAG_END + * @fires Phaser.Input.Events#DRAG_ENTER + * @fires Phaser.Input.Events#DRAG + * @fires Phaser.Input.Events#DRAG_LEAVE + * @fires Phaser.Input.Events#DRAG_OVER + * @fires Phaser.Input.Events#DRAG_START + * @fires Phaser.Input.Events#DROP + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @fires Phaser.Input.Events#GAMEOBJECT_DROP * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. @@ -865,19 +972,19 @@ var InputPlugin = new Class({ // 4 = Pointer actively dragging the draglist and has moved // 5 = Pointer actively dragging but has been released, notify draglist - if (pointer.dragState === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) + if (this.getDragState(pointer) === 0 && pointer.primaryDown && pointer.justDown && currentlyOver.length > 0) { - pointer.dragState = 1; + this.setDragState(pointer, 1); } - else if (pointer.dragState > 0 && !pointer.primaryDown && pointer.justUp) + else if (this.getDragState(pointer) > 0 && !pointer.primaryDown && pointer.justUp) { - pointer.dragState = 5; + this.setDragState(pointer, 5); } // Process the various drag states // 1 = Primary button down and objects below, so collect a draglist - if (pointer.dragState === 1) + if (this.getDragState(pointer) === 1) { // Get draggable objects, sort them, pick the top (or all) and store them somewhere var draglist = []; @@ -894,7 +1001,7 @@ var InputPlugin = new Class({ if (draglist.length === 0) { - pointer.dragState = 0; + this.setDragState(pointer, 0); return 0; } @@ -914,35 +1021,35 @@ var InputPlugin = new Class({ if (this.dragDistanceThreshold === 0 && this.dragTimeThreshold === 0) { // No drag criteria, so snap immediately to mode 3 - pointer.dragState = 3; + this.setDragState(pointer, 3); } else { // Check the distance / time - pointer.dragState = 2; + this.setDragState(pointer, 2); } } // 2 = Pointer being checked if meets drag criteria - if (pointer.dragState === 2) + if (this.getDragState(pointer) === 2) { // Has it moved far enough to be considered a drag? if (this.dragDistanceThreshold > 0 && DistanceBetween(pointer.x, pointer.y, pointer.downX, pointer.downY) >= this.dragDistanceThreshold) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } // Held down long enough to be considered a drag? if (this.dragTimeThreshold > 0 && (time >= pointer.downTime + this.dragTimeThreshold)) { // Alrighty, we've got a drag going on ... - pointer.dragState = 3; + this.setDragState(pointer, 3); } } // 3 = Pointer meets criteria and is freshly down, notify the draglist - if (pointer.dragState === 3) + if (this.getDragState(pointer) === 3) { list = this._drag[pointer.id]; @@ -960,18 +1067,18 @@ var InputPlugin = new Class({ input.dragStartX = gameObject.x; input.dragStartY = gameObject.y; - gameObject.emit('dragstart', pointer, input.dragX, input.dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG_START, pointer, input.dragX, input.dragY); - this.emit('dragstart', pointer, gameObject); + this.emit(Events.DRAG_START, pointer, gameObject); } - pointer.dragState = 4; + this.setDragState(pointer, 4); return list.length; } // 4 = Pointer actively dragging the draglist and has moved - if (pointer.dragState === 4 && pointer.justMoved && !pointer.justUp) + if (this.getDragState(pointer) === 4 && pointer.justMoved && !pointer.justUp) { var dropZones = this._tempZones; @@ -992,29 +1099,29 @@ var InputPlugin = new Class({ if (index === 0) { // We're still over it, and it's still the top of the display list, phew ... - gameObject.emit('dragover', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_OVER, pointer, input.target); - this.emit('dragover', pointer, gameObject, input.target); + this.emit(Events.DRAG_OVER, pointer, gameObject, input.target); } else if (index > 0) { // Still over it but it's no longer top of the display list (targets must always be at the top) - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { // Nope, we've moved on (or the target has!), leave the old target - gameObject.emit('dragleave', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, input.target); - this.emit('dragleave', pointer, gameObject, input.target); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, input.target); // Anything new to replace it? // Yup! @@ -1022,9 +1129,9 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } else { @@ -1037,24 +1144,24 @@ var InputPlugin = new Class({ { input.target = dropZones[0]; - gameObject.emit('dragenter', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, input.target); - this.emit('dragenter', pointer, gameObject, input.target); + this.emit(Events.DRAG_ENTER, pointer, gameObject, input.target); } var dragX = pointer.x - gameObject.input.dragX; var dragY = pointer.y - gameObject.input.dragY; - gameObject.emit('drag', pointer, dragX, dragY); + gameObject.emit(Events.GAMEOBJECT_DRAG, pointer, dragX, dragY); - this.emit('drag', pointer, gameObject, dragX, dragY); + this.emit(Events.DRAG, pointer, gameObject, dragX, dragY); } return list.length; } // 5 = Pointer was actively dragging but has been released, notify draglist - if (pointer.dragState === 5) + if (this.getDragState(pointer) === 5) { list = this._drag[pointer.id]; @@ -1075,9 +1182,9 @@ var InputPlugin = new Class({ if (input.target) { - gameObject.emit('drop', pointer, input.target); + gameObject.emit(Events.GAMEOBJECT_DROP, pointer, input.target); - this.emit('drop', pointer, gameObject, input.target); + this.emit(Events.DROP, pointer, gameObject, input.target); input.target = null; @@ -1086,13 +1193,13 @@ var InputPlugin = new Class({ // And finally the dragend event - gameObject.emit('dragend', pointer, input.dragX, input.dragY, dropped); + gameObject.emit(Events.GAMEOBJECT_DRAG_END, pointer, input.dragX, input.dragY, dropped); - this.emit('dragend', pointer, gameObject, dropped); + this.emit(Events.DRAG_END, pointer, gameObject, dropped); } } - pointer.dragState = 0; + this.setDragState(pointer, 0); list.splice(0); } @@ -1104,9 +1211,10 @@ var InputPlugin = new Class({ * An internal method that handles the Pointer movement event. * * @method Phaser.Input.InputPlugin#processMoveEvents + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @fires Phaser.Input.Events#GAMEOBJECT_MOVE + * @fires Phaser.Input.Events#POINTER_MOVE * @private - * @fires Phaser.GameObjects.GameObject#pointermoveEvent - * @fires Phaser.Input.InputPlugin#gameobjectmoveEvent * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -1137,7 +1245,7 @@ var InputPlugin = new Class({ total++; - gameObject.emit('pointermove', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_MOVE, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); if (_eventData.cancelled) { @@ -1145,7 +1253,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectmove', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_MOVE, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -1161,7 +1269,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointermove', pointer, currentlyOver); + this.emit(Events.POINTER_MOVE, pointer, currentlyOver); } return total; @@ -1172,10 +1280,12 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processOverOutEvents * @private - * @fires Phaser.GameObjects.GameObject#pointeroutEvent - * @fires Phaser.GameObjects.GameObject#pointeroverEvent - * @fires Phaser.Input.InputPlugin#gameobjectoutEvent - * @fires Phaser.Input.InputPlugin#gameobjectoverEvent + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_OVER + * @fires Phaser.Input.Events#POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @fires Phaser.Input.Events#GAMEOBJECT_OUT + * @fires Phaser.Input.Events#POINTER_OUT * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -1257,7 +1367,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerout', pointer, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); manager.resetCursor(gameObject.input); @@ -1269,7 +1379,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectout', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -1280,7 +1390,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerout', pointer, justOut); + this.emit(Events.POINTER_OUT, pointer, justOut); } } @@ -1305,7 +1415,7 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerover', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); manager.setCursor(gameObject.input); @@ -1317,7 +1427,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectover', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -1328,7 +1438,7 @@ var InputPlugin = new Class({ if (!aborted) { - this.emit('pointerover', pointer, justOver); + this.emit(Events.POINTER_OVER, pointer, justOver); } } @@ -1346,9 +1456,10 @@ var InputPlugin = new Class({ * * @method Phaser.Input.InputPlugin#processUpEvents * @private - * @fires Phaser.GameObjects.GameObject#pointerupEvent - * @fires Phaser.Input.InputPlugin#gameobjectupEvent - * @fires Phaser.Input.InputPlugin#gameobjectupoutsideEvent + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @fires Phaser.Input.Events#GAMEOBJECT_UP + * @fires Phaser.Input.Events#POINTER_UP + * @fires Phaser.Input.Events#POINTER_UP_OUTSIDE * @since 3.0.0 * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. @@ -1376,7 +1487,15 @@ var InputPlugin = new Class({ continue; } - gameObject.emit('pointerup', pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + gameObject.emit(Events.GAMEOBJECT_POINTER_UP, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + + // Clear over and emit 'pointerout' on touch. + if (pointer.wasTouch) + { + this._over[pointer.id] = []; + + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + } if (_eventData.cancelled) { @@ -1384,7 +1503,7 @@ var InputPlugin = new Class({ break; } - this.emit('gameobjectup', pointer, gameObject, _eventContainer); + this.emit(Events.GAMEOBJECT_UP, pointer, gameObject, _eventContainer); if (_eventData.cancelled) { @@ -1396,10 +1515,14 @@ var InputPlugin = new Class({ // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. if (!aborted) { - var type = (pointer.upElement === this.manager.game.canvas) ? 'pointerup' : 'pointerupoutside'; - - // Contains ALL Game Objects currently up in the array - this.emit(type, pointer, currentlyOver); + if (pointer.upElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_UP, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_UP_OUTSIDE, pointer); + } } return currentlyOver.length; @@ -1531,19 +1654,6 @@ var InputPlugin = new Class({ return CreatePixelPerfectHandler(textureManager, alphaTolerance); }, - /** - * @typedef {object} Phaser.Input.InputConfiguration - * - * @property {any} [hitArea] - The object / shape to use as the Hit Area. If not given it will try to create a Rectangle based on the texture frame. - * @property {function} [hitAreaCallback] - The callback that determines if the pointer is within the Hit Area shape or not. - * @property {boolean} [draggable=false] - If `true` the Interactive Object will be set to be draggable and emit drag events. - * @property {boolean} [dropZone=false] - If `true` the Interactive Object will be set to be a drop zone for draggable objects. - * @property {boolean} [useHandCursor=false] - If `true` the Interactive Object will set the `pointer` hand cursor when a pointer is over it. This is a short-cut for setting `cursor: 'pointer'`. - * @property {string} [cursor] - The CSS string to be used when the cursor is over this Interactive Object. - * @property {boolean} [pixelPerfect=false] - If `true` the a pixel perfect function will be set for the hit area callback. Only works with texture based Game Objects. - * @property {integer} [alphaTolerance=1] - If `pixelPerfect` is set, this is the alpha tolerance threshold value used in the callback. - */ - /** * Sets the hit area for the given array of Game Objects. * @@ -1561,8 +1671,8 @@ var InputPlugin = new Class({ * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set the hit area on. - * @param {(Phaser.Input.InputConfiguration|any)} [shape] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {HitAreaCallback} [callback] - The 'contains' function to invoke to check if the pointer is within the hit area. + * @param {(Phaser.Input.Types.InputConfiguration|any)} [shape] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The 'contains' function to invoke to check if the pointer is within the hit area. * * @return {Phaser.Input.InputPlugin} This InputPlugin object. */ @@ -1649,7 +1759,7 @@ var InputPlugin = new Class({ * @param {number} x - The center of the circle. * @param {number} y - The center of the circle. * @param {number} radius - The radius of the circle. - * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Circle.Contains. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Circle.Contains. * * @return {Phaser.Input.InputPlugin} This InputPlugin object. */ @@ -1674,7 +1784,7 @@ var InputPlugin = new Class({ * @param {number} y - The center of the ellipse. * @param {number} width - The width of the ellipse. * @param {number} height - The height of the ellipse. - * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Ellipse.Contains. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Ellipse.Contains. * * @return {Phaser.Input.InputPlugin} This InputPlugin object. */ @@ -1695,7 +1805,7 @@ var InputPlugin = new Class({ * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having an ellipse hit area. - * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. * * @return {Phaser.Input.InputPlugin} This InputPlugin object. */ @@ -1757,7 +1867,7 @@ var InputPlugin = new Class({ * @param {number} y - The top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. * * @return {Phaser.Input.InputPlugin} This InputPlugin object. */ @@ -1784,7 +1894,7 @@ var InputPlugin = new Class({ * @param {number} y2 - The y coordinate of the second point of the triangle. * @param {number} x3 - The x coordinate of the third point of the triangle. * @param {number} y3 - The y coordinate of the third point of the triangle. - * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Triangle.Contains. + * @param {Phaser.Input.Types.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Triangle.Contains. * * @return {Phaser.Input.InputPlugin} This InputPlugin object. */ @@ -2004,6 +2114,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -2026,6 +2140,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addUpCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this DOM event. @@ -2041,6 +2156,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -2063,6 +2182,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addDownCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -2078,6 +2198,10 @@ var InputPlugin = new Class({ }, /** + * **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true` + * in your game config, to force it to use the legacy event queue system. This method is deprecated and + * will be removed in a future version. + * * Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received. * By setting the `isOnce` argument you can control if the callback is called once, * or every time the DOM event occurs. @@ -2100,6 +2224,7 @@ var InputPlugin = new Class({ * solve. * * @method Phaser.Input.InputPlugin#addMoveCallback + * @deprecated * @since 3.10.0 * * @param {function} callback - The callback to be invoked on this dom event. @@ -2215,19 +2340,21 @@ var InputPlugin = new Class({ * We need to kill and reset all internal properties as well as stop listening to Scene events. * * @method Phaser.Input.InputPlugin#shutdown + * @fires Phaser.Input.Events#SHUTDOWN * @private * @since 3.0.0 */ shutdown: function () { // Registered input plugins listen for this - this.pluginEvents.emit('shutdown'); + this.pluginEvents.emit(Events.SHUTDOWN); this._temp.length = 0; this._list.length = 0; this._draggable.length = 0; this._pendingRemoval.length = 0; this._pendingInsertion.length = 0; + this._dragState.length = 0; for (var i = 0; i < 10; i++) { @@ -2239,13 +2366,21 @@ var InputPlugin = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('transitionstart', this.transitionIn, this); - eventEmitter.off('transitionout', this.transitionOut, this); - eventEmitter.off('transitioncomplete', this.transitionComplete, this); + eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + + if (this.manager.useQueue) + { + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + } + + this.manager.events.off(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.off(Events.GAME_OVER, this.onGameOver, this); + + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -2253,6 +2388,7 @@ var InputPlugin = new Class({ * We need to shutdown and then kill off all external references. * * @method Phaser.Input.InputPlugin#destroy + * @fires Phaser.Input.Events#DESTROY * @private * @since 3.0.0 */ @@ -2261,11 +2397,11 @@ var InputPlugin = new Class({ this.shutdown(); // Registered input plugins listen for this - this.pluginEvents.emit('destroy'); + this.pluginEvents.emit(Events.DESTROY); this.pluginEvents.removeAllListeners(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.cameras = null; @@ -2548,171 +2684,3 @@ var InputPlugin = new Class({ PluginCache.register('InputPlugin', InputPlugin, 'input'); module.exports = InputPlugin; - -/** - * A Pointer stopped dragging the Game Object. - * @event Phaser.GameObjects.GameObject#dragendEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer that was dragging this Game Object. - * @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space. - * @param {boolean} dropped - True if the object was dropped within its drop target. (In that case, 'drop' was emitted before this.) - * - * The Game Object entered its drop target, while being dragged. - * @event Phaser.GameObjects.GameObject#dragenterEvent - * @param {Phaser.Input.Pointer} pointer - The pointer dragging this Game Object. - * @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target. - * - * The Game Object is being dragged by a Pointer. - * @event Phaser.GameObjects.GameObject#dragEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object. - * @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space. - * - * The Game Object left its drop target, while being dragged. - * @event Phaser.GameObjects.GameObject#dragleaveEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object. - * @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target. - * - * The Game Object is within its drop target, while being dragged. - * @event Phaser.GameObjects.GameObject#dragoverEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object. - * @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target. - * - * A Pointer began dragging the Game Object. - * @event Phaser.GameObjects.GameObject#dragstartEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object. - * @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space. - * - * The Game Object was released on its drop target, after being dragged. - * @event Phaser.GameObjects.GameObject#dropEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object. - * @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target. - * - * A Pointer was pressed on the Game Object. - * @event Phaser.GameObjects.GameObject#pointerdownEvent - * @param {Phaser.Input.Pointer} - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {object} eventContainer - * - * A Pointer moved while over the Game Object. - * @event Phaser.GameObjects.GameObject#pointermoveEvent - * @param {Phaser.Input.Pointer} - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {object} eventContainer - * - * A Pointer left the Game Object, after being over it. - * @event Phaser.GameObjects.GameObject#pointeroutEvent - * @param {Phaser.Input.Pointer} - The Pointer. - * @param {object} eventContainer - * - * A Pointer entered the Game Object, after being outside it. - * @event Phaser.GameObjects.GameObject#pointeroverEvent - * @param {Phaser.Input.Pointer} - The Pointer. - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {object} eventContainer - * - * A Pointer was released while over the Game Object, after being pressed on the Game Object. - * @event Phaser.GameObjects.GameObject#pointerupEvent - * @param {Phaser.Input.Pointer} - The Pointer. - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {object} eventContainer - */ - -/** - * A Game Object was released, after being dragged. - * @event Phaser.Input.InputPlugin#dragendEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {boolean} dropped - True if the Game Object was dropped onto its drop target. - * - * A dragged Game Object entered it drop target. - * @event Phaser.Input.InputPlugin#dragenterEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {Phaser.GameObjects.GameObject} target - The drop target. - * - * A Game Object is being dragged by a Pointer. - * @event Phaser.Input.InputPlugin#dragEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space. - * - * A dragged Game Object left its drop target. - * @event Phaser.Input.InputPlugin#dragleaveEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {?Phaser.GameObjects.GameObject} target - The drop target. - * - * A dragged Game Object is within its drop target. - * @event Phaser.Input.InputPlugin#dragoverEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {?Phaser.GameObjects.GameObject} target - The drop target. - * - * A Pointer started dragging a Game Object. - * @event Phaser.Input.InputPlugin#dragstartEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * - * A Game Object was dropped within its drop target. - * @event Phaser.Input.InputPlugin#dropEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {?Phaser.GameObjects.GameObject} target - The drop target. - * - * A Pointer was pressed while over a Game Object. - * @event Phaser.Input.InputPlugin#gameobjectdownEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {object} eventContainer - * - * A Pointer moved while over a Game Object. - * @event Phaser.Input.InputPlugin#gameobjectmoveEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {object} eventContainer - * - * A Pointer moved off of a Game Object, after being over it. - * @event Phaser.Input.InputPlugin#gameobjectoutEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {object} eventContainer - * - * A Pointer moved onto a Game Object, after being off it. - * @event Phaser.Input.InputPlugin#gameobjectoverEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {object} eventContainer - * - * A Pointer was released while over a Game Object, after being pressed on the Game Object. - * @event Phaser.Input.InputPlugin#gameobjectupEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object. - * @param {object} eventContainer - * - * A Pointer was pressed down. - * @event Phaser.Input.InputPlugin#pointerdownEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - All the Game Objects currently under the Pointer. - * - * A Pointer was released, after being pressed down. - * @event Phaser.Input.InputPlugin#pointerupEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - All the Game Objects currently under the Pointer. - * - * A Pointer was pressed down outside of the game canvas. - * @event Phaser.Input.InputPlugin#pointerdownoutsideEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - All the Game Objects currently under the Pointer. - * - * A Pointer was released outside of the game canvas. - * @event Phaser.Input.InputPlugin#pointerupoutsideEvent - * @param {Phaser.Input.Pointer} pointer - The Pointer. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - All the Game Objects currently under the Pointer. - */ diff --git a/src/input/InputPluginCache.js b/src/input/InputPluginCache.js index c3a2ba592..82a7e74c5 100644 --- a/src/input/InputPluginCache.js +++ b/src/input/InputPluginCache.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,11 +11,7 @@ var GetValue = require('../utils/object/GetValue'); var inputPlugins = {}; /** - * @typedef {object} InputPluginContainer - * - * @property {string} key - The unique name of this plugin in the input plugin cache. - * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated. - * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used. + * @namespace Phaser.Input.InputPluginCache */ var InputPluginCache = {}; @@ -26,7 +22,9 @@ var InputPluginCache = {}; * Plugin is the object to instantiate to create the plugin * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) * - * @method Phaser.Input.InputPluginCache.register + * @name Phaser.Input.InputPluginCache.register + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - A reference used to get this plugin from the plugin cache. @@ -43,12 +41,14 @@ InputPluginCache.register = function (key, plugin, mapping, settingsKey, configK /** * Returns the input plugin object from the cache based on the given key. * - * @method Phaser.Input.InputPluginCache.getCore + * @name Phaser.Input.InputPluginCache.getCore + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to get. * - * @return {InputPluginContainer} The input plugin object. + * @return {Phaser.Input.Types.InputPluginContainer} The input plugin object. */ InputPluginCache.getPlugin = function (key) { @@ -58,7 +58,9 @@ InputPluginCache.getPlugin = function (key) /** * Installs all of the registered Input Plugins into the given target. * - * @method Phaser.Input.InputPluginCache.install + * @name Phaser.Input.InputPluginCache.install + * @type {function} + * @static * @since 3.10.0 * * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into. @@ -86,7 +88,9 @@ InputPluginCache.install = function (target) /** * Removes an input plugin based on the given key. * - * @method Phaser.Input.InputPluginCache.remove + * @name Phaser.Input.InputPluginCache.remove + * @type {function} + * @static * @since 3.10.0 * * @param {string} key - The key of the input plugin to remove. diff --git a/src/input/Pointer.js b/src/input/Pointer.js index 020135c81..639aab513 100644 --- a/src/input/Pointer.js +++ b/src/input/Pointer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -337,20 +337,6 @@ var Pointer = new Class({ */ this.primaryDown = false; - /** - * The Drag State of the Pointer: - * - * 0 = Not dragging anything - * 1 = Being checked if dragging - * 2 = Dragging something - * - * @name Phaser.Input.Pointer#dragState - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.dragState = 0; - /** * Is _any_ button on this pointer considered as being down? * @@ -581,7 +567,7 @@ var Pointer = new Class({ */ up: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } @@ -622,7 +608,7 @@ var Pointer = new Class({ */ down: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } @@ -663,7 +649,7 @@ var Pointer = new Class({ */ move: function (event, time) { - if (event.buttons) + if ('buttons' in event) { this.buttons = event.buttons; } @@ -847,7 +833,7 @@ var Pointer = new Class({ */ leftButtonDown: function () { - return (this.buttons & 1); + return (this.buttons & 1) ? true : false; }, /** @@ -860,7 +846,7 @@ var Pointer = new Class({ */ rightButtonDown: function () { - return (this.buttons & 2); + return (this.buttons & 2) ? true : false; }, /** @@ -873,7 +859,7 @@ var Pointer = new Class({ */ middleButtonDown: function () { - return (this.buttons & 4); + return (this.buttons & 4) ? true : false; }, /** @@ -886,7 +872,7 @@ var Pointer = new Class({ */ backButtonDown: function () { - return (this.buttons & 8); + return (this.buttons & 8) ? true : false; }, /** @@ -899,7 +885,7 @@ var Pointer = new Class({ */ forwardButtonDown: function () { - return (this.buttons & 16); + return (this.buttons & 16) ? true : false; }, /** diff --git a/src/input/const.js b/src/input/const.js index 0558dde41..b78742cb4 100644 --- a/src/input/const.js +++ b/src/input/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/events/BOOT_EVENT.js b/src/input/events/BOOT_EVENT.js new file mode 100644 index 000000000..e9fe28778 --- /dev/null +++ b/src/input/events/BOOT_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Boot Event. + * + * This internal event is dispatched by the Input Plugin when it boots, signalling to all of its systems to create themselves. + * + * @event Phaser.Input.Events#BOOT + * @since 3.0.0 + */ +module.exports = 'boot'; diff --git a/src/input/events/DESTROY_EVENT.js b/src/input/events/DESTROY_EVENT.js new file mode 100644 index 000000000..7a682333b --- /dev/null +++ b/src/input/events/DESTROY_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Destroy Event. + * + * This internal event is dispatched by the Input Plugin when it is destroyed, signalling to all of its systems to destroy themselves. + * + * @event Phaser.Input.Events#DESTROY + * @since 3.0.0 + */ +module.exports = 'destroy'; diff --git a/src/input/events/DRAG_END_EVENT.js b/src/input/events/DRAG_END_EVENT.js new file mode 100644 index 000000000..0ca4d1793 --- /dev/null +++ b/src/input/events/DRAG_END_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag End Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer stops dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragend', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_END]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_END} event instead. + * + * @event Phaser.Input.Events#DRAG_END + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer stopped dragging. + */ +module.exports = 'dragend'; diff --git a/src/input/events/DRAG_ENTER_EVENT.js b/src/input/events/DRAG_ENTER_EVENT.js new file mode 100644 index 000000000..1b0ee850e --- /dev/null +++ b/src/input/events/DRAG_ENTER_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Enter Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object into a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragenter', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_ENTER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_ENTER} event instead. + * + * @event Phaser.Input.Events#DRAG_ENTER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; diff --git a/src/input/events/DRAG_EVENT.js b/src/input/events/DRAG_EVENT.js new file mode 100644 index 000000000..7f9ea5992 --- /dev/null +++ b/src/input/events/DRAG_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves while dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('drag', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG} event instead. + * + * @event Phaser.Input.Events#DRAG + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; diff --git a/src/input/events/DRAG_LEAVE_EVENT.js b/src/input/events/DRAG_LEAVE_EVENT.js new file mode 100644 index 000000000..44f218b82 --- /dev/null +++ b/src/input/events/DRAG_LEAVE_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Leave Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object out of a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragleave', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_LEAVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_LEAVE} event instead. + * + * @event Phaser.Input.Events#DRAG_LEAVE + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; diff --git a/src/input/events/DRAG_OVER_EVENT.js b/src/input/events/DRAG_OVER_EVENT.js new file mode 100644 index 000000000..4864788fd --- /dev/null +++ b/src/input/events/DRAG_OVER_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object over a Drag Target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from within a Scene using: `this.input.on('dragover', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_OVER} event instead. + * + * @event Phaser.Input.Events#DRAG_OVER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; diff --git a/src/input/events/DRAG_START_EVENT.js b/src/input/events/DRAG_START_EVENT.js new file mode 100644 index 000000000..9b5a1e781 --- /dev/null +++ b/src/input/events/DRAG_START_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drag Start Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer starts to drag any Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragstart', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_START]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_START} event instead. + * + * @event Phaser.Input.Events#DRAG_START + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + */ +module.exports = 'dragstart'; diff --git a/src/input/events/DROP_EVENT.js b/src/input/events/DROP_EVENT.js new file mode 100644 index 000000000..23722a787 --- /dev/null +++ b/src/input/events/DROP_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Drop Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drops a Game Object on a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('drop', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DROP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DROP} event instead. + * + * @event Phaser.Input.Events#DROP + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer was dragging. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; diff --git a/src/input/events/GAMEOBJECT_DOWN_EVENT.js b/src/input/events/GAMEOBJECT_DOWN_EVENT.js new file mode 100644 index 000000000..31b12ec3c --- /dev/null +++ b/src/input/events/GAMEOBJECT_DOWN_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down on _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectdown', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_DOWN + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was pressed down on. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectdown'; diff --git a/src/input/events/GAMEOBJECT_DRAG_END_EVENT.js b/src/input/events/GAMEOBJECT_DRAG_END_EVENT.js new file mode 100644 index 000000000..822127e04 --- /dev/null +++ b/src/input/events/GAMEOBJECT_DRAG_END_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag End Event. + * + * This event is dispatched by an interactive Game Object if a pointer stops dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragend', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive](Phaser.GameObjects.GameObject#setInteractive) for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer stopped dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer stopped dragging the Game Object, in world space. + */ +module.exports = 'dragend'; diff --git a/src/input/events/GAMEOBJECT_DRAG_ENTER_EVENT.js b/src/input/events/GAMEOBJECT_DRAG_ENTER_EVENT.js new file mode 100644 index 000000000..aa2ccc543 --- /dev/null +++ b/src/input/events/GAMEOBJECT_DRAG_ENTER_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Enter Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it into a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragenter', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; diff --git a/src/input/events/GAMEOBJECT_DRAG_EVENT.js b/src/input/events/GAMEOBJECT_DRAG_EVENT.js new file mode 100644 index 000000000..f21426df9 --- /dev/null +++ b/src/input/events/GAMEOBJECT_DRAG_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves while dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('drag', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; diff --git a/src/input/events/GAMEOBJECT_DRAG_LEAVE_EVENT.js b/src/input/events/GAMEOBJECT_DRAG_LEAVE_EVENT.js new file mode 100644 index 000000000..bdf72857c --- /dev/null +++ b/src/input/events/GAMEOBJECT_DRAG_LEAVE_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Leave Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragleave', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; diff --git a/src/input/events/GAMEOBJECT_DRAG_OVER_EVENT.js b/src/input/events/GAMEOBJECT_DRAG_OVER_EVENT.js new file mode 100644 index 000000000..317995add --- /dev/null +++ b/src/input/events/GAMEOBJECT_DRAG_OVER_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it over a drag target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from a Game Object using: `gameObject.on('dragover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; diff --git a/src/input/events/GAMEOBJECT_DRAG_START_EVENT.js b/src/input/events/GAMEOBJECT_DRAG_START_EVENT.js new file mode 100644 index 000000000..46ca57547 --- /dev/null +++ b/src/input/events/GAMEOBJECT_DRAG_START_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drag Start Event. + * + * This event is dispatched by an interactive Game Object if a pointer starts to drag it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragstart', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * There are lots of useful drag related properties that are set within the Game Object when dragging occurs. + * For example, `gameObject.input.dragStartX`, `dragStartY` and so on. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'dragstart'; diff --git a/src/input/events/GAMEOBJECT_DROP_EVENT.js b/src/input/events/GAMEOBJECT_DROP_EVENT.js new file mode 100644 index 000000000..8abe6a721 --- /dev/null +++ b/src/input/events/GAMEOBJECT_DROP_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Drop Event. + * + * This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target. + * + * Listen to this event from a Game Object using: `gameObject.on('drop', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DROP + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; diff --git a/src/input/events/GAMEOBJECT_MOVE_EVENT.js b/src/input/events/GAMEOBJECT_MOVE_EVENT.js new file mode 100644 index 000000000..a110e4600 --- /dev/null +++ b/src/input/events/GAMEOBJECT_MOVE_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved across _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectmove', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_MOVE + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was moved on. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectmove'; diff --git a/src/input/events/GAMEOBJECT_OUT_EVENT.js b/src/input/events/GAMEOBJECT_OUT_EVENT.js new file mode 100644 index 000000000..8f3a6048f --- /dev/null +++ b/src/input/events/GAMEOBJECT_OUT_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectout', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OUT + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved out of. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectout'; diff --git a/src/input/events/GAMEOBJECT_OVER_EVENT.js b/src/input/events/GAMEOBJECT_OVER_EVENT.js new file mode 100644 index 000000000..367ef576e --- /dev/null +++ b/src/input/events/GAMEOBJECT_OVER_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectover', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OVER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved over. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectover'; diff --git a/src/input/events/GAMEOBJECT_POINTER_DOWN_EVENT.js b/src/input/events/GAMEOBJECT_POINTER_DOWN_EVENT.js new file mode 100644 index 000000000..453b43c9d --- /dev/null +++ b/src/input/events/GAMEOBJECT_POINTER_DOWN_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Down Event. + * + * This event is dispatched by an interactive Game Object if a pointer is pressed down on it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerdown', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerdown'; diff --git a/src/input/events/GAMEOBJECT_POINTER_MOVE_EVENT.js b/src/input/events/GAMEOBJECT_POINTER_MOVE_EVENT.js new file mode 100644 index 000000000..30f70c87a --- /dev/null +++ b/src/input/events/GAMEOBJECT_POINTER_MOVE_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Move Event. + * + * This event is dispatched by an interactive Game Object if a pointer is moved while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointermove', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointermove'; diff --git a/src/input/events/GAMEOBJECT_POINTER_OUT_EVENT.js b/src/input/events/GAMEOBJECT_POINTER_OUT_EVENT.js new file mode 100644 index 000000000..0506cb7ef --- /dev/null +++ b/src/input/events/GAMEOBJECT_POINTER_OUT_EVENT.js @@ -0,0 +1,33 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Out Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves out of it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerout', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerout'; diff --git a/src/input/events/GAMEOBJECT_POINTER_OVER_EVENT.js b/src/input/events/GAMEOBJECT_POINTER_OVER_EVENT.js new file mode 100644 index 000000000..e96d6ee9e --- /dev/null +++ b/src/input/events/GAMEOBJECT_POINTER_OVER_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerover'; diff --git a/src/input/events/GAMEOBJECT_POINTER_UP_EVENT.js b/src/input/events/GAMEOBJECT_POINTER_UP_EVENT.js new file mode 100644 index 000000000..1d3922a12 --- /dev/null +++ b/src/input/events/GAMEOBJECT_POINTER_UP_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Pointer Up Event. + * + * This event is dispatched by an interactive Game Object if a pointer is released while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerup', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerup'; diff --git a/src/input/events/GAMEOBJECT_UP_EVENT.js b/src/input/events/GAMEOBJECT_UP_EVENT.js new file mode 100644 index 000000000..7760d861d --- /dev/null +++ b/src/input/events/GAMEOBJECT_UP_EVENT.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Game Object Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released while over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectup', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_UP + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when released. + * @param {Phaser.Input.Types.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectup'; diff --git a/src/input/events/GAME_OUT_EVENT.js b/src/input/events/GAME_OUT_EVENT.js new file mode 100644 index 000000000..0223a6514 --- /dev/null +++ b/src/input/events/GAME_OUT_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Out Event. + * + * This event is dispatched by the Input Plugin if the active pointer leaves the game canvas and is now + * outside of it, elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameout', listener)`. + * + * @event Phaser.Input.Events#GAME_OUT + * @since 3.16.1 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas out. + */ +module.exports = 'gameout'; diff --git a/src/input/events/GAME_OVER_EVENT.js b/src/input/events/GAME_OVER_EVENT.js new file mode 100644 index 000000000..fde3724af --- /dev/null +++ b/src/input/events/GAME_OVER_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Game Over Event. + * + * This event is dispatched by the Input Plugin if the active pointer enters the game canvas and is now + * over of it, having previously been elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameover', listener)`. + * + * @event Phaser.Input.Events#GAME_OVER + * @since 3.16.1 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas over. + */ +module.exports = 'gameover'; diff --git a/src/input/events/MANAGER_BOOT_EVENT.js b/src/input/events/MANAGER_BOOT_EVENT.js new file mode 100644 index 000000000..9ac98064c --- /dev/null +++ b/src/input/events/MANAGER_BOOT_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Boot Event. + * + * This internal event is dispatched by the Input Manager when it boots. + * + * @event Phaser.Input.Events#MANAGER_BOOT + * @since 3.0.0 + */ +module.exports = 'boot'; diff --git a/src/input/events/MANAGER_PROCESS_EVENT.js b/src/input/events/MANAGER_PROCESS_EVENT.js new file mode 100644 index 000000000..26d1760b0 --- /dev/null +++ b/src/input/events/MANAGER_PROCESS_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Process Event. + * + * This internal event is dispatched by the Input Manager when not using the legacy queue system, + * and it wants the Input Plugins to update themselves. + * + * @event Phaser.Input.Events#MANAGER_PROCESS + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'process'; diff --git a/src/input/events/MANAGER_UPDATE_EVENT.js b/src/input/events/MANAGER_UPDATE_EVENT.js new file mode 100644 index 000000000..4e67177c6 --- /dev/null +++ b/src/input/events/MANAGER_UPDATE_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Update Event. + * + * This internal event is dispatched by the Input Manager as part of its update step. + * + * @event Phaser.Input.Events#MANAGER_UPDATE + * @since 3.0.0 + */ +module.exports = 'update'; diff --git a/src/input/events/POINTERLOCK_CHANGE_EVENT.js b/src/input/events/POINTERLOCK_CHANGE_EVENT.js new file mode 100644 index 000000000..380f0d931 --- /dev/null +++ b/src/input/events/POINTERLOCK_CHANGE_EVENT.js @@ -0,0 +1,18 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Manager Pointer Lock Change Event. + * + * This event is dispatched by the Input Manager when it is processing a native Pointer Lock Change DOM Event. + * + * @event Phaser.Input.Events#POINTERLOCK_CHANGE + * @since 3.0.0 + * + * @param {Event} event - The native DOM Event. + * @param {boolean} locked - The locked state of the Mouse Pointer. + */ +module.exports = 'pointerlockchange'; diff --git a/src/input/events/POINTER_DOWN_EVENT.js b/src/input/events/POINTER_DOWN_EVENT.js new file mode 100644 index 000000000..409f77f2f --- /dev/null +++ b/src/input/events/POINTER_DOWN_EVENT.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdown', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerdown'; diff --git a/src/input/events/POINTER_DOWN_OUTSIDE_EVENT.js b/src/input/events/POINTER_DOWN_OUTSIDE_EVENT.js new file mode 100644 index 000000000..672726f0c --- /dev/null +++ b/src/input/events/POINTER_DOWN_OUTSIDE_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Down Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdownoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN_OUTSIDE + * @since 3.16.1 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerdownoutside'; diff --git a/src/input/events/POINTER_MOVE_EVENT.js b/src/input/events/POINTER_MOVE_EVENT.js new file mode 100644 index 000000000..742d47ccd --- /dev/null +++ b/src/input/events/POINTER_MOVE_EVENT.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointermove', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_MOVE + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointermove'; diff --git a/src/input/events/POINTER_OUT_EVENT.js b/src/input/events/POINTER_OUT_EVENT.js new file mode 100644 index 000000000..66bb458dc --- /dev/null +++ b/src/input/events/POINTER_OUT_EVENT.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OUT + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOut - An array containing all interactive Game Objects that the pointer moved out of when the event was created. + */ +module.exports = 'pointerout'; diff --git a/src/input/events/POINTER_OVER_EVENT.js b/src/input/events/POINTER_OVER_EVENT.js new file mode 100644 index 000000000..0041bdf18 --- /dev/null +++ b/src/input/events/POINTER_OVER_EVENT.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerover', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OVER + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOver - An array containing all interactive Game Objects that the pointer moved over when the event was created. + */ +module.exports = 'pointerover'; diff --git a/src/input/events/POINTER_UP_EVENT.js b/src/input/events/POINTER_UP_EVENT.js new file mode 100644 index 000000000..2700651c4 --- /dev/null +++ b/src/input/events/POINTER_UP_EVENT.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerup'; diff --git a/src/input/events/POINTER_UP_OUTSIDE_EVENT.js b/src/input/events/POINTER_UP_OUTSIDE_EVENT.js new file mode 100644 index 000000000..4ae991e60 --- /dev/null +++ b/src/input/events/POINTER_UP_OUTSIDE_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pointer Up Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerupoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP_OUTSIDE + * @since 3.16.1 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerupoutside'; diff --git a/src/input/events/PRE_UPDATE_EVENT.js b/src/input/events/PRE_UPDATE_EVENT.js new file mode 100644 index 000000000..8af717689 --- /dev/null +++ b/src/input/events/PRE_UPDATE_EVENT.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Pre-Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `preUpdate` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#PRE_UPDATE + * @since 3.0.0 + */ +module.exports = 'preupdate'; diff --git a/src/input/events/SHUTDOWN_EVENT.js b/src/input/events/SHUTDOWN_EVENT.js new file mode 100644 index 000000000..cdbaebf0b --- /dev/null +++ b/src/input/events/SHUTDOWN_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Shutdown Event. + * + * This internal event is dispatched by the Input Plugin when it shuts down, signalling to all of its systems to shut themselves down. + * + * @event Phaser.Input.Events#SHUTDOWN + * @since 3.0.0 + */ +module.exports = 'shutdown'; diff --git a/src/input/events/START_EVENT.js b/src/input/events/START_EVENT.js new file mode 100644 index 000000000..bf507ff8c --- /dev/null +++ b/src/input/events/START_EVENT.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Start Event. + * + * This internal event is dispatched by the Input Plugin when it has finished setting-up, + * signalling to all of its internal systems to start. + * + * @event Phaser.Input.Events#START + * @since 3.0.0 + */ +module.exports = 'start'; diff --git a/src/input/events/UPDATE_EVENT.js b/src/input/events/UPDATE_EVENT.js new file mode 100644 index 000000000..baba08429 --- /dev/null +++ b/src/input/events/UPDATE_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Input Plugin Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `update` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#UPDATE + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; diff --git a/src/input/events/index.js b/src/input/events/index.js new file mode 100644 index 000000000..d49b2361b --- /dev/null +++ b/src/input/events/index.js @@ -0,0 +1,57 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: require('./BOOT_EVENT'), + DESTROY: require('./DESTROY_EVENT'), + DRAG_END: require('./DRAG_END_EVENT'), + DRAG_ENTER: require('./DRAG_ENTER_EVENT'), + DRAG: require('./DRAG_EVENT'), + DRAG_LEAVE: require('./DRAG_LEAVE_EVENT'), + DRAG_OVER: require('./DRAG_OVER_EVENT'), + DRAG_START: require('./DRAG_START_EVENT'), + DROP: require('./DROP_EVENT'), + GAME_OUT: require('./GAME_OUT_EVENT'), + GAME_OVER: require('./GAME_OVER_EVENT'), + GAMEOBJECT_DOWN: require('./GAMEOBJECT_DOWN_EVENT'), + GAMEOBJECT_DRAG_END: require('./GAMEOBJECT_DRAG_END_EVENT'), + GAMEOBJECT_DRAG_ENTER: require('./GAMEOBJECT_DRAG_ENTER_EVENT'), + GAMEOBJECT_DRAG: require('./GAMEOBJECT_DRAG_EVENT'), + GAMEOBJECT_DRAG_LEAVE: require('./GAMEOBJECT_DRAG_LEAVE_EVENT'), + GAMEOBJECT_DRAG_OVER: require('./GAMEOBJECT_DRAG_OVER_EVENT'), + GAMEOBJECT_DRAG_START: require('./GAMEOBJECT_DRAG_START_EVENT'), + GAMEOBJECT_DROP: require('./GAMEOBJECT_DROP_EVENT'), + GAMEOBJECT_MOVE: require('./GAMEOBJECT_MOVE_EVENT'), + GAMEOBJECT_OUT: require('./GAMEOBJECT_OUT_EVENT'), + GAMEOBJECT_OVER: require('./GAMEOBJECT_OVER_EVENT'), + GAMEOBJECT_POINTER_DOWN: require('./GAMEOBJECT_POINTER_DOWN_EVENT'), + GAMEOBJECT_POINTER_MOVE: require('./GAMEOBJECT_POINTER_MOVE_EVENT'), + GAMEOBJECT_POINTER_OUT: require('./GAMEOBJECT_POINTER_OUT_EVENT'), + GAMEOBJECT_POINTER_OVER: require('./GAMEOBJECT_POINTER_OVER_EVENT'), + GAMEOBJECT_POINTER_UP: require('./GAMEOBJECT_POINTER_UP_EVENT'), + GAMEOBJECT_UP: require('./GAMEOBJECT_UP_EVENT'), + MANAGER_BOOT: require('./MANAGER_BOOT_EVENT'), + MANAGER_PROCESS: require('./MANAGER_PROCESS_EVENT'), + MANAGER_UPDATE: require('./MANAGER_UPDATE_EVENT'), + POINTER_DOWN: require('./POINTER_DOWN_EVENT'), + POINTER_DOWN_OUTSIDE: require('./POINTER_DOWN_OUTSIDE_EVENT'), + POINTER_MOVE: require('./POINTER_MOVE_EVENT'), + POINTER_OUT: require('./POINTER_OUT_EVENT'), + POINTER_OVER: require('./POINTER_OVER_EVENT'), + POINTER_UP: require('./POINTER_UP_EVENT'), + POINTER_UP_OUTSIDE: require('./POINTER_UP_OUTSIDE_EVENT'), + POINTERLOCK_CHANGE: require('./POINTERLOCK_CHANGE_EVENT'), + PRE_UPDATE: require('./PRE_UPDATE_EVENT'), + SHUTDOWN: require('./SHUTDOWN_EVENT'), + START: require('./START_EVENT'), + UPDATE: require('./UPDATE_EVENT') + +}; diff --git a/src/input/gamepad/Axis.js b/src/input/gamepad/Axis.js index 2d39cf8b0..789c38eac 100644 --- a/src/input/gamepad/Axis.js +++ b/src/input/gamepad/Axis.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/gamepad/Button.js b/src/input/gamepad/Button.js index 2184be2a3..a2f065a5a 100644 --- a/src/input/gamepad/Button.js +++ b/src/input/gamepad/Button.js @@ -1,10 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); +var Events = require('./events'); /** * @classdesc @@ -89,10 +90,14 @@ var Button = new Class({ * Called automatically by the Gamepad as part of its update. * * @method Phaser.Input.Gamepad.Button#update + * @fires Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#BUTTON_UP + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP * @private * @since 3.0.0 * - * @param {number} value - The GamepadButton value. + * @param {number} value - The value of the button. Between 0 and 1. */ update: function (value) { @@ -106,15 +111,15 @@ var Button = new Class({ if (!this.pressed) { this.pressed = true; - this.events.emit('down', pad, this, value); - this.pad.emit('down', index, value, this); + this.events.emit(Events.BUTTON_DOWN, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_DOWN, index, value, this); } } else if (this.pressed) { this.pressed = false; - this.events.emit('up', pad, this, value); - this.pad.emit('up', index, value, this); + this.events.emit(Events.BUTTON_UP, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_UP, index, value, this); } }, diff --git a/src/input/gamepad/Gamepad.js b/src/input/gamepad/Gamepad.js index 02354b75b..a4f205c67 100644 --- a/src/input/gamepad/Gamepad.js +++ b/src/input/gamepad/Gamepad.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -23,7 +23,7 @@ var Vector2 = require('../../math/Vector2'); * @since 3.0.0 * * @param {Phaser.Input.Gamepad.GamepadPlugin} manager - A reference to the Gamepad Plugin. - * @param {Pad} pad - The Gamepad object, as extracted from GamepadEvent. + * @param {Phaser.Input.Gamepad.Types.Pad} pad - The Gamepad object, as extracted from GamepadEvent. */ var Gamepad = new Class({ diff --git a/src/input/gamepad/GamepadPlugin.js b/src/input/gamepad/GamepadPlugin.js index e8cc597e1..09653df89 100644 --- a/src/input/gamepad/GamepadPlugin.js +++ b/src/input/gamepad/GamepadPlugin.js @@ -1,21 +1,16 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var Gamepad = require('./Gamepad'); var GetValue = require('../../utils/object/GetValue'); var InputPluginCache = require('../InputPluginCache'); - -/** - * @typedef {object} Pad - * - * @property {string} id - The ID of the Gamepad. - * @property {integer} index - The index of the Gamepad. - */ +var InputEvents = require('../events'); /** * @classdesc @@ -83,7 +78,7 @@ var GamepadPlugin = new Class({ * A reference to the Scene Systems Settings. * * @name Phaser.Input.Gamepad.GamepadPlugin#settings - * @type {Phaser.Scenes.Settings.Object} + * @type {Phaser.Scenes.Types.SettingsObject} * @since 3.10.0 */ this.settings = this.scene.sys.settings; @@ -188,8 +183,8 @@ var GamepadPlugin = new Class({ */ this._pad4; - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -209,7 +204,7 @@ var GamepadPlugin = new Class({ this.enabled = GetValue(settings, 'gamepad', config.inputGamepad) && game.device.input.gamepads; this.target = GetValue(settings, 'gamepad.target', config.inputGamepadEventTarget); - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -228,7 +223,7 @@ var GamepadPlugin = new Class({ this.startListeners(); } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -282,7 +277,7 @@ var GamepadPlugin = new Class({ // until more browsers support this // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); }, /** @@ -298,7 +293,7 @@ var GamepadPlugin = new Class({ this.target.removeEventListener('gamepadconnected', this.onGamepadHandler); this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); - this.sceneInputPlugin.pluginEvents.off('update', this.update); + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); }, /** @@ -445,6 +440,8 @@ var GamepadPlugin = new Class({ * * @method Phaser.Input.Gamepad.GamepadPlugin#update * @private + * @fires Phaser.Input.Gamepad.Events#CONNECTED + * @fires Phaser.Input.Gamepad.Events#DISCONNECTED * @since 3.10.0 */ update: function () @@ -473,11 +470,11 @@ var GamepadPlugin = new Class({ if (event.type === 'gamepadconnected') { - this.emit('connected', pad, event); + this.emit(Events.CONNECTED, pad, event); } else if (event.type === 'gamepaddisconnected') { - this.emit('disconnected', pad, event); + this.emit(Events.DISCONNECTED, pad, event); } } }, diff --git a/src/input/gamepad/configs/SNES_USB_Controller.js b/src/input/gamepad/configs/SNES_USB_Controller.js index 6fe3aa535..94735b480 100644 --- a/src/input/gamepad/configs/SNES_USB_Controller.js +++ b/src/input/gamepad/configs/SNES_USB_Controller.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js b/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js index c9d6a95ec..e5d0afba6 100644 --- a/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js +++ b/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/gamepad/configs/XBox360_Controller.js b/src/input/gamepad/configs/XBox360_Controller.js index d1299289b..9ba80b459 100644 --- a/src/input/gamepad/configs/XBox360_Controller.js +++ b/src/input/gamepad/configs/XBox360_Controller.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/gamepad/configs/index.js b/src/input/gamepad/configs/index.js index eb7e9b8f3..3a1ec24cb 100644 --- a/src/input/gamepad/configs/index.js +++ b/src/input/gamepad/configs/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/gamepad/events/BUTTON_DOWN_EVENT.js b/src/input/gamepad/events/BUTTON_DOWN_EVENT.js new file mode 100644 index 000000000..031be30e3 --- /dev/null +++ b/src/input/gamepad/events/BUTTON_DOWN_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`. + * + * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @since 3.10.0 + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was pressed. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'down'; diff --git a/src/input/gamepad/events/BUTTON_UP_EVENT.js b/src/input/gamepad/events/BUTTON_UP_EVENT.js new file mode 100644 index 000000000..8563b6cc8 --- /dev/null +++ b/src/input/gamepad/events/BUTTON_UP_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad. + * + * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`. + * + * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#BUTTON_UP + * @since 3.10.0 + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was released. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'up'; diff --git a/src/input/gamepad/events/CONNECTED_EVENT.js b/src/input/gamepad/events/CONNECTED_EVENT.js new file mode 100644 index 000000000..d0b506a37 --- /dev/null +++ b/src/input/gamepad/events/CONNECTED_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Connected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`. + * + * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, + * this is for security reasons. However, it may also trust the page already, in which case you won't get the + * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads + * already connected. + * + * @event Phaser.Input.Gamepad.Events#CONNECTED + * @since 3.0.0 + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was connected. + * @param {Event} event - The native DOM Event that triggered the connection. + */ +module.exports = 'connected'; diff --git a/src/input/gamepad/events/DISCONNECTED_EVENT.js b/src/input/gamepad/events/DISCONNECTED_EVENT.js new file mode 100644 index 000000000..6dd87d547 --- /dev/null +++ b/src/input/gamepad/events/DISCONNECTED_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Disconnected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`. + * + * @event Phaser.Input.Gamepad.Events#DISCONNECTED + * @since 3.0.0 + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was disconnected. + * @param {Event} event - The native DOM Event that triggered the disconnection. + */ +module.exports = 'disconnected'; diff --git a/src/input/gamepad/events/GAMEPAD_BUTTON_DOWN_EVENT.js b/src/input/gamepad/events/GAMEPAD_BUTTON_DOWN_EVENT.js new file mode 100644 index 000000000..c7cef250b --- /dev/null +++ b/src/input/gamepad/events/GAMEPAD_BUTTON_DOWN_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by a Gamepad instance when a button has been pressed on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('down', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @since 3.10.0 + * + * @param {integer} index - The index of the button that was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + */ +module.exports = 'down'; diff --git a/src/input/gamepad/events/GAMEPAD_BUTTON_UP_EVENT.js b/src/input/gamepad/events/GAMEPAD_BUTTON_UP_EVENT.js new file mode 100644 index 000000000..509fae428 --- /dev/null +++ b/src/input/gamepad/events/GAMEPAD_BUTTON_UP_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Gamepad Button Up Event. + * + * This event is dispatched by a Gamepad instance when a button has been released on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('up', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP + * @since 3.10.0 + * + * @param {integer} index - The index of the button that was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + */ +module.exports = 'up'; diff --git a/src/input/gamepad/events/index.js b/src/input/gamepad/events/index.js new file mode 100644 index 000000000..450913184 --- /dev/null +++ b/src/input/gamepad/events/index.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Gamepad.Events + */ + +module.exports = { + + BUTTON_DOWN: require('./BUTTON_DOWN_EVENT'), + BUTTON_UP: require('./BUTTON_UP_EVENT'), + CONNECTED: require('./CONNECTED_EVENT'), + DISCONNECTED: require('./DISCONNECTED_EVENT'), + GAMEPAD_BUTTON_DOWN: require('./GAMEPAD_BUTTON_DOWN_EVENT'), + GAMEPAD_BUTTON_UP: require('./GAMEPAD_BUTTON_UP_EVENT') + +}; diff --git a/src/input/gamepad/index.js b/src/input/gamepad/index.js index fdc9b5b1b..5076cf7d8 100644 --- a/src/input/gamepad/index.js +++ b/src/input/gamepad/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ module.exports = { Axis: require('./Axis'), Button: require('./Button'), + Events: require('./events'), Gamepad: require('./Gamepad'), GamepadPlugin: require('./GamepadPlugin'), diff --git a/src/input/gamepad/typedefs/Pad.js b/src/input/gamepad/typedefs/Pad.js new file mode 100644 index 000000000..58998450b --- /dev/null +++ b/src/input/gamepad/typedefs/Pad.js @@ -0,0 +1,9 @@ +/** + * The Gamepad object, as extracted from GamepadEvent. + * + * @typedef {object} Phaser.Input.Gamepad.Types.Pad + * @since 3.10.0 + * + * @property {string} id - The ID of the Gamepad. + * @property {integer} index - The index of the Gamepad. + */ diff --git a/src/input/gamepad/typedefs/index.js b/src/input/gamepad/typedefs/index.js new file mode 100644 index 000000000..9a7d11c4c --- /dev/null +++ b/src/input/gamepad/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Gamepad.Types + */ diff --git a/src/input/index.js b/src/input/index.js index d1626c1c3..67d39a601 100644 --- a/src/input/index.js +++ b/src/input/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,6 +14,7 @@ var Extend = require('../utils/object/Extend'); var Input = { CreateInteractiveObject: require('./CreateInteractiveObject'), + Events: require('./events'), Gamepad: require('./gamepad'), InputManager: require('./InputManager'), InputPlugin: require('./InputPlugin'), diff --git a/src/input/keyboard/KeyboardManager.js b/src/input/keyboard/KeyboardManager.js index 270dfb5ce..9102d5e8b 100644 --- a/src/input/keyboard/KeyboardManager.js +++ b/src/input/keyboard/KeyboardManager.js @@ -1,11 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var ArrayRemove = require('../../utils/array/Remove'); var Class = require('../../utils/Class'); +var GameEvents = require('../../core/events'); +var InputEvents = require('../events'); var KeyCodes = require('../../input/keyboard/keys/KeyCodes'); var NOOP = require('../../utils/Class'); @@ -72,7 +74,7 @@ var KeyboardManager = new Class({ * An array of Key Code values that will automatically have `preventDefault` called on them, * as long as the `KeyboardManager.preventDefault` boolean is set to `true`. * - * By default the array contains: The Space Key, the Cursor Keys, 0 to 9 and A to Z. + * By default the array is empty. * * The key must be non-modified when pressed in order to be captured. * @@ -138,7 +140,7 @@ var KeyboardManager = new Class({ */ this.onKeyUp = NOOP; - inputManager.events.once('boot', this.boot, this); + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -167,7 +169,7 @@ var KeyboardManager = new Class({ this.startListeners(); } - this.manager.game.events.on('poststep', this.postUpdate, this); + this.manager.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); }, /** @@ -190,6 +192,11 @@ var KeyboardManager = new Class({ } _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); @@ -206,8 +213,13 @@ var KeyboardManager = new Class({ // Do nothing if event already handled return; } - + _this.queue.push(event); + + if (!_this.manager.useQueue) + { + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); + } var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); @@ -317,7 +329,7 @@ var KeyboardManager = new Class({ if (typeof code === 'string') { - code = KeyCodes[code.toUpperCase()]; + code = KeyCodes[code.trim().toUpperCase()]; } if (captures.indexOf(code) === -1) @@ -420,7 +432,7 @@ var KeyboardManager = new Class({ this.queue = []; - this.manager.game.events.off('poststep', this.postUpdate, this); + this.manager.game.events.off(GameEvents.POST_RENDER, this.postUpdate, this); this.target = null; this.enabled = false; diff --git a/src/input/keyboard/KeyboardPlugin.js b/src/input/keyboard/KeyboardPlugin.js index 69fda30b0..d017c4712 100644 --- a/src/input/keyboard/KeyboardPlugin.js +++ b/src/input/keyboard/KeyboardPlugin.js @@ -1,12 +1,15 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); +var GameEvents = require('../../core/events'); var GetValue = require('../../utils/object/GetValue'); +var InputEvents = require('../events'); var InputPluginCache = require('../InputPluginCache'); var Key = require('./keys/Key'); var KeyCodes = require('./keys/KeyCodes'); @@ -31,7 +34,7 @@ var SnapFloor = require('../../math/snap/SnapFloor'); * Or, to listen for a specific key: * * ```javascript - * this.input.keyboard.on('keydown_A', callback, context); + * this.input.keyboard.on('keydown-A', callback, context); * ``` * * You can also create Key objects, which you can then poll in your game loop: @@ -69,6 +72,15 @@ var KeyboardPlugin = new Class({ { EventEmitter.call(this); + /** + * A reference to the core game, so we can listen for visibility events. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#game + * @type {Phaser.Game} + * @since 3.16.0 + */ + this.game = sceneInputPlugin.systems.game; + /** * A reference to the Scene that this Input Plugin is responsible for. * @@ -82,7 +94,7 @@ var KeyboardPlugin = new Class({ * A reference to the Scene Systems Settings. * * @name Phaser.Input.Keyboard.KeyboardPlugin#settings - * @type {Phaser.Scenes.Settings.Object} + * @type {Phaser.Scenes.Types.SettingsObject} * @since 3.10.0 */ this.settings = this.scene.sys.settings; @@ -134,18 +146,8 @@ var KeyboardPlugin = new Class({ */ this.combos = []; - /** - * Internal time value. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#time - * @type {number} - * @private - * @since 3.11.0 - */ - this.time = 0; - - sceneInputPlugin.pluginEvents.once('boot', this.boot, this); - sceneInputPlugin.pluginEvents.on('start', this.start, this); + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** @@ -169,7 +171,7 @@ var KeyboardPlugin = new Class({ this.addCaptures(captures); } - this.sceneInputPlugin.pluginEvents.once('destroy', this.destroy, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** @@ -183,9 +185,18 @@ var KeyboardPlugin = new Class({ */ start: function () { - this.startListeners(); + if (this.sceneInputPlugin.manager.useQueue) + { + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.on(InputEvents.MANAGER_PROCESS, this.update, this); + } - this.sceneInputPlugin.pluginEvents.once('shutdown', this.shutdown, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); + + this.game.events.on(GameEvents.BLUR, this.resetKeys, this); }, /** @@ -201,32 +212,6 @@ var KeyboardPlugin = new Class({ return (this.enabled && this.scene.sys.isActive()); }, - /** - * Starts the Keyboard Event listeners running. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#startListeners - * @private - * @since 3.10.0 - */ - startListeners: function () - { - this.sceneInputPlugin.pluginEvents.on('update', this.update, this); - }, - - /** - * Stops the Keyboard Event listeners. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#stopListeners - * @private - * @since 3.10.0 - */ - stopListeners: function () - { - this.sceneInputPlugin.pluginEvents.off('update', this.update); - }, - /** * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. @@ -377,25 +362,13 @@ var KeyboardPlugin = new Class({ return this; }, - /** - * @typedef {object} CursorKeys - * @memberof Phaser.Input.Keyboard - * - * @property {Phaser.Input.Keyboard.Key} [up] - A Key object mapping to the UP arrow key. - * @property {Phaser.Input.Keyboard.Key} [down] - A Key object mapping to the DOWN arrow key. - * @property {Phaser.Input.Keyboard.Key} [left] - A Key object mapping to the LEFT arrow key. - * @property {Phaser.Input.Keyboard.Key} [right] - A Key object mapping to the RIGHT arrow key. - * @property {Phaser.Input.Keyboard.Key} [space] - A Key object mapping to the SPACE BAR key. - * @property {Phaser.Input.Keyboard.Key} [shift] - A Key object mapping to the SHIFT key. - */ - /** * Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right, and also Space Bar and shift. * * @method Phaser.Input.Keyboard.KeyboardPlugin#createCursorKeys * @since 3.10.0 * - * @return {CursorKeys} An object containing the properties: `up`, `down`, `left`, `right`, `space` and `shift`. + * @return {Phaser.Input.Keyboard.Types.CursorKeys} An object containing the properties: `up`, `down`, `left`, `right`, `space` and `shift`. */ createCursorKeys: function () { @@ -608,7 +581,7 @@ var KeyboardPlugin = new Class({ * @since 3.10.0 * * @param {(string|integer[]|object[])} keys - The keys that comprise this combo. - * @param {KeyComboConfig} [config] - A Key Combo configuration object. + * @param {Phaser.Input.Keyboard.Types.KeyComboConfig} [config] - A Key Combo configuration object. * * @return {Phaser.Input.Keyboard.KeyCombo} The new KeyCombo object. */ @@ -633,7 +606,7 @@ var KeyboardPlugin = new Class({ * @param {Phaser.Input.Keyboard.Key} key - A Key object. * @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down. * - * @return {boolean} `True` if the Key is down within the duration specified, otherwise `false`. + * @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`. */ checkDown: function (key, duration) { @@ -658,13 +631,9 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#update * @private * @since 3.10.0 - * - * @param {number} time - The game loop time value. */ - update: function (time) + update: function () { - this.time = time; - var queue = this.manager.queue; var len = queue.length; @@ -720,16 +689,18 @@ var KeyboardPlugin = new Class({ if (!event.cancelled && (!key || !repeat)) { - // keydown_code event if (KeyMap[code]) { + this.emit(Events.KEY_DOWN + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. this.emit('keydown_' + KeyMap[code], event); } if (!event.cancelled) { - // keydown event - this.emit(event.type, event); + this.emit(Events.ANY_KEY_DOWN, event); } } } @@ -743,16 +714,18 @@ var KeyboardPlugin = new Class({ if (!event.cancelled) { - // keyup_code event if (KeyMap[code]) { + this.emit(Events.KEY_UP + KeyMap[code], event); + + // Deprecated, kept in for compatibility with 3.15 + // To be removed by 3.20. this.emit('keyup_' + KeyMap[code], event); } if (!event.cancelled) { - // keyup event - this.emit(event.type, event); + this.emit(Events.ANY_KEY_UP, event); } } } @@ -767,7 +740,7 @@ var KeyboardPlugin = new Class({ /** * Resets all Key objects created by _this_ Keyboard Plugin back to their default un-pressed states. - * This can only reset keys created via the `addKey`, `addKeys` or `createCursors` methods. + * This can only reset keys created via the `addKey`, `addKeys` or `createCursorKeys` methods. * If you have created a Key object directly you'll need to reset it yourself. * * This method is called automatically when the Keyboard Plugin shuts down, but can be @@ -809,7 +782,16 @@ var KeyboardPlugin = new Class({ { this.resetKeys(); - this.stopListeners(); + if (this.sceneInputPlugin.manager.useQueue) + { + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update, this); + } + else + { + this.sceneInputPlugin.manager.events.off(InputEvents.MANAGER_PROCESS, this.update, this); + } + + this.game.events.off(GameEvents.BLUR, this.resetKeys); this.removeAllListeners(); @@ -846,6 +828,23 @@ var KeyboardPlugin = new Class({ this.settings = null; this.sceneInputPlugin = null; this.manager = null; + }, + + /** + * Internal time value. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#time + * @type {number} + * @private + * @since 3.11.0 + */ + time: { + + get: function () + { + return this.sceneInputPlugin.manager.time; + } + } }); diff --git a/src/input/keyboard/combo/AdvanceKeyCombo.js b/src/input/keyboard/combo/AdvanceKeyCombo.js index ac71a8fe7..45cb00526 100644 --- a/src/input/keyboard/combo/AdvanceKeyCombo.js +++ b/src/input/keyboard/combo/AdvanceKeyCombo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/combo/KeyCombo.js b/src/input/keyboard/combo/KeyCombo.js index f3e6a6321..b82d4264e 100644 --- a/src/input/keyboard/combo/KeyCombo.js +++ b/src/input/keyboard/combo/KeyCombo.js @@ -1,29 +1,15 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../../utils/Class'); +var Events = require('../events'); var GetFastValue = require('../../../utils/object/GetFastValue'); var ProcessKeyCombo = require('./ProcessKeyCombo'); var ResetKeyCombo = require('./ResetKeyCombo'); -/** - * @callback KeyboardKeydownCallback - * - * @param {KeyboardEvent} event - The Keyboard Event. - */ - -/** - * @typedef {object} KeyComboConfig - * - * @property {boolean} [resetOnWrongKey=true] - If they press the wrong key do we reset the combo? - * @property {number} [maxKeyDelay=0] - The max delay in ms between each key press. Above this the combo is reset. 0 means disabled. - * @property {boolean} [resetOnMatch=false] - If previously matched and they press the first key of the combo again, will it reset? - * @property {boolean} [deleteOnMatch=false] - If the combo matches, will it delete itself? - */ - /** * @classdesc * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them @@ -55,11 +41,12 @@ var ResetKeyCombo = require('./ResetKeyCombo'); * @class KeyCombo * @memberof Phaser.Input.Keyboard * @constructor + * @listens Phaser.Input.Keyboard.Events#ANY_KEY_DOWN * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. * @param {(string|integer[]|object[])} keys - The keys that comprise this combo. - * @param {KeyComboConfig} [config] - A Key Combo configuration object. + * @param {Phaser.Input.Keyboard.Types.KeyComboConfig} [config] - A Key Combo configuration object. */ var KeyCombo = new Class({ @@ -235,7 +222,7 @@ var KeyCombo = new Class({ if (matched) { - _this.manager.emit('keycombomatch', _this, event); + _this.manager.emit(Events.COMBO_MATCH, _this, event); if (_this.resetOnMatch) { @@ -254,11 +241,12 @@ var KeyCombo = new Class({ * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown * @private * @type {KeyboardKeydownCallback} + * @fires Phaser.Input.Keyboard.Events#COMBO_MATCH * @since 3.0.0 */ this.onKeyDown = onKeyDownHandler; - this.manager.on('keydown', onKeyDownHandler); + this.manager.on(Events.ANY_KEY_DOWN, this.onKeyDown); }, /** @@ -289,7 +277,7 @@ var KeyCombo = new Class({ this.enabled = false; this.keyCodes = []; - this.manager.off('keydown', this.onKeyDown); + this.manager.off(Events.ANY_KEY_DOWN, this.onKeyDown); this.manager = null; } diff --git a/src/input/keyboard/combo/ProcessKeyCombo.js b/src/input/keyboard/combo/ProcessKeyCombo.js index 8fadcad8a..3d33937a9 100644 --- a/src/input/keyboard/combo/ProcessKeyCombo.js +++ b/src/input/keyboard/combo/ProcessKeyCombo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/combo/ResetKeyCombo.js b/src/input/keyboard/combo/ResetKeyCombo.js index ac1cc695e..715cd2ced 100644 --- a/src/input/keyboard/combo/ResetKeyCombo.js +++ b/src/input/keyboard/combo/ResetKeyCombo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/events/ANY_KEY_DOWN_EVENT.js b/src/input/keyboard/events/ANY_KEY_DOWN_EVENT.js new file mode 100644 index 000000000..b3778b7ea --- /dev/null +++ b/src/input/keyboard/events/ANY_KEY_DOWN_EVENT.js @@ -0,0 +1,30 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`. + * + * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_DOWN + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown'; diff --git a/src/input/keyboard/events/ANY_KEY_UP_EVENT.js b/src/input/keyboard/events/ANY_KEY_UP_EVENT.js new file mode 100644 index 000000000..488945c2b --- /dev/null +++ b/src/input/keyboard/events/ANY_KEY_UP_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Global Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`. + * + * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_UP + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup'; diff --git a/src/input/keyboard/events/COMBO_MATCH_EVENT.js b/src/input/keyboard/events/COMBO_MATCH_EVENT.js new file mode 100644 index 000000000..a47fc0c8d --- /dev/null +++ b/src/input/keyboard/events/COMBO_MATCH_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Combo Match Event. + * + * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched. + * + * Listen for this event from the Key Plugin after a combo has been created: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * @event Phaser.Input.Keyboard.Events#COMBO_MATCH + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.KeyCombo} keycombo - The Key Combo object that was matched. + * @param {KeyboardEvent} event - The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'keycombomatch'; diff --git a/src/input/keyboard/events/DOWN_EVENT.js b/src/input/keyboard/events/DOWN_EVENT.js new file mode 100644 index 000000000..18d19d76d --- /dev/null +++ b/src/input/keyboard/events/DOWN_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('down', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * @event Phaser.Input.Keyboard.Events#DOWN + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was pressed. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'down'; diff --git a/src/input/keyboard/events/KEY_DOWN_EVENT.js b/src/input/keyboard/events/KEY_DOWN_EVENT.js new file mode 100644 index 000000000..2d14f888e --- /dev/null +++ b/src/input/keyboard/events/KEY_DOWN_EVENT.js @@ -0,0 +1,33 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed + * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keydown-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#KEY_DOWN + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown-'; diff --git a/src/input/keyboard/events/KEY_UP_EVENT.js b/src/input/keyboard/events/KEY_UP_EVENT.js new file mode 100644 index 000000000..362be28d7 --- /dev/null +++ b/src/input/keyboard/events/KEY_UP_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released + * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keyup-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#KEY_UP + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + */ +module.exports = 'keyup-'; diff --git a/src/input/keyboard/events/UP_EVENT.js b/src/input/keyboard/events/UP_EVENT.js new file mode 100644 index 000000000..653b55c59 --- /dev/null +++ b/src/input/keyboard/events/UP_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Key Up Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('up', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * @event Phaser.Input.Keyboard.Events#UP + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was released. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + */ +module.exports = 'up'; diff --git a/src/input/keyboard/events/index.js b/src/input/keyboard/events/index.js new file mode 100644 index 000000000..c28586dd9 --- /dev/null +++ b/src/input/keyboard/events/index.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Keyboard.Events + */ + +module.exports = { + + ANY_KEY_DOWN: require('./ANY_KEY_DOWN_EVENT'), + ANY_KEY_UP: require('./ANY_KEY_UP_EVENT'), + COMBO_MATCH: require('./COMBO_MATCH_EVENT'), + DOWN: require('./DOWN_EVENT'), + KEY_DOWN: require('./KEY_DOWN_EVENT'), + KEY_UP: require('./KEY_UP_EVENT'), + UP: require('./UP_EVENT') + +}; diff --git a/src/input/keyboard/index.js b/src/input/keyboard/index.js index 2aad578fd..02ac95caa 100644 --- a/src/input/keyboard/index.js +++ b/src/input/keyboard/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,6 +10,8 @@ module.exports = { + Events: require('./events'), + KeyboardManager: require('./KeyboardManager'), KeyboardPlugin: require('./KeyboardPlugin'), diff --git a/src/input/keyboard/keys/DownDuration.js b/src/input/keyboard/keys/DownDuration.js index cc94f140a..7a038db51 100644 --- a/src/input/keyboard/keys/DownDuration.js +++ b/src/input/keyboard/keys/DownDuration.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/keys/JustDown.js b/src/input/keyboard/keys/JustDown.js index 541548f0c..c544f1607 100644 --- a/src/input/keyboard/keys/JustDown.js +++ b/src/input/keyboard/keys/JustDown.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/keys/JustUp.js b/src/input/keyboard/keys/JustUp.js index 676647223..07c1b0c5e 100644 --- a/src/input/keyboard/keys/JustUp.js +++ b/src/input/keyboard/keys/JustUp.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/keys/Key.js b/src/input/keyboard/keys/Key.js index da337a0fe..41d8df3ad 100644 --- a/src/input/keyboard/keys/Key.js +++ b/src/input/keyboard/keys/Key.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../../utils/Class'); var EventEmitter = require('eventemitter3'); +var Events = require('../events'); /** * @classdesc @@ -238,6 +239,7 @@ var Key = new Class({ * Called automatically by the Keyboard Plugin. * * @method Phaser.Input.Keyboard.Key#onDown + * @fires Phaser.Input.Keyboard.Events#DOWN * @since 3.16.0 * * @param {KeyboardEvent} event - The native DOM Keyboard event. @@ -268,11 +270,11 @@ var Key = new Class({ this._justDown = true; this._justUp = false; - this.emit('down', this, event); + this.emit(Events.DOWN, this, event); } else if (this.emitOnRepeat) { - this.emit('down', this, event); + this.emit(Events.DOWN, this, event); } }, @@ -281,6 +283,7 @@ var Key = new Class({ * Called automatically by the Keyboard Plugin. * * @method Phaser.Input.Keyboard.Key#onUp + * @fires Phaser.Input.Keyboard.Events#UP * @since 3.16.0 * * @param {KeyboardEvent} event - The native DOM Keyboard event. @@ -304,7 +307,7 @@ var Key = new Class({ this._justUp = true; this._tick = -1; - this.emit('up', this, event); + this.emit(Events.UP, this, event); }, /** diff --git a/src/input/keyboard/keys/KeyCodes.js b/src/input/keyboard/keys/KeyCodes.js index e09c91922..06038b20b 100644 --- a/src/input/keyboard/keys/KeyCodes.js +++ b/src/input/keyboard/keys/KeyCodes.js @@ -1,498 +1,880 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Keyboard Codes. * - * @name Phaser.Input.Keyboard.KeyCodes - * @enum {integer} + * @namespace Phaser.Input.Keyboard.KeyCodes * @memberof Phaser.Input.Keyboard - * @readonly * @since 3.0.0 */ var KeyCodes = { /** + * The BACKSPACE key. + * * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE + * @type {integer} + * @since 3.0.0 */ BACKSPACE: 8, /** + * The TAB key. + * * @name Phaser.Input.Keyboard.KeyCodes.TAB + * @type {integer} + * @since 3.0.0 */ TAB: 9, /** + * The ENTER key. + * * @name Phaser.Input.Keyboard.KeyCodes.ENTER + * @type {integer} + * @since 3.0.0 */ ENTER: 13, /** + * The SHIFT key. + * * @name Phaser.Input.Keyboard.KeyCodes.SHIFT + * @type {integer} + * @since 3.0.0 */ SHIFT: 16, /** + * The CTRL key. + * * @name Phaser.Input.Keyboard.KeyCodes.CTRL + * @type {integer} + * @since 3.0.0 */ CTRL: 17, /** + * The ALT key. + * * @name Phaser.Input.Keyboard.KeyCodes.ALT + * @type {integer} + * @since 3.0.0 */ ALT: 18, /** + * The PAUSE key. + * * @name Phaser.Input.Keyboard.KeyCodes.PAUSE + * @type {integer} + * @since 3.0.0 */ PAUSE: 19, /** + * The CAPS_LOCK key. + * * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK + * @type {integer} + * @since 3.0.0 */ CAPS_LOCK: 20, /** + * The ESC key. + * * @name Phaser.Input.Keyboard.KeyCodes.ESC + * @type {integer} + * @since 3.0.0 */ ESC: 27, /** + * The SPACE key. + * * @name Phaser.Input.Keyboard.KeyCodes.SPACE + * @type {integer} + * @since 3.0.0 */ SPACE: 32, /** + * The PAGE_UP key. + * * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP + * @type {integer} + * @since 3.0.0 */ PAGE_UP: 33, /** + * The PAGE_DOWN key. + * * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN + * @type {integer} + * @since 3.0.0 */ PAGE_DOWN: 34, /** + * The END key. + * * @name Phaser.Input.Keyboard.KeyCodes.END + * @type {integer} + * @since 3.0.0 */ END: 35, /** + * The HOME key. + * * @name Phaser.Input.Keyboard.KeyCodes.HOME + * @type {integer} + * @since 3.0.0 */ HOME: 36, /** + * The LEFT key. + * * @name Phaser.Input.Keyboard.KeyCodes.LEFT + * @type {integer} + * @since 3.0.0 */ LEFT: 37, /** + * The UP key. + * * @name Phaser.Input.Keyboard.KeyCodes.UP + * @type {integer} + * @since 3.0.0 */ UP: 38, /** + * The RIGHT key. + * * @name Phaser.Input.Keyboard.KeyCodes.RIGHT + * @type {integer} + * @since 3.0.0 */ RIGHT: 39, /** + * The DOWN key. + * * @name Phaser.Input.Keyboard.KeyCodes.DOWN + * @type {integer} + * @since 3.0.0 */ DOWN: 40, /** + * The PRINT_SCREEN key. + * * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN + * @type {integer} + * @since 3.0.0 */ PRINT_SCREEN: 42, /** + * The INSERT key. + * * @name Phaser.Input.Keyboard.KeyCodes.INSERT + * @type {integer} + * @since 3.0.0 */ INSERT: 45, /** + * The DELETE key. + * * @name Phaser.Input.Keyboard.KeyCodes.DELETE + * @type {integer} + * @since 3.0.0 */ DELETE: 46, /** + * The ZERO key. + * * @name Phaser.Input.Keyboard.KeyCodes.ZERO + * @type {integer} + * @since 3.0.0 */ ZERO: 48, /** + * The ONE key. + * * @name Phaser.Input.Keyboard.KeyCodes.ONE + * @type {integer} + * @since 3.0.0 */ ONE: 49, /** + * The TWO key. + * * @name Phaser.Input.Keyboard.KeyCodes.TWO + * @type {integer} + * @since 3.0.0 */ TWO: 50, /** + * The THREE key. + * * @name Phaser.Input.Keyboard.KeyCodes.THREE + * @type {integer} + * @since 3.0.0 */ THREE: 51, /** + * The FOUR key. + * * @name Phaser.Input.Keyboard.KeyCodes.FOUR + * @type {integer} + * @since 3.0.0 */ FOUR: 52, /** + * The FIVE key. + * * @name Phaser.Input.Keyboard.KeyCodes.FIVE + * @type {integer} + * @since 3.0.0 */ FIVE: 53, /** + * The SIX key. + * * @name Phaser.Input.Keyboard.KeyCodes.SIX + * @type {integer} + * @since 3.0.0 */ SIX: 54, /** + * The SEVEN key. + * * @name Phaser.Input.Keyboard.KeyCodes.SEVEN + * @type {integer} + * @since 3.0.0 */ SEVEN: 55, /** + * The EIGHT key. + * * @name Phaser.Input.Keyboard.KeyCodes.EIGHT + * @type {integer} + * @since 3.0.0 */ EIGHT: 56, /** + * The NINE key. + * * @name Phaser.Input.Keyboard.KeyCodes.NINE + * @type {integer} + * @since 3.0.0 */ NINE: 57, /** + * The NUMPAD_ZERO key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO + * @type {integer} + * @since 3.0.0 */ NUMPAD_ZERO: 96, /** + * The NUMPAD_ONE key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE + * @type {integer} + * @since 3.0.0 */ NUMPAD_ONE: 97, /** + * The NUMPAD_TWO key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO + * @type {integer} + * @since 3.0.0 */ NUMPAD_TWO: 98, /** + * The NUMPAD_THREE key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE + * @type {integer} + * @since 3.0.0 */ NUMPAD_THREE: 99, /** + * The NUMPAD_FOUR key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR + * @type {integer} + * @since 3.0.0 */ NUMPAD_FOUR: 100, /** + * The NUMPAD_FIVE key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE + * @type {integer} + * @since 3.0.0 */ NUMPAD_FIVE: 101, /** + * The NUMPAD_SIX key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX + * @type {integer} + * @since 3.0.0 */ NUMPAD_SIX: 102, /** + * The NUMPAD_SEVEN key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN + * @type {integer} + * @since 3.0.0 */ NUMPAD_SEVEN: 103, /** + * The NUMPAD_EIGHT key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT + * @type {integer} + * @since 3.0.0 */ NUMPAD_EIGHT: 104, /** + * The NUMPAD_NINE key. + * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE + * @type {integer} + * @since 3.0.0 */ NUMPAD_NINE: 105, /** + * The A key. + * * @name Phaser.Input.Keyboard.KeyCodes.A + * @type {integer} + * @since 3.0.0 */ A: 65, /** + * The B key. + * * @name Phaser.Input.Keyboard.KeyCodes.B + * @type {integer} + * @since 3.0.0 */ B: 66, /** + * The C key. + * * @name Phaser.Input.Keyboard.KeyCodes.C + * @type {integer} + * @since 3.0.0 */ C: 67, /** + * The D key. + * * @name Phaser.Input.Keyboard.KeyCodes.D + * @type {integer} + * @since 3.0.0 */ D: 68, /** + * The E key. + * * @name Phaser.Input.Keyboard.KeyCodes.E + * @type {integer} + * @since 3.0.0 */ E: 69, /** + * The F key. + * * @name Phaser.Input.Keyboard.KeyCodes.F + * @type {integer} + * @since 3.0.0 */ F: 70, /** + * The G key. + * * @name Phaser.Input.Keyboard.KeyCodes.G + * @type {integer} + * @since 3.0.0 */ G: 71, /** + * The H key. + * * @name Phaser.Input.Keyboard.KeyCodes.H + * @type {integer} + * @since 3.0.0 */ H: 72, /** + * The I key. + * * @name Phaser.Input.Keyboard.KeyCodes.I + * @type {integer} + * @since 3.0.0 */ I: 73, /** + * The J key. + * * @name Phaser.Input.Keyboard.KeyCodes.J + * @type {integer} + * @since 3.0.0 */ J: 74, /** + * The K key. + * * @name Phaser.Input.Keyboard.KeyCodes.K + * @type {integer} + * @since 3.0.0 */ K: 75, /** + * The L key. + * * @name Phaser.Input.Keyboard.KeyCodes.L + * @type {integer} + * @since 3.0.0 */ L: 76, /** + * The M key. + * * @name Phaser.Input.Keyboard.KeyCodes.M + * @type {integer} + * @since 3.0.0 */ M: 77, /** + * The N key. + * * @name Phaser.Input.Keyboard.KeyCodes.N + * @type {integer} + * @since 3.0.0 */ N: 78, /** + * The O key. + * * @name Phaser.Input.Keyboard.KeyCodes.O + * @type {integer} + * @since 3.0.0 */ O: 79, /** + * The P key. + * * @name Phaser.Input.Keyboard.KeyCodes.P + * @type {integer} + * @since 3.0.0 */ P: 80, /** + * The Q key. + * * @name Phaser.Input.Keyboard.KeyCodes.Q + * @type {integer} + * @since 3.0.0 */ Q: 81, /** + * The R key. + * * @name Phaser.Input.Keyboard.KeyCodes.R + * @type {integer} + * @since 3.0.0 */ R: 82, /** + * The S key. + * * @name Phaser.Input.Keyboard.KeyCodes.S + * @type {integer} + * @since 3.0.0 */ S: 83, /** + * The T key. + * * @name Phaser.Input.Keyboard.KeyCodes.T + * @type {integer} + * @since 3.0.0 */ T: 84, /** + * The U key. + * * @name Phaser.Input.Keyboard.KeyCodes.U + * @type {integer} + * @since 3.0.0 */ U: 85, /** + * The V key. + * * @name Phaser.Input.Keyboard.KeyCodes.V + * @type {integer} + * @since 3.0.0 */ V: 86, /** + * The W key. + * * @name Phaser.Input.Keyboard.KeyCodes.W + * @type {integer} + * @since 3.0.0 */ W: 87, /** + * The X key. + * * @name Phaser.Input.Keyboard.KeyCodes.X + * @type {integer} + * @since 3.0.0 */ X: 88, /** + * The Y key. + * * @name Phaser.Input.Keyboard.KeyCodes.Y + * @type {integer} + * @since 3.0.0 */ Y: 89, /** + * The Z key. + * * @name Phaser.Input.Keyboard.KeyCodes.Z + * @type {integer} + * @since 3.0.0 */ Z: 90, /** + * The F1 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F1 + * @type {integer} + * @since 3.0.0 */ F1: 112, /** + * The F2 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F2 + * @type {integer} + * @since 3.0.0 */ F2: 113, /** + * The F3 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F3 + * @type {integer} + * @since 3.0.0 */ F3: 114, /** + * The F4 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F4 + * @type {integer} + * @since 3.0.0 */ F4: 115, /** + * The F5 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F5 + * @type {integer} + * @since 3.0.0 */ F5: 116, /** + * The F6 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F6 + * @type {integer} + * @since 3.0.0 */ F6: 117, /** + * The F7 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F7 + * @type {integer} + * @since 3.0.0 */ F7: 118, /** + * The F8 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F8 + * @type {integer} + * @since 3.0.0 */ F8: 119, /** + * The F9 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F9 + * @type {integer} + * @since 3.0.0 */ F9: 120, /** + * The F10 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F10 + * @type {integer} + * @since 3.0.0 */ F10: 121, /** + * The F11 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F11 + * @type {integer} + * @since 3.0.0 */ F11: 122, /** + * The F12 key. + * * @name Phaser.Input.Keyboard.KeyCodes.F12 + * @type {integer} + * @since 3.0.0 */ F12: 123, /** + * The SEMICOLON key. + * * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON + * @type {integer} + * @since 3.0.0 */ SEMICOLON: 186, /** + * The PLUS key. + * * @name Phaser.Input.Keyboard.KeyCodes.PLUS + * @type {integer} + * @since 3.0.0 */ PLUS: 187, /** + * The COMMA key. + * * @name Phaser.Input.Keyboard.KeyCodes.COMMA + * @type {integer} + * @since 3.0.0 */ COMMA: 188, /** + * The MINUS key. + * * @name Phaser.Input.Keyboard.KeyCodes.MINUS + * @type {integer} + * @since 3.0.0 */ MINUS: 189, /** + * The PERIOD key. + * * @name Phaser.Input.Keyboard.KeyCodes.PERIOD + * @type {integer} + * @since 3.0.0 */ PERIOD: 190, /** + * The FORWARD_SLASH key. + * * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH + * @type {integer} + * @since 3.0.0 */ FORWARD_SLASH: 191, /** + * The BACK_SLASH key. + * * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH + * @type {integer} + * @since 3.0.0 */ BACK_SLASH: 220, /** + * The QUOTES key. + * * @name Phaser.Input.Keyboard.KeyCodes.QUOTES + * @type {integer} + * @since 3.0.0 */ QUOTES: 222, /** + * The BACKTICK key. + * * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK + * @type {integer} + * @since 3.0.0 */ BACKTICK: 192, /** + * The OPEN_BRACKET key. + * * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET + * @type {integer} + * @since 3.0.0 */ OPEN_BRACKET: 219, /** + * The CLOSED_BRACKET key. + * * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET + * @type {integer} + * @since 3.0.0 */ CLOSED_BRACKET: 221, /** + * The SEMICOLON_FIREFOX key. + * * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX + * @type {integer} + * @since 3.0.0 */ SEMICOLON_FIREFOX: 59, /** + * The COLON key. + * * @name Phaser.Input.Keyboard.KeyCodes.COLON + * @type {integer} + * @since 3.0.0 */ COLON: 58, /** + * The COMMA_FIREFOX_WINDOWS key. + * * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS + * @type {integer} + * @since 3.0.0 */ COMMA_FIREFOX_WINDOWS: 60, /** + * The COMMA_FIREFOX key. + * * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX + * @type {integer} + * @since 3.0.0 */ COMMA_FIREFOX: 62, /** + * The BRACKET_RIGHT_FIREFOX key. + * * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX + * @type {integer} + * @since 3.0.0 */ BRACKET_RIGHT_FIREFOX: 174, /** + * The BRACKET_LEFT_FIREFOX key. + * * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX + * @type {integer} + * @since 3.0.0 */ BRACKET_LEFT_FIREFOX: 175 }; diff --git a/src/input/keyboard/keys/KeyMap.js b/src/input/keyboard/keys/KeyMap.js index a1cf93bdc..329eb7efd 100644 --- a/src/input/keyboard/keys/KeyMap.js +++ b/src/input/keyboard/keys/KeyMap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/keys/UpDuration.js b/src/input/keyboard/keys/UpDuration.js index bf8c32677..24c5fa7a2 100644 --- a/src/input/keyboard/keys/UpDuration.js +++ b/src/input/keyboard/keys/UpDuration.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/keyboard/typedefs/CursorKeys.js b/src/input/keyboard/typedefs/CursorKeys.js new file mode 100644 index 000000000..311c4201c --- /dev/null +++ b/src/input/keyboard/typedefs/CursorKeys.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.Input.Keyboard.Types.CursorKeys + * @since 3.0.0 + * + * @property {Phaser.Input.Keyboard.Key} [up] - A Key object mapping to the UP arrow key. + * @property {Phaser.Input.Keyboard.Key} [down] - A Key object mapping to the DOWN arrow key. + * @property {Phaser.Input.Keyboard.Key} [left] - A Key object mapping to the LEFT arrow key. + * @property {Phaser.Input.Keyboard.Key} [right] - A Key object mapping to the RIGHT arrow key. + * @property {Phaser.Input.Keyboard.Key} [space] - A Key object mapping to the SPACE BAR key. + * @property {Phaser.Input.Keyboard.Key} [shift] - A Key object mapping to the SHIFT key. + */ diff --git a/src/input/keyboard/typedefs/KeyComboConfig.js b/src/input/keyboard/typedefs/KeyComboConfig.js new file mode 100644 index 000000000..ee53723a4 --- /dev/null +++ b/src/input/keyboard/typedefs/KeyComboConfig.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Input.Keyboard.Types.KeyComboConfig + * @since 3.0.0 + * + * @property {boolean} [resetOnWrongKey=true] - If they press the wrong key do we reset the combo? + * @property {number} [maxKeyDelay=0] - The max delay in ms between each key press. Above this the combo is reset. 0 means disabled. + * @property {boolean} [resetOnMatch=false] - If previously matched and they press the first key of the combo again, will it reset? + * @property {boolean} [deleteOnMatch=false] - If the combo matches, will it delete itself? + */ diff --git a/src/input/keyboard/typedefs/KeyboardKeydownCallback.js b/src/input/keyboard/typedefs/KeyboardKeydownCallback.js new file mode 100644 index 000000000..ad308f97b --- /dev/null +++ b/src/input/keyboard/typedefs/KeyboardKeydownCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.Input.Keyboard.Types.KeyboardKeydownCallback + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The Keyboard Event. + */ diff --git a/src/input/keyboard/typedefs/index.js b/src/input/keyboard/typedefs/index.js new file mode 100644 index 000000000..1284a2f6b --- /dev/null +++ b/src/input/keyboard/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Keyboard.Types + */ diff --git a/src/input/mouse/MouseManager.js b/src/input/mouse/MouseManager.js index 882f39a9a..9907e78c6 100644 --- a/src/input/mouse/MouseManager.js +++ b/src/input/mouse/MouseManager.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var Features = require('../../device/Features'); +var InputEvents = require('../events'); var NOOP = require('../../utils/Class'); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent @@ -115,6 +116,28 @@ var MouseManager = new Class({ */ this.onMouseUp = NOOP; + /** + * The Mouse Down Event handler specifically for events on the Window. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseDownWindow + * @type {function} + * @since 3.17.0 + */ + this.onMouseDownWindow = NOOP; + + /** + * The Mouse Up Event handler specifically for events on the Window. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseUpWindow + * @type {function} + * @since 3.17.0 + */ + this.onMouseUpWindow = NOOP; + /** * The Mouse Over Event handler. * This function is sent the native DOM MouseEvent. @@ -148,7 +171,7 @@ var MouseManager = new Class({ */ this.pointerLockChange = NOOP; - inputManager.events.once('boot', this.boot, this); + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -300,6 +323,21 @@ var MouseManager = new Class({ } }; + this.onMouseDownWindow = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + if (event.target !== canvas) + { + // Only process the event if the target isn't the canvas + _this.manager.queueMouseDown(event); + } + }; + this.onMouseUp = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) @@ -316,6 +354,21 @@ var MouseManager = new Class({ } }; + this.onMouseUpWindow = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + if (event.target !== canvas) + { + // Only process the event if the target isn't the canvas + _this.manager.queueMouseUp(event); + } + }; + this.onMouseOver = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) @@ -354,10 +407,10 @@ var MouseManager = new Class({ target.addEventListener('mouseover', this.onMouseOver, (this.capture) ? nonPassive : passive); target.addEventListener('mouseout', this.onMouseOut, (this.capture) ? nonPassive : passive); - if (window) + if (window && this.manager.game.config.inputWindowEvents) { - window.addEventListener('mousedown', this.onMouseDown, nonPassive); - window.addEventListener('mouseup', this.onMouseUp, nonPassive); + window.addEventListener('mousedown', this.onMouseDownWindow, nonPassive); + window.addEventListener('mouseup', this.onMouseUpWindow, nonPassive); } if (Features.pointerLock) @@ -398,8 +451,8 @@ var MouseManager = new Class({ if (window) { - window.removeEventListener('mousedown', this.onMouseDown); - window.removeEventListener('mouseup', this.onMouseUp); + window.removeEventListener('mousedown', this.onMouseDownWindow); + window.removeEventListener('mouseup', this.onMouseUpWindow); } if (Features.pointerLock) diff --git a/src/input/mouse/index.js b/src/input/mouse/index.js index 8898beb5a..436d6775f 100644 --- a/src/input/mouse/index.js +++ b/src/input/mouse/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/touch/TouchManager.js b/src/input/touch/TouchManager.js index eb5d8761a..a1456063a 100644 --- a/src/input/touch/TouchManager.js +++ b/src/input/touch/TouchManager.js @@ -1,10 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); +var InputEvents = require('../events'); var NOOP = require('../../utils/NOOP'); // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events @@ -82,6 +83,16 @@ var TouchManager = new Class({ */ this.onTouchStart = NOOP; + /** + * The Touch Start event handler function specifically for events on the Window. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchStartWindow + * @type {function} + * @since 3.17.0 + */ + this.onTouchStartWindow = NOOP; + /** * The Touch Move event handler function. * Initially empty and bound in the `startListeners` method. @@ -102,6 +113,16 @@ var TouchManager = new Class({ */ this.onTouchEnd = NOOP; + /** + * The Touch End event handler function specifically for events on the Window. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchEndWindow + * @type {function} + * @since 3.17.0 + */ + this.onTouchEndWindow = NOOP; + /** * The Touch Cancel event handler function. * Initially empty and bound in the `startListeners` method. @@ -132,7 +153,7 @@ var TouchManager = new Class({ */ this.onTouchOut = NOOP; - inputManager.events.once('boot', this.boot, this); + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** @@ -198,6 +219,21 @@ var TouchManager = new Class({ } }; + this.onTouchStartWindow = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + if (event.target !== canvas) + { + // Only process the event if the target isn't the canvas + _this.manager.queueTouchStart(event); + } + }; + this.onTouchMove = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) @@ -230,6 +266,21 @@ var TouchManager = new Class({ } }; + this.onTouchEndWindow = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } + + if (event.target !== canvas) + { + // Only process the event if the target isn't the canvas + _this.manager.queueTouchEnd(event); + } + }; + this.onTouchCancel = function (event) { if (event.defaultPrevented || !_this.enabled || !_this.manager) @@ -285,10 +336,10 @@ var TouchManager = new Class({ target.addEventListener('touchover', this.onTouchOver, (this.capture) ? nonPassive : passive); target.addEventListener('touchout', this.onTouchOut, (this.capture) ? nonPassive : passive); - if (window) + if (window && this.manager.game.config.inputWindowEvents) { - window.addEventListener('touchstart', this.onTouchStart, nonPassive); - window.addEventListener('touchend', this.onTouchEnd, nonPassive); + window.addEventListener('touchstart', this.onTouchStartWindow, nonPassive); + window.addEventListener('touchend', this.onTouchEndWindow, nonPassive); } this.enabled = true; @@ -314,8 +365,8 @@ var TouchManager = new Class({ if (window) { - window.removeEventListener('touchstart', this.onTouchStart); - window.removeEventListener('touchend', this.onTouchEnd); + window.removeEventListener('touchstart', this.onTouchStartWindow); + window.removeEventListener('touchend', this.onTouchEndWindow); } }, diff --git a/src/input/touch/index.js b/src/input/touch/index.js index 58e512cf1..7c29ac4c9 100644 --- a/src/input/touch/index.js +++ b/src/input/touch/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/input/typedefs/EventData.js b/src/input/typedefs/EventData.js new file mode 100644 index 000000000..7d5cbade0 --- /dev/null +++ b/src/input/typedefs/EventData.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A Phaser Input Event Data object. + * + * This object is passed to the registered event listeners and allows you to stop any further propagation. + * + * @typedef {object} Phaser.Input.Types.EventData + * @since 3.15.1 + * + * @property {boolean} [cancelled=false] - The cancelled state of this Event. + * @property {function} stopPropagation - Call this method to stop this event from passing any further down the event chain. + */ diff --git a/src/input/typedefs/HitAreaCallback.js b/src/input/typedefs/HitAreaCallback.js new file mode 100644 index 000000000..12cb31964 --- /dev/null +++ b/src/input/typedefs/HitAreaCallback.js @@ -0,0 +1,11 @@ +/** + * @callback Phaser.Input.Types.HitAreaCallback + * @since 3.0.0 + * + * @param {any} hitArea - The hit area object. + * @param {number} x - The translated x coordinate of the hit test event. + * @param {number} y - The translated y coordinate of the hit test event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that invoked the hit test. + * + * @return {boolean} `true` if the coordinates fall within the space of the hitArea, otherwise `false`. + */ diff --git a/src/input/typedefs/InputConfiguration.js b/src/input/typedefs/InputConfiguration.js new file mode 100644 index 000000000..d70893f31 --- /dev/null +++ b/src/input/typedefs/InputConfiguration.js @@ -0,0 +1,13 @@ +/** + * @typedef {object} Phaser.Input.Types.InputConfiguration + * @since 3.0.0 + * + * @property {any} [hitArea] - The object / shape to use as the Hit Area. If not given it will try to create a Rectangle based on the texture frame. + * @property {function} [hitAreaCallback] - The callback that determines if the pointer is within the Hit Area shape or not. + * @property {boolean} [draggable=false] - If `true` the Interactive Object will be set to be draggable and emit drag events. + * @property {boolean} [dropZone=false] - If `true` the Interactive Object will be set to be a drop zone for draggable objects. + * @property {boolean} [useHandCursor=false] - If `true` the Interactive Object will set the `pointer` hand cursor when a pointer is over it. This is a short-cut for setting `cursor: 'pointer'`. + * @property {string} [cursor] - The CSS string to be used when the cursor is over this Interactive Object. + * @property {boolean} [pixelPerfect=false] - If `true` the a pixel perfect function will be set for the hit area callback. Only works with texture based Game Objects. + * @property {integer} [alphaTolerance=1] - If `pixelPerfect` is set, this is the alpha tolerance threshold value used in the callback. + */ diff --git a/src/input/typedefs/InputPluginContainer.js b/src/input/typedefs/InputPluginContainer.js new file mode 100644 index 000000000..fe328f998 --- /dev/null +++ b/src/input/typedefs/InputPluginContainer.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Input.Types.InputPluginContainer + * @since 3.0.0 + * + * @property {string} key - The unique name of this plugin in the input plugin cache. + * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated. + * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used. + */ diff --git a/src/input/typedefs/InteractiveObject.js b/src/input/typedefs/InteractiveObject.js new file mode 100644 index 000000000..1dfedd038 --- /dev/null +++ b/src/input/typedefs/InteractiveObject.js @@ -0,0 +1,21 @@ +/** + * @typedef {object} Phaser.Input.Types.InteractiveObject + * @since 3.0.0 + * + * @property {Phaser.GameObjects.GameObject} gameObject - The Game Object to which this Interactive Object is bound. + * @property {boolean} enabled - Is this Interactive Object currently enabled for input events? + * @property {boolean} draggable - Is this Interactive Object draggable? Enable with `InputPlugin.setDraggable`. + * @property {boolean} dropZone - Is this Interactive Object a drag-targets drop zone? Set when the object is created. + * @property {(boolean|string)} cursor - Should this Interactive Object change the cursor (via css) when over? (desktop only) + * @property {?Phaser.GameObjects.GameObject} target - An optional drop target for a draggable Interactive Object. + * @property {Phaser.Cameras.Scene2D.Camera} camera - The most recent Camera to be tested against this Interactive Object. + * @property {any} hitArea - The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle. + * @property {Phaser.Input.Types.HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests. + * @property {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @property {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @property {(0|1|2)} dragState - The current drag state of this Interactive Object. 0 = Not being dragged, 1 = being checked for drag, or 2 = being actively dragged. + * @property {number} dragStartX - The x coordinate that the Pointer started dragging this Interactive Object from. + * @property {number} dragStartY - The y coordinate that the Pointer started dragging this Interactive Object from. + * @property {number} dragX - The x coordinate that this Interactive Object is currently being dragged to. + * @property {number} dragY - The y coordinate that this Interactive Object is currently being dragged to. + */ diff --git a/src/input/typedefs/index.js b/src/input/typedefs/index.js new file mode 100644 index 000000000..1a23d6322 --- /dev/null +++ b/src/input/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Input.Types + */ diff --git a/src/loader/File.js b/src/loader/File.js index c4564eaab..be568223a 100644 --- a/src/loader/File.js +++ b/src/loader/File.js @@ -1,30 +1,18 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var CONST = require('./const'); +var Events = require('./events'); var GetFastValue = require('../utils/object/GetFastValue'); var GetURL = require('./GetURL'); var MergeXHRSettings = require('./MergeXHRSettings'); var XHRLoader = require('./XHRLoader'); var XHRSettings = require('./XHRSettings'); -/** - * @typedef {object} FileConfig - * - * @property {string} type - The file type string (image, json, etc) for sorting within the Loader. - * @property {string} key - Unique cache key (unique within its file type) - * @property {string} [url] - The URL of the file, not including baseURL. - * @property {string} [path] - The path of the file, not including the baseURL. - * @property {string} [extension] - The default extension this file uses. - * @property {XMLHttpRequestResponseType} [responseType] - The responseType to be used by the XHR request. - * @property {(XHRSettingsObject|false)} [xhrSettings=false] - Custom XHR Settings specific to this file and merged with the Loader defaults. - * @property {any} [config] - A config object that can be used by file types to store transitional data. - */ - /** * @classdesc * The base File class used by all File Types that the Loader can support. @@ -36,7 +24,7 @@ var XHRSettings = require('./XHRSettings'); * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. - * @param {FileConfig} fileConfig - The file configuration object, as created by the file type. + * @param {Phaser.Loader.Types.FileConfig} fileConfig - The file configuration object, as created by the file type. */ var File = new Class({ @@ -125,7 +113,7 @@ var File = new Class({ * The merged XHRSettings for this file. * * @name Phaser.Loader.File#xhrSettings - * @type {XHRSettingsObject} + * @type {Phaser.Loader.Types.XHRSettingsObject} * @since 3.0.0 */ this.xhrSettings = XHRSettings(GetFastValue(fileConfig, 'responseType', undefined)); @@ -315,7 +303,9 @@ var File = new Class({ */ onLoad: function (xhr, event) { - var success = !(event.target && event.target.status !== 200); + var localFileOk = ((xhr.responseURL && xhr.responseURL.indexOf('file://') === 0 && event.target.status === 0)); + + var success = !(event.target && event.target.status !== 200) || localFileOk; // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) @@ -334,6 +324,7 @@ var File = new Class({ * @method Phaser.Loader.File#onError * @since 3.0.0 * + * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error. */ onError: function () @@ -347,6 +338,7 @@ var File = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.File#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 * * @param {ProgressEvent} event - The DOM ProgressEvent. @@ -360,7 +352,7 @@ var File = new Class({ this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); } }, @@ -448,65 +440,13 @@ var File = new Class({ this.pendingDestroy(); }, - /** - * You can listen for this event from the LoaderPlugin. It is dispatched _every time_ - * a file loads and is sent 3 arguments, which allow you to identify the file: - * - * ```javascript - * this.load.on('filecomplete', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#fileCompleteEvent - * @param {string} key - The key of the file that just loaded and finished processing. - * @param {string} type - The type of the file that just loaded and finished processing. - * @param {any} data - The data of the file. - */ - - /** - * You can listen for this event from the LoaderPlugin. It is dispatched only once per - * file and you have to use a special listener handle to pick it up. - * - * The string of the event is based on the file type and the key you gave it, split up - * using hyphens. - * - * For example, if you have loaded an image with a key of `monster`, you can listen for it - * using the following: - * - * ```javascript - * this.load.on('filecomplete-image-monster', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a texture atlas with a key of `Level1`: - * - * ```javascript - * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: - * - * ```javascript - * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * @event Phaser.Loader.File#singleFileCompleteEvent - * @param {any} data - The data of the file. - */ - /** * Called once the file has been added to its cache and is now ready for deletion from the Loader. * It will emit a `filecomplete` event from the LoaderPlugin. * * @method Phaser.Loader.File#pendingDestroy - * @fires Phaser.Loader.File#fileCompleteEvent - * @fires Phaser.Loader.File#singleFileCompleteEvent + * @fires Phaser.Loader.Events#FILE_COMPLETE + * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE * @since 3.7.0 */ pendingDestroy: function (data) @@ -516,8 +456,8 @@ var File = new Class({ var key = this.key; var type = this.type; - this.loader.emit('filecomplete', key, type, data); - this.loader.emit('filecomplete-' + type + '-' + key, key, type, data); + this.loader.emit(Events.FILE_COMPLETE, key, type, data); + this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data); this.loader.flagForRemoval(this); }, @@ -546,6 +486,8 @@ var File = new Class({ * * @method Phaser.Loader.File.createObjectURL * @static + * @since 3.7.0 + * * @param {HTMLImageElement} image - Image object which 'src' attribute should be set to object URL. * @param {Blob} blob - A Blob object to create an object URL for. * @param {string} defaultType - Default mime type used if blob type is not available. @@ -578,6 +520,8 @@ File.createObjectURL = function (image, blob, defaultType) * * @method Phaser.Loader.File.revokeObjectURL * @static + * @since 3.7.0 + * * @param {HTMLImageElement} image - Image object which 'src' attribute should be revoked. */ File.revokeObjectURL = function (image) diff --git a/src/loader/FileTypesManager.js b/src/loader/FileTypesManager.js index a5abc1c09..be20de555 100644 --- a/src/loader/FileTypesManager.js +++ b/src/loader/FileTypesManager.js @@ -1,11 +1,15 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var types = {}; +/** + * @namespace Phaser.Loader.FileTypesManager + */ + var FileTypesManager = { /** @@ -14,7 +18,7 @@ var FileTypesManager = { * Loops through the local types object and injects all of them as * properties into the LoaderPlugin instance. * - * @method Phaser.Loader.FileTypesManager.register + * @method Phaser.Loader.FileTypesManager.install * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. diff --git a/src/loader/GetURL.js b/src/loader/GetURL.js index 30b326562..9e16bd956 100644 --- a/src/loader/GetURL.js +++ b/src/loader/GetURL.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/loader/LoaderPlugin.js b/src/loader/LoaderPlugin.js index 062ea7013..c8795e1d9 100644 --- a/src/loader/LoaderPlugin.js +++ b/src/loader/LoaderPlugin.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,9 +8,11 @@ var Class = require('../utils/Class'); var CONST = require('./const'); var CustomSet = require('../structs/Set'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var FileTypesManager = require('./FileTypesManager'); var GetFastValue = require('../utils/object/GetFastValue'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); var XHRSettings = require('./XHRSettings'); /** @@ -184,7 +186,7 @@ var LoaderPlugin = new Class({ * xhr specific global settings (can be overridden on a per-file basis) * * @name Phaser.Loader.LoaderPlugin#xhr - * @type {XHRSettingsObject} + * @type {Phaser.Loader.Types.XHRSettingsObject} * @since 3.0.0 */ this.xhr = XHRSettings( @@ -311,8 +313,8 @@ var LoaderPlugin = new Class({ */ this.state = CONST.LOADER_IDLE; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.pluginStart, this); }, /** @@ -325,7 +327,7 @@ var LoaderPlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -339,7 +341,7 @@ var LoaderPlugin = new Class({ */ pluginStart: function () { - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -459,16 +461,6 @@ var LoaderPlugin = new Class({ return this; }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#addFileEvent - * @param {string} key - The key of the file that was added. - * @param {string} type - The type of the file that was added. - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that had the file added to it. - * @param {Phaser.Loader.File} loader - The File object that was added to the Loader. - */ - /** * Adds a file, or array of files, into the load queue. * @@ -481,7 +473,7 @@ var LoaderPlugin = new Class({ * however you can call this as long as the file given to it is well formed. * * @method Phaser.Loader.LoaderPlugin#addFile - * @fires Phaser.Loader.LoaderPlugin#addFileEvent + * @fires Phaser.Loader.Events#ADD * @since 3.0.0 * * @param {(Phaser.Loader.File|Phaser.Loader.File[])} file - The file, or array of files, to be added to the load queue. @@ -503,7 +495,7 @@ var LoaderPlugin = new Class({ { this.list.set(item); - this.emit('addfile', item.key, item.type, this, item); + this.emit(Events.ADD, item.key, item.type, this, item); if (this.isLoading()) { @@ -669,13 +661,6 @@ var LoaderPlugin = new Class({ return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE); }, - /** - * This event is fired when a Loader successfully begins to load its queue. - * - * @event Phaser.Loader.LoaderPlugin#startEvent - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader instance that started. - */ - /** * Starts the Loader running. This will reset the progress and totals and then emit a `start` event. * If there is nothing in the queue the Loader will immediately complete, otherwise it will start @@ -688,7 +673,7 @@ var LoaderPlugin = new Class({ * If the Loader is already running this method will simply return. * * @method Phaser.Loader.LoaderPlugin#start - * @fires Phaser.Loader.LoaderPlugin#startEvent + * @fires Phaser.Loader.Events#START * @since 3.0.0 */ start: function () @@ -704,7 +689,7 @@ var LoaderPlugin = new Class({ this.totalComplete = 0; this.totalToLoad = this.list.size; - this.emit('start', this); + this.emit(Events.START, this); if (this.list.size === 0) { @@ -721,32 +706,24 @@ var LoaderPlugin = new Class({ this.checkLoadQueue(); - this.systems.events.on('update', this.update, this); + this.systems.events.on(SceneEvents.UPDATE, this.update, this); } }, - /** - * This event is fired when the Loader updates its progress, typically as a result of - * a file having completed loading. - * - * @event Phaser.Loader.LoaderPlugin#progressEvent - * @param {number} progress - The current progress of the load. A value between 0 and 1. - */ - /** * Called automatically during the load process. * It updates the `progress` value and then emits a progress event, which you can use to * display a loading bar in your game. * * @method Phaser.Loader.LoaderPlugin#updateProgress - * @fires Phaser.Loader.LoaderPlugin#progressEvent + * @fires Phaser.Loader.Events#PROGRESS * @since 3.0.0 */ updateProgress: function () { this.progress = 1 - ((this.list.size + this.inflight.size) / this.totalToLoad); - this.emit('progress', this.progress); + this.emit(Events.PROGRESS, this.progress); }, /** @@ -803,20 +780,6 @@ var LoaderPlugin = new Class({ }, this); }, - /** - * This event is fired when the a file successfully completes loading, _before_ it is processed. - * - * @event Phaser.Loader.LoaderPlugin#loadEvent - * @param {Phaser.Loader.File} file - The file that has completed loading. - */ - - /** - * This event is fired when the a file errors during load. - * - * @event Phaser.Loader.LoaderPlugin#loadErrorEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * An internal method called automatically by the XHRLoader belong to a File. * @@ -824,8 +787,8 @@ var LoaderPlugin = new Class({ * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue. * * @method Phaser.Loader.LoaderPlugin#nextFile - * @fires Phaser.Loader.LoaderPlugin#loadEvent - * @fires Phaser.Loader.LoaderPlugin#loadErrorEvent + * @fires Phaser.Loader.Events#FILE_LOAD + * @fires Phaser.Loader.Events#FILE_LOAD_ERROR * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File that just finished loading, or errored during load. @@ -849,7 +812,7 @@ var LoaderPlugin = new Class({ this.queue.set(file); - this.emit('load', file); + this.emit(Events.FILE_LOAD, file); file.onProcess(); } @@ -859,7 +822,7 @@ var LoaderPlugin = new Class({ this._deleteQueue.set(file); - this.emit('loaderror', file); + this.emit(Events.FILE_LOAD_ERROR, file); this.fileProcessComplete(file); } @@ -921,14 +884,6 @@ var LoaderPlugin = new Class({ } }, - /** - * This event is fired when the Loader has finished loading everything and the queue is empty. - * By this point every loaded file will now be in its associated cache and ready for use. - * - * @event Phaser.Loader.LoaderPlugin#completeEvent - * @param {Phaser.Loader.File} file - The file that has failed to load. - */ - /** * Called at the end when the load queue is exhausted and all files have either loaded or errored. * By this point every loaded file will now be in its associated cache and ready for use. @@ -936,12 +891,13 @@ var LoaderPlugin = new Class({ * Also clears down the Sets, puts progress to 1 and clears the deletion queue. * * @method Phaser.Loader.LoaderPlugin#loadComplete - * @fires Phaser.Loader.LoaderPlugin#completeEvent + * @fires Phaser.Loader.Events#COMPLETE + * @fires Phaser.Loader.Events#POST_PROCESS * @since 3.7.0 */ loadComplete: function () { - this.emit('loadcomplete', this); + this.emit(Events.POST_PROCESS, this); this.list.clear(); this.inflight.clear(); @@ -951,14 +907,14 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_COMPLETE; - this.systems.events.off('update', this.update, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); // Call 'destroy' on each file ready for deletion this._deleteQueue.iterateLocal('destroy'); this._deleteQueue.clear(); - this.emit('complete', this, this.totalComplete, this.totalFailed); + this.emit(Events.COMPLETE, this, this.totalComplete, this.totalFailed); }, /** @@ -1066,8 +1022,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_SHUTDOWN; - this.systems.events.off('update', this.update, this); - this.systems.events.off('shutdown', this.shutdown, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -1084,8 +1040,8 @@ var LoaderPlugin = new Class({ this.state = CONST.LOADER_DESTROYED; - this.systems.events.off('update', this.update, this); - this.systems.events.off('start', this.pluginStart, this); + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.START, this.pluginStart, this); this.list = null; this.inflight = null; diff --git a/src/loader/MergeXHRSettings.js b/src/loader/MergeXHRSettings.js index 5b79d68b7..d85f4cd3a 100644 --- a/src/loader/MergeXHRSettings.js +++ b/src/loader/MergeXHRSettings.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,10 +16,10 @@ var XHRSettings = require('./XHRSettings'); * @function Phaser.Loader.MergeXHRSettings * @since 3.0.0 * - * @param {XHRSettingsObject} global - The global XHRSettings object. - * @param {XHRSettingsObject} local - The local XHRSettings object. + * @param {Phaser.Loader.Types.XHRSettingsObject} global - The global XHRSettings object. + * @param {Phaser.Loader.Types.XHRSettingsObject} local - The local XHRSettings object. * - * @return {XHRSettingsObject} A newly formed XHRSettings object. + * @return {Phaser.Loader.Types.XHRSettingsObject} A newly formed XHRSettings object. */ var MergeXHRSettings = function (global, local) { diff --git a/src/loader/MultiFile.js b/src/loader/MultiFile.js index b38d4b4d7..2ed2f6075 100644 --- a/src/loader/MultiFile.js +++ b/src/loader/MultiFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/loader/XHRLoader.js b/src/loader/XHRLoader.js index 8267385a2..3ebfd1779 100644 --- a/src/loader/XHRLoader.js +++ b/src/loader/XHRLoader.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var MergeXHRSettings = require('./MergeXHRSettings'); * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File to download. - * @param {XHRSettingsObject} globalXHRSettings - The global XHRSettings object. + * @param {Phaser.Loader.Types.XHRSettingsObject} globalXHRSettings - The global XHRSettings object. * * @return {XMLHttpRequest} The XHR object. */ @@ -48,7 +48,7 @@ var XHRLoader = function (file, globalXHRSettings) // After a successful request, the xhr.response property will contain the requested data as a DOMString, ArrayBuffer, Blob, or Document (depending on what was set for responseType.) xhr.onload = file.onLoad.bind(file, xhr); - xhr.onerror = file.onError.bind(file); + xhr.onerror = file.onError.bind(file, xhr); xhr.onprogress = file.onProgress.bind(file); // This is the only standard method, the ones above are browser additions (maybe not universal?) diff --git a/src/loader/XHRSettings.js b/src/loader/XHRSettings.js index 5036f7500..9eba3b098 100644 --- a/src/loader/XHRSettings.js +++ b/src/loader/XHRSettings.js @@ -1,23 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} XHRSettingsObject - * - * @property {XMLHttpRequestResponseType} responseType - The response type of the XHR request, i.e. `blob`, `text`, etc. - * @property {boolean} [async=true] - Should the XHR request use async or not? - * @property {string} [user=''] - Optional username for the XHR request. - * @property {string} [password=''] - Optional password for the XHR request. - * @property {integer} [timeout=0] - Optional XHR timeout value. - * @property {(string|undefined)} [header] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. - * @property {(string|undefined)} [headerValue] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. - * @property {(string|undefined)} [requestedWith] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. - * @property {(string|undefined)} [overrideMimeType] - Provide a custom mime-type to use instead of the default. - */ - /** * Creates an XHRSettings Object with default values. * @@ -30,7 +16,7 @@ * @param {string} [password=''] - Optional password for the XHR request. * @param {integer} [timeout=0] - Optional XHR timeout value. * - * @return {XHRSettingsObject} The XHRSettings object as used by the Loader. + * @return {Phaser.Loader.Types.XHRSettingsObject} The XHRSettings object as used by the Loader. */ var XHRSettings = function (responseType, async, user, password, timeout) { diff --git a/src/loader/const.js b/src/loader/const.js index 4201dc968..27e5d9537 100644 --- a/src/loader/const.js +++ b/src/loader/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/loader/events/ADD_EVENT.js b/src/loader/events/ADD_EVENT.js new file mode 100644 index 000000000..b9968eb27 --- /dev/null +++ b/src/loader/events/ADD_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Add File Event. + * + * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue. + * + * Listen to it from a Scene using: `this.load.on('addfile', listener)`. + * + * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them. + * + * @event Phaser.Loader.Events#ADD + * @since 3.0.0 + * + * @param {string} key - The unique key of the file that was added to the Loader. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} string of the file that was added to the Loader, i.e. `image`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {Phaser.Loader.File} file - A reference to the File which was added to the Loader. + */ +module.exports = 'addfile'; diff --git a/src/loader/events/COMPLETE_EVENT.js b/src/loader/events/COMPLETE_EVENT.js new file mode 100644 index 000000000..f8850f033 --- /dev/null +++ b/src/loader/events/COMPLETE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Complete Event. + * + * This event is dispatched when the Loader has fully processed everything in the load queue. + * By this point every loaded file will now be in its associated cache and ready for use. + * + * Listen to it from a Scene using: `this.load.on('complete', listener)`. + * + * @event Phaser.Loader.Events#COMPLETE + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {integer} totalComplete - The total number of files that successfully loaded. + * @param {integer} totalFailed - The total number of files that failed to load. + */ +module.exports = 'complete'; diff --git a/src/loader/events/FILE_COMPLETE_EVENT.js b/src/loader/events/FILE_COMPLETE_EVENT.js new file mode 100644 index 000000000..fc7896a74 --- /dev/null +++ b/src/loader/events/FILE_COMPLETE_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`. + * + * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_COMPLETE + * @since 3.0.0 + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete'; diff --git a/src/loader/events/FILE_KEY_COMPLETE_EVENT.js b/src/loader/events/FILE_KEY_COMPLETE_EVENT.js new file mode 100644 index 000000000..901ab991f --- /dev/null +++ b/src/loader/events/FILE_KEY_COMPLETE_EVENT.js @@ -0,0 +1,48 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * It uses a special dynamic event name constructed from the key and type of the file. + * + * For example, if you have loaded an `image` with a key of `monster`, you can listen for it + * using the following: + * + * ```javascript + * this.load.on('filecomplete-image-monster', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a texture `atlas` with a key of `Level1`: + * + * ```javascript + * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: + * + * ```javascript + * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_KEY_COMPLETE + * @since 3.0.0 + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} data - The raw data the file contained. + */ +module.exports = 'filecomplete-'; diff --git a/src/loader/events/FILE_LOAD_ERROR_EVENT.js b/src/loader/events/FILE_LOAD_ERROR_EVENT.js new file mode 100644 index 000000000..9324038b9 --- /dev/null +++ b/src/loader/events/FILE_LOAD_ERROR_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Error Event. + * + * This event is dispatched by the Loader Plugin when a file fails to load. + * + * Listen to it from a Scene using: `this.load.on('loaderror', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD_ERROR + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + */ +module.exports = 'loaderror'; diff --git a/src/loader/events/FILE_LOAD_EVENT.js b/src/loader/events/FILE_LOAD_EVENT.js new file mode 100644 index 000000000..4ce4ab98a --- /dev/null +++ b/src/loader/events/FILE_LOAD_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Event. + * + * This event is dispatched by the Loader Plugin when a file finishes loading, + * but _before_ it is processed and added to the internal Phaser caches. + * + * Listen to it from a Scene using: `this.load.on('load', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - A reference to the File which just finished loading. + */ +module.exports = 'load'; diff --git a/src/loader/events/FILE_PROGRESS_EVENT.js b/src/loader/events/FILE_PROGRESS_EVENT.js new file mode 100644 index 000000000..0a51e4ca7 --- /dev/null +++ b/src/loader/events/FILE_PROGRESS_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The File Load Progress Event. + * + * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and + * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen. + * + * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`. + * + * @event Phaser.Loader.Events#FILE_PROGRESS + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + * @param {number} percentComplete - A value between 0 and 1 indicating how 'complete' this file is. + */ +module.exports = 'fileprogress'; diff --git a/src/loader/events/POST_PROCESS_EVENT.js b/src/loader/events/POST_PROCESS_EVENT.js new file mode 100644 index 000000000..a23484925 --- /dev/null +++ b/src/loader/events/POST_PROCESS_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Post Process Event. + * + * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue. + * It is dispatched before the internal lists are cleared and each File is destroyed. + * + * Use this hook to perform any last minute processing of files that can only happen once the + * Loader has completed, but prior to it emitting the `complete` event. + * + * Listen to it from a Scene using: `this.load.on('postprocess', listener)`. + * + * @event Phaser.Loader.Events#POST_PROCESS + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'postprocess'; diff --git a/src/loader/events/PROGRESS_EVENT.js b/src/loader/events/PROGRESS_EVENT.js new file mode 100644 index 000000000..b9176ad02 --- /dev/null +++ b/src/loader/events/PROGRESS_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Progress Event. + * + * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading. + * + * Listen to it from a Scene using: `this.load.on('progress', listener)`. + * + * @event Phaser.Loader.Events#PROGRESS + * @since 3.0.0 + * + * @param {number} progress - The current progress of the load. A value between 0 and 1. + */ +module.exports = 'progress'; diff --git a/src/loader/events/START_EVENT.js b/src/loader/events/START_EVENT.js new file mode 100644 index 000000000..3088bd502 --- /dev/null +++ b/src/loader/events/START_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Loader Plugin Start Event. + * + * This event is dispatched when the Loader starts running. At this point load progress is zero. + * + * This event is dispatched even if there aren't any files in the load queue. + * + * Listen to it from a Scene using: `this.load.on('start', listener)`. + * + * @event Phaser.Loader.Events#START + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'start'; diff --git a/src/loader/events/index.js b/src/loader/events/index.js new file mode 100644 index 000000000..0ce94a7c6 --- /dev/null +++ b/src/loader/events/index.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Loader.Events + */ + +module.exports = { + + ADD: require('./ADD_EVENT'), + COMPLETE: require('./COMPLETE_EVENT'), + FILE_COMPLETE: require('./FILE_COMPLETE_EVENT'), + FILE_KEY_COMPLETE: require('./FILE_KEY_COMPLETE_EVENT'), + FILE_LOAD_ERROR: require('./FILE_LOAD_ERROR_EVENT'), + FILE_LOAD: require('./FILE_LOAD_EVENT'), + FILE_PROGRESS: require('./FILE_PROGRESS_EVENT'), + POST_PROCESS: require('./POST_PROCESS_EVENT'), + PROGRESS: require('./PROGRESS_EVENT'), + START: require('./START_EVENT') + +}; diff --git a/src/loader/filetypes/AnimationJSONFile.js b/src/loader/filetypes/AnimationJSONFile.js index e424f97b5..c44c79778 100644 --- a/src/loader/filetypes/AnimationJSONFile.js +++ b/src/loader/filetypes/AnimationJSONFile.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); var FileTypesManager = require('../FileTypesManager'); var JSONFile = require('./JSONFile.js'); +var LoaderEvents = require('../events'); /** * @classdesc @@ -25,7 +26,7 @@ var JSONFile = require('./JSONFile.js'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. */ var AnimationJSONFile = new Class({ @@ -54,7 +55,7 @@ var AnimationJSONFile = new Class({ onProcess: function () { // We need to hook into this event: - this.loader.once('loadcomplete', this.onLoadComplete, this); + this.loader.once(LoaderEvents.POST_PROCESS, this.onLoadComplete, this); // But the rest is the same as a normal JSON file JSONFile.prototype.onProcess.call(this); @@ -168,7 +169,7 @@ var AnimationJSONFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.JSONFileConfig|Phaser.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". * @param {string} [dataKey] - When the Animation JSON file loads only this property will be stored in the Cache and used to create animation data. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/AtlasJSONFile.js b/src/loader/filetypes/AtlasJSONFile.js index f404a4358..5dd586541 100644 --- a/src/loader/filetypes/AtlasJSONFile.js +++ b/src/loader/filetypes/AtlasJSONFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,11 +18,11 @@ var MultiFile = require('../MultiFile.js'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [textureURL] - The absolute or relative URL to load the texture image file from. * @property {string} [textureExtension='png'] - The default file extension to use for the image texture if no url is provided. - * @property {XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the texture image. * @property {string} [atlasURL] - The absolute or relative URL to load the atlas json file from. Or a well formed JSON object to use instead. * @property {string} [atlasExtension='json'] - The default file extension to use for the atlas json if no url is provided. - * @property {XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. */ /** @@ -45,8 +45,8 @@ var MultiFile = require('../MultiFile.js'); * @param {(string|Phaser.Loader.FileTypes.AtlasJSONFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. */ var AtlasJSONFile = new Class({ @@ -221,8 +221,8 @@ var AtlasJSONFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.AtlasJSONFileConfig|Phaser.Loader.FileTypes.AtlasJSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/AtlasXMLFile.js b/src/loader/filetypes/AtlasXMLFile.js index 9360ee4c9..47de2cd61 100644 --- a/src/loader/filetypes/AtlasXMLFile.js +++ b/src/loader/filetypes/AtlasXMLFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,11 +18,11 @@ var XMLFile = require('./XMLFile.js'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [textureURL] - The absolute or relative URL to load the texture image file from. * @property {string} [textureExtension='png'] - The default file extension to use for the image texture if no url is provided. - * @property {XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the texture image. * @property {string} [atlasURL] - The absolute or relative URL to load the atlas xml file from. * @property {string} [atlasExtension='xml'] - The default file extension to use for the atlas xml if no url is provided. - * @property {XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas xml file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas xml file. */ /** @@ -37,13 +37,14 @@ var XMLFile = require('./XMLFile.js'); * @extends Phaser.Loader.MultiFile * @memberof Phaser.Loader.FileTypes * @constructor + * @since 3.7.0 * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.AtlasXMLFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. */ var AtlasXMLFile = new Class({ @@ -214,8 +215,8 @@ var AtlasXMLFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.AtlasXMLFileConfig|Phaser.Loader.FileTypes.AtlasXMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/AudioFile.js b/src/loader/filetypes/AudioFile.js index 9fa9695f5..414a47a94 100644 --- a/src/loader/filetypes/AudioFile.js +++ b/src/loader/filetypes/AudioFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * * @property {string} key - The key of the file. Must be unique within the Loader and Audio Cache. * @property {string} [urlConfig] - The absolute or relative URL to load the file from. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @property {AudioContext} [audioContext] - The AudioContext this file will use to process itself. */ @@ -38,7 +38,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.AudioFileConfig)} key - The key to use for this file, or a file configuration object. * @param {any} [urlConfig] - The absolute or relative URL to load this file from in a config object. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @param {AudioContext} [audioContext] - The AudioContext this file will use to process itself. */ var AudioFile = new Class({ @@ -227,7 +227,7 @@ AudioFile.getAudioURL = function (game, urls) * @param {(string|Phaser.Loader.FileTypes.AudioFileConfig|Phaser.Loader.FileTypes.AudioFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|string[])} [urls] - The absolute or relative URL to load the audio files from. * @param {any} [config] - An object containing an `instances` property for HTML5Audio. Defaults to 1. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/AudioSpriteFile.js b/src/loader/filetypes/AudioSpriteFile.js index fef54a680..8260a7ba2 100644 --- a/src/loader/filetypes/AudioSpriteFile.js +++ b/src/loader/filetypes/AudioSpriteFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,10 +17,10 @@ var MultiFile = require('../MultiFile.js'); * * @property {string} key - The key of the file. Must be unique within both the Loader and the Audio Cache. * @property {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. - * @property {XHRSettingsObject} [jsonXhrSettings] - Extra XHR Settings specifically for the json file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [jsonXhrSettings] - Extra XHR Settings specifically for the json file. * @property {{(string|string[])}} [audioURL] - The absolute or relative URL to load the audio file from. * @property {any} [audioConfig] - The audio configuration options. - * @property {XHRSettingsObject} [audioXhrSettings] - Extra XHR Settings specifically for the audio file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [audioXhrSettings] - Extra XHR Settings specifically for the audio file. */ /** @@ -42,8 +42,8 @@ var MultiFile = require('../MultiFile.js'); * @param {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. * @param {{(string|string[])}} [audioURL] - The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. * @param {any} [audioConfig] - The audio configuration options. - * @param {XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. */ var AudioSpriteFile = new Class({ @@ -96,7 +96,7 @@ var AudioSpriteFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.AudioSpriteFile#onFileComplete + * @method Phaser.Loader.FileTypes.AudioSpriteFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -132,7 +132,7 @@ var AudioSpriteFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.AudioSpriteFile#addToCache + * @method Phaser.Loader.FileTypes.AudioSpriteFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -246,8 +246,8 @@ var AudioSpriteFile = new Class({ * @param {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. * @param {(string|string[])} [audioURL] - The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. * @param {any} [audioConfig] - The audio configuration options. - * @param {XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ diff --git a/src/loader/filetypes/BinaryFile.js b/src/loader/filetypes/BinaryFile.js index a39665a8b..cbe3b3e00 100644 --- a/src/loader/filetypes/BinaryFile.js +++ b/src/loader/filetypes/BinaryFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Binary Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='bin'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @property {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. */ @@ -38,7 +38,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.BinaryFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @param {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. */ var BinaryFile = new Class({ @@ -161,7 +161,7 @@ var BinaryFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.BinaryFileConfig|Phaser.Loader.FileTypes.BinaryFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin". * @param {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/BitmapFontFile.js b/src/loader/filetypes/BitmapFontFile.js index 3c32a09c9..e1cd148b5 100644 --- a/src/loader/filetypes/BitmapFontFile.js +++ b/src/loader/filetypes/BitmapFontFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19,11 +19,11 @@ var XMLFile = require('./XMLFile.js'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [textureURL] - The absolute or relative URL to load the texture image file from. * @property {string} [textureExtension='png'] - The default file extension to use for the image texture if no url is provided. - * @property {XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the texture image. * @property {string} [fontDataURL] - The absolute or relative URL to load the font data xml file from. * @property {string} [fontDataExtension='xml'] - The default file extension to use for the font data xml if no url is provided. - * @property {XHRSettingsObject} [fontDataXhrSettings] - Extra XHR Settings specifically for the font data xml file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [fontDataXhrSettings] - Extra XHR Settings specifically for the font data xml file. */ /** @@ -44,8 +44,8 @@ var XMLFile = require('./XMLFile.js'); * @param {(string|Phaser.Loader.FileTypes.BitmapFontFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [fontDataURL] - The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. */ var BitmapFontFile = new Class({ @@ -215,8 +215,8 @@ var BitmapFontFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.BitmapFontFileConfig|Phaser.Loader.FileTypes.BitmapFontFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [fontDataURL] - The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/GLSLFile.js b/src/loader/filetypes/GLSLFile.js index 077978d60..b58c08e43 100644 --- a/src/loader/filetypes/GLSLFile.js +++ b/src/loader/filetypes/GLSLFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='glsl'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -37,7 +37,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var GLSLFile = new Class({ @@ -154,7 +154,7 @@ var GLSLFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.GLSLFileConfig|Phaser.Loader.FileTypes.GLSLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.glsl`, i.e. if `key` was "alien" then the URL will be "alien.glsl". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index 16cdb3924..af41725bc 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -1,10 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../../utils/Class'); +var Events = require('../events'); var File = require('../File'); var GetFastValue = require('../../utils/object/GetFastValue'); var GetURL = require('../GetURL'); @@ -27,7 +28,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.AudioFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [urlConfig] - The absolute or relative URL to load this file from. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTML5AudioFile = new Class({ @@ -104,6 +105,7 @@ var HTML5AudioFile = new Class({ * Called during the file load progress. Is sent a DOM ProgressEvent. * * @method Phaser.Loader.FileTypes.HTML5AudioFile#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 */ onProgress: function (event) @@ -117,7 +119,7 @@ var HTML5AudioFile = new Class({ this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); - this.loader.emit('fileprogress', this, this.percentComplete); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); if (this.filesLoaded === this.filesTotal) { diff --git a/src/loader/filetypes/HTMLFile.js b/src/loader/filetypes/HTMLFile.js index f7865f481..0e19b710a 100644 --- a/src/loader/filetypes/HTMLFile.js +++ b/src/loader/filetypes/HTMLFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='html'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -37,7 +37,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.HTMLFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTMLFile = new Class({ @@ -153,7 +153,7 @@ var HTMLFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.HTMLFileConfig|Phaser.Loader.FileTypes.HTMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/HTMLTextureFile.js b/src/loader/filetypes/HTMLTextureFile.js index 0fd876b65..5f1d7941a 100644 --- a/src/loader/filetypes/HTMLTextureFile.js +++ b/src/loader/filetypes/HTMLTextureFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='html'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @property {integer} [width=512] - The width of the texture the HTML will be rendered to. * @property {integer} [height=512] - The height of the texture the HTML will be rendered to. */ @@ -41,7 +41,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {integer} [width] - The width of the texture the HTML will be rendered to. * @param {integer} [height] - The height of the texture the HTML will be rendered to. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTMLTextureFile = new Class({ @@ -238,7 +238,7 @@ var HTMLTextureFile = new Class({ * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". * @param {integer} [width=512] - The width of the texture the HTML will be rendered to. * @param {integer} [height=512] - The height of the texture the HTML will be rendered to. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/ImageFile.js b/src/loader/filetypes/ImageFile.js index e6d737871..b7085ad83 100644 --- a/src/loader/filetypes/ImageFile.js +++ b/src/loader/filetypes/ImageFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -30,7 +30,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} [extension='png'] - The default file extension to use if no url is provided. * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the image. * @property {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -50,7 +50,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @param {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. */ var ImageFile = new Class({ @@ -265,7 +265,7 @@ var ImageFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.ImageFileConfig|Phaser.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/JSONFile.js b/src/loader/filetypes/JSONFile.js index 26649fcaa..203a92472 100644 --- a/src/loader/filetypes/JSONFile.js +++ b/src/loader/filetypes/JSONFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19,7 +19,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string|any} [url] - The absolute or relative URL to load the file from. Or can be a ready formed JSON object, in which case it will be directly added to the Cache. * @property {string} [extension='json'] - The default file extension to use if no url is provided. * @property {string} [dataKey] - If specified instead of the whole JSON file being parsed and added to the Cache, only the section corresponding to this property key will be added. If the property you want to extract is nested, use periods to divide it. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -39,7 +39,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. */ var JSONFile = new Class({ @@ -209,7 +209,7 @@ var JSONFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.JSONFileConfig|Phaser.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/MultiAtlasFile.js b/src/loader/filetypes/MultiAtlasFile.js index ed26ab296..5c449356f 100644 --- a/src/loader/filetypes/MultiAtlasFile.js +++ b/src/loader/filetypes/MultiAtlasFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,10 +18,10 @@ var MultiFile = require('../MultiFile.js'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [atlasURL] - The absolute or relative URL to load the multi atlas json file from. Or, a well formed JSON object. * @property {string} [atlasExtension='json'] - The default file extension to use for the atlas json if no url is provided. - * @property {XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. * @property {string} [path] - Optional path to use when loading the textures defined in the atlas data. * @property {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. - * @property {XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture files. + * @property {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture files. */ /** @@ -43,8 +43,8 @@ var MultiFile = require('../MultiFile.js'); * @param {string} [atlasURL] - The absolute or relative URL to load the multi atlas json file from. * @param {string} [path] - Optional path to use when loading the textures defined in the atlas data. * @param {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. - * @param {XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. - * @param {XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture files. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture files. */ var MultiAtlasFile = new Class({ @@ -78,7 +78,7 @@ var MultiAtlasFile = new Class({ /** * Called by each File when it finishes loading. * - * @method Phaser.Loader.MultiFile#onFileComplete + * @method Phaser.Loader.FileTypes.MultiAtlasFile#onFileComplete * @since 3.7.0 * * @param {Phaser.Loader.File} file - The File that has completed processing. @@ -151,7 +151,7 @@ var MultiAtlasFile = new Class({ /** * Adds this file to its target cache upon successful loading and processing. * - * @method Phaser.Loader.MultiFile#addToCache + * @method Phaser.Loader.FileTypes.MultiAtlasFile#addToCache * @since 3.7.0 */ addToCache: function () @@ -296,7 +296,7 @@ var MultiAtlasFile = new Class({ * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". * @param {string} [path] - Optional path to use when loading the textures defined in the atlas data. * @param {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/PackFile.js b/src/loader/filetypes/PackFile.js index 0339e23f2..1a3a5e90a 100644 --- a/src/loader/filetypes/PackFile.js +++ b/src/loader/filetypes/PackFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,7 +16,7 @@ var JSONFile = require('./JSONFile.js'); * @property {string|any} [url] - The absolute or relative URL to load the file from. Or can be a ready formed JSON object, in which case it will be directly processed. * @property {string} [extension='json'] - The default file extension to use if no url is provided. * @property {string} [dataKey] - If specified instead of the whole JSON file being parsed, only the section corresponding to this property key will be added. If the property you want to extract is nested, use periods to divide it. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -36,7 +36,7 @@ var JSONFile = require('./JSONFile.js'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. */ var PackFile = new Class({ @@ -194,7 +194,7 @@ var PackFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.PackFileConfig|Phaser.Loader.FileTypes.PackFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/PluginFile.js b/src/loader/filetypes/PluginFile.js index 5daaeb0ef..61ee01d76 100644 --- a/src/loader/filetypes/PluginFile.js +++ b/src/loader/filetypes/PluginFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19,7 +19,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} [extension='js'] - The default file extension to use if no url is provided. * @property {boolean} [start=false] - Automatically start the plugin after loading? * @property {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -41,7 +41,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". * @param {boolean} [start=false] - Automatically start the plugin after loading? * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var PluginFile = new Class({ @@ -192,7 +192,7 @@ var PluginFile = new Class({ * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function. * @param {boolean} [start] - Automatically start the plugin after loading? * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/SVGFile.js b/src/loader/filetypes/SVGFile.js index f150e6ec8..75d4de524 100644 --- a/src/loader/filetypes/SVGFile.js +++ b/src/loader/filetypes/SVGFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -25,7 +25,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='svg'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. * @property {Phaser.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. */ @@ -47,7 +47,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {(string|Phaser.Loader.FileTypes.SVGFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg". * @param {Phaser.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var SVGFile = new Class({ @@ -325,7 +325,7 @@ var SVGFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.SVGFileConfig|Phaser.Loader.FileTypes.SVGFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg". * @param {Phaser.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/SceneFile.js b/src/loader/filetypes/SceneFile.js index c33f79e1d..9c459ce7c 100644 --- a/src/loader/filetypes/SceneFile.js +++ b/src/loader/filetypes/SceneFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='txt'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -37,7 +37,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var SceneFile = new Class({ @@ -196,7 +196,7 @@ var SceneFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.SceneFileConfig|Phaser.Loader.FileTypes.SceneFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/ScenePluginFile.js b/src/loader/filetypes/ScenePluginFile.js index a0832070d..c116ed833 100644 --- a/src/loader/filetypes/ScenePluginFile.js +++ b/src/loader/filetypes/ScenePluginFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -19,7 +19,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} [extension='js'] - The default file extension to use if no url is provided. * @property {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. * @property {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -41,7 +41,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". * @param {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. * @param {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var ScenePluginFile = new Class({ @@ -108,7 +108,7 @@ var ScenePluginFile = new Class({ if (this.state === CONST.FILE_POPULATED) { - pluginManager.installScenePlugin(systemKey, this.data, sceneKey, this.loader.scene); + pluginManager.installScenePlugin(systemKey, this.data, sceneKey, this.loader.scene, true); } else { @@ -123,7 +123,7 @@ var ScenePluginFile = new Class({ document.head.appendChild(this.data); - pluginManager.installScenePlugin(systemKey, window[this.key], sceneKey, this.loader.scene); + pluginManager.installScenePlugin(systemKey, window[this.key], sceneKey, this.loader.scene, true); } this.onProcessComplete(); @@ -186,7 +186,7 @@ var ScenePluginFile = new Class({ * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, set to a plugin function. * @param {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. * @param {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/ScriptFile.js b/src/loader/filetypes/ScriptFile.js index e7a378aef..e6ce9b3ab 100644 --- a/src/loader/filetypes/ScriptFile.js +++ b/src/loader/filetypes/ScriptFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within the Loader. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='js'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -37,7 +37,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.ScriptFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var ScriptFile = new Class({ @@ -149,7 +149,7 @@ var ScriptFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.ScriptFileConfig|Phaser.Loader.FileTypes.ScriptFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/SpriteSheetFile.js b/src/loader/filetypes/SpriteSheetFile.js index e57717e54..f024284a4 100644 --- a/src/loader/filetypes/SpriteSheetFile.js +++ b/src/loader/filetypes/SpriteSheetFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,7 +16,7 @@ var ImageFile = require('./ImageFile.js'); * @property {string} [extension='png'] - The default file extension to use if no url is provided. * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the image. * @property {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -37,7 +37,7 @@ var ImageFile = require('./ImageFile.js'); * @param {(string|Phaser.Loader.FileTypes.SpriteSheetFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var SpriteSheetFile = new Class({ @@ -171,7 +171,7 @@ var SpriteSheetFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.SpriteSheetFileConfig|Phaser.Loader.FileTypes.SpriteSheetFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. At a minimum it should have a `frameWidth` property. - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/TextFile.js b/src/loader/filetypes/TextFile.js index c52538287..aeb08e543 100644 --- a/src/loader/filetypes/TextFile.js +++ b/src/loader/filetypes/TextFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='txt'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -37,7 +37,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var TextFile = new Class({ @@ -153,7 +153,7 @@ var TextFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.TextFileConfig|Phaser.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/TilemapCSVFile.js b/src/loader/filetypes/TilemapCSVFile.js index ad9e4689f..7fccc2a1b 100644 --- a/src/loader/filetypes/TilemapCSVFile.js +++ b/src/loader/filetypes/TilemapCSVFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,7 +18,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Tilemap Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='csv'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -38,7 +38,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.TilemapCSVFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var TilemapCSVFile = new Class({ @@ -173,7 +173,7 @@ var TilemapCSVFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.TilemapCSVFileConfig|Phaser.Loader.FileTypes.TilemapCSVFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/TilemapImpactFile.js b/src/loader/filetypes/TilemapImpactFile.js index d3afccb5e..ce388c0b9 100644 --- a/src/loader/filetypes/TilemapImpactFile.js +++ b/src/loader/filetypes/TilemapImpactFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Tilemap Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='json'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -35,7 +35,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.TilemapImpactFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var TilemapImpactFile = new Class({ @@ -134,7 +134,7 @@ var TilemapImpactFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.TilemapImpactFileConfig|Phaser.Loader.FileTypes.TilemapImpactFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/TilemapJSONFile.js b/src/loader/filetypes/TilemapJSONFile.js index 7b500c047..28b3b6db8 100644 --- a/src/loader/filetypes/TilemapJSONFile.js +++ b/src/loader/filetypes/TilemapJSONFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,7 +15,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Tilemap Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='json'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -35,7 +35,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.TilemapJSONFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var TilemapJSONFile = new Class({ @@ -134,7 +134,7 @@ var TilemapJSONFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.TilemapJSONFileConfig|Phaser.Loader.FileTypes.TilemapJSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/UnityAtlasFile.js b/src/loader/filetypes/UnityAtlasFile.js index 39b6f7179..8f9899792 100644 --- a/src/loader/filetypes/UnityAtlasFile.js +++ b/src/loader/filetypes/UnityAtlasFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,11 +18,11 @@ var TextFile = require('./TextFile.js'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager. * @property {string} [textureURL] - The absolute or relative URL to load the texture image file from. * @property {string} [textureExtension='png'] - The default file extension to use for the image texture if no url is provided. - * @property {XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture image file. * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the texture image. * @property {string} [atlasURL] - The absolute or relative URL to load the atlas data file from. * @property {string} [atlasExtension='txt'] - The default file extension to use for the atlas data if no url is provided. - * @property {XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas data file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas data file. */ /** @@ -37,13 +37,14 @@ var TextFile = require('./TextFile.js'); * @extends Phaser.Loader.MultiFile * @memberof Phaser.Loader.FileTypes * @constructor + * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.UnityAtlasFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. */ var UnityAtlasFile = new Class({ @@ -213,8 +214,8 @@ var UnityAtlasFile = new Class({ * @param {(string|Phaser.Loader.FileTypes.UnityAtlasFileConfig|Phaser.Loader.FileTypes.UnityAtlasFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/XMLFile.js b/src/loader/filetypes/XMLFile.js index a87f49e7c..123269490 100644 --- a/src/loader/filetypes/XMLFile.js +++ b/src/loader/filetypes/XMLFile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,7 +18,7 @@ var ParseXML = require('../../dom/ParseXML'); * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache. * @property {string} [url] - The absolute or relative URL to load the file from. * @property {string} [extension='xml'] - The default file extension to use if no url is provided. - * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @property {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ /** @@ -38,7 +38,7 @@ var ParseXML = require('../../dom/ParseXML'); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var XMLFile = new Class({ @@ -163,7 +163,7 @@ var XMLFile = new Class({ * * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig|Phaser.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Loader.Types.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ diff --git a/src/loader/filetypes/index.js b/src/loader/filetypes/index.js index c804a5db3..2164c4390 100644 --- a/src/loader/filetypes/index.js +++ b/src/loader/filetypes/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/loader/index.js b/src/loader/index.js index 99e3f94f2..d72c0520f 100644 --- a/src/loader/index.js +++ b/src/loader/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,6 +13,8 @@ var Extend = require('../utils/object/Extend'); var Loader = { + Events: require('./events'), + FileTypes: require('./filetypes'), File: require('./File'), diff --git a/src/loader/typedefs/FileConfig.js b/src/loader/typedefs/FileConfig.js new file mode 100644 index 000000000..653f707fb --- /dev/null +++ b/src/loader/typedefs/FileConfig.js @@ -0,0 +1,13 @@ +/** + * @typedef {object} Phaser.Loader.Types.FileConfig + * @since 3.0.0 + * + * @property {string} type - The file type string (image, json, etc) for sorting within the Loader. + * @property {string} key - Unique cache key (unique within its file type) + * @property {string} [url] - The URL of the file, not including baseURL. + * @property {string} [path] - The path of the file, not including the baseURL. + * @property {string} [extension] - The default extension this file uses. + * @property {XMLHttpRequestResponseType} [responseType] - The responseType to be used by the XHR request. + * @property {(Phaser.Loader.Types.XHRSettingsObject|false)} [xhrSettings=false] - Custom XHR Settings specific to this file and merged with the Loader defaults. + * @property {any} [config] - A config object that can be used by file types to store transitional data. + */ diff --git a/src/loader/typedefs/XHRSettingsObject.js b/src/loader/typedefs/XHRSettingsObject.js new file mode 100644 index 000000000..1ac133abc --- /dev/null +++ b/src/loader/typedefs/XHRSettingsObject.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Loader.Types.XHRSettingsObject + * @since 3.0.0 + * + * @property {XMLHttpRequestResponseType} responseType - The response type of the XHR request, i.e. `blob`, `text`, etc. + * @property {boolean} [async=true] - Should the XHR request use async or not? + * @property {string} [user=''] - Optional username for the XHR request. + * @property {string} [password=''] - Optional password for the XHR request. + * @property {integer} [timeout=0] - Optional XHR timeout value. + * @property {(string|undefined)} [header] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. + * @property {(string|undefined)} [headerValue] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. + * @property {(string|undefined)} [requestedWith] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. + * @property {(string|undefined)} [overrideMimeType] - Provide a custom mime-type to use instead of the default. + */ diff --git a/src/loader/typedefs/index.js b/src/loader/typedefs/index.js new file mode 100644 index 000000000..5fb61eede --- /dev/null +++ b/src/loader/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Loader.Types + */ diff --git a/src/math/Average.js b/src/math/Average.js index 3ac0649ca..f7dccf189 100644 --- a/src/math/Average.js +++ b/src/math/Average.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Bernstein.js b/src/math/Bernstein.js index 8477c703e..ffa7eb139 100644 --- a/src/math/Bernstein.js +++ b/src/math/Bernstein.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Between.js b/src/math/Between.js index 13870b1ec..ac8991948 100644 --- a/src/math/Between.js +++ b/src/math/Between.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/CatmullRom.js b/src/math/CatmullRom.js index 65078d127..9bb9883f3 100644 --- a/src/math/CatmullRom.js +++ b/src/math/CatmullRom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/CeilTo.js b/src/math/CeilTo.js index 3a643df62..b0a348e76 100644 --- a/src/math/CeilTo.js +++ b/src/math/CeilTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Clamp.js b/src/math/Clamp.js index 072fb1740..5dfdffa9d 100644 --- a/src/math/Clamp.js +++ b/src/math/Clamp.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/DegToRad.js b/src/math/DegToRad.js index 21c0e75c6..793f321f6 100644 --- a/src/math/DegToRad.js +++ b/src/math/DegToRad.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Difference.js b/src/math/Difference.js index 4e39dd497..3a4a6a257 100644 --- a/src/math/Difference.js +++ b/src/math/Difference.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Factorial.js b/src/math/Factorial.js index 02a0c6c3e..ccd4012d8 100644 --- a/src/math/Factorial.js +++ b/src/math/Factorial.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/FloatBetween.js b/src/math/FloatBetween.js index 95f938e5f..c5be23d82 100644 --- a/src/math/FloatBetween.js +++ b/src/math/FloatBetween.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/FloorTo.js b/src/math/FloorTo.js index 57b8fc007..e108a7af6 100644 --- a/src/math/FloorTo.js +++ b/src/math/FloorTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/FromPercent.js b/src/math/FromPercent.js index 6e7d61465..99d7aa22c 100644 --- a/src/math/FromPercent.js +++ b/src/math/FromPercent.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/GetSpeed.js b/src/math/GetSpeed.js index f4455d31c..6d0c7b614 100644 --- a/src/math/GetSpeed.js +++ b/src/math/GetSpeed.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/IsEven.js b/src/math/IsEven.js index 434a5c375..89237f5b7 100644 --- a/src/math/IsEven.js +++ b/src/math/IsEven.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/IsEvenStrict.js b/src/math/IsEvenStrict.js index 611534f46..44d028167 100644 --- a/src/math/IsEvenStrict.js +++ b/src/math/IsEvenStrict.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Linear.js b/src/math/Linear.js index b891f6803..4358a692f 100644 --- a/src/math/Linear.js +++ b/src/math/Linear.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Matrix3.js b/src/math/Matrix3.js index 081a0133d..48c3657bf 100644 --- a/src/math/Matrix3.js +++ b/src/math/Matrix3.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Matrix4.js b/src/math/Matrix4.js index f6cccf63e..831e03a50 100644 --- a/src/math/Matrix4.js +++ b/src/math/Matrix4.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/MaxAdd.js b/src/math/MaxAdd.js index 69af6f49b..231282a5f 100644 --- a/src/math/MaxAdd.js +++ b/src/math/MaxAdd.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/MinSub.js b/src/math/MinSub.js index 469c4cc69..51220cb5f 100644 --- a/src/math/MinSub.js +++ b/src/math/MinSub.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Percent.js b/src/math/Percent.js index 15421e701..5442d8da8 100644 --- a/src/math/Percent.js +++ b/src/math/Percent.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 89f900954..5737ce96f 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RadToDeg.js b/src/math/RadToDeg.js index 1bde46d4c..2f8ef3966 100644 --- a/src/math/RadToDeg.js +++ b/src/math/RadToDeg.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RandomXY.js b/src/math/RandomXY.js index 9c523c75c..97c73fd1b 100644 --- a/src/math/RandomXY.js +++ b/src/math/RandomXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RandomXYZ.js b/src/math/RandomXYZ.js index 0c8a10e8d..d4a1528a6 100644 --- a/src/math/RandomXYZ.js +++ b/src/math/RandomXYZ.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RandomXYZW.js b/src/math/RandomXYZW.js index 2a6e61e6d..c03e7a334 100644 --- a/src/math/RandomXYZW.js +++ b/src/math/RandomXYZW.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Rotate.js b/src/math/Rotate.js index 5d76060f5..1032aff33 100644 --- a/src/math/Rotate.js +++ b/src/math/Rotate.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RotateAround.js b/src/math/RotateAround.js index 90b89212e..9cd938f0d 100644 --- a/src/math/RotateAround.js +++ b/src/math/RotateAround.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RotateAroundDistance.js b/src/math/RotateAroundDistance.js index 4eaf00791..57e5f60c0 100644 --- a/src/math/RotateAroundDistance.js +++ b/src/math/RotateAroundDistance.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RotateVec3.js b/src/math/RotateVec3.js index 8fe925819..5b5532b08 100644 --- a/src/math/RotateVec3.js +++ b/src/math/RotateVec3.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RoundAwayFromZero.js b/src/math/RoundAwayFromZero.js index 634771852..ebdce5eee 100644 --- a/src/math/RoundAwayFromZero.js +++ b/src/math/RoundAwayFromZero.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/RoundTo.js b/src/math/RoundTo.js index c04e5dac1..14114c87f 100644 --- a/src/math/RoundTo.js +++ b/src/math/RoundTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/SinCosTableGenerator.js b/src/math/SinCosTableGenerator.js index cffa433d9..34a8bddc4 100644 --- a/src/math/SinCosTableGenerator.js +++ b/src/math/SinCosTableGenerator.js @@ -1,17 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} SinCosTable - * - * @property {number} sin - The sine value. - * @property {number} cos - The cosine value. - * @property {number} length - The length. - */ - /** * Generate a series of sine and cosine values. * @@ -23,7 +15,7 @@ * @param {number} [cosAmp=1] - The cosine value amplitude. * @param {number} [frequency=1] - The frequency of the values. * - * @return {SinCosTable} The generated values. + * @return {Phaser.Math.Types.SinCosTable} The generated values. */ var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) { diff --git a/src/math/SmoothStep.js b/src/math/SmoothStep.js index 6592e5a44..4b646187c 100644 --- a/src/math/SmoothStep.js +++ b/src/math/SmoothStep.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/SmootherStep.js b/src/math/SmootherStep.js index 99c9c5917..80e0cfeca 100644 --- a/src/math/SmootherStep.js +++ b/src/math/SmootherStep.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/TransformXY.js b/src/math/TransformXY.js index 7e7622526..c2021ccfe 100644 --- a/src/math/TransformXY.js +++ b/src/math/TransformXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Vector2.js b/src/math/Vector2.js index 48cb0a663..5e00b63a5 100644 --- a/src/math/Vector2.js +++ b/src/math/Vector2.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,13 +9,6 @@ var Class = require('../utils/Class'); -/** - * @typedef {object} Vector2Like - * - * @property {number} x - The x component. - * @property {number} y - The y component. - */ - /** * @classdesc * A representation of a vector in 2D space. @@ -27,7 +20,7 @@ var Class = require('../utils/Class'); * @constructor * @since 3.0.0 * - * @param {number|Vector2Like} [x] - The x component, or an object with `x` and `y` properties. + * @param {number|Phaser.Math.Types.Vector2Like} [x] - The x component, or an object with `x` and `y` properties. * @param {number} [y] - The y component. */ var Vector2 = new Class({ @@ -567,12 +560,74 @@ var Vector2 = new Class({ /** * A static zero Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. * * @constant * @name Phaser.Math.Vector2.ZERO - * @type {Vector2} + * @type {Phaser.Math.Vector2} * @since 3.1.0 */ Vector2.ZERO = new Vector2(); +/** + * A static right Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.RIGHT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.RIGHT = new Vector2(1, 0); + +/** + * A static left Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.LEFT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.LEFT = new Vector2(-1, 0); + +/** + * A static up Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.UP + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.UP = new Vector2(0, -1); + +/** + * A static down Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.DOWN + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.DOWN = new Vector2(0, 1); + +/** + * A static one Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.ONE + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.ONE = new Vector2(1, 1); + module.exports = Vector2; diff --git a/src/math/Vector3.js b/src/math/Vector3.js index a73745e09..ba2364503 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -705,76 +705,100 @@ var Vector3 = new Class({ }); -/* -Vector3.Zero = function () -{ - return new Vector3(0, 0, 0); -}; +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); -Vector3.Up = function () -{ - return new Vector3(0, 1.0, 0); -}; +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); -Vector3.Copy = function (source) -{ - return new Vector3(source.x, source.y, source.z); -}; +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); -Vector3.TransformCoordinates = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]) + transformation.m[12]; - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]) + transformation.m[13]; - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]) + transformation.m[14]; - var w = (vector.x * transformation.m[3]) + (vector.y * transformation.m[7]) + (vector.z * transformation.m[11]) + transformation.m[15]; +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); - return new Vector3(x / w, y / w, z / w); -}; +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); -Vector3.TransformNormal = function (vector, transformation) -{ - var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]); - var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]); - var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]); +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); - return new Vector3(x, y, z); -}; +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); -Vector3.Dot = function (left, right) -{ - return (left.x * right.x + left.y * right.y + left.z * right.z); -}; - -Vector3.Cross = function (left, right) -{ - var x = left.y * right.z - left.z * right.y; - var y = left.z * right.x - left.x * right.z; - var z = left.x * right.y - left.y * right.x; - - return new Vector3(x, y, z); -}; - -Vector3.Normalize = function (vector) -{ - var newVector = Vector3.Copy(vector); - newVector.normalize(); - - return newVector; -}; - -Vector3.Distance = function (value1, value2) -{ - return Math.sqrt(Vector3.DistanceSquared(value1, value2)); -}; - -Vector3.DistanceSquared = function (value1, value2) -{ - var x = value1.x - value2.x; - var y = value1.y - value2.y; - var z = value1.z - value2.z; - - return (x * x) + (y * y) + (z * z); -}; -*/ +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); module.exports = Vector3; diff --git a/src/math/Vector4.js b/src/math/Vector4.js index 14e7d9d8c..04f814ed1 100644 --- a/src/math/Vector4.js +++ b/src/math/Vector4.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Within.js b/src/math/Within.js index e31710dc1..20bca5e39 100644 --- a/src/math/Within.js +++ b/src/math/Within.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/Wrap.js b/src/math/Wrap.js index 11aec6bcb..3ffbf92e8 100644 --- a/src/math/Wrap.js +++ b/src/math/Wrap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/Between.js b/src/math/angle/Between.js index 6938bfdba..93f468e40 100644 --- a/src/math/angle/Between.js +++ b/src/math/angle/Between.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/BetweenPoints.js b/src/math/angle/BetweenPoints.js index dd344469e..89abdb8d6 100644 --- a/src/math/angle/BetweenPoints.js +++ b/src/math/angle/BetweenPoints.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/BetweenPointsY.js b/src/math/angle/BetweenPointsY.js index 8892776a2..ce5c6abb7 100644 --- a/src/math/angle/BetweenPointsY.js +++ b/src/math/angle/BetweenPointsY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/BetweenY.js b/src/math/angle/BetweenY.js index 55530b79e..60b6c42d4 100644 --- a/src/math/angle/BetweenY.js +++ b/src/math/angle/BetweenY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/CounterClockwise.js b/src/math/angle/CounterClockwise.js index cb9a0899c..30d8db432 100644 --- a/src/math/angle/CounterClockwise.js +++ b/src/math/angle/CounterClockwise.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/Normalize.js b/src/math/angle/Normalize.js index c7f9e56a0..3f0a5bdbf 100644 --- a/src/math/angle/Normalize.js +++ b/src/math/angle/Normalize.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/Reverse.js b/src/math/angle/Reverse.js index de2afcc9e..0573b9bc4 100644 --- a/src/math/angle/Reverse.js +++ b/src/math/angle/Reverse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/RotateTo.js b/src/math/angle/RotateTo.js index d7aac3711..38f86efce 100644 --- a/src/math/angle/RotateTo.js +++ b/src/math/angle/RotateTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/ShortestBetween.js b/src/math/angle/ShortestBetween.js index 993aae64d..a5c5fc8fa 100644 --- a/src/math/angle/ShortestBetween.js +++ b/src/math/angle/ShortestBetween.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/Wrap.js b/src/math/angle/Wrap.js index 1aff16f1b..70b678592 100644 --- a/src/math/angle/Wrap.js +++ b/src/math/angle/Wrap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/WrapDegrees.js b/src/math/angle/WrapDegrees.js index 69f223ac1..f7f5f88f1 100644 --- a/src/math/angle/WrapDegrees.js +++ b/src/math/angle/WrapDegrees.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/angle/index.js b/src/math/angle/index.js index bc8ca3c27..41e7fdb83 100644 --- a/src/math/angle/index.js +++ b/src/math/angle/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/const.js b/src/math/const.js index 25ba01033..cd1ef4c47 100644 --- a/src/math/const.js +++ b/src/math/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/distance/DistanceBetween.js b/src/math/distance/DistanceBetween.js index 0774cdf31..e791a2bec 100644 --- a/src/math/distance/DistanceBetween.js +++ b/src/math/distance/DistanceBetween.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/distance/DistancePower.js b/src/math/distance/DistancePower.js index 2eb3cd815..d20ac24c1 100644 --- a/src/math/distance/DistancePower.js +++ b/src/math/distance/DistancePower.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/distance/DistanceSquared.js b/src/math/distance/DistanceSquared.js index aca4c6caa..41f8f0475 100644 --- a/src/math/distance/DistanceSquared.js +++ b/src/math/distance/DistanceSquared.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/distance/index.js b/src/math/distance/index.js index d0fe68e53..0b5b65398 100644 --- a/src/math/distance/index.js +++ b/src/math/distance/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/EaseMap.js b/src/math/easing/EaseMap.js index b89fb854d..a4ec62aa2 100644 --- a/src/math/easing/EaseMap.js +++ b/src/math/easing/EaseMap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/back/In.js b/src/math/easing/back/In.js index 76c2d1c58..0e12696b6 100644 --- a/src/math/easing/back/In.js +++ b/src/math/easing/back/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/back/InOut.js b/src/math/easing/back/InOut.js index 83479b094..48dbdf22c 100644 --- a/src/math/easing/back/InOut.js +++ b/src/math/easing/back/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/back/Out.js b/src/math/easing/back/Out.js index f23422ff8..f225261b4 100644 --- a/src/math/easing/back/Out.js +++ b/src/math/easing/back/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/back/index.js b/src/math/easing/back/index.js index 041eb3fdc..e7f5536fd 100644 --- a/src/math/easing/back/index.js +++ b/src/math/easing/back/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/bounce/In.js b/src/math/easing/bounce/In.js index 00a3f9d2f..b446e257f 100644 --- a/src/math/easing/bounce/In.js +++ b/src/math/easing/bounce/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/bounce/InOut.js b/src/math/easing/bounce/InOut.js index 101b62bc8..bc86ac0eb 100644 --- a/src/math/easing/bounce/InOut.js +++ b/src/math/easing/bounce/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/bounce/Out.js b/src/math/easing/bounce/Out.js index eacc63afc..fa1df960e 100644 --- a/src/math/easing/bounce/Out.js +++ b/src/math/easing/bounce/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/bounce/index.js b/src/math/easing/bounce/index.js index 0774dc70d..1d710add3 100644 --- a/src/math/easing/bounce/index.js +++ b/src/math/easing/bounce/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/circular/In.js b/src/math/easing/circular/In.js index 0a142907f..3f8f01e5b 100644 --- a/src/math/easing/circular/In.js +++ b/src/math/easing/circular/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/circular/InOut.js b/src/math/easing/circular/InOut.js index 15b42ec92..58ac26633 100644 --- a/src/math/easing/circular/InOut.js +++ b/src/math/easing/circular/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/circular/Out.js b/src/math/easing/circular/Out.js index 54362c364..7aafdfa08 100644 --- a/src/math/easing/circular/Out.js +++ b/src/math/easing/circular/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/circular/index.js b/src/math/easing/circular/index.js index 0b5d46f2c..65afeb7f3 100644 --- a/src/math/easing/circular/index.js +++ b/src/math/easing/circular/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/cubic/In.js b/src/math/easing/cubic/In.js index e001374d7..fab124cb8 100644 --- a/src/math/easing/cubic/In.js +++ b/src/math/easing/cubic/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/cubic/InOut.js b/src/math/easing/cubic/InOut.js index 2f9a2dd3d..4ddd6f732 100644 --- a/src/math/easing/cubic/InOut.js +++ b/src/math/easing/cubic/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/cubic/Out.js b/src/math/easing/cubic/Out.js index 04d5d74e2..f6c8e904e 100644 --- a/src/math/easing/cubic/Out.js +++ b/src/math/easing/cubic/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/cubic/index.js b/src/math/easing/cubic/index.js index 9807edb8c..47d96a8d7 100644 --- a/src/math/easing/cubic/index.js +++ b/src/math/easing/cubic/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/elastic/In.js b/src/math/easing/elastic/In.js index 04a183a7e..dba291273 100644 --- a/src/math/easing/elastic/In.js +++ b/src/math/easing/elastic/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/elastic/InOut.js b/src/math/easing/elastic/InOut.js index 90853e086..912546d2f 100644 --- a/src/math/easing/elastic/InOut.js +++ b/src/math/easing/elastic/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/elastic/Out.js b/src/math/easing/elastic/Out.js index 3e4bc3824..9e18dce0d 100644 --- a/src/math/easing/elastic/Out.js +++ b/src/math/easing/elastic/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/elastic/index.js b/src/math/easing/elastic/index.js index 5483f12fe..916a10721 100644 --- a/src/math/easing/elastic/index.js +++ b/src/math/easing/elastic/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/expo/In.js b/src/math/easing/expo/In.js index d5ccdcc43..e43d4e404 100644 --- a/src/math/easing/expo/In.js +++ b/src/math/easing/expo/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/expo/InOut.js b/src/math/easing/expo/InOut.js index 135b46642..d6e0127b4 100644 --- a/src/math/easing/expo/InOut.js +++ b/src/math/easing/expo/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/expo/Out.js b/src/math/easing/expo/Out.js index 5ad82109b..7fe181fb9 100644 --- a/src/math/easing/expo/Out.js +++ b/src/math/easing/expo/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/expo/index.js b/src/math/easing/expo/index.js index 80f0bb43f..cdf09ed21 100644 --- a/src/math/easing/expo/index.js +++ b/src/math/easing/expo/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/index.js b/src/math/easing/index.js index 967f5215c..46c9ad3d2 100644 --- a/src/math/easing/index.js +++ b/src/math/easing/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/linear/Linear.js b/src/math/easing/linear/Linear.js index 2c068b444..f1b72fb0e 100644 --- a/src/math/easing/linear/Linear.js +++ b/src/math/easing/linear/Linear.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/linear/index.js b/src/math/easing/linear/index.js index d33827c97..a89cf99fd 100644 --- a/src/math/easing/linear/index.js +++ b/src/math/easing/linear/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quadratic/In.js b/src/math/easing/quadratic/In.js index 37502c88b..19fbdca50 100644 --- a/src/math/easing/quadratic/In.js +++ b/src/math/easing/quadratic/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quadratic/InOut.js b/src/math/easing/quadratic/InOut.js index 264215f0c..5260588ff 100644 --- a/src/math/easing/quadratic/InOut.js +++ b/src/math/easing/quadratic/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quadratic/Out.js b/src/math/easing/quadratic/Out.js index 904d965e7..8ddfa59ac 100644 --- a/src/math/easing/quadratic/Out.js +++ b/src/math/easing/quadratic/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quadratic/index.js b/src/math/easing/quadratic/index.js index a52f8a174..2ee0fae3e 100644 --- a/src/math/easing/quadratic/index.js +++ b/src/math/easing/quadratic/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quartic/In.js b/src/math/easing/quartic/In.js index e3e76a6a2..899e42870 100644 --- a/src/math/easing/quartic/In.js +++ b/src/math/easing/quartic/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quartic/InOut.js b/src/math/easing/quartic/InOut.js index 46dd55b6a..401fb52af 100644 --- a/src/math/easing/quartic/InOut.js +++ b/src/math/easing/quartic/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quartic/Out.js b/src/math/easing/quartic/Out.js index da7507eb4..51db16314 100644 --- a/src/math/easing/quartic/Out.js +++ b/src/math/easing/quartic/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quartic/index.js b/src/math/easing/quartic/index.js index 6afa176b9..7b777313c 100644 --- a/src/math/easing/quartic/index.js +++ b/src/math/easing/quartic/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quintic/In.js b/src/math/easing/quintic/In.js index 1ad19ba68..af4e7e468 100644 --- a/src/math/easing/quintic/In.js +++ b/src/math/easing/quintic/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quintic/InOut.js b/src/math/easing/quintic/InOut.js index 784664822..f319888f0 100644 --- a/src/math/easing/quintic/InOut.js +++ b/src/math/easing/quintic/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quintic/Out.js b/src/math/easing/quintic/Out.js index d58e69a4f..1a56ca591 100644 --- a/src/math/easing/quintic/Out.js +++ b/src/math/easing/quintic/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/quintic/index.js b/src/math/easing/quintic/index.js index 9c46b2221..45c48dcf6 100644 --- a/src/math/easing/quintic/index.js +++ b/src/math/easing/quintic/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/sine/In.js b/src/math/easing/sine/In.js index 997fd20a5..bb514a0a5 100644 --- a/src/math/easing/sine/In.js +++ b/src/math/easing/sine/In.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/sine/InOut.js b/src/math/easing/sine/InOut.js index 18a89dc29..362d63824 100644 --- a/src/math/easing/sine/InOut.js +++ b/src/math/easing/sine/InOut.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/sine/Out.js b/src/math/easing/sine/Out.js index 43886f4b7..d320ac1aa 100644 --- a/src/math/easing/sine/Out.js +++ b/src/math/easing/sine/Out.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/sine/index.js b/src/math/easing/sine/index.js index aca8dc7af..44c008c5c 100644 --- a/src/math/easing/sine/index.js +++ b/src/math/easing/sine/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/stepped/Stepped.js b/src/math/easing/stepped/Stepped.js index ff3781a7c..718a90864 100644 --- a/src/math/easing/stepped/Stepped.js +++ b/src/math/easing/stepped/Stepped.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/easing/stepped/index.js b/src/math/easing/stepped/index.js index ebd063d36..1ab7266d9 100644 --- a/src/math/easing/stepped/index.js +++ b/src/math/easing/stepped/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/fuzzy/Ceil.js b/src/math/fuzzy/Ceil.js index dd5921bae..9009b5ad2 100644 --- a/src/math/fuzzy/Ceil.js +++ b/src/math/fuzzy/Ceil.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/fuzzy/Equal.js b/src/math/fuzzy/Equal.js index cbfd7cd6d..83dd2e7ca 100644 --- a/src/math/fuzzy/Equal.js +++ b/src/math/fuzzy/Equal.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/fuzzy/Floor.js b/src/math/fuzzy/Floor.js index a9f3e7582..81e2a078a 100644 --- a/src/math/fuzzy/Floor.js +++ b/src/math/fuzzy/Floor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/fuzzy/GreaterThan.js b/src/math/fuzzy/GreaterThan.js index f67c97539..59da3809a 100644 --- a/src/math/fuzzy/GreaterThan.js +++ b/src/math/fuzzy/GreaterThan.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/fuzzy/LessThan.js b/src/math/fuzzy/LessThan.js index 22810fe95..c566041ca 100644 --- a/src/math/fuzzy/LessThan.js +++ b/src/math/fuzzy/LessThan.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/fuzzy/index.js b/src/math/fuzzy/index.js index 840a2a9da..8cf98a9f8 100644 --- a/src/math/fuzzy/index.js +++ b/src/math/fuzzy/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/index.js b/src/math/index.js index a4249ecb0..b18d9655a 100644 --- a/src/math/index.js +++ b/src/math/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/interpolation/BezierInterpolation.js b/src/math/interpolation/BezierInterpolation.js index cf2d62d5e..6b90e76f9 100644 --- a/src/math/interpolation/BezierInterpolation.js +++ b/src/math/interpolation/BezierInterpolation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/interpolation/CatmullRomInterpolation.js b/src/math/interpolation/CatmullRomInterpolation.js index 592079e1b..85ae298f9 100644 --- a/src/math/interpolation/CatmullRomInterpolation.js +++ b/src/math/interpolation/CatmullRomInterpolation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/interpolation/CubicBezierInterpolation.js b/src/math/interpolation/CubicBezierInterpolation.js index 1bf717c02..6e95280af 100644 --- a/src/math/interpolation/CubicBezierInterpolation.js +++ b/src/math/interpolation/CubicBezierInterpolation.js @@ -1,9 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @ignore + */ function P0 (t, p) { var k = 1 - t; @@ -11,6 +14,9 @@ function P0 (t, p) return k * k * k * p; } +/** + * @ignore + */ function P1 (t, p) { var k = 1 - t; @@ -18,26 +24,27 @@ function P1 (t, p) return 3 * k * k * t * p; } +/** + * @ignore + */ function P2 (t, p) { return 3 * (1 - t) * t * t * p; } +/** + * @ignore + */ 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 - /** * A cubic bezier interpolation method. * + * https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a + * * @function Phaser.Math.Interpolation.CubicBezier * @since 3.0.0 * diff --git a/src/math/interpolation/LinearInterpolation.js b/src/math/interpolation/LinearInterpolation.js index 1fce7a2ab..39b045cc1 100644 --- a/src/math/interpolation/LinearInterpolation.js +++ b/src/math/interpolation/LinearInterpolation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/interpolation/QuadraticBezierInterpolation.js b/src/math/interpolation/QuadraticBezierInterpolation.js index 177097ee7..7cf8e83e2 100644 --- a/src/math/interpolation/QuadraticBezierInterpolation.js +++ b/src/math/interpolation/QuadraticBezierInterpolation.js @@ -1,9 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @ignore + */ function P0 (t, p) { var k = 1 - t; @@ -11,20 +14,22 @@ function P0 (t, p) return k * k * p; } +/** + * @ignore + */ function P1 (t, p) { return 2 * (1 - t) * t * p; } +/** + * @ignore + */ function P2 (t, p) { return t * t * p; } -// p0 = start point -// p1 = control point 1 -// p2 = end point - // https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js /** diff --git a/src/math/interpolation/SmoothStepInterpolation.js b/src/math/interpolation/SmoothStepInterpolation.js index 1dca72222..96c56b048 100644 --- a/src/math/interpolation/SmoothStepInterpolation.js +++ b/src/math/interpolation/SmoothStepInterpolation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/interpolation/SmootherStepInterpolation.js b/src/math/interpolation/SmootherStepInterpolation.js index 2f7b7c240..f29ca9d57 100644 --- a/src/math/interpolation/SmootherStepInterpolation.js +++ b/src/math/interpolation/SmootherStepInterpolation.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/interpolation/index.js b/src/math/interpolation/index.js index b1a3f422e..102523fab 100644 --- a/src/math/interpolation/index.js +++ b/src/math/interpolation/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/pow2/GetPowerOfTwo.js b/src/math/pow2/GetPowerOfTwo.js index 37f21b5d1..6aee27692 100644 --- a/src/math/pow2/GetPowerOfTwo.js +++ b/src/math/pow2/GetPowerOfTwo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/pow2/IsSizePowerOfTwo.js b/src/math/pow2/IsSizePowerOfTwo.js index dcc31bfbc..aad022ba5 100644 --- a/src/math/pow2/IsSizePowerOfTwo.js +++ b/src/math/pow2/IsSizePowerOfTwo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/pow2/IsValuePowerOfTwo.js b/src/math/pow2/IsValuePowerOfTwo.js index 0b82221db..6faa41317 100644 --- a/src/math/pow2/IsValuePowerOfTwo.js +++ b/src/math/pow2/IsValuePowerOfTwo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/pow2/index.js b/src/math/pow2/index.js index c388dc2d6..e8c1c7a04 100644 --- a/src/math/pow2/index.js +++ b/src/math/pow2/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/random-data-generator/RandomDataGenerator.js b/src/math/random-data-generator/RandomDataGenerator.js index 5b1e6efe4..bd5e12398 100644 --- a/src/math/random-data-generator/RandomDataGenerator.js +++ b/src/math/random-data-generator/RandomDataGenerator.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/snap/SnapCeil.js b/src/math/snap/SnapCeil.js index 35a09c386..3a620e050 100644 --- a/src/math/snap/SnapCeil.js +++ b/src/math/snap/SnapCeil.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/snap/SnapFloor.js b/src/math/snap/SnapFloor.js index a25b7c99a..8f0c5bcc2 100644 --- a/src/math/snap/SnapFloor.js +++ b/src/math/snap/SnapFloor.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/snap/SnapTo.js b/src/math/snap/SnapTo.js index f441dd34c..7bb731ff4 100644 --- a/src/math/snap/SnapTo.js +++ b/src/math/snap/SnapTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/snap/index.js b/src/math/snap/index.js index fe4219e63..2bd1c0cf5 100644 --- a/src/math/snap/index.js +++ b/src/math/snap/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/math/typedefs/SinCosTable.js b/src/math/typedefs/SinCosTable.js new file mode 100644 index 000000000..bbdfa610f --- /dev/null +++ b/src/math/typedefs/SinCosTable.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Math.Types.SinCosTable + * @since 3.0.0 + * + * @property {number} sin - The sine value. + * @property {number} cos - The cosine value. + * @property {number} length - The length. + */ diff --git a/src/math/typedefs/Vector2Like.js b/src/math/typedefs/Vector2Like.js new file mode 100644 index 000000000..33ec77f0e --- /dev/null +++ b/src/math/typedefs/Vector2Like.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Math.Types.Vector2Like + * @since 3.0.0 + * + * @property {number} [x] - The x component. + * @property {number} [y] - The y component. + */ diff --git a/src/math/typedefs/index.js b/src/math/typedefs/index.js new file mode 100644 index 000000000..9123f039c --- /dev/null +++ b/src/math/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Math.Types + */ diff --git a/src/phaser-arcade-physics.js b/src/phaser-arcade-physics.js index e10f2f477..aa2c76eb7 100644 --- a/src/phaser-arcade-physics.js +++ b/src/phaser-arcade-physics.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,9 +16,10 @@ var Extend = require('./utils/object/Extend'); var Phaser = { Actions: require('./actions'), - Animation: require('./animations'), + Animations: require('./animations'), Cache: require('./cache'), Cameras: require('./cameras'), + Core: require('./core'), Class: require('./utils/Class'), Create: require('./create'), Curves: require('./curves'), @@ -26,7 +27,7 @@ var Phaser = { Display: require('./display'), DOM: require('./dom'), Events: require('./events'), - Game: require('./boot/Game'), + Game: require('./core/Game'), GameObjects: require('./gameobjects'), Geom: require('./geom'), Input: require('./input'), @@ -36,6 +37,7 @@ var Phaser = { Arcade: require('./physics/arcade') }, Plugins: require('./plugins'), + Scale: require('./scale'), Scene: require('./scene/Scene'), Scenes: require('./scene'), Sound: require('./sound'), diff --git a/src/phaser-core.js b/src/phaser-core.js index a5bc079b1..d5e290cc4 100644 --- a/src/phaser-core.js +++ b/src/phaser-core.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,14 +15,15 @@ var Extend = require('./utils/object/Extend'); var Phaser = { - Animation: require('./animations'), + Animations: require('./animations'), Cache: require('./cache'), Cameras: { Scene2D: require('./cameras/2d') }, + Core: require('./core'), Class: require('./utils/Class'), Data: require('./data'), Display: { Masks: require('./display/mask') }, Events: require('./events'), - Game: require('./boot/Game'), + Game: require('./core/Game'), GameObjects: { DisplayList: require('./gameobjects/DisplayList'), GameObjectCreator: require('./gameobjects/GameObjectCreator'), @@ -84,6 +85,7 @@ var Phaser = { }, Plugins: require('./plugins'), Renderer: require('./renderer'), + Scale: require('./scale'), Scene: require('./scene/Scene'), Scenes: require('./scene'), Sound: require('./sound'), diff --git a/src/phaser.js b/src/phaser.js index 177a65114..a584024c9 100644 --- a/src/phaser.js +++ b/src/phaser.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,9 +16,10 @@ var Extend = require('./utils/object/Extend'); var Phaser = { Actions: require('./actions'), - Animation: require('./animations'), + Animations: require('./animations'), Cache: require('./cache'), Cameras: require('./cameras'), + Core: require('./core'), Class: require('./utils/Class'), Create: require('./create'), Curves: require('./curves'), @@ -26,7 +27,7 @@ var Phaser = { Display: require('./display'), DOM: require('./dom'), Events: require('./events'), - Game: require('./boot/Game'), + Game: require('./core/Game'), GameObjects: require('./gameobjects'), Geom: require('./geom'), Input: require('./input'), @@ -35,6 +36,7 @@ var Phaser = { Physics: require('./physics'), Plugins: require('./plugins'), Renderer: require('./renderer'), + Scale: require('./scale'), Scene: require('./scene/Scene'), Scenes: require('./scene'), Sound: require('./sound'), diff --git a/src/physics/arcade/ArcadeImage.js b/src/physics/arcade/ArcadeImage.js index 13e7ae587..0721e41b9 100644 --- a/src/physics/arcade/ArcadeImage.js +++ b/src/physics/arcade/ArcadeImage.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/ArcadePhysics.js b/src/physics/arcade/ArcadePhysics.js index fe16c44b5..62e211fc7 100644 --- a/src/physics/arcade/ArcadePhysics.js +++ b/src/physics/arcade/ArcadePhysics.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ var Factory = require('./Factory'); var GetFastValue = require('../../utils/object/GetFastValue'); var Merge = require('../../utils/object/Merge'); var PluginCache = require('../../plugins/PluginCache'); +var SceneEvents = require('../../scene/events'); var Vector2 = require('../../math/Vector2'); var World = require('./World'); @@ -21,6 +22,11 @@ var World = require('./World'); * It also holds some useful methods for moving and rotating Arcade Physics Bodies. * * You can access it from within a Scene using `this.physics`. + * + * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable + * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. + * The separation that stops two objects penetrating may create a new penetration against a different object. If you + * require a high level of stability please consider using an alternative physics system, such as Matter.js. * * @class ArcadePhysics * @memberof Phaser.Physics.Arcade @@ -80,8 +86,8 @@ var ArcadePhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -97,7 +103,7 @@ var ArcadePhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -119,9 +125,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -151,8 +157,8 @@ var ArcadePhysics = new Class({ * @method Phaser.Physics.Arcade.ArcadePhysics#overlap * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {*} [callbackContext] - The context in which to run the callbacks. @@ -171,13 +177,30 @@ var ArcadePhysics = new Class({ }, /** - * Tests if Game Objects overlap and separates them (if possible). See {@link Phaser.Physics.Arcade.World#collide}. + * Performs a collision check and separation between the two physics enabled objects given, which can be single + * Game Objects, arrays of Game Objects, Physics Groups, arrays of Physics Groups or normal Groups. + * + * If you don't require separation then use {@link #overlap} instead. + * + * If two Groups or arrays are passed, each member of one will be tested against each member of the other. + * + * If **only** one Group is passed (as `object1`), each member of the Group will be collided against the other members. + * + * If **only** one Array is passed, the array is iterated and every element in it is tested against the others. + * + * Two callbacks can be provided. The `collideCallback` is invoked if a collision occurs and the two colliding + * objects are passed to it. + * + * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable + * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. + * The separation that stops two objects penetrating may create a new penetration against a different object. If you + * require a high level of stability please consider using an alternative physics system, such as Matter.js. * * @method Phaser.Physics.Arcade.ArcadePhysics#collide * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {*} [callbackContext] - The context in which to run the callbacks. @@ -195,6 +218,67 @@ var ArcadePhysics = new Class({ return this.world.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false); }, + /** + * This advanced method is specifically for testing for collision between a single Sprite and an array of Tile objects. + * + * You should generally use the `collide` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for collision with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic collisions + * on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * Important: Use of this method skips the `interesting faces` system that Tilemap Layers use. This means if you have + * say a row or column of tiles, and you jump into, or walk over them, it's possible to get stuck on the edges of the + * tiles as the interesting face calculations are skipped. However, for quick-fire small collision set tests on + * dynamic maps, this method can prove very useful. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#collideTiles + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + return this.world.collideTiles(sprite, tiles, collideCallback, processCallback, callbackContext); + }, + + /** + * This advanced method is specifically for testing for overlaps between a single Sprite and an array of Tile objects. + * + * You should generally use the `overlap` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for overlaps with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic overlap + * tests on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#overlapTiles + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects overlap. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + overlapTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + return this.world.overlapTiles(sprite, tiles, collideCallback, processCallback, callbackContext); + }, + /** * Pauses the simulation. * @@ -282,27 +366,29 @@ var ArcadePhysics = new Class({ }, /** - * Finds the Body closest to a source point or object. + * Finds the Dynamic Body closest to a source point or object. + * + * If two or more bodies are the exact same distance from the source point, only the first body + * is returned. * * @method Phaser.Physics.Arcade.ArcadePhysics#closest * @since 3.0.0 * - * @param {object} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. + * @param {any} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. * - * @return {Phaser.Physics.Arcade.Body} The closest Body to the given source point. + * @return {Phaser.Physics.Arcade.Body} The closest Dynamic Body to the given source point. */ closest: function (source) { - var bodies = this.world.tree.all(); + var bodies = this.world.bodies; var min = Number.MAX_VALUE; var closest = null; var x = source.x; var y = source.y; - for (var i = bodies.length - 1; i >= 0; i--) + bodies.iterate(function (target) { - var target = bodies[i]; var distance = DistanceSquared(x, y, target.x, target.y); if (distance < min) @@ -310,33 +396,36 @@ var ArcadePhysics = new Class({ closest = target; min = distance; } - } + + }); return closest; }, /** - * Finds the Body farthest from a source point or object. + * Finds the Dynamic Body farthest from a source point or object. + * + * If two or more bodies are the exact same distance from the source point, only the first body + * is returned. * * @method Phaser.Physics.Arcade.ArcadePhysics#furthest * @since 3.0.0 * - * @param {object} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. + * @param {any} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. * - * @return {Phaser.Physics.Arcade.Body} The Body furthest from the given source point. + * @return {Phaser.Physics.Arcade.Body} The Dynamic Body furthest away from the given source point. */ furthest: function (source) { - var bodies = this.world.tree.all(); + var bodies = this.world.bodies; var max = -1; var farthest = null; var x = source.x; var y = source.y; - for (var i = bodies.length - 1; i >= 0; i--) + bodies.iterate(function (target) { - var target = bodies[i]; var distance = DistanceSquared(x, y, target.x, target.y); if (distance > max) @@ -344,7 +433,8 @@ var ArcadePhysics = new Class({ farthest = target; max = distance; } - } + + }); return farthest; }, @@ -451,6 +541,76 @@ var ArcadePhysics = new Class({ return vec2.setToPolar(rotation, speed); }, + /** + * This method will search the given rectangular area and return an array of all physics bodies that + * overlap with it. It can return either Dynamic or Static bodies. If Arcade Physics is set to use + * the RTree (which it is by default) then the search is extremely fast, otherwise the search is O(N). + * + * @method Phaser.Physics.Arcade.ArcadePhysics#overlapRect + * @since 3.17.0 + * + * @param {number} x - The top-left x coordinate of the area to search within. + * @param {number} y - The top-left y coordinate of the area to search within. + * @param {number} width - The width of the area to search within. + * @param {number} height - The height of the area to search within. + * @param {boolean} [dynamic=true] - Search for Dynamic Bodies (true) or Static Bodies (false) + * + * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. + */ + overlapRect: function (x, y, width, height, dynamic) + { + if (dynamic === undefined) { dynamic = true; } + + var output = []; + var world = this.world; + + var minMax = world.treeMinMax; + + minMax.minX = x; + minMax.minY = y; + minMax.maxX = x + width; + minMax.maxY = y + height; + + if (!dynamic) + { + output = world.staticTree.search(minMax); + } + else if (world.useTree) + { + output = world.tree.search(minMax); + } + else + { + var bodies = world.bodies; + + var fakeBody = + { + position: { + x: x, + y: y + }, + left: x, + top: y, + right: x + width, + bottom: y + height, + isCircle: false + }; + + var intersects = world.intersects; + + bodies.iterate(function (target) + { + if (intersects(target, fakeBody)) + { + output.push(target); + } + + }); + } + + return output; + }, + /** * The Scene that owns this plugin is shutting down. * We need to kill and reset all internal properties as well as stop listening to Scene events. @@ -468,9 +628,9 @@ var ArcadePhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -490,7 +650,7 @@ var ArcadePhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/physics/arcade/ArcadeSprite.js b/src/physics/arcade/ArcadeSprite.js index cd5954ae6..870f54773 100644 --- a/src/physics/arcade/ArcadeSprite.js +++ b/src/physics/arcade/ArcadeSprite.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/Body.js b/src/physics/arcade/Body.js index 524c23dde..4ef4d954e 100644 --- a/src/physics/arcade/Body.js +++ b/src/physics/arcade/Body.js @@ -1,36 +1,18 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CircleContains = require('../../geom/circle/Contains'); var Class = require('../../utils/Class'); var CONST = require('./const'); +var Events = require('./events'); var RadToDeg = require('../../math/RadToDeg'); var Rectangle = require('../../geom/rectangle/Rectangle'); var RectangleContains = require('../../geom/rectangle/Contains'); var Vector2 = require('../../math/Vector2'); -/** - * @typedef {object} ArcadeBodyBounds - * - * @property {number} x - The left edge. - * @property {number} y - The upper edge. - * @property {number} right - The right edge. - * @property {number} bottom - The lower edge. - */ - -/** - * @typedef {object} ArcadeBodyCollision - * - * @property {boolean} none - True if the Body is not colliding. - * @property {boolean} up - True if the Body is colliding on its upper edge. - * @property {boolean} down - True if the Body is colliding on its lower edge. - * @property {boolean} left - True if the Body is colliding on its left edge. - * @property {boolean} right - True if the Body is colliding on its right edge. - */ - /** * @classdesc * A Dynamic Arcade Body. @@ -401,7 +383,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#worldboundsEvent + * @see Phaser.Physics.Arcade.Events#WORLD_BOUNDS */ this.onWorldBounds = false; @@ -412,7 +394,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#collideEvent + * @see Phaser.Physics.Arcade.Events#COLLIDE */ this.onCollide = false; @@ -423,7 +405,7 @@ var Body = new Class({ * @type {boolean} * @default false * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#overlapEvent + * @see Phaser.Physics.Arcade.Events#OVERLAP */ this.onOverlap = false; @@ -437,6 +419,19 @@ var Body = new Class({ */ this.maxVelocity = new Vector2(10000, 10000); + /** + * The maximum speed this Body is allowed to reach. + * + * If not negative it limits the scalar value of speed. + * + * Any negative value means no maximum is being applied. + * + * @name Phaser.Physics.Arcade.Body#maxSpeed + * @type {number} + * @since 3.16.0 + */ + this.maxSpeed = -1; + /** * If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1. * The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all. @@ -647,7 +642,7 @@ var Body = new Class({ * You can set `checkCollision.none = true` to disable collision checks. * * @name Phaser.Physics.Arcade.Body#checkCollision - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; @@ -656,7 +651,7 @@ var Body = new Class({ * Whether this Body is colliding with another and in which direction. * * @name Phaser.Physics.Arcade.Body#touching - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.touching = { none: true, up: false, down: false, left: false, right: false }; @@ -665,7 +660,7 @@ var Body = new Class({ * Whether this Body was colliding with another during the last step, and in which direction. * * @name Phaser.Physics.Arcade.Body#wasTouching - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; @@ -674,7 +669,7 @@ var Body = new Class({ * Whether this Body is colliding with a tile or the world boundary. * * @name Phaser.Physics.Arcade.Body#blocked - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.blocked = { none: true, up: false, down: false, left: false, right: false }; @@ -870,15 +865,15 @@ var Body = new Class({ }, /** - * Updates the Body. + * Prepares the Body for a physics step by resetting all the states and syncing the position + * with the parent Game Object. + * + * This method is only ever called once per game step. * - * @method Phaser.Physics.Arcade.Body#update - * @fires Phaser.Physics.Arcade.World#worldbounds - * @since 3.0.0 - * - * @param {number} delta - The delta time, in seconds, elapsed since the last frame. + * @method Phaser.Physics.Arcade.Body#preUpdate + * @since 3.17.0 */ - update: function (delta) + preUpdate: function () { // Store and reset collision flags this.wasTouching.none = this.touching.none; @@ -924,7 +919,24 @@ var Body = new Class({ this.prev.x = this.position.x; this.prev.y = this.position.y; } + }, + /** + * Performs a single physics step and updates the body velocity, angle, speed and other + * properties. + * + * This method can be called multiple times per game step. + * + * The results are synced back to the Game Object in `postUpdate`. + * + * @method Phaser.Physics.Arcade.Body#update + * @fires Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * @since 3.0.0 + * + * @param {number} delta - The delta time, in seconds, elapsed since the last frame. + */ + update: function (delta) + { if (this.moves) { this.world.updateMotion(this, delta); @@ -940,83 +952,118 @@ var Body = new Class({ this.angle = Math.atan2(vy, vx); this.speed = Math.sqrt(vx * vx + vy * vy); + } - // Now the State update will throw collision checks at the Body - // And finally we'll integrate the new position back to the Sprite in postUpdate + // Calculate the delta + this._dx = this.position.x - this.prev.x; + this._dy = this.position.y - this.prev.y; - if (this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds) + // World Bounds check + if (this.collideWorldBounds && this.checkWorldBounds()) + { + var bx = (this.worldBounce) ? -this.worldBounce.x : -this.bounce.x; + var by = (this.worldBounce) ? -this.worldBounce.y : -this.bounce.y; + var blocked = this.blocked; + + if (blocked.left || blocked.right) { - this.world.emit('worldbounds', this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); + if (bx !== 0) + { + // Reverse the velocity for the bounce and flip the delta + this.velocity.x *= bx; + this._dx *= -1; + } + } + + if (blocked.up || blocked.down) + { + if (by !== 0) + { + // Reverse the velocity for the bounce and flip the delta + this.velocity.y *= by; + this._dy *= -1; + } + } + + if (this.onWorldBounds) + { + this.world.emit(Events.WORLD_BOUNDS, this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); } } - this._dx = this.position.x - this.prev.x; - this._dy = this.position.y - this.prev.y; + // Now the update will throw collision checks at the Body + // And finally we'll integrate the new position back to the Sprite in postUpdate }, /** * Feeds the Body results back into the parent Game Object. + * + * This method is only ever called once per game step. * * @method Phaser.Physics.Arcade.Body#postUpdate * @since 3.0.0 - * - * @param {boolean} resetDelta - Reset the delta properties? */ postUpdate: function () { - this._dx = this.position.x - this.prev.x; - this._dy = this.position.y - this.prev.y; + var dx = this.position.x - this.prev.x; + var dy = this.position.y - this.prev.y; if (this.moves) { - if (this.deltaMax.x !== 0 && this._dx !== 0) + var mx = this.deltaMax.x; + var my = this.deltaMax.y; + + if (mx !== 0 && dx !== 0) { - if (this._dx < 0 && this._dx < -this.deltaMax.x) + if (dx < 0 && dx < -mx) { - this._dx = -this.deltaMax.x; + dx = -mx; } - else if (this._dx > 0 && this._dx > this.deltaMax.x) + else if (dx > 0 && dx > mx) { - this._dx = this.deltaMax.x; + dx = mx; } } - if (this.deltaMax.y !== 0 && this._dy !== 0) + if (my !== 0 && dy !== 0) { - if (this._dy < 0 && this._dy < -this.deltaMax.y) + if (dy < 0 && dy < -my) { - this._dy = -this.deltaMax.y; + dy = -my; } - else if (this._dy > 0 && this._dy > this.deltaMax.y) + else if (dy > 0 && dy > my) { - this._dy = this.deltaMax.y; + dy = my; } } - this.gameObject.x += this._dx; - this.gameObject.y += this._dy; + this.gameObject.x += dx; + this.gameObject.y += dy; this._reset = true; } - if (this._dx < 0) + if (dx < 0) { this.facing = CONST.FACING_LEFT; } - else if (this._dx > 0) + else if (dx > 0) { this.facing = CONST.FACING_RIGHT; } - if (this._dy < 0) + if (dy < 0) { this.facing = CONST.FACING_UP; } - else if (this._dy > 0) + else if (dy > 0) { this.facing = CONST.FACING_DOWN; } + this._dx = dx; + this._dy = dy; + if (this.allowRotation) { this.gameObject.angle += this.deltaZ(); @@ -1039,41 +1086,40 @@ var Body = new Class({ var pos = this.position; var bounds = this.world.bounds; var check = this.world.checkCollision; + var set = false; - var bx = (this.worldBounce) ? -this.worldBounce.x : -this.bounce.x; - var by = (this.worldBounce) ? -this.worldBounce.y : -this.bounce.y; - - if (pos.x < bounds.x && check.left) + if (pos.x <= bounds.x && check.left) { + set = true; pos.x = bounds.x; - this.velocity.x *= bx; - this.blocked.left = true; - this.blocked.none = false; + this.setBlockedLeft(); } - else if (this.right > bounds.right && check.right) + else if (this.right >= bounds.right && check.right) { + set = true; pos.x = bounds.right - this.width; - this.velocity.x *= bx; - this.blocked.right = true; - this.blocked.none = false; + this.setBlockedRight(); } - if (pos.y < bounds.y && check.up) + if (pos.y <= bounds.y && check.up) { + set = true; pos.y = bounds.y; - this.velocity.y *= by; - this.blocked.up = true; - this.blocked.none = false; + this.setBlockedUp(); } - else if (this.bottom > bounds.bottom && check.down) + else if (this.bottom >= bounds.bottom && check.down) { + set = true; pos.y = bounds.bottom - this.height; - this.velocity.y *= by; - this.blocked.down = true; - this.blocked.none = false; + this.setBlockedDown(); } - return !this.blocked.none; + if (set) + { + this.updateCenter(); + } + + return set; }, /** @@ -1223,6 +1269,24 @@ var Body = new Class({ this.updateCenter(); }, + zeroX: function () + { + this.velocity.x = 0; + this.prev.x = this.position.x; + this._dx = 0; + + return this; + }, + + zeroY: function () + { + this.velocity.y = 0; + this.prev.y = this.position.y; + this._dy = 0; + + return this; + }, + /** * Sets acceleration, velocity, and speed to zero. * @@ -1248,9 +1312,9 @@ var Body = new Class({ * @method Phaser.Physics.Arcade.Body#getBounds * @since 3.0.0 * - * @param {ArcadeBodyBounds} obj - An object to copy the values into. + * @param {Phaser.Physics.Arcade.Types.ArcadeBodyBounds} obj - An object to copy the values into. * - * @return {ArcadeBodyBounds} - An object with {x, y, right, bottom}. + * @return {Phaser.Physics.Arcade.Types.ArcadeBodyBounds} - An object with {x, y, right, bottom}. */ getBounds: function (obj) { @@ -1330,7 +1394,7 @@ var Body = new Class({ */ deltaAbsX: function () { - return (this._dx > 0) ? this._dx : -this._dx; + return Math.abs(this._dx); }, /** @@ -1343,7 +1407,7 @@ var Body = new Class({ */ deltaAbsY: function () { - return (this._dy > 0) ? this._dy : -this._dy; + return Math.abs(this._dy); }, /** @@ -1553,6 +1617,23 @@ var Body = new Class({ return this; }, + /** + * Sets the maximum speed the Body can move. + * + * @method Phaser.Physics.Arcade.Body#setMaxSpeed + * @since 3.16.0 + * + * @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxSpeed: function (value) + { + this.maxSpeed = value; + + return this; + }, + /** * Sets the Body's bounce. * @@ -1605,6 +1686,152 @@ var Body = new Class({ return this; }, + setTouchingUp: function () + { + var touching = this.touching; + + touching.up = true; + touching.none = false; + + return this; + }, + + setTouchingDown: function () + { + var touching = this.touching; + + touching.down = true; + touching.none = false; + + return this; + }, + + setTouchingLeft: function () + { + var touching = this.touching; + + touching.left = true; + touching.none = false; + + return this; + }, + + setTouchingRight: function () + { + var touching = this.touching; + + touching.right = true; + touching.none = false; + + return this; + }, + + setBlockedUp: function () + { + var blocked = this.blocked; + + blocked.up = true; + blocked.none = false; + + return this; + }, + + setBlockedDown: function () + { + var blocked = this.blocked; + + blocked.down = true; + blocked.none = false; + + return this; + }, + + setBlockedLeft: function () + { + var blocked = this.blocked; + + blocked.left = true; + blocked.none = false; + + return this; + }, + + setBlockedRight: function () + { + var blocked = this.blocked; + + blocked.right = true; + blocked.none = false; + + return this; + }, + + getMoveX: function (amount, setBlocked) + { + if (setBlocked === undefined) { setBlocked = false; } + + var blocked = this.blocked; + + if (amount < 0 && blocked.left || amount > 0 && blocked.right) + { + // If it's already blocked, it can't go anywhere + return 0; + } + + if (this.checkWorldBounds) + { + var pos = this.position; + var bounds = this.world.bounds; + var check = this.world.checkCollision; + + if (amount < 0 && check.left && pos.x + amount < bounds.x) + { + this.setBlockedLeft(); + return amount - ((pos.x + amount) - bounds.x); + } + else if (amount > 0 && check.right && this.right + amount > bounds.right) + { + this.setBlockedRight(); + return amount - ((this.right + amount) - bounds.right); + } + } + + return amount; + }, + + getMoveY: function (amount, setBlocked) + { + if (setBlocked === undefined) { setBlocked = false; } + + var blocked = this.blocked; + + if (amount < 0 && blocked.up || amount > 0 && blocked.down) + { + // If it's already blocked, it can't go anywhere + return 0; + } + + if (this.checkWorldBounds) + { + var pos = this.position; + var bounds = this.world.bounds; + var check = this.world.checkCollision; + + if (amount < 0 && check.up && pos.y + amount < bounds.y) + { + this.setBlockedUp(); + return amount - ((pos.y + amount) - bounds.y); + } + else if (amount > 0 && check.down && this.bottom + amount > bounds.bottom) + { + this.setBlockedDown(); + return amount - ((this.bottom + amount) - bounds.bottom); + } + } + + return amount; + }, + /** * Sets the Body's acceleration. * diff --git a/src/physics/arcade/Collider.js b/src/physics/arcade/Collider.js index 5a35ecbc7..34defa1b6 100644 --- a/src/physics/arcade/Collider.js +++ b/src/physics/arcade/Collider.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,8 +18,8 @@ var Class = require('../../utils/Class'); * * @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions. * @param {boolean} overlapOnly - Whether to check for collisions or overlap. - * @param {ArcadeColliderType} object1 - The first object to check for collision. - * @param {ArcadeColliderType} object2 - The second object to check for collision. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. * @param {any} callbackContext - The scope in which to call the callbacks. @@ -71,7 +71,7 @@ var Collider = new Class({ * The first object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object1 - * @type {ArcadeColliderType} + * @type {Phaser.Physics.Arcade.Types.ArcadeColliderType} * @since 3.0.0 */ this.object1 = object1; @@ -80,7 +80,7 @@ var Collider = new Class({ * The second object to check for collision. * * @name Phaser.Physics.Arcade.Collider#object2 - * @type {ArcadeColliderType} + * @type {Phaser.Physics.Arcade.Types.ArcadeColliderType} * @since 3.0.0 */ this.object2 = object2; diff --git a/src/physics/arcade/Factory.js b/src/physics/arcade/Factory.js index ac87f1005..90b2b54dd 100644 --- a/src/physics/arcade/Factory.js +++ b/src/physics/arcade/Factory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -220,8 +220,8 @@ var Factory = new Class({ * @method Phaser.Physics.Arcade.Factory#staticGroup * @since 3.0.0 * - * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {GroupConfig|GroupCreateConfig} [config] - Settings for this group. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} [config] - Settings for this group. * * @return {Phaser.Physics.Arcade.StaticGroup} The Static Group object that was created. */ @@ -237,8 +237,8 @@ var Factory = new Class({ * @method Phaser.Physics.Arcade.Factory#group * @since 3.0.0 * - * @param {(Phaser.GameObjects.GameObject[]|PhysicsGroupConfig|GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {PhysicsGroupConfig|GroupCreateConfig} [config] - Settings for this group. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Physics.Arcade.Types.PhysicsGroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Physics.Arcade.Types.PhysicsGroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} [config] - Settings for this group. * * @return {Phaser.Physics.Arcade.Group} The Group object that was created. */ diff --git a/src/physics/arcade/GetOverlapX.js b/src/physics/arcade/GetOverlapX.js index 15283c24f..254d28f9f 100644 --- a/src/physics/arcade/GetOverlapX.js +++ b/src/physics/arcade/GetOverlapX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/GetOverlapY.js b/src/physics/arcade/GetOverlapY.js index 03f8ca31f..32486c56d 100644 --- a/src/physics/arcade/GetOverlapY.js +++ b/src/physics/arcade/GetOverlapY.js @@ -1,14 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CONST = require('./const'); - /** - * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties - * accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'. + * Calculates and returns the vertical overlap between two arcade physics bodies. * * @function Phaser.Physics.Arcade.GetOverlapY * @since 3.0.0 @@ -16,7 +13,7 @@ var CONST = require('./const'); * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? - * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling (sprites passing through each other instead of colliding). * * @return {number} The amount of overlap. */ @@ -25,71 +22,40 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias) var overlap = 0; var maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + bias; - if (body1._dy === 0 && body2._dy === 0) + var body1Down = (body1._dy > body2._dy); + + if (body1._dy === body2._dy) { - // They overlap but neither of them are moving - body1.embedded = true; - body2.embedded = true; + // Neither of them has a faster velocity, but we still need to separate them + + // Try to figure it out based on overlap size + var distance1 = body1.bottom - body2.y; + var distance2 = body2.bottom - body1.y; + + body1Down = (distance1 < distance2); } - else if (body1._dy > body2._dy) + + if (body1Down) { - // Body1 is moving down and/or Body2 is moving up + // body1 is moving down and body2 is either moving up, moving slower than body1, or static overlap = body1.bottom - body2.y; if ((overlap > maxOverlap && !overlapOnly) || body1.checkCollision.down === false || body2.checkCollision.up === false) { overlap = 0; } - else - { - body1.touching.none = false; - body1.touching.down = true; - - body2.touching.none = false; - body2.touching.up = true; - - if (body2.physicsType === CONST.STATIC_BODY) - { - body1.blocked.none = false; - body1.blocked.down = true; - } - - if (body1.physicsType === CONST.STATIC_BODY) - { - body2.blocked.none = false; - body2.blocked.up = true; - } - } } - else if (body1._dy < body2._dy) + else { - // Body1 is moving up and/or Body2 is moving down + // body1 is moving up and body2 is either moving down, moving slower than body1, or static overlap = body1.y - body2.bottom; + // console.log('body1 faster up', overlap); + if ((-overlap > maxOverlap && !overlapOnly) || body1.checkCollision.up === false || body2.checkCollision.down === false) { overlap = 0; } - else - { - body1.touching.none = false; - body1.touching.up = true; - - body2.touching.none = false; - body2.touching.down = true; - - if (body2.physicsType === CONST.STATIC_BODY) - { - body1.blocked.none = false; - body1.blocked.up = true; - } - - if (body1.physicsType === CONST.STATIC_BODY) - { - body2.blocked.none = false; - body2.blocked.down = true; - } - } } // Resets the overlapY to zero if there is no overlap, or to the actual pixel value if there is diff --git a/src/physics/arcade/PhysicsGroup.js b/src/physics/arcade/PhysicsGroup.js index 5d090b823..3e4166d61 100644 --- a/src/physics/arcade/PhysicsGroup.js +++ b/src/physics/arcade/PhysicsGroup.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,61 +11,6 @@ var GetFastValue = require('../../utils/object/GetFastValue'); var Group = require('../../gameobjects/group/Group'); var IsPlainObject = require('../../utils/object/IsPlainObject'); -/** - * @typedef {object} PhysicsGroupConfig - * @extends GroupConfig - * - * @property {boolean} [collideWorldBounds=false] - Sets {@link Phaser.Physics.Arcade.Body#collideWorldBounds}. - * @property {number} [accelerationX=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.x}. - * @property {number} [accelerationY=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.y}. - * @property {boolean} [allowDrag=true] - Sets {@link Phaser.Physics.Arcade.Body#allowDrag}. - * @property {boolean} [allowGravity=true] - Sets {@link Phaser.Physics.Arcade.Body#allowGravity}. - * @property {boolean} [allowRotation=true] - Sets {@link Phaser.Physics.Arcade.Body#allowRotation}. - * @property {number} [bounceX=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.x}. - * @property {number} [bounceY=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.y}. - * @property {number} [dragX=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.x}. - * @property {number} [dragY=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.y}. - * @property {boolean} [enable=true] - Sets {@link Phaser.Physics.Arcade.Body#enable enable}. - * @property {number} [gravityX=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.x}. - * @property {number} [gravityY=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.y}. - * @property {number} [frictionX=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.x}. - * @property {number} [frictionY=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.y}. - * @property {number} [velocityX=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.x}. - * @property {number} [velocityY=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.y}. - * @property {number} [angularVelocity=0] - Sets {@link Phaser.Physics.Arcade.Body#angularVelocity}. - * @property {number} [angularAcceleration=0] - Sets {@link Phaser.Physics.Arcade.Body#angularAcceleration}. - * @property {number} [angularDrag=0] - Sets {@link Phaser.Physics.Arcade.Body#angularDrag}. - * @property {number} [mass=0] - Sets {@link Phaser.Physics.Arcade.Body#mass}. - * @property {boolean} [immovable=false] - Sets {@link Phaser.Physics.Arcade.Body#immovable}. - */ - -/** - * @typedef {object} PhysicsGroupDefaults - * - * @property {boolean} setCollideWorldBounds - As {@link Phaser.Physics.Arcade.Body#setCollideWorldBounds}. - * @property {number} setAccelerationX - As {@link Phaser.Physics.Arcade.Body#setAccelerationX}. - * @property {number} setAccelerationY - As {@link Phaser.Physics.Arcade.Body#setAccelerationY}. - * @property {boolean} setAllowDrag - As {@link Phaser.Physics.Arcade.Body#setAllowDrag}. - * @property {boolean} setAllowGravity - As {@link Phaser.Physics.Arcade.Body#setAllowGravity}. - * @property {boolean} setAllowRotation - As {@link Phaser.Physics.Arcade.Body#setAllowRotation}. - * @property {number} setBounceX - As {@link Phaser.Physics.Arcade.Body#setBounceX}. - * @property {number} setBounceY - As {@link Phaser.Physics.Arcade.Body#setBounceY}. - * @property {number} setDragX - As {@link Phaser.Physics.Arcade.Body#setDragX}. - * @property {number} setDragY - As {@link Phaser.Physics.Arcade.Body#setDragY}. - * @property {boolean} setEnable - As {@link Phaser.Physics.Arcade.Body#setEnable}. - * @property {number} setGravityX - As {@link Phaser.Physics.Arcade.Body#setGravityX}. - * @property {number} setGravityY - As {@link Phaser.Physics.Arcade.Body#setGravityY}. - * @property {number} setFrictionX - As {@link Phaser.Physics.Arcade.Body#setFrictionX}. - * @property {number} setFrictionY - As {@link Phaser.Physics.Arcade.Body#setFrictionY}. - * @property {number} setVelocityX - As {@link Phaser.Physics.Arcade.Body#setVelocityX}. - * @property {number} setVelocityY - As {@link Phaser.Physics.Arcade.Body#setVelocityY}. - * @property {number} setAngularVelocity - As {@link Phaser.Physics.Arcade.Body#setAngularVelocity}. - * @property {number} setAngularAcceleration - As {@link Phaser.Physics.Arcade.Body#setAngularAcceleration}. - * @property {number} setAngularDrag - As {@link Phaser.Physics.Arcade.Body#setAngularDrag}. - * @property {number} setMass - As {@link Phaser.Physics.Arcade.Body#setMass}. - * @property {boolean} setImmovable - As {@link Phaser.Physics.Arcade.Body#setImmovable}. - */ - /** * @classdesc * An Arcade Physics Group object. @@ -82,8 +27,8 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * * @param {Phaser.Physics.Arcade.World} world - The physics simulation. * @param {Phaser.Scene} scene - The scene this group belongs to. - * @param {(Phaser.GameObjects.GameObject[]|PhysicsGroupConfig|GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {PhysicsGroupConfig|GroupCreateConfig} [config] - Settings for this group. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Physics.Arcade.Types.PhysicsGroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Physics.Arcade.Types.PhysicsGroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} [config] - Settings for this group. */ var PhysicsGroup = new Class({ @@ -140,12 +85,14 @@ var PhysicsGroup = new Class({ this.world = world; /** - * The class to create new group members from. - * This should be ArcadeImage, ArcadeSprite, or a class extending one of those. + * The class to create new Group members from. + * + * This should be either `Phaser.Physics.Arcade.Image`, `Phaser.Physics.Arcade.Sprite`, or a class extending one of those. * * @name Phaser.Physics.Arcade.Group#classType - * @type {(Phaser.Physics.Arcade.Image|Phaser.Physics.Arcade.Sprite)} + * @type {Phaser.GameObjects.Group.Types.GroupClassTypeConstructor} * @default ArcadeSprite + * @since 3.0.0 */ config.classType = GetFastValue(config, 'classType', ArcadeSprite); @@ -163,7 +110,7 @@ var PhysicsGroup = new Class({ * Default physics properties applied to Game Objects added to the Group or created by the Group. Derived from the `config` argument. * * @name Phaser.Physics.Arcade.Group#defaults - * @type {PhysicsGroupDefaults} + * @type {Phaser.Physics.Arcade.Types.PhysicsGroupDefaults} * @since 3.0.0 */ this.defaults = { diff --git a/src/physics/arcade/SeparateX.js b/src/physics/arcade/SeparateX.js index 923cc791f..3a5ce0cc6 100644 --- a/src/physics/arcade/SeparateX.js +++ b/src/physics/arcade/SeparateX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/SeparateY.js b/src/physics/arcade/SeparateY.js index a244c96b6..3b1fc82d2 100644 --- a/src/physics/arcade/SeparateY.js +++ b/src/physics/arcade/SeparateY.js @@ -1,22 +1,25 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CONST = require('./const'); var GetOverlapY = require('./GetOverlapY'); /** * Separates two overlapping bodies on the Y-axis (vertically). * - * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * Separation involves moving two overlapping bodies so they don't overlap anymore + * and adjusting their velocities based on their mass. This is a core part of collision detection. * - * The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation. + * The bodies won't be separated if there is no vertical overlap between them, if they are static, + * or if either one uses custom logic for its separation. * * @function Phaser.Physics.Arcade.SeparateY * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. This is our priority body. * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. @@ -25,25 +28,39 @@ var GetOverlapY = require('./GetOverlapY'); */ var SeparateY = function (body1, body2, overlapOnly, bias) { + // console.log('SeparateY start', body1.gameObject.name, body2.gameObject.name); + var overlap = GetOverlapY(body1, body2, overlapOnly, bias); + var velocity1 = body1.velocity; + var velocity2 = body2.velocity; + + var body1Immovable = (body1.physicsType === CONST.STATIC_BODY || body1.immovable); + var body2Immovable = (body2.physicsType === CONST.STATIC_BODY || body2.immovable); + // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateY || body2.customSeparateY) + if (overlapOnly || (body1Immovable && body2Immovable) || body1.customSeparateY || body2.customSeparateY) { - // return true if there was some overlap, otherwise false + // return true if there was some overlap, otherwise false. return (overlap !== 0) || (body1.embedded && body2.embedded); } - // Adjust their positions and velocities accordingly (if there was any overlap) - var v1 = body1.velocity.y; - var v2 = body2.velocity.y; + // Adjust their positions and velocities accordingly based on the amount of overlap + var v1 = velocity1.y; + var v2 = velocity2.y; - if (!body1.immovable && !body2.immovable) + // At this point, the velocity from gravity, world rebounds, etc has been factored in. + // The body is moving the direction it wants to, but may be blocked. + + if (!body1Immovable && !body2Immovable) { + // Neither body is immovable, so they get an equal amount of separation and a new velocity based on mass + // Share the overlap equally if both bodies are unblocked + overlap *= 0.5; - body1.y -= overlap; - body2.y += overlap; + body1.y -= body1.getMoveY(overlap, true); + body2.y += body2.getMoveY(overlap, true); var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); @@ -52,32 +69,67 @@ var SeparateY = function (body1, body2, overlapOnly, bias) nv1 -= avg; nv2 -= avg; - body1.velocity.y = avg + nv1 * body1.bounce.y; - body2.velocity.y = avg + nv2 * body2.bounce.y; + velocity1.y = avg + nv1 * body1.bounce.y; + velocity2.y = avg + nv2 * body2.bounce.y; } - else if (!body1.immovable) + else if (!body1Immovable) { - body1.y -= overlap; - body1.velocity.y = v2 - v1 * body1.bounce.y; + // Body2 is immovable, but Body1 can move, so it gets all the separation unless blocked + + body1.y -= body1.getMoveY(overlap, true); + + velocity1.y = v2 - v1 * body1.bounce.y; // This is special case code that handles things like horizontal moving platforms you can ride if (body2.moves) { - body1.x += (body2.x - body2.prev.x) * body2.friction.x; + body1.x += body1.getMoveX((body2.deltaX()) * body2.friction.x, true); } } - else + else if (!body2Immovable) { - body2.y += overlap; - body2.velocity.y = v1 - v2 * body2.bounce.y; + // Body1 is immovable, but Body2 can move, so it gets all the separation unless blocked + body2.y += body2.getMoveY(overlap, true); + + velocity2.y = v1 - v2 * body2.bounce.y; // This is special case code that handles things like horizontal moving platforms you can ride if (body1.moves) { - body2.x += (body1.x - body1.prev.x) * body1.friction.x; + body2.x += body2.getMoveX((body1.deltaX()) * body1.friction.x, true); } } + // It's possible both bodies were equally immovable, in which case neither of them have moved + + /* + var blocked1 = body1.blocked; + var blocked2 = body2.blocked; + + // Set flags + if (overlap < 0) + { + // body1 was moving down + body1.setTouchingDown(); + body2.setTouchingUp(); + + if (blocked2.down) + { + body1.setBlockedDown(); + + // If we're still moving, but blocked, and the velocity hasn't inversed (i.e. rebounded) we should zero it. + if (velocity1.y > 0) + { + velocity1.y = 0; + } + } + } + else + { + // body1 was moving up + } + */ + // If we got this far then there WAS overlap, and separation is complete, so return true return true; }; diff --git a/src/physics/arcade/StaticBody.js b/src/physics/arcade/StaticBody.js index d03aeaa8f..b59671156 100644 --- a/src/physics/arcade/StaticBody.js +++ b/src/physics/arcade/StaticBody.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -346,7 +346,7 @@ var StaticBody = new Class({ * Whether this StaticBody is checked for collisions and for which directions. You can set `checkCollision.none = false` to disable collision checks. * * @name Phaser.Physics.Arcade.StaticBody#checkCollision - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; @@ -355,7 +355,7 @@ var StaticBody = new Class({ * Whether this StaticBody has ever collided with another body and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#touching - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.touching = { none: true, up: false, down: false, left: false, right: false }; @@ -364,7 +364,7 @@ var StaticBody = new Class({ * Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction. * * @name Phaser.Physics.Arcade.StaticBody#wasTouching - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; @@ -373,7 +373,7 @@ var StaticBody = new Class({ * Whether this StaticBody has ever collided with a tile or the world boundary. * * @name Phaser.Physics.Arcade.StaticBody#blocked - * @type {ArcadeBodyCollision} + * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision} * @since 3.0.0 */ this.blocked = { none: true, up: false, down: false, left: false, right: false }; @@ -665,9 +665,9 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#getBounds * @since 3.0.0 * - * @param {ArcadeBodyBounds} obj - The object which will hold the coordinates of the bounds. + * @param {Phaser.Physics.Arcade.Types.ArcadeBodyBounds} obj - The object which will hold the coordinates of the bounds. * - * @return {ArcadeBodyBounds} The same object that was passed with `x`, `y`, `right` and `bottom` values matching the respective values of the StaticBody. + * @return {Phaser.Physics.Arcade.Types.ArcadeBodyBounds} The same object that was passed with `x`, `y`, `right` and `bottom` values matching the respective values of the StaticBody. */ getBounds: function (obj) { diff --git a/src/physics/arcade/StaticPhysicsGroup.js b/src/physics/arcade/StaticPhysicsGroup.js index 796efa125..74ef49d68 100644 --- a/src/physics/arcade/StaticPhysicsGroup.js +++ b/src/physics/arcade/StaticPhysicsGroup.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -26,8 +26,8 @@ var IsPlainObject = require('../../utils/object/IsPlainObject'); * * @param {Phaser.Physics.Arcade.World} world - The physics simulation. * @param {Phaser.Scene} scene - The scene this group belongs to. - * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {GroupConfig|GroupCreateConfig} [config] - Settings for this group. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.GameObjects.Group.Types.GroupConfig|Phaser.GameObjects.Group.Types.GroupCreateConfig} [config] - Settings for this group. */ var StaticPhysicsGroup = new Class({ diff --git a/src/physics/arcade/World.js b/src/physics/arcade/World.js index 5eeeb4ad8..ddd0f57c1 100644 --- a/src/physics/arcade/World.js +++ b/src/physics/arcade/World.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,6 +11,7 @@ var Collider = require('./Collider'); var CONST = require('./const'); var DistanceBetween = require('../../math/distance/DistanceBetween'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var FuzzyEqual = require('../../math/fuzzy/Equal'); var FuzzyGreaterThan = require('../../math/fuzzy/GreaterThan'); var FuzzyLessThan = require('../../math/fuzzy/LessThan'); @@ -31,133 +32,6 @@ var TransformMatrix = require('../../gameobjects/components/TransformMatrix'); var Vector2 = require('../../math/Vector2'); var Wrap = require('../../math/Wrap'); -/** - * The physics simulation paused. - * @event Phaser.Physics.Arcade.World#pauseEvent - */ - -/** - * The physics simulation resumed (from a paused state). - * @event Phaser.Physics.Arcade.World#resumeEvent - */ - -/** - * Two Game Objects collided. - * This event is emitted only if at least one body has `onCollide` enabled. - * @event Phaser.Physics.Arcade.World#collideEvent - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - * @see Phaser.Physics.Arcade.Body#onCollide - */ - -/** - * Two Game Objects overlapped. - * This event is emitted only if at least one body has `onOverlap` enabled. - * @event Phaser.Physics.Arcade.World#overlapEvent - * @param {Phaser.GameObjects.GameObject} gameObject1 - * @param {Phaser.GameObjects.GameObject} gameObject2 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - * @see Phaser.Physics.Arcade.Body#onOverlap - */ - -/** - * A Body contacted the world boundary. - * This event is emitted only if the body has `onWorldBounds` enabled. - * @event Phaser.Physics.Arcade.World#worldboundsEvent - * @param {Phaser.Physics.Arcade.Body} body - * @param {boolean} up - * @param {boolean} down - * @param {boolean} left - * @param {boolean} right - * @see Phaser.Physics.Arcade.Body#onWorldBounds - */ - -/** - * @typedef {object} ArcadeWorldConfig - * - * @property {number} [fps=60] - Sets {@link Phaser.Physics.Arcade.World#fps}. - * @property {number} [timeScale=1] - Sets {@link Phaser.Physics.Arcade.World#timeScale}. - * @property {object} [gravity] - Sets {@link Phaser.Physics.Arcade.World#gravity}. - * @property {number} [gravity.x=0] - The horizontal world gravity value. - * @property {number} [gravity.y=0] - The vertical world gravity value. - * @property {number} [x=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.x}. - * @property {number} [y=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.y}. - * @property {number} [width=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.width}. - * @property {number} [height=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.height}. - * @property {object} [checkCollision] - Sets {@link Phaser.Physics.Arcade.World#checkCollision}. - * @property {boolean} [checkCollision.up=true] - Should bodies collide with the top of the world bounds? - * @property {boolean} [checkCollision.down=true] - Should bodies collide with the bottom of the world bounds? - * @property {boolean} [checkCollision.left=true] - Should bodies collide with the left of the world bounds? - * @property {boolean} [checkCollision.right=true] - Should bodies collide with the right of the world bounds? - * @property {number} [overlapBias=4] - Sets {@link Phaser.Physics.Arcade.World#OVERLAP_BIAS}. - * @property {number} [tileBias=16] - Sets {@link Phaser.Physics.Arcade.World#TILE_BIAS}. - * @property {boolean} [forceX=false] - Sets {@link Phaser.Physics.Arcade.World#forceX}. - * @property {boolean} [isPaused=false] - Sets {@link Phaser.Physics.Arcade.World#isPaused}. - * @property {boolean} [debug=false] - Sets {@link Phaser.Physics.Arcade.World#debug}. - * @property {boolean} [debugShowBody=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowBody}. - * @property {boolean} [debugShowStaticBody=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowStaticBody}. - * @property {boolean} [debugShowVelocity=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowStaticBody}. - * @property {number} [debugBodyColor=0xff00ff] - Sets {@link Phaser.Physics.Arcade.World#defaults debugBodyColor}. - * @property {number} [debugStaticBodyColor=0x0000ff] - Sets {@link Phaser.Physics.Arcade.World#defaults debugStaticBodyColor}. - * @property {number} [debugVelocityColor=0x00ff00] - Sets {@link Phaser.Physics.Arcade.World#defaults debugVelocityColor}. - * @property {number} [maxEntries=16] - Sets {@link Phaser.Physics.Arcade.World#maxEntries}. - * @property {boolean} [useTree=true] - Sets {@link Phaser.Physics.Arcade.World#useTree}. - */ - -/** - * @typedef {object} CheckCollisionObject - * - * @property {boolean} up - Will bodies collide with the top side of the world bounds? - * @property {boolean} down - Will bodies collide with the bottom side of the world bounds? - * @property {boolean} left - Will bodies collide with the left side of the world bounds? - * @property {boolean} right - Will bodies collide with the right side of the world bounds? - */ - -/** - * @typedef {object} ArcadeWorldDefaults - * - * @property {boolean} debugShowBody - Set to `true` to render dynamic body outlines to the debug display. - * @property {boolean} debugShowStaticBody - Set to `true` to render static body outlines to the debug display. - * @property {boolean} debugShowVelocity - Set to `true` to render body velocity markers to the debug display. - * @property {number} bodyDebugColor - The color of dynamic body outlines when rendered to the debug display. - * @property {number} staticBodyDebugColor - The color of static body outlines when rendered to the debug display. - * @property {number} velocityDebugColor - The color of the velocity markers when rendered to the debug display. - */ - -/** - * @typedef {object} ArcadeWorldTreeMinMax - * - * @property {number} minX - The minimum x value used in RTree searches. - * @property {number} minY - The minimum y value used in RTree searches. - * @property {number} maxX - The maximum x value used in RTree searches. - * @property {number} maxY - The maximum y value used in RTree searches. - */ - -/** - * An Arcade Physics Collider Type. - * - * @typedef {( - * Phaser.GameObjects.GameObject| - * Phaser.GameObjects.Group| - * Phaser.Physics.Arcade.Sprite| - * Phaser.Physics.Arcade.Image| - * Phaser.Physics.Arcade.StaticGroup| - * Phaser.Physics.Arcade.Group| - * Phaser.Tilemaps.DynamicTilemapLayer| - * Phaser.Tilemaps.StaticTilemapLayer| - * Phaser.GameObjects.GameObject[]| - * Phaser.Physics.Arcade.Sprite[]| - * Phaser.Physics.Arcade.Image[]| - * Phaser.Physics.Arcade.StaticGroup[]| - * Phaser.Physics.Arcade.Group[]| - * Phaser.Tilemaps.DynamicTilemapLayer[]| - * Phaser.Tilemaps.StaticTilemapLayer[] - * )} ArcadeColliderType - */ - /** * @classdesc * The Arcade Physics World. @@ -173,7 +47,7 @@ var Wrap = require('../../math/Wrap'); * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to which this World instance belongs. - * @param {ArcadeWorldConfig} config - An Arcade Physics Configuration object. + * @param {Phaser.Physics.Arcade.Types.ArcadeWorldConfig} config - An Arcade Physics Configuration object. */ var World = new Class({ @@ -249,15 +123,15 @@ var World = new Class({ this.bounds = new Rectangle( GetValue(config, 'x', 0), GetValue(config, 'y', 0), - GetValue(config, 'width', scene.sys.game.config.width), - GetValue(config, 'height', scene.sys.game.config.height) + GetValue(config, 'width', scene.sys.scale.width), + GetValue(config, 'height', scene.sys.scale.height) ); /** * The boundary edges that Bodies can collide with. * * @name Phaser.Physics.Arcade.World#checkCollision - * @type {CheckCollisionObject} + * @type {Phaser.Physics.Arcade.Types.CheckCollisionObject} * @since 3.0.0 */ this.checkCollision = { @@ -328,7 +202,7 @@ var World = new Class({ * - 0.5 = double speed * * @name Phaser.Physics.Arcade.World#timeScale - * @property {number} + * @type {number} * @default 1 * @since 3.10.0 */ @@ -414,7 +288,7 @@ var World = new Class({ * Default debug display settings for new Bodies. * * @name Phaser.Physics.Arcade.World#defaults - * @type {ArcadeWorldDefaults} + * @type {Phaser.Physics.Arcade.Types.ArcadeWorldDefaults} * @since 3.0.0 */ this.defaults = { @@ -441,18 +315,19 @@ var World = new Class({ this.maxEntries = GetValue(config, 'maxEntries', 16); /** - * Should this Arcade Physics World use an RTree for Dynamic Physics bodies or not? + * Should this Arcade Physics World use an RTree for Dynamic and Static Physics bodies? * - * An RTree is a fast way of spatially sorting of all the moving bodies in the world. + * An RTree is a fast way of spatially sorting of all the bodies in the world. * However, at certain limits, the cost of clearing and inserting the bodies into the * tree every frame becomes more expensive than the search speed gains it provides. * * If you have a large number of dynamic bodies in your world then it may be best to - * disable the use of the RTree by setting this property to `true`. + * disable the use of the RTree by setting this property to `false` in the physics config. + * * The number it can cope with depends on browser and device, but a conservative estimate * of around 5,000 bodies should be considered the max before disabling it. * - * Note this only applies to dynamic bodies. Static bodies are always kept in an RTree, + * This only applies to dynamic bodies. Static bodies are always kept in an RTree, * because they don't have to be cleared every frame, so you benefit from the * massive search speeds all the time. * @@ -485,7 +360,7 @@ var World = new Class({ * Recycled input for tree searches. * * @name Phaser.Physics.Arcade.World#treeMinMax - * @type {ArcadeWorldTreeMinMax} + * @type {Phaser.Physics.Arcade.Types.ArcadeWorldTreeMinMax} * @since 3.0.0 */ this.treeMinMax = { minX: 0, minY: 0, maxX: 0, maxY: 0 }; @@ -864,7 +739,7 @@ var World = new Class({ * checks. * * @method Phaser.Physics.Arcade.World#pause - * @fires Phaser.Physics.Arcade.World#pauseEvent + * @fires Phaser.Physics.Arcade.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -873,7 +748,7 @@ var World = new Class({ { this.isPaused = true; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -882,7 +757,7 @@ var World = new Class({ * Resumes the simulation, if paused. * * @method Phaser.Physics.Arcade.World#resume - * @fires Phaser.Physics.Arcade.World#resumeEvent + * @fires Phaser.Physics.Arcade.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Arcade.World} This World object. @@ -891,7 +766,7 @@ var World = new Class({ { this.isPaused = false; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, @@ -911,8 +786,8 @@ var World = new Class({ * @since 3.0.0 * @see Phaser.Physics.Arcade.World#collide * - * @param {ArcadeColliderType} object1 - The first object to check for collision. - * @param {ArcadeColliderType} object2 - The second object to check for collision. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. * @param {*} [callbackContext] - The scope in which to call the callbacks. @@ -946,8 +821,8 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#addOverlap * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object to check for overlap. - * @param {ArcadeColliderType} object2 - The second object to check for overlap. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object to check for overlap. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object2 - The second object to check for overlap. * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects overlap. * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects overlap. Must return a boolean. * @param {*} [callbackContext] - The scope in which to call the callbacks. @@ -1038,6 +913,20 @@ var World = new Class({ return; } + // Update all active bodies + var body; + var bodies = this.bodies.entries; + + for (var i = 0; i < bodies.length; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.preUpdate(); + } + } + var stepsThisFrame = 0; var fixedDelta = this._frameTime; var msPerFrame = this._frameTimeMS * this.timeScale; @@ -1101,18 +990,6 @@ var World = new Class({ collider.update(); } } - - len = bodies.length; - - for (i = 0; i < len; i++) - { - body = bodies[i]; - - if (body.enable) - { - body.postUpdate(); - } - } }, /** @@ -1125,13 +1002,21 @@ var World = new Class({ { var i; var body; + var bodies = this.bodies.entries; + var len = bodies.length; var dynamic = this.bodies; var staticBodies = this.staticBodies; - var pending = this.pendingDestroy; - var bodies = dynamic.entries; - var len = bodies.length; + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.postUpdate(); + } + } if (this.drawDebug) { @@ -1163,6 +1048,8 @@ var World = new Class({ } } + var pending = this.pendingDestroy; + if (pending.size > 0) { var dynamicTree = this.tree; @@ -1281,6 +1168,7 @@ var World = new Class({ var maxY = body.maxVelocity.y; var speed = body.speed; + var maxSpeed = body.maxSpeed; var allowDrag = body.allowDrag; var useDamping = body.useDamping; @@ -1362,18 +1250,21 @@ var World = new Class({ } } - velocityX = Clamp(velocityX, -maxX, maxX); - velocityY = Clamp(velocityY, -maxY, maxY); + body.velocity.x = Clamp(velocityX, -maxX, maxX); + body.velocity.y = Clamp(velocityY, -maxY, maxY); - body.velocity.set(velocityX, velocityY); + if (maxSpeed > -1 && body.velocity.length() > maxSpeed) + { + body.velocity.normalize().scale(maxSpeed); + } }, /** * Separates two Bodies. * * @method Phaser.Physics.Arcade.World#separate - * @fires Phaser.Physics.Arcade.World#collideEvent - * @fires Phaser.Physics.Arcade.World#overlapEvent + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. @@ -1464,20 +1355,17 @@ var World = new Class({ if (result) { - if (overlapOnly && (body1.onOverlap || body2.onOverlap)) + if (overlapOnly) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); - } - else - { - body1.postUpdate(); - body2.postUpdate(); - - if (body1.onCollide || body2.onCollide) + if (body1.onOverlap || body2.onOverlap) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); } } + else if (body1.onCollide || body2.onCollide) + { + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); + } } return result; @@ -1487,14 +1375,14 @@ var World = new Class({ * Separates two Bodies, when both are circular. * * @method Phaser.Physics.Arcade.World#separateCircle - * @fires Phaser.Physics.Arcade.World#collideEvent - * @fires Phaser.Physics.Arcade.World#overlapEvent + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP * @since 3.0.0 * * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. * @param {boolean} [overlapOnly] - If this a collide or overlap check? - * @param {number} bias - A small value added to the calculations. + * @param {number} [bias] - A small value added to the calculations. * * @return {boolean} True if separation occurred, otherwise false. */ @@ -1561,7 +1449,7 @@ var World = new Class({ { if (overlap !== 0 && (body1.onOverlap || body2.onOverlap)) { - this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); } // return true if there was some overlap, otherwise false @@ -1673,13 +1561,9 @@ var World = new Class({ if (body1.onCollide || body2.onCollide) { - this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); } - // sync changes back to the bodies - body1.postUpdate(); - body2.postUpdate(); - return true; }, @@ -1759,8 +1643,8 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#overlap * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [overlapCallback] - An optional callback function that is called if the objects overlap. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`. * @param {*} [callbackContext] - The context in which to run the callbacks. @@ -1784,7 +1668,9 @@ var World = new Class({ * * If two Groups or arrays are passed, each member of one will be tested against each member of the other. * - * If one Group **only** is passed (as `object1`), each member of the Group will be collided against the other members. + * If **only** one Group is passed (as `object1`), each member of the Group will be collided against the other members. + * + * If **only** one Array is passed, the array is iterated and every element in it is tested against the others. * * Two callbacks can be provided. The `collideCallback` is invoked if a collision occurs and the two colliding * objects are passed to it. @@ -1797,8 +1683,8 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#collide * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} [callbackContext] - The context in which to run the callbacks. @@ -1821,8 +1707,8 @@ var World = new Class({ * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object to check for collision. - * @param {ArcadeColliderType} object2 - The second object to check for collision. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} [object2] - The second object to check for collision. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. * @param {any} callbackContext - The scope in which to call the callbacks. @@ -1833,6 +1719,7 @@ var World = new Class({ collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) { var i; + var j; if (object1.isParent && object1.physicsType === undefined) { @@ -1865,9 +1752,30 @@ var World = new Class({ else if (object1isArray && !object2isArray) { // Object 1 is an Array - for (i = 0; i < object1.length; i++) + if (!object2) { - this.collideHandler(object1[i], object2, collideCallback, processCallback, callbackContext, overlapOnly); + // Special case for array vs. self + for (i = 0; i < object1.length; i++) + { + var child = object1[i]; + + for (j = i + 1; j < object1.length; j++) + { + if (i === j) + { + continue; + } + + this.collideHandler(child, object1[j], collideCallback, processCallback, callbackContext, overlapOnly); + } + } + } + else + { + for (i = 0; i < object1.length; i++) + { + this.collideHandler(object1[i], object2, collideCallback, processCallback, callbackContext, overlapOnly); + } } } else @@ -1875,7 +1783,7 @@ var World = new Class({ // They're both arrays for (i = 0; i < object1.length; i++) { - for (var j = 0; j < object2.length; j++) + for (j = 0; j < object2.length; j++) { this.collideHandler(object1[i], object2[j], collideCallback, processCallback, callbackContext, overlapOnly); } @@ -1892,8 +1800,8 @@ var World = new Class({ * @private * @since 3.0.0 * - * @param {ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Physics.Arcade.Types.ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} callbackContext - The context in which to run the callbacks. @@ -2138,15 +2046,88 @@ var World = new Class({ return didCollide; }, + /** + * This advanced method is specifically for testing for collision between a single Sprite and an array of Tile objects. + * + * You should generally use the `collide` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for collision with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic collisions + * on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * Important: Use of this method skips the `interesting faces` system that Tilemap Layers use. This means if you have + * say a row or column of tiles, and you jump into, or walk over them, it's possible to get stuck on the edges of the + * tiles as the interesting face calculations are skipped. However, for quick-fire small collision set tests on + * dynamic maps, this method can prove very useful. + * + * @method Phaser.Physics.Arcade.World#collideTiles + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + if (!sprite.body.enable || tiles.length === 0) + { + return false; + } + else + { + return this.collideSpriteVsTilesHandler(sprite, tiles, collideCallback, processCallback, callbackContext, false, false); + } + }, + + /** + * This advanced method is specifically for testing for overlaps between a single Sprite and an array of Tile objects. + * + * You should generally use the `overlap` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for overlaps with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic overlap + * tests on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * @method Phaser.Physics.Arcade.World#overlapTiles + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects overlap. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + overlapTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + if (!sprite.body.enable || tiles.length === 0) + { + return false; + } + else + { + return this.collideSpriteVsTilesHandler(sprite, tiles, collideCallback, processCallback, callbackContext, true, false); + } + }, + /** * Internal handler for Sprite vs. Tilemap collisions. * Please use Phaser.Physics.Arcade.World#collide instead. * * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer - * @fires Phaser.GameObjects.GameObject#collideEvent - * @fires Phaser.GameObjects.GameObject#overlapEvent - * @fires Phaser.Physics.Arcade.World#collideEvent - * @fires Phaser.Physics.Arcade.World#overlapEvent + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. @@ -2154,7 +2135,7 @@ var World = new Class({ * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} [callbackContext] - The context in which to run the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ @@ -2198,13 +2179,47 @@ var World = new Class({ { return false; } + else + { + return this.collideSpriteVsTilesHandler(sprite, mapData, collideCallback, processCallback, callbackContext, overlapOnly, true); + } + }, + + /** + * Internal handler for Sprite vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideSpriteVsTilesHandler + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @private + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. + * @param {boolean} [isLayer] - Is this check coming from a TilemapLayer or an array of tiles? + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideSpriteVsTilesHandler: function (sprite, tiles, collideCallback, processCallback, callbackContext, overlapOnly, isLayer) + { + var body = sprite.body; var tile; var tileWorldRect = { left: 0, right: 0, top: 0, bottom: 0 }; + var tilemapLayer; + var collision = false; - for (var i = 0; i < mapData.length; i++) + for (var i = 0; i < tiles.length; i++) { - tile = mapData[i]; + tile = tiles[i]; + + tilemapLayer = tile.tilemapLayer; + tileWorldRect.left = tilemapLayer.tileToWorldX(tile.x); tileWorldRect.top = tilemapLayer.tileToWorldY(tile.y); @@ -2221,10 +2236,12 @@ var World = new Class({ if (TileIntersectsBody(tileWorldRect, body) && (!processCallback || processCallback.call(callbackContext, sprite, tile)) && ProcessTileCallbacks(tile, sprite) - && (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS))) + && (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS, isLayer))) { this._total++; + collision = true; + if (collideCallback) { collideCallback.call(callbackContext, sprite, tile); @@ -2232,17 +2249,16 @@ var World = new Class({ if (overlapOnly && body.onOverlap) { - sprite.emit('overlap', body.gameObject, tile, body, null); + this.emit(Events.TILE_OVERLAP, sprite, tile, body); } else if (body.onCollide) { - sprite.emit('collide', body.gameObject, tile, body, null); + this.emit(Events.TILE_COLLIDE, sprite, tile, body); } - - // sync changes back to the body - body.postUpdate(); } } + + return collision; }, /** @@ -2308,7 +2324,6 @@ var World = new Class({ } }, - /** * Wrap each object's coordinates within {@link Phaser.Physics.Arcade.World#bounds}. * @@ -2376,23 +2391,3 @@ var World = new Class({ }); module.exports = World; - -/** - * A physics-enabled Game Object collided with a Tile. - * This event is emitted only if the Game Object's body has `onCollide` enabled. - * @event Phaser.GameObjects.GameObject#collideEvent - * @param {Phaser.GameObjects.GameObject} gameObject - * @param {Phaser.Tilemaps.Tile} tile - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body - * @see Phaser.Physics.Arcade.Body#onCollide - */ - -/** - * A physics-enabled Game Object overlapped with a Tile. - * This event is emitted only if the Game Object's body has `onOverlap` enabled. - * @event Phaser.GameObjects.GameObject#overlapEvent - * @param {Phaser.GameObjects.GameObject} gameObject - * @param {Phaser.Tilemaps.Tile} tile - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body - * @see Phaser.Physics.Arcade.Body#onOverlap - */ diff --git a/src/physics/arcade/components/Acceleration.js b/src/physics/arcade/components/Acceleration.js index 587bd4dc6..95849feb7 100644 --- a/src/physics/arcade/components/Acceleration.js +++ b/src/physics/arcade/components/Acceleration.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the acceleration properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Acceleration + * @namespace Phaser.Physics.Arcade.Components.Acceleration * @since 3.0.0 */ var Acceleration = { diff --git a/src/physics/arcade/components/Angular.js b/src/physics/arcade/components/Angular.js index 5b8ad10ad..e0947b767 100644 --- a/src/physics/arcade/components/Angular.js +++ b/src/physics/arcade/components/Angular.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Angular + * @namespace Phaser.Physics.Arcade.Components.Angular * @since 3.0.0 */ var Angular = { diff --git a/src/physics/arcade/components/Bounce.js b/src/physics/arcade/components/Bounce.js index b8c5ccd54..3e41a8824 100644 --- a/src/physics/arcade/components/Bounce.js +++ b/src/physics/arcade/components/Bounce.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the bounce properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Bounce + * @namespace Phaser.Physics.Arcade.Components.Bounce * @since 3.0.0 */ var Bounce = { diff --git a/src/physics/arcade/components/Debug.js b/src/physics/arcade/components/Debug.js index f1acf73c4..bb59aa860 100644 --- a/src/physics/arcade/components/Debug.js +++ b/src/physics/arcade/components/Debug.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the debug properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Debug + * @namespace Phaser.Physics.Arcade.Components.Debug * @since 3.0.0 */ var Debug = { diff --git a/src/physics/arcade/components/Drag.js b/src/physics/arcade/components/Drag.js index 8b5bf6c07..affd2a384 100644 --- a/src/physics/arcade/components/Drag.js +++ b/src/physics/arcade/components/Drag.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the drag properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Drag + * @namespace Phaser.Physics.Arcade.Components.Drag * @since 3.0.0 */ var Drag = { diff --git a/src/physics/arcade/components/Enable.js b/src/physics/arcade/components/Enable.js index 978774f16..9d68fc241 100644 --- a/src/physics/arcade/components/Enable.js +++ b/src/physics/arcade/components/Enable.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the enable properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Enable + * @namespace Phaser.Physics.Arcade.Components.Enable * @since 3.0.0 */ var Enable = { diff --git a/src/physics/arcade/components/Friction.js b/src/physics/arcade/components/Friction.js index 447371dc8..935ffd445 100644 --- a/src/physics/arcade/components/Friction.js +++ b/src/physics/arcade/components/Friction.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis. The higher than friction, the faster the body will slow down once force stops being applied to it. * - * @name Phaser.Physics.Arcade.Components.Friction + * @namespace Phaser.Physics.Arcade.Components.Friction * @since 3.0.0 */ var Friction = { diff --git a/src/physics/arcade/components/Gravity.js b/src/physics/arcade/components/Gravity.js index b0cef108b..f0fac4054 100644 --- a/src/physics/arcade/components/Gravity.js +++ b/src/physics/arcade/components/Gravity.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * Provides methods for setting the gravity properties of an Arcade Physics Game Object. * Should be applied as a mixin and not used directly. * - * @name Phaser.Physics.Arcade.Components.Gravity + * @namespace Phaser.Physics.Arcade.Components.Gravity * @since 3.0.0 */ var Gravity = { diff --git a/src/physics/arcade/components/Immovable.js b/src/physics/arcade/components/Immovable.js index 899700f9a..bbd7b64f8 100644 --- a/src/physics/arcade/components/Immovable.js +++ b/src/physics/arcade/components/Immovable.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the immovable properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Immovable + * @namespace Phaser.Physics.Arcade.Components.Immovable * @since 3.0.0 */ var Immovable = { diff --git a/src/physics/arcade/components/Mass.js b/src/physics/arcade/components/Mass.js index 112227910..3ea184efb 100644 --- a/src/physics/arcade/components/Mass.js +++ b/src/physics/arcade/components/Mass.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Provides methods used for setting the mass properties of an Arcade Physics Body. * - * @name Phaser.Physics.Arcade.Components.Mass + * @namespace Phaser.Physics.Arcade.Components.Mass * @since 3.0.0 */ var Mass = { diff --git a/src/physics/arcade/components/Size.js b/src/physics/arcade/components/Size.js index 653b4b8b9..9cdb1c11a 100644 --- a/src/physics/arcade/components/Size.js +++ b/src/physics/arcade/components/Size.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * Provides methods for setting the size of an Arcade Physics Game Object. * Should be applied as a mixin and not used directly. * - * @name Phaser.Physics.Arcade.Components.Size + * @namespace Phaser.Physics.Arcade.Components.Size * @since 3.0.0 */ var Size = { diff --git a/src/physics/arcade/components/Velocity.js b/src/physics/arcade/components/Velocity.js index 9266e85c9..669c59443 100644 --- a/src/physics/arcade/components/Velocity.js +++ b/src/physics/arcade/components/Velocity.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,7 +9,7 @@ * * Should be applied as a mixin and not used directly. * - * @name Phaser.Physics.Arcade.Components.Velocity + * @namespace Phaser.Physics.Arcade.Components.Velocity * @since 3.0.0 */ var Velocity = { diff --git a/src/physics/arcade/components/index.js b/src/physics/arcade/components/index.js index 2bf2d0eb9..99ca79d87 100644 --- a/src/physics/arcade/components/index.js +++ b/src/physics/arcade/components/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/const.js b/src/physics/arcade/const.js index 75943cc45..66ba39dbf 100644 --- a/src/physics/arcade/const.js +++ b/src/physics/arcade/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/events/COLLIDE_EVENT.js b/src/physics/arcade/events/COLLIDE_EVENT.js new file mode 100644 index 000000000..fe0d8c42d --- /dev/null +++ b/src/physics/arcade/events/COLLIDE_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least + * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#COLLIDE + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the collision. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the collision. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the collision. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the collision. + */ +module.exports = 'collide'; diff --git a/src/physics/arcade/events/OVERLAP_EVENT.js b/src/physics/arcade/events/OVERLAP_EVENT.js new file mode 100644 index 000000000..f21db3fc4 --- /dev/null +++ b/src/physics/arcade/events/OVERLAP_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least + * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#OVERLAP + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the overlap. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the overlap. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the overlap. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the overlap. + */ +module.exports = 'overlap'; diff --git a/src/physics/arcade/events/PAUSE_EVENT.js b/src/physics/arcade/events/PAUSE_EVENT.js new file mode 100644 index 000000000..4968a0e7f --- /dev/null +++ b/src/physics/arcade/events/PAUSE_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Pause Event. + * + * This event is dispatched by an Arcade Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`. + * + * @event Phaser.Physics.Arcade.Events#PAUSE + * @since 3.0.0 + */ +module.exports = 'pause'; diff --git a/src/physics/arcade/events/RESUME_EVENT.js b/src/physics/arcade/events/RESUME_EVENT.js new file mode 100644 index 000000000..a07be114b --- /dev/null +++ b/src/physics/arcade/events/RESUME_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Resume Event. + * + * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`. + * + * @event Phaser.Physics.Arcade.Events#RESUME + * @since 3.0.0 + */ +module.exports = 'resume'; diff --git a/src/physics/arcade/events/TILE_COLLIDE_EVENT.js b/src/physics/arcade/events/TILE_COLLIDE_EVENT.js new file mode 100644 index 000000000..787562f9a --- /dev/null +++ b/src/physics/arcade/events/TILE_COLLIDE_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_ + * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @since 3.16.1 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the collision. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body collided with. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the collision. + */ +module.exports = 'tilecollide'; diff --git a/src/physics/arcade/events/TILE_OVERLAP_EVENT.js b/src/physics/arcade/events/TILE_OVERLAP_EVENT.js new file mode 100644 index 000000000..bd1243b26 --- /dev/null +++ b/src/physics/arcade/events/TILE_OVERLAP_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics Tile Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_ + * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @since 3.16.1 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the overlap. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body overlapped. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the overlap. + */ +module.exports = 'tileoverlap'; diff --git a/src/physics/arcade/events/WORLD_BOUNDS_EVENT.js b/src/physics/arcade/events/WORLD_BOUNDS_EVENT.js new file mode 100644 index 000000000..9831a9350 --- /dev/null +++ b/src/physics/arcade/events/WORLD_BOUNDS_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Arcade Physics World Bounds Event. + * + * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_ + * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`. + * + * @event Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that hit the world bounds. + * @param {boolean} up - Is the Body blocked up? I.e. collided with the top of the world bounds. + * @param {boolean} down - Is the Body blocked down? I.e. collided with the bottom of the world bounds. + * @param {boolean} left - Is the Body blocked left? I.e. collided with the left of the world bounds. + * @param {boolean} right - Is the Body blocked right? I.e. collided with the right of the world bounds. + */ +module.exports = 'worldbounds'; diff --git a/src/physics/arcade/events/index.js b/src/physics/arcade/events/index.js new file mode 100644 index 000000000..594441502 --- /dev/null +++ b/src/physics/arcade/events/index.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Arcade.Events + */ + +module.exports = { + + COLLIDE: require('./COLLIDE_EVENT'), + OVERLAP: require('./OVERLAP_EVENT'), + PAUSE: require('./PAUSE_EVENT'), + RESUME: require('./RESUME_EVENT'), + TILE_COLLIDE: require('./TILE_COLLIDE_EVENT'), + TILE_OVERLAP: require('./TILE_OVERLAP_EVENT'), + WORLD_BOUNDS: require('./WORLD_BOUNDS_EVENT') + +}; diff --git a/src/physics/arcade/index.js b/src/physics/arcade/index.js index 3bebfd22b..a5171e3be 100644 --- a/src/physics/arcade/index.js +++ b/src/physics/arcade/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/tilemap/ProcessTileCallbacks.js b/src/physics/arcade/tilemap/ProcessTileCallbacks.js index 14cf85e52..b73d203d4 100644 --- a/src/physics/arcade/tilemap/ProcessTileCallbacks.js +++ b/src/physics/arcade/tilemap/ProcessTileCallbacks.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/tilemap/ProcessTileSeparationX.js b/src/physics/arcade/tilemap/ProcessTileSeparationX.js index d49c1475c..368ae6fda 100644 --- a/src/physics/arcade/tilemap/ProcessTileSeparationX.js +++ b/src/physics/arcade/tilemap/ProcessTileSeparationX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/tilemap/ProcessTileSeparationY.js b/src/physics/arcade/tilemap/ProcessTileSeparationY.js index 437bfd312..d9f2bd4bb 100644 --- a/src/physics/arcade/tilemap/ProcessTileSeparationY.js +++ b/src/physics/arcade/tilemap/ProcessTileSeparationY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/tilemap/SeparateTile.js b/src/physics/arcade/tilemap/SeparateTile.js index 9e3fe0a9f..2f4785f1a 100644 --- a/src/physics/arcade/tilemap/SeparateTile.js +++ b/src/physics/arcade/tilemap/SeparateTile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -20,10 +20,11 @@ var TileIntersectsBody = require('./TileIntersectsBody'); * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against. * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. + * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? * * @return {boolean} `true` if the body was separated, otherwise `false`. */ -var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias) +var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias, isLayer) { var tileLeft = tileWorldRect.left; var tileTop = tileWorldRect.top; @@ -32,6 +33,12 @@ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBia var faceHorizontal = tile.faceLeft || tile.faceRight; var faceVertical = tile.faceTop || tile.faceBottom; + if (!isLayer) + { + faceHorizontal = true; + faceVertical = true; + } + // We don't need to go any further if this tile doesn't actually have any colliding faces. This // could happen if the tile was meant to be collided with re: a callback, but otherwise isn't // needed for separation. @@ -68,7 +75,7 @@ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBia { if (faceHorizontal) { - ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias); + ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias, isLayer); // That's horizontal done, check if we still intersects? If not then we can return now if (ox !== 0 && !TileIntersectsBody(tileWorldRect, body)) @@ -79,14 +86,14 @@ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBia if (faceVertical) { - oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias); + oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias, isLayer); } } else { if (faceVertical) { - oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias); + oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias, isLayer); // That's vertical done, check if we still intersects? If not then we can return now if (oy !== 0 && !TileIntersectsBody(tileWorldRect, body)) @@ -97,7 +104,7 @@ var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBia if (faceHorizontal) { - ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias); + ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias, isLayer); } } diff --git a/src/physics/arcade/tilemap/TileCheckX.js b/src/physics/arcade/tilemap/TileCheckX.js index e91924ec7..2962645f4 100644 --- a/src/physics/arcade/tilemap/TileCheckX.js +++ b/src/physics/arcade/tilemap/TileCheckX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,17 +18,31 @@ var ProcessTileSeparationX = require('./ProcessTileSeparationX'); * @param {number} tileLeft - The left position of the tile within the tile world. * @param {number} tileRight - The right position of the tile within the tile world. * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. + * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? * * @return {number} The amount of separation that occurred. */ -var TileCheckX = function (body, tile, tileLeft, tileRight, tileBias) +var TileCheckX = function (body, tile, tileLeft, tileRight, tileBias, isLayer) { var ox = 0; - if (body.deltaX() < 0 && !body.blocked.left && tile.collideRight && body.checkCollision.left) + var faceLeft = tile.faceLeft; + var faceRight = tile.faceRight; + var collideLeft = tile.collideLeft; + var collideRight = tile.collideRight; + + if (!isLayer) + { + faceLeft = true; + faceRight = true; + collideLeft = true; + collideRight = true; + } + + if (body.deltaX() < 0 && !body.blocked.left && collideRight && body.checkCollision.left) { // Body is moving LEFT - if (tile.faceRight && body.x < tileRight) + if (faceRight && body.x < tileRight) { ox = body.x - tileRight; @@ -38,10 +52,10 @@ var TileCheckX = function (body, tile, tileLeft, tileRight, tileBias) } } } - else if (body.deltaX() > 0 && !body.blocked.right && tile.collideLeft && body.checkCollision.right) + else if (body.deltaX() > 0 && !body.blocked.right && collideLeft && body.checkCollision.right) { // Body is moving RIGHT - if (tile.faceLeft && body.right > tileLeft) + if (faceLeft && body.right > tileLeft) { ox = body.right - tileLeft; diff --git a/src/physics/arcade/tilemap/TileCheckY.js b/src/physics/arcade/tilemap/TileCheckY.js index d02f045ec..4efa18dfc 100644 --- a/src/physics/arcade/tilemap/TileCheckY.js +++ b/src/physics/arcade/tilemap/TileCheckY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,17 +18,31 @@ var ProcessTileSeparationY = require('./ProcessTileSeparationY'); * @param {number} tileTop - The top position of the tile within the tile world. * @param {number} tileBottom - The bottom position of the tile within the tile world. * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. + * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? * * @return {number} The amount of separation that occurred. */ -var TileCheckY = function (body, tile, tileTop, tileBottom, tileBias) +var TileCheckY = function (body, tile, tileTop, tileBottom, tileBias, isLayer) { var oy = 0; - if (body.deltaY() < 0 && !body.blocked.up && tile.collideDown && body.checkCollision.up) + var faceTop = tile.faceTop; + var faceBottom = tile.faceBottom; + var collideUp = tile.collideUp; + var collideDown = tile.collideDown; + + if (!isLayer) + { + faceTop = true; + faceBottom = true; + collideUp = true; + collideDown = true; + } + + if (body.deltaY() < 0 && !body.blocked.up && collideDown && body.checkCollision.up) { // Body is moving UP - if (tile.faceBottom && body.y < tileBottom) + if (faceBottom && body.y < tileBottom) { oy = body.y - tileBottom; @@ -38,10 +52,10 @@ var TileCheckY = function (body, tile, tileTop, tileBottom, tileBias) } } } - else if (body.deltaY() > 0 && !body.blocked.down && tile.collideUp && body.checkCollision.down) + else if (body.deltaY() > 0 && !body.blocked.down && collideUp && body.checkCollision.down) { // Body is moving DOWN - if (tile.faceTop && body.bottom > tileTop) + if (faceTop && body.bottom > tileTop) { oy = body.bottom - tileTop; diff --git a/src/physics/arcade/tilemap/TileIntersectsBody.js b/src/physics/arcade/tilemap/TileIntersectsBody.js index f478994f8..a4bb751da 100644 --- a/src/physics/arcade/tilemap/TileIntersectsBody.js +++ b/src/physics/arcade/tilemap/TileIntersectsBody.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/arcade/typedefs/ArcadeBodyBounds.js b/src/physics/arcade/typedefs/ArcadeBodyBounds.js new file mode 100644 index 000000000..576137f13 --- /dev/null +++ b/src/physics/arcade/typedefs/ArcadeBodyBounds.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.ArcadeBodyBounds + * @since 3.0.0 + * + * @property {number} x - The left edge. + * @property {number} y - The upper edge. + * @property {number} right - The right edge. + * @property {number} bottom - The lower edge. + */ diff --git a/src/physics/arcade/typedefs/ArcadeBodyCollision.js b/src/physics/arcade/typedefs/ArcadeBodyCollision.js new file mode 100644 index 000000000..399264c9b --- /dev/null +++ b/src/physics/arcade/typedefs/ArcadeBodyCollision.js @@ -0,0 +1,10 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.ArcadeBodyCollision + * @since 3.0.0 + * + * @property {boolean} none - True if the Body is not colliding. + * @property {boolean} up - True if the Body is colliding on its upper edge. + * @property {boolean} down - True if the Body is colliding on its lower edge. + * @property {boolean} left - True if the Body is colliding on its left edge. + * @property {boolean} right - True if the Body is colliding on its right edge. + */ diff --git a/src/physics/arcade/typedefs/ArcadeColliderType.js b/src/physics/arcade/typedefs/ArcadeColliderType.js new file mode 100644 index 000000000..a1cadc739 --- /dev/null +++ b/src/physics/arcade/typedefs/ArcadeColliderType.js @@ -0,0 +1,6 @@ +/** + * An Arcade Physics Collider Type. + * + * @typedef {(Phaser.GameObjects.GameObject|Phaser.GameObjects.Group|Phaser.Physics.Arcade.Sprite|Phaser.Physics.Arcade.Image|Phaser.Physics.Arcade.StaticGroup|Phaser.Physics.Arcade.Group|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer|Phaser.GameObjects.GameObject[]|Phaser.Physics.Arcade.Sprite[]|Phaser.Physics.Arcade.Image[]|Phaser.Physics.Arcade.StaticGroup[]|Phaser.Physics.Arcade.Group[]|Phaser.Tilemaps.DynamicTilemapLayer[]|Phaser.Tilemaps.StaticTilemapLayer[])} Phaser.Physics.Arcade.Types.ArcadeColliderType + * @since 3.0.0 + */ diff --git a/src/physics/arcade/typedefs/ArcadeWorldConfig.js b/src/physics/arcade/typedefs/ArcadeWorldConfig.js new file mode 100644 index 000000000..b76636c5f --- /dev/null +++ b/src/physics/arcade/typedefs/ArcadeWorldConfig.js @@ -0,0 +1,26 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.ArcadeWorldConfig + * @since 3.0.0 + * + * @property {number} [fps=60] - Sets {@link Phaser.Physics.Arcade.World#fps}. + * @property {number} [timeScale=1] - Sets {@link Phaser.Physics.Arcade.World#timeScale}. + * @property {Phaser.Math.Types.Vector2Like} [gravity] - Sets {@link Phaser.Physics.Arcade.World#gravity}. + * @property {number} [x=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.x}. + * @property {number} [y=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.y}. + * @property {number} [width=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.width}. + * @property {number} [height=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.height}. + * @property {Phaser.Physics.Arcade.Types.CheckCollisionObject} [checkCollision] - Sets {@link Phaser.Physics.Arcade.World#checkCollision}. + * @property {number} [overlapBias=4] - Sets {@link Phaser.Physics.Arcade.World#OVERLAP_BIAS}. + * @property {number} [tileBias=16] - Sets {@link Phaser.Physics.Arcade.World#TILE_BIAS}. + * @property {boolean} [forceX=false] - Sets {@link Phaser.Physics.Arcade.World#forceX}. + * @property {boolean} [isPaused=false] - Sets {@link Phaser.Physics.Arcade.World#isPaused}. + * @property {boolean} [debug=false] - Sets {@link Phaser.Physics.Arcade.World#debug}. + * @property {boolean} [debugShowBody=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowBody}. + * @property {boolean} [debugShowStaticBody=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowStaticBody}. + * @property {boolean} [debugShowVelocity=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowStaticBody}. + * @property {number} [debugBodyColor=0xff00ff] - Sets {@link Phaser.Physics.Arcade.World#defaults debugBodyColor}. + * @property {number} [debugStaticBodyColor=0x0000ff] - Sets {@link Phaser.Physics.Arcade.World#defaults debugStaticBodyColor}. + * @property {number} [debugVelocityColor=0x00ff00] - Sets {@link Phaser.Physics.Arcade.World#defaults debugVelocityColor}. + * @property {number} [maxEntries=16] - Sets {@link Phaser.Physics.Arcade.World#maxEntries}. + * @property {boolean} [useTree=true] - Sets {@link Phaser.Physics.Arcade.World#useTree}. + */ diff --git a/src/physics/arcade/typedefs/ArcadeWorldDefaults.js b/src/physics/arcade/typedefs/ArcadeWorldDefaults.js new file mode 100644 index 000000000..8be7d5a69 --- /dev/null +++ b/src/physics/arcade/typedefs/ArcadeWorldDefaults.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.ArcadeWorldDefaults + * @since 3.0.0 + * + * @property {boolean} debugShowBody - Set to `true` to render dynamic body outlines to the debug display. + * @property {boolean} debugShowStaticBody - Set to `true` to render static body outlines to the debug display. + * @property {boolean} debugShowVelocity - Set to `true` to render body velocity markers to the debug display. + * @property {number} bodyDebugColor - The color of dynamic body outlines when rendered to the debug display. + * @property {number} staticBodyDebugColor - The color of static body outlines when rendered to the debug display. + * @property {number} velocityDebugColor - The color of the velocity markers when rendered to the debug display. + */ diff --git a/src/physics/arcade/typedefs/ArcadeWorldTreeMinMax.js b/src/physics/arcade/typedefs/ArcadeWorldTreeMinMax.js new file mode 100644 index 000000000..084df62c3 --- /dev/null +++ b/src/physics/arcade/typedefs/ArcadeWorldTreeMinMax.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.ArcadeWorldTreeMinMax + * @since 3.0.0 + * + * @property {number} minX - The minimum x value used in RTree searches. + * @property {number} minY - The minimum y value used in RTree searches. + * @property {number} maxX - The maximum x value used in RTree searches. + * @property {number} maxY - The maximum y value used in RTree searches. + */ diff --git a/src/physics/arcade/typedefs/CheckCollisionObject.js b/src/physics/arcade/typedefs/CheckCollisionObject.js new file mode 100644 index 000000000..252726d06 --- /dev/null +++ b/src/physics/arcade/typedefs/CheckCollisionObject.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.CheckCollisionObject + * @since 3.0.0 + * + * @property {boolean} up - Will bodies collide with the top side of the world bounds? + * @property {boolean} down - Will bodies collide with the bottom side of the world bounds? + * @property {boolean} left - Will bodies collide with the left side of the world bounds? + * @property {boolean} right - Will bodies collide with the right side of the world bounds? + */ diff --git a/src/physics/arcade/typedefs/PhysicsGroupConfig.js b/src/physics/arcade/typedefs/PhysicsGroupConfig.js new file mode 100644 index 000000000..71c0f2df5 --- /dev/null +++ b/src/physics/arcade/typedefs/PhysicsGroupConfig.js @@ -0,0 +1,28 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.PhysicsGroupConfig + * @extends Phaser.GameObjects.Group.Types.GroupConfig + * @since 3.0.0 + * + * @property {boolean} [collideWorldBounds=false] - Sets {@link Phaser.Physics.Arcade.Body#collideWorldBounds}. + * @property {number} [accelerationX=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.x}. + * @property {number} [accelerationY=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.y}. + * @property {boolean} [allowDrag=true] - Sets {@link Phaser.Physics.Arcade.Body#allowDrag}. + * @property {boolean} [allowGravity=true] - Sets {@link Phaser.Physics.Arcade.Body#allowGravity}. + * @property {boolean} [allowRotation=true] - Sets {@link Phaser.Physics.Arcade.Body#allowRotation}. + * @property {number} [bounceX=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.x}. + * @property {number} [bounceY=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.y}. + * @property {number} [dragX=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.x}. + * @property {number} [dragY=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.y}. + * @property {boolean} [enable=true] - Sets {@link Phaser.Physics.Arcade.Body#enable enable}. + * @property {number} [gravityX=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.x}. + * @property {number} [gravityY=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.y}. + * @property {number} [frictionX=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.x}. + * @property {number} [frictionY=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.y}. + * @property {number} [velocityX=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.x}. + * @property {number} [velocityY=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.y}. + * @property {number} [angularVelocity=0] - Sets {@link Phaser.Physics.Arcade.Body#angularVelocity}. + * @property {number} [angularAcceleration=0] - Sets {@link Phaser.Physics.Arcade.Body#angularAcceleration}. + * @property {number} [angularDrag=0] - Sets {@link Phaser.Physics.Arcade.Body#angularDrag}. + * @property {number} [mass=0] - Sets {@link Phaser.Physics.Arcade.Body#mass}. + * @property {boolean} [immovable=false] - Sets {@link Phaser.Physics.Arcade.Body#immovable}. + */ diff --git a/src/physics/arcade/typedefs/PhysicsGroupDefaults.js b/src/physics/arcade/typedefs/PhysicsGroupDefaults.js new file mode 100644 index 000000000..eba1c6c18 --- /dev/null +++ b/src/physics/arcade/typedefs/PhysicsGroupDefaults.js @@ -0,0 +1,27 @@ +/** + * @typedef {object} Phaser.Physics.Arcade.Types.PhysicsGroupDefaults + * @since 3.0.0 + * + * @property {boolean} setCollideWorldBounds - As {@link Phaser.Physics.Arcade.Body#setCollideWorldBounds}. + * @property {number} setAccelerationX - As {@link Phaser.Physics.Arcade.Body#setAccelerationX}. + * @property {number} setAccelerationY - As {@link Phaser.Physics.Arcade.Body#setAccelerationY}. + * @property {boolean} setAllowDrag - As {@link Phaser.Physics.Arcade.Body#setAllowDrag}. + * @property {boolean} setAllowGravity - As {@link Phaser.Physics.Arcade.Body#setAllowGravity}. + * @property {boolean} setAllowRotation - As {@link Phaser.Physics.Arcade.Body#setAllowRotation}. + * @property {number} setBounceX - As {@link Phaser.Physics.Arcade.Body#setBounceX}. + * @property {number} setBounceY - As {@link Phaser.Physics.Arcade.Body#setBounceY}. + * @property {number} setDragX - As {@link Phaser.Physics.Arcade.Body#setDragX}. + * @property {number} setDragY - As {@link Phaser.Physics.Arcade.Body#setDragY}. + * @property {boolean} setEnable - As {@link Phaser.Physics.Arcade.Body#setEnable}. + * @property {number} setGravityX - As {@link Phaser.Physics.Arcade.Body#setGravityX}. + * @property {number} setGravityY - As {@link Phaser.Physics.Arcade.Body#setGravityY}. + * @property {number} setFrictionX - As {@link Phaser.Physics.Arcade.Body#setFrictionX}. + * @property {number} setFrictionY - As {@link Phaser.Physics.Arcade.Body#setFrictionY}. + * @property {number} setVelocityX - As {@link Phaser.Physics.Arcade.Body#setVelocityX}. + * @property {number} setVelocityY - As {@link Phaser.Physics.Arcade.Body#setVelocityY}. + * @property {number} setAngularVelocity - As {@link Phaser.Physics.Arcade.Body#setAngularVelocity}. + * @property {number} setAngularAcceleration - As {@link Phaser.Physics.Arcade.Body#setAngularAcceleration}. + * @property {number} setAngularDrag - As {@link Phaser.Physics.Arcade.Body#setAngularDrag}. + * @property {number} setMass - As {@link Phaser.Physics.Arcade.Body#setMass}. + * @property {boolean} setImmovable - As {@link Phaser.Physics.Arcade.Body#setImmovable}. + */ diff --git a/src/physics/arcade/typedefs/index.js b/src/physics/arcade/typedefs/index.js new file mode 100644 index 000000000..0ee0e55df --- /dev/null +++ b/src/physics/arcade/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Arcade.Types + */ diff --git a/src/physics/impact/Body.js b/src/physics/impact/Body.js index ee7affcd7..2a50c241c 100644 --- a/src/physics/impact/Body.js +++ b/src/physics/impact/Body.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,30 +11,12 @@ var TYPE = require('./TYPE'); var UpdateMotion = require('./UpdateMotion'); /** - * @callback BodyUpdateCallback + * @callback Phaser.Physics.Impact.Types.BodyUpdateCallback + * @since 3.0.0 * * @param {Phaser.Physics.Impact.Body} body - [description] */ -/** - * @typedef {object} JSONImpactBody - * @todo Replace object types - * - * @property {string} name - [description] - * @property {object} size - [description] - * @property {object} pos - The entity's position in the game world. - * @property {object} vel - Current velocity in pixels per second. - * @property {object} accel - Current acceleration to be added to the entity's velocity per second. E.g. an entity with a `vel.x` of 0 and `accel.x` of 10 will have a `vel.x` of 100 ten seconds later. - * @property {object} friction - Deceleration to be subtracted from the entity's velocity per second. Only applies if `accel` is 0. - * @property {object} maxVel - The maximum velocity a body can move. - * @property {number} gravityFactor - [description] - * @property {number} bounciness - [description] - * @property {number} minBounceVelocity - [description] - * @property {Phaser.Physics.Impact.TYPE} type - [description] - * @property {Phaser.Physics.Impact.TYPE} checkAgainst - [description] - * @property {Phaser.Physics.Impact.COLLIDES} collides - [description] - */ - /** * @classdesc * An Impact.js compatible physics body. @@ -121,7 +103,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#size - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.size = { x: sx, y: sy }; @@ -130,7 +112,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#offset - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.offset = { x: 0, y: 0 }; @@ -139,7 +121,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#pos - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.pos = { x: x, y: y }; @@ -148,7 +130,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#last - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.last = { x: x, y: y }; @@ -157,7 +139,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#vel - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.vel = { x: 0, y: 0 }; @@ -166,7 +148,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#accel - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.accel = { x: 0, y: 0 }; @@ -175,7 +157,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#friction - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.friction = { x: 0, y: 0 }; @@ -184,7 +166,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Impact.Body#maxVel - * @type {{x: number, y: number}} + * @type {Phaser.Math.Types.Vector2Like} * @since 3.0.0 */ this.maxVel = { x: world.defaults.maxVelocityX, y: world.defaults.maxVelocityY }; @@ -509,7 +491,7 @@ var Body = new Class({ * @method Phaser.Physics.Impact.Body#toJSON * @since 3.0.0 * - * @return {JSONImpactBody} JSON representation of this body object. + * @return {Phaser.Physics.Impact.Types.JSONImpactBody} JSON representation of this body object. */ toJSON: function () { diff --git a/src/physics/impact/COLLIDES.js b/src/physics/impact/COLLIDES.js index 8e7d06c2d..249490f39 100644 --- a/src/physics/impact/COLLIDES.js +++ b/src/physics/impact/COLLIDES.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,18 +13,20 @@ * with other LITE or PASSIVE entities at all. The behavior for FIXED vs. * FIXED collisions is undefined. * - * @name Phaser.Physics.Impact.COLLIDES - * @enum {integer} + * @namespace Phaser.Physics.Impact.COLLIDES * @memberof Phaser.Physics.Impact - * @readonly * @since 3.0.0 */ + module.exports = { /** * Never collides. * * @name Phaser.Physics.Impact.COLLIDES.NEVER + * @type {integer} + * @const + * @since 3.0.0 */ NEVER: 0, @@ -32,6 +34,9 @@ module.exports = { * Lite collision. * * @name Phaser.Physics.Impact.COLLIDES.LITE + * @type {integer} + * @const + * @since 3.0.0 */ LITE: 1, @@ -39,6 +44,9 @@ module.exports = { * Passive collision. * * @name Phaser.Physics.Impact.COLLIDES.PASSIVE + * @type {integer} + * @const + * @since 3.0.0 */ PASSIVE: 2, @@ -46,6 +54,9 @@ module.exports = { * Active collision. * * @name Phaser.Physics.Impact.COLLIDES.ACTIVE + * @type {integer} + * @const + * @since 3.0.0 */ ACTIVE: 4, @@ -53,6 +64,9 @@ module.exports = { * Fixed collision. * * @name Phaser.Physics.Impact.COLLIDES.FIXED + * @type {integer} + * @const + * @since 3.0.0 */ FIXED: 8 diff --git a/src/physics/impact/CollisionMap.js b/src/physics/impact/CollisionMap.js index ec042d80a..2f6865f67 100644 --- a/src/physics/impact/CollisionMap.js +++ b/src/physics/impact/CollisionMap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/DefaultDefs.js b/src/physics/impact/DefaultDefs.js index 159fca98d..113eb7b0e 100644 --- a/src/physics/impact/DefaultDefs.js +++ b/src/physics/impact/DefaultDefs.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/Factory.js b/src/physics/impact/Factory.js index f74dfc4a3..85c3ba39f 100644 --- a/src/physics/impact/Factory.js +++ b/src/physics/impact/Factory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/GetVelocity.js b/src/physics/impact/GetVelocity.js index 9fa209bd5..b0276cae8 100644 --- a/src/physics/impact/GetVelocity.js +++ b/src/physics/impact/GetVelocity.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/ImpactBody.js b/src/physics/impact/ImpactBody.js index faca25f6c..4a4ca1fa0 100644 --- a/src/physics/impact/ImpactBody.js +++ b/src/physics/impact/ImpactBody.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/ImpactImage.js b/src/physics/impact/ImpactImage.js index dbd3c8b04..83b15b0fc 100644 --- a/src/physics/impact/ImpactImage.js +++ b/src/physics/impact/ImpactImage.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/ImpactPhysics.js b/src/physics/impact/ImpactPhysics.js index 24d980605..68dcc731a 100644 --- a/src/physics/impact/ImpactPhysics.js +++ b/src/physics/impact/ImpactPhysics.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,6 +9,7 @@ var Factory = require('./Factory'); var GetFastValue = require('../../utils/object/GetFastValue'); var Merge = require('../../utils/object/Merge'); var PluginCache = require('../../plugins/PluginCache'); +var SceneEvents = require('../../scene/events'); var World = require('./World'); /** @@ -73,8 +74,8 @@ var ImpactPhysics = new Class({ */ this.add; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -90,7 +91,7 @@ var ImpactPhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -112,8 +113,8 @@ var ImpactPhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -175,8 +176,8 @@ var ImpactPhysics = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -197,7 +198,7 @@ var ImpactPhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/physics/impact/ImpactSprite.js b/src/physics/impact/ImpactSprite.js index c7fb7d536..cb0d0aec9 100644 --- a/src/physics/impact/ImpactSprite.js +++ b/src/physics/impact/ImpactSprite.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/SeperateX.js b/src/physics/impact/SeparateX.js similarity index 89% rename from src/physics/impact/SeperateX.js rename to src/physics/impact/SeparateX.js index ef744df33..56a5fc5d2 100644 --- a/src/physics/impact/SeperateX.js +++ b/src/physics/impact/SeparateX.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @function Phaser.Physics.Impact.SeperateX + * @function Phaser.Physics.Impact.SeparateX * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - [description] @@ -15,7 +15,7 @@ * @param {Phaser.Physics.Impact.Body} right - [description] * @param {Phaser.Physics.Impact.Body} [weak] - [description] */ -var SeperateX = function (world, left, right, weak) +var SeparateX = function (world, left, right, weak) { var nudge = left.pos.x + left.size.x - right.pos.x; @@ -47,4 +47,4 @@ var SeperateX = function (world, left, right, weak) } }; -module.exports = SeperateX; +module.exports = SeparateX; diff --git a/src/physics/impact/SeperateY.js b/src/physics/impact/SeparateY.js similarity index 92% rename from src/physics/impact/SeperateY.js rename to src/physics/impact/SeparateY.js index 4837e348a..0beadd2f5 100644 --- a/src/physics/impact/SeperateY.js +++ b/src/physics/impact/SeparateY.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @function Phaser.Physics.Impact.SeperateY + * @function Phaser.Physics.Impact.SeparateY * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - [description] @@ -15,7 +15,7 @@ * @param {Phaser.Physics.Impact.Body} bottom - [description] * @param {Phaser.Physics.Impact.Body} [weak] - [description] */ -var SeperateY = function (world, top, bottom, weak) +var SeparateY = function (world, top, bottom, weak) { var nudge = (top.pos.y + top.size.y - bottom.pos.y); var nudgeX; @@ -76,4 +76,4 @@ var SeperateY = function (world, top, bottom, weak) } }; -module.exports = SeperateY; +module.exports = SeparateY; diff --git a/src/physics/impact/Solver.js b/src/physics/impact/Solver.js index a6e03523a..ee9cdf5f6 100644 --- a/src/physics/impact/Solver.js +++ b/src/physics/impact/Solver.js @@ -1,17 +1,19 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var COLLIDES = require('./COLLIDES'); -var SeperateX = require('./SeperateX'); -var SeperateY = require('./SeperateY'); +var Events = require('./events'); +var SeparateX = require('./SeparateX'); +var SeparateY = require('./SeparateY'); /** * Impact Physics Solver * * @function Phaser.Physics.Impact.Solver + * @fires Phaser.Physics.Impact.Events#COLLIDE * @since 3.0.0 * * @param {Phaser.Physics.Impact.World} world - The Impact simulation to run the solver in. @@ -35,33 +37,33 @@ var Solver = function (world, bodyA, bodyB) { if (bodyA.last.y < bodyB.last.y) { - SeperateY(world, bodyA, bodyB, weak); + SeparateY(world, bodyA, bodyB, weak); } else { - SeperateY(world, bodyB, bodyA, weak); + SeparateY(world, bodyB, bodyA, weak); } bodyA.collideWith(bodyB, 'y'); bodyB.collideWith(bodyA, 'y'); - world.emit('collide', bodyA, bodyB, 'y'); + world.emit(Events.COLLIDE, bodyA, bodyB, 'y'); } else if (bodyA.last.y + bodyA.size.y > bodyB.last.y && bodyA.last.y < bodyB.last.y + bodyB.size.y) { if (bodyA.last.x < bodyB.last.x) { - SeperateX(world, bodyA, bodyB, weak); + SeparateX(world, bodyA, bodyB, weak); } else { - SeperateX(world, bodyB, bodyA, weak); + SeparateX(world, bodyB, bodyA, weak); } bodyA.collideWith(bodyB, 'x'); bodyB.collideWith(bodyA, 'x'); - world.emit('collide', bodyA, bodyB, 'x'); + world.emit(Events.COLLIDE, bodyA, bodyB, 'x'); } }; diff --git a/src/physics/impact/TYPE.js b/src/physics/impact/TYPE.js index 856f280b8..6908940e1 100644 --- a/src/physics/impact/TYPE.js +++ b/src/physics/impact/TYPE.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,10 +13,8 @@ * with other LITE or PASSIVE entities at all. The behavior for FIXED vs. * FIXED collisions is undefined. * - * @name Phaser.Physics.Impact.TYPE - * @enum {integer} + * @namespace Phaser.Physics.Impact.TYPE * @memberof Phaser.Physics.Impact - * @readonly * @since 3.0.0 */ module.exports = { @@ -25,6 +23,9 @@ module.exports = { * Collides with nothing. * * @name Phaser.Physics.Impact.TYPE.NONE + * @type {integer} + * @const + * @since 3.0.0 */ NONE: 0, @@ -32,6 +33,9 @@ module.exports = { * Type A. Collides with Type B. * * @name Phaser.Physics.Impact.TYPE.A + * @type {integer} + * @const + * @since 3.0.0 */ A: 1, @@ -39,6 +43,9 @@ module.exports = { * Type B. Collides with Type A. * * @name Phaser.Physics.Impact.TYPE.B + * @type {integer} + * @const + * @since 3.0.0 */ B: 2, @@ -46,6 +53,9 @@ module.exports = { * Collides with both types A and B. * * @name Phaser.Physics.Impact.TYPE.BOTH + * @type {integer} + * @const + * @since 3.0.0 */ BOTH: 3 diff --git a/src/physics/impact/UpdateMotion.js b/src/physics/impact/UpdateMotion.js index 798b12fcf..403ff00e8 100644 --- a/src/physics/impact/UpdateMotion.js +++ b/src/physics/impact/UpdateMotion.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/World.js b/src/physics/impact/World.js index ac44a53cd..4ce421ab0 100644 --- a/src/physics/impact/World.js +++ b/src/physics/impact/World.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,6 +9,7 @@ var Class = require('../../utils/Class'); var COLLIDES = require('./COLLIDES'); var CollisionMap = require('./CollisionMap'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var GetFastValue = require('../../utils/object/GetFastValue'); var HasValue = require('../../utils/object/HasValue'); var Set = require('../../structs/Set'); @@ -16,61 +17,6 @@ var Solver = require('./Solver'); var TILEMAP_FORMATS = require('../../tilemaps/Formats'); var TYPE = require('./TYPE'); -/** - * @typedef {object} Phaser.Physics.Impact.WorldConfig - * - * @property {number} [gravity=0] - Sets {@link Phaser.Physics.Impact.World#gravity} - * @property {number} [cellSize=64] - The size of the cells used for the broadphase pass. Increase this value if you have lots of large objects in the world. - * @property {number} [timeScale=1] - A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. - * @property {number} [maxStep=0.05] - [description] - * @property {boolean} [debug=false] - Sets {@link Phaser.Physics.Impact.World#debug}. - * @property {number} [maxVelocity=100] - The maximum velocity a body can move. - * @property {boolean} [debugShowBody=true] - Whether the Body's boundary is drawn to the debug display. - * @property {boolean} [debugShowVelocity=true] - Whether the Body's velocity is drawn to the debug display. - * @property {number} [debugBodyColor=0xff00ff] - The color of this Body on the debug display. - * @property {number} [debugVelocityColor=0x00ff00] - The color of the Body's velocity on the debug display. - * @property {number} [maxVelocityX=maxVelocity] - Maximum X velocity objects can move. - * @property {number} [maxVelocityY=maxVelocity] - Maximum Y velocity objects can move. - * @property {number} [minBounceVelocity=40] - The minimum velocity an object can be moving at to be considered for bounce. - * @property {number} [gravityFactor=1] - Gravity multiplier. Set to 0 for no gravity. - * @property {number} [bounciness=0] - The default bounce, or restitution, of bodies in the world. - * @property {(object|boolean)} [setBounds] - Should the world have bounds enabled by default? - * @property {number} [setBounds.x=0] - The x coordinate of the world bounds. - * @property {number} [setBounds.y=0] - The y coordinate of the world bounds. - * @property {number} [setBounds.width] - The width of the world bounds. - * @property {number} [setBounds.height] - The height of the world bounds. - * @property {number} [setBounds.thickness=64] - The thickness of the walls of the world bounds. - * @property {boolean} [setBounds.left=true] - Should the left-side world bounds wall be created? - * @property {boolean} [setBounds.right=true] - Should the right-side world bounds wall be created? - * @property {boolean} [setBounds.top=true] - Should the top world bounds wall be created? - * @property {boolean} [setBounds.bottom=true] - Should the bottom world bounds wall be created? - */ - -/** - * An object containing the 4 wall bodies that bound the physics world. - * - * @typedef {object} Phaser.Physics.Impact.WorldDefaults - * - * @property {boolean} debugShowBody - Whether the Body's boundary is drawn to the debug display. - * @property {boolean} debugShowVelocity - Whether the Body's velocity is drawn to the debug display. - * @property {number} bodyDebugColor - The color of this Body on the debug display. - * @property {number} velocityDebugColor - The color of the Body's velocity on the debug display. - * @property {number} maxVelocityX - Maximum X velocity objects can move. - * @property {number} maxVelocityY - Maximum Y velocity objects can move. - * @property {number} minBounceVelocity - The minimum velocity an object can be moving at to be considered for bounce. - * @property {number} gravityFactor - Gravity multiplier. Set to 0 for no gravity. - * @property {number} bounciness - The default bounce, or restitution, of bodies in the world. - */ - -/** - * @typedef {object} Phaser.Physics.Impact.WorldWalls - * - * @property {?Phaser.Physics.Impact.Body} left - The left-side wall of the world bounds. - * @property {?Phaser.Physics.Impact.Body} right - The right-side wall of the world bounds. - * @property {?Phaser.Physics.Impact.Body} top - The top wall of the world bounds. - * @property {?Phaser.Physics.Impact.Body} bottom - The bottom wall of the world bounds. - */ - /** * @classdesc * [description] @@ -82,7 +28,7 @@ var TYPE = require('./TYPE'); * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to which this Impact World instance belongs. - * @param {Phaser.Physics.Impact.WorldConfig} config - [description] + * @param {Phaser.Physics.Impact.Types.WorldConfig} config - [description] */ var World = new Class({ @@ -195,7 +141,7 @@ var World = new Class({ * [description] * * @name Phaser.Physics.Impact.World#defaults - * @type {Phaser.Physics.Impact.WorldDefaults} + * @type {Phaser.Physics.Impact.Types.WorldDefaults} * @since 3.0.0 */ this.defaults = { @@ -214,7 +160,7 @@ var World = new Class({ * An object containing the 4 wall bodies that bound the physics world. * * @name Phaser.Physics.Impact.World#walls - * @type {Phaser.Physics.Impact.WorldWalls} + * @type {Phaser.Physics.Impact.Types.WorldWalls} * @since 3.0.0 */ this.walls = { left: null, right: null, top: null, bottom: null }; @@ -252,8 +198,8 @@ var World = new Class({ { var x = GetFastValue(boundsConfig, 'x', 0); var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); var thickness = GetFastValue(boundsConfig, 'thickness', 64); var left = GetFastValue(boundsConfig, 'left', true); var right = GetFastValue(boundsConfig, 'right', true); @@ -334,16 +280,7 @@ var World = new Class({ * @since 3.0.0 * * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemap layer to use. - * @param {object} [options] - Options for controlling the mapping from tiles to slope IDs. - * @param {string} [options.slopeTileProperty=null] - Slope IDs can be stored on tiles directly - * using Tiled's tileset editor. If a tile has a property with the given slopeTileProperty string - * name, the value of that property for the tile will be used for its slope mapping. E.g. a 45 - * degree slope upward could be given a "slope" property with a value of 2. - * @param {object} [options.slopeMap=null] - A tile index to slope definition map. - * @param {integer} [options.defaultCollidingSlope=null] - If specified, the default slope ID to - * assign to a colliding tile. If not specified, the tile's index is used. - * @param {integer} [options.defaultNonCollidingSlope=0] - The default slope ID to assign to a - * non-colliding tile. + * @param {Phaser.Physics.Impact.Types.CollisionOptions} [options] - Options for controlling the mapping from tiles to slope IDs. * * @return {Phaser.Physics.Impact.CollisionMap} The newly created CollisionMap. */ @@ -425,8 +362,8 @@ var World = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (thickness === undefined) { thickness = 64; } if (left === undefined) { left = true; } if (right === undefined) { right = true; } @@ -556,6 +493,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Impact.World#pause + * @fires Phaser.Physics.Impact.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Impact.World} This World object. @@ -564,7 +502,7 @@ var World = new Class({ { this.enabled = false; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -573,6 +511,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Impact.World#resume + * @fires Phaser.Physics.Impact.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Impact.World} This World object. @@ -581,7 +520,7 @@ var World = new Class({ { this.enabled = true; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, diff --git a/src/physics/impact/components/Acceleration.js b/src/physics/impact/components/Acceleration.js index 18ffe0c63..42e1fcb36 100644 --- a/src/physics/impact/components/Acceleration.js +++ b/src/physics/impact/components/Acceleration.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Acceleration component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Acceleration + * @namespace Phaser.Physics.Impact.Components.Acceleration * @since 3.0.0 */ var Acceleration = { diff --git a/src/physics/impact/components/BodyScale.js b/src/physics/impact/components/BodyScale.js index 4e9483b69..affab2158 100644 --- a/src/physics/impact/components/BodyScale.js +++ b/src/physics/impact/components/BodyScale.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Body Scale component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.BodyScale + * @namespace Phaser.Physics.Impact.Components.BodyScale * @since 3.0.0 */ var BodyScale = { diff --git a/src/physics/impact/components/BodyType.js b/src/physics/impact/components/BodyType.js index 6da8778a1..c96777379 100644 --- a/src/physics/impact/components/BodyType.js +++ b/src/physics/impact/components/BodyType.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var TYPE = require('../TYPE'); * The Impact Body Type component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.BodyType + * @namespace Phaser.Physics.Impact.Components.BodyType * @since 3.0.0 */ var BodyType = { diff --git a/src/physics/impact/components/Bounce.js b/src/physics/impact/components/Bounce.js index ac4765446..9f61b4c0d 100644 --- a/src/physics/impact/components/Bounce.js +++ b/src/physics/impact/components/Bounce.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Bounce component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Bounce + * @namespace Phaser.Physics.Impact.Components.Bounce * @since 3.0.0 */ var Bounce = { diff --git a/src/physics/impact/components/CheckAgainst.js b/src/physics/impact/components/CheckAgainst.js index 0b3d2554d..41d66dde3 100644 --- a/src/physics/impact/components/CheckAgainst.js +++ b/src/physics/impact/components/CheckAgainst.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var TYPE = require('../TYPE'); * The Impact Check Against component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.CheckAgainst + * @namespace Phaser.Physics.Impact.Components.CheckAgainst * @since 3.0.0 */ var CheckAgainst = { diff --git a/src/physics/impact/components/Collides.js b/src/physics/impact/components/Collides.js index 8af458bb6..603f234a6 100644 --- a/src/physics/impact/components/Collides.js +++ b/src/physics/impact/components/Collides.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,7 +18,7 @@ var COLLIDES = require('../COLLIDES'); * The Impact Collides component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Collides + * @namespace Phaser.Physics.Impact.Components.Collides * @since 3.0.0 */ var Collides = { diff --git a/src/physics/impact/components/Debug.js b/src/physics/impact/components/Debug.js index b91ac79a3..9d524bb00 100644 --- a/src/physics/impact/components/Debug.js +++ b/src/physics/impact/components/Debug.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Debug component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Debug + * @namespace Phaser.Physics.Impact.Components.Debug * @since 3.0.0 */ var Debug = { diff --git a/src/physics/impact/components/Friction.js b/src/physics/impact/components/Friction.js index b0d14c2dc..ef7e8f9fb 100644 --- a/src/physics/impact/components/Friction.js +++ b/src/physics/impact/components/Friction.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Friction component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Friction + * @namespace Phaser.Physics.Impact.Components.Friction * @since 3.0.0 */ var Friction = { diff --git a/src/physics/impact/components/Gravity.js b/src/physics/impact/components/Gravity.js index 6ea581451..c1b6519b5 100644 --- a/src/physics/impact/components/Gravity.js +++ b/src/physics/impact/components/Gravity.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Gravity component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Gravity + * @namespace Phaser.Physics.Impact.Components.Gravity * @since 3.0.0 */ var Gravity = { diff --git a/src/physics/impact/components/Offset.js b/src/physics/impact/components/Offset.js index d640eb609..bc45e4504 100644 --- a/src/physics/impact/components/Offset.js +++ b/src/physics/impact/components/Offset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Offset component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Offset + * @namespace Phaser.Physics.Impact.Components.Offset * @since 3.0.0 */ var Offset = { diff --git a/src/physics/impact/components/SetGameObject.js b/src/physics/impact/components/SetGameObject.js index 0344c4a3d..16e6b8278 100644 --- a/src/physics/impact/components/SetGameObject.js +++ b/src/physics/impact/components/SetGameObject.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Set Game Object component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.SetGameObject + * @namespace Phaser.Physics.Impact.Components.SetGameObject * @since 3.0.0 */ var SetGameObject = { diff --git a/src/physics/impact/components/Velocity.js b/src/physics/impact/components/Velocity.js index c2028aba1..12e31e91c 100644 --- a/src/physics/impact/components/Velocity.js +++ b/src/physics/impact/components/Velocity.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,7 +8,7 @@ * The Impact Velocity component. * Should be applied as a mixin. * - * @name Phaser.Physics.Impact.Components.Velocity + * @namespace Phaser.Physics.Impact.Components.Velocity * @since 3.0.0 */ var Velocity = { diff --git a/src/physics/impact/components/index.js b/src/physics/impact/components/index.js index 81c3a771f..ec6d6db65 100644 --- a/src/physics/impact/components/index.js +++ b/src/physics/impact/components/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/impact/events/COLLIDE_EVENT.js b/src/physics/impact/events/COLLIDE_EVENT.js new file mode 100644 index 000000000..bbe7a9844 --- /dev/null +++ b/src/physics/impact/events/COLLIDE_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Collide Event. + * + * This event is dispatched by an Impact Physics World instance if two bodies collide. + * + * Listen to it from a Scene using: `this.impact.world.on('collide', listener)`. + * + * @event Phaser.Physics.Impact.Events#COLLIDE + * @since 3.0.0 + * + * @param {Phaser.Physics.Impact.Body} bodyA - The first body involved in the collision. + * @param {Phaser.Physics.Impact.Body} bodyB - The second body involved in the collision. + * @param {string} axis - The collision axis. Either `x` or `y`. + */ +module.exports = 'collide'; diff --git a/src/physics/impact/events/PAUSE_EVENT.js b/src/physics/impact/events/PAUSE_EVENT.js new file mode 100644 index 000000000..8714ee56a --- /dev/null +++ b/src/physics/impact/events/PAUSE_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Pause Event. + * + * This event is dispatched by an Impact Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.impact.world.on('pause', listener)`. + * + * @event Phaser.Physics.Impact.Events#PAUSE + * @since 3.0.0 + */ +module.exports = 'pause'; diff --git a/src/physics/impact/events/RESUME_EVENT.js b/src/physics/impact/events/RESUME_EVENT.js new file mode 100644 index 000000000..360ae0af8 --- /dev/null +++ b/src/physics/impact/events/RESUME_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Impact Physics World Resume Event. + * + * This event is dispatched by an Impact Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.impact.world.on('resume', listener)`. + * + * @event Phaser.Physics.Impact.Events#RESUME + * @since 3.0.0 + */ +module.exports = 'resume'; diff --git a/src/physics/impact/events/index.js b/src/physics/impact/events/index.js new file mode 100644 index 000000000..27f8a88c6 --- /dev/null +++ b/src/physics/impact/events/index.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Impact.Events + */ + +module.exports = { + + COLLIDE: require('./COLLIDE_EVENT'), + PAUSE: require('./PAUSE_EVENT'), + RESUME: require('./RESUME_EVENT') + +}; diff --git a/src/physics/impact/index.js b/src/physics/impact/index.js index 134886ad3..85de24de3 100644 --- a/src/physics/impact/index.js +++ b/src/physics/impact/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22,6 +22,7 @@ module.exports = { Body: require('./Body'), + Events: require('./events'), COLLIDES: require('./COLLIDES'), CollisionMap: require('./CollisionMap'), Factory: require('./Factory'), diff --git a/src/physics/impact/typedefs/CollisionOptions.js b/src/physics/impact/typedefs/CollisionOptions.js new file mode 100644 index 000000000..7c64cd9df --- /dev/null +++ b/src/physics/impact/typedefs/CollisionOptions.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Physics.Impact.Types.CollisionOptions + * @since 3.0.0 + * + * @property {string} [slopeTileProperty=null] - Slope IDs can be stored on tiles directly + * using Impacts tileset editor. If a tile has a property with the given slopeTileProperty string + * name, the value of that property for the tile will be used for its slope mapping. E.g. a 45 + * degree slope upward could be given a "slope" property with a value of 2. + * @property {object} [slopeMap=null] - A tile index to slope definition map. + * @property {integer} [defaultCollidingSlope=null] - If specified, the default slope ID to + * assign to a colliding tile. If not specified, the tile's index is used. + * @property {integer} [defaultNonCollidingSlope=0] - The default slope ID to assign to a + * non-colliding tile. + */ diff --git a/src/physics/impact/typedefs/JSONImpactBody.js b/src/physics/impact/typedefs/JSONImpactBody.js new file mode 100644 index 000000000..b56cc033d --- /dev/null +++ b/src/physics/impact/typedefs/JSONImpactBody.js @@ -0,0 +1,18 @@ +/** + * @typedef {object} Phaser.Physics.Impact.Types.JSONImpactBody + * @since 3.0.0 + * + * @property {string} name - [description] + * @property {Phaser.Math.Types.Vector2Like} size - [description] + * @property {Phaser.Math.Types.Vector2Like} pos - The entity's position in the game world. + * @property {Phaser.Math.Types.Vector2Like} vel - Current velocity in pixels per second. + * @property {Phaser.Math.Types.Vector2Like} accel - Current acceleration to be added to the entity's velocity per second. E.g. an entity with a `vel.x` of 0 and `accel.x` of 10 will have a `vel.x` of 100 ten seconds later. + * @property {Phaser.Math.Types.Vector2Like} friction - Deceleration to be subtracted from the entity's velocity per second. Only applies if `accel` is 0. + * @property {Phaser.Math.Types.Vector2Like} maxVel - The maximum velocity a body can move. + * @property {number} gravityFactor - [description] + * @property {number} bounciness - [description] + * @property {number} minBounceVelocity - [description] + * @property {Phaser.Physics.Impact.TYPE} type - [description] + * @property {Phaser.Physics.Impact.TYPE} checkAgainst - [description] + * @property {Phaser.Physics.Impact.COLLIDES} collides - [description] + */ diff --git a/src/physics/impact/typedefs/WorldConfig.js b/src/physics/impact/typedefs/WorldConfig.js new file mode 100644 index 000000000..7502f2c95 --- /dev/null +++ b/src/physics/impact/typedefs/WorldConfig.js @@ -0,0 +1,30 @@ +/** + * @typedef {object} Phaser.Physics.Impact.Types.WorldConfig + * @since 3.0.0 + * + * @property {number} [gravity=0] - Sets {@link Phaser.Physics.Impact.World#gravity} + * @property {number} [cellSize=64] - The size of the cells used for the broadphase pass. Increase this value if you have lots of large objects in the world. + * @property {number} [timeScale=1] - A number that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + * @property {number} [maxStep=0.05] - [description] + * @property {boolean} [debug=false] - Sets {@link Phaser.Physics.Impact.World#debug}. + * @property {number} [maxVelocity=100] - The maximum velocity a body can move. + * @property {boolean} [debugShowBody=true] - Whether the Body's boundary is drawn to the debug display. + * @property {boolean} [debugShowVelocity=true] - Whether the Body's velocity is drawn to the debug display. + * @property {number} [debugBodyColor=0xff00ff] - The color of this Body on the debug display. + * @property {number} [debugVelocityColor=0x00ff00] - The color of the Body's velocity on the debug display. + * @property {number} [maxVelocityX=maxVelocity] - Maximum X velocity objects can move. + * @property {number} [maxVelocityY=maxVelocity] - Maximum Y velocity objects can move. + * @property {number} [minBounceVelocity=40] - The minimum velocity an object can be moving at to be considered for bounce. + * @property {number} [gravityFactor=1] - Gravity multiplier. Set to 0 for no gravity. + * @property {number} [bounciness=0] - The default bounce, or restitution, of bodies in the world. + * @property {(object|boolean)} [setBounds] - Should the world have bounds enabled by default? + * @property {number} [setBounds.x=0] - The x coordinate of the world bounds. + * @property {number} [setBounds.y=0] - The y coordinate of the world bounds. + * @property {number} [setBounds.width] - The width of the world bounds. + * @property {number} [setBounds.height] - The height of the world bounds. + * @property {number} [setBounds.thickness=64] - The thickness of the walls of the world bounds. + * @property {boolean} [setBounds.left=true] - Should the left-side world bounds wall be created? + * @property {boolean} [setBounds.right=true] - Should the right-side world bounds wall be created? + * @property {boolean} [setBounds.top=true] - Should the top world bounds wall be created? + * @property {boolean} [setBounds.bottom=true] - Should the bottom world bounds wall be created? + */ diff --git a/src/physics/impact/typedefs/WorldDefaults.js b/src/physics/impact/typedefs/WorldDefaults.js new file mode 100644 index 000000000..af1c0b877 --- /dev/null +++ b/src/physics/impact/typedefs/WorldDefaults.js @@ -0,0 +1,16 @@ +/** + * An object containing the 4 wall bodies that bound the physics world. + * + * @typedef {object} Phaser.Physics.Impact.Types.WorldDefaults + * @since 3.0.0 + * + * @property {boolean} debugShowBody - Whether the Body's boundary is drawn to the debug display. + * @property {boolean} debugShowVelocity - Whether the Body's velocity is drawn to the debug display. + * @property {number} bodyDebugColor - The color of this Body on the debug display. + * @property {number} velocityDebugColor - The color of the Body's velocity on the debug display. + * @property {number} maxVelocityX - Maximum X velocity objects can move. + * @property {number} maxVelocityY - Maximum Y velocity objects can move. + * @property {number} minBounceVelocity - The minimum velocity an object can be moving at to be considered for bounce. + * @property {number} gravityFactor - Gravity multiplier. Set to 0 for no gravity. + * @property {number} bounciness - The default bounce, or restitution, of bodies in the world. + */ diff --git a/src/physics/impact/typedefs/WorldWalls.js b/src/physics/impact/typedefs/WorldWalls.js new file mode 100644 index 000000000..bfda262dc --- /dev/null +++ b/src/physics/impact/typedefs/WorldWalls.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Physics.Impact.Types.WorldWalls + * @since 3.0.0 + * + * @property {?Phaser.Physics.Impact.Body} left - The left-side wall of the world bounds. + * @property {?Phaser.Physics.Impact.Body} right - The right-side wall of the world bounds. + * @property {?Phaser.Physics.Impact.Body} top - The top wall of the world bounds. + * @property {?Phaser.Physics.Impact.Body} bottom - The bottom wall of the world bounds. + */ diff --git a/src/physics/impact/typedefs/index.js b/src/physics/impact/typedefs/index.js new file mode 100644 index 000000000..9e8456209 --- /dev/null +++ b/src/physics/impact/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Impact.Types + */ diff --git a/src/physics/index.js b/src/physics/index.js index 24afefe22..8ab9f47ba 100644 --- a/src/physics/index.js +++ b/src/physics/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/matter-js/CustomMain.js b/src/physics/matter-js/CustomMain.js index 6b2dfff1a..923b5716b 100644 --- a/src/physics/matter-js/CustomMain.js +++ b/src/physics/matter-js/CustomMain.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/matter-js/Factory.js b/src/physics/matter-js/Factory.js index aae35f3bb..581bfdf77 100644 --- a/src/physics/matter-js/Factory.js +++ b/src/physics/matter-js/Factory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/matter-js/MatterGameObject.js b/src/physics/matter-js/MatterGameObject.js index 717fc15b5..e48a54d71 100644 --- a/src/physics/matter-js/MatterGameObject.js +++ b/src/physics/matter-js/MatterGameObject.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/matter-js/MatterImage.js b/src/physics/matter-js/MatterImage.js index 3e1dd9200..ba7b1ea5d 100644 --- a/src/physics/matter-js/MatterImage.js +++ b/src/physics/matter-js/MatterImage.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/matter-js/MatterPhysics.js b/src/physics/matter-js/MatterPhysics.js index 622b27638..55b281721 100644 --- a/src/physics/matter-js/MatterPhysics.js +++ b/src/physics/matter-js/MatterPhysics.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,6 +14,7 @@ var MatterWrap = require('./lib/plugins/MatterWrap'); var Merge = require('../../utils/object/Merge'); var Plugin = require('./lib/core/Plugin'); var PluginCache = require('../../plugins/PluginCache'); +var SceneEvents = require('../../scene/events'); var World = require('./World'); var Vertices = require('./lib/geometry/Vertices'); @@ -104,8 +105,8 @@ var MatterPhysics = new Class({ Plugin.use(MatterLib, MatterWrap); } - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -121,7 +122,7 @@ var MatterPhysics = new Class({ this.world = new World(this.scene, this.config); this.add = new Factory(this.world); - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -143,9 +144,9 @@ var MatterPhysics = new Class({ var eventEmitter = this.systems.events; - eventEmitter.on('update', this.world.update, this.world); - eventEmitter.on('postupdate', this.world.postUpdate, this.world); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -305,9 +306,9 @@ var MatterPhysics = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('update', this.world.update, this.world); - eventEmitter.off('postupdate', this.world.postUpdate, this.world); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); this.add.destroy(); this.world.destroy(); @@ -328,7 +329,7 @@ var MatterPhysics = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/physics/matter-js/MatterSprite.js b/src/physics/matter-js/MatterSprite.js index c093a4723..342f40049 100644 --- a/src/physics/matter-js/MatterSprite.js +++ b/src/physics/matter-js/MatterSprite.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -89,7 +89,7 @@ var MatterSprite = new Class({ function MatterSprite (world, x, y, texture, frame, options) { - GameObject.call(this, world.scene, 'Image'); + GameObject.call(this, world.scene, 'Sprite'); this.anims = new AnimationComponent(this); diff --git a/src/physics/matter-js/MatterTileBody.js b/src/physics/matter-js/MatterTileBody.js index e22e46a76..f60dbfe9f 100644 --- a/src/physics/matter-js/MatterTileBody.js +++ b/src/physics/matter-js/MatterTileBody.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -41,14 +41,7 @@ var Vertices = require('./lib/geometry/Vertices'); * * @param {Phaser.Physics.Matter.World} world - [description] * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. - * @param {object} [options] - Options to be used when creating the Matter body. See - * Phaser.Physics.Matter.Matter.Body for a list of what Matter accepts. - * @param {Phaser.Physics.Matter.Matter.Body} [options.body=null] - An existing Matter body to - * be used instead of creating a new one. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. + * @param {Phaser.Physics.Matter.Types.MatterTileOptions} [options] - Options to be used when creating the Matter body. */ var MatterTileBody = new Class({ @@ -126,11 +119,7 @@ var MatterTileBody = new Class({ * @method Phaser.Physics.Matter.TileBody#setFromTileRectangle * @since 3.0.0 * - * @param {object} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. + * @param {Phaser.Physics.Matter.Types.MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. * * @return {Phaser.Physics.Matter.TileBody} This TileBody object. */ @@ -164,11 +153,7 @@ var MatterTileBody = new Class({ * @method Phaser.Physics.Matter.TileBody#setFromTileCollision * @since 3.0.0 * - * @param {object} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * @param {boolean} [options.isStatic=true] - Whether or not the newly created body should be - * made static. This defaults to true since typically tiles should not be moved. - * @param {boolean} [options.addToWorld=true] - Whether or not to add the newly created body (or - * existing body if options.body is used) to the Matter world. + * @param {MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. * * @return {Phaser.Physics.Matter.TileBody} This TileBody object. */ @@ -220,12 +205,14 @@ var MatterTileBody = new Class({ // matter expects points to be relative to the center of mass. This only applies to // convex shapes. When a concave shape is decomposed, multiple parts are created and // the individual parts are positioned relative to (ox, oy). - if (Vertices.isConvex(points)) - { - var center = Vertices.centre(vertices); - ox += center.x; - oy += center.y; - } + // + // Update: 8th January 2019 - the latest version of Matter needs the Vertices adjusted, + // regardless if convex or concave. + + var center = Vertices.centre(vertices); + + ox += center.x; + oy += center.y; body = Bodies.fromVertices(ox, oy, vertices, options); } diff --git a/src/physics/matter-js/PointerConstraint.js b/src/physics/matter-js/PointerConstraint.js index 76a692124..a91ac4e5d 100644 --- a/src/physics/matter-js/PointerConstraint.js +++ b/src/physics/matter-js/PointerConstraint.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,7 +9,8 @@ var Class = require('../../utils/Class'); var Composite = require('./lib/body/Composite'); var Constraint = require('./lib/constraint/Constraint'); var Detector = require('./lib/collision/Detector'); -var GetFastValue = require('../../utils/object/GetFastValue'); +var Events = require('./events'); +var InputEvents = require('../../input/events'); var Merge = require('../../utils/object/Merge'); var Sleeping = require('./lib/core/Sleeping'); var Vector2 = require('../../math/Vector2'); @@ -17,16 +18,23 @@ var Vertices = require('./lib/geometry/Vertices'); /** * @classdesc - * [description] + * A Pointer Constraint is a special type of constraint that allows you to click + * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, + * and when one is pressed down it checks to see if that hit any part of any active + * body in the world. If it did, and the body has input enabled, it will begin to + * drag it until either released, or you stop it via the `stopDrag` method. + * + * You can adjust the stiffness, length and other properties of the constraint via + * the `options` object on creation. * * @class PointerConstraint * @memberof Phaser.Physics.Matter * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Physics.Matter.World} world - [description] - * @param {object} options - [description] + * @param {Phaser.Scene} scene - A reference to the Scene to which this Pointer Constraint belongs. + * @param {Phaser.Physics.Matter.World} world - A reference to the Matter World instance to which this Constraint belongs. + * @param {object} [options] - A Constraint configuration object. */ var PointerConstraint = new Class({ @@ -53,7 +61,8 @@ var PointerConstraint = new Class({ }; /** - * [description] + * A reference to the Scene to which this Pointer Constraint belongs. + * This is the same Scene as the Matter World instance. * * @name Phaser.Physics.Matter.PointerConstraint#scene * @type {Phaser.Scene} @@ -62,7 +71,7 @@ var PointerConstraint = new Class({ this.scene = scene; /** - * [description] + * A reference to the Matter World instance to which this Constraint belongs. * * @name Phaser.Physics.Matter.PointerConstraint#world * @type {Phaser.Physics.Matter.World} @@ -71,27 +80,18 @@ var PointerConstraint = new Class({ this.world = world; /** - * [description] + * The Camera the Pointer was interacting with when the input + * down event was processed. * * @name Phaser.Physics.Matter.PointerConstraint#camera * @type {Phaser.Cameras.Scene2D.Camera} * @since 3.0.0 */ - var camera = GetFastValue(options, 'camera', null); - - if (!camera) - { - this.camera = scene.sys.cameras.main; - } - else - { - this.camera = camera; - - delete options.camera; - } + this.camera = null; /** - * [description] + * A reference to the Input Pointer that activated this Constraint. + * This is set in the `onDown` handler. * * @name Phaser.Physics.Matter.PointerConstraint#pointer * @type {Phaser.Input.Pointer} @@ -101,7 +101,10 @@ var PointerConstraint = new Class({ this.pointer = null; /** - * [description] + * Is this Constraint active or not? + * + * An active constraint will be processed each update. An inactive one will be skipped. + * Use this to toggle a Pointer Constraint on and off. * * @name Phaser.Physics.Matter.PointerConstraint#active * @type {boolean} @@ -111,7 +114,7 @@ var PointerConstraint = new Class({ this.active = true; /** - * The transformed position. + * The internal transformed position. * * @name Phaser.Physics.Matter.PointerConstraint#position * @type {Phaser.Math.Vector2} @@ -120,7 +123,25 @@ var PointerConstraint = new Class({ this.position = new Vector2(); /** - * [description] + * The body that is currently being dragged, if any. + * + * @name Phaser.Physics.Matter.PointerConstraint#body + * @type {?MatterJS.Body} + * @since 3.16.2 + */ + this.body = null; + + /** + * The part of the body that was clicked on to start the drag. + * + * @name Phaser.Physics.Matter.PointerConstraint#part + * @type {?MatterJS.Body} + * @since 3.16.2 + */ + this.part = null; + + /** + * The native Matter Constraint that is used to attach to bodies. * * @name Phaser.Physics.Matter.PointerConstraint#constraint * @type {object} @@ -128,49 +149,90 @@ var PointerConstraint = new Class({ */ this.constraint = Constraint.create(Merge(options, defaults)); - this.world.on('beforeupdate', this.update, this); + this.world.on(Events.BEFORE_UPDATE, this.update, this); - scene.sys.input.on('pointerdown', this.onDown, this); - - scene.sys.input.on('pointerup', this.onUp, this); + scene.sys.input.on(InputEvents.POINTER_DOWN, this.onDown, this); }, /** - * [description] + * A Pointer has been pressed down onto the Scene. + * + * If this Constraint doesn't have an active Pointer then a hit test is + * run against all active bodies in the world. If one is found it is bound + * to this constraint and the drag begins. * * @method Phaser.Physics.Matter.PointerConstraint#onDown + * @fires Phaser.Physics.Matter.Events#DRAG_START * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. */ onDown: function (pointer) { - this.pointer = pointer; + if (!this.pointer) + { + if (this.getBody(pointer)) + { + this.pointer = pointer; + + this.camera = pointer.camera; + } + } }, /** - * [description] + * Scans all active bodies in the current Matter World to see if any of them + * are hit by the Pointer. The _first one_ found to hit is set as the active contraint + * body. * - * @method Phaser.Physics.Matter.PointerConstraint#onUp - * @since 3.0.0 + * @method Phaser.Physics.Matter.PointerConstraint#getBody + * @since 3.16.2 + * + * @return {boolean} `true` if a body was found and set, otherwise `false`. */ - onUp: function () + getBody: function (pointer) { - this.pointer = null; + var pos = this.position; + var constraint = this.constraint; + + pointer.camera.getWorldPoint(pointer.x, pointer.y, pos); + + var bodies = Composite.allBodies(this.world.localWorld); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + if (!body.ignorePointer && + Bounds.contains(body.bounds, pos) && + Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) + { + if (this.hitTestBody(body, pos)) + { + this.world.emit(Events.DRAG_START, this.body, this.part, this); + + return true; + } + } + } + + return false; }, /** - * [description] + * Scans the current body to determine if a part of it was clicked on. + * If a part is found the body is set as the `constraint.bodyB` property, + * as well as the `body` property of this class. The part is also set. * - * @method Phaser.Physics.Matter.PointerConstraint#getBodyPart - * @since 3.0.0 + * @method Phaser.Physics.Matter.PointerConstraint#hitTestBody + * @since 3.16.2 * - * @param {MatterJS.Body} body - [description] - * @param {Phaser.Math.Vector2} position - [description] + * @param {MatterJS.Body} body - The Matter Body to check. + * @param {Phaser.Math.Vector2} position - A translated hit test position. * - * @return {boolean} [description] + * @return {boolean} `true` if a part of the body was hit, otherwise `false`. */ - getBodyPart: function (body, position) + hitTestBody: function (body, position) { var constraint = this.constraint; @@ -194,6 +256,9 @@ var PointerConstraint = new Class({ Sleeping.set(body, false); + this.part = part; + this.body = body; + return true; } } @@ -202,67 +267,73 @@ var PointerConstraint = new Class({ }, /** - * [description] + * Internal update handler. Called in the Matter BEFORE_UPDATE step. * * @method Phaser.Physics.Matter.PointerConstraint#update + * @fires Phaser.Physics.Matter.Events#DRAG * @since 3.0.0 */ update: function () { - if (!this.active) + var body = this.body; + var pointer = this.pointer; + + if (!this.active || !pointer || !body) { return; } - var pointer = this.pointer; - var constraint = this.constraint; - - if (!pointer) + if (pointer.isDown) { - // Pointer is up / released - if (constraint.bodyB) - { - constraint.bodyB = null; - } + var pos = this.position; + var constraint = this.constraint; + + this.camera.getWorldPoint(pointer.x, pointer.y, pos); + + Sleeping.set(body, false); + + constraint.pointA.x = pos.x; + constraint.pointA.y = pos.y; + + this.world.emit(Events.DRAG, body, this); } else { - var pos = this.position; - - this.camera.getWorldPoint(pointer.x, pointer.y, pos); - - if (constraint.bodyB) - { - // Pointer is down and we have bodyB, so wake it up - Sleeping.set(constraint.bodyB, false); - - constraint.pointA.x = pos.x; - constraint.pointA.y = pos.y; - } - else - { - var bodies = Composite.allBodies(this.world.localWorld); - - // Pointer is down and no bodyB, so check if we've hit anything - for (var i = 0; i < bodies.length; i++) - { - var body = bodies[i]; - - if (!body.ignorePointer && Bounds.contains(body.bounds, pos) && - Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) - { - if (this.getBodyPart(body, pos)) - { - break; - } - } - } - } + // Pointer has been released since the last world step + this.stopDrag(); } }, /** - * [description] + * Stops the Pointer Constraint from dragging the body any further. + * + * This is called automatically if the Pointer is released while actively + * dragging a body. Or, you can call it manually to release a body from a + * constraint without having to first release the pointer. + * + * @method Phaser.Physics.Matter.PointerConstraint#stopDrag + * @fires Phaser.Physics.Matter.Events#DRAG_END + * @since 3.16.2 + */ + stopDrag: function () + { + var body = this.body; + var constraint = this.constraint; + + if (body) + { + this.world.emit(Events.DRAG_END, body, this); + + this.pointer = null; + this.body = null; + this.part = null; + + constraint.bodyB = null; + } + }, + + /** + * Destroys this Pointer Constraint instance and all of its references. * * @method Phaser.Physics.Matter.PointerConstraint#destroy * @since 3.0.0 @@ -271,13 +342,14 @@ var PointerConstraint = new Class({ { this.world.removeConstraint(this.constraint); + this.pointer = null; this.constraint = null; + this.body = null; + this.part = null; - this.world.off('beforeupdate', this.update); + this.world.off(Events.BEFORE_UPDATE, this.update); - this.scene.sys.input.off('pointerdown', this.onDown, this); - - this.scene.sys.input.off('pointerup', this.onUp, this); + this.scene.sys.input.off(InputEvents.POINTER_DOWN, this.onDown, this); } }); diff --git a/src/physics/matter-js/World.js b/src/physics/matter-js/World.js index 0a8fda1e5..2ae5c2d43 100644 --- a/src/physics/matter-js/World.js +++ b/src/physics/matter-js/World.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,6 +10,7 @@ var Common = require('./lib/core/Common'); var Composite = require('./lib/body/Composite'); var Engine = require('./lib/core/Engine'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var GetFastValue = require('../../utils/object/GetFastValue'); var GetValue = require('../../utils/object/GetValue'); var MatterBody = require('./lib/body/Body'); @@ -96,8 +97,8 @@ var World = new Class({ { var x = GetFastValue(boundsConfig, 'x', 0); var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); var thickness = GetFastValue(boundsConfig, 'thickness', 64); var left = GetFastValue(boundsConfig, 'left', true); var right = GetFastValue(boundsConfig, 'right', true); @@ -238,12 +239,12 @@ var World = new Class({ MatterEvents.on(engine, 'beforeUpdate', function (event) { - _this.emit('beforeupdate', event); + _this.emit(Events.BEFORE_UPDATE, event); }); MatterEvents.on(engine, 'afterUpdate', function (event) { - _this.emit('afterupdate', event); + _this.emit(Events.AFTER_UPDATE, event); }); MatterEvents.on(engine, 'collisionStart', function (event) @@ -258,7 +259,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionstart', event, bodyA, bodyB); + _this.emit(Events.COLLISION_START, event, bodyA, bodyB); }); MatterEvents.on(engine, 'collisionActive', function (event) @@ -273,7 +274,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionactive', event, bodyA, bodyB); + _this.emit(Events.COLLISION_ACTIVE, event, bodyA, bodyB); }); MatterEvents.on(engine, 'collisionEnd', function (event) @@ -288,7 +289,7 @@ var World = new Class({ bodyB = pairs[0].bodyB; } - _this.emit('collisionend', event, bodyA, bodyB); + _this.emit(Events.COLLISION_END, event, bodyA, bodyB); }); }, @@ -319,16 +320,16 @@ var World = new Class({ { 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 (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } if (thickness === undefined) { thickness = 128; } if (left === undefined) { left = true; } if (right === undefined) { right = true; } if (top === undefined) { top = true; } if (bottom === undefined) { bottom = true; } - this.updateWall(left, 'left', x - thickness, y, thickness, height); - this.updateWall(right, 'right', x + width, y, thickness, height); + this.updateWall(left, 'left', x - thickness, y - thickness, thickness, height + (thickness * 2)); + this.updateWall(right, 'right', x + width, y - thickness, thickness, height + (thickness * 2)); this.updateWall(top, 'top', x, y - thickness, width, thickness); this.updateWall(bottom, 'bottom', x, y + height, width, thickness); @@ -498,7 +499,7 @@ var World = new Class({ { var body = (object.body) ? object.body : object; - Composite.removeBody(this.localWorld, body, deep); + Composite.remove(this.localWorld, body, deep); return this; }, @@ -537,7 +538,7 @@ var World = new Class({ convertTilemapLayer: function (tilemapLayer, options) { var layerData = tilemapLayer.layer; - var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, {isColliding: true}); + var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, { isColliding: true }); this.convertTiles(tiles, options); @@ -603,6 +604,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Matter.World#pause + * @fires Phaser.Physics.Matter.Events#PAUSE * @since 3.0.0 * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -611,7 +613,7 @@ var World = new Class({ { this.enabled = false; - this.emit('pause'); + this.emit(Events.PAUSE); return this; }, @@ -620,6 +622,7 @@ var World = new Class({ * [description] * * @method Phaser.Physics.Matter.World#resume + * @fires Phaser.Physics.Matter.Events#RESUME * @since 3.0.0 * * @return {Phaser.Physics.Matter.World} This Matter World object. @@ -628,7 +631,7 @@ var World = new Class({ { this.enabled = true; - this.emit('resume'); + this.emit(Events.RESUME); return this; }, diff --git a/src/physics/matter-js/components/Bounce.js b/src/physics/matter-js/components/Bounce.js index 634ca6514..a4f623ba7 100644 --- a/src/physics/matter-js/components/Bounce.js +++ b/src/physics/matter-js/components/Bounce.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * A component to set restitution on objects. * - * @name Phaser.Physics.Matter.Components.Bounce + * @namespace Phaser.Physics.Matter.Components.Bounce * @since 3.0.0 */ var Bounce = { diff --git a/src/physics/matter-js/components/Collision.js b/src/physics/matter-js/components/Collision.js index 1d43f0fb4..de36a37aa 100644 --- a/src/physics/matter-js/components/Collision.js +++ b/src/physics/matter-js/components/Collision.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly. * - * @name Phaser.Physics.Matter.Components.Collision + * @namespace Phaser.Physics.Matter.Components.Collision * @since 3.0.0 */ var Collision = { diff --git a/src/physics/matter-js/components/Force.js b/src/physics/matter-js/components/Force.js index 5f10d60a1..b10317709 100644 --- a/src/physics/matter-js/components/Force.js +++ b/src/physics/matter-js/components/Force.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,7 +9,7 @@ var Body = require('../lib/body/Body'); /** * A component to apply force to Matter.js bodies. * - * @name Phaser.Physics.Matter.Components.Force + * @namespace Phaser.Physics.Matter.Components.Force * @since 3.0.0 */ var Force = { diff --git a/src/physics/matter-js/components/Friction.js b/src/physics/matter-js/components/Friction.js index 1a778ed67..7bc5f3621 100644 --- a/src/physics/matter-js/components/Friction.js +++ b/src/physics/matter-js/components/Friction.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly. * - * @name Phaser.Physics.Matter.Components.Friction + * @namespace Phaser.Physics.Matter.Components.Friction * @since 3.0.0 */ var Friction = { diff --git a/src/physics/matter-js/components/Gravity.js b/src/physics/matter-js/components/Gravity.js index f1bcc6b4a..1b64a6103 100644 --- a/src/physics/matter-js/components/Gravity.js +++ b/src/physics/matter-js/components/Gravity.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * A component to manipulate world gravity for Matter.js bodies. * - * @name Phaser.Physics.Matter.Components.Gravity + * @namespace Phaser.Physics.Matter.Components.Gravity * @since 3.0.0 */ var Gravity = { diff --git a/src/physics/matter-js/components/Mass.js b/src/physics/matter-js/components/Mass.js index f6d461864..59f2948a7 100644 --- a/src/physics/matter-js/components/Mass.js +++ b/src/physics/matter-js/components/Mass.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,7 +10,7 @@ var Vector2 = require('../../../math/Vector2'); /** * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly. * - * @name Phaser.Physics.Matter.Components.Mass + * @namespace Phaser.Physics.Matter.Components.Mass * @since 3.0.0 */ var Mass = { @@ -53,6 +53,7 @@ var Mass = { * The body's center of mass. * * @name Phaser.Physics.Matter.Components.Mass#centerOfMass + * @type {Phaser.Math.Vector2} * @readonly * @since 3.10.0 * diff --git a/src/physics/matter-js/components/Sensor.js b/src/physics/matter-js/components/Sensor.js index 263afb70d..4f37a0c9f 100644 --- a/src/physics/matter-js/components/Sensor.js +++ b/src/physics/matter-js/components/Sensor.js @@ -1,13 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * - * @name Phaser.Physics.Matter.Components.Sensor + * @namespace Phaser.Physics.Matter.Components.Sensor * @since 3.0.0 */ var Sensor = { diff --git a/src/physics/matter-js/components/SetBody.js b/src/physics/matter-js/components/SetBody.js index c9ff710ba..877cbd2ff 100644 --- a/src/physics/matter-js/components/SetBody.js +++ b/src/physics/matter-js/components/SetBody.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,7 +13,7 @@ var Vertices = require('../lib/geometry/Vertices'); /** * [description] * - * @name Phaser.Physics.Matter.Components.SetBody + * @namespace Phaser.Physics.Matter.Components.SetBody * @since 3.0.0 */ var SetBody = { diff --git a/src/physics/matter-js/components/Sleep.js b/src/physics/matter-js/components/Sleep.js index 97e7ccab7..1308491dc 100644 --- a/src/physics/matter-js/components/Sleep.js +++ b/src/physics/matter-js/components/Sleep.js @@ -1,15 +1,16 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Events = require('../events'); var MatterEvents = require('../lib/core/Events'); /** * [description] * - * @name Phaser.Physics.Matter.Components.Sleep + * @namespace Phaser.Physics.Matter.Components.Sleep * @since 3.0.0 */ var Sleep = { @@ -70,7 +71,7 @@ var Sleep = { MatterEvents.on(this.body, 'sleepStart', function (event) { - world.emit('sleepstart', event, this); + world.emit(Events.SLEEP_START, event, this); }); } else @@ -99,7 +100,7 @@ var Sleep = { MatterEvents.on(this.body, 'sleepEnd', function (event) { - world.emit('sleepend', event, this); + world.emit(Events.SLEEP_END, event, this); }); } else diff --git a/src/physics/matter-js/components/Static.js b/src/physics/matter-js/components/Static.js index 25658946c..ba646f96e 100644 --- a/src/physics/matter-js/components/Static.js +++ b/src/physics/matter-js/components/Static.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,7 +9,7 @@ var Body = require('../lib/body/Body'); /** * [description] * - * @name Phaser.Physics.Matter.Components.Static + * @namespace Phaser.Physics.Matter.Components.Static * @since 3.0.0 */ var Static = { diff --git a/src/physics/matter-js/components/Transform.js b/src/physics/matter-js/components/Transform.js index c87159e8a..5546abf0e 100644 --- a/src/physics/matter-js/components/Transform.js +++ b/src/physics/matter-js/components/Transform.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -17,7 +17,7 @@ var _FLAG = 4; // 0100 /** * Provides methods used for getting and setting the position, scale and rotation of a Game Object. * - * @name Phaser.Physics.Matter.Components.Transform + * @namespace Phaser.Physics.Matter.Components.Transform * @since 3.0.0 */ var Transform = { diff --git a/src/physics/matter-js/components/Velocity.js b/src/physics/matter-js/components/Velocity.js index 1072ed9c5..569208420 100644 --- a/src/physics/matter-js/components/Velocity.js +++ b/src/physics/matter-js/components/Velocity.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,7 +9,7 @@ var Body = require('../lib/body/Body'); /** * [description] * - * @name Phaser.Physics.Matter.Components.Velocity + * @namespace Phaser.Physics.Matter.Components.Velocity * @since 3.0.0 */ var Velocity = { diff --git a/src/physics/matter-js/components/index.js b/src/physics/matter-js/components/index.js index 3c3fad770..0819aad20 100644 --- a/src/physics/matter-js/components/index.js +++ b/src/physics/matter-js/components/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/physics/matter-js/events/AFTER_UPDATE_EVENT.js b/src/physics/matter-js/events/AFTER_UPDATE_EVENT.js new file mode 100644 index 000000000..7660c2892 --- /dev/null +++ b/src/physics/matter-js/events/AFTER_UPDATE_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.AfterUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics After Update Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved. + * + * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#AFTER_UPDATE + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.AfterUpdateEvent} event - The Update Event object. + */ +module.exports = 'afterupdate'; diff --git a/src/physics/matter-js/events/BEFORE_UPDATE_EVENT.js b/src/physics/matter-js/events/BEFORE_UPDATE_EVENT.js new file mode 100644 index 000000000..df79f3707 --- /dev/null +++ b/src/physics/matter-js/events/BEFORE_UPDATE_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.BeforeUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Before Update Event. + * + * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place. + * + * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#BEFORE_UPDATE + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.BeforeUpdateEvent} event - The Update Event object. + */ +module.exports = 'beforeupdate'; diff --git a/src/physics/matter-js/events/COLLISION_ACTIVE_EVENT.js b/src/physics/matter-js/events/COLLISION_ACTIVE_EVENT.js new file mode 100644 index 000000000..82a3536c0 --- /dev/null +++ b/src/physics/matter-js/events/COLLISION_ACTIVE_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionActiveEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Active Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that are colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_ACTIVE + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.CollisionActiveEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionactive'; diff --git a/src/physics/matter-js/events/COLLISION_END_EVENT.js b/src/physics/matter-js/events/COLLISION_END_EVENT.js new file mode 100644 index 000000000..54accd8f5 --- /dev/null +++ b/src/physics/matter-js/events/COLLISION_END_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionEndEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision End Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have finished colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_END + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.CollisionEndEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionend'; diff --git a/src/physics/matter-js/events/COLLISION_START_EVENT.js b/src/physics/matter-js/events/COLLISION_START_EVENT.js new file mode 100644 index 000000000..2a2fde292 --- /dev/null +++ b/src/physics/matter-js/events/COLLISION_START_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionStartEvent + * + * @property {array} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Start Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have started to collide in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_START + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.CollisionStartEvent} event - The Collision Event object. + * @param {MatterJS.Body} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.Body} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionstart'; diff --git a/src/physics/matter-js/events/DRAG_END_EVENT.js b/src/physics/matter-js/events/DRAG_END_EVENT.js new file mode 100644 index 000000000..899fc0a19 --- /dev/null +++ b/src/physics/matter-js/events/DRAG_END_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag End Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * stops dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_END + * @since 3.16.2 + * + * @param {MatterJS.Body} body - The Body that has stopped being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that was dragging the body. + */ +module.exports = 'dragend'; diff --git a/src/physics/matter-js/events/DRAG_EVENT.js b/src/physics/matter-js/events/DRAG_EVENT.js new file mode 100644 index 000000000..e20da98e5 --- /dev/null +++ b/src/physics/matter-js/events/DRAG_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * is actively dragging a body. It is emitted each time the pointer moves. + * + * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG + * @since 3.16.2 + * + * @param {MatterJS.Body} body - The Body that is being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'drag'; diff --git a/src/physics/matter-js/events/DRAG_START_EVENT.js b/src/physics/matter-js/events/DRAG_START_EVENT.js new file mode 100644 index 000000000..f6daa9f9d --- /dev/null +++ b/src/physics/matter-js/events/DRAG_START_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics Drag Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * starts dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_START + * @since 3.16.2 + * + * @param {MatterJS.Body} body - The Body that has started being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {MatterJS.Body} part - The part of the body that was clicked on. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'dragstart'; diff --git a/src/physics/matter-js/events/PAUSE_EVENT.js b/src/physics/matter-js/events/PAUSE_EVENT.js new file mode 100644 index 000000000..a97b6f510 --- /dev/null +++ b/src/physics/matter-js/events/PAUSE_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics World Pause Event. + * + * This event is dispatched by an Matter Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`. + * + * @event Phaser.Physics.Matter.Events#PAUSE + * @since 3.0.0 + */ +module.exports = 'pause'; diff --git a/src/physics/matter-js/events/RESUME_EVENT.js b/src/physics/matter-js/events/RESUME_EVENT.js new file mode 100644 index 000000000..4040c9334 --- /dev/null +++ b/src/physics/matter-js/events/RESUME_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Matter Physics World Resume Event. + * + * This event is dispatched by an Matter Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`. + * + * @event Phaser.Physics.Matter.Events#RESUME + * @since 3.0.0 + */ +module.exports = 'resume'; diff --git a/src/physics/matter-js/events/SLEEP_END_EVENT.js b/src/physics/matter-js/events/SLEEP_END_EVENT.js new file mode 100644 index 000000000..538d99ad5 --- /dev/null +++ b/src/physics/matter-js/events/SLEEP_END_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepEndEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep End Event. + * + * This event is dispatched by a Matter Physics World instance when a Body stop sleeping. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_END + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.SleepEndEvent} event - The Sleep Event object. + * @param {MatterJS.Body} body - The body that has stopped sleeping. + */ +module.exports = 'sleepend'; diff --git a/src/physics/matter-js/events/SLEEP_START_EVENT.js b/src/physics/matter-js/events/SLEEP_START_EVENT.js new file mode 100644 index 000000000..ea93813c8 --- /dev/null +++ b/src/physics/matter-js/events/SLEEP_START_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepStartEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Body goes to sleep. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_START + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.SleepStartEvent} event - The Sleep Event object. + * @param {MatterJS.Body} body - The body that has gone to sleep. + */ +module.exports = 'sleepstart'; diff --git a/src/physics/matter-js/events/index.js b/src/physics/matter-js/events/index.js new file mode 100644 index 000000000..3b47765e6 --- /dev/null +++ b/src/physics/matter-js/events/index.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Events + */ + +module.exports = { + + AFTER_UPDATE: require('./AFTER_UPDATE_EVENT'), + BEFORE_UPDATE: require('./BEFORE_UPDATE_EVENT'), + COLLISION_ACTIVE: require('./COLLISION_ACTIVE_EVENT'), + COLLISION_END: require('./COLLISION_END_EVENT'), + COLLISION_START: require('./COLLISION_START_EVENT'), + DRAG_END: require('./DRAG_END_EVENT'), + DRAG: require('./DRAG_EVENT'), + DRAG_START: require('./DRAG_START_EVENT'), + PAUSE: require('./PAUSE_EVENT'), + RESUME: require('./RESUME_EVENT'), + SLEEP_END: require('./SLEEP_END_EVENT'), + SLEEP_START: require('./SLEEP_START_EVENT') + +}; diff --git a/src/physics/matter-js/index.js b/src/physics/matter-js/index.js index 19aeb7949..317e60b05 100644 --- a/src/physics/matter-js/index.js +++ b/src/physics/matter-js/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -32,6 +32,7 @@ module.exports = { * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. * * @class MatterJS.Body + * @since 3.0.0 */ /** @@ -42,6 +43,7 @@ module.exports = { * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. * * @class MatterJS.Composite + * @since 3.0.0 */ /** @@ -54,6 +56,7 @@ module.exports = { * * @class MatterJS.World * @extends MatterJS.Composite + * @since 3.0.0 */ /** @@ -63,6 +66,7 @@ module.exports = { * The stiffness of constraints can be modified to create springs or elastic. * * @class MatterJS.Constraint + * @since 3.0.0 */ /** @@ -71,13 +75,15 @@ module.exports = { * An engine is a controller that manages updating the simulation of the world. * * @class MatterJS.Engine + * @since 3.0.0 */ /** * @classdesc -* The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. -* A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. -* A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). -* -* @class MatterJS.Vertices -*/ + * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. + * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. + * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). + * + * @class MatterJS.Vertices + * @since 3.0.0 + */ diff --git a/src/physics/matter-js/typedefs/MatterBodyTileOptions.js b/src/physics/matter-js/typedefs/MatterBodyTileOptions.js new file mode 100644 index 000000000..4de7d1e6a --- /dev/null +++ b/src/physics/matter-js/typedefs/MatterBodyTileOptions.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Physics.Matter.Types.MatterBodyTileOptions + * @since 3.0.0 + * + * @property {boolean} [isStatic=true] - Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved. + * @property {boolean} [addToWorld=true] - Whether or not to add the newly created body (or existing body if options.body is used) to the Matter world. + */ diff --git a/src/physics/matter-js/typedefs/MatterTileOptions.js b/src/physics/matter-js/typedefs/MatterTileOptions.js new file mode 100644 index 000000000..8fa3ffe50 --- /dev/null +++ b/src/physics/matter-js/typedefs/MatterTileOptions.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Physics.Matter.Types.MatterTileOptions + * @since 3.0.0 + * + * @property {MatterJS.Body} [body=null] - An existing Matter body to be used instead of creating a new one. + * @property {boolean} [isStatic=true] - Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved. + * @property {boolean} [addToWorld=true] - Whether or not to add the newly created body (or existing body if options.body is used) to the Matter world. + */ diff --git a/src/physics/matter-js/typedefs/index.js b/src/physics/matter-js/typedefs/index.js new file mode 100644 index 000000000..e6d35ba73 --- /dev/null +++ b/src/physics/matter-js/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Types + */ diff --git a/src/plugins/BasePlugin.js b/src/plugins/BasePlugin.js index 895f86092..af8ded53c 100644 --- a/src/plugins/BasePlugin.js +++ b/src/plugins/BasePlugin.js @@ -1,6 +1,6 @@ /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ diff --git a/src/plugins/DefaultPlugins.js b/src/plugins/DefaultPlugins.js index 01ed3904f..001b62a38 100644 --- a/src/plugins/DefaultPlugins.js +++ b/src/plugins/DefaultPlugins.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/plugins/PluginCache.js b/src/plugins/PluginCache.js index 674a51e92..eb5bc4a6b 100644 --- a/src/plugins/PluginCache.js +++ b/src/plugins/PluginCache.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,24 +12,12 @@ var corePlugins = {}; // These are the source objects, not instantiated. var customPlugins = {}; -/** - * @typedef {object} CorePluginContainer - * - * @property {string} key - The unique name of this plugin in the core plugin cache. - * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated. - * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @property {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? - */ - -/** - * @typedef {object} CustomPluginContainer - * - * @property {string} key - The unique name of this plugin in the custom plugin cache. - * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated. - */ - var PluginCache = {}; +/** + * @namespace Phaser.Plugins.PluginCache + */ + /** * Static method called directly by the Core internal Plugins. * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) @@ -106,7 +94,7 @@ PluginCache.hasCustom = function (key) * * @param {string} key - The key of the core plugin to get. * - * @return {CorePluginContainer} The core plugin object. + * @return {Phaser.Plugins.Types.CorePluginContainer} The core plugin object. */ PluginCache.getCore = function (key) { @@ -121,7 +109,7 @@ PluginCache.getCore = function (key) * * @param {string} key - The key of the custom plugin to get. * - * @return {CustomPluginContainer} The custom plugin object. + * @return {Phaser.Plugins.Types.CustomPluginContainer} The custom plugin object. */ PluginCache.getCustom = function (key) { diff --git a/src/plugins/PluginManager.js b/src/plugins/PluginManager.js index c6d1dfb20..96519016e 100644 --- a/src/plugins/PluginManager.js +++ b/src/plugins/PluginManager.js @@ -1,10 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); +var GameEvents = require('../core/events'); var EventEmitter = require('eventemitter3'); var FileTypesManager = require('../loader/FileTypesManager'); var GameObjectCreator = require('../gameobjects/GameObjectCreator'); @@ -13,15 +14,6 @@ var GetFastValue = require('../utils/object/GetFastValue'); var PluginCache = require('./PluginCache'); var Remove = require('../utils/array/Remove'); -/** - * @typedef {object} GlobalPlugin - * - * @property {string} key - The unique name of this plugin within the plugin cache. - * @property {function} plugin - An instance of the plugin. - * @property {boolean} [active] - Is the plugin active or not? - * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. - */ - /** * @classdesc * The PluginManager is responsible for installing and adding plugins to Phaser. @@ -33,8 +25,8 @@ var Remove = require('../utils/array/Remove'); * * There are two types of plugin: * - * 1) A Global Plugin - * 2) A Scene Plugin + * 1. A Global Plugin + * 2. A Scene Plugin * * A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get * access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in @@ -48,9 +40,9 @@ var Remove = require('../utils/array/Remove'); * * You can add a plugin to Phaser in three different ways: * - * 1) Preload it - * 2) Include it in your source code and install it via the Game Config - * 3) Include it in your source code and install it within a Scene + * 1. Preload it + * 2. Include it in your source code and install it via the Game Config + * 3. Include it in your source code and install it within a Scene * * For examples of all of these approaches please see the Phaser 3 Examples Repo `plugins` folder. * @@ -87,7 +79,7 @@ var PluginManager = new Class({ * A plugin must have been started at least once in order to appear in this list. * * @name Phaser.Plugins.PluginManager#plugins - * @type {GlobalPlugin[]} + * @type {Phaser.Plugins.Types.GlobalPlugin[]} * @since 3.8.0 */ this.plugins = []; @@ -127,7 +119,7 @@ var PluginManager = new Class({ } else { - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); } }, @@ -198,7 +190,7 @@ var PluginManager = new Class({ this._pendingGlobal = []; this._pendingScene = []; - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -230,7 +222,7 @@ var PluginManager = new Class({ for (i = 0; i < globalPlugins.length; i++) { pluginKey = globalPlugins[i]; - + if (game[pluginKey]) { sys[pluginKey] = game[pluginKey]; @@ -290,7 +282,7 @@ var PluginManager = new Class({ for (i = 0; i < pluginList.length; i++) { var entry = pluginList[i]; - + if (entry.mapping) { scene[entry.mapping] = entry.plugin; @@ -344,25 +336,32 @@ var PluginManager = new Class({ * @param {function} plugin - The plugin code. This should be the non-instantiated version. * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. * @param {Phaser.Scene} [addToScene] - Optionally automatically add this plugin to the given Scene. + * @param {boolean} [fromLoader=false] - Is this being called by the Loader? */ - installScenePlugin: function (key, plugin, mapping, addToScene) + installScenePlugin: function (key, plugin, mapping, addToScene, fromLoader) { + if (fromLoader === undefined) { fromLoader = false; } + if (typeof plugin !== 'function') { console.warn('Invalid Scene Plugin: ' + key); return; } - if (PluginCache.hasCore(key)) + if (!PluginCache.hasCore(key)) { + // Plugin is freshly loaded + PluginCache.register(key, plugin, mapping, true); + + this.scenePlugins.push(key); + } + else if (!fromLoader && PluginCache.hasCore(key)) + { + // Plugin wasn't from the loader but already exists console.warn('Scene Plugin key in use: ' + key); return; } - PluginCache.register(key, plugin, mapping, true); - - this.scenePlugins.push(key); - if (addToScene) { var instance = new plugin(addToScene, this); @@ -487,7 +486,7 @@ var PluginManager = new Class({ * * @param {string} key - The unique plugin key. * - * @return {GlobalPlugin} The plugin entry. + * @return {Phaser.Plugins.Types.GlobalPlugin} The plugin entry. */ getEntry: function (key) { diff --git a/src/plugins/ScenePlugin.js b/src/plugins/ScenePlugin.js index 884d79686..afd3ffaef 100644 --- a/src/plugins/ScenePlugin.js +++ b/src/plugins/ScenePlugin.js @@ -1,11 +1,12 @@ /** * @author Richard Davey -* @copyright 2018 Photon Storm Ltd. +* @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ var BasePlugin = require('./BasePlugin'); var Class = require('../utils/Class'); +var SceneEvents = require('../scene/events'); /** * @classdesc @@ -35,7 +36,7 @@ var ScenePlugin = new Class({ this.scene = scene; this.systems = scene.sys; - scene.sys.events.once('boot', this.boot, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); }, /** diff --git a/src/plugins/index.js b/src/plugins/index.js index 55fd52178..eed00277d 100644 --- a/src/plugins/index.js +++ b/src/plugins/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/plugins/typedefs/CorePluginContainer.js b/src/plugins/typedefs/CorePluginContainer.js new file mode 100644 index 000000000..dbec4d67b --- /dev/null +++ b/src/plugins/typedefs/CorePluginContainer.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Plugins.Types.CorePluginContainer + * @since 3.8.0 + * + * @property {string} key - The unique name of this plugin in the core plugin cache. + * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated. + * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @property {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? + */ diff --git a/src/plugins/typedefs/CustomPluginContainer.js b/src/plugins/typedefs/CustomPluginContainer.js new file mode 100644 index 000000000..b57f30a13 --- /dev/null +++ b/src/plugins/typedefs/CustomPluginContainer.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Plugins.Types.CustomPluginContainer + * @since 3.8.0 + * + * @property {string} key - The unique name of this plugin in the custom plugin cache. + * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated. + */ diff --git a/src/plugins/typedefs/GlobalPlugin.js b/src/plugins/typedefs/GlobalPlugin.js new file mode 100644 index 000000000..39c48cff3 --- /dev/null +++ b/src/plugins/typedefs/GlobalPlugin.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Plugins.Types.GlobalPlugin + * @since 3.0.0 + * + * @property {string} key - The unique name of this plugin within the plugin cache. + * @property {function} plugin - An instance of the plugin. + * @property {boolean} [active] - Is the plugin active or not? + * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used. + */ diff --git a/src/plugins/typedefs/index.js b/src/plugins/typedefs/index.js new file mode 100644 index 000000000..89050c320 --- /dev/null +++ b/src/plugins/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Plugins.Types + */ diff --git a/src/renderer/BlendModes.js b/src/renderer/BlendModes.js index 761b69e2a..7f5d18b58 100644 --- a/src/renderer/BlendModes.js +++ b/src/renderer/BlendModes.js @@ -1,16 +1,14 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Phaser Blend Modes. * - * @name Phaser.BlendModes - * @enum {integer} + * @namespace Phaser.BlendModes * @memberof Phaser - * @readonly * @since 3.0.0 */ @@ -20,6 +18,9 @@ module.exports = { * Skips the Blend Mode check in the renderer. * * @name Phaser.BlendModes.SKIP_CHECK + * @type {integer} + * @const + * @since 3.0.0 */ SKIP_CHECK: -1, @@ -28,6 +29,9 @@ module.exports = { * This is the default setting and draws new shapes on top of the existing canvas content. * * @name Phaser.BlendModes.NORMAL + * @type {integer} + * @const + * @since 3.0.0 */ NORMAL: 0, @@ -36,6 +40,9 @@ module.exports = { * Where both shapes overlap the color is determined by adding color values. * * @name Phaser.BlendModes.ADD + * @type {integer} + * @const + * @since 3.0.0 */ ADD: 1, @@ -44,6 +51,9 @@ module.exports = { * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. * * @name Phaser.BlendModes.MULTIPLY + * @type {integer} + * @const + * @since 3.0.0 */ MULTIPLY: 2, @@ -52,6 +62,9 @@ module.exports = { * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) * * @name Phaser.BlendModes.SCREEN + * @type {integer} + * @const + * @since 3.0.0 */ SCREEN: 3, @@ -60,6 +73,9 @@ module.exports = { * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. * * @name Phaser.BlendModes.OVERLAY + * @type {integer} + * @const + * @since 3.0.0 */ OVERLAY: 4, @@ -68,6 +84,9 @@ module.exports = { * Retains the darkest pixels of both layers. * * @name Phaser.BlendModes.DARKEN + * @type {integer} + * @const + * @since 3.0.0 */ DARKEN: 5, @@ -76,6 +95,9 @@ module.exports = { * Retains the lightest pixels of both layers. * * @name Phaser.BlendModes.LIGHTEN + * @type {integer} + * @const + * @since 3.0.0 */ LIGHTEN: 6, @@ -84,6 +106,9 @@ module.exports = { * Divides the bottom layer by the inverted top layer. * * @name Phaser.BlendModes.COLOR_DODGE + * @type {integer} + * @const + * @since 3.0.0 */ COLOR_DODGE: 7, @@ -92,6 +117,9 @@ module.exports = { * Divides the inverted bottom layer by the top layer, and then inverts the result. * * @name Phaser.BlendModes.COLOR_BURN + * @type {integer} + * @const + * @since 3.0.0 */ COLOR_BURN: 8, @@ -100,6 +128,9 @@ module.exports = { * A combination of multiply and screen like overlay, but with top and bottom layer swapped. * * @name Phaser.BlendModes.HARD_LIGHT + * @type {integer} + * @const + * @since 3.0.0 */ HARD_LIGHT: 9, @@ -108,6 +139,9 @@ module.exports = { * A softer version of hard-light. Pure black or white does not result in pure black or white. * * @name Phaser.BlendModes.SOFT_LIGHT + * @type {integer} + * @const + * @since 3.0.0 */ SOFT_LIGHT: 10, @@ -116,6 +150,9 @@ module.exports = { * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. * * @name Phaser.BlendModes.DIFFERENCE + * @type {integer} + * @const + * @since 3.0.0 */ DIFFERENCE: 11, @@ -124,6 +161,9 @@ module.exports = { * Like difference, but with lower contrast. * * @name Phaser.BlendModes.EXCLUSION + * @type {integer} + * @const + * @since 3.0.0 */ EXCLUSION: 12, @@ -132,6 +172,9 @@ module.exports = { * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. * * @name Phaser.BlendModes.HUE + * @type {integer} + * @const + * @since 3.0.0 */ HUE: 13, @@ -140,6 +183,9 @@ module.exports = { * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. * * @name Phaser.BlendModes.SATURATION + * @type {integer} + * @const + * @since 3.0.0 */ SATURATION: 14, @@ -148,6 +194,9 @@ module.exports = { * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. * * @name Phaser.BlendModes.COLOR + * @type {integer} + * @const + * @since 3.0.0 */ COLOR: 15, @@ -156,6 +205,9 @@ module.exports = { * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. * * @name Phaser.BlendModes.LUMINOSITY + * @type {integer} + * @const + * @since 3.0.0 */ LUMINOSITY: 16, @@ -163,6 +215,9 @@ module.exports = { * Alpha erase blend mode. For Canvas and WebGL. * * @name Phaser.BlendModes.ERASE + * @type {integer} + * @const + * @since 3.0.0 */ ERASE: 17, @@ -171,6 +226,9 @@ module.exports = { * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. * * @name Phaser.BlendModes.SOURCE_IN + * @type {integer} + * @const + * @since 3.0.0 */ SOURCE_IN: 18, @@ -179,6 +237,9 @@ module.exports = { * The new shape is drawn where it doesn't overlap the existing canvas content. * * @name Phaser.BlendModes.SOURCE_OUT + * @type {integer} + * @const + * @since 3.0.0 */ SOURCE_OUT: 19, @@ -187,6 +248,9 @@ module.exports = { * The new shape is only drawn where it overlaps the existing canvas content. * * @name Phaser.BlendModes.SOURCE_ATOP + * @type {integer} + * @const + * @since 3.0.0 */ SOURCE_ATOP: 20, @@ -195,6 +259,9 @@ module.exports = { * New shapes are drawn behind the existing canvas content. * * @name Phaser.BlendModes.DESTINATION_OVER + * @type {integer} + * @const + * @since 3.0.0 */ DESTINATION_OVER: 21, @@ -203,6 +270,9 @@ module.exports = { * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. * * @name Phaser.BlendModes.DESTINATION_IN + * @type {integer} + * @const + * @since 3.0.0 */ DESTINATION_IN: 22, @@ -211,6 +281,9 @@ module.exports = { * The existing content is kept where it doesn't overlap the new shape. * * @name Phaser.BlendModes.DESTINATION_OUT + * @type {integer} + * @const + * @since 3.0.0 */ DESTINATION_OUT: 23, @@ -219,6 +292,9 @@ module.exports = { * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. * * @name Phaser.BlendModes.DESTINATION_ATOP + * @type {integer} + * @const + * @since 3.0.0 */ DESTINATION_ATOP: 24, @@ -227,6 +303,9 @@ module.exports = { * Where both shapes overlap the color is determined by adding color values. * * @name Phaser.BlendModes.LIGHTER + * @type {integer} + * @const + * @since 3.0.0 */ LIGHTER: 25, @@ -235,14 +314,20 @@ module.exports = { * Only the new shape is shown. * * @name Phaser.BlendModes.COPY + * @type {integer} + * @const + * @since 3.0.0 */ COPY: 26, /** - * xor blend mode. For Canvas only. + * Xor blend mode. For Canvas only. * Shapes are made transparent where both overlap and drawn normal everywhere else. * * @name Phaser.BlendModes.XOR + * @type {integer} + * @const + * @since 3.0.0 */ XOR: 27 diff --git a/src/renderer/ScaleModes.js b/src/renderer/ScaleModes.js index 4b9dbf51f..d84dd66b4 100644 --- a/src/renderer/ScaleModes.js +++ b/src/renderer/ScaleModes.js @@ -1,16 +1,14 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Phaser Scale Modes. * - * @name Phaser.ScaleModes - * @enum {integer} + * @namespace Phaser.ScaleModes * @memberof Phaser - * @readonly * @since 3.0.0 */ @@ -20,6 +18,9 @@ module.exports = { * Default Scale Mode (Linear). * * @name Phaser.ScaleModes.DEFAULT + * @type {integer} + * @const + * @since 3.0.0 */ DEFAULT: 0, @@ -27,6 +28,9 @@ module.exports = { * Linear Scale Mode. * * @name Phaser.ScaleModes.LINEAR + * @type {integer} + * @const + * @since 3.0.0 */ LINEAR: 0, @@ -34,6 +38,9 @@ module.exports = { * Nearest Scale Mode. * * @name Phaser.ScaleModes.NEAREST + * @type {integer} + * @const + * @since 3.0.0 */ NEAREST: 1 diff --git a/src/renderer/canvas/CanvasRenderer.js b/src/renderer/canvas/CanvasRenderer.js index 881280abc..a88cd33e1 100644 --- a/src/renderer/canvas/CanvasRenderer.js +++ b/src/renderer/canvas/CanvasRenderer.js @@ -1,11 +1,12 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var CanvasSnapshot = require('../snapshot/CanvasSnapshot'); +var CameraEvents = require('../../cameras/2d/events'); var Class = require('../../utils/Class'); var CONST = require('../../const'); var GetBlendModes = require('./utils/GetBlendModes'); @@ -62,32 +63,31 @@ var CanvasRenderer = new Class({ * The width of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {number} + * @type {integer} * @since 3.0.0 */ - this.width = game.config.width; + this.width = 0; /** * The height of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {number} + * @type {integer} * @since 3.0.0 */ - this.height = game.config.height; + this.height = 0; /** * The local configuration settings of the CanvasRenderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {RendererConfig} + * @type {object} * @since 3.0.0 */ this.config = { clearBeforeRender: game.config.clearBeforeRender, backgroundColor: game.config.backgroundColor, resolution: game.config.resolution, - autoResize: game.config.autoResize, antialias: game.config.antialias, roundPixels: game.config.roundPixels }; @@ -153,34 +153,24 @@ var CanvasRenderer = new Class({ this.currentScaleMode = 0; /** - * If a snapshot is scheduled, the function to call after it is taken. + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback - * @type {?SnapshotCallback} - * @default null - * @since 3.0.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState + * @type {Phaser.Renderer.Snapshot.Types.SnapshotState} + * @since 3.16.0 */ - this.snapshotCallback = null; - - /** - * The type of the image to create when taking the snapshot, usually `image/png`. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType - * @type {?string} - * @default null - * @since 3.0.0 - */ - this.snapshotType = null; - - /** - * The image quality of the snapshot which will be taken, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder - * @type {?number} - * @default null - * @since 3.0.0 - */ - this.snapshotEncoder = null; + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92 + }; /** * A temporary Transform Matrix, re-used internally during batching. @@ -233,7 +223,31 @@ var CanvasRenderer = new Class({ */ init: function () { - this.resize(this.width, this.height); + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height); + }, + + /** + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height) + { + this.resize(baseSize.width, baseSize.height); + } }, /** @@ -242,30 +256,14 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#resize * @since 3.0.0 * - * @param {integer} width - The new width of the canvas. - * @param {integer} height - The new height of the canvas. + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. */ resize: function (width, height) { this.width = width; this.height = height; - /* - var resolution = this.config.resolution; - - this.width = width * resolution; - this.height = height * resolution; - - this.gameCanvas.width = this.width; - this.gameCanvas.height = this.height; - - if (this.config.autoResize) - { - this.gameCanvas.style.width = (this.width / resolution) + 'px'; - this.gameCanvas.style.height = (this.height / resolution) + 'px'; - } - */ - // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) if (this.scaleMode === ScaleModes.NEAREST) { @@ -442,7 +440,7 @@ var CanvasRenderer = new Class({ if (camera.renderToTexture) { - camera.emit('prerender', camera); + camera.emit(CameraEvents.PRE_RENDER, camera); } camera.matrix.copyToContext(ctx); @@ -483,7 +481,7 @@ var CanvasRenderer = new Class({ if (camera.renderToTexture) { - camera.emit('postrender', camera); + camera.emit(CameraEvents.POST_RENDER, camera); scene.sys.context.drawImage(camera.canvas, cx, cy); } @@ -503,28 +501,109 @@ var CanvasRenderer = new Class({ ctx.restore(); - if (this.snapshotCallback) + var state = this.snapshotState; + + if (state.callback) { - this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); - this.snapshotCallback = null; + CanvasSnapshot(this.gameCanvas, state); + + state.callback = null; } }, /** - * Schedules a snapshot to be taken after the current frame is rendered. + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot * @since 3.0.0 * - * @param {SnapshotCallback} callback - Function to invoke after the snapshot is created. - * @param {string} type - The format of the image to create, usually `image/png`. - * @param {number} encoderOptions - The image quality, between 0 and 1, to use for image formats with lossy compression (such as `image/jpeg`). + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. */ snapshot: function (callback, type, encoderOptions) { - this.snapshotCallback = callback; - this.snapshotType = type; - this.snapshotEncoder = encoderOptions; + return this.snapshotArea(0, 0, this.gameCanvas.width, this.gameCanvas.height, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gameCanvas.width); + state.height = Math.min(height, this.gameCanvas.height); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; + + return this; }, /** diff --git a/src/renderer/canvas/index.js b/src/renderer/canvas/index.js index c46df1248..6d7d25ad1 100644 --- a/src/renderer/canvas/index.js +++ b/src/renderer/canvas/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/renderer/canvas/utils/GetBlendModes.js b/src/renderer/canvas/utils/GetBlendModes.js index b3b1e1eed..1e731fc31 100644 --- a/src/renderer/canvas/utils/GetBlendModes.js +++ b/src/renderer/canvas/utils/GetBlendModes.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/renderer/canvas/utils/SetTransform.js b/src/renderer/canvas/utils/SetTransform.js index c802fb09f..c0160e5de 100644 --- a/src/renderer/canvas/utils/SetTransform.js +++ b/src/renderer/canvas/utils/SetTransform.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,12 +8,12 @@ * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix * and then performs the following steps: * - * 1) Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2) Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3) Sets the blend mode of the context to be that used by the Game Object. - * 4) Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5) Saves the context state. - * 6) Sets the final matrix values into the context via setTransform. + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. * * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. * diff --git a/src/renderer/index.js b/src/renderer/index.js index 697ddfe90..87e17c6b4 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -1,20 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} RendererConfig - * - * @property {boolean} clearBeforeRender - If `false`, the canvas won't be cleared before a frame is rendered. As a side effect, this can give a negligible performance boost with no visual artifacts with full-screen backgrounds. - * @property {boolean} antialias - Whether to antialias textures when transforming them. This should be turned off if you're using pixel art as it will make it look blurry. - * @property {Phaser.Display.Color} backgroundColor - The background color of the canvas. This is visible in areas which aren't covered by any Game Objects. - * @property {number} resolution - The resolution of the game canvas. This is the scale of a pixel compared to the size it'll actually be visible as. This can allow high-resolution textures at the expense of video memory. - * @property {boolean} autoResize - Whether the game canvas element should be physically resized to match the actual size of the canvas automatically. - * @property {boolean} roundPixels - If `true`, graphics won't be drawn at fractional pixels. Enabling this can make pixel art look better. - */ - /** * @namespace Phaser.Renderer */ diff --git a/src/renderer/snapshot/CanvasSnapshot.js b/src/renderer/snapshot/CanvasSnapshot.js index 5d547d46b..91b11357f 100644 --- a/src/renderer/snapshot/CanvasSnapshot.js +++ b/src/renderer/snapshot/CanvasSnapshot.js @@ -1,33 +1,87 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CanvasPool = require('../../display/canvas/CanvasPool'); +var Color = require('../../display/color/Color'); +var GetFastValue = require('../../utils/object/GetFastValue'); + /** - * Takes a snapshot of the current frame displayed by a 2D canvas. + * Takes a snapshot of an area from the current frame displayed by a canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * * @function Phaser.Renderer.Snapshot.Canvas * @since 3.0.0 * - * @param {HTMLCanvasElement} canvas - The canvas to take a snapshot of. - * @param {string} [type='image/png'] - The format of the returned image. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - * - * @return {HTMLImageElement} Returns an image of the type specified. + * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {SnapshotState} config - The snapshot configuration object. */ -var CanvasSnapshot = function (canvas, type, encoderOptions) +var CanvasSnapshot = function (canvas, config) { - if (type === undefined) { type = 'image/png'; } - if (encoderOptions === undefined) { encoderOptions = 0.92; } + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); + var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); + var width = GetFastValue(config, 'width', canvas.width); + var height = GetFastValue(config, 'height', canvas.height); + var getPixel = GetFastValue(config, 'getPixel', false); - var src = canvas.toDataURL(type, encoderOptions); + if (getPixel) + { + var context = canvas.getContext('2d'); + var imageData = context.getImageData(x, y, 1, 1); + var data = imageData.data; - var image = new Image(); + callback.call(null, new Color(data[0], data[1], data[2], data[3] / 255)); + } + else if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) + { + // Area Grab + var copyCanvas = CanvasPool.createWebGL(this, width, height); + var ctx = copyCanvas.getContext('2d'); - image.src = src; + ctx.drawImage(canvas, x, y, width, height, 0, 0, width, height); - return image; + var image1 = new Image(); + + image1.onerror = function () + { + callback.call(null); + + CanvasPool.remove(copyCanvas); + }; + + image1.onload = function () + { + callback.call(null, image1); + + CanvasPool.remove(copyCanvas); + }; + + image1.src = copyCanvas.toDataURL(type, encoderOptions); + } + else + { + // Full Grab + var image2 = new Image(); + + image2.onerror = function () + { + callback.call(null); + }; + + image2.onload = function () + { + callback.call(null, image2); + }; + + image2.src = canvas.toDataURL(type, encoderOptions); + } }; module.exports = CanvasSnapshot; diff --git a/src/renderer/snapshot/WebGLSnapshot.js b/src/renderer/snapshot/WebGLSnapshot.js index 69894d6f1..1ef04bacd 100644 --- a/src/renderer/snapshot/WebGLSnapshot.js +++ b/src/renderer/snapshot/WebGLSnapshot.js @@ -1,63 +1,93 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var CanvasPool = require('../../display/canvas/CanvasPool'); +var Color = require('../../display/color/Color'); +var GetFastValue = require('../../utils/object/GetFastValue'); + /** - * Takes a snapshot of the current frame displayed by a WebGL canvas. + * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. + * + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * * @function Phaser.Renderer.Snapshot.WebGL * @since 3.0.0 * * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. - * @param {string} [type='image/png'] - The format of the returned image. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - * - * @return {HTMLImageElement} A new image which contains a snapshot of the canvas's contents. + * @param {SnapshotState} config - The snapshot configuration object. */ -var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) +var WebGLSnapshot = function (sourceCanvas, config) { - 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; + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = GetFastValue(config, 'x', 0); + var y = GetFastValue(config, 'y', 0); + var width = GetFastValue(config, 'width', gl.drawingBufferWidth); + var height = GetFastValue(config, 'height', gl.drawingBufferHeight); + var getPixel = GetFastValue(config, 'getPixel', false); - 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) + if (getPixel) { - 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]; - } + var pixel = new Uint8Array(4); + + gl.readPixels(x, gl.drawingBufferHeight - y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel); + + callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3] / 255)); } + else + { + var pixels = new Uint8Array(width * height * 4); - ctx.putImageData(imageData, 0, 0); + gl.readPixels(x, gl.drawingBufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + + var canvas = CanvasPool.createWebGL(this, width, height); + var ctx = canvas.getContext('2d'); - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); + var imageData = ctx.getImageData(0, 0, width, height); + + var data = imageData.data; + + for (var py = 0; py < height; py++) + { + for (var px = 0; px < width; px++) + { + var sourceIndex = ((height - py) * width + px) * 4; + var destIndex = (py * width + px) * 4; - image.src = src; + data[destIndex + 0] = pixels[sourceIndex + 0]; + data[destIndex + 1] = pixels[sourceIndex + 1]; + data[destIndex + 2] = pixels[sourceIndex + 2]; + data[destIndex + 3] = pixels[sourceIndex + 3]; + } + } + + ctx.putImageData(imageData, 0, 0); + + var image = new Image(); - return image; + image.onerror = function () + { + callback.call(null); + + CanvasPool.remove(canvas); + }; + + image.onload = function () + { + callback.call(null, image); + + CanvasPool.remove(canvas); + }; + + image.src = canvas.toDataURL(type, encoderOptions); + } }; module.exports = WebGLSnapshot; diff --git a/src/renderer/snapshot/index.js b/src/renderer/snapshot/index.js index cbbe86b76..17f5224b1 100644 --- a/src/renderer/snapshot/index.js +++ b/src/renderer/snapshot/index.js @@ -1,15 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @callback SnapshotCallback - * - * @param {HTMLImageElement} snapshot - [description] - */ - /** * @namespace Phaser.Renderer.Snapshot */ diff --git a/src/renderer/snapshot/typedefs/SnapshotCallback.js b/src/renderer/snapshot/typedefs/SnapshotCallback.js new file mode 100644 index 000000000..d0993e244 --- /dev/null +++ b/src/renderer/snapshot/typedefs/SnapshotCallback.js @@ -0,0 +1,6 @@ +/** + * @callback Phaser.Renderer.Snapshot.Types.SnapshotCallback + * @since 3.16.1 + * + * @param {(Phaser.Display.Color|HTMLImageElement)} snapshot - Either a Color object if a single pixel is being grabbed, or a new Image which contains a snapshot of the canvas contents. + */ diff --git a/src/renderer/snapshot/typedefs/SnapshotState.js b/src/renderer/snapshot/typedefs/SnapshotState.js new file mode 100644 index 000000000..3f662ff47 --- /dev/null +++ b/src/renderer/snapshot/typedefs/SnapshotState.js @@ -0,0 +1,13 @@ +/** + * @typedef {object} Phaser.Renderer.Snapshot.Types.SnapshotState + * @since 3.16.1 + * + * @property {Phaser.Renderer.Snapshot.Types.SnapshotCallback} callback - The function to call after the snapshot is taken. + * @property {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @property {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * @property {integer} [x=0] - The x coordinate to start the snapshot from. + * @property {integer} [y=0] - The y coordinate to start the snapshot from. + * @property {integer} [width] - The width of the snapshot. + * @property {integer} [height] - The height of the snapshot. + * @property {boolean} [getPixel=false] - Is this a snapshot to get a single pixel, or an area? + */ diff --git a/src/renderer/snapshot/typedefs/index.js b/src/renderer/snapshot/typedefs/index.js new file mode 100644 index 000000000..334253478 --- /dev/null +++ b/src/renderer/snapshot/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.Snapshot.Types + */ diff --git a/src/renderer/webgl/Utils.js b/src/renderer/webgl/Utils.js index 949bf56f3..54d240b3e 100644 --- a/src/renderer/webgl/Utils.js +++ b/src/renderer/webgl/Utils.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/renderer/webgl/WebGLPipeline.js b/src/renderer/webgl/WebGLPipeline.js index 283344908..714bcc86c 100644 --- a/src/renderer/webgl/WebGLPipeline.js +++ b/src/renderer/webgl/WebGLPipeline.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -87,7 +87,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.resolution = config.game.config.resolution; + this.resolution = 1; /** * Width of the current viewport @@ -96,7 +96,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.width = config.game.config.width * this.resolution; + this.width = 0; /** * Height of the current viewport @@ -105,7 +105,7 @@ var WebGLPipeline = new Class({ * @type {number} * @since 3.0.0 */ - this.height = config.game.config.height * this.resolution; + this.height = 0; /** * The WebGL context this WebGL Pipeline uses. @@ -307,6 +307,7 @@ var WebGLPipeline = new Class({ { this.width = width * resolution; this.height = height * resolution; + this.resolution = resolution; return this; }, diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js index 1cba6a7bc..bdab08da9 100644 --- a/src/renderer/webgl/WebGLRenderer.js +++ b/src/renderer/webgl/WebGLRenderer.js @@ -1,15 +1,17 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseCamera = require('../../cameras/2d/BaseCamera'); +var CameraEvents = require('../../cameras/2d/events'); var Class = require('../../utils/Class'); var CONST = require('../../const'); var IsSizePowerOfTwo = require('../../math/pow2/IsSizePowerOfTwo'); var SpliceOne = require('../../utils/array/SpliceOne'); +var TextureEvents = require('../../textures/events'); var TransformMatrix = require('../../gameobjects/components/TransformMatrix'); var Utils = require('./Utils'); var WebGLSnapshot = require('../snapshot/WebGLSnapshot'); @@ -25,14 +27,6 @@ var TextureTintPipeline = require('./pipelines/TextureTintPipeline'); * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. */ -/** - * @typedef {object} SnapshotState - * - * @property {SnapshotCallback} callback - The function to call after the snapshot is taken. - * @property {string} type - The type of the image to create. - * @property {number} encoder - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`). - */ - /** * @classdesc * WebGLRenderer is a class that contains the needed functionality to keep the @@ -75,7 +69,7 @@ var WebGLRenderer = new Class({ * The local configuration settings of this WebGL Renderer. * * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {RendererConfig} + * @type {object} * @since 3.0.0 */ this.config = { @@ -84,7 +78,6 @@ var WebGLRenderer = new Class({ backgroundColor: gameConfig.backgroundColor, contextCreation: contextCreationConfig, resolution: gameConfig.resolution, - autoResize: gameConfig.autoResize, roundPixels: gameConfig.roundPixels, maxTextures: gameConfig.maxTextures, maxTextureSize: gameConfig.maxTextureSize, @@ -112,21 +105,23 @@ var WebGLRenderer = new Class({ /** * The width of the canvas being rendered to. + * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#width * @type {integer} * @since 3.0.0 */ - this.width = game.scale.canvasWidth; + this.width = 0; /** * The height of the canvas being rendered to. + * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#height * @type {integer} * @since 3.0.0 */ - this.height = game.scale.canvasHeight; + this.height = 0; /** * The canvas which this WebGL Renderer draws to. @@ -203,13 +198,18 @@ var WebGLRenderer = new Class({ * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. * * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState - * @type {SnapshotState} + * @type {Phaser.Renderer.Snapshot.Types.SnapshotState} * @since 3.0.0 */ this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, callback: null, - type: null, - encoder: null + type: 'image/png', + encoder: 0.92 }; // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) @@ -421,6 +421,13 @@ var WebGLRenderer = new Class({ */ this.blankTexture = null; + /** + * A default Camera used in calls when no other camera has been provided. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultCamera + * @type {Phaser.Cameras.Scene2D.BaseCamera} + * @since 3.12.0 + */ this.defaultCamera = new BaseCamera(0, 0, 0, 0); /** @@ -467,8 +474,7 @@ var WebGLRenderer = new Class({ }, /** - * Creates a new WebGLRenderingContext and initializes all internal - * state. + * Creates a new WebGLRenderingContext and initializes all internal state. * * @method Phaser.Renderer.WebGL.WebGLRenderer#init * @since 3.0.0 @@ -480,13 +486,14 @@ var WebGLRenderer = new Class({ init: function (config) { var gl; + var game = this.game; var canvas = this.canvas; var clearColor = config.backgroundColor; // Did they provide their own context? - if (this.game.config.context) + if (game.config.context) { - gl = this.game.config.context; + gl = game.config.context; } else { @@ -503,7 +510,7 @@ var WebGLRenderer = new Class({ this.gl = gl; // Set it back into the Game, so developers can access it from there too - this.game.context = gl; + game.context = gl; for (var i = 0; i <= 27; i++) { @@ -556,7 +563,7 @@ var WebGLRenderer = new Class({ gl.enable(gl.BLEND); - gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, 1); + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); // Initialize all textures to null for (var index = 0; index < this.currentTextures.length; ++index) @@ -567,32 +574,13 @@ var WebGLRenderer = new Class({ // Clear previous pipelines and reload default ones this.pipelines = {}; - this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ 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, maxLights: config.maxLights })); + this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: game, renderer: this })); + this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: game, renderer: this })); + this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: game, renderer: this, maxLights: config.maxLights })); this.setBlendMode(CONST.BlendModes.NORMAL); - var width = this.width; - var height = this.height; - - gl.viewport(0, 0, width, height); - - var pipelines = this.pipelines; - - // Update all registered pipelines - for (var pipelineName in pipelines) - { - pipelines[pipelineName].resize(width, height, this.game.scale.resolution); - } - - this.drawingBufferHeight = gl.drawingBufferHeight; - - this.defaultCamera.setSize(width, height); - - gl.scissor(0, (this.drawingBufferHeight - height), width, height); - - this.game.events.once('texturesready', this.boot, this); + game.textures.once(TextureEvents.READY, this.boot, this); return this; }, @@ -624,29 +612,56 @@ var WebGLRenderer = new Class({ gl.enable(gl.SCISSOR_TEST); this.setPipeline(this.pipelines.TextureTintPipeline); + + this.game.scale.on('resize', this.onResize, this); + + var baseSize = this.game.scale.baseSize; + + this.resize(baseSize.width, baseSize.height, this.game.scale.resolution); }, /** - * Resizes the drawing buffer. + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. + * @param {number} [resolution] - The Scale Manager resolution setting. + */ + onResize: function (gameSize, baseSize, displaySize, resolution) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height || resolution !== this.resolution) + { + this.resize(baseSize.width, baseSize.height, resolution); + } + }, + + /** + * Resizes the drawing buffer to match that required by the Scale Manager. * * @method Phaser.Renderer.WebGL.WebGLRenderer#resize * @since 3.0.0 * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. + * @param {number} [resolution] - The new resolution of the renderer. * * @return {this} This WebGLRenderer instance. */ - resize: function (width, height) + resize: function (width, height, resolution) { var gl = this.gl; var pipelines = this.pipelines; - var resolution = this.game.scale.resolution; - this.width = Math.floor(width * resolution); - this.height = Math.floor(height * resolution); + this.width = width; + this.height = height; + this.resolution = resolution; - gl.viewport(0, 0, this.width, this.height); + gl.viewport(0, 0, width, height); // Update all registered pipelines for (var pipelineName in pipelines) @@ -656,9 +671,9 @@ var WebGLRenderer = new Class({ this.drawingBufferHeight = gl.drawingBufferHeight; - this.defaultCamera.setSize(width, height); + gl.scissor(0, (gl.drawingBufferHeight - height), width, height); - gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); + this.defaultCamera.setSize(width, height); return this; }, @@ -1406,6 +1421,7 @@ var WebGLRenderer = new Class({ else { gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); + width = pixels.width; height = pixels.height; } @@ -1592,7 +1608,7 @@ var WebGLRenderer = new Class({ this.gl.deleteTexture(texture); - if (this.currentTextures[0] === texture) + if (this.currentTextures[0] === texture && !this.game.pendingDestroy) { // texture we just deleted is in use, so bind a blank texture this.setBlankTexture(true); @@ -1697,7 +1713,7 @@ var WebGLRenderer = new Class({ ); } - camera.emit('prerender', camera); + camera.emit(CameraEvents.PRE_RENDER, camera); } else { @@ -1740,7 +1756,7 @@ var WebGLRenderer = new Class({ this.setFramebuffer(null); - camera.emit('postrender', camera); + camera.emit(CameraEvents.POST_RENDER, camera); TextureTintPipeline.projOrtho(0, TextureTintPipeline.width, TextureTintPipeline.height, 0, -1000.0, 1000.0); @@ -1795,7 +1811,7 @@ var WebGLRenderer = new Class({ { var clearColor = this.config.backgroundColor; - gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, 1); + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } @@ -1905,10 +1921,13 @@ var WebGLRenderer = new Class({ // Unbind custom framebuffer here - if (this.snapshotState.callback) + var state = this.snapshotState; + + if (state.callback) { - this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); - this.snapshotState.callback = null; + WebGLSnapshot(this.canvas, state); + + state.callback = null; } var pipelines = this.pipelines; @@ -1920,22 +1939,100 @@ var WebGLRenderer = new Class({ }, /** - * Schedules a snapshot to be taken after the current frame is rendered. + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot * @since 3.0.0 * - * @param {SnapshotCallback} callback - Function to invoke after the snapshot is created. - * @param {string} type - The format of the image to create, usually `image/png`. - * @param {number} encoderOptions - The image quality, between 0 and 1, to use for image formats with lossy compression (such as `image/jpeg`). + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} This WebGL Renderer. + * @return {this} This WebGL Renderer. */ snapshot: function (callback, type, encoderOptions) { - this.snapshotState.callback = callback; - this.snapshotState.type = type; - this.snapshotState.encoder = encoderOptions; + return this.snapshotArea(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea + * @since 3.16.0 + * + * @param {integer} x - The x coordinate to grab from. + * @param {integer} y - The y coordinate to grab from. + * @param {integer} width - The width of the area to grab. + * @param {integer} height - The height of the area to grab. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; + + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gl.drawingBufferWidth); + state.height = Math.min(height, this.gl.drawingBufferHeight); + + return this; + }, + + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {integer} x - The x coordinate of the pixel to get. + * @param {integer} y - The y coordinate of the pixel to get. + * @param {SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); + + this.snapshotState.getPixel = true; return this; }, @@ -1967,7 +2064,9 @@ var WebGLRenderer = new Class({ wrapping = gl.REPEAT; } - dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); + var filter = (this.config.antialias) ? gl.LINEAR : gl.NEAREST; + + dstTexture = this.createTexture2D(0, filter, filter, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); } else { @@ -2385,7 +2484,7 @@ var WebGLRenderer = new Class({ delete this.pipelines[key]; } - for (var index = 0; index < this.nativeTextures.length; ++index) + for (var index = 0; index < this.nativeTextures.length; index++) { this.deleteTexture(this.nativeTextures[index]); diff --git a/src/renderer/webgl/index.js b/src/renderer/webgl/index.js index 981d1309b..daed9866f 100644 --- a/src/renderer/webgl/index.js +++ b/src/renderer/webgl/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/renderer/webgl/pipelines/BitmapMaskPipeline.js b/src/renderer/webgl/pipelines/BitmapMaskPipeline.js index 505aa57b5..1fa37d72e 100644 --- a/src/renderer/webgl/pipelines/BitmapMaskPipeline.js +++ b/src/renderer/webgl/pipelines/BitmapMaskPipeline.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js b/src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js index 9925b61d2..46aaf64e2 100644 --- a/src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js +++ b/src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -178,7 +178,7 @@ var ForwardDiffuseLightPipeline = new Class({ /** * Generic function for batching a textured quad * - * @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#batchTexture + * @method Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline#batchTexture * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject diff --git a/src/renderer/webgl/pipelines/TextureTintPipeline.js b/src/renderer/webgl/pipelines/TextureTintPipeline.js index 9bea5c50c..939364695 100644 --- a/src/renderer/webgl/pipelines/TextureTintPipeline.js +++ b/src/renderer/webgl/pipelines/TextureTintPipeline.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/renderer/webgl/pipelines/components/ModelViewProjection.js b/src/renderer/webgl/pipelines/components/ModelViewProjection.js index 11c21370c..532506ee5 100644 --- a/src/renderer/webgl/pipelines/components/ModelViewProjection.js +++ b/src/renderer/webgl/pipelines/components/ModelViewProjection.js @@ -1,49 +1,77 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ - /** * Implements a model view projection matrices. * Pipelines can implement this for doing 2D and 3D rendering. + * + * @namespace Phaser.Renderer.WebGL.Pipelines.ModelViewProjection + * @since 3.0.0 */ - var ModelViewProjection = { /** * Dirty flag for checking if model matrix needs to be updated on GPU. + * + * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelMatrixDirty + * @type {boolean} + * @since 3.0.0 */ modelMatrixDirty: false, /** * Dirty flag for checking if view matrix needs to be updated on GPU. + * + * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewMatrixDirty + * @type {boolean} + * @since 3.0.0 */ viewMatrixDirty: false, /** * Dirty flag for checking if projection matrix needs to be updated on GPU. + * + * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projectionMatrixDirty + * @type {boolean} + * @since 3.0.0 */ projectionMatrixDirty: false, /** * Model matrix + * + * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelMatrix + * @type {?Float32Array} + * @since 3.0.0 */ modelMatrix: null, /** * View matrix + * + * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewMatrix + * @type {?Float32Array} + * @since 3.0.0 */ viewMatrix: null, /** * Projection matrix + * + * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projectionMatrix + * @type {?Float32Array} + * @since 3.0.0 */ projectionMatrix: null, /** * Initializes MVP matrices with an identity matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#mvpInit + * @since 3.0.0 */ mvpInit: function () { @@ -77,6 +105,9 @@ var ModelViewProjection = { /** * If dirty flags are set then the matrices are uploaded to the GPU. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#mvpUpdate + * @since 3.0.0 */ mvpUpdate: function () { @@ -105,6 +136,9 @@ var ModelViewProjection = { /** * Loads an identity matrix to the model matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelIdentity + * @since 3.0.0 */ modelIdentity: function () { @@ -134,6 +168,15 @@ var ModelViewProjection = { /** * Scale model matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelScale + * @since 3.0.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Model View Projection. */ modelScale: function (x, y, z) { @@ -159,6 +202,15 @@ var ModelViewProjection = { /** * Translate model matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelTranslate + * @since 3.0.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Model View Projection. */ modelTranslate: function (x, y, z) { @@ -174,9 +226,15 @@ var ModelViewProjection = { return this; }, - /** * Rotates the model matrix in the X axis. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelRotateX + * @since 3.0.0 + * + * @param {number} radians - The amount to rotate by. + * + * @return {this} This Model View Projection. */ modelRotateX: function (radians) { @@ -208,6 +266,13 @@ var ModelViewProjection = { /** * Rotates the model matrix in the Y axis. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelRotateY + * @since 3.0.0 + * + * @param {number} radians - The amount to rotate by. + * + * @return {this} This Model View Projection. */ modelRotateY: function (radians) { @@ -239,6 +304,13 @@ var ModelViewProjection = { /** * Rotates the model matrix in the Z axis. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelRotateZ + * @since 3.0.0 + * + * @param {number} radians - The amount to rotate by. + * + * @return {this} This Model View Projection. */ modelRotateZ: function (radians) { @@ -270,6 +342,11 @@ var ModelViewProjection = { /** * Loads identity matrix into the view matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewIdentity + * @since 3.0.0 + * + * @return {this} This Model View Projection. */ viewIdentity: function () { @@ -299,6 +376,15 @@ var ModelViewProjection = { /** * Scales view matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewScale + * @since 3.0.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Model View Projection. */ viewScale: function (x, y, z) { @@ -324,6 +410,15 @@ var ModelViewProjection = { /** * Translates view matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewTranslate + * @since 3.0.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Model View Projection. */ viewTranslate: function (x, y, z) { @@ -341,6 +436,13 @@ var ModelViewProjection = { /** * Rotates view matrix in the X axis. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewRotateX + * @since 3.0.0 + * + * @param {number} radians - The amount to rotate by. + * + * @return {this} This Model View Projection. */ viewRotateX: function (radians) { @@ -372,6 +474,13 @@ var ModelViewProjection = { /** * Rotates view matrix in the Y axis. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewRotateY + * @since 3.0.0 + * + * @param {number} radians - The amount to rotate by. + * + * @return {this} This Model View Projection. */ viewRotateY: function (radians) { @@ -403,6 +512,13 @@ var ModelViewProjection = { /** * Rotates view matrix in the Z axis. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewRotateZ + * @since 3.0.0 + * + * @param {number} radians - The amount to rotate by. + * + * @return {this} This Model View Projection. */ viewRotateZ: function (radians) { @@ -434,6 +550,13 @@ var ModelViewProjection = { /** * Loads a 2D view matrix (3x2 matrix) into a 4x4 view matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewLoad2D + * @since 3.0.0 + * + * @param {Float32Array} matrix2D - The Matrix2D. + * + * @return {this} This Model View Projection. */ viewLoad2D: function (matrix2D) { @@ -464,6 +587,13 @@ var ModelViewProjection = { /** * Copies a 4x4 matrix into the view matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewLoad + * @since 3.0.0 + * + * @param {Float32Array} matrix - The Matrix2D. + * + * @return {this} This Model View Projection. */ viewLoad: function (matrix) { @@ -493,6 +623,11 @@ var ModelViewProjection = { /** * Loads identity matrix into the projection matrix. + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projIdentity + * @since 3.0.0 + * + * @return {this} This Model View Projection. */ projIdentity: function () { @@ -522,6 +657,18 @@ var ModelViewProjection = { /** * Sets up an orthographics projection matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projOrtho + * @since 3.0.0 + * + * @param {number} left - The left value. + * @param {number} right - The right value. + * @param {number} bottom - The bottom value. + * @param {number} top - The top value. + * @param {number} near - The near value. + * @param {number} far - The far value. + * + * @return {this} This Model View Projection. */ projOrtho: function (left, right, bottom, top, near, far) { @@ -553,6 +700,16 @@ var ModelViewProjection = { /** * Sets up a perspective projection matrix + * + * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projPersp + * @since 3.0.0 + * + * @param {number} fovy - The fovy value. + * @param {number} aspectRatio - The aspectRatio value. + * @param {number} near - The near value. + * @param {number} far - The far value. + * + * @return {this} This Model View Projection. */ projPersp: function (fovy, aspectRatio, near, far) { diff --git a/src/renderer/webgl/pipelines/index.js b/src/renderer/webgl/pipelines/index.js index bfbc04d9f..0de0d5ded 100644 --- a/src/renderer/webgl/pipelines/index.js +++ b/src/renderer/webgl/pipelines/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -12,6 +12,7 @@ module.exports = { BitmapMaskPipeline: require('./BitmapMaskPipeline'), ForwardDiffuseLightPipeline: require('./ForwardDiffuseLightPipeline'), - TextureTintPipeline: require('./TextureTintPipeline') + TextureTintPipeline: require('./TextureTintPipeline'), + ModelViewProjection: require('./components/ModelViewProjection') }; diff --git a/src/scale/ScaleManager.js b/src/scale/ScaleManager.js new file mode 100644 index 000000000..5d60f1885 --- /dev/null +++ b/src/scale/ScaleManager.js @@ -0,0 +1,1679 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = require('./const'); +var Class = require('../utils/Class'); +var EventEmitter = require('eventemitter3'); +var Events = require('./events'); +var GameEvents = require('../core/events'); +var GetInnerHeight = require('../dom/GetInnerHeight'); +var GetTarget = require('../dom/GetTarget'); +var GetScreenOrientation = require('../dom/GetScreenOrientation'); +var NOOP = require('../utils/NOOP'); +var Rectangle = require('../geom/rectangle/Rectangle'); +var Size = require('../structs/Size'); +var SnapFloor = require('../math/snap/SnapFloor'); +var Vector2 = require('../math/Vector2'); + +/** + * @classdesc + * The Scale Manager handles the scaling, resizing and alignment of the game canvas. + * + * The way scaling is handled is by setting the game canvas to a fixed size, which is defined in the + * game configuration. You also define the parent container in the game config. If no parent is given, + * it will default to using the document body. The Scale Manager will then look at the available space + * within the _parent_ and scale the canvas accordingly. Scaling is handled by setting the canvas CSS + * width and height properties, leaving the width and height of the canvas element itself untouched. + * Scaling is therefore achieved by keeping the core canvas the same size and 'stretching' + * it via its CSS properties. This gives the same result and speed as using the `transform-scale` CSS + * property, without the need for browser prefix handling. + * + * The calculations for the scale are heavily influenced by the bounding parent size, which is the computed + * dimensions of the canvas's parent. The CSS rules of the parent element play an important role in the + * operation of the Scale Manager. For example, if the parent has no defined width or height, then actions + * like auto-centering will fail to achieve the required result. The Scale Manager works in tandem with the + * CSS you set-up on the page hosting your game, rather than taking control of it. + * + * #### Parent and Display canvas containment guidelines: + * + * - Style the Parent element (of the game canvas) to control the Parent size and thus the games size and layout. + * + * - The Parent element's CSS styles should _effectively_ apply maximum (and minimum) bounding behavior. + * + * - The Parent element should _not_ apply a padding as this is not accounted for. + * If a padding is required apply it to the Parent's parent or apply a margin to the Parent. + * If you need to add a border, margin or any other CSS around your game container, then use a parent element and + * apply the CSS to this instead, otherwise you'll be constantly resizing the shape of the game container. + * + * - The Display canvas layout CSS styles (i.e. margins, size) should not be altered / specified as + * they may be updated by the Scale Manager. + * + * #### Scale Modes + * + * The way the scaling is handled is determined by the `scaleMode` property. The default is `NO_SCALE`, + * which prevents Phaser from scaling or touching the canvas, or its parent, at all. In this mode, you are + * responsible for all scaling. The other scaling modes afford you automatic scaling. + * + * If you wish to scale your game so that it always fits into the available space within the parent, you + * should use the scale mode `FIT`. Look at the documentation for other scale modes to see what options are + * available. Here is a basic config showing how to set this scale mode: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * mode: Phaser.Scale.FIT, + * width: 800, + * height: 600 + * } + * ``` + * + * Place the `scale` config object within your game config. + * + * If you wish for the canvas to be resized directly, so that the canvas itself fills the available space + * (i.e. it isn't scaled, it's resized) then use the `RESIZE` scale mode. This will give you a 1:1 mapping + * of canvas pixels to game size. In this mode CSS isn't used to scale the canvas, it's literally adjusted + * to fill all available space within the parent. You should be extremely careful about the size of the + * canvas you're creating when doing this, as the larger the area, the more work the GPU has to do and it's + * very easy to hit fill-rate limits quickly. + * + * For complex, custom-scaling requirements, you should probably consider using the `RESIZE` scale mode, + * with your own limitations in place re: canvas dimensions and managing the scaling with the game scenes + * yourself. For the vast majority of games, however, the `FIT` mode is likely to be the most used. + * + * Please appreciate that the Scale Manager cannot perform miracles. All it does is scale your game canvas + * as best it can, based on what it can infer from its surrounding area. There are all kinds of environments + * where it's up to you to guide and help the canvas position itself, especially when built into rendering + * frameworks like React and Vue. If your page requires meta tags to prevent user scaling gestures, or such + * like, then it's up to you to ensure they are present in the html. + * + * #### Centering + * + * You can also have the game canvas automatically centered. Again, this relies heavily on the parent being + * properly configured and styled, as the centering offsets are based entirely on the available space + * within the parent element. Centering is disabled by default, or can be applied horizontally, vertically, + * or both. Here's an example: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * autoCenter: Phaser.Scale.CENTER_BOTH, + * width: 800, + * height: 600 + * } + * ``` + * + * #### Fullscreen API + * + * If the browser supports it, you can send your game into fullscreen mode. In this mode, the game will fill + * the entire display, removing all browser UI and anything else present on the screen. It will remain in this + * mode until your game either disables it, or until the user tabs out or presses ESCape if on desktop. It's a + * great way to achieve a desktop-game like experience from the browser, but it does require a modern browser + * to handle it. Some mobile browsers also support this. + * + * @class ScaleManager + * @memberof Phaser.Scale + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance. + */ +var ScaleManager = new Class({ + + Extends: EventEmitter, + + initialize: + + function ScaleManager (game) + { + EventEmitter.call(this); + + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Scale.ScaleManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.15.0 + */ + this.game = game; + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * + * @name Phaser.Scale.ScaleManager#canvas + * @type {HTMLCanvasElement} + * @since 3.16.0 + */ + this.canvas; + + /** + * The DOM bounds of the canvas element. + * + * @name Phaser.Scale.ScaleManager#canvasBounds + * @type {Phaser.Geom.Rectangle} + * @since 3.16.0 + */ + this.canvasBounds = new Rectangle(); + + /** + * The parent object of the Canvas. Often a div, or the browser window, or nothing in non-browser environments. + * + * This is set in the Game Config as the `parent` property. If undefined (or just not present), it will default + * to use the document body. If specifically set to `null` Phaser will ignore all parent operations. + * + * @name Phaser.Scale.ScaleManager#parent + * @type {?any} + * @since 3.16.0 + */ + this.parent = null; + + /** + * Is the parent element the browser window? + * + * @name Phaser.Scale.ScaleManager#parentIsWindow + * @type {boolean} + * @since 3.16.0 + */ + this.parentIsWindow = false; + + /** + * The Parent Size component. + * + * @name Phaser.Scale.ScaleManager#parentSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.parentSize = new Size(); + + /** + * The Game Size component. + * + * The un-modified game size, as requested in the game config (the raw width / height), + * as used for world bounds, cameras, etc + * + * @name Phaser.Scale.ScaleManager#gameSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.gameSize = new Size(); + + /** + * The Base Size component. + * + * The modified game size, which is the gameSize * resolution, used to set the canvas width and height + * (but not the CSS style) + * + * @name Phaser.Scale.ScaleManager#baseSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.baseSize = new Size(); + + /** + * The Display Size component. + * + * The size used for the canvas style, factoring in the scale mode, parent and other values. + * + * @name Phaser.Scale.ScaleManager#displaySize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.displaySize = new Size(); + + /** + * The game scale mode. + * + * @name Phaser.Scale.ScaleManager#scaleMode + * @type {Phaser.Scale.ScaleModeType} + * @since 3.16.0 + */ + this.scaleMode = CONST.SCALE_MODE.NONE; + + /** + * The canvas resolution. + * + * This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date. + * + * @name Phaser.Scale.ScaleManager#resolution + * @type {number} + * @since 3.16.0 + */ + this.resolution = 1; + + /** + * The game zoom factor. + * + * This value allows you to multiply your games base size by the given zoom factor. + * This is then used when calculating the display size, even in `NO_SCALE` situations. + * If you don't want Phaser to touch the canvas style at all, this value should be 1. + * + * Can also be set to `MAX_ZOOM` in which case the zoom value will be derived based + * on the game size and available space within the parent. + * + * @name Phaser.Scale.ScaleManager#zoom + * @type {number} + * @since 3.16.0 + */ + this.zoom = 1; + + /** + * The scale factor between the baseSize and the canvasBounds. + * + * @name Phaser.Scale.ScaleManager#displayScale + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ + this.displayScale = new Vector2(1, 1); + + /** + * If set, the canvas sizes will be automatically passed through Math.floor. + * This results in rounded pixel display values, which is important for performance on legacy + * and low powered devices, but at the cost of not achieving a 'perfect' fit in some browser windows. + * + * @name Phaser.Scale.ScaleManager#autoRound + * @type {boolean} + * @since 3.16.0 + */ + this.autoRound = false; + + /** + * Automatically center the canvas within the parent? The different centering modes are: + * + * 1. No centering. + * 2. Center both horizontally and vertically. + * 3. Center horizontally. + * 4. Center vertically. + * + * Please be aware that in order to center the game canvas, you must have specified a parent + * that has a size set, or the canvas parent is the document.body. + * + * @name Phaser.Scale.ScaleManager#autoCenter + * @type {Phaser.Scale.CenterType} + * @since 3.16.0 + */ + this.autoCenter = CONST.CENTER.NO_CENTER; + + /** + * The current device orientation. + * + * Orientation events are dispatched via the Device Orientation API, typically only on mobile browsers. + * + * @name Phaser.Scale.ScaleManager#orientation + * @type {Phaser.Scale.OrientationType} + * @since 3.16.0 + */ + this.orientation = CONST.ORIENTATION.LANDSCAPE; + + /** + * A reference to the Device.Fullscreen object. + * + * @name Phaser.Scale.ScaleManager#fullscreen + * @type {Phaser.Device.Fullscreen} + * @since 3.16.0 + */ + this.fullscreen; + + /** + * The DOM Element which is sent into fullscreen mode. + * + * @name Phaser.Scale.ScaleManager#fullscreenTarget + * @type {?any} + * @since 3.16.0 + */ + this.fullscreenTarget = null; + + /** + * Did Phaser create the fullscreen target div, or was it provided in the game config? + * + * @name Phaser.Scale.ScaleManager#_createdFullscreenTarget + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._createdFullscreenTarget = false; + + /** + * Internal var that keeps track of the user, or the browser, requesting fullscreen changes. + * + * @name Phaser.Scale.ScaleManager#_requestedFullscreenChange + * @type {boolean} + * @private + * @since 3.16.2 + */ + this._requestedFullscreenChange = false; + + /** + * The dirty state of the Scale Manager. + * Set if there is a change between the parent size and the current size. + * + * @name Phaser.Scale.ScaleManager#dirty + * @type {boolean} + * @since 3.16.0 + */ + this.dirty = false; + + /** + * How many milliseconds should elapse before checking if the browser size has changed? + * + * Most modern browsers dispatch a 'resize' event, which the Scale Manager will listen for. + * However, older browsers fail to do this, or do it consistently, so we fall back to a + * more traditional 'size check' based on a time interval. You can control how often it is + * checked here. + * + * @name Phaser.Scale.ScaleManager#resizeInterval + * @type {integer} + * @since 3.16.0 + */ + this.resizeInterval = 500; + + /** + * Internal size interval tracker. + * + * @name Phaser.Scale.ScaleManager#_lastCheck + * @type {integer} + * @private + * @since 3.16.0 + */ + this._lastCheck = 0; + + /** + * Internal flag to check orientation state. + * + * @name Phaser.Scale.ScaleManager#_checkOrientation + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._checkOrientation = false; + + /** + * Internal object containing our defined event listeners. + * + * @name Phaser.Scale.ScaleManager#listeners + * @type {object} + * @private + * @since 3.16.0 + */ + this.listeners = { + + orientationChange: NOOP, + windowResize: NOOP, + fullScreenChange: NOOP, + fullScreenError: NOOP + + }; + }, + + /** + * Called _before_ the canvas object is created and added to the DOM. + * + * @method Phaser.Scale.ScaleManager#preBoot + * @protected + * @listens Phaser.Core.Events#BOOT + * @since 3.16.0 + */ + preBoot: function () + { + // Parse the config to get the scaling values we need + this.parseConfig(this.game.config); + + this.game.events.once('boot', this.boot, this); + }, + + /** + * The Boot handler is called by Phaser.Game when it first starts up. + * The renderer is available by now and the canvas has been added to the DOM. + * + * @method Phaser.Scale.ScaleManager#boot + * @protected + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + */ + boot: function () + { + var game = this.game; + + this.canvas = game.canvas; + + this.fullscreen = game.device.fullscreen; + + if (this.scaleMode !== CONST.SCALE_MODE.RESIZE) + { + this.displaySize.setAspectMode(this.scaleMode); + } + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + this.resize(this.width, this.height); + } + else + { + this.getParentBounds(); + + // Only set the parent bounds if the parent has an actual size + if (this.parentSize.width > 0 && this.parentSize.height > 0) + { + this.displaySize.setParent(this.parentSize); + } + + this.refresh(); + } + + game.events.on(GameEvents.PRE_STEP, this.step, this); + + this.startListeners(); + }, + + /** + * Parses the game configuration to set-up the scale defaults. + * + * @method Phaser.Scale.ScaleManager#parseConfig + * @protected + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + parseConfig: function (config) + { + // Get the parent element, if any + this.getParent(config); + + // Get the size of the parent element + // This can often set a height of zero (especially for un-styled divs) + this.getParentBounds(); + + var width = config.width; + var height = config.height; + var scaleMode = config.scaleMode; + var resolution = config.resolution; + var zoom = config.zoom; + var autoRound = config.autoRound; + + // If width = '100%', or similar value + if (typeof width === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentWidth = this.parentSize.width; + + if (parentWidth === 0) + { + parentWidth = window.innerWidth; + } + + var parentScaleX = parseInt(width, 10) / 100; + + width = Math.floor(parentWidth * parentScaleX); + } + + // If height = '100%', or similar value + if (typeof height === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentHeight = this.parentSize.height; + + if (parentHeight === 0) + { + parentHeight = window.innerHeight; + } + + var parentScaleY = parseInt(height, 10) / 100; + + height = Math.floor(parentHeight * parentScaleY); + } + + // This is fixed at 1 on purpose. + // Changing it will break all user input. + // Wait for another release to solve this issue. + this.resolution = 1; + + this.scaleMode = scaleMode; + + this.autoRound = autoRound; + + this.autoCenter = config.autoCenter; + + this.resizeInterval = config.resizeInterval; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.setSize(width, height); + + if (zoom === CONST.ZOOM.MAX_ZOOM) + { + zoom = this.getMaxZoom(); + } + + this.zoom = zoom; + + // The modified game size, which is the w/h * resolution + this.baseSize.setSize(width * resolution, height * resolution); + + if (autoRound) + { + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } + + if (config.minWidth > 0) + { + this.displaySize.setMin(config.minWidth * zoom, config.minHeight * zoom); + } + + if (config.maxWidth > 0) + { + this.displaySize.setMax(config.maxWidth * zoom, config.maxHeight * zoom); + } + + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) + this.displaySize.setSize(width, height); + + this.orientation = GetScreenOrientation(width, height); + }, + + /** + * Determines the parent element of the game canvas, if any, based on the game configuration. + * + * @method Phaser.Scale.ScaleManager#getParent + * @since 3.16.0 + * + * @param {GameConfig} config - The Game configuration object. + */ + getParent: function (config) + { + var parent = config.parent; + + if (parent === null) + { + // User is responsible for managing the parent + return; + } + + this.parent = GetTarget(parent); + this.parentIsWindow = (this.parent === document.body); + + if (config.expandParent && config.scaleMode !== CONST.SCALE_MODE.NONE) + { + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow || DOMRect.height === 0) + { + document.documentElement.style.height = '100%'; + document.body.style.height = '100%'; + + DOMRect = this.parent.getBoundingClientRect(); + + // The parent STILL has no height, clearly no CSS + // has been set on it even though we fixed the body :( + if (!this.parentIsWindow && DOMRect.height === 0) + { + this.parent.style.overflow = 'hidden'; + this.parent.style.width = '100%'; + this.parent.style.height = '100%'; + } + } + } + + // And now get the fullscreenTarget + if (config.fullscreenTarget && !this.fullscreenTarget) + { + this.fullscreenTarget = GetTarget(config.fullscreenTarget); + } + }, + + /** + * Calculates the size of the parent bounds and updates the `parentSize` component, if the canvas has a dom parent. + * + * @method Phaser.Scale.ScaleManager#getParentBounds + * @since 3.16.0 + * + * @return {boolean} `true` if the parent bounds have changed size, otherwise `false`. + */ + getParentBounds: function () + { + if (!this.parent) + { + return false; + } + + var parentSize = this.parentSize; + + // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect + + var DOMRect = this.parent.getBoundingClientRect(); + + if (this.parentIsWindow && this.game.device.os.iOS) + { + DOMRect.height = GetInnerHeight(true); + } + + var resolution = this.resolution; + var newWidth = DOMRect.width * resolution; + var newHeight = DOMRect.height * resolution; + + if (parentSize.width !== newWidth || parentSize.height !== newHeight) + { + parentSize.setSize(newWidth, newHeight); + + return true; + } + else + { + return false; + } + }, + + /** + * Attempts to lock the orientation of the web browser using the Screen Orientation API. + * + * This API is only available on modern mobile browsers. + * See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details. + * + * @method Phaser.Scale.ScaleManager#lockOrientation + * @since 3.16.0 + * + * @param {string} orientation - The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc. + * + * @return {boolean} `true` if the orientation was successfully locked, otherwise `false`. + */ + lockOrientation: function (orientation) + { + var lock = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation; + + if (lock) + { + return lock(orientation); + } + + return false; + }, + + /** + * This method will set the size of the Parent Size component, which is used in scaling + * and centering calculations. You only need to call this method if you have explicitly + * disabled the use of a parent in your game config, but still wish to take advantage of + * other Scale Manager features. + * + * @method Phaser.Scale.ScaleManager#setParentSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the parent. + * @param {number} height - The new height of the parent. + * + * @return {this} The Scale Manager instance. + */ + setParentSize: function (width, height) + { + this.parentSize.setSize(width, height); + + return this.refresh(); + }, + + /** + * This method will set a new size for your game. + * + * @method Phaser.Scale.ScaleManager#setGameSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + setGameSize: function (width, height) + { + var autoRound = this.autoRound; + var resolution = this.resolution; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + this.baseSize.resize(width * resolution, height * resolution); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this.refresh(); + }, + + /** + * Call this to modify the size of the Phaser canvas element directly. + * You should only use this if you are using the `NO_SCALE` scale mode, + * it will update all internal components completely. + * + * If all you want to do is change the size of the parent, see the `setParentSize` method. + * + * If all you want is to change the base size of the game, but still have the Scale Manager + * manage all the scaling, then see the `setGameSize` method. + * + * This method will set the `gameSize`, `baseSize` and `displaySize` components to the given + * dimensions. It will then resize the canvas width and height to the values given, by + * directly setting the properties. Finally, if you have set the Scale Manager zoom value + * to anything other than 1 (the default), it will set the canvas CSS width and height to + * be the given size multiplied by the zoom factor (the canvas pixel size remains untouched). + * + * If you have enabled `autoCenter`, it is then passed to the `updateCenter` method and + * the margins are set, allowing the canvas to be centered based on its parent element + * alone. Finally, the `displayScale` is adjusted and the RESIZE event dispatched. + * + * @method Phaser.Scale.ScaleManager#resize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + resize: function (width, height) + { + var zoom = this.zoom; + var resolution = this.resolution; + var autoRound = this.autoRound; + + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } + + this.gameSize.resize(width, height); + + this.baseSize.resize(width * resolution, height * resolution); + + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + this.canvas.width = this.baseSize.width; + this.canvas.height = this.baseSize.height; + + var style = this.canvas.style; + + var styleWidth = width * zoom; + var styleHeight = height * zoom; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (styleWidth !== width || styleHeight !== height) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + this.getParentBounds(); + + this.updateCenter(); + + this.updateBounds(); + + this.displayScale.set(width / this.canvasBounds.width, height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + this.updateOrientation(); + + return this; + }, + + /** + * Sets the zoom value of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#setZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {integer} value - The new zoom value of the game. + * + * @return {this} The Scale Manager instance. + */ + setZoom: function (value) + { + this.zoom = value; + + return this.refresh(); + }, + + /** + * Sets the zoom to be the maximum possible based on the _current_ parent size. + * + * @method Phaser.Scale.ScaleManager#setMaxZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + setMaxZoom: function () + { + this.zoom = this.getMaxZoom(); + + return this.refresh(); + }, + + /** + * Refreshes the internal scale values, bounds sizes and orientation checks. + * + * Once finished, dispatches the resize event. + * + * This is called automatically by the Scale Manager when the browser window size changes, + * as long as it is using a Scale Mode other than 'NONE'. + * + * @method Phaser.Scale.ScaleManager#refresh + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + refresh: function () + { + this.updateScale(); + this.updateBounds(); + this.updateOrientation(); + + this.displayScale.set(this.baseSize.width / this.canvasBounds.width, this.baseSize.height / this.canvasBounds.height); + + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution); + + return this; + }, + + /** + * Internal method that checks the current screen orientation, only if the internal check flag is set. + * + * If the orientation has changed it updates the orientation property and then dispatches the orientation change event. + * + * @method Phaser.Scale.ScaleManager#updateOrientation + * @fires Phaser.Scale.Events#ORIENTATION_CHANGE + * @since 3.16.0 + */ + updateOrientation: function () + { + if (this._checkOrientation) + { + this._checkOrientation = false; + + var newOrientation = GetScreenOrientation(this.width, this.height); + + if (newOrientation !== this.orientation) + { + this.orientation = newOrientation; + + this.emit(Events.ORIENTATION_CHANGE, newOrientation); + } + } + }, + + /** + * Internal method that manages updating the size components based on the scale mode. + * + * @method Phaser.Scale.ScaleManager#updateScale + * @since 3.16.0 + */ + updateScale: function () + { + var style = this.canvas.style; + + var width = this.gameSize.width; + var height = this.gameSize.height; + + var styleWidth; + var styleHeight; + + var zoom = this.zoom; + var autoRound = this.autoRound; + var resolution = 1; + + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + // No scale + this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + if (zoom > 1) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + } + else if (this.scaleMode === CONST.SCALE_MODE.RESIZE) + { + // Resize to match parent + + // This will constrain using min/max + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + this.gameSize.setSize(this.displaySize.width, this.displaySize.height); + + this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + this.canvas.width = styleWidth; + this.canvas.height = styleHeight; + } + else + { + // All other scale modes + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); + + styleWidth = this.displaySize.width / resolution; + styleHeight = this.displaySize.height / resolution; + + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } + + // Update the parentSize incase the canvas / style change modified it + this.getParentBounds(); + + // Finally, update the centering + this.updateCenter(); + }, + + /** + * Calculates and returns the largest possible zoom factor, based on the current + * parent and game sizes. If the parent has no dimensions (i.e. an unstyled div), + * or is smaller than the un-zoomed game, then this will return a value of 1 (no zoom) + * + * @method Phaser.Scale.ScaleManager#getMaxZoom + * @since 3.16.0 + * + * @return {integer} The maximum possible zoom factor. At a minimum this value is always at least 1. + */ + getMaxZoom: function () + { + var zoomH = SnapFloor(this.parentSize.width, this.gameSize.width, 0, true); + var zoomV = SnapFloor(this.parentSize.height, this.gameSize.height, 0, true); + + return Math.max(Math.min(zoomH, zoomV), 1); + }, + + /** + * Calculates and updates the canvas CSS style in order to center it within the + * bounds of its parent. If you have explicitly set parent to be `null` in your + * game config then this method will likely give incorrect results unless you have called the + * `setParentSize` method first. + * + * It works by modifying the canvas CSS `marginLeft` and `marginTop` properties. + * + * If they have already been set by your own style sheet, or code, this will overwrite them. + * + * To prevent the Scale Manager from centering the canvas, either do not set the + * `autoCenter` property in your game config, or make sure it is set to `NO_CENTER`. + * + * @method Phaser.Scale.ScaleManager#updateCenter + * @since 3.16.0 + */ + updateCenter: function () + { + var autoCenter = this.autoCenter; + + if (autoCenter === CONST.CENTER.NO_CENTER) + { + return; + } + + var canvas = this.canvas; + + var style = canvas.style; + + var bounds = canvas.getBoundingClientRect(); + + // var width = parseInt(canvas.style.width, 10) || canvas.width; + // var height = parseInt(canvas.style.height, 10) || canvas.height; + + var width = bounds.width; + var height = bounds.height; + + var offsetX = Math.floor((this.parentSize.width - width) / 2); + var offsetY = Math.floor((this.parentSize.height - height) / 2); + + if (autoCenter === CONST.CENTER.CENTER_HORIZONTALLY) + { + offsetY = 0; + } + else if (autoCenter === CONST.CENTER.CENTER_VERTICALLY) + { + offsetX = 0; + } + + style.marginLeft = offsetX + 'px'; + style.marginTop = offsetY + 'px'; + }, + + /** + * Updates the `canvasBounds` rectangle to match the bounding client rectangle of the + * canvas element being used to track input events. + * + * @method Phaser.Scale.ScaleManager#updateBounds + * @since 3.16.0 + */ + updateBounds: function () + { + var bounds = this.canvasBounds; + var clientRect = this.canvas.getBoundingClientRect(); + + bounds.x = clientRect.left + (window.pageXOffset || 0) - (document.documentElement.clientLeft || 0); + bounds.y = clientRect.top + (window.pageYOffset || 0) - (document.documentElement.clientTop || 0); + bounds.width = clientRect.width; + bounds.height = clientRect.height; + }, + + /** + * Transforms the pageX value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformX + * @since 3.16.0 + * + * @param {number} pageX - The DOM pageX value. + * + * @return {number} The translated value. + */ + transformX: function (pageX) + { + return (pageX - this.canvasBounds.left) * this.displayScale.x; + }, + + /** + * Transforms the pageY value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformY + * @since 3.16.0 + * + * @param {number} pageY - The DOM pageY value. + * + * @return {number} The translated value. + */ + transformY: function (pageY) + { + return (pageY - this.canvasBounds.top) * this.displayScale.y; + }, + + /** + * Sends a request to the browser to ask it to go in to full screen mode, using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Fullscreen API}. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerup`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * On touch devices, such as Android and iOS Safari, you should always use `pointerup` and NOT `pointerdown`, + * otherwise the request will fail unless the document in which your game is embedded has already received + * some form of touch input, which you cannot guarantee. Activating fullscreen via `pointerup` circumvents + * this issue. + * + * Performing an action that navigates to another page, or opens another tab, will automatically cancel + * fullscreen mode, as will the user pressing the ESC key. To cancel fullscreen mode directly from your game, + * i.e. by clicking an icon, call the `stopFullscreen` method. + * + * A browser can only send one DOM element into fullscreen. You can control which element this is by + * setting the `fullscreenTarget` property in your game config, or changing the property in the Scale Manager. + * Note that the game canvas _must_ be a child of the target. If you do not give a target, Phaser will + * automatically create a blank `
` element and move the canvas into it, before going fullscreen. + * When it leaves fullscreen, the div will be removed. + * + * @method Phaser.Scale.ScaleManager#startFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_FAILED + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + startFullscreen: function (fullscreenOptions) + { + if (fullscreenOptions === undefined) { fullscreenOptions = { navigationUI: 'hide' }; } + + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return; + } + + if (!fullscreen.active) + { + var fsTarget = this.getFullscreenTarget(); + + this._requestedFullscreenChange = true; + + if (typeof Promise !== 'undefined') + { + if (fullscreen.keyboard) + { + // eslint-disable-next-line es5/no-arrow-functions + fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT).then(() => this.fullscreenSuccessHandler()).catch((error) => this.fullscreenErrorHandler(error)); + } + else + { + // eslint-disable-next-line es5/no-arrow-functions + fsTarget[fullscreen.request](fullscreenOptions).then(() => this.fullscreenSuccessHandler()).catch((error) => this.fullscreenErrorHandler(error)); + } + } + else + { + if (fullscreen.keyboard) + { + fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); + } + else + { + fsTarget[fullscreen.request](fullscreenOptions); + } + + if (fullscreen.active) + { + this.fullscreenSuccessHandler(); + } + else + { + this.fullscreenErrorHandler(); + } + } + } + }, + + /** + * The browser has successfully entered fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#fullscreenSuccessHandler + * @private + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#RESIZE + * @since 3.17.0 + */ + fullscreenSuccessHandler: function () + { + this.getParentBounds(); + + this.refresh(); + + this.emit(Events.ENTER_FULLSCREEN); + }, + + /** + * The browser failed to enter fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#fullscreenErrorHandler + * @private + * @fires Phaser.Scale.Events#FULLSCREEN_FAILED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.17.0 + * + * @param {any} error - The DOM error event. + */ + fullscreenErrorHandler: function (error) + { + this.removeFullscreenTarget(); + + this.emit(Events.FULLSCREEN_FAILED, error); + }, + + /** + * An internal method that gets the target element that is used when entering fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#getFullscreenTarget + * @since 3.16.0 + * + * @return {object} The fullscreen target element. + */ + getFullscreenTarget: function () + { + if (!this.fullscreenTarget) + { + var fsTarget = document.createElement('div'); + + fsTarget.style.margin = '0'; + fsTarget.style.padding = '0'; + fsTarget.style.width = '100%'; + fsTarget.style.height = '100%'; + + this.fullscreenTarget = fsTarget; + + this._createdFullscreenTarget = true; + } + + if (this._createdFullscreenTarget) + { + var canvasParent = this.canvas.parentNode; + + canvasParent.insertBefore(this.fullscreenTarget, this.canvas); + + this.fullscreenTarget.appendChild(this.canvas); + } + + return this.fullscreenTarget; + }, + + /** + * Removes the fullscreen target that was added to the DOM. + * + * @method Phaser.Scale.ScaleManager#removeFullscreenTarget + * @since 3.17.0 + */ + removeFullscreenTarget: function () + { + if (this._createdFullscreenTarget) + { + var fsTarget = this.fullscreenTarget; + + if (fsTarget && fsTarget.parentNode) + { + var parent = fsTarget.parentNode; + + parent.insertBefore(this.canvas, fsTarget); + + parent.removeChild(fsTarget); + } + } + }, + + /** + * Calling this method will cancel fullscreen mode, if the browser has entered it. + * + * @method Phaser.Scale.ScaleManager#stopFullscreen + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.16.0 + */ + stopFullscreen: function () + { + var fullscreen = this.fullscreen; + + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + + return false; + } + + if (fullscreen.active) + { + this._requestedFullscreenChange = true; + + document[fullscreen.cancel](); + } + + this.removeFullscreenTarget(); + + // Get the parent size again as it will have changed + this.getParentBounds(); + + this.emit(Events.LEAVE_FULLSCREEN); + + this.refresh(); + }, + + /** + * Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. + * If not in fullscreen, this will request the browser to enter fullscreen mode. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * @method Phaser.Scale.ScaleManager#toggleFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + toggleFullscreen: function (fullscreenOptions) + { + if (this.fullscreen.active) + { + this.stopFullscreen(); + } + else + { + this.startFullscreen(fullscreenOptions); + } + }, + + /** + * An internal method that starts the different DOM event listeners running. + * + * @method Phaser.Scale.ScaleManager#startListeners + * @since 3.16.0 + */ + startListeners: function () + { + var _this = this; + var listeners = this.listeners; + + listeners.orientationChange = function () + { + _this._checkOrientation = true; + _this.dirty = true; + }; + + listeners.windowResize = function () + { + _this.dirty = true; + }; + + // Only dispatched on mobile devices + window.addEventListener('orientationchange', listeners.orientationChange, false); + + window.addEventListener('resize', listeners.windowResize, false); + + if (this.fullscreen.available) + { + listeners.fullScreenChange = function (event) + { + return _this.onFullScreenChange(event); + }; + + listeners.fullScreenError = function (event) + { + return _this.onFullScreenError(event); + }; + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); + } + }, + + /** + * Triggered when a fullscreenchange event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenChange + * @since 3.16.0 + */ + onFullScreenChange: function () + { + // They pressed ESC while in fullscreen mode + if (!this._requestedFullscreenChange) + { + this.stopFullscreen(); + } + + this._requestedFullscreenChange = false; + }, + + /** + * Triggered when a fullscreenerror event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenError + * @since 3.16.0 + */ + onFullScreenError: function () + { + this.removeFullscreenTarget(); + }, + + /** + * Internal method, called automatically by the game step. + * Monitors the elapsed time and resize interval to see if a parent bounds check needs to take place. + * + * @method Phaser.Scale.ScaleManager#step + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + step: function (time, delta) + { + if (!this.parent) + { + return; + } + + this._lastCheck += delta; + + if (this.dirty || this._lastCheck > this.resizeInterval) + { + // Returns true if the parent bounds have changed size + if (this.getParentBounds()) + { + this.refresh(); + } + + this.dirty = false; + this._lastCheck = 0; + } + }, + + /** + * Stops all DOM event listeners. + * + * @method Phaser.Scale.ScaleManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var listeners = this.listeners; + + window.removeEventListener('orientationchange', listeners.orientationChange, false); + window.removeEventListener('resize', listeners.windowResize, false); + + var vendors = [ 'webkit', 'moz', '' ]; + + vendors.forEach(function (prefix) + { + document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); + + // MS Specific + document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); + }, + + /** + * Destroys this Scale Manager, releasing all references to external resources. + * Once destroyed, the Scale Manager cannot be used again. + * + * @method Phaser.Scale.ScaleManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); + + this.stopListeners(); + + this.game = null; + this.canvas = null; + this.canvasBounds = null; + this.parent = null; + this.parentSize.destroy(); + this.gameSize.destroy(); + this.baseSize.destroy(); + this.displaySize.destroy(); + this.fullscreenTarget = null; + }, + + /** + * Is the browser currently in fullscreen mode or not? + * + * @name Phaser.Scale.ScaleManager#isFullscreen + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isFullscreen: { + + get: function () + { + return this.fullscreen.active; + } + + }, + + /** + * The game width. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#width + * @type {number} + * @readonly + * @since 3.16.0 + */ + width: { + + get: function () + { + return this.gameSize.width; + } + + }, + + /** + * The game height. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#height + * @type {number} + * @readonly + * @since 3.16.0 + */ + height: { + + get: function () + { + return this.gameSize.height; + } + + }, + + /** + * Is the device in a portrait orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isPortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isPortrait: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.PORTRAIT); + } + + }, + + /** + * Is the device in a landscape orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isLandscape: { + + get: function () + { + return (this.orientation === CONST.ORIENTATION.LANDSCAPE); + } + + }, + + /** + * Are the game dimensions portrait? (i.e. taller than they are wide) + * + * This is different to the device itself being in a portrait orientation. + * + * @name Phaser.Scale.ScaleManager#isGamePortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGamePortrait: { + + get: function () + { + return (this.height > this.width); + } + + }, + + /** + * Are the game dimensions landscape? (i.e. wider than they are tall) + * + * This is different to the device itself being in a landscape orientation. + * + * @name Phaser.Scale.ScaleManager#isGameLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGameLandscape: { + + get: function () + { + return (this.width > this.height); + } + + } + +}); + +module.exports = ScaleManager; diff --git a/src/scale/const/CENTER_CONST.js b/src/scale/const/CENTER_CONST.js new file mode 100644 index 000000000..2298fb079 --- /dev/null +++ b/src/scale/const/CENTER_CONST.js @@ -0,0 +1,80 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * @namespace Phaser.Scale.Center + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for centering the game canvas. + * + * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}. + * + * @typedef {(Phaser.Scale.Center.NO_CENTER|Phaser.Scale.Center.CENTER_BOTH|Phaser.Scale.Center.CENTER_HORIZONTALLY|Phaser.Scale.Center.CENTER_VERTICALLY)} Phaser.Scale.CenterType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas is not centered within the parent by Phaser. + * You can still center it yourself via CSS. + * + * @name Phaser.Scale.Center.NO_CENTER + * @type {integer} + * @const + * @since 3.16.0 + */ + NO_CENTER: 0, + + /** + * The game canvas is centered both horizontally and vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_BOTH + * @type {integer} + * @const + * @since 3.16.0 + */ + CENTER_BOTH: 1, + + /** + * The game canvas is centered horizontally within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_HORIZONTALLY + * @type {integer} + * @const + * @since 3.16.0 + */ + CENTER_HORIZONTALLY: 2, + + /** + * The game canvas is centered both vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_VERTICALLY + * @type {integer} + * @const + * @since 3.16.0 + */ + CENTER_VERTICALLY: 3 + +}; diff --git a/src/scale/const/ORIENTATION_CONST.js b/src/scale/const/ORIENTATION_CONST.js new file mode 100644 index 000000000..e1b30c3fd --- /dev/null +++ b/src/scale/const/ORIENTATION_CONST.js @@ -0,0 +1,47 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * @namespace Phaser.Scale.Orientation + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for orientation. + * + * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}. + * + * @typedef {(Phaser.Scale.Orientation.LANDSCAPE|Phaser.Scale.Orientation.PORTRAIT)} Phaser.Scale.OrientationType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * A landscape orientation. + * + * @name Phaser.Scale.Orientation.LANDSCAPE + * @type {string} + * @const + * @since 3.16.0 + */ + LANDSCAPE: 'landscape-primary', + + /** + * A portrait orientation. + * + * @name Phaser.Scale.Orientation.PORTRAIT + * @type {string} + * @const + * @since 3.16.0 + */ + PORTRAIT: 'portrait-primary' + +}; diff --git a/src/scale/const/SCALE_MODE_CONST.js b/src/scale/const/SCALE_MODE_CONST.js new file mode 100644 index 000000000..172da66f1 --- /dev/null +++ b/src/scale/const/SCALE_MODE_CONST.js @@ -0,0 +1,92 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * @namespace Phaser.Scale.ScaleModes + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for the different scale modes available. + * + * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}. + * + * @typedef {(Phaser.Scale.ScaleModes.NONE|Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT|Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH|Phaser.Scale.ScaleModes.FIT|Phaser.Scale.ScaleModes.ENVELOP|Phaser.Scale.ScaleModes.RESIZE)} Phaser.Scale.ScaleModeType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it + * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need + * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. + * + * @name Phaser.Scale.ScaleModes.NONE + * @type {integer} + * @const + * @since 3.16.0 + */ + NONE: 0, + + /** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT + * @type {integer} + * @const + * @since 3.16.0 + */ + WIDTH_CONTROLS_HEIGHT: 1, + + /** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH + * @type {integer} + * @const + * @since 3.16.0 + */ + HEIGHT_CONTROLS_WIDTH: 2, + + /** + * The width and height are automatically adjusted to fit inside the given target area, + * while keeping the aspect ratio. Depending on the aspect ratio there may be some space + * inside the area which is not covered. + * + * @name Phaser.Scale.ScaleModes.FIT + * @type {integer} + * @const + * @since 3.16.0 + */ + FIT: 3, + + /** + * The width and height are automatically adjusted to make the size cover the entire target + * area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Scale.ScaleModes.ENVELOP + * @type {integer} + * @const + * @since 3.16.0 + */ + ENVELOP: 4, + + /** + * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. + * + * @name Phaser.Scale.ScaleModes.RESIZE + * @type {integer} + * @const + * @since 3.16.0 + */ + RESIZE: 5 + +}; diff --git a/src/scale/const/ZOOM_CONST.js b/src/scale/const/ZOOM_CONST.js new file mode 100644 index 000000000..5944a62b0 --- /dev/null +++ b/src/scale/const/ZOOM_CONST.js @@ -0,0 +1,68 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * @namespace Phaser.Scale.Zoom + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for zoom modes. + * + * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}. + * + * @typedef {(Phaser.Scale.Zoom.NO_ZOOM|Phaser.Scale.Zoom.ZOOM_2X|Phaser.Scale.Zoom.ZOOM_4X|Phaser.Scale.Zoom.MAX_ZOOM)} Phaser.Scale.ZoomType + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +module.exports = { + + /** + * The game canvas will not be zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.NO_ZOOM + * @type {integer} + * @const + * @since 3.16.0 + */ + NO_ZOOM: 1, + + /** + * The game canvas will be 2x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_2X + * @type {integer} + * @const + * @since 3.16.0 + */ + ZOOM_2X: 2, + + /** + * The game canvas will be 4x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_4X + * @type {integer} + * @const + * @since 3.16.0 + */ + ZOOM_4X: 4, + + /** + * Calculate the zoom value based on the maximum multiplied game size that will + * fit into the parent, or browser window if no parent is set. + * + * @name Phaser.Scale.Zoom.MAX_ZOOM + * @type {integer} + * @const + * @since 3.16.0 + */ + MAX_ZOOM: -1 + +}; diff --git a/src/scale/const/index.js b/src/scale/const/index.js new file mode 100644 index 000000000..1614dc15f --- /dev/null +++ b/src/scale/const/index.js @@ -0,0 +1,16 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CONST = { + + CENTER: require('./CENTER_CONST'), + ORIENTATION: require('./ORIENTATION_CONST'), + SCALE_MODE: require('./SCALE_MODE_CONST'), + ZOOM: require('./ZOOM_CONST') + +}; + +module.exports = CONST; diff --git a/src/scale/events/ENTER_FULLSCREEN_EVENT.js b/src/scale/events/ENTER_FULLSCREEN_EVENT.js new file mode 100644 index 000000000..fbe329f69 --- /dev/null +++ b/src/scale/events/ENTER_FULLSCREEN_EVENT.js @@ -0,0 +1,13 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager has successfully entered fullscreen mode. + * + * @event Phaser.Scale.Events#ENTER_FULLSCREEN + * @since 3.16.1 + */ +module.exports = 'enterfullscreen'; diff --git a/src/scale/events/FULLSCREEN_FAILED_EVENT.js b/src/scale/events/FULLSCREEN_FAILED_EVENT.js new file mode 100644 index 000000000..76236f6c1 --- /dev/null +++ b/src/scale/events/FULLSCREEN_FAILED_EVENT.js @@ -0,0 +1,13 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager tried to enter fullscreen mode but failed. + * + * @event Phaser.Scale.Events#FULLSCREEN_FAILED + * @since 3.17.0 + */ +module.exports = 'fullscreenfailed'; diff --git a/src/scale/events/FULLSCREEN_UNSUPPORTED_EVENT.js b/src/scale/events/FULLSCREEN_UNSUPPORTED_EVENT.js new file mode 100644 index 000000000..16c183c28 --- /dev/null +++ b/src/scale/events/FULLSCREEN_UNSUPPORTED_EVENT.js @@ -0,0 +1,13 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager tried to enter fullscreen mode, but it is unsupported by the browser. + * + * @event Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.16.1 + */ +module.exports = 'fullscreenunsupported'; diff --git a/src/scale/events/LEAVE_FULLSCREEN_EVENT.js b/src/scale/events/LEAVE_FULLSCREEN_EVENT.js new file mode 100644 index 000000000..50ca8b788 --- /dev/null +++ b/src/scale/events/LEAVE_FULLSCREEN_EVENT.js @@ -0,0 +1,14 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager was in fullscreen mode, but has since left, either directly via game code, + * or via a user gestured, such as pressing the ESC key. + * + * @event Phaser.Scale.Events#LEAVE_FULLSCREEN + * @since 3.16.1 + */ +module.exports = 'leavefullscreen'; diff --git a/src/scale/events/ORIENTATION_CHANGE_EVENT.js b/src/scale/events/ORIENTATION_CHANGE_EVENT.js new file mode 100644 index 000000000..749daf0ed --- /dev/null +++ b/src/scale/events/ORIENTATION_CHANGE_EVENT.js @@ -0,0 +1,15 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Orientation Change Event. + * + * @event Phaser.Scale.Events#ORIENTATION_CHANGE + * @since 3.16.1 + * + * @param {string} orientation - + */ +module.exports = 'orientationchange'; diff --git a/src/scale/events/RESIZE_EVENT.js b/src/scale/events/RESIZE_EVENT.js new file mode 100644 index 000000000..9e4062f15 --- /dev/null +++ b/src/scale/events/RESIZE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scale Manager Resize Event. + * + * This event is dispatched whenever the Scale Manager detects a resize event from the browser. + * It sends three parameters to the callback, each of them being Size components. You can read + * the `width`, `height`, `aspectRatio` and other properties of these components to help with + * scaling your own game content. + * + * @event Phaser.Scale.Events#RESIZE + * @since 3.16.1 + * + * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size multiplied by resolution. + * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. + */ +module.exports = 'resize'; diff --git a/src/scale/events/index.js b/src/scale/events/index.js new file mode 100644 index 000000000..e0dcf9eff --- /dev/null +++ b/src/scale/events/index.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scale.Events + */ + +module.exports = { + + ENTER_FULLSCREEN: require('./ENTER_FULLSCREEN_EVENT'), + FULLSCREEN_FAILED: require('./FULLSCREEN_FAILED_EVENT'), + FULLSCREEN_UNSUPPORTED: require('./FULLSCREEN_UNSUPPORTED_EVENT'), + LEAVE_FULLSCREEN: require('./LEAVE_FULLSCREEN_EVENT'), + ORIENTATION_CHANGE: require('./ORIENTATION_CHANGE_EVENT'), + RESIZE: require('./RESIZE_EVENT') + +}; diff --git a/src/scale/index.js b/src/scale/index.js new file mode 100644 index 000000000..702949930 --- /dev/null +++ b/src/scale/index.js @@ -0,0 +1,50 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Extend = require('../utils/object/Extend'); +var CONST = require('./const'); + +/** + * @namespace Phaser.Scale + * + * @borrows Phaser.Scale.Center.NO_CENTER as NO_CENTER + * @borrows Phaser.Scale.Center.CENTER_BOTH as CENTER_BOTH + * @borrows Phaser.Scale.Center.CENTER_HORIZONTALLY as CENTER_HORIZONTALLY + * @borrows Phaser.Scale.Center.CENTER_VERTICALLY as CENTER_VERTICALLY + * + * @borrows Phaser.Scale.Orientation.LANDSCAPE as LANDSCAPE + * @borrows Phaser.Scale.Orientation.PORTRAIT as PORTRAIT + * + * @borrows Phaser.Scale.ScaleModes.NONE as NONE + * @borrows Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT as WIDTH_CONTROLS_HEIGHT + * @borrows Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH as HEIGHT_CONTROLS_WIDTH + * @borrows Phaser.Scale.ScaleModes.FIT as FIT + * @borrows Phaser.Scale.ScaleModes.ENVELOP as ENVELOP + * @borrows Phaser.Scale.ScaleModes.RESIZE as RESIZE + * + * @borrows Phaser.Scale.Zoom.NO_ZOOM as NO_ZOOM + * @borrows Phaser.Scale.Zoom.ZOOM_2X as ZOOM_2X + * @borrows Phaser.Scale.Zoom.ZOOM_4X as ZOOM_4X + * @borrows Phaser.Scale.Zoom.MAX_ZOOM as MAX_ZOOM + */ + +var Scale = { + + Center: require('./const/CENTER_CONST'), + Events: require('./events'), + Orientation: require('./const/ORIENTATION_CONST'), + ScaleManager: require('./ScaleManager'), + ScaleModes: require('./const/SCALE_MODE_CONST'), + Zoom: require('./const/ZOOM_CONST') + +}; + +Scale = Extend(false, Scale, CONST.CENTER); +Scale = Extend(false, Scale, CONST.ORIENTATION); +Scale = Extend(false, Scale, CONST.SCALE_MODE); +Scale = Extend(false, Scale, CONST.ZOOM); + +module.exports = Scale; diff --git a/src/scene/GetPhysicsPlugins.js b/src/scene/GetPhysicsPlugins.js index 1125500b9..0df553936 100644 --- a/src/scene/GetPhysicsPlugins.js +++ b/src/scene/GetPhysicsPlugins.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/scene/GetScenePlugins.js b/src/scene/GetScenePlugins.js index d92fdb320..f10116648 100644 --- a/src/scene/GetScenePlugins.js +++ b/src/scene/GetScenePlugins.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/scene/InjectionMap.js b/src/scene/InjectionMap.js index a4c47f5d6..39205adc6 100644 --- a/src/scene/InjectionMap.js +++ b/src/scene/InjectionMap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/scene/Scene.js b/src/scene/Scene.js index 3162ffd99..7804d225c 100644 --- a/src/scene/Scene.js +++ b/src/scene/Scene.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,7 +16,7 @@ var Systems = require('./Systems'); * @constructor * @since 3.0.0 * - * @param {(string|Phaser.Scenes.Settings.Config)} config - Scene specific configuration settings. + * @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - Scene specific configuration settings. */ var Scene = new Class({ @@ -255,6 +255,16 @@ var Scene = new Class({ */ this.facebook; } + + /** + * A reference to the global Scale Manager. + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.2 + */ + this.scale; }, /** @@ -271,6 +281,30 @@ var Scene = new Class({ { } + /** + * Should be overridden by your own Scenes. + * + * @method Phaser.Scene#init + * @override + * @since 3.0.0 + */ + + /** + * Should be overridden by your own Scenes. + * + * @method Phaser.Scene#preload + * @override + * @since 3.0.0 + */ + + /** + * Should be overridden by your own Scenes. + * + * @method Phaser.Scene#create + * @override + * @since 3.0.0 + */ + }); module.exports = Scene; diff --git a/src/scene/SceneManager.js b/src/scene/SceneManager.js index 9fac22443..55af5487d 100644 --- a/src/scene/SceneManager.js +++ b/src/scene/SceneManager.js @@ -1,12 +1,15 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var CONST = require('./const'); +var Events = require('./events'); +var GameEvents = require('../core/events'); var GetValue = require('../utils/object/GetValue'); +var LoaderEvents = require('../loader/events'); var NOOP = require('../utils/NOOP'); var Scene = require('./Scene'); var Systems = require('./Systems'); @@ -152,7 +155,7 @@ var SceneManager = new Class({ } } - game.events.once('ready', this.bootQueue, this); + game.events.once(GameEvents.READY, this.bootQueue, this); }, /** @@ -309,7 +312,7 @@ var SceneManager = new Class({ * @since 3.0.0 * * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. - * @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene + * @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The config for the Scene * @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added. * @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`. * @@ -439,6 +442,7 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#bootScene * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to boot. @@ -456,7 +460,7 @@ var SceneManager = new Class({ if (settings.isTransition) { - sys.events.emit('transitioninit', settings.transitionFrom, settings.transitionDuration); + sys.events.emit(Events.TRANSITION_INIT, settings.transitionFrom, settings.transitionDuration); } } @@ -483,7 +487,7 @@ var SceneManager = new Class({ settings.status = CONST.LOADING; // Start the loader going as we have something in the queue - loader.once('complete', this.loadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.loadComplete, this); loader.start(); } @@ -510,7 +514,8 @@ var SceneManager = new Class({ { var scene = loader.scene; - // Try to unlock HTML5 sounds every time any loader completes + // TODO - Remove. This should *not* be handled here + // Try to unlock HTML5 sounds every time any loader completes if (this.game.sound.onBlurPausedSounds) { this.game.sound.unlock(); @@ -560,26 +565,6 @@ var SceneManager = new Class({ } }, - /** - * Informs the Scenes of the Game being resized. - * - * @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); - } - }, - /** * Renders the Scenes. * @@ -609,6 +594,8 @@ var SceneManager = new Class({ * * @method Phaser.Scenes.SceneManager#create * @private + * @fires Phaser.Scenes.Events#CREATE + * @fires Phaser.Scenes.Events#TRANSITION_INIT * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to create. @@ -623,11 +610,11 @@ var SceneManager = new Class({ settings.status = CONST.CREATING; scene.create.call(scene, settings.data); + } - if (settings.isTransition) - { - sys.events.emit('transitionstart', settings.transitionFrom, settings.transitionDuration); - } + if (settings.isTransition) + { + sys.events.emit(Events.TRANSITION_START, settings.transitionFrom, settings.transitionDuration); } // If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP @@ -637,6 +624,8 @@ var SceneManager = new Class({ } settings.status = CONST.RUNNING; + + sys.events.emit(Events.CREATE, scene); }, /** @@ -721,7 +710,7 @@ var SceneManager = new Class({ * @since 3.0.0 * * @param {string} key - The key of the Scene. - * @param {(string|Phaser.Scenes.Settings.Config)} sceneConfig - The Scene config. + * @param {(string|Phaser.Scenes.Types.SettingsConfig)} sceneConfig - The Scene config. * * @return {Phaser.Scene} The created Scene. */ @@ -799,7 +788,7 @@ var SceneManager = new Class({ * @since 3.0.0 * * @param {string} key - The key to check in the Scene config. - * @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The Scene config. + * @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The Scene config. * * @return {string} The Scene key. */ @@ -832,6 +821,41 @@ var SceneManager = new Class({ } }, + /** + * Returns an array of all the current Scenes being managed by this Scene Manager. + * + * You can filter the output by the active state of the Scene and choose to have + * the array returned in normal or reversed order. + * + * @method Phaser.Scenes.SceneManager#getScenes + * @since 3.16.0 + * + * @param {boolean} [isActive=true] - Only include Scene's that are currently active? + * @param {boolean} [inReverse=false] - Return the array of Scenes in reverse? + * + * @return {Phaser.Scene[]} An array containing all of the Scenes in the Scene Manager. + */ + getScenes: function (isActive, inReverse) + { + if (isActive === undefined) { isActive = true; } + if (inReverse === undefined) { inReverse = false; } + + var out = []; + var scenes = this.scenes; + + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; + + if (scene && (!isActive || (isActive && scene.sys.isActive()))) + { + out.push(scene); + } + } + + return (inReverse) ? out.reverse() : out; + }, + /** * Retrieves a Scene. * @@ -1130,7 +1154,7 @@ var SceneManager = new Class({ { scene.sys.settings.status = CONST.LOADING; - loader.once('complete', this.payloadComplete, this); + loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); loader.start(); diff --git a/src/scene/ScenePlugin.js b/src/scene/ScenePlugin.js index e48162406..c317dad3f 100644 --- a/src/scene/ScenePlugin.js +++ b/src/scene/ScenePlugin.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../math/Clamp'); var Class = require('../utils/Class'); +var Events = require('./events'); var GetFastValue = require('../utils/object/GetFastValue'); var PluginCache = require('../plugins/PluginCache'); @@ -48,7 +49,7 @@ var ScenePlugin = new Class({ * The settings of the Scene this ScenePlugin belongs to. * * @name Phaser.Scenes.ScenePlugin#settings - * @type {Phaser.Scenes.Settings.Object} + * @type {Phaser.Scenes.Types.SettingsObject} * @since 3.0.0 */ this.settings = scene.sys.settings; @@ -151,8 +152,8 @@ var ScenePlugin = new Class({ */ this._willRemove = false; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.pluginStart, this); + scene.sys.events.once(Events.BOOT, this.boot, this); + scene.sys.events.on(Events.START, this.pluginStart, this); }, /** @@ -165,7 +166,7 @@ var ScenePlugin = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(Events.DESTROY, this.destroy, this); }, /** @@ -181,7 +182,7 @@ var ScenePlugin = new Class({ { this._target = null; - this.systems.events.once('shutdown', this.shutdown, this); + this.systems.events.once(Events.SHUTDOWN, this.shutdown, this); }, /** @@ -225,20 +226,6 @@ var ScenePlugin = new Class({ return this; }, - /** - * @typedef {object} Phaser.Scenes.ScenePlugin.SceneTransitionConfig - * - * @property {string} target - The Scene key to transition to. - * @property {integer} [duration=1000] - The duration, in ms, for the transition to last. - * @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`) - * @property {boolean} [allowInput=false] - Will the Scenes Input system be able to process events while it is transitioning in or out? - * @property {boolean} [moveAbove] - Move the target Scene to be above this one before the transition starts. - * @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts. - * @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition. - * @property {any} [onUpdateScope] - The context in which the callback is invoked. - * @property {any} [data] - An object containing any data you wish to be passed to the target Scenes init / create methods. - */ - /** * This will start a transition from the current Scene to the target Scene given. * @@ -251,7 +238,7 @@ var ScenePlugin = new Class({ * * This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop. * - * There are also 5 transition related events: This scene will emit the event `transitionto` when + * There are also 5 transition related events: This scene will emit the event `transitionout` when * the transition begins, which is typically the frame after calling this method. * * The target Scene will emit the event `transitioninit` when that Scene's `init` method is called. @@ -270,9 +257,10 @@ var ScenePlugin = new Class({ * override this understand that until the target Scene completes it might never be unlocked for input events. * * @method Phaser.Scenes.ScenePlugin#transition + * @fires Phaser.Scenes.Events#TRANSITION_OUT * @since 3.5.0 * - * @param {Phaser.Scenes.ScenePlugin.SceneTransitionConfig} config - The transition configuration object. + * @param {Phaser.Scenes.Types.SceneTransitionConfig} config - The transition configuration object. * * @return {boolean} `true` is the transition was started, otherwise `false`. */ @@ -334,9 +322,9 @@ var ScenePlugin = new Class({ this.manager.start(key, GetFastValue(config, 'data')); } - this.systems.events.emit('transitionout', target, duration); + this.systems.events.emit(Events.TRANSITION_OUT, target, duration); - this.systems.events.on('update', this.step, this); + this.systems.events.on(Events.UPDATE, this.step, this); return true; }, @@ -396,6 +384,7 @@ var ScenePlugin = new Class({ * * @method Phaser.Scenes.ScenePlugin#transitionComplete * @private + * @fires Phaser.Scenes.Events#TRANSITION_COMPLETE * @since 3.5.0 */ transitionComplete: function () @@ -404,10 +393,10 @@ var ScenePlugin = new Class({ var targetSettings = this._target.sys.settings; // Stop the step - this.systems.events.off('update', this.step, this); + this.systems.events.off(Events.UPDATE, this.step, this); // Notify target scene - targetSys.events.emit('transitioncomplete', this.scene); + targetSys.events.emit(Events.TRANSITION_COMPLETE, this.scene); // Clear target scene settings targetSettings.isTransition = false; @@ -441,17 +430,15 @@ var ScenePlugin = new Class({ * @since 3.0.0 * * @param {string} key - The Scene key. - * @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene. + * @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The config for the Scene. * @param {boolean} autoStart - Whether to start the Scene after it's added. * @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`. * - * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. + * @return {Phaser.Scene} An instance of the Scene that was added to the Scene Manager. */ add: function (key, sceneConfig, autoStart, data) { - this.manager.add(key, sceneConfig, autoStart, data); - - return this; + return this.manager.add(key, sceneConfig, autoStart, data); }, /** @@ -608,7 +595,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#stop * @since 3.0.0 * - * @param {string} key - The Scene to stop. + * @param {string} [key] - The Scene to stop. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -678,7 +665,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isSleeping * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is sleeping. */ @@ -695,7 +682,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isActive * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is active. */ @@ -712,7 +699,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#isVisible * @since 3.0.0 * - * @param {string} key - The Scene to check. + * @param {string} [key] - The Scene to check. * * @return {boolean} Whether the Scene is visible. */ @@ -810,7 +797,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#remove * @since 3.2.0 * - * @param {(string|Phaser.Scene)} key - The Scene to be removed. + * @param {(string|Phaser.Scene)} [key] - The Scene to be removed. * * @return {Phaser.Scenes.SceneManager} This SceneManager. */ @@ -829,7 +816,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveUp * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -848,7 +835,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#moveDown * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -869,7 +856,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#bringToTop * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -890,7 +877,7 @@ var ScenePlugin = new Class({ * @method Phaser.Scenes.ScenePlugin#sendToBack * @since 3.0.0 * - * @param {string} key - The Scene to move. + * @param {string} [key] - The Scene to move. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ @@ -947,9 +934,9 @@ var ScenePlugin = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.off('shutdown', this.shutdown, this); - eventEmitter.off('postupdate', this.step, this); - eventEmitter.off('transitionout'); + eventEmitter.off(Events.SHUTDOWN, this.shutdown, this); + eventEmitter.off(Events.POST_UPDATE, this.step, this); + eventEmitter.off(Events.TRANSITION_OUT); }, /** @@ -964,7 +951,7 @@ var ScenePlugin = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(Events.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/scene/Settings.js b/src/scene/Settings.js index 2f338011a..228c9af37 100644 --- a/src/scene/Settings.js +++ b/src/scene/Settings.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,42 +13,6 @@ var InjectionMap = require('./InjectionMap'); * @namespace Phaser.Scenes.Settings */ -/** - * @typedef {object} Phaser.Scenes.Settings.Config - * - * @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance. - * @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step. - * @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step. - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins. - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object. - * @property {Object.} [map] - Overwrites the default injection map for a scene. - * @property {Object.} [mapAdd] - Extends the injection map for a scene. - * @property {object} [physics={}] - The physics configuration object for the Scene. - * @property {object} [loader={}] - The loader configuration object for the Scene. - * @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene. - */ - -/** - * @typedef {object} Phaser.Scenes.Settings.Object - * - * @property {number} status - The current status of the Scene. Maps to the Scene constants. - * @property {string} key - The unique key of this Scene. Unique within the entire Game instance. - * @property {boolean} active - The active state of this Scene. An active Scene updates each step. - * @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step. - * @property {boolean} isBooted - Has the Scene finished booting? - * @property {boolean} isTransition - Is the Scene in a state of transition? - * @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set. - * @property {integer} transitionDuration - The duration of the transition, if set. - * @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions? - * @property {object} data - a data bundle passed to this Scene from the Scene Manager. - * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins. - * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - The Camera configuration object. - * @property {Object.} map - The Scene's Injection Map. - * @property {object} physics - The physics configuration object for the Scene. - * @property {object} loader - The loader configuration object for the Scene. - * @property {(false|*)} plugins - The plugin configuration object for the Scene. - */ - var Settings = { /** @@ -57,9 +21,9 @@ var Settings = { * @function Phaser.Scenes.Settings.create * @since 3.0.0 * - * @param {(string|Phaser.Scenes.Settings.Config)} config - The Scene configuration object used to create this Scene Settings. + * @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - The Scene configuration object used to create this Scene Settings. * - * @return {Phaser.Scenes.Settings.Object} The Scene Settings object created as a result of the config and default settings. + * @return {Phaser.Scenes.Types.SettingsObject} The Scene Settings object created as a result of the config and default settings. */ create: function (config) { diff --git a/src/scene/Systems.js b/src/scene/Systems.js index ef07b5cd7..22a30d8a0 100644 --- a/src/scene/Systems.js +++ b/src/scene/Systems.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var CONST = require('./const'); var DefaultPlugins = require('../plugins/DefaultPlugins'); +var Events = require('./events'); var GetPhysicsPlugins = require('./GetPhysicsPlugins'); var GetScenePlugins = require('./GetScenePlugins'); var NOOP = require('../utils/NOOP'); @@ -26,7 +27,7 @@ var Settings = require('./Settings'); * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene that owns this Systems instance. - * @param {(string|Phaser.Scenes.Settings.Config)} config - Scene specific configuration settings. + * @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - Scene specific configuration settings. */ var Systems = new Class({ @@ -68,7 +69,7 @@ var Systems = new Class({ * The Scene Configuration object, as passed in when creating the Scene. * * @name Phaser.Scenes.Systems#config - * @type {(string|Phaser.Scenes.Settings.Config)} + * @type {(string|Phaser.Scenes.Types.SettingsConfig)} * @since 3.0.0 */ this.config = config; @@ -77,7 +78,7 @@ var Systems = new Class({ * The Scene Settings. This is the parsed output based on the Scene configuration. * * @name Phaser.Scenes.Systems#settings - * @type {Phaser.Scenes.Settings.Object} + * @type {Phaser.Scenes.Types.SettingsObject} * @since 3.0.0 */ this.settings = Settings.create(config); @@ -154,7 +155,7 @@ var Systems = new Class({ * In the default set-up you can access this from within a Scene via the `this.scale` property. * * @name Phaser.Scenes.Systems#scale - * @type {Phaser.DOM.ScaleManager} + * @type {Phaser.Scale.ScaleManager} * @since 3.15.0 */ this.scale; @@ -301,6 +302,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#init * @protected + * @fires Phaser.Scenes.Events#BOOT * @since 3.0.0 * * @param {Phaser.Game} game - A reference to the Phaser Game instance. @@ -323,7 +325,7 @@ var Systems = new Class({ pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]); - this.events.emit('boot', this); + this.events.emit(Events.BOOT, this); this.settings.isBooted = true; }, @@ -352,6 +354,9 @@ var Systems = new Class({ * Frame or Set Timeout call to the main Game instance. * * @method Phaser.Scenes.Systems#step + * @fires Phaser.Scenes.Events#PRE_UPDATE + * @fires Phaser.Scenes.Events#_UPDATE + * @fires Phaser.Scenes.Events#POST_UPDATE * @since 3.0.0 * * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). @@ -359,13 +364,13 @@ var Systems = new Class({ */ step: function (time, delta) { - this.events.emit('preupdate', time, delta); + this.events.emit(Events.PRE_UPDATE, time, delta); - this.events.emit('update', time, delta); + this.events.emit(Events.UPDATE, time, delta); this.sceneUpdate.call(this.scene, time, delta); - this.events.emit('postupdate', time, delta); + this.events.emit(Events.POST_UPDATE, time, delta); }, /** @@ -373,6 +378,7 @@ var Systems = new Class({ * Instructs the Scene to render itself via its Camera Manager to the renderer given. * * @method Phaser.Scenes.Systems#render + * @fires Phaser.Scenes.Events#RENDER * @since 3.0.0 * * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call. @@ -385,7 +391,7 @@ var Systems = new Class({ this.cameras.render(renderer, displayList); - this.events.emit('render', renderer); + this.events.emit(Events.RENDER, renderer); }, /** @@ -415,6 +421,7 @@ var Systems = new Class({ * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. * * @method Phaser.Scenes.Systems#pause + * @fires Phaser.Scenes.Events#PAUSE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'pause' event. @@ -429,7 +436,7 @@ var Systems = new Class({ this.settings.active = false; - this.events.emit('pause', this, data); + this.events.emit(Events.PAUSE, this, data); } return this; @@ -439,6 +446,7 @@ var Systems = new Class({ * Resume this Scene from a paused state. * * @method Phaser.Scenes.Systems#resume + * @fires Phaser.Scenes.Events#RESUME * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'resume' event. @@ -453,7 +461,7 @@ var Systems = new Class({ this.settings.active = true; - this.events.emit('resume', this, data); + this.events.emit(Events.RESUME, this, data); } return this; @@ -468,6 +476,7 @@ var Systems = new Class({ * from other Scenes may still invoke changes within it, so be careful what is left active. * * @method Phaser.Scenes.Systems#sleep + * @fires Phaser.Scenes.Events#SLEEP * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'sleep' event. @@ -481,7 +490,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('sleep', this, data); + this.events.emit(Events.SLEEP, this, data); return this; }, @@ -490,6 +499,7 @@ var Systems = new Class({ * Wake-up this Scene if it was previously asleep. * * @method Phaser.Scenes.Systems#wake + * @fires Phaser.Scenes.Events#WAKE * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'wake' event. @@ -505,11 +515,11 @@ var Systems = new Class({ settings.active = true; settings.visible = true; - this.events.emit('wake', this, data); + this.events.emit(Events.WAKE, this, data); if (settings.isTransition) { - this.events.emit('transitionwake', settings.transitionFrom, settings.transitionDuration); + this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); } return this; @@ -654,6 +664,8 @@ var Systems = new Class({ * Called automatically by the SceneManager. * * @method Phaser.Scenes.Systems#start + * @fires Phaser.Scenes.Events#START + * @fires Phaser.Scenes.Events#READY * @since 3.0.0 * * @param {object} data - Optional data object that may have been passed to this Scene from another. @@ -671,25 +683,10 @@ var Systems = new Class({ this.settings.visible = true; // For plugins to listen out for - this.events.emit('start', this); + this.events.emit(Events.START, this); // For user-land code to listen out for - this.events.emit('ready', this, data); - }, - - /** - * 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); + this.events.emit(Events.READY, this, data); }, /** @@ -700,23 +697,24 @@ var Systems = new Class({ * to free-up resources. * * @method Phaser.Scenes.Systems#shutdown + * @fires Phaser.Scenes.Events#SHUTDOWN * @since 3.0.0 * * @param {object} [data] - A data object that will be passed in the 'shutdown' event. */ shutdown: function (data) { - this.events.off('transitioninit'); - this.events.off('transitionstart'); - this.events.off('transitioncomplete'); - this.events.off('transitionout'); + this.events.off(Events.TRANSITION_INIT); + this.events.off(Events.TRANSITION_START); + this.events.off(Events.TRANSITION_COMPLETE); + this.events.off(Events.TRANSITION_OUT); this.settings.status = CONST.SHUTDOWN; this.settings.active = false; this.settings.visible = false; - this.events.emit('shutdown', this, data); + this.events.emit(Events.SHUTDOWN, this, data); }, /** @@ -726,6 +724,7 @@ var Systems = new Class({ * * @method Phaser.Scenes.Systems#destroy * @private + * @fires Phaser.Scenes.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -735,7 +734,7 @@ var Systems = new Class({ this.settings.active = false; this.settings.visible = false; - this.events.emit('destroy', this); + this.events.emit(Events.DESTROY, this); this.events.removeAllListeners(); diff --git a/src/scene/const.js b/src/scene/const.js index 952544faa..ffa803d4d 100644 --- a/src/scene/const.js +++ b/src/scene/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/scene/events/BOOT_EVENT.js b/src/scene/events/BOOT_EVENT.js new file mode 100644 index 000000000..2798027f4 --- /dev/null +++ b/src/scene/events/BOOT_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Boot Event. + * + * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('boot', listener)`. + * + * @event Phaser.Scenes.Events#BOOT + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'boot'; diff --git a/src/scene/events/CREATE_EVENT.js b/src/scene/events/CREATE_EVENT.js new file mode 100644 index 000000000..c61e7b88b --- /dev/null +++ b/src/scene/events/CREATE_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Create Event. + * + * This event is dispatched by a Scene after it has been created by the Scene Manager. + * + * If a Scene has a `create` method then this event is emitted _after_ that has run. + * + * If there is a transition, this event will be fired after the `TRANSITION_START` event. + * + * Listen to it from a Scene using `this.scene.events.on('create', listener)`. + * + * @event Phaser.Scenes.Events#CREATE + * @since 3.17.0 + * + * @param {Phaser.Scene} scene - A reference to the Scene that emitted this event. + */ +module.exports = 'create'; diff --git a/src/scene/events/DESTROY_EVENT.js b/src/scene/events/DESTROY_EVENT.js new file mode 100644 index 000000000..97202cbd6 --- /dev/null +++ b/src/scene/events/DESTROY_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Destroy Event. + * + * This event is dispatched by a Scene during the Scene Systems destroy process. + * + * Listen to it from a Scene using `this.scene.events.on('destroy', listener)`. + * + * You should destroy any resources that may be in use by your Scene in this event handler. + * + * @event Phaser.Scenes.Events#DESTROY + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'destroy'; diff --git a/src/scene/events/PAUSE_EVENT.js b/src/scene/events/PAUSE_EVENT.js new file mode 100644 index 000000000..c89e2c107 --- /dev/null +++ b/src/scene/events/PAUSE_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pause Event. + * + * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an + * action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('pause', listener)`. + * + * @event Phaser.Scenes.Events#PAUSE + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was paused. + */ +module.exports = 'pause'; diff --git a/src/scene/events/POST_UPDATE_EVENT.js b/src/scene/events/POST_UPDATE_EVENT.js new file mode 100644 index 000000000..8211216a1 --- /dev/null +++ b/src/scene/events/POST_UPDATE_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Post Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('postupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#POST_UPDATE + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'postupdate'; diff --git a/src/scene/events/PRE_UPDATE_EVENT.js b/src/scene/events/PRE_UPDATE_EVENT.js new file mode 100644 index 000000000..d085df475 --- /dev/null +++ b/src/scene/events/PRE_UPDATE_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Pre Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('preupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#PRE_UPDATE + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'preupdate'; diff --git a/src/scene/events/READY_EVENT.js b/src/scene/events/READY_EVENT.js new file mode 100644 index 000000000..76e8a67c9 --- /dev/null +++ b/src/scene/events/READY_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Ready Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. + * By this point in the process the Scene is now fully active and rendering. + * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event. + * + * Listen to it from a Scene using `this.scene.events.on('ready', listener)`. + * + * @event Phaser.Scenes.Events#READY + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was started. + */ +module.exports = 'ready'; diff --git a/src/scene/events/RENDER_EVENT.js b/src/scene/events/RENDER_EVENT.js new file mode 100644 index 000000000..b854d1968 --- /dev/null +++ b/src/scene/events/RENDER_EVENT.js @@ -0,0 +1,30 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Render Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('render', listener)`. + * + * A Scene will only render if it is visible and active. + * By the time this event is dispatched, the Scene will have already been rendered. + * + * @event Phaser.Scenes.Events#RENDER + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. + */ +module.exports = 'render'; diff --git a/src/scene/events/RESUME_EVENT.js b/src/scene/events/RESUME_EVENT.js new file mode 100644 index 000000000..89f64611b --- /dev/null +++ b/src/scene/events/RESUME_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Resume Event. + * + * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('resume', listener)`. + * + * @event Phaser.Scenes.Events#RESUME + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was resumed. + */ +module.exports = 'resume'; diff --git a/src/scene/events/SHUTDOWN_EVENT.js b/src/scene/events/SHUTDOWN_EVENT.js new file mode 100644 index 000000000..f9c0ecd30 --- /dev/null +++ b/src/scene/events/SHUTDOWN_EVENT.js @@ -0,0 +1,24 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Shutdown Event. + * + * This event is dispatched by a Scene during the Scene Systems shutdown process. + * + * Listen to it from a Scene using `this.scene.events.on('shutdown', listener)`. + * + * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding + * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not + * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources. + * + * @event Phaser.Scenes.Events#SHUTDOWN + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was shutdown. + */ +module.exports = 'shutdown'; diff --git a/src/scene/events/SLEEP_EVENT.js b/src/scene/events/SLEEP_EVENT.js new file mode 100644 index 000000000..9c8ee2e4a --- /dev/null +++ b/src/scene/events/SLEEP_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Sleep Event. + * + * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('sleep', listener)`. + * + * @event Phaser.Scenes.Events#SLEEP + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was sent to sleep. + */ +module.exports = 'sleep'; diff --git a/src/scene/events/START_EVENT.js b/src/scene/events/START_EVENT.js new file mode 100644 index 000000000..97a3bb7ac --- /dev/null +++ b/src/scene/events/START_EVENT.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Start Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.scene.events.on('start', listener)`. + * + * @event Phaser.Scenes.Events#START + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'start'; diff --git a/src/scene/events/TRANSITION_COMPLETE_EVENT.js b/src/scene/events/TRANSITION_COMPLETE_EVENT.js new file mode 100644 index 000000000..94019942d --- /dev/null +++ b/src/scene/events/TRANSITION_COMPLETE_EVENT.js @@ -0,0 +1,30 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Transition Complete Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration + * of the transition. + * + * Listen to it from a Scene using `this.scene.events.on('transitioncomplete', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_COMPLETE + * @since 3.5.0 + * + * @param {Phaser.Scene} scene -The Scene on which the transitioned completed. + */ +module.exports = 'transitioncomplete'; diff --git a/src/scene/events/TRANSITION_INIT_EVENT.js b/src/scene/events/TRANSITION_INIT_EVENT.js new file mode 100644 index 000000000..6fc607f10 --- /dev/null +++ b/src/scene/events/TRANSITION_INIT_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Transition Init Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method, + * this event is not dispatched. + * + * Listen to it from a Scene using `this.scene.events.on('transitioninit', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_INIT + * @since 3.5.0 + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitioninit'; diff --git a/src/scene/events/TRANSITION_OUT_EVENT.js b/src/scene/events/TRANSITION_OUT_EVENT.js new file mode 100644 index 000000000..953f6f921 --- /dev/null +++ b/src/scene/events/TRANSITION_OUT_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Transition Out Event. + * + * This event is dispatched by a Scene when it initiates a transition to another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('transitionout', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_OUT + * @since 3.5.0 + * + * @param {Phaser.Scene} target - A reference to the Scene that is being transitioned to. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitionout'; diff --git a/src/scene/events/TRANSITION_START_EVENT.js b/src/scene/events/TRANSITION_START_EVENT.js new file mode 100644 index 000000000..7d59fb548 --- /dev/null +++ b/src/scene/events/TRANSITION_START_EVENT.js @@ -0,0 +1,34 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Transition Start Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep. + * + * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method, + * this event is dispatched anyway. + * + * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is + * dispatched instead of this event. + * + * Listen to it from a Scene using `this.scene.events.on('transitionstart', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_START + * @since 3.5.0 + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitionstart'; diff --git a/src/scene/events/TRANSITION_WAKE_EVENT.js b/src/scene/events/TRANSITION_WAKE_EVENT.js new file mode 100644 index 000000000..aa36272f0 --- /dev/null +++ b/src/scene/events/TRANSITION_WAKE_EVENT.js @@ -0,0 +1,29 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Transition Wake Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before + * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead. + * + * Listen to it from a Scene using `this.scene.events.on('transitionwake', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_WAKE + * @since 3.5.0 + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitionwake'; diff --git a/src/scene/events/UPDATE_EVENT.js b/src/scene/events/UPDATE_EVENT.js new file mode 100644 index 000000000..46b927054 --- /dev/null +++ b/src/scene/events/UPDATE_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.scene.events.on('update', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#UPDATE + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; diff --git a/src/scene/events/WAKE_EVENT.js b/src/scene/events/WAKE_EVENT.js new file mode 100644 index 000000000..66104a603 --- /dev/null +++ b/src/scene/events/WAKE_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Scene Systems Wake Event. + * + * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.scene.events.on('wake', listener)`. + * + * @event Phaser.Scenes.Events#WAKE + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was woken up. + */ +module.exports = 'wake'; diff --git a/src/scene/events/index.js b/src/scene/events/index.js new file mode 100644 index 000000000..0645c79c9 --- /dev/null +++ b/src/scene/events/index.js @@ -0,0 +1,33 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scenes.Events + */ + +module.exports = { + + BOOT: require('./BOOT_EVENT'), + CREATE: require('./CREATE_EVENT'), + DESTROY: require('./DESTROY_EVENT'), + PAUSE: require('./PAUSE_EVENT'), + POST_UPDATE: require('./POST_UPDATE_EVENT'), + PRE_UPDATE: require('./PRE_UPDATE_EVENT'), + READY: require('./READY_EVENT'), + RENDER: require('./RENDER_EVENT'), + RESUME: require('./RESUME_EVENT'), + SHUTDOWN: require('./SHUTDOWN_EVENT'), + SLEEP: require('./SLEEP_EVENT'), + START: require('./START_EVENT'), + TRANSITION_COMPLETE: require('./TRANSITION_COMPLETE_EVENT'), + TRANSITION_INIT: require('./TRANSITION_INIT_EVENT'), + TRANSITION_OUT: require('./TRANSITION_OUT_EVENT'), + TRANSITION_START: require('./TRANSITION_START_EVENT'), + TRANSITION_WAKE: require('./TRANSITION_WAKE_EVENT'), + UPDATE: require('./UPDATE_EVENT'), + WAKE: require('./WAKE_EVENT') + +}; diff --git a/src/scene/index.js b/src/scene/index.js index 64842a1d4..9fd2118c4 100644 --- a/src/scene/index.js +++ b/src/scene/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -13,6 +13,7 @@ var Extend = require('../utils/object/Extend'); var Scene = { + Events: require('./events'), SceneManager: require('./SceneManager'), ScenePlugin: require('./ScenePlugin'), Settings: require('./Settings'), diff --git a/src/scene/typedefs/SceneTransitionConfig.js b/src/scene/typedefs/SceneTransitionConfig.js new file mode 100644 index 000000000..ac648839d --- /dev/null +++ b/src/scene/typedefs/SceneTransitionConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Scenes.Types.SceneTransitionConfig + * @since 3.5.0 + * + * @property {string} target - The Scene key to transition to. + * @property {integer} [duration=1000] - The duration, in ms, for the transition to last. + * @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`) + * @property {boolean} [allowInput=false] - Will the Scenes Input system be able to process events while it is transitioning in or out? + * @property {boolean} [moveAbove] - Move the target Scene to be above this one before the transition starts. + * @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts. + * @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition. + * @property {any} [onUpdateScope] - The context in which the callback is invoked. + * @property {any} [data] - An object containing any data you wish to be passed to the target Scenes init / create methods. + */ diff --git a/src/scene/typedefs/SettingsConfig.js b/src/scene/typedefs/SettingsConfig.js new file mode 100644 index 000000000..8ef97df96 --- /dev/null +++ b/src/scene/typedefs/SettingsConfig.js @@ -0,0 +1,15 @@ +/** + * @typedef {object} Phaser.Scenes.Types.SettingsConfig + * @since 3.0.0 + * + * @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance. + * @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step. + * @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins. + * @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object. + * @property {Object.} [map] - Overwrites the default injection map for a scene. + * @property {Object.} [mapAdd] - Extends the injection map for a scene. + * @property {object} [physics={}] - The physics configuration object for the Scene. + * @property {object} [loader={}] - The loader configuration object for the Scene. + * @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene. + */ diff --git a/src/scene/typedefs/SettingsObject.js b/src/scene/typedefs/SettingsObject.js new file mode 100644 index 000000000..b0d732d77 --- /dev/null +++ b/src/scene/typedefs/SettingsObject.js @@ -0,0 +1,21 @@ +/** + * @typedef {object} Phaser.Scenes.Types.SettingsObject + * @since 3.0.0 + * + * @property {number} status - The current status of the Scene. Maps to the Scene constants. + * @property {string} key - The unique key of this Scene. Unique within the entire Game instance. + * @property {boolean} active - The active state of this Scene. An active Scene updates each step. + * @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step. + * @property {boolean} isBooted - Has the Scene finished booting? + * @property {boolean} isTransition - Is the Scene in a state of transition? + * @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set. + * @property {integer} transitionDuration - The duration of the transition, if set. + * @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions? + * @property {object} data - a data bundle passed to this Scene from the Scene Manager. + * @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins. + * @property {?(Phaser.Cameras.Scene2D.Types.JSONCamera|Phaser.Cameras.Scene2D.Types.JSONCamera[])} cameras - The Camera configuration object. + * @property {Object.} map - The Scene's Injection Map. + * @property {object} physics - The physics configuration object for the Scene. + * @property {object} loader - The loader configuration object for the Scene. + * @property {(false|*)} plugins - The plugin configuration object for the Scene. + */ diff --git a/src/scene/typedefs/index.js b/src/scene/typedefs/index.js new file mode 100644 index 000000000..6ffe87ea3 --- /dev/null +++ b/src/scene/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Scenes.Types + */ diff --git a/src/sound/BaseSound.js b/src/sound/BaseSound.js index 759f8786a..649ada449 100644 --- a/src/sound/BaseSound.js +++ b/src/sound/BaseSound.js @@ -1,12 +1,13 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var Extend = require('../utils/object/Extend'); var NOOP = require('../utils/NOOP'); @@ -22,7 +23,7 @@ var NOOP = require('../utils/NOOP'); * * @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. + * @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings. */ var BaseSound = new Class({ @@ -115,7 +116,7 @@ var BaseSound = new Class({ * Default values will be set by properties' setters. * * @name Phaser.Sound.BaseSound#config - * @type {SoundConfig} + * @type {Phaser.Sound.Types.SoundConfig} * @private * @since 3.0.0 */ @@ -136,7 +137,7 @@ var BaseSound = new Class({ * It could be default config or marker config. * * @name Phaser.Sound.BaseSound#currentConfig - * @type {SoundConfig} + * @type {Phaser.Sound.Types.SoundConfig} * @private * @since 3.0.0 */ @@ -148,7 +149,7 @@ var BaseSound = new Class({ * Object containing markers definitions. * * @name Phaser.Sound.BaseSound#markers - * @type {Object.} + * @type {Object.} * @default {} * @readonly * @since 3.0.0 @@ -160,7 +161,7 @@ var BaseSound = new Class({ * 'null' if whole sound is playing. * * @name Phaser.Sound.BaseSound#currentMarker - * @type {SoundMarker} + * @type {Phaser.Sound.Types.SoundMarker} * @default null * @readonly * @since 3.0.0 @@ -231,7 +232,7 @@ var BaseSound = new Class({ * @method Phaser.Sound.BaseSound#updateMarker * @since 3.0.0 * - * @param {SoundMarker} marker - Marker object with updated values. + * @param {Phaser.Sound.Types.SoundMarker} marker - Marker object with updated values. * * @return {boolean} Whether the marker was updated successfully. */ @@ -263,7 +264,7 @@ var BaseSound = new Class({ * * @param {string} markerName - The name of the marker to remove. * - * @return {?SoundMarker} Removed marker object or 'null' if there was no marker with provided name. + * @return {?Phaser.Sound.Types.SoundMarker} Removed marker object or 'null' if there was no marker with provided name. */ removeMarker: function (markerName) { @@ -288,7 +289,7 @@ var BaseSound = new Class({ * @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. + * @param {Phaser.Sound.Types.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. */ @@ -465,6 +466,7 @@ var BaseSound = new Class({ * Destroys this sound and all associated events and marks it for removal from the sound manager. * * @method Phaser.Sound.BaseSound#destroy + * @fires Phaser.Sound.Events#DESTROY * @since 3.0.0 */ destroy: function () @@ -474,7 +476,7 @@ var BaseSound = new Class({ return; } - this.emit('destroy', this); + this.emit(Events.DESTROY, this); this.pendingRemove = true; this.manager = null; this.key = ''; diff --git a/src/sound/BaseSoundManager.js b/src/sound/BaseSoundManager.js index 607241b49..e6fff1ff6 100644 --- a/src/sound/BaseSoundManager.js +++ b/src/sound/BaseSoundManager.js @@ -1,32 +1,17 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var Clone = require('../utils/object/Clone'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); +var GameEvents = require('../core/events'); var NOOP = require('../utils/NOOP'); -/** - * @callback EachActiveSoundCallback - * - * @param {Phaser.Sound.BaseSoundManager} manager - The SoundManager - * @param {Phaser.Sound.BaseSound} sound - The current active Sound - * @param {number} index - The index of the current active Sound - * @param {Phaser.Sound.BaseSound[]} sounds - All sounds - */ - -/** - * Audio sprite sound type. - * - * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound - * - * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. - */ - /** * @classdesc * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback. @@ -162,7 +147,7 @@ var BaseSoundManager = new Class({ */ this.unlocked = false; - game.events.on('blur', function () + game.events.on(GameEvents.BLUR, function () { if (this.pauseOnBlur) { @@ -170,7 +155,7 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('focus', function () + game.events.on(GameEvents.FOCUS, function () { if (this.pauseOnBlur) { @@ -178,8 +163,8 @@ var BaseSoundManager = new Class({ } }, this); - game.events.on('prestep', this.update, this); - game.events.once('destroy', this.destroy, this); + game.events.on(GameEvents.PRE_STEP, this.update, this); + game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -190,7 +175,7 @@ var BaseSoundManager = new Class({ * @since 3.0.0 * * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings. * * @return {Phaser.Sound.BaseSound} The new sound instance. */ @@ -205,9 +190,9 @@ var BaseSoundManager = new Class({ * @since 3.0.0 * * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings. * - * @return {Phaser.Sound.BaseSound.AudioSpriteSound} The new audio sprite sound instance. + * @return {Phaser.Sound.Types.AudioSpriteSound} The new audio sprite sound instance. */ addAudioSprite: function (key, config) { @@ -246,10 +231,11 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#play + * @listens Phaser.Sound.Events#COMPLETE * @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 {(Phaser.Sound.Types.SoundConfig|Phaser.Sound.Types.SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. * * @return {boolean} Whether the sound started playing successfully. */ @@ -257,7 +243,7 @@ var BaseSoundManager = new Class({ { var sound = this.add(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); if (extra) { @@ -283,11 +269,12 @@ var BaseSoundManager = new Class({ * Sound will auto destroy once its playback ends. * * @method Phaser.Sound.BaseSoundManager#playAudioSprite + * @listens Phaser.Sound.Events#COMPLETE * @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 {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings. * * @return {boolean} Whether the audio sprite sound started playing successfully. */ @@ -295,7 +282,7 @@ var BaseSoundManager = new Class({ { var sound = this.addAudioSprite(key); - sound.once('ended', sound.destroy, sound); + sound.once(Events.COMPLETE, sound.destroy, sound); return sound.play(spriteName, config); }, @@ -359,16 +346,11 @@ var BaseSoundManager = new Class({ return removed; }, - /** - * @event Phaser.Sound.BaseSoundManager#pauseall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Pauses all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#pauseAll - * @fires Phaser.Sound.BaseSoundManager#pauseall + * @fires Phaser.Sound.Events#PAUSE_ALL * @since 3.0.0 */ pauseAll: function () @@ -378,19 +360,14 @@ var BaseSoundManager = new Class({ sound.pause(); }); - this.emit('pauseall', this); + this.emit(Events.PAUSE_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#resumeall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Resumes all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#resumeAll - * @fires Phaser.Sound.BaseSoundManager#resumeall + * @fires Phaser.Sound.Events#RESUME_ALL * @since 3.0.0 */ resumeAll: function () @@ -400,19 +377,14 @@ var BaseSoundManager = new Class({ sound.resume(); }); - this.emit('resumeall', this); + this.emit(Events.RESUME_ALL, this); }, - /** - * @event Phaser.Sound.BaseSoundManager#stopall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - /** * Stops all the sounds in the game. * * @method Phaser.Sound.BaseSoundManager#stopAll - * @fires Phaser.Sound.BaseSoundManager#stopall + * @fires Phaser.Sound.Events#STOP_ALL * @since 3.0.0 */ stopAll: function () @@ -422,7 +394,7 @@ var BaseSoundManager = new Class({ sound.stop(); }); - this.emit('stopall', this); + this.emit(Events.STOP_ALL, this); }, /** @@ -466,6 +438,7 @@ var BaseSoundManager = new Class({ * * @method Phaser.Sound.BaseSoundManager#update * @protected + * @fires Phaser.Sound.Events#UNLOCKED * @since 3.0.0 * * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. @@ -478,11 +451,7 @@ var BaseSoundManager = new Class({ 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); + this.emit(Events.UNLOCKED, this); } for (var i = this.sounds.length - 1; i >= 0; i--) @@ -527,7 +496,7 @@ var BaseSoundManager = new Class({ * @private * @since 3.0.0 * - * @param {EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void + * @param {Phaser.Sound.Types.EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void * @param {*} [scope] - Callback context. */ forEachActiveSound: function (callback, scope) @@ -543,12 +512,6 @@ var BaseSoundManager = new Class({ }); }, - /** - * @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. - */ - /** * Sets the global playback rate at which all the sounds will be played. * @@ -556,7 +519,7 @@ var BaseSoundManager = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.BaseSoundManager#setRate - * @fires Phaser.Sound.BaseSoundManager#rate + * @fires Phaser.Sound.Events#GLOBAL_RATE * @since 3.3.0 * * @param {number} value - Global playback rate at which all the sounds will be played. @@ -596,7 +559,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('rate', this, value); + this.emit(Events.GLOBAL_RATE, this, value); } }, @@ -606,7 +569,7 @@ var BaseSoundManager = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.BaseSoundManager#setDetune - * @fires Phaser.Sound.BaseSoundManager#detune + * @fires Phaser.Sound.Events#GLOBAL_DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -620,12 +583,6 @@ var BaseSoundManager = new Class({ return this; }, - /** - * @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. - */ - /** * 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). @@ -651,7 +608,7 @@ var BaseSoundManager = new Class({ sound.calculateRate(); }); - this.emit('detune', this, value); + this.emit(Events.GLOBAL_DETUNE, this, value); } } diff --git a/src/sound/SoundManagerCreator.js b/src/sound/SoundManagerCreator.js index 41dda90ec..12abb81b3 100644 --- a/src/sound/SoundManagerCreator.js +++ b/src/sound/SoundManagerCreator.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/sound/events/COMPLETE_EVENT.js b/src/sound/events/COMPLETE_EVENT.js new file mode 100644 index 000000000..37b5ebdf5 --- /dev/null +++ b/src/sound/events/COMPLETE_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Complete Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they complete playback. + * + * Listen to it from a Sound instance using `Sound.on('complete', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('complete', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#COMPLETE + * @since 3.16.1 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'complete'; diff --git a/src/sound/events/DESTROY_EVENT.js b/src/sound/events/DESTROY_EVENT.js new file mode 100644 index 000000000..3aec76361 --- /dev/null +++ b/src/sound/events/DESTROY_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Destroy Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are destroyed, either + * directly or via a Sound Manager. + * + * Listen to it from a Sound instance using `Sound.on('destroy', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('destroy', listener); + * music.destroy(); + * ``` + * + * @event Phaser.Sound.Events#DESTROY + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'destroy'; diff --git a/src/sound/events/DETUNE_EVENT.js b/src/sound/events/DETUNE_EVENT.js new file mode 100644 index 000000000..f3fdbae00 --- /dev/null +++ b/src/sound/events/DETUNE_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Detune Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their detune value changes. + * + * Listen to it from a Sound instance using `Sound.on('detune', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('detune', listener); + * music.play(); + * music.setDetune(200); + * ``` + * + * @event Phaser.Sound.Events#DETUNE + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'detune'; diff --git a/src/sound/events/GLOBAL_DETUNE_EVENT.js b/src/sound/events/GLOBAL_DETUNE_EVENT.js new file mode 100644 index 000000000..e7184a265 --- /dev/null +++ b/src/sound/events/GLOBAL_DETUNE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Detune Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `detune` property of the Sound Manager is changed, which globally + * adjusts the detuning of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_DETUNE + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} detune - The updated detune value. + */ +module.exports = 'detune'; diff --git a/src/sound/events/GLOBAL_MUTE_EVENT.js b/src/sound/events/GLOBAL_MUTE_EVENT.js new file mode 100644 index 000000000..4b64eb919 --- /dev/null +++ b/src/sound/events/GLOBAL_MUTE_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Mute Event. + * + * This event is dispatched by the Sound Manager when its `mute` property is changed, either directly + * or via the `setMute` method. This changes the mute state of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('mute', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_MUTE + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. + */ +module.exports = 'mute'; diff --git a/src/sound/events/GLOBAL_RATE_EVENT.js b/src/sound/events/GLOBAL_RATE_EVENT.js new file mode 100644 index 000000000..058a711ec --- /dev/null +++ b/src/sound/events/GLOBAL_RATE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Rate Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `rate` property of the Sound Manager is changed, which globally + * adjusts the playback rate of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_RATE + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} rate - The updated rate value. + */ +module.exports = 'rate'; diff --git a/src/sound/events/GLOBAL_VOLUME_EVENT.js b/src/sound/events/GLOBAL_VOLUME_EVENT.js new file mode 100644 index 000000000..cb7fc5171 --- /dev/null +++ b/src/sound/events/GLOBAL_VOLUME_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Global Volume Event. + * + * This event is dispatched by the Sound Manager when its `volume` property is changed, either directly + * or via the `setVolume` method. This changes the volume of all active sounds. + * + * Listen to it from a Scene using: `this.sound.on('volume', listener)`. + * + * @event Phaser.Sound.Events#GLOBAL_VOLUME + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {number} volume - The new global volume of the Sound Manager. + */ +module.exports = 'volume'; diff --git a/src/sound/events/LOOPED_EVENT.js b/src/sound/events/LOOPED_EVENT.js new file mode 100644 index 000000000..e4fdc86c5 --- /dev/null +++ b/src/sound/events/LOOPED_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Looped Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they loop during playback. + * + * Listen to it from a Sound instance using `Sound.on('looped', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('looped', listener); + * music.setLoop(true); + * music.play(); + * ``` + * + * This is not to be confused with the [LOOP]{@linkcode Phaser.Sound.Events#event:LOOP} event, which only emits when the loop state of a Sound is changed. + * + * @event Phaser.Sound.Events#LOOPED + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'looped'; diff --git a/src/sound/events/LOOP_EVENT.js b/src/sound/events/LOOP_EVENT.js new file mode 100644 index 000000000..81be5a9ec --- /dev/null +++ b/src/sound/events/LOOP_EVENT.js @@ -0,0 +1,28 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Loop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their loop state is changed. + * + * Listen to it from a Sound instance using `Sound.on('loop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('loop', listener); + * music.setLoop(true); + * ``` + * + * This is not to be confused with the [LOOPED]{@linkcode Phaser.Sound.Events#event:LOOPED} event, which emits each time a Sound loops during playback. + * + * @event Phaser.Sound.Events#LOOP + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} loop - The new loop value. `true` if the Sound will loop, otherwise `false`. + */ +module.exports = 'loop'; diff --git a/src/sound/events/MUTE_EVENT.js b/src/sound/events/MUTE_EVENT.js new file mode 100644 index 000000000..674e93ce9 --- /dev/null +++ b/src/sound/events/MUTE_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Mute Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their mute state changes. + * + * Listen to it from a Sound instance using `Sound.on('mute', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('mute', listener); + * music.play(); + * music.setMute(true); + * ``` + * + * @event Phaser.Sound.Events#MUTE + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound is now muted, otherwise `false`. + */ +module.exports = 'mute'; diff --git a/src/sound/events/PAUSE_ALL_EVENT.js b/src/sound/events/PAUSE_ALL_EVENT.js new file mode 100644 index 000000000..78c6d6467 --- /dev/null +++ b/src/sound/events/PAUSE_ALL_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Pause All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `pauseAll` method is invoked and after all current Sounds + * have been paused. + * + * Listen to it from a Scene using: `this.sound.on('pauseall', listener)`. + * + * @event Phaser.Sound.Events#PAUSE_ALL + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'pauseall'; diff --git a/src/sound/events/PAUSE_EVENT.js b/src/sound/events/PAUSE_EVENT.js new file mode 100644 index 000000000..cb1f68691 --- /dev/null +++ b/src/sound/events/PAUSE_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Pause Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are paused. + * + * Listen to it from a Sound instance using `Sound.on('pause', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('pause', listener); + * music.play(); + * music.pause(); + * ``` + * + * @event Phaser.Sound.Events#PAUSE + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'pause'; diff --git a/src/sound/events/PLAY_EVENT.js b/src/sound/events/PLAY_EVENT.js new file mode 100644 index 000000000..fec9ee112 --- /dev/null +++ b/src/sound/events/PLAY_EVENT.js @@ -0,0 +1,25 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Play Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are played. + * + * Listen to it from a Sound instance using `Sound.on('play', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('play', listener); + * music.play(); + * ``` + * + * @event Phaser.Sound.Events#PLAY + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'play'; diff --git a/src/sound/events/RATE_EVENT.js b/src/sound/events/RATE_EVENT.js new file mode 100644 index 000000000..ef81a3882 --- /dev/null +++ b/src/sound/events/RATE_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Rate Change Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their rate changes. + * + * Listen to it from a Sound instance using `Sound.on('rate', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('rate', listener); + * music.play(); + * music.setRate(0.5); + * ``` + * + * @event Phaser.Sound.Events#RATE + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} rate - The new rate of the Sound. + */ +module.exports = 'rate'; diff --git a/src/sound/events/RESUME_ALL_EVENT.js b/src/sound/events/RESUME_ALL_EVENT.js new file mode 100644 index 000000000..57042eaaf --- /dev/null +++ b/src/sound/events/RESUME_ALL_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Resume All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `resumeAll` method is invoked and after all current Sounds + * have been resumed. + * + * Listen to it from a Scene using: `this.sound.on('resumeall', listener)`. + * + * @event Phaser.Sound.Events#RESUME_ALL + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'resumeall'; diff --git a/src/sound/events/RESUME_EVENT.js b/src/sound/events/RESUME_EVENT.js new file mode 100644 index 000000000..39871f1f7 --- /dev/null +++ b/src/sound/events/RESUME_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Resume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are resumed from a paused state. + * + * Listen to it from a Sound instance using `Sound.on('resume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('resume', listener); + * music.play(); + * music.pause(); + * music.resume(); + * ``` + * + * @event Phaser.Sound.Events#RESUME + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'resume'; diff --git a/src/sound/events/SEEK_EVENT.js b/src/sound/events/SEEK_EVENT.js new file mode 100644 index 000000000..ca95f1800 --- /dev/null +++ b/src/sound/events/SEEK_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Seek Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are seeked to a new position. + * + * Listen to it from a Sound instance using `Sound.on('seek', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('seek', listener); + * music.play(); + * music.setSeek(5000); + * ``` + * + * @event Phaser.Sound.Events#SEEK + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. + */ +module.exports = 'seek'; diff --git a/src/sound/events/STOP_ALL_EVENT.js b/src/sound/events/STOP_ALL_EVENT.js new file mode 100644 index 000000000..3641215b2 --- /dev/null +++ b/src/sound/events/STOP_ALL_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Stop All Sounds Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `stopAll` method is invoked and after all current Sounds + * have been stopped. + * + * Listen to it from a Scene using: `this.sound.on('stopall', listener)`. + * + * @event Phaser.Sound.Events#STOP_ALL + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'stopall'; diff --git a/src/sound/events/STOP_EVENT.js b/src/sound/events/STOP_EVENT.js new file mode 100644 index 000000000..4a3c5b333 --- /dev/null +++ b/src/sound/events/STOP_EVENT.js @@ -0,0 +1,26 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Stop Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are stopped. + * + * Listen to it from a Sound instance using `Sound.on('stop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('stop', listener); + * music.play(); + * music.stop(); + * ``` + * + * @event Phaser.Sound.Events#STOP + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + */ +module.exports = 'stop'; diff --git a/src/sound/events/UNLOCKED_EVENT.js b/src/sound/events/UNLOCKED_EVENT.js new file mode 100644 index 000000000..5204a720c --- /dev/null +++ b/src/sound/events/UNLOCKED_EVENT.js @@ -0,0 +1,21 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Manager Unlocked Event. + * + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched during the update loop when the Sound Manager becomes unlocked. For + * Web Audio this is on the first user gesture on the page. + * + * Listen to it from a Scene using: `this.sound.on('unlocked', listener)`. + * + * @event Phaser.Sound.Events#UNLOCKED + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'unlocked'; diff --git a/src/sound/events/VOLUME_EVENT.js b/src/sound/events/VOLUME_EVENT.js new file mode 100644 index 000000000..e48f11f9c --- /dev/null +++ b/src/sound/events/VOLUME_EVENT.js @@ -0,0 +1,27 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Sound Volume Event. + * + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their volume changes. + * + * Listen to it from a Sound instance using `Sound.on('volume', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('volume', listener); + * music.play(); + * music.setVolume(0.5); + * ``` + * + * @event Phaser.Sound.Events#VOLUME + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} volume - The new volume of the Sound. + */ +module.exports = 'volume'; diff --git a/src/sound/events/index.js b/src/sound/events/index.js new file mode 100644 index 000000000..fc4cc6bd5 --- /dev/null +++ b/src/sound/events/index.js @@ -0,0 +1,35 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Sound.Events + */ + +module.exports = { + + COMPLETE: require('./COMPLETE_EVENT'), + DESTROY: require('./DESTROY_EVENT'), + DETUNE: require('./DETUNE_EVENT'), + GLOBAL_DETUNE: require('./GLOBAL_DETUNE_EVENT'), + GLOBAL_MUTE: require('./GLOBAL_MUTE_EVENT'), + GLOBAL_RATE: require('./GLOBAL_RATE_EVENT'), + GLOBAL_VOLUME: require('./GLOBAL_VOLUME_EVENT'), + LOOP: require('./LOOP_EVENT'), + LOOPED: require('./LOOPED_EVENT'), + MUTE: require('./MUTE_EVENT'), + PAUSE_ALL: require('./PAUSE_ALL_EVENT'), + PAUSE: require('./PAUSE_EVENT'), + PLAY: require('./PLAY_EVENT'), + RATE: require('./RATE_EVENT'), + RESUME_ALL: require('./RESUME_ALL_EVENT'), + RESUME: require('./RESUME_EVENT'), + SEEK: require('./SEEK_EVENT'), + STOP_ALL: require('./STOP_ALL_EVENT'), + STOP: require('./STOP_EVENT'), + UNLOCKED: require('./UNLOCKED_EVENT'), + VOLUME: require('./VOLUME_EVENT') + +}; diff --git a/src/sound/html5/HTML5AudioSound.js b/src/sound/html5/HTML5AudioSound.js index 49aa1ed22..d85ba4145 100644 --- a/src/sound/html5/HTML5AudioSound.js +++ b/src/sound/html5/HTML5AudioSound.js @@ -1,12 +1,13 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseSound = require('../BaseSound'); var Class = require('../../utils/Class'); +var Events = require('../events'); /** * @classdesc @@ -20,7 +21,7 @@ var Class = require('../../utils/Class'); * * @param {Phaser.Sound.HTML5AudioSoundManager} 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. + * @param {Phaser.Sound.Types.SoundConfig} [config={}] - An optional config object containing default sound settings. */ var HTML5AudioSound = new Class({ @@ -94,22 +95,17 @@ var HTML5AudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.HTML5AudioSound#playEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * 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.HTML5AudioSound#play - * @fires Phaser.Sound.HTML5AudioSound#playEvent + * @fires Phaser.Sound.Events#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. + * @param {Phaser.Sound.Types.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. */ @@ -131,21 +127,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#pauseEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.HTML5AudioSound#pause - * @fires Phaser.Sound.HTML5AudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -172,21 +163,16 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#resumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.HTML5AudioSound#resume - * @fires Phaser.Sound.HTML5AudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -214,21 +200,16 @@ var HTML5AudioSound = new Class({ return false; } - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.HTML5AudioSound#stopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.HTML5AudioSound#stop - * @fires Phaser.Sound.HTML5AudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -248,7 +229,7 @@ var HTML5AudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndReleaseAudioTag(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -457,22 +438,12 @@ var HTML5AudioSound = new Class({ this.pickAndPlayAudioTag(); }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.HTML5AudioSound#endedEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.HTML5AudioSound#update - * @fires Phaser.Sound.HTML5AudioSound#loopedEvent - * @fires Phaser.Sound.HTML5AudioSound#endedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -521,7 +492,7 @@ var HTML5AudioSound = new Class({ if (currentTime < this.previousTime) { - this.emit('looped', this); + this.emit(Events.LOOPED, this); } } else if (currentTime >= endTime) @@ -530,7 +501,7 @@ var HTML5AudioSound = new Class({ this.stopAndReleaseAudioTag(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); return; } @@ -604,12 +575,6 @@ var HTML5AudioSound = new Class({ } }, - /** - * @event Phaser.Sound.HTML5AudioSound#muteEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -617,6 +582,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -637,7 +603,7 @@ var HTML5AudioSound = new Class({ this.updateMute(); - this.emit('mute', this, value); + this.emit(Events.MUTE, this, value); } }, @@ -645,7 +611,7 @@ var HTML5AudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setMute - * @fires Phaser.Sound.HTML5AudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -659,18 +625,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#volumeEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.HTML5AudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -691,7 +652,7 @@ var HTML5AudioSound = new Class({ this.updateVolume(); - this.emit('volume', this, value); + this.emit(Events.VOLUME, this, value); } }, @@ -699,7 +660,7 @@ var HTML5AudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setVolume - * @fires Phaser.Sound.HTML5AudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -713,12 +674,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#rateEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -727,6 +682,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -740,7 +696,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.rate = value; - if (this.manager.isLocked(this, 'rate', value)) + if (this.manager.isLocked(this, Events.RATE, value)) { return; } @@ -748,7 +704,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } } @@ -761,7 +717,7 @@ var HTML5AudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.HTML5AudioSound#setRate - * @fires Phaser.Sound.HTML5AudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -775,12 +731,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#detuneEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -788,6 +738,7 @@ var HTML5AudioSound = new Class({ * @name Phaser.Sound.HTML5AudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -801,7 +752,7 @@ var HTML5AudioSound = new Class({ { this.currentConfig.detune = value; - if (this.manager.isLocked(this, 'detune', value)) + if (this.manager.isLocked(this, Events.DETUNE, value)) { return; } @@ -809,7 +760,7 @@ var HTML5AudioSound = new Class({ { this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } } @@ -820,7 +771,7 @@ var HTML5AudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.HTML5AudioSound#setDetune - * @fires Phaser.Sound.HTML5AudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -834,12 +785,6 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#seekEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -848,6 +793,7 @@ var HTML5AudioSound = new Class({ * * @name Phaser.Sound.HTML5AudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -894,7 +840,7 @@ var HTML5AudioSound = new Class({ this.currentConfig.seek = value; } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -903,7 +849,7 @@ var HTML5AudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.HTML5AudioSound#setSeek - * @fires Phaser.Sound.HTML5AudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -917,18 +863,13 @@ var HTML5AudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.HTML5AudioSound#loopEvent - * @param {Phaser.Sound.HTML5AudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.HTML5AudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -952,7 +893,7 @@ var HTML5AudioSound = new Class({ this.audio.loop = value; } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -961,7 +902,7 @@ var HTML5AudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.HTML5AudioSound#setLoop - * @fires Phaser.Sound.HTML5AudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. diff --git a/src/sound/html5/HTML5AudioSoundManager.js b/src/sound/html5/HTML5AudioSoundManager.js index 73d3581de..a78725ed1 100644 --- a/src/sound/html5/HTML5AudioSoundManager.js +++ b/src/sound/html5/HTML5AudioSoundManager.js @@ -1,12 +1,13 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseSoundManager = require('../BaseSoundManager'); var Class = require('../../utils/Class'); +var Events = require('../events'); var HTML5AudioSound = require('./HTML5AudioSound'); /** @@ -132,7 +133,7 @@ var HTML5AudioSoundManager = new Class({ * @since 3.0.0 * * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings. * * @return {Phaser.Sound.HTML5AudioSound} The new sound instance. */ @@ -238,7 +239,7 @@ var HTML5AudioSoundManager = new Class({ }); }; - this.once('unlocked', function () + this.once(Events.UNLOCKED, function () { this.forEachActiveSound(function (sound) { @@ -354,17 +355,11 @@ var HTML5AudioSoundManager = new Class({ return false; }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setMute - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -381,7 +376,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.HTML5AudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -400,22 +395,16 @@ var HTML5AudioSoundManager = new Class({ sound.updateMute(); }); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, this, value); } }, - /** - * @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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.HTML5AudioSoundManager#setVolume - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -432,7 +421,7 @@ var HTML5AudioSoundManager = new Class({ /** * @name Phaser.Sound.HTML5AudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.HTML5AudioSoundManager#volumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -451,7 +440,7 @@ var HTML5AudioSoundManager = new Class({ sound.updateVolume(); }); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } diff --git a/src/sound/index.js b/src/sound/index.js index 6c1695ed5..3d6bfcc11 100644 --- a/src/sound/index.js +++ b/src/sound/index.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -9,35 +9,12 @@ * @namespace Phaser.Sound */ -/** - * Config object containing various sound settings. - * - * @typedef {object} SoundConfig - * - * @property {boolean} [mute=false] - Boolean indicating whether the sound should be muted or not. - * @property {number} [volume=1] - A value between 0 (silence) and 1 (full volume). - * @property {number} [rate=1] - Defines the speed at which the sound should be played. - * @property {number} [detune=0] - Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * @property {number} [seek=0] - Position of playback for this sound, in seconds. - * @property {boolean} [loop=false] - Whether or not the sound or current sound marker should loop. - * @property {number} [delay=0] - Time, in seconds, that should elapse before the sound actually starts its playback. - */ - -/** - * Marked section of a sound represented by name, and optionally start time, duration, and config object. - * - * @typedef {object} SoundMarker - * - * @property {string} name - Unique identifier of a sound marker. - * @property {number} [start=0] - Sound position offset at witch playback should start. - * @property {number} [duration] - Playback duration of this marker. - * @property {SoundConfig} [config] - An optional config object containing default marker settings. - */ - module.exports = { SoundManagerCreator: require('./SoundManagerCreator'), + Events: require('./events'), + BaseSound: require('./BaseSound'), BaseSoundManager: require('./BaseSoundManager'), diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 1ecbab921..439b11152 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -27,7 +27,7 @@ var Extend = require('../../utils/object/Extend'); * * @param {Phaser.Sound.NoAudioSoundManager} 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. + * @param {Phaser.Sound.Types.SoundConfig} [config={}] - An optional config object containing default sound settings. */ var NoAudioSound = new Class({ diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 23aefee67..5aeaa0262 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -1,7 +1,7 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/sound/typedefs/AudioSpriteSound.js b/src/sound/typedefs/AudioSpriteSound.js new file mode 100644 index 000000000..fb6666880 --- /dev/null +++ b/src/sound/typedefs/AudioSpriteSound.js @@ -0,0 +1,8 @@ +/** + * Audio sprite sound type. + * + * @typedef {object} Phaser.Sound.Types.AudioSpriteSound + * @since 3.0.0 + * + * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. + */ diff --git a/src/sound/typedefs/EachActiveSoundCallback.js b/src/sound/typedefs/EachActiveSoundCallback.js new file mode 100644 index 000000000..53bfd66fd --- /dev/null +++ b/src/sound/typedefs/EachActiveSoundCallback.js @@ -0,0 +1,9 @@ +/** + * @callback Phaser.Sound.Types.EachActiveSoundCallback + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} manager - The SoundManager + * @param {Phaser.Sound.BaseSound} sound - The current active Sound + * @param {number} index - The index of the current active Sound + * @param {Phaser.Sound.BaseSound[]} sounds - All sounds + */ diff --git a/src/sound/typedefs/SoundConfig.js b/src/sound/typedefs/SoundConfig.js new file mode 100644 index 000000000..ee8823370 --- /dev/null +++ b/src/sound/typedefs/SoundConfig.js @@ -0,0 +1,14 @@ +/** + * Config object containing various sound settings. + * + * @typedef {object} Phaser.Sound.Types.SoundConfig + * @since 3.0.0 + * + * @property {boolean} [mute=false] - Boolean indicating whether the sound should be muted or not. + * @property {number} [volume=1] - A value between 0 (silence) and 1 (full volume). + * @property {number} [rate=1] - Defines the speed at which the sound should be played. + * @property {number} [detune=0] - Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * @property {number} [seek=0] - Position of playback for this sound, in seconds. + * @property {boolean} [loop=false] - Whether or not the sound or current sound marker should loop. + * @property {number} [delay=0] - Time, in seconds, that should elapse before the sound actually starts its playback. + */ diff --git a/src/sound/typedefs/SoundMarker.js b/src/sound/typedefs/SoundMarker.js new file mode 100644 index 000000000..94ffaadb1 --- /dev/null +++ b/src/sound/typedefs/SoundMarker.js @@ -0,0 +1,11 @@ +/** + * Marked section of a sound represented by name, and optionally start time, duration, and config object. + * + * @typedef {object} Phaser.Sound.Types.SoundMarker + * @since 3.0.0 + * + * @property {string} name - Unique identifier of a sound marker. + * @property {number} [start=0] - Sound position offset at witch playback should start. + * @property {number} [duration] - Playback duration of this marker. + * @property {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default marker settings. + */ diff --git a/src/sound/typedefs/index.js b/src/sound/typedefs/index.js new file mode 100644 index 000000000..728eed3ac --- /dev/null +++ b/src/sound/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Sound.Types + */ diff --git a/src/sound/webaudio/WebAudioSound.js b/src/sound/webaudio/WebAudioSound.js index 24da56c40..6d07186a4 100644 --- a/src/sound/webaudio/WebAudioSound.js +++ b/src/sound/webaudio/WebAudioSound.js @@ -1,12 +1,13 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseSound = require('../BaseSound'); var Class = require('../../utils/Class'); +var Events = require('../events'); /** * @classdesc @@ -20,7 +21,7 @@ var Class = require('../../utils/Class'); * * @param {Phaser.Sound.WebAudioSoundManager} 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. + * @param {Phaser.Sound.Types.SoundConfig} [config={}] - An optional config object containing default sound settings. */ var WebAudioSound = new Class({ @@ -175,11 +176,6 @@ var WebAudioSound = new Class({ BaseSound.call(this, manager, key, config); }, - /** - * @event Phaser.Sound.WebAudioSound#playEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Play this sound, or a marked section of it. * @@ -187,11 +183,11 @@ var WebAudioSound = new Class({ * you can set 'seek' setting of the config object, provided to this call, to that value. * * @method Phaser.Sound.WebAudioSound#play - * @fires Phaser.Sound.WebAudioSound#playEvent + * @fires Phaser.Sound.Events#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. + * @param {Phaser.Sound.Types.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. */ @@ -206,21 +202,16 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); this.createAndStartBufferSource(); - this.emit('play', this); + this.emit(Events.PLAY, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#pauseEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Pauses the sound. * * @method Phaser.Sound.WebAudioSound#pause - * @fires Phaser.Sound.WebAudioSound#pauseEvent + * @fires Phaser.Sound.Events#PAUSE * @since 3.0.0 * * @return {boolean} Whether the sound was paused successfully. @@ -241,21 +232,16 @@ var WebAudioSound = new Class({ this.currentConfig.seek = this.getCurrentTime(); // Equivalent to setting paused time this.stopAndRemoveBufferSource(); - this.emit('pause', this); + this.emit(Events.PAUSE, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#resumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Resumes the sound. * * @method Phaser.Sound.WebAudioSound#resume - * @fires Phaser.Sound.WebAudioSound#resumeEvent + * @fires Phaser.Sound.Events#RESUME * @since 3.0.0 * * @return {boolean} Whether the sound was resumed successfully. @@ -275,21 +261,16 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = true, isPaused = false \/\/\/ this.createAndStartBufferSource(); - this.emit('resume', this); + this.emit(Events.RESUME, this); return true; }, - /** - * @event Phaser.Sound.WebAudioSound#stopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - */ - /** * Stop playing this sound. * * @method Phaser.Sound.WebAudioSound#stop - * @fires Phaser.Sound.WebAudioSound#stopEvent + * @fires Phaser.Sound.Events#STOP * @since 3.0.0 * * @return {boolean} Whether the sound was stopped successfully. @@ -304,7 +285,7 @@ var WebAudioSound = new Class({ // \/\/\/ isPlaying = false, isPaused = false \/\/\/ this.stopAndRemoveBufferSource(); - this.emit('stop', this); + this.emit(Events.STOP, this); return true; }, @@ -453,22 +434,12 @@ var WebAudioSound = new Class({ BaseSound.prototype.applyConfig.call(this); }, - /** - * @event Phaser.Sound.WebAudioSound#endedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - - /** - * @event Phaser.Sound.WebAudioSound#loopedEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - */ - /** * Update method called automatically by sound manager on every game step. * * @method Phaser.Sound.WebAudioSound#update - * @fires Phaser.Sound.WebAudioSound#endedEvent - * @fires Phaser.Sound.WebAudioSound#loopedEvent + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED * @protected * @since 3.0.0 * @@ -486,7 +457,7 @@ var WebAudioSound = new Class({ this.stopAndRemoveBufferSource(); - this.emit('ended', this); + this.emit(Events.COMPLETE, this); } else if (this.hasLooped) { @@ -503,7 +474,7 @@ var WebAudioSound = new Class({ this.createAndStartLoopBufferSource(); - this.emit('looped', this); + this.emit(Events.LOOPED, this); } }, @@ -613,12 +584,6 @@ var WebAudioSound = new Class({ return this.playTime + lastRateUpdate.time + (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate; }, - /** - * @event Phaser.Sound.WebAudioSound#rateEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted the event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#rate property. - */ - /** * Rate at which this Sound will be played. * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed @@ -627,6 +592,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#rate * @type {number} * @default 1 + * @fires Phaser.Sound.Events#RATE * @since 3.0.0 */ rate: { @@ -642,7 +608,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('rate', this, value); + this.emit(Events.RATE, this, value); } }, @@ -654,7 +620,7 @@ var WebAudioSound = new Class({ * and 2.0 doubles the audios playback speed. * * @method Phaser.Sound.WebAudioSound#setRate - * @fires Phaser.Sound.WebAudioSound#rateEvent + * @fires Phaser.Sound.Events#RATE * @since 3.3.0 * * @param {number} value - The playback rate at of this Sound. @@ -668,12 +634,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#detuneEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the Sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#detune property. - */ - /** * The detune value of this Sound, given 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). @@ -681,6 +641,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#detune * @type {number} * @default 0 + * @fires Phaser.Sound.Events#DETUNE * @since 3.0.0 */ detune: { @@ -696,7 +657,7 @@ var WebAudioSound = new Class({ this.calculateRate(); - this.emit('detune', this, value); + this.emit(Events.DETUNE, this, value); } }, @@ -706,7 +667,7 @@ var WebAudioSound = new Class({ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). * * @method Phaser.Sound.WebAudioSound#setDetune - * @fires Phaser.Sound.WebAudioSound#detuneEvent + * @fires Phaser.Sound.Events#DETUNE * @since 3.3.0 * * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). @@ -720,12 +681,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#muteEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#mute property. - */ - /** * Boolean indicating whether the sound is muted or not. * Gets or sets the muted state of this sound. @@ -733,6 +688,7 @@ var WebAudioSound = new Class({ * @name Phaser.Sound.WebAudioSound#mute * @type {boolean} * @default false + * @fires Phaser.Sound.Events#MUTE * @since 3.0.0 */ mute: { @@ -747,7 +703,7 @@ var WebAudioSound = new Class({ this.currentConfig.mute = value; this.muteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.MUTE, this, value); } }, @@ -756,7 +712,7 @@ var WebAudioSound = new Class({ * Sets the muted state of this Sound. * * @method Phaser.Sound.WebAudioSound#setMute - * @fires Phaser.Sound.WebAudioSound#muteEvent + * @fires Phaser.Sound.Events#MUTE * @since 3.4.0 * * @param {boolean} value - `true` to mute this sound, `false` to unmute it. @@ -770,18 +726,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#volumeEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#volume property. - */ - /** * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). * * @name Phaser.Sound.WebAudioSound#volume * @type {number} * @default 1 + * @fires Phaser.Sound.Events#VOLUME * @since 3.0.0 */ volume: { @@ -796,7 +747,7 @@ var WebAudioSound = new Class({ this.currentConfig.volume = value; this.volumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.VOLUME, this, value); } }, @@ -804,7 +755,7 @@ var WebAudioSound = new Class({ * Sets the volume of this Sound. * * @method Phaser.Sound.WebAudioSound#setVolume - * @fires Phaser.Sound.WebAudioSound#volumeEvent + * @fires Phaser.Sound.Events#VOLUME * @since 3.4.0 * * @param {number} value - The volume of the sound. @@ -818,12 +769,6 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#seekEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSound#seek property. - */ - /** * Property representing the position of playback for this sound, in seconds. * Setting it to a specific value moves current playback to that position. @@ -832,6 +777,7 @@ var WebAudioSound = new Class({ * * @name Phaser.Sound.WebAudioSound#seek * @type {number} + * @fires Phaser.Sound.Events#SEEK * @since 3.0.0 */ seek: { @@ -876,7 +822,7 @@ var WebAudioSound = new Class({ this.createAndStartBufferSource(); } - this.emit('seek', this, value); + this.emit(Events.SEEK, this, value); } } }, @@ -885,7 +831,7 @@ var WebAudioSound = new Class({ * Seeks to a specific point in this sound. * * @method Phaser.Sound.WebAudioSound#setSeek - * @fires Phaser.Sound.WebAudioSound#seekEvent + * @fires Phaser.Sound.Events#SEEK * @since 3.4.0 * * @param {number} value - The point in the sound to seek to. @@ -899,18 +845,13 @@ var WebAudioSound = new Class({ return this; }, - /** - * @event Phaser.Sound.WebAudioSound#loopEvent - * @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSound#loop property. - */ - /** * Flag indicating whether or not the sound or current sound marker will loop. * * @name Phaser.Sound.WebAudioSound#loop * @type {boolean} * @default false + * @fires Phaser.Sound.Events#LOOP * @since 3.0.0 */ loop: { @@ -934,7 +875,7 @@ var WebAudioSound = new Class({ } } - this.emit('loop', this, value); + this.emit(Events.LOOP, this, value); } }, @@ -942,7 +883,7 @@ var WebAudioSound = new Class({ * Sets the loop state of this Sound. * * @method Phaser.Sound.WebAudioSound#setLoop - * @fires Phaser.Sound.WebAudioSound#loopEvent + * @fires Phaser.Sound.Events#LOOP * @since 3.4.0 * * @param {boolean} value - `true` to loop this sound, `false` to not loop it. diff --git a/src/sound/webaudio/WebAudioSoundManager.js b/src/sound/webaudio/WebAudioSoundManager.js index 15bbc5b33..73b0b1b72 100644 --- a/src/sound/webaudio/WebAudioSoundManager.js +++ b/src/sound/webaudio/WebAudioSoundManager.js @@ -1,12 +1,13 @@ /** * @author Richard Davey * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var BaseSoundManager = require('../BaseSoundManager'); var Class = require('../../utils/Class'); +var Events = require('../events'); var WebAudioSound = require('./WebAudioSound'); /** @@ -119,7 +120,7 @@ var WebAudioSoundManager = new Class({ * @since 3.0.0 * * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings. * * @return {Phaser.Sound.WebAudioSound} The new sound instance. */ @@ -146,14 +147,17 @@ var WebAudioSoundManager = new Class({ var unlockHandler = function unlockHandler () { - _this.context.resume().then(function () + if (_this.context) { - document.body.removeEventListener('touchstart', unlockHandler); - document.body.removeEventListener('touchend', unlockHandler); - document.body.removeEventListener('click', unlockHandler); - - _this.unlocked = true; - }); + _this.context.resume().then(function () + { + document.body.removeEventListener('touchstart', unlockHandler); + document.body.removeEventListener('touchend', unlockHandler); + document.body.removeEventListener('click', unlockHandler); + + _this.unlocked = true; + }); + } }; if (document.body) @@ -230,17 +234,11 @@ var WebAudioSoundManager = new Class({ BaseSoundManager.prototype.destroy.call(this); }, - /** - * @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. - */ - /** * Sets the muted state of all this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setMute - * @fires Phaser.Sound.WebAudioSoundManager#muteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.3.0 * * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. @@ -257,7 +255,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#mute * @type {boolean} - * @fires Phaser.Sound.WebAudioSoundManager#MuteEvent + * @fires Phaser.Sound.Events#GLOBAL_MUTE * @since 3.0.0 */ mute: { @@ -271,22 +269,16 @@ var WebAudioSoundManager = new Class({ { this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - this.emit('mute', this, value); + this.emit(Events.GLOBAL_MUTE, 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. - */ - /** * Sets the volume of this Sound Manager. * * @method Phaser.Sound.WebAudioSoundManager#setVolume - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.3.0 * * @param {number} value - The global volume of this Sound Manager. @@ -303,7 +295,7 @@ var WebAudioSoundManager = new Class({ /** * @name Phaser.Sound.WebAudioSoundManager#volume * @type {number} - * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ volume: { @@ -317,7 +309,7 @@ var WebAudioSoundManager = new Class({ { this.masterVolumeNode.gain.setValueAtTime(value, 0); - this.emit('volume', this, value); + this.emit(Events.GLOBAL_VOLUME, this, value); } } diff --git a/src/structs/List.js b/src/structs/List.js index 43188e855..4fb105911 100644 --- a/src/structs/List.js +++ b/src/structs/List.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,10 +10,9 @@ var NOOP = require('../utils/NOOP'); var StableSort = require('../utils/array/StableSort'); /** - * @callback EachListCallback - * @generic I - [item] + * @callback EachListCallback * - * @param {*} item - The item which is currently being processed. + * @param {I} item - The item which is currently being processed. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ @@ -184,9 +183,8 @@ var List = new Class({ }, /** - * Sort the contents of this List so the items are in order based - * on the given property. For example, `sort('alpha')` would sort the List - * contents based on the value of their `alpha` property. + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. * * @method Phaser.Structs.List#sort * @since 3.0.0 @@ -194,38 +192,28 @@ var List = new Class({ * @genericUse {T[]} - [children,$return] * * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. * * @return {Phaser.Structs.List} This List object. */ - sort: function (property) + sort: function (property, handler) { - if (property) + if (!property) { - this._sortKey = property; - - StableSort.inplace(this.list, this.sortHandler); + return this; } - return this; - }, + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } - /** - * Internal handler for the {@link #sort} method which compares two items. - * - * @method Phaser.Structs.List#sortHandler - * @private - * @since 3.4.0 - * - * @genericUse {T} - [childA,childB] - * - * @param {*} childA - The first item to compare. - * @param {*} childB - The second item to compare. - * - * @return {integer} The result of the comparison, which will be negative if the first item is smaller then second, positive if the first item is larger than the second, or 0 if they're equal. - */ - sortHandler: function (childA, childB) - { - return childA[this._sortKey] - childB[this._sortKey]; + StableSort.inplace(this.list, handler); + + return this; }, /** @@ -271,7 +259,6 @@ var List = new Class({ * @method Phaser.Structs.List#getFirst * @since 3.0.0 * - * @genericUse {T} - [value] * @genericUse {T | null} - [$return] * * @param {string} property - The name of the property to test or a falsey value to have no criterion. @@ -711,7 +698,7 @@ var List = new Class({ * * @name Phaser.Structs.List#first * @genericUse {T} - [$type] - * @type {*} The first item in the List or `null` for an empty List. + * @type {*} * @readonly * @since 3.0.0 */ @@ -738,7 +725,7 @@ var List = new Class({ * * @name Phaser.Structs.List#last * @genericUse {T} - [$type] - * @type {*} The last item in the List, or `null` for an empty List. + * @type {*} * @readonly * @since 3.0.0 */ @@ -767,7 +754,7 @@ var List = new Class({ * * @name Phaser.Structs.List#next * @genericUse {T} - [$type] - * @type {*} The next item in the List, or `null` if the entire List has been traversed. + * @type {*} * @readonly * @since 3.0.0 */ @@ -796,7 +783,7 @@ var List = new Class({ * * @name Phaser.Structs.List#previous * @genericUse {T} - [$type] - * @type {*} The previous item in the List, or `null` if the entire List has been traversed. + * @type {*} * @readonly * @since 3.0.0 */ diff --git a/src/structs/Map.js b/src/structs/Map.js index 7ade64572..8e3f3ebc1 100644 --- a/src/structs/Map.js +++ b/src/structs/Map.js @@ -1,17 +1,16 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); /** - * @callback EachMapCallback - * @generic E - [entry] + * @callback EachMapCallback * * @param {string} key - The key of the Map entry. - * @param {*} entry - The value of the Map entry. + * @param {E} entry - The value of the Map entry. * * @return {?boolean} The callback result. */ diff --git a/src/structs/ProcessQueue.js b/src/structs/ProcessQueue.js index 58df83a6a..43de8f43e 100644 --- a/src/structs/ProcessQueue.js +++ b/src/structs/ProcessQueue.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,7 +14,7 @@ var Class = require('../utils/Class'); * The `active` list is a selection of items which are considered active and should be updated. * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. * - * When new items are added to a Process Queue they are put in a pending data, rather than being added + * When new items are added to a Process Queue they are put in the pending list, rather than being added * immediately the active list. Equally, items that are removed are put into the destroy list, rather than * being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed * time, rather than at the time of the request from the API. diff --git a/src/structs/RTree.js b/src/structs/RTree.js index 62b10f675..f768d205f 100644 --- a/src/structs/RTree.js +++ b/src/structs/RTree.js @@ -1,6 +1,7 @@ /** + * @author Vladimir Agafonkin * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -16,6 +17,8 @@ var quickselect = require('../utils/array/QuickSelect'); * * This version of RBush uses a fixed min/max accessor structure of `[ '.left', '.top', '.right', '.bottom' ]`. * This is to avoid the eval like function creation that the original library used, which caused CSP policy violations. + * + * rbush is forked from https://github.com/mourner/rbush by Vladimir Agafonkin * * @class RTree * @memberof Phaser.Structs diff --git a/src/structs/Set.js b/src/structs/Set.js index 2c8a4656f..7a2cf2daa 100644 --- a/src/structs/Set.js +++ b/src/structs/Set.js @@ -1,16 +1,15 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); /** - * @callback EachSetCallback - * @generic E - [entry] + * @callback EachSetCallback * - * @param {*} entry - The Set entry. + * @param {E} entry - The Set entry. * @param {number} index - The index of the entry within the Set. * * @return {?boolean} The callback result. diff --git a/src/structs/Size.js b/src/structs/Size.js index 1b44d0471..58cba5b6d 100644 --- a/src/structs/Size.js +++ b/src/structs/Size.js @@ -1,11 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Clamp = require('../math/Clamp'); var Class = require('../utils/Class'); +var SnapFloor = require('../math/snap/SnapFloor'); +var Vector2 = require('../math/Vector2'); /** * @classdesc @@ -20,24 +22,24 @@ var Class = require('../utils/Class'); * @constructor * @since 3.16.0 * - * @param {number} [width] - The width of the Size component. + * @param {number} [width=0] - The width of the Size component. * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. - * @param {boolean} [lockAspectRatio=false] - Should the aspect ratio be locked? It will be based on the given `width` and `height` arguments. - * @param {boolean} [lockWidth=true] - Set to `true` to make the `width` the dominant axis, or `false` to make `height` the dominant axis. + * @param {integer} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ var Size = new Class({ initialize: - function Size (width, height, lockAspectRatio, lockWidth) + function Size (width, height, aspectMode, parent) { if (width === undefined) { width = 0; } if (height === undefined) { height = width; } - if (lockAspectRatio === undefined) { lockAspectRatio = false; } - if (lockWidth === undefined) { lockWidth = true; } + if (aspectMode === undefined) { aspectMode = 0; } + if (parent === undefined) { parent = null; } /** - * The width. + * Internal width value. * * @name Phaser.Structs.Size#_width * @type {number} @@ -47,7 +49,7 @@ var Size = new Class({ this._width = width; /** - * The height. + * Internal height value. * * @name Phaser.Structs.Size#_height * @type {number} @@ -56,121 +58,201 @@ var Size = new Class({ */ this._height = height; + /** + * Internal parent reference. + * + * @name Phaser.Structs.Size#_parent + * @type {any} + * @private + * @since 3.16.0 + */ + this._parent = parent; + + /** + * The aspect mode this Size component will use when calculating its dimensions. + * This property is read-only. To change it use the `setAspectMode` method. + * + * @name Phaser.Structs.Size#aspectMode + * @type {integer} + * @readonly + * @since 3.16.0 + */ + this.aspectMode = aspectMode; + /** * The proportional relationship between the width and height. * - * This property is read only and is updated automatically when either the `width` or `height` properties are changed, - * providing the aspect ratio lock isn't enabled. + * This property is read-only and is updated automatically when either the `width` or `height` properties are changed, + * depending on the aspect mode. * - * @name Phaser.Structs.Size#ratioH + * @name Phaser.Structs.Size#aspectRatio * @type {number} * @readonly * @since 3.16.0 */ - this.ratioH = (height === 0) ? 1 : width / height; - - /** - * The proportional relationship between the height and width. - * - * This property is read only and is updated automatically when either the `width` or `height` properties are changed, - * providing the aspect ratio lock isn't enabled. - * - * @name Phaser.Structs.Size#ratioV - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.ratioV = (width === 0) ? 1 : height / width; - - /** - * Set this property to lock the aspect ratios to their current values. - * - * Once enabled, changing the `width` or `height` properties will automatically adjust the other based on the aspect ratio. - * - * @name Phaser.Structs.Size#lockAspectRatio - * @type {boolean} - * @since 3.16.0 - */ - this.lockAspectRatio = lockAspectRatio; - - /** - * When scaling the Size based on the min-max range and the aspect ratio, this property controls the priority of - * the axis. If `true` (the default) the `width` will be the dominant axis, and the height will adjust to match it. If `false`, - * the `height` will be the dominant axis, and the `width` will adjust to match it. - * - * @name Phaser.Structs.Size#lockWidth - * @type {boolean} - * @default true - * @since 3.16.0 - */ - this.lockWidth = lockWidth; + this.aspectRatio = (height === 0) ? 1 : width / height; /** * The minimum allowed width. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. * - * @name Phaser.Structs.Size#_minWidth + * @name Phaser.Structs.Size#minWidth * @type {number} - * @private + * @readonly * @since 3.16.0 */ - this._minWidth = 0; + this.minWidth = 0; /** * The minimum allowed height. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. * - * @name Phaser.Structs.Size#_minHeight + * @name Phaser.Structs.Size#minHeight * @type {number} - * @private + * @readonly * @since 3.16.0 */ - this._minHeight = 0; + this.minHeight = 0; /** * The maximum allowed width. + * This value is read-only. To change it see the `setMax` method. * - * @name Phaser.Structs.Size#_maxWidth + * @name Phaser.Structs.Size#maxWidth * @type {number} - * @private + * @readonly * @since 3.16.0 */ - this._maxWidth = Number.MAX_VALUE; + this.maxWidth = Number.MAX_VALUE; /** * The maximum allowed height. + * This value is read-only. To change it see the `setMax` method. * - * @name Phaser.Structs.Size#_maxHeight + * @name Phaser.Structs.Size#maxHeight * @type {number} - * @private + * @readonly * @since 3.16.0 */ - this._maxHeight = Number.MAX_VALUE; + this.maxHeight = Number.MAX_VALUE; + + /** + * A Vector2 containing the horizontal and vertical snap values, which the width and height are snapped to during resizing. + * + * By default this is disabled. + * + * This property is read-only. To change it see the `setSnap` method. + * + * @name Phaser.Structs.Size#snapTo + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.snapTo = new Vector2(); }, /** - * Lock the aspect ratio to its current value? + * Sets the aspect mode of this Size component. * - * If enabled, changing the `width` or `height` properties will automatically adjust the other based on the aspect ratio. - * - * @method Phaser.Structs.Size#setAspectRatioLock + * The aspect mode controls what happens when you modify the `width` or `height` properties, or call `setSize`. + * + * It can be a number from 0 to 4, or a Size constant: + * + * 0. NONE = Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * 1. WIDTH_CONTROLS_HEIGHT = The height is automatically adjusted based on the width. + * 2. HEIGHT_CONTROLS_WIDTH = The width is automatically adjusted based on the height. + * 3. FIT = The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * 4. ENVELOP = The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setAspectMode * @since 3.16.0 * - * @param {boolean} value - `true` to enable the aspect ratio lock or `false` to disable it. + * @param {integer} [value=0] - The aspect mode value. * * @return {this} This Size component instance. */ - setAspectRatioLock: function (value) + setAspectMode: function (value) { - this.lockAspectRatio = value; + if (value === undefined) { value = 0; } - return this; + this.aspectMode = value; + + return this.setSize(this._width, this._height); + }, + + /** + * By setting a Snap To value when this Size component is modified its dimensions will automatically + * by snapped to the nearest grid slice, using floor. For example, if you have snap value of 16, + * and the width changes to 68, then it will snap down to 64 (the closest multiple of 16 when floored) + * + * Note that snapping takes place before adjustments by the parent, or the min / max settings. If these + * values are not multiples of the given snap values, then this can result in un-snapped dimensions. + * + * Call this method with no arguments to reset the snap values. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setSnap + * @since 3.16.0 + * + * @param {number} [snapWidth=0] - The amount to snap the width to. If you don't want to snap the width, pass a value of zero. + * @param {number} [snapHeight=snapWidth] - The amount to snap the height to. If not provided it will use the `snapWidth` value. If you don't want to snap the height, pass a value of zero. + * + * @return {this} This Size component instance. + */ + setSnap: function (snapWidth, snapHeight) + { + if (snapWidth === undefined) { snapWidth = 0; } + if (snapHeight === undefined) { snapHeight = snapWidth; } + + this.snapTo.set(snapWidth, snapHeight); + + return this.setSize(this._width, this._height); + }, + + /** + * Sets, or clears, the parent of this Size component. + * + * To clear the parent call this method with no arguments. + * + * The parent influences the maximum extents to which this Size compoent can expand, + * based on the aspect mode: + * + * NONE - The parent clamps both the width and height. + * WIDTH_CONTROLS_HEIGHT - The parent clamps just the width. + * HEIGHT_CONTROLS_WIDTH - The parent clamps just the height. + * FIT - The parent clamps whichever axis is required to ensure the size fits within it. + * ENVELOP - The parent is used to ensure the size fully envelops the parent. + * + * Calling this method automatically calls `setSize`. + * + * @method Phaser.Structs.Size#setParent + * @since 3.16.0 + * + * @param {any} [parent] - Sets the parent of this Size component. Don't provide a value to clear an existing parent. + * + * @return {this} This Size component instance. + */ + setParent: function (parent) + { + this._parent = parent; + + return this.setSize(this._width, this._height); }, /** * Set the minimum width and height values this Size component will allow. * - * If enabled, the properties will be clamped to the min-max range, including when locked to their aspect ratios. + * The minimum values can never be below zero, or greater than the maximum values. * * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the minimums set here + * _can_ be exceed in some situations. * * @method Phaser.Structs.Size#setMin * @since 3.16.0 @@ -185,18 +267,19 @@ var Size = new Class({ if (width === undefined) { width = 0; } if (height === undefined) { height = width; } - this._minWidth = width; - this._minHeight = height; + this.minWidth = Clamp(width, 0, this.maxWidth); + this.minHeight = Clamp(height, 0, this.maxHeight); - return this.update(); + return this.setSize(this._width, this._height); }, /** * Set the maximum width and height values this Size component will allow. * - * If enabled, the properties will be clamped to the min-max range, including when locked to their aspect ratios. - * * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the maximums set here + * _can_ be exceed in some situations. * * @method Phaser.Structs.Size#setMax * @since 3.16.0 @@ -211,147 +294,32 @@ var Size = new Class({ if (width === undefined) { width = Number.MAX_VALUE; } if (height === undefined) { height = width; } - this._maxWidth = width; - this._maxHeight = height; + this.maxWidth = Clamp(width, this.minWidth, Number.MAX_VALUE); + this.maxHeight = Clamp(height, this.minHeight, Number.MAX_VALUE); - return this.update(); - }, - - /** - * Calls `setSize` with the current width and height. - * This has the effect of applying min-max clamping and axis locking to the current values. - * - * @method Phaser.Structs.Size#update - * @since 3.16.0 - * - * @return {this} This Size component instance. - */ - update: function () - { return this.setSize(this._width, this._height); }, /** - * Updates the `ratioH` and `ratioV` properties based on the current width and height. + * Sets the width and height of this Size component based on the aspect mode. * - * They are only updated if `lockAspectRatio` is `false`. - * - * @method Phaser.Structs.Size#updateRatios - * @since 3.16.0 - * - * @return {this} This Size component instance. - */ - updateRatios: function () - { - if (!this.lockAspectRatio) - { - this.ratioH = (this._height === 0) ? 1 : this._width / this._height; - this.ratioV = (this._width === 0) ? 1 : this._height / this._width; - } - - return this; - }, - - /** - * Sets a new width for this Size component. + * If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current + * aspect ratio is honored across all other modes. * - * The new width is clamped to the min-max range automatically. + * If snapTo values have been set then the given width and height are snapped first, prior to any further + * adjustment via min/max values, or a parent. * - * Additionally, if the aspect ratio is locked, the height will also be adjusted based on the new width. - * - * @method Phaser.Structs.Size#updateWidth - * @since 3.16.0 + * If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into + * that range prior to adjustment, but may still exceed them depending on the aspect mode. * - * @param {number} width - The new width of the Size component. - * - * @return {this} This Size component instance. - */ - updateWidth: function (width) - { - width = Clamp(width, this._minWidth, this._maxWidth); - - if (this.lockAspectRatio) - { - // What's the new height? - var height = width * this.ratioV; - - // height takes priority - if (!this.lockWidth) - { - if (height < this._minHeight) - { - height = this._minHeight; - } - else if (height > this._maxHeight) - { - height = this._maxHeight; - } - - // Re-adjust the width based on the dominant height - width = height * this.ratioH; - } - } - - this._width = width; - this._height = height; - - return this.updateRatios(); - }, - - /** - * Sets a new height for this Size component. - * - * The new height is clamped to the min-max range automatically. - * - * Additionally, if the aspect ratio is locked, the width will also be adjusted based on the new height. - * - * @method Phaser.Structs.Size#updateHeight - * @since 3.16.0 - * - * @param {number} height - The new height of the Size component. - * - * @return {this} This Size component instance. - */ - updateHeight: function (height) - { - height = Clamp(height, this._minHeight, this._maxHeight); - - if (this.lockAspectRatio) - { - // What's the new width? - var width = height * this.ratioH; - - // width takes priority - if (this.lockWidth) - { - if (width < this._minWidth) - { - width = this._minWidth; - } - else if (width > this._maxWidth) - { - width = this._maxWidth; - } - - // Re-adjust the height based on the dominant width - height = width * this.ratioV; - } - } - - this._width = width; - this._height = height; - - return this.updateRatios(); - }, - - /** - * Set the width and height of this Size component, adjusting for the aspect ratio, if locked. + * If this Size component has a parent set, and the aspect mode is `fit` or `envelop`, then the given sizes will + * be clamped to the range specified by the parent. * * @method Phaser.Structs.Size#setSize * @since 3.16.0 * - * @param {number} [width] - The width of the Size component. - * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. * * @return {this} This Size component instance. */ @@ -359,140 +327,273 @@ var Size = new Class({ { if (width === undefined) { width = 0; } if (height === undefined) { height = width; } + + switch (this.aspectMode) + { + case Size.NONE: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + break; - return (this.lockWidth) ? this.updateWidth(width) : this.updateHeight(height); + case Size.WIDTH_CONTROLS_HEIGHT: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(this._width * (1 / this.aspectRatio), false); + break; + + case Size.HEIGHT_CONTROLS_WIDTH: + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this._width = this.getNewWidth(this._height * this.aspectRatio, false); + break; + + case Size.FIT: + this.constrain(width, height, true); + break; + + case Size.ENVELOP: + this.constrain(width, height, false); + break; + } + + return this; }, /** - * The `width` and `height` are adjusted to fit inside the given dimensions, while keeping the current aspect ratio, - * regardless if the aspect ratio is locked or not. + * Sets a new aspect ratio, overriding what was there previously. * - * There may be some space inside the parent area which is not covered if its aspect ratio differs. + * It then calls `setSize` immediately using the current dimensions. + * + * @method Phaser.Structs.Size#setAspectRatio + * @since 3.16.0 + * + * @param {number} ratio - The new aspect ratio. + * + * @return {this} This Size component instance. + */ + setAspectRatio: function (ratio) + { + this.aspectRatio = ratio; + + return this.setSize(this._width, this._height); + }, + + /** + * Sets a new width and height for this Size component and updates the aspect ratio based on them. + * + * It _doesn't_ change the `aspectMode` and still factors in size limits such as the min max and parent bounds. + * + * @method Phaser.Structs.Size#resize + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + resize: function (width, height) + { + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + + return this; + }, + + /** + * Takes a new width and passes it through the min/max clamp and then checks it doesn't exceed the parent width. + * + * @method Phaser.Structs.Size#getNewWidth + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified width value. + */ + getNewWidth: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minWidth, this.maxWidth); + + if (checkParent && this._parent && value > this._parent.width) + { + value = Math.max(this.minWidth, this._parent.width); + } + + return value; + }, + + /** + * Takes a new height and passes it through the min/max clamp and then checks it doesn't exceed the parent height. + * + * @method Phaser.Structs.Size#getNewHeight + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified height value. + */ + getNewHeight: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } + + value = Clamp(value, this.minHeight, this.maxHeight); + + if (checkParent && this._parent && value > this._parent.height) + { + value = Math.max(this.minHeight, this._parent.height); + } + + return value; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * If `fit` is true there may be some space inside the target area which is not covered if its aspect ratio differs. + * If `fit` is false the size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#constrain + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * @param {boolean} [fit=true] - Perform a `fit` (true) constraint, or an `envelop` (false) constraint. + * + * @return {this} This Size component instance. + */ + constrain: function (width, height, fit) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (fit === undefined) { fit = true; } + + width = this.getNewWidth(width); + height = this.getNewHeight(height); + + var snap = this.snapTo; + var newRatio = (height === 0) ? 1 : width / height; + + if ((fit && this.aspectRatio > newRatio) || (!fit && this.aspectRatio < newRatio)) + { + // We need to change the height to fit the width + // height = width / this.aspectRatio; + + width = SnapFloor(width, snap.x); + + height = width / this.aspectRatio; + + if (snap.y > 0) + { + height = SnapFloor(height, snap.y); + + // Reduce the width accordingly + width = height * this.aspectRatio; + } + } + else if ((fit && this.aspectRatio < newRatio) || (!fit && this.aspectRatio > newRatio)) + { + // We need to change the width to fit the height + // width = height * this.aspectRatio; + + height = SnapFloor(height, snap.y); + + width = height * this.aspectRatio; + + if (snap.x > 0) + { + width = SnapFloor(width, snap.x); + + // Reduce the height accordingly + height = width * (1 / this.aspectRatio); + } + } + + this._width = width; + this._height = height; + + return this; + }, + + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * There may be some space inside the target area which is not covered if its aspect ratio differs. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. * * @method Phaser.Structs.Size#fitTo * @since 3.16.0 * - * @param {number} width - The new width of the Size component. - * @param {number} height - The new height of the Size component. + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. * * @return {this} This Size component instance. */ fitTo: function (width, height) { - var newRatio = (height === 0) ? 1 : width / height; - - var newWidth = width; - var newHeight = height; - - if (this.ratioH > newRatio) - { - newHeight = width / this.ratioH; - } - else if (this.ratioH < newRatio) - { - newWidth = height * this.ratioH; - } - - this._width = newWidth; - this._height = newHeight; - - return this; + return this.constrain(width, height, true); }, /** - * The `width` and `height` are adjusted to fit inside the given dimensions, while keeping the current aspect ratio, - * regardless if the aspect ratio is locked or not. + * The current `width` and `height` are adjusted so that they fully envlop the given dimensions, while keeping the aspect ratio. * - * There may be some space inside the parent area which is not covered if its aspect ratio differs. + * The size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the values are clamped so that it never exceeds the parent + * on the longest axis. * - * @method Phaser.Structs.Size#fitTo + * @method Phaser.Structs.Size#envelop * @since 3.16.0 * - * @param {number} width - The new width of the Size component. - * @param {number} height - The new height of the Size component. + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. * * @return {this} This Size component instance. */ - envelope: function (width, height) + envelop: function (width, height) { - var newRatio = (height === 0) ? 1 : width / height; - - var newWidth = width; - var newHeight = height; - - if (this.ratioH > newRatio) - { - newWidth = height * this.ratioH; - } - else if (this.ratioH < newRatio) - { - newHeight = width / this.ratioH; - } - - this._width = newWidth; - this._height = newHeight; - - return this; + return this.constrain(width, height, false); }, /** * Sets the width of this Size component. * - * If the aspect ratio is locked, changing the width will also automatically update the height. + * Depending on the aspect mode, changing the width may also update the height and aspect ratio. * * @method Phaser.Structs.Size#setWidth * @since 3.16.0 * - * @param {number} width - The width of the Size component. + * @param {number} width - The new width of the Size component. * * @return {this} This Size component instance. */ setWidth: function (value) { - return this.updateWidth(value); - }, - - /** - * Gets the width of this Size component. - * - * @method Phaser.Structs.Size#getWidth - * @since 3.16.0 - * - * @return {number} The width of this Size component. - */ - getWidth: function () - { - return this._width; + return this.setSize(value, this._height); }, /** * Sets the height of this Size component. * - * If the aspect ratio is locked, changing the height will also automatically update the width. + * Depending on the aspect mode, changing the height may also update the width and aspect ratio. * * @method Phaser.Structs.Size#setHeight * @since 3.16.0 * - * @param {number} height - The height of the Size component. + * @param {number} height - The new height of the Size component. * * @return {this} This Size component instance. */ setHeight: function (value) { - return this.updateHeight(value); - }, - - /** - * Gets the height of this Size component. - * - * @method Phaser.Structs.Size#getHeight - * @since 3.16.0 - * - * @return {number} The height of this Size component. - */ - getHeight: function () - { - return this._height; + return this.setSize(this._width, value); }, /** @@ -505,7 +606,43 @@ var Size = new Class({ */ toString: function () { - return '[{ Size (width=' + this._width + ' height=' + this._height + ' ratioH=' + this.ratioH + ' ratioV=' + this.ratioV + ' lockAspectRatio=' + this.lockAspectRatio + ') }]'; + return '[{ Size (width=' + this._width + ' height=' + this._height + ' aspectRatio=' + this.aspectRatio + ' aspectMode=' + this.aspectMode + ') }]'; + }, + + /** + * Copies the aspect mode, aspect ratio, width and height from this Size component + * to the given Size component. Note that the parent, if set, is not copied across. + * + * @method Phaser.Structs.Size#copy + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} destination - The Size component to copy the values to. + * + * @return {Phaser.Structs.Size} The updated destination Size component. + */ + copy: function (destination) + { + destination.setAspectMode(this.aspectMode); + + destination.aspectRatio = this.aspectRatio; + + return destination.setSize(this.width, this.height); + }, + + /** + * Destroys this Size component. + * + * This clears the local properties and any parent object, if set. + * + * A destroyed Size component cannot be re-used. + * + * @method Phaser.Structs.Size#destroy + * @since 3.16.0 + */ + destroy: function () + { + this._parent = null; + this.snapTo = null; }, /** @@ -531,7 +668,7 @@ var Size = new Class({ set: function (value) { - this.updateWidth(value); + this.setSize(value, this._height); } }, @@ -559,11 +696,61 @@ var Size = new Class({ set: function (value) { - this.updateHeight(value); + this.setSize(this._width, value); } } }); +/** + * Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * + * @name Phaser.Structs.Size.NONE + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.NONE = 0; + +/** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.WIDTH_CONTROLS_HEIGHT = 1; + +/** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.HEIGHT_CONTROLS_WIDTH = 2; + +/** + * The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * + * @name Phaser.Structs.Size.FIT + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.FIT = 3; + +/** + * The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Structs.Size.ENVELOP + * @constant + * @type {integer} + * @since 3.16.0 + */ +Size.ENVELOP = 4; + module.exports = Size; diff --git a/src/structs/index.js b/src/structs/index.js index e3b2d2913..9df8a542b 100644 --- a/src/structs/index.js +++ b/src/structs/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/CanvasTexture.js b/src/textures/CanvasTexture.js index 71fd96f36..3d1c4642a 100644 --- a/src/textures/CanvasTexture.js +++ b/src/textures/CanvasTexture.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -321,15 +321,21 @@ var CanvasTexture = new Class({ * @param {ImageData} imageData - The ImageData to put at the given location. * @param {integer} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. * @param {integer} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {integer} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {integer} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {integer} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. * * @return {this} This CanvasTexture. */ - putData: function (imageData, x, y) + putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) { - x = Math.abs(Math.floor(x)); - y = Math.abs(Math.floor(y)); + if (dirtyX === undefined) { dirtyX = 0; } + if (dirtyY === undefined) { dirtyY = 0; } + if (dirtyWidth === undefined) { dirtyWidth = imageData.width; } + if (dirtyHeight === undefined) { dirtyHeight = imageData.height; } - this.context.putImageData(imageData, x, y); + this.context.putImageData(imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight); return this; }, @@ -343,8 +349,8 @@ var CanvasTexture = new Class({ * * @param {integer} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. * @param {integer} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} width - The width of the region to get. Must be an integer. - * @param {integer} height - The height of the region to get. Must be an integer. + * @param {integer} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {integer} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. * * @return {ImageData} The ImageData extracted from this CanvasTexture. */ @@ -399,17 +405,6 @@ var CanvasTexture = new Class({ return out; }, - /** - * An object containing the position and color data for a single pixel in a CanvasTexture. - * - * @typedef {object} Phaser.Textures.CanvasTexture.PixelConfig - * - * @property {integer} x - The x-coordinate of the pixel. - * @property {integer} y - The y-coordinate of the pixel. - * @property {integer} color - The color of the pixel, not including the alpha channel. - * @property {float} alpha - The alpha of the pixel, between 0 and 1. - */ - /** * Returns an array containing all of the pixels in the given region. * @@ -427,7 +422,7 @@ var CanvasTexture = new Class({ * @param {integer} width - The width of the region to get. Must be an integer. * @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. * - * @return {Phaser.Textures.CanvasTexture.PixelConfig[]} An array of Pixel objects. + * @return {Phaser.Textures.Types.PixelConfig[]} An array of Pixel objects. */ getPixels: function (x, y, width, height) { diff --git a/src/textures/Frame.js b/src/textures/Frame.js index cbdc2930f..a621d1ced 100644 --- a/src/textures/Frame.js +++ b/src/textures/Frame.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/Texture.js b/src/textures/Texture.js index 17a9a1174..5506b5849 100644 --- a/src/textures/Texture.js +++ b/src/textures/Texture.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/TextureManager.js b/src/textures/TextureManager.js index 60e2bf2b0..4a817de9c 100644 --- a/src/textures/TextureManager.js +++ b/src/textures/TextureManager.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -10,6 +10,8 @@ var Class = require('../utils/Class'); var Color = require('../display/color/Color'); var CONST = require('../const'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); +var GameEvents = require('../core/events'); var GenerateTexture = require('../create/GenerateTexture'); var GetValue = require('../utils/object/GetValue'); var Parser = require('./parsers'); @@ -109,7 +111,7 @@ var TextureManager = new Class({ */ this._pending = 0; - game.events.once('boot', this.boot, this); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -123,13 +125,13 @@ var TextureManager = new Class({ { this._pending = 2; - this.on('onload', this.updatePending, this); - this.on('onerror', this.updatePending, this); + this.on(Events.LOAD, this.updatePending, this); + this.on(Events.ERROR, this.updatePending, this); this.addBase64('__DEFAULT', this.game.config.defaultImage); this.addBase64('__MISSING', this.game.config.missingImage); - this.game.events.once('destroy', this.destroy, this); + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** @@ -145,10 +147,10 @@ var TextureManager = new Class({ if (this._pending === 0) { - this.off('onload'); - this.off('onerror'); + this.off(Events.LOAD); + this.off(Events.ERROR); - this.game.events.emit('texturesready'); + this.emit(Events.READY); } }, @@ -186,6 +188,7 @@ var TextureManager = new Class({ * step when clearing down to avoid this. * * @method Phaser.Textures.TextureManager#remove + * @fires Phaser.Textures.Events#REMOVE * @since 3.7.0 * * @param {(string|Phaser.Textures.Texture)} key - The key of the Texture to remove, or a reference to it. @@ -214,7 +217,7 @@ var TextureManager = new Class({ key.destroy(); - this.emit('removetexture', key.key); + this.emit(Events.REMOVE, key.key); } return this; @@ -224,6 +227,9 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * * @method Phaser.Textures.TextureManager#addBase64 + * @fires Phaser.Textures.Events#ADD + * @fires Phaser.Textures.Events#ERROR + * @fires Phaser.Textures.Events#LOAD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -241,7 +247,7 @@ var TextureManager = new Class({ image.onerror = function () { - _this.emit('onerror', key); + _this.emit(Events.ERROR, key); }; image.onload = function () @@ -250,9 +256,9 @@ var TextureManager = new Class({ Parser.Image(texture, 0); - _this.emit('addtexture', key, texture); + _this.emit(Events.ADD, key, texture); - _this.emit('onload', key, texture); + _this.emit(Events.LOAD, key, texture); }; image.src = data; @@ -316,6 +322,7 @@ var TextureManager = new Class({ * Adds a new Texture to the Texture Manager created from the given Image element. * * @method Phaser.Textures.TextureManager#addImage + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -339,7 +346,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -350,6 +357,7 @@ var TextureManager = new Class({ * This allows you to then use the Render Texture as a normal texture for texture based Game Objects like Sprites. * * @method Phaser.Textures.TextureManager#addRenderTexture + * @fires Phaser.Textures.Events#ADD * @since 3.12.0 * * @param {string} key - The unique string-based key of the Texture. @@ -367,7 +375,7 @@ var TextureManager = new Class({ texture.add('__BASE', 0, 0, 0, renderTexture.width, renderTexture.height); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -414,7 +422,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {integer} [width=256]- The width of the Canvas element. + * @param {integer} [width=256] - The width of the Canvas element. * @param {integer} [height=256] - The height of the Canvas element. * * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. @@ -439,6 +447,7 @@ var TextureManager = new Class({ * and adds it to this Texture Manager, unless `skipCache` is true. * * @method Phaser.Textures.TextureManager#addCanvas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -463,7 +472,7 @@ var TextureManager = new Class({ this.list[key] = texture; - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -502,6 +511,7 @@ var TextureManager = new Class({ * This is known as a JSON Array in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONArray + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -542,7 +552,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -554,6 +564,7 @@ var TextureManager = new Class({ * This is known as a JSON Hash in software such as Texture Packer. * * @method Phaser.Textures.TextureManager#addAtlasJSONHash + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -588,7 +599,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -599,6 +610,7 @@ var TextureManager = new Class({ * in the XML format. * * @method Phaser.Textures.TextureManager#addAtlasXML + * @fires Phaser.Textures.Events#ADD * @since 3.7.0 * * @param {string} key - The unique string-based key of the Texture. @@ -623,7 +635,7 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; @@ -634,6 +646,7 @@ var TextureManager = new Class({ * The data must be in the form of a Unity YAML file. * * @method Phaser.Textures.TextureManager#addUnityAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. @@ -658,23 +671,12 @@ var TextureManager = new Class({ texture.setDataSource(dataSource); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; }, - /** - * @typedef {object} SpriteSheetConfig - * - * @property {integer} frameWidth - The fixed width of each frame. - * @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height. - * @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture. - * @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames". - * @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here. - * @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. - */ - /** * Adds a Sprite Sheet to this Texture Manager. * @@ -682,11 +684,12 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheet + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. - * @param {SpriteSheetConfig} config - The configuration object for this Sprite Sheet. + * @param {Phaser.Textures.Types.SpriteSheetConfig} config - The configuration object for this Sprite Sheet. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -703,25 +706,12 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, 0, 0, width, height, config); - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); } return texture; }, - /** - * @typedef {object} SpriteSheetFromAtlasConfig - * - * @property {string} atlas - The key of the Texture Atlas in which this Sprite Sheet can be found. - * @property {string} frame - The key of the Texture Atlas Frame in which this Sprite Sheet can be found. - * @property {integer} frameWidth - The fixed width of each frame. - * @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height. - * @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture. - * @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames". - * @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here. - * @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. - */ - /** * Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas. * @@ -729,10 +719,11 @@ var TextureManager = new Class({ * same size and cannot be trimmed or rotated. * * @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {SpriteSheetFromAtlasConfig} config - The configuration object for this Sprite Sheet. + * @param {Phaser.Textures.Types.SpriteSheetFromAtlasConfig} config - The configuration object for this Sprite Sheet. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -768,7 +759,7 @@ var TextureManager = new Class({ Parser.SpriteSheet(texture, 0, sheet.cutX, sheet.cutY, sheet.cutWidth, sheet.cutHeight, config); } - this.emit('addtexture', key, texture); + this.emit(Events.ADD, key, texture); return texture; } diff --git a/src/textures/TextureSource.js b/src/textures/TextureSource.js index 4bc0c4908..efa23170c 100644 --- a/src/textures/TextureSource.js +++ b/src/textures/TextureSource.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/const.js b/src/textures/const.js index 8ea18b883..ca08d5128 100644 --- a/src/textures/const.js +++ b/src/textures/const.js @@ -1,16 +1,14 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Filter Types. * - * @name Phaser.Textures.FilterMode - * @enum {integer} + * @namespace Phaser.Textures.FilterMode * @memberof Phaser.Textures - * @readonly * @since 3.0.0 */ var CONST = { @@ -19,6 +17,9 @@ var CONST = { * Linear filter type. * * @name Phaser.Textures.FilterMode.LINEAR + * @type {integer} + * @const + * @since 3.0.0 */ LINEAR: 0, @@ -26,6 +27,9 @@ var CONST = { * Nearest neighbor filter type. * * @name Phaser.Textures.FilterMode.NEAREST + * @type {integer} + * @const + * @since 3.0.0 */ NEAREST: 1 diff --git a/src/textures/events/ADD_EVENT.js b/src/textures/events/ADD_EVENT.js new file mode 100644 index 000000000..9d687ff1a --- /dev/null +++ b/src/textures/events/ADD_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Add Event. + * + * This event is dispatched by the Texture Manager when a texture is added to it. + * + * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`. + * + * @event Phaser.Textures.Events#ADD + * @since 3.0.0 + * + * @param {string} key - The key of the Texture that was added to the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. + */ +module.exports = 'addtexture'; diff --git a/src/textures/events/ERROR_EVENT.js b/src/textures/events/ERROR_EVENT.js new file mode 100644 index 000000000..76a991fc1 --- /dev/null +++ b/src/textures/events/ERROR_EVENT.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Error Event. + * + * This event is dispatched by the Texture Manager when a texture it requested to load failed. + * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`. + * + * @event Phaser.Textures.Events#ERROR + * @since 3.0.0 + * + * @param {string} key - The key of the Texture that failed to load into the Texture Manager. + */ +module.exports = 'onerror'; diff --git a/src/textures/events/LOAD_EVENT.js b/src/textures/events/LOAD_EVENT.js new file mode 100644 index 000000000..ac5ad0c15 --- /dev/null +++ b/src/textures/events/LOAD_EVENT.js @@ -0,0 +1,23 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Load Event. + * + * This event is dispatched by the Texture Manager when a texture has finished loading on it. + * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`. + * + * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event. + * + * @event Phaser.Textures.Events#LOAD + * @since 3.0.0 + * + * @param {string} key - The key of the Texture that was loaded by the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was loaded by the Texture Manager. + */ +module.exports = 'onload'; diff --git a/src/textures/events/READY_EVENT.js b/src/textures/events/READY_EVENT.js new file mode 100644 index 000000000..3d7647b6b --- /dev/null +++ b/src/textures/events/READY_EVENT.js @@ -0,0 +1,17 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * This internal event signifies that the Texture Manager is now ready and the Game can continue booting. + * + * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking + * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game + * instance, which tells the Game to carry on booting. + * + * @event Phaser.Textures.Events#READY + * @since 3.16.1 + */ +module.exports = 'ready'; diff --git a/src/textures/events/REMOVE_EVENT.js b/src/textures/events/REMOVE_EVENT.js new file mode 100644 index 000000000..b020dc1fc --- /dev/null +++ b/src/textures/events/REMOVE_EVENT.js @@ -0,0 +1,22 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Texture Remove Event. + * + * This event is dispatched by the Texture Manager when a texture is removed from it. + * + * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`. + * + * If you have any Game Objects still using the removed texture, they will start throwing + * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. + * + * @event Phaser.Textures.Events#REMOVE + * @since 3.0.0 + * + * @param {string} key - The key of the Texture that was removed from the Texture Manager. + */ +module.exports = 'removetexture'; diff --git a/src/textures/events/index.js b/src/textures/events/index.js new file mode 100644 index 000000000..4e94b7c51 --- /dev/null +++ b/src/textures/events/index.js @@ -0,0 +1,19 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Textures.Events + */ + +module.exports = { + + ADD: require('./ADD_EVENT'), + ERROR: require('./ERROR_EVENT'), + LOAD: require('./LOAD_EVENT'), + READY: require('./READY_EVENT'), + REMOVE: require('./REMOVE_EVENT') + +}; diff --git a/src/textures/index.js b/src/textures/index.js index 75fff37af..bb88f04df 100644 --- a/src/textures/index.js +++ b/src/textures/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -15,18 +15,23 @@ var FilterMode = require('./const'); * Linear filter type. * * @name Phaser.Textures.LINEAR - * @constant + * @type {integer} + * @const + * @since 3.0.0 */ /** * Nearest Neighbor filter type. * * @name Phaser.Textures.NEAREST - * @constant + * @type {integer} + * @const + * @since 3.0.0 */ var Textures = { + Events: require('./events'), FilterMode: FilterMode, Frame: require('./Frame'), Parsers: require('./parsers'), diff --git a/src/textures/parsers/AtlasXML.js b/src/textures/parsers/AtlasXML.js index 0e1966331..800236b9d 100644 --- a/src/textures/parsers/AtlasXML.js +++ b/src/textures/parsers/AtlasXML.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/Canvas.js b/src/textures/parsers/Canvas.js index 6035541e0..77ac46ba2 100644 --- a/src/textures/parsers/Canvas.js +++ b/src/textures/parsers/Canvas.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/Image.js b/src/textures/parsers/Image.js index e78f2aa87..b6ab3d23a 100644 --- a/src/textures/parsers/Image.js +++ b/src/textures/parsers/Image.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/JSONArray.js b/src/textures/parsers/JSONArray.js index f630610c3..269083fa0 100644 --- a/src/textures/parsers/JSONArray.js +++ b/src/textures/parsers/JSONArray.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/JSONHash.js b/src/textures/parsers/JSONHash.js index 3f2a3ac41..3e1a621de 100644 --- a/src/textures/parsers/JSONHash.js +++ b/src/textures/parsers/JSONHash.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/SpriteSheet.js b/src/textures/parsers/SpriteSheet.js index c9a5e3d14..b5cad38e2 100644 --- a/src/textures/parsers/SpriteSheet.js +++ b/src/textures/parsers/SpriteSheet.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/SpriteSheetFromAtlas.js b/src/textures/parsers/SpriteSheetFromAtlas.js index b9e341c95..70afcd811 100644 --- a/src/textures/parsers/SpriteSheetFromAtlas.js +++ b/src/textures/parsers/SpriteSheetFromAtlas.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/UnityYAML.js b/src/textures/parsers/UnityYAML.js index 5234724a6..db45e200d 100644 --- a/src/textures/parsers/UnityYAML.js +++ b/src/textures/parsers/UnityYAML.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/parsers/index.js b/src/textures/parsers/index.js index 7baf9c3c7..b1e1d3cd9 100644 --- a/src/textures/parsers/index.js +++ b/src/textures/parsers/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/textures/typedefs/PixelConfig.js b/src/textures/typedefs/PixelConfig.js new file mode 100644 index 000000000..a9808a9ab --- /dev/null +++ b/src/textures/typedefs/PixelConfig.js @@ -0,0 +1,11 @@ +/** + * An object containing the position and color data for a single pixel in a CanvasTexture. + * + * @typedef {object} Phaser.Textures.Types.PixelConfig + * @since 3.16.0 + * + * @property {integer} x - The x-coordinate of the pixel. + * @property {integer} y - The y-coordinate of the pixel. + * @property {integer} color - The color of the pixel, not including the alpha channel. + * @property {number} alpha - The alpha of the pixel, between 0 and 1. + */ diff --git a/src/textures/typedefs/SpriteSheetConfig.js b/src/textures/typedefs/SpriteSheetConfig.js new file mode 100644 index 000000000..c7c39d732 --- /dev/null +++ b/src/textures/typedefs/SpriteSheetConfig.js @@ -0,0 +1,11 @@ +/** + * @typedef {object} Phaser.Textures.Types.SpriteSheetConfig + * @since 3.0.0 + * + * @property {integer} frameWidth - The fixed width of each frame. + * @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height. + * @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture. + * @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames". + * @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here. + * @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. + */ diff --git a/src/textures/typedefs/SpriteSheetFromAtlasConfig.js b/src/textures/typedefs/SpriteSheetFromAtlasConfig.js new file mode 100644 index 000000000..16b329ce0 --- /dev/null +++ b/src/textures/typedefs/SpriteSheetFromAtlasConfig.js @@ -0,0 +1,13 @@ +/** + * @typedef {object} Phaser.Textures.Types.SpriteSheetFromAtlasConfig + * @since 3.0.0 + * + * @property {string} atlas - The key of the Texture Atlas in which this Sprite Sheet can be found. + * @property {string} frame - The key of the Texture Atlas Frame in which this Sprite Sheet can be found. + * @property {integer} frameWidth - The fixed width of each frame. + * @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height. + * @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture. + * @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames". + * @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here. + * @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. + */ diff --git a/src/textures/typedefs/index.js b/src/textures/typedefs/index.js new file mode 100644 index 000000000..635be5e1d --- /dev/null +++ b/src/textures/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Textures.Types + */ diff --git a/src/tilemaps/Formats.js b/src/tilemaps/Formats.js index 8ccd7136a..2e13b7732 100644 --- a/src/tilemaps/Formats.js +++ b/src/tilemaps/Formats.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/ImageCollection.js b/src/tilemaps/ImageCollection.js index 880c7898a..ef96a5b2d 100644 --- a/src/tilemaps/ImageCollection.js +++ b/src/tilemaps/ImageCollection.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/ParseToTilemap.js b/src/tilemaps/ParseToTilemap.js index 07e47d3f0..211354951 100644 --- a/src/tilemaps/ParseToTilemap.js +++ b/src/tilemaps/ParseToTilemap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/Tile.js b/src/tilemaps/Tile.js index d8b1f4ca8..8b73480f2 100644 --- a/src/tilemaps/Tile.js +++ b/src/tilemaps/Tile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -151,7 +151,7 @@ var Tile = new Class({ * Tile specific properties. These usually come from Tiled. * * @name Phaser.Tilemaps.Tile#properties - * @type {object} + * @type {any} * @since 3.0.0 */ this.properties = {}; diff --git a/src/tilemaps/Tilemap.js b/src/tilemaps/Tilemap.js index e3f334e8d..c03223841 100644 --- a/src/tilemaps/Tilemap.js +++ b/src/tilemaps/Tilemap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -717,8 +717,8 @@ var Tilemap = new Class({ * * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} x - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} y - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer was created, or null if it failed. */ @@ -855,10 +855,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. @@ -946,10 +943,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. @@ -978,10 +972,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. @@ -1192,10 +1183,7 @@ var Tilemap = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. @@ -1218,10 +1206,7 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * @@ -1247,10 +1232,7 @@ var Tilemap = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * @@ -1584,6 +1566,48 @@ var Tilemap = new Class({ return this; }, + /** + * Removes the given Tile, or an array of Tiles, from the layer to which they belong, + * and optionally recalculates the collision information. + * + * This cannot be applied to Tiles that belong to Static Tilemap Layers. + * + * @method Phaser.Tilemaps.Tilemap#removeTile + * @since 3.17.0 + * + * @param {(Phaser.Tilemaps.Tile|Phaser.Tilemaps.Tile[])} tiles - The Tile to remove, or an array of Tiles. + * @param {integer} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {Phaser.Tilemaps.Tile[]} Returns an array of Tiles that were removed. + */ + removeTile: function (tiles, replaceIndex, recalculateFaces) + { + if (replaceIndex === undefined) { replaceIndex = -1; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + + var removed = []; + + if (!Array.isArray(tiles)) + { + tiles = [ tiles ]; + } + + for (var i = 0; i < tiles.length; i++) + { + var tile = tiles[i]; + + removed.push(this.removeTileAt(tile.x, tile.y, true, recalculateFaces, tile.tilemapLayer)); + + if (replaceIndex > -1) + { + this.putTileAt(replaceIndex, tile.x, tile.y, recalculateFaces, tile.tilemapLayer); + } + } + + return removed; + }, + /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's * collision information. @@ -1600,7 +1624,7 @@ var Tilemap = new Class({ * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * - * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + * @return {?Phaser.Tilemaps.Tile} Returns the Tile that was removed, or null if the layer given was invalid. */ removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { @@ -1655,10 +1679,7 @@ var Tilemap = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. + * @param {Phaser.Tilemaps.Types.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. diff --git a/src/tilemaps/TilemapCreator.js b/src/tilemaps/TilemapCreator.js index dd764045a..428cdd345 100644 --- a/src/tilemaps/TilemapCreator.js +++ b/src/tilemaps/TilemapCreator.js @@ -1,29 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GameObjectCreator = require('../gameobjects/GameObjectCreator'); var ParseToTilemap = require('./ParseToTilemap'); -/** - * @typedef {object} TilemapConfig - * - * @property {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @property {integer[][]} [data] - Instead of loading from the cache, you can also load directly from a 2D array of tile indexes. - * @property {integer} [tileWidth=32] - The width of a tile in pixels. - * @property {integer} [tileHeight=32] - The height of a tile in pixels. - * @property {integer} [width=10] - The width of the map in tiles. - * @property {integer} [height=10] - The height of the map in tiles. - * @property {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, - * in the map data are handled. If `true`, empty locations will get a value of `null`. If `false`, - * empty location will get a Tile object with an index of -1. If you've a large sparsely populated - * map and the tile data doesn't need to change then setting this value to `true` will help with - * memory consumption. However if your map is small or you need to update the tiles dynamically, - * then leave the default value set. - */ - /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing @@ -33,7 +16,7 @@ var ParseToTilemap = require('./ParseToTilemap'); * @method Phaser.GameObjects.GameObjectCreator#tilemap * @since 3.0.0 * - * @param {TilemapConfig} [config] - The config options for the Tilemap. + * @param {Phaser.Tilemaps.Types.TilemapConfig} [config] - The config options for the Tilemap. * * @return {Phaser.Tilemaps.Tilemap} */ diff --git a/src/tilemaps/TilemapFactory.js b/src/tilemaps/TilemapFactory.js index 27361a445..52853460b 100644 --- a/src/tilemaps/TilemapFactory.js +++ b/src/tilemaps/TilemapFactory.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/Tileset.js b/src/tilemaps/Tileset.js index a3db0ca1a..67f33201d 100644 --- a/src/tilemaps/Tileset.js +++ b/src/tilemaps/Tileset.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/CalculateFacesAt.js b/src/tilemaps/components/CalculateFacesAt.js index adee2743c..81c8538a4 100644 --- a/src/tilemaps/components/CalculateFacesAt.js +++ b/src/tilemaps/components/CalculateFacesAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/CalculateFacesWithin.js b/src/tilemaps/components/CalculateFacesWithin.js index 870fd4148..3f08da281 100644 --- a/src/tilemaps/components/CalculateFacesWithin.js +++ b/src/tilemaps/components/CalculateFacesWithin.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/Copy.js b/src/tilemaps/components/Copy.js index a45939ad8..7f94d94d7 100644 --- a/src/tilemaps/components/Copy.js +++ b/src/tilemaps/components/Copy.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/CreateFromTiles.js b/src/tilemaps/components/CreateFromTiles.js index a40aedb8d..8affe6a87 100644 --- a/src/tilemaps/components/CreateFromTiles.js +++ b/src/tilemaps/components/CreateFromTiles.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/CullTiles.js b/src/tilemaps/components/CullTiles.js index 96455091b..a19f5f954 100644 --- a/src/tilemaps/components/CullTiles.js +++ b/src/tilemaps/components/CullTiles.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/Fill.js b/src/tilemaps/components/Fill.js index e4b7505be..48ac18060 100644 --- a/src/tilemaps/components/Fill.js +++ b/src/tilemaps/components/Fill.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/FilterTiles.js b/src/tilemaps/components/FilterTiles.js index 58580ff66..a35222f50 100644 --- a/src/tilemaps/components/FilterTiles.js +++ b/src/tilemaps/components/FilterTiles.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/FindByIndex.js b/src/tilemaps/components/FindByIndex.js index eee8e3ef6..f8e7f148c 100644 --- a/src/tilemaps/components/FindByIndex.js +++ b/src/tilemaps/components/FindByIndex.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/FindTile.js b/src/tilemaps/components/FindTile.js index 6933647c1..b9e84a65a 100644 --- a/src/tilemaps/components/FindTile.js +++ b/src/tilemaps/components/FindTile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/ForEachTile.js b/src/tilemaps/components/ForEachTile.js index 2d5ae1293..77fb852bf 100644 --- a/src/tilemaps/components/ForEachTile.js +++ b/src/tilemaps/components/ForEachTile.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/GetTileAt.js b/src/tilemaps/components/GetTileAt.js index d23c6f783..d0bcb19e4 100644 --- a/src/tilemaps/components/GetTileAt.js +++ b/src/tilemaps/components/GetTileAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/GetTileAtWorldXY.js b/src/tilemaps/components/GetTileAtWorldXY.js index 30d2c719b..98c436c82 100644 --- a/src/tilemaps/components/GetTileAtWorldXY.js +++ b/src/tilemaps/components/GetTileAtWorldXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/GetTilesWithin.js b/src/tilemaps/components/GetTilesWithin.js index f3464a900..6a8864ab2 100644 --- a/src/tilemaps/components/GetTilesWithin.js +++ b/src/tilemaps/components/GetTilesWithin.js @@ -1,19 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var GetFastValue = require('../../utils/object/GetFastValue'); -/** - * @typedef {object} GetTilesWithinFilteringOptions - * - * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. - * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - */ - /** * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. * @@ -25,7 +17,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} width - How many tiles wide from the `tileX` index the area will be. * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.Types.GetTilesWithinFilteringOptions} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. diff --git a/src/tilemaps/components/GetTilesWithinShape.js b/src/tilemaps/components/GetTilesWithinShape.js index 30f20777b..6c6567dd0 100644 --- a/src/tilemaps/components/GetTilesWithinShape.js +++ b/src/tilemaps/components/GetTilesWithinShape.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/GetTilesWithinWorldXY.js b/src/tilemaps/components/GetTilesWithinWorldXY.js index 2b66b9ca6..4224ad871 100644 --- a/src/tilemaps/components/GetTilesWithinWorldXY.js +++ b/src/tilemaps/components/GetTilesWithinWorldXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/HasTileAt.js b/src/tilemaps/components/HasTileAt.js index 37fb5fc48..f5ea6c0c7 100644 --- a/src/tilemaps/components/HasTileAt.js +++ b/src/tilemaps/components/HasTileAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/HasTileAtWorldXY.js b/src/tilemaps/components/HasTileAtWorldXY.js index 746b9a1da..3ddae5c41 100644 --- a/src/tilemaps/components/HasTileAtWorldXY.js +++ b/src/tilemaps/components/HasTileAtWorldXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/IsInLayerBounds.js b/src/tilemaps/components/IsInLayerBounds.js index 1fe71cc08..f4463f283 100644 --- a/src/tilemaps/components/IsInLayerBounds.js +++ b/src/tilemaps/components/IsInLayerBounds.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/PutTileAt.js b/src/tilemaps/components/PutTileAt.js index c72627e1f..b63893a49 100644 --- a/src/tilemaps/components/PutTileAt.js +++ b/src/tilemaps/components/PutTileAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/PutTileAtWorldXY.js b/src/tilemaps/components/PutTileAtWorldXY.js index 1ed6737d9..0e3891d1e 100644 --- a/src/tilemaps/components/PutTileAtWorldXY.js +++ b/src/tilemaps/components/PutTileAtWorldXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/PutTilesAt.js b/src/tilemaps/components/PutTilesAt.js index 66dcd1012..e00ffee36 100644 --- a/src/tilemaps/components/PutTilesAt.js +++ b/src/tilemaps/components/PutTilesAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/Randomize.js b/src/tilemaps/components/Randomize.js index 8b070623b..a62f496db 100644 --- a/src/tilemaps/components/Randomize.js +++ b/src/tilemaps/components/Randomize.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/RemoveTileAt.js b/src/tilemaps/components/RemoveTileAt.js index ff2194f07..78f6a1e55 100644 --- a/src/tilemaps/components/RemoveTileAt.js +++ b/src/tilemaps/components/RemoveTileAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -28,21 +28,24 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la { if (replaceWithNull === undefined) { replaceWithNull = false; } if (recalculateFaces === undefined) { recalculateFaces = true; } - if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } - var tile = layer.data[tileY][tileX] || null; - if (tile === null) + if (!IsInLayerBounds(tileX, tileY, layer)) + { + return null; + } + + var tile = layer.data[tileY][tileX]; + + if (!tile) { return null; } else { - layer.data[tileY][tileX] = replaceWithNull - ? null - : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); + layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); } - // Recalculate faces only if the removed tile was a colliding tile + // Recalculate faces only if the removed tile was a colliding tile if (recalculateFaces && tile && tile.collides) { CalculateFacesAt(tileX, tileY, layer); diff --git a/src/tilemaps/components/RemoveTileAtWorldXY.js b/src/tilemaps/components/RemoveTileAtWorldXY.js index 00a9ec294..ed2f4b3a8 100644 --- a/src/tilemaps/components/RemoveTileAtWorldXY.js +++ b/src/tilemaps/components/RemoveTileAtWorldXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/RenderDebug.js b/src/tilemaps/components/RenderDebug.js index a12ec9198..3a0c8ecd5 100644 --- a/src/tilemaps/components/RenderDebug.js +++ b/src/tilemaps/components/RenderDebug.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/ReplaceByIndex.js b/src/tilemaps/components/ReplaceByIndex.js index eaf912d32..fbd874b17 100644 --- a/src/tilemaps/components/ReplaceByIndex.js +++ b/src/tilemaps/components/ReplaceByIndex.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetCollision.js b/src/tilemaps/components/SetCollision.js index 0d46d4a2d..4c02da636 100644 --- a/src/tilemaps/components/SetCollision.js +++ b/src/tilemaps/components/SetCollision.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetCollisionBetween.js b/src/tilemaps/components/SetCollisionBetween.js index 20ff01b6c..b6b2f14e9 100644 --- a/src/tilemaps/components/SetCollisionBetween.js +++ b/src/tilemaps/components/SetCollisionBetween.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetCollisionByExclusion.js b/src/tilemaps/components/SetCollisionByExclusion.js index cb0927013..ed6f1861a 100644 --- a/src/tilemaps/components/SetCollisionByExclusion.js +++ b/src/tilemaps/components/SetCollisionByExclusion.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetCollisionByProperty.js b/src/tilemaps/components/SetCollisionByProperty.js index 47b726440..b33d2b58d 100644 --- a/src/tilemaps/components/SetCollisionByProperty.js +++ b/src/tilemaps/components/SetCollisionByProperty.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetCollisionFromCollisionGroup.js b/src/tilemaps/components/SetCollisionFromCollisionGroup.js index 951f82b39..447a6dc33 100644 --- a/src/tilemaps/components/SetCollisionFromCollisionGroup.js +++ b/src/tilemaps/components/SetCollisionFromCollisionGroup.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetLayerCollisionIndex.js b/src/tilemaps/components/SetLayerCollisionIndex.js index b399f1c87..3ce9ba831 100644 --- a/src/tilemaps/components/SetLayerCollisionIndex.js +++ b/src/tilemaps/components/SetLayerCollisionIndex.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetTileCollision.js b/src/tilemaps/components/SetTileCollision.js index 23413ce51..9d9bcee54 100644 --- a/src/tilemaps/components/SetTileCollision.js +++ b/src/tilemaps/components/SetTileCollision.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetTileIndexCallback.js b/src/tilemaps/components/SetTileIndexCallback.js index 5bddeba39..e665d23cf 100644 --- a/src/tilemaps/components/SetTileIndexCallback.js +++ b/src/tilemaps/components/SetTileIndexCallback.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SetTileLocationCallback.js b/src/tilemaps/components/SetTileLocationCallback.js index 4614811d6..0ee0adf5a 100644 --- a/src/tilemaps/components/SetTileLocationCallback.js +++ b/src/tilemaps/components/SetTileLocationCallback.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/Shuffle.js b/src/tilemaps/components/Shuffle.js index a53db8296..501826e33 100644 --- a/src/tilemaps/components/Shuffle.js +++ b/src/tilemaps/components/Shuffle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/SwapByIndex.js b/src/tilemaps/components/SwapByIndex.js index 9dd6ffeb7..ac04344d7 100644 --- a/src/tilemaps/components/SwapByIndex.js +++ b/src/tilemaps/components/SwapByIndex.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/TileToWorldX.js b/src/tilemaps/components/TileToWorldX.js index 4ad6210d2..0a0108220 100644 --- a/src/tilemaps/components/TileToWorldX.js +++ b/src/tilemaps/components/TileToWorldX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/TileToWorldXY.js b/src/tilemaps/components/TileToWorldXY.js index d04e55074..02e19c7d0 100644 --- a/src/tilemaps/components/TileToWorldXY.js +++ b/src/tilemaps/components/TileToWorldXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/TileToWorldY.js b/src/tilemaps/components/TileToWorldY.js index 4dd833ef9..102b8f1de 100644 --- a/src/tilemaps/components/TileToWorldY.js +++ b/src/tilemaps/components/TileToWorldY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/WeightedRandomize.js b/src/tilemaps/components/WeightedRandomize.js index 766fce487..5c1d4b1b5 100644 --- a/src/tilemaps/components/WeightedRandomize.js +++ b/src/tilemaps/components/WeightedRandomize.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/WorldToTileX.js b/src/tilemaps/components/WorldToTileX.js index 58a588d8d..6bb5722aa 100644 --- a/src/tilemaps/components/WorldToTileX.js +++ b/src/tilemaps/components/WorldToTileX.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/WorldToTileXY.js b/src/tilemaps/components/WorldToTileXY.js index 83e99b638..eac6a48c9 100644 --- a/src/tilemaps/components/WorldToTileXY.js +++ b/src/tilemaps/components/WorldToTileXY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/WorldToTileY.js b/src/tilemaps/components/WorldToTileY.js index 9e3004140..658c9e238 100644 --- a/src/tilemaps/components/WorldToTileY.js +++ b/src/tilemaps/components/WorldToTileY.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/components/index.js b/src/tilemaps/components/index.js index 32280bfc3..2a4ba0e8a 100644 --- a/src/tilemaps/components/index.js +++ b/src/tilemaps/components/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/dynamiclayer/DynamicTilemapLayer.js b/src/tilemaps/dynamiclayer/DynamicTilemapLayer.js index dad886933..996b431b3 100644 --- a/src/tilemaps/dynamiclayer/DynamicTilemapLayer.js +++ b/src/tilemaps/dynamiclayer/DynamicTilemapLayer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -199,9 +199,9 @@ var DynamicTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -513,10 +513,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -561,10 +558,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -586,10 +580,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -646,10 +637,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -666,10 +654,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -689,10 +674,7 @@ var DynamicTilemapLayer = new Class({ * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -878,13 +860,7 @@ var DynamicTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {Phaser.Tilemaps.Types.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. */ @@ -1087,7 +1063,7 @@ var DynamicTilemapLayer = new Class({ * @method Phaser.Tilemaps.DynamicTilemapLayer#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 {(integer|integer[])} 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. * @@ -1112,7 +1088,7 @@ var DynamicTilemapLayer = new Class({ * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @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.DynamicTilemapLayer} This Tilemap Layer object. diff --git a/src/tilemaps/dynamiclayer/DynamicTilemapLayerCanvasRenderer.js b/src/tilemaps/dynamiclayer/DynamicTilemapLayerCanvasRenderer.js index 0d8255f74..843237d65 100644 --- a/src/tilemaps/dynamiclayer/DynamicTilemapLayerCanvasRenderer.js +++ b/src/tilemaps/dynamiclayer/DynamicTilemapLayerCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/dynamiclayer/DynamicTilemapLayerRender.js b/src/tilemaps/dynamiclayer/DynamicTilemapLayerRender.js index 8e3d5f25d..aadf8e9db 100644 --- a/src/tilemaps/dynamiclayer/DynamicTilemapLayerRender.js +++ b/src/tilemaps/dynamiclayer/DynamicTilemapLayerRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/dynamiclayer/DynamicTilemapLayerWebGLRenderer.js b/src/tilemaps/dynamiclayer/DynamicTilemapLayerWebGLRenderer.js index 7e7358c5f..f0a45ed26 100644 --- a/src/tilemaps/dynamiclayer/DynamicTilemapLayerWebGLRenderer.js +++ b/src/tilemaps/dynamiclayer/DynamicTilemapLayerWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/index.js b/src/tilemaps/index.js index 49a60260c..fb302c650 100644 --- a/src/tilemaps/index.js +++ b/src/tilemaps/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/mapdata/LayerData.js b/src/tilemaps/mapdata/LayerData.js index d40a818f9..6cdacb0d0 100644 --- a/src/tilemaps/mapdata/LayerData.js +++ b/src/tilemaps/mapdata/LayerData.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -29,7 +29,7 @@ var LayerData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The name of the layer, if specified in Tiled. * * @name Phaser.Tilemaps.LayerData#name * @type {string} @@ -38,7 +38,7 @@ var LayerData = new Class({ this.name = GetFastValue(config, 'name', 'layer'); /** - * [description] + * The x offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#x * @type {number} @@ -47,7 +47,7 @@ var LayerData = new Class({ this.x = GetFastValue(config, 'x', 0); /** - * [description] + * The y offset of where to draw from the top left * * @name Phaser.Tilemaps.LayerData#y * @type {number} @@ -56,7 +56,7 @@ var LayerData = new Class({ this.y = GetFastValue(config, 'y', 0); /** - * [description] + * The width in tile of the layer. * * @name Phaser.Tilemaps.LayerData#width * @type {number} @@ -65,7 +65,7 @@ var LayerData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height in tiles of the layer. * * @name Phaser.Tilemaps.LayerData#height * @type {number} @@ -74,7 +74,7 @@ var LayerData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The pixel width of the tiles. * * @name Phaser.Tilemaps.LayerData#tileWidth * @type {number} @@ -83,7 +83,7 @@ var LayerData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The pixel height of the tiles. * * @name Phaser.Tilemaps.LayerData#tileHeight * @type {number} @@ -110,7 +110,7 @@ var LayerData = new Class({ this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); /** - * [description] + * The width in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#widthInPixels * @type {number} @@ -119,7 +119,7 @@ var LayerData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); /** - * [description] + * The height in pixels of the entire layer. * * @name Phaser.Tilemaps.LayerData#heightInPixels * @type {number} @@ -146,7 +146,7 @@ var LayerData = new Class({ this.visible = GetFastValue(config, 'visible', true); /** - * [description] + * Layer specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.LayerData#properties * @type {object} @@ -191,10 +191,10 @@ var LayerData = new Class({ this.bodies = GetFastValue(config, 'bodies', []); /** - * [description] + * An array of the tile indexes * * @name Phaser.Tilemaps.LayerData#data - * @type {array} + * @type {(number[])} * @since 3.0.0 */ this.data = GetFastValue(config, 'data', []); diff --git a/src/tilemaps/mapdata/MapData.js b/src/tilemaps/mapdata/MapData.js index 28dc8422f..4e02b55f5 100644 --- a/src/tilemaps/mapdata/MapData.js +++ b/src/tilemaps/mapdata/MapData.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -18,7 +18,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {Phaser.Tilemaps.Types.MapDataConfig} [config] - The Map configuration object. */ var MapData = new Class({ @@ -29,7 +29,7 @@ var MapData = new Class({ if (config === undefined) { config = {}; } /** - * [description] + * The key in the Phaser cache that corresponds to the loaded tilemap data. * * @name Phaser.Tilemaps.MapData#name * @type {string} @@ -38,7 +38,7 @@ var MapData = new Class({ this.name = GetFastValue(config, 'name', 'map'); /** - * [description] + * The width of the entire tilemap. * * @name Phaser.Tilemaps.MapData#width * @type {number} @@ -47,7 +47,7 @@ var MapData = new Class({ this.width = GetFastValue(config, 'width', 0); /** - * [description] + * The height of the entire tilemap. * * @name Phaser.Tilemaps.MapData#height * @type {number} @@ -56,7 +56,7 @@ var MapData = new Class({ this.height = GetFastValue(config, 'height', 0); /** - * [description] + * The width of the tiles. * * @name Phaser.Tilemaps.MapData#tileWidth * @type {number} @@ -65,7 +65,7 @@ var MapData = new Class({ this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * [description] + * The height of the tiles. * * @name Phaser.Tilemaps.MapData#tileHeight * @type {number} @@ -74,7 +74,7 @@ var MapData = new Class({ this.tileHeight = GetFastValue(config, 'tileHeight', 0); /** - * [description] + * The width in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#widthInPixels * @type {number} @@ -83,7 +83,7 @@ var MapData = new Class({ this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); /** - * [description] + * The height in pixels of the entire tilemap. * * @name Phaser.Tilemaps.MapData#heightInPixels * @type {number} @@ -101,7 +101,7 @@ var MapData = new Class({ this.format = GetFastValue(config, 'format', null); /** - * [description] + * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. * * @name Phaser.Tilemaps.MapData#orientation * @type {string} @@ -109,15 +109,6 @@ var MapData = new Class({ */ this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); - /** - * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. - * - * @name Phaser.Tilemaps.MapData#renderOrder - * @type {string} - * @since 3.12.0 - */ - this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); - /** * Determines the draw order of tilemap. Default is right-down * @@ -126,6 +117,15 @@ var MapData = new Class({ * 2, or 'right-up' * 3, or 'left-up' * + * @name Phaser.Tilemaps.MapData#renderOrder + * @type {string} + * @since 3.12.0 + */ + this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); + + /** + * The version of the map data (as specified in Tiled). + * * @name Phaser.Tilemaps.MapData#version * @type {string} * @since 3.0.0 @@ -133,7 +133,7 @@ var MapData = new Class({ this.version = GetFastValue(config, 'version', '1'); /** - * The version of the map data (as specified in Tiled). + * Map specific properties (can be specified in Tiled) * * @name Phaser.Tilemaps.MapData#properties * @type {object} @@ -142,16 +142,16 @@ var MapData = new Class({ this.properties = GetFastValue(config, 'properties', {}); /** - * Map specific properties (can be specified in Tiled) + * An array with all the layers configured to the MapData. * * @name Phaser.Tilemaps.MapData#layers - * @type {array} + * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} * @since 3.0.0 */ this.layers = GetFastValue(config, 'layers', []); /** - * An array with all the layers configured to the MapData + * An array of Tiled Image Layers. * * @name Phaser.Tilemaps.MapData#images * @type {array} @@ -160,7 +160,7 @@ var MapData = new Class({ this.images = GetFastValue(config, 'images', []); /** - * An array of Tiled Image Layers + * An object of Tiled Object Layers. * * @name Phaser.Tilemaps.MapData#objects * @type {object} @@ -169,7 +169,7 @@ var MapData = new Class({ this.objects = GetFastValue(config, 'objects', {}); /** - * An object of Tiled Object Layers + * An object of collision data. Must be created as physics object or will return undefined. * * @name Phaser.Tilemaps.MapData#collision * @type {object} @@ -178,16 +178,16 @@ var MapData = new Class({ this.collision = GetFastValue(config, 'collision', {}); /** - * An object of collision data. Must be created as physics object or will return undefined + * An array of Tilesets. * * @name Phaser.Tilemaps.MapData#tilesets - * @type {array} + * @type {Phaser.Tilemaps.Tileset[]} * @since 3.0.0 */ this.tilesets = GetFastValue(config, 'tilesets', []); /** - * An array of Tilesets + * The collection of images the map uses(specified in Tiled) * * @name Phaser.Tilemaps.MapData#imageCollections * @type {array} diff --git a/src/tilemaps/mapdata/ObjectLayer.js b/src/tilemaps/mapdata/ObjectLayer.js index 888b411a2..5d4e32676 100644 --- a/src/tilemaps/mapdata/ObjectLayer.js +++ b/src/tilemaps/mapdata/ObjectLayer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/Parse.js b/src/tilemaps/parsers/Parse.js index 506386f95..a661a6163 100644 --- a/src/tilemaps/parsers/Parse.js +++ b/src/tilemaps/parsers/Parse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/Parse2DArray.js b/src/tilemaps/parsers/Parse2DArray.js index 8d2d810f4..bce75efad 100644 --- a/src/tilemaps/parsers/Parse2DArray.js +++ b/src/tilemaps/parsers/Parse2DArray.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/ParseCSV.js b/src/tilemaps/parsers/ParseCSV.js index e04cb09ab..40b05cef2 100644 --- a/src/tilemaps/parsers/ParseCSV.js +++ b/src/tilemaps/parsers/ParseCSV.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/impact/ParseTileLayers.js b/src/tilemaps/parsers/impact/ParseTileLayers.js index a9fa32f6e..413622ea4 100644 --- a/src/tilemaps/parsers/impact/ParseTileLayers.js +++ b/src/tilemaps/parsers/impact/ParseTileLayers.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/impact/ParseTilesets.js b/src/tilemaps/parsers/impact/ParseTilesets.js index 63870103b..f36f1bb34 100644 --- a/src/tilemaps/parsers/impact/ParseTilesets.js +++ b/src/tilemaps/parsers/impact/ParseTilesets.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/impact/ParseWeltmeister.js b/src/tilemaps/parsers/impact/ParseWeltmeister.js index 45cb52cf6..fe264280f 100644 --- a/src/tilemaps/parsers/impact/ParseWeltmeister.js +++ b/src/tilemaps/parsers/impact/ParseWeltmeister.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/index.js b/src/tilemaps/parsers/index.js index 9f301a75b..f6b0dddf2 100644 --- a/src/tilemaps/parsers/index.js +++ b/src/tilemaps/parsers/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/AssignTileProperties.js b/src/tilemaps/parsers/tiled/AssignTileProperties.js index 49d7b4f8b..c47718a69 100644 --- a/src/tilemaps/parsers/tiled/AssignTileProperties.js +++ b/src/tilemaps/parsers/tiled/AssignTileProperties.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/Base64Decode.js b/src/tilemaps/parsers/tiled/Base64Decode.js index a346cff6f..d6fc50e56 100644 --- a/src/tilemaps/parsers/tiled/Base64Decode.js +++ b/src/tilemaps/parsers/tiled/Base64Decode.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/BuildTilesetIndex.js b/src/tilemaps/parsers/tiled/BuildTilesetIndex.js index e30378445..1cab21d7b 100644 --- a/src/tilemaps/parsers/tiled/BuildTilesetIndex.js +++ b/src/tilemaps/parsers/tiled/BuildTilesetIndex.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseGID.js b/src/tilemaps/parsers/tiled/ParseGID.js index dccb70843..0b984f462 100644 --- a/src/tilemaps/parsers/tiled/ParseGID.js +++ b/src/tilemaps/parsers/tiled/ParseGID.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseImageLayers.js b/src/tilemaps/parsers/tiled/ParseImageLayers.js index 3cd781f43..4b3694c07 100644 --- a/src/tilemaps/parsers/tiled/ParseImageLayers.js +++ b/src/tilemaps/parsers/tiled/ParseImageLayers.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseJSONTiled.js b/src/tilemaps/parsers/tiled/ParseJSONTiled.js index 20ee4e17b..aa24b5c3f 100644 --- a/src/tilemaps/parsers/tiled/ParseJSONTiled.js +++ b/src/tilemaps/parsers/tiled/ParseJSONTiled.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseObject.js b/src/tilemaps/parsers/tiled/ParseObject.js index d54d0abc5..120167e19 100644 --- a/src/tilemaps/parsers/tiled/ParseObject.js +++ b/src/tilemaps/parsers/tiled/ParseObject.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseObjectLayers.js b/src/tilemaps/parsers/tiled/ParseObjectLayers.js index 1428af7df..f117e4e09 100644 --- a/src/tilemaps/parsers/tiled/ParseObjectLayers.js +++ b/src/tilemaps/parsers/tiled/ParseObjectLayers.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseTileLayers.js b/src/tilemaps/parsers/tiled/ParseTileLayers.js index 9a5c44adf..484a3f547 100644 --- a/src/tilemaps/parsers/tiled/ParseTileLayers.js +++ b/src/tilemaps/parsers/tiled/ParseTileLayers.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/ParseTilesets.js b/src/tilemaps/parsers/tiled/ParseTilesets.js index 1c9ed3f36..d118d547a 100644 --- a/src/tilemaps/parsers/tiled/ParseTilesets.js +++ b/src/tilemaps/parsers/tiled/ParseTilesets.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/parsers/tiled/Pick.js b/src/tilemaps/parsers/tiled/Pick.js index f1a50ddd0..b740493e5 100644 --- a/src/tilemaps/parsers/tiled/Pick.js +++ b/src/tilemaps/parsers/tiled/Pick.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/staticlayer/StaticTilemapLayer.js b/src/tilemaps/staticlayer/StaticTilemapLayer.js index 03b9956f5..18c7ed50a 100644 --- a/src/tilemaps/staticlayer/StaticTilemapLayer.js +++ b/src/tilemaps/staticlayer/StaticTilemapLayer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -215,9 +215,9 @@ var StaticTilemapLayer = new Class({ * * It will be sent 3 arguments: * - * 1) The Phaser.Tilemaps.LayerData object for this Layer - * 2) The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3) A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * @@ -943,13 +943,7 @@ var StaticTilemapLayer = new Class({ * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {?Phaser.Tilemaps.Tile} */ @@ -974,13 +968,7 @@ var StaticTilemapLayer = new Class({ * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -1003,13 +991,7 @@ var StaticTilemapLayer = new Class({ * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide - * on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ @@ -1068,13 +1050,7 @@ var StaticTilemapLayer = new Class({ * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area. * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ @@ -1093,13 +1069,7 @@ var StaticTilemapLayer = new Class({ * @param {number} worldY - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. * @param {number} width - How many tiles wide from the `tileX` index the area will be. * @param {number} height - How many tiles high from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -1117,13 +1087,7 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have - * -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on - * at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that - * have at least one interesting face. + * @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -1178,13 +1142,7 @@ var StaticTilemapLayer = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {Phaser.Tilemaps.Types.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. * * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ diff --git a/src/tilemaps/staticlayer/StaticTilemapLayerCanvasRenderer.js b/src/tilemaps/staticlayer/StaticTilemapLayerCanvasRenderer.js index 2fb481cde..c543f3cf4 100644 --- a/src/tilemaps/staticlayer/StaticTilemapLayerCanvasRenderer.js +++ b/src/tilemaps/staticlayer/StaticTilemapLayerCanvasRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/staticlayer/StaticTilemapLayerRender.js b/src/tilemaps/staticlayer/StaticTilemapLayerRender.js index 22241b605..1f9dfb5bd 100644 --- a/src/tilemaps/staticlayer/StaticTilemapLayerRender.js +++ b/src/tilemaps/staticlayer/StaticTilemapLayerRender.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/staticlayer/StaticTilemapLayerWebGLRenderer.js b/src/tilemaps/staticlayer/StaticTilemapLayerWebGLRenderer.js index 231d8f1bd..c41aec966 100644 --- a/src/tilemaps/staticlayer/StaticTilemapLayerWebGLRenderer.js +++ b/src/tilemaps/staticlayer/StaticTilemapLayerWebGLRenderer.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tilemaps/typedefs/FilteringOptions.js b/src/tilemaps/typedefs/FilteringOptions.js new file mode 100644 index 000000000..694091809 --- /dev/null +++ b/src/tilemaps/typedefs/FilteringOptions.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Tilemaps.Types.FilteringOptions + * @since 3.0.0 + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ diff --git a/src/tilemaps/typedefs/GetTilesWithinFilteringOptions.js b/src/tilemaps/typedefs/GetTilesWithinFilteringOptions.js new file mode 100644 index 000000000..9cd300e39 --- /dev/null +++ b/src/tilemaps/typedefs/GetTilesWithinFilteringOptions.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Tilemaps.Types.GetTilesWithinFilteringOptions + * @since 3.0.0 + * + * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. + * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side. + * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + */ diff --git a/src/tilemaps/typedefs/MapDataConfig.js b/src/tilemaps/typedefs/MapDataConfig.js new file mode 100644 index 000000000..e5f9abf72 --- /dev/null +++ b/src/tilemaps/typedefs/MapDataConfig.js @@ -0,0 +1,24 @@ +/** + * @typedef {object} Phaser.Tilemaps.Types.MapDataConfig + * @since 3.0.0 + * + * @property {string} [name] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @property {number} [width=0] - The width of the entire tilemap. + * @property {number} [height=0] - The height of the entire tilemap. + * @property {number} [tileWidth=0] - The width of the tiles. + * @property {number} [tileHeight=0] - The height of the tiles. + * @property {number} [widthInPixels] - The width in pixels of the entire tilemap. + * @property {number} [heightInPixels] - The height in pixels of the entire tilemap. + * @property {integer} [format] - The format of the Tilemap, as defined in Tiled. + * @property {string} [orientation] - The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. + * @property {string} [renderOrder] - Determines the draw order of tilemap. Default is right-down. + * @property {number} [version] - The version of Tiled the map uses. + * @property {number} [properties] - Map specific properties (can be specified in Tiled). + * @property {Phaser.Tilemaps.LayerData[]} [layers] - The layers of the tilemap. + * @property {array} [images] - An array with all the layers configured to the MapData. + * @property {object} [objects] - An array of Tiled Image Layers. + * @property {object} [collision] - An object of Tiled Object Layers. + * @property {Phaser.Tilemaps.Tileset[]} [tilesets] - The tilesets the map uses. + * @property {array} [imageCollections] - The collection of images the map uses(specified in Tiled). + * @property {array} [tiles] - [description] + */ diff --git a/src/tilemaps/typedefs/StyleConfig.js b/src/tilemaps/typedefs/StyleConfig.js new file mode 100644 index 000000000..a83c7884d --- /dev/null +++ b/src/tilemaps/typedefs/StyleConfig.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Tilemaps.Types.StyleConfig + * @since 3.0.0 + * + * @property {?number} [tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. + * @property {?number} [collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. + * @property {?number} [faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn. + */ diff --git a/src/tilemaps/typedefs/TilemapConfig.js b/src/tilemaps/typedefs/TilemapConfig.js new file mode 100644 index 000000000..c8c89f64a --- /dev/null +++ b/src/tilemaps/typedefs/TilemapConfig.js @@ -0,0 +1,17 @@ +/** + * @typedef {object} Phaser.Tilemaps.Types.TilemapConfig + * @since 3.0.0 + * + * @property {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @property {integer[][]} [data] - Instead of loading from the cache, you can also load directly from a 2D array of tile indexes. + * @property {integer} [tileWidth=32] - The width of a tile in pixels. + * @property {integer} [tileHeight=32] - The height of a tile in pixels. + * @property {integer} [width=10] - The width of the map in tiles. + * @property {integer} [height=10] - The height of the map in tiles. + * @property {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, + * in the map data are handled. If `true`, empty locations will get a value of `null`. If `false`, + * empty location will get a Tile object with an index of -1. If you've a large sparsely populated + * map and the tile data doesn't need to change then setting this value to `true` will help with + * memory consumption. However if your map is small or you need to update the tiles dynamically, + * then leave the default value set. + */ diff --git a/src/tilemaps/typedefs/index.js b/src/tilemaps/typedefs/index.js new file mode 100644 index 000000000..e42488b78 --- /dev/null +++ b/src/tilemaps/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tilemaps.Types + */ diff --git a/src/time/Clock.js b/src/time/Clock.js index 150cacf43..714c33484 100644 --- a/src/time/Clock.js +++ b/src/time/Clock.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); var TimerEvent = require('./TimerEvent'); /** @@ -114,8 +115,8 @@ var Clock = new Class({ */ this._pendingRemoval = []; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -128,7 +129,7 @@ var Clock = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -144,9 +145,9 @@ var Clock = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -155,7 +156,7 @@ var Clock = new Class({ * @method Phaser.Time.Clock#addEvent * @since 3.0.0 * - * @param {TimerEventConfig} config - The configuration for the Timer Event. + * @param {Phaser.Time.Types.TimerEventConfig} config - The configuration for the Timer Event. * * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ @@ -366,9 +367,9 @@ var Clock = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -383,7 +384,7 @@ var Clock = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/time/TimerEvent.js b/src/time/TimerEvent.js index 28d4fba1a..da9f5daa5 100644 --- a/src/time/TimerEvent.js +++ b/src/time/TimerEvent.js @@ -1,26 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var GetFastValue = require('../utils/object/GetFastValue'); -/** - * @typedef {object} TimerEventConfig - * - * @property {number} [delay=0] - The delay after which the Timer Event should fire, in milliseconds. - * @property {number} [repeat=0] - The total number of times the Timer Event will repeat before finishing. - * @property {boolean} [loop=false] - `true` if the Timer Event should repeat indefinitely. - * @property {function} [callback] - The callback which will be called when the Timer Event fires. - * @property {*} [callbackScope] - The scope (`this` object) with which to invoke the `callback`. - * @property {Array.<*>} [args] - Additional arguments to be passed to the `callback`. - * @property {number} [timeScale=1] - The scale of the elapsed time. - * @property {number} [startAt=1] - The initial elapsed time in milliseconds. Useful if you want a long duration with repeat, but for the first loop to fire quickly. - * @property {boolean} [paused=false] - `true` if the Timer Event should be paused. - */ - /** * @classdesc * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. @@ -32,7 +18,7 @@ var GetFastValue = require('../utils/object/GetFastValue'); * @constructor * @since 3.0.0 * - * @param {TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. + * @param {Phaser.Time.Types.TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. */ var TimerEvent = new Class({ @@ -173,7 +159,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#reset * @since 3.0.0 * - * @param {TimerEventConfig} config - The new state for the Timer Event. + * @param {Phaser.Time.Types.TimerEventConfig} config - The new state for the Timer Event. * * @return {Phaser.Time.TimerEvent} This TimerEvent object. */ @@ -288,7 +274,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#remove * @since 3.0.0 * - * @param {function} dispatchCallback - If `true` (by default `false`), the function of the Timer Event will be called before its removal from its Clock. + * @param {boolean} [dispatchCallback] - If `true` (by default `false`), the function of the Timer Event will be called before its removal from its Clock. */ remove: function (dispatchCallback) { diff --git a/src/time/index.js b/src/time/index.js index 47ef8b508..0499f1b57 100644 --- a/src/time/index.js +++ b/src/time/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/time/typedefs/TimerEventConfig.js b/src/time/typedefs/TimerEventConfig.js new file mode 100644 index 000000000..d56cc86c2 --- /dev/null +++ b/src/time/typedefs/TimerEventConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Time.Types.TimerEventConfig + * @since 3.0.0 + * + * @property {number} [delay=0] - The delay after which the Timer Event should fire, in milliseconds. + * @property {number} [repeat=0] - The total number of times the Timer Event will repeat before finishing. + * @property {boolean} [loop=false] - `true` if the Timer Event should repeat indefinitely. + * @property {function} [callback] - The callback which will be called when the Timer Event fires. + * @property {*} [callbackScope] - The scope (`this` object) with which to invoke the `callback`. + * @property {Array.<*>} [args] - Additional arguments to be passed to the `callback`. + * @property {number} [timeScale=1] - The scale of the elapsed time. + * @property {number} [startAt=1] - The initial elapsed time in milliseconds. Useful if you want a long duration with repeat, but for the first loop to fire quickly. + * @property {boolean} [paused=false] - `true` if the Timer Event should be paused. + */ diff --git a/src/time/typedefs/index.js b/src/time/typedefs/index.js new file mode 100644 index 000000000..8f509e01b --- /dev/null +++ b/src/time/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Time.Types + */ diff --git a/src/tweens/Timeline.js b/src/tweens/Timeline.js index 8ab481664..1af77f7f6 100644 --- a/src/tweens/Timeline.js +++ b/src/tweens/Timeline.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var EventEmitter = require('eventemitter3'); +var Events = require('./events'); var TweenBuilder = require('./builders/TweenBuilder'); var TWEEN_CONST = require('./tween/const'); @@ -567,6 +568,7 @@ var Timeline = new Class({ * Starts playing the timeline. * * @method Phaser.Tweens.Timeline#play + * @fires Phaser.Tweens.Events#TIMELINE_START * @since 3.0.0 */ play: function () @@ -598,13 +600,15 @@ var Timeline = new Class({ onStart.func.apply(onStart.scope, onStart.params); } - this.emit('start', this); + this.emit(Events.TIMELINE_START, this); }, /** * [description] * * @method Phaser.Tweens.Timeline#nextState + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_LOOP * @since 3.0.0 */ nextState: function () @@ -627,7 +631,7 @@ var Timeline = new Class({ onLoop.func.apply(onLoop.scope, onLoop.params); } - this.emit('loop', this, this.loopCounter); + this.emit(Events.TIMELINE_LOOP, this, this.loopCounter); this.resetTweens(true); @@ -648,6 +652,8 @@ var Timeline = new Class({ } else { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -655,9 +661,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } }, @@ -666,6 +670,8 @@ var Timeline = new Class({ * Otherwise, returns false. * * @method Phaser.Tweens.Timeline#update + * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE + * @fires Phaser.Tweens.Events#TIMELINE_UPDATE * @since 3.0.0 * * @param {number} timestamp - [description] @@ -718,7 +724,7 @@ var Timeline = new Class({ onUpdate.func.apply(onUpdate.scope, onUpdate.params); } - this.emit('update', this); + this.emit(Events.TIMELINE_UPDATE, this); // Anything still running? If not, we're done if (stillRunning === 0) @@ -745,6 +751,8 @@ var Timeline = new Class({ if (this.countdown <= 0) { + this.state = TWEEN_CONST.PENDING_REMOVE; + var onComplete = this.callbacks.onComplete; if (onComplete) @@ -752,9 +760,7 @@ var Timeline = new Class({ onComplete.func.apply(onComplete.scope, onComplete.params); } - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; + this.emit(Events.TIMELINE_COMPLETE, this); } break; @@ -778,6 +784,7 @@ var Timeline = new Class({ * Pauses the timeline, retaining its internal state. * * @method Phaser.Tweens.Timeline#pause + * @fires Phaser.Tweens.Events#TIMELINE_PAUSE * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -795,7 +802,7 @@ var Timeline = new Class({ this.state = TWEEN_CONST.PAUSED; - this.emit('pause', this); + this.emit(Events.TIMELINE_PAUSE, this); return this; }, @@ -804,6 +811,7 @@ var Timeline = new Class({ * Resumes the timeline from where it was when it was paused. * * @method Phaser.Tweens.Timeline#resume + * @fires Phaser.Tweens.Events#TIMELINE_RESUME * @since 3.0.0 * * @return {Phaser.Tweens.Timeline} This Timeline object. @@ -817,7 +825,7 @@ var Timeline = new Class({ this.state = this._pausedState; } - this.emit('resume', this); + this.emit(Events.TIMELINE_RESUME, this); return this; }, diff --git a/src/tweens/TweenManager.js b/src/tweens/TweenManager.js index 309f0efa4..026873476 100644 --- a/src/tweens/TweenManager.js +++ b/src/tweens/TweenManager.js @@ -1,12 +1,13 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Class = require('../utils/Class'); var NumberTweenBuilder = require('./builders/NumberTweenBuilder'); var PluginCache = require('../plugins/PluginCache'); +var SceneEvents = require('../scene/events'); var TimelineBuilder = require('./builders/TimelineBuilder'); var TWEEN_CONST = require('./tween/const'); var TweenBuilder = require('./builders/TweenBuilder'); @@ -109,8 +110,8 @@ var TweenManager = new Class({ */ this._toProcess = 0; - scene.sys.events.once('boot', this.boot, this); - scene.sys.events.on('start', this.start, this); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** @@ -123,7 +124,7 @@ var TweenManager = new Class({ */ boot: function () { - this.systems.events.once('destroy', this.destroy, this); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -139,9 +140,9 @@ var TweenManager = new Class({ { var eventEmitter = this.systems.events; - eventEmitter.on('preupdate', this.preUpdate, this); - eventEmitter.on('update', this.update, this); - eventEmitter.once('shutdown', this.shutdown, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); this.timeScale = 1; }, @@ -666,9 +667,9 @@ var TweenManager = new Class({ var eventEmitter = this.systems.events; - eventEmitter.off('preupdate', this.preUpdate, this); - eventEmitter.off('update', this.update, this); - eventEmitter.off('shutdown', this.shutdown, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** @@ -682,7 +683,7 @@ var TweenManager = new Class({ { this.shutdown(); - this.scene.sys.events.off('start', this.start, this); + this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null; this.systems = null; diff --git a/src/tweens/builders/GetBoolean.js b/src/tweens/builders/GetBoolean.js index 1fb2901bf..30594f19f 100644 --- a/src/tweens/builders/GetBoolean.js +++ b/src/tweens/builders/GetBoolean.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/GetEaseFunction.js b/src/tweens/builders/GetEaseFunction.js index 3dcc08e30..f64b3b5c2 100644 --- a/src/tweens/builders/GetEaseFunction.js +++ b/src/tweens/builders/GetEaseFunction.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/GetNewValue.js b/src/tweens/builders/GetNewValue.js index 224307271..49dc95458 100644 --- a/src/tweens/builders/GetNewValue.js +++ b/src/tweens/builders/GetNewValue.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/GetProps.js b/src/tweens/builders/GetProps.js index f2bc8c018..71adb1910 100644 --- a/src/tweens/builders/GetProps.js +++ b/src/tweens/builders/GetProps.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/GetTargets.js b/src/tweens/builders/GetTargets.js index 0963c3e7c..6d29e8912 100644 --- a/src/tweens/builders/GetTargets.js +++ b/src/tweens/builders/GetTargets.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/GetTweens.js b/src/tweens/builders/GetTweens.js index 0ffcdac6c..01208e901 100644 --- a/src/tweens/builders/GetTweens.js +++ b/src/tweens/builders/GetTweens.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/GetValueOp.js b/src/tweens/builders/GetValueOp.js index 8abcd9025..f59c95e4d 100644 --- a/src/tweens/builders/GetValueOp.js +++ b/src/tweens/builders/GetValueOp.js @@ -1,19 +1,28 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @ignore + */ function hasGetStart (def) { return (!!def.getStart && typeof def.getStart === 'function'); } +/** + * @ignore + */ function hasGetEnd (def) { return (!!def.getEnd && typeof def.getEnd === 'function'); } +/** + * @ignore + */ function hasGetters (def) { return hasGetStart(def) || hasGetEnd(def); diff --git a/src/tweens/builders/NumberTweenBuilder.js b/src/tweens/builders/NumberTweenBuilder.js index 151665b8b..11d1cfca5 100644 --- a/src/tweens/builders/NumberTweenBuilder.js +++ b/src/tweens/builders/NumberTweenBuilder.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -22,7 +22,7 @@ var TweenData = require('../tween/TweenData'); * * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] * @param {object} config - [description] - * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description] + * @param {Phaser.Tweens.Types.TweenConfigDefaults} defaults - [description] * * @return {Phaser.Tweens.Tween} [description] */ diff --git a/src/tweens/builders/TimelineBuilder.js b/src/tweens/builders/TimelineBuilder.js index a282527b6..9c9690e86 100644 --- a/src/tweens/builders/TimelineBuilder.js +++ b/src/tweens/builders/TimelineBuilder.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/builders/TweenBuilder.js b/src/tweens/builders/TweenBuilder.js index c9102f926..d2077f087 100644 --- a/src/tweens/builders/TweenBuilder.js +++ b/src/tweens/builders/TweenBuilder.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -24,7 +24,7 @@ var TweenData = require('../tween/TweenData'); * * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] * @param {object} config - [description] - * @param {Phaser.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. + * @param {Phaser.Tweens.Types.TweenConfigDefaults} defaults - Tween configuration defaults. ` * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. diff --git a/src/tweens/builders/index.js b/src/tweens/builders/index.js index 16cd7aba6..6f200b670 100644 --- a/src/tweens/builders/index.js +++ b/src/tweens/builders/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/events/TIMELINE_COMPLETE_EVENT.js b/src/tweens/events/TIMELINE_COMPLETE_EVENT.js new file mode 100644 index 000000000..1555db348 --- /dev/null +++ b/src/tweens/events/TIMELINE_COMPLETE_EVENT.js @@ -0,0 +1,30 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Complete Event. + * + * This event is dispatched by a Tween Timeline when it completes playback. + * + * Listen to it from a Timeline instance using `Timeline.on('complete', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('complete', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_COMPLETE + * @since 3.0.0 + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'complete'; diff --git a/src/tweens/events/TIMELINE_LOOP_EVENT.js b/src/tweens/events/TIMELINE_LOOP_EVENT.js new file mode 100644 index 000000000..edf583636 --- /dev/null +++ b/src/tweens/events/TIMELINE_LOOP_EVENT.js @@ -0,0 +1,32 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Loop Event. + * + * This event is dispatched by a Tween Timeline every time it loops. + * + * Listen to it from a Timeline instance using `Timeline.on('loop', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * loop: 4, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('loop', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_LOOP + * @since 3.0.0 + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + * @param {integer} loopCount - The number of loops left before this Timeline completes. + */ +module.exports = 'loop'; diff --git a/src/tweens/events/TIMELINE_PAUSE_EVENT.js b/src/tweens/events/TIMELINE_PAUSE_EVENT.js new file mode 100644 index 000000000..d4b601210 --- /dev/null +++ b/src/tweens/events/TIMELINE_PAUSE_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Pause Event. + * + * This event is dispatched by a Tween Timeline when it is paused. + * + * Listen to it from a Timeline instance using `Timeline.on('pause', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('pause', listener); + * // At some point later ... + * timeline.pause(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_PAUSE + * @since 3.0.0 + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'pause'; diff --git a/src/tweens/events/TIMELINE_RESUME_EVENT.js b/src/tweens/events/TIMELINE_RESUME_EVENT.js new file mode 100644 index 000000000..0d1931ab2 --- /dev/null +++ b/src/tweens/events/TIMELINE_RESUME_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Resume Event. + * + * This event is dispatched by a Tween Timeline when it is resumed from a paused state. + * + * Listen to it from a Timeline instance using `Timeline.on('resume', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('resume', listener); + * // At some point later ... + * timeline.resume(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_RESUME + * @since 3.0.0 + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'resume'; diff --git a/src/tweens/events/TIMELINE_START_EVENT.js b/src/tweens/events/TIMELINE_START_EVENT.js new file mode 100644 index 000000000..1c849c0b9 --- /dev/null +++ b/src/tweens/events/TIMELINE_START_EVENT.js @@ -0,0 +1,30 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Start Event. + * + * This event is dispatched by a Tween Timeline when it starts. + * + * Listen to it from a Timeline instance using `Timeline.on('start', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('start', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_START + * @since 3.0.0 + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'start'; diff --git a/src/tweens/events/TIMELINE_UPDATE_EVENT.js b/src/tweens/events/TIMELINE_UPDATE_EVENT.js new file mode 100644 index 000000000..96a43208e --- /dev/null +++ b/src/tweens/events/TIMELINE_UPDATE_EVENT.js @@ -0,0 +1,31 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * The Timeline Update Event. + * + * This event is dispatched by a Tween Timeline every time it updates, which can happen a lot of times per second, + * so be careful about listening to this event unless you absolutely require it. + * + * Listen to it from a Timeline instance using `Timeline.on('update', listener)`, i.e.: + * + * ```javascript + * var timeline = this.tweens.timeline({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] + * }); + * timeline.on('update', listener); + * timeline.play(); + * ``` + * + * @event Phaser.Tweens.Events#TIMELINE_UPDATE + * @since 3.0.0 + * + * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. + */ +module.exports = 'update'; diff --git a/src/tweens/events/index.js b/src/tweens/events/index.js new file mode 100644 index 000000000..00662b010 --- /dev/null +++ b/src/tweens/events/index.js @@ -0,0 +1,20 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tweens.Events + */ + +module.exports = { + + TIMELINE_COMPLETE: require('./TIMELINE_COMPLETE_EVENT'), + TIMELINE_LOOP: require('./TIMELINE_LOOP_EVENT'), + TIMELINE_PAUSE: require('./TIMELINE_PAUSE_EVENT'), + TIMELINE_RESUME: require('./TIMELINE_RESUME_EVENT'), + TIMELINE_START: require('./TIMELINE_START_EVENT'), + TIMELINE_UPDATE: require('./TIMELINE_UPDATE_EVENT') + +}; diff --git a/src/tweens/index.js b/src/tweens/index.js index 651013778..a279c16fc 100644 --- a/src/tweens/index.js +++ b/src/tweens/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -14,6 +14,7 @@ var Extend = require('../utils/object/Extend'); var Tweens = { Builders: require('./builders'), + Events: require('./events'), TweenManager: require('./TweenManager'), Tween: require('./tween/Tween'), diff --git a/src/tweens/tween/Defaults.js b/src/tweens/tween/Defaults.js index eefd0cfb4..9e786abc2 100644 --- a/src/tweens/tween/Defaults.js +++ b/src/tweens/tween/Defaults.js @@ -1,11 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @typedef {object} Phaser.Tweens.TweenConfigDefaults + * @typedef {object} Phaser.Tweens.Types.TweenConfigDefaults + * @since 3.0.0 * * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. diff --git a/src/tweens/tween/ReservedProps.js b/src/tweens/tween/ReservedProps.js index 6418a99ce..309870dcb 100644 --- a/src/tweens/tween/ReservedProps.js +++ b/src/tweens/tween/ReservedProps.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/tween/Tween.js b/src/tweens/tween/Tween.js index 66624c25b..834c0ddb3 100644 --- a/src/tweens/tween/Tween.js +++ b/src/tweens/tween/Tween.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -11,16 +11,18 @@ var TWEEN_CONST = require('./const'); /** * @classdesc - * [description] + * A Tween is able to manipulate the properties of one or more objects to any given value, based + * on a duration and type of ease. They are rarely instantiated directly and instead should be + * created via the TweenManager. * * @class Tween * @memberof Phaser.Tweens * @constructor * @since 3.0.0 * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description] - * @param {Phaser.Tweens.TweenDataConfig[]} data - [description] - * @param {array} targets - [description] + * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - A reference to the parent of this Tween. Either the Tween Manager or a Tween Timeline instance. + * @param {Phaser.Tweens.Types.TweenDataConfig[]} data - An array of TweenData objects, each containing a unique property to be tweened. + * @param {array} targets - An array of targets to be tweened. */ var Tween = new Class({ @@ -29,7 +31,8 @@ var Tween = new Class({ function Tween (parent, data, targets) { /** - * [description] + * A reference to the parent of this Tween. + * Either the Tween Manager or a Tween Timeline instance. * * @name Phaser.Tweens.Tween#parent * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} @@ -50,13 +53,13 @@ var Tween = new Class({ * An array of TweenData objects, each containing a unique property and target being tweened. * * @name Phaser.Tweens.Tween#data - * @type {Phaser.Tweens.TweenDataConfig[]} + * @type {Phaser.Tweens.Types.TweenDataConfig[]} * @since 3.0.0 */ this.data = data; /** - * data array doesn't change, so we can cache the length + * The cached length of the data array. * * @name Phaser.Tweens.Tween#totalData * @type {integer} @@ -65,7 +68,7 @@ var Tween = new Class({ this.totalData = data.length; /** - * An array of references to the target/s this Tween is operating on + * An array of references to the target/s this Tween is operating on. * * @name Phaser.Tweens.Tween#targets * @type {object[]} @@ -83,7 +86,7 @@ var Tween = new Class({ this.totalTargets = targets.length; /** - * If true then duration, delay, etc values are all frame totals. + * If `true` then duration, delay, etc values are all frame totals. * * @name Phaser.Tweens.Tween#useFrames * @type {boolean} @@ -105,7 +108,7 @@ var Tween = new Class({ /** * 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) + * When enabled it will play through ALL TweenDatas again. Use TweenData.repeat to loop a single element. * * @name Phaser.Tweens.Tween#loop * @type {number} @@ -289,7 +292,7 @@ var Tween = new Class({ * @method Phaser.Tweens.Tween#getValue * @since 3.0.0 * - * @return {number} [description] + * @return {number} The value of the Tween. */ getValue: function () { @@ -304,7 +307,7 @@ var Tween = new Class({ * * @param {number} value - The scale factor for timescale. * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ setTimeScale: function (value) { @@ -358,9 +361,9 @@ var Tween = new Class({ * @method Phaser.Tweens.Tween#hasTarget * @since 3.0.0 * - * @param {object} target - [description] + * @param {object} target - The target to check against this Tween. * - * @return {boolean} [description] + * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`. */ hasTarget: function (target) { @@ -368,19 +371,24 @@ var Tween = new Class({ }, /** - * [description] + * Updates the value of a property of this Tween to a new value, without adjusting the + * Tween duration or current progress. + * + * You can optionally tell it to set the 'start' value to be the current value (before the change). * * @method Phaser.Tweens.Tween#updateTo * @since 3.0.0 * - * @param {string} key - [description] - * @param {*} value - [description] - * @param {boolean} startToCurrent - [description] + * @param {string} key - The property to set the new value for. + * @param {*} value - The new value of the property. + * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value? * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ updateTo: function (key, value, startToCurrent) { + if (startToCurrent === undefined) { startToCurrent = false; } + for (var i = 0; i < this.totalData; i++) { var tweenData = this.data[i]; @@ -406,6 +414,8 @@ var Tween = new Class({ * * @method Phaser.Tweens.Tween#restart * @since 3.0.0 + * + * @return {this} This Tween instance. */ restart: function () { @@ -419,10 +429,12 @@ var Tween = new Class({ this.stop(); this.play(); } + + return this; }, /** - * [description] + * Internal method that calculates the overall duration of the Tween. * * @method Phaser.Tweens.Tween#calcDuration * @since 3.0.0 @@ -533,7 +545,7 @@ var Tween = new Class({ }, /** - * [description] + * Internal method that advances to the next state of the Tween during playback. * * @method Phaser.Tweens.Tween#nextState * @since 3.0.0 @@ -588,12 +600,12 @@ var Tween = new Class({ }, /** - * [description] + * Pauses the Tween immediately. Use `resume` to continue playback. * * @method Phaser.Tweens.Tween#pause * @since 3.0.0 * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ pause: function () { @@ -612,18 +624,22 @@ var Tween = new Class({ }, /** - * [description] + * Starts a Tween playing. + * + * You only need to call this method if you have configured the tween to be paused on creation. * * @method Phaser.Tweens.Tween#play * @since 3.0.0 * - * @param {boolean} resetFromTimeline - [description] + * @param {boolean} resetFromTimeline - Is this Tween being played as part of a Timeline? + * + * @return {this} This Tween instance. */ play: function (resetFromTimeline) { if (this.state === TWEEN_CONST.ACTIVE) { - return; + return this; } else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED) { @@ -677,15 +693,17 @@ var Tween = new Class({ this.parent.makeActive(this); } + + return this; }, /** - * [description] + * Internal method that resets all of the Tween Data, including the progress and elapsed values. * * @method Phaser.Tweens.Tween#resetTweenData * @since 3.0.0 * - * @param {boolean} resetFromLoop - [description] + * @param {boolean} resetFromLoop - Has this method been called as part of a loop? */ resetTweenData: function (resetFromLoop) { @@ -728,7 +746,7 @@ var Tween = new Class({ * @method Phaser.Tweens.Tween#resume * @since 3.0.0 * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} - This Tween instance. */ resume: function () { @@ -747,12 +765,14 @@ var Tween = new Class({ }, /** - * [description] + * Attempts to seek to a specific position in a Tween. * * @method Phaser.Tweens.Tween#seek * @since 3.0.0 * - * @param {number} toPosition - A value between 0 and 1. + * @param {number} toPosition - A value between 0 and 1 which represents the progress point to seek to. + * + * @return {this} This Tween instance. */ seek: function (toPosition) { @@ -811,19 +831,14 @@ var Tween = new Class({ tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - // console.log(tweenData.key, 'Seek', tweenData.target[tweenData.key], 'to', tweenData.current, 'pro', tweenData.progress, 'marker', toPosition, progress); - - // if (tweenData.current === 0) - // { - // console.log('zero', tweenData.start, tweenData.end, v, 'progress', progress); - // } - tweenData.target[tweenData.key] = tweenData.current; } + + return this; }, /** - * [description] + * Sets an event based callback to be invoked during playback. * * @method Phaser.Tweens.Tween#setCallback * @since 3.0.0 @@ -831,9 +846,9 @@ var Tween = new Class({ * @param {string} type - Type of the callback. * @param {function} callback - Callback function. * @param {array} [params] - An array of parameters for specified callbacks types. - * @param {object} [scope] - [description] + * @param {object} [scope] - The context the callback will be invoked in. * - * @return {Phaser.Tweens.Tween} This Tween object. + * @return {this} This Tween instance. */ setCallback: function (type, callback, params, scope) { @@ -854,6 +869,8 @@ var Tween = new Class({ * @since 3.2.0 * * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately. + * + * @return {this} This Tween instance. */ complete: function (delay) { @@ -877,6 +894,8 @@ var Tween = new Class({ this.state = TWEEN_CONST.PENDING_REMOVE; } + + return this; }, /** @@ -886,6 +905,8 @@ var Tween = new Class({ * @since 3.0.0 * * @param {number} [resetTo] - A value between 0 and 1. + * + * @return {this} This Tween instance. */ stop: function (resetTo) { @@ -907,10 +928,12 @@ var Tween = new Class({ this.state = TWEEN_CONST.PENDING_REMOVE; } + + return this; }, /** - * [description] + * Internal method that advances the Tween based on the time values. * * @method Phaser.Tweens.Tween#update * @since 3.0.0 @@ -1016,14 +1039,14 @@ var Tween = new Class({ }, /** - * [description] + * Internal method used as part of the playback process that sets a tween to play in reverse. * * @method Phaser.Tweens.Tween#setStateFromEnd * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] - * @param {number} diff - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.Types.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * * @return {integer} The state of this Tween. */ @@ -1120,14 +1143,14 @@ var Tween = new Class({ }, /** - * Was PLAYING_BACKWARD and has hit the start. + * Internal method used as part of the playback process that sets a tween to play from the start. * * @method Phaser.Tweens.Tween#setStateFromStart * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - A TweenData object contains all the information related to a tween. Created by and belongs to a Phaser.Tween object. - * @param {number} diff - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.Types.TweenDataConfig} tweenData - The TweenData property to update. + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * * @return {integer} The state of this Tween. */ @@ -1184,13 +1207,13 @@ var Tween = new Class({ }, /** - * [description] + * Internal method that advances the TweenData based on the time value given. * * @method Phaser.Tweens.Tween#updateTweenData * @since 3.0.0 * - * @param {Phaser.Tweens.Tween} tween - [description] - * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description] + * @param {Phaser.Tweens.Tween} tween - The Tween to update. + * @param {Phaser.Tweens.Types.TweenDataConfig} tweenData - The TweenData property to update. * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true * * @return {boolean} [description] diff --git a/src/tweens/tween/TweenData.js b/src/tweens/tween/TweenData.js index 6146f8081..9e2a5e409 100644 --- a/src/tweens/tween/TweenData.js +++ b/src/tweens/tween/TweenData.js @@ -1,48 +1,9 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @typedef {object} TweenDataGenConfig - * - * @property {function} delay - Time in ms/frames before tween will start. - * @property {function} duration - Duration of the tween in ms/frames, excludes time for yoyo or repeats. - * @property {function} hold - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - * @property {function} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - * @property {function} repeatDelay - Time in ms/frames before the repeat will start. - */ - -/** - * @typedef {object} Phaser.Tweens.TweenDataConfig - * - * @property {object} target - The target to tween. - * @property {string} key - The property of the target being tweened. - * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween. - * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween. - * @property {function} ease - The ease function this tween uses. - * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats. - * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) - * @property {number} [delay=0] - Time in ms/frames before tween will start. - * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired. - * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start. - * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats - * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats - * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData. - * @property {number} [elapsed=0] - Delta counter - * @property {integer} [repeatCounter=0] - How many repeats are left to run? - * @property {number} [start=0] - Ease value data. - * @property {number} [current=0] - Ease value data. - * @property {number} [end=0] - Ease value data. - * @property {number} [t1=0] - Time duration 1. - * @property {number} [t2=0] - Time duration 2. - * @property {TweenDataGenConfig} [gen] - LoadValue generation functions. - * @property {integer} [state=0] - TWEEN_CONST.CREATED - */ - /** * Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween. * @@ -65,7 +26,7 @@ * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? * - * @return {TweenDataConfig} The config object describing this TweenData. + * @return {Phaser.Tweens.Types.TweenDataConfig} The config object describing this TweenData. */ var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) { diff --git a/src/tweens/tween/const.js b/src/tweens/tween/const.js index a44ce57f6..efb460bee 100644 --- a/src/tweens/tween/const.js +++ b/src/tweens/tween/const.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/tweens/typedefs/TweenDataConfig.js b/src/tweens/typedefs/TweenDataConfig.js new file mode 100644 index 000000000..d92bbec49 --- /dev/null +++ b/src/tweens/typedefs/TweenDataConfig.js @@ -0,0 +1,29 @@ +/** + * @typedef {object} Phaser.Tweens.Types.TweenDataConfig + * @since 3.0.0 + * + * @property {any} target - The target to tween. + * @property {string} key - The property of the target being tweened. + * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween. + * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween. + * @property {function} ease - The ease function this tween uses. + * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) + * @property {number} [delay=0] - Time in ms/frames before tween will start. + * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired. + * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start. + * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats + * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats + * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData. + * @property {number} [elapsed=0] - Delta counter + * @property {integer} [repeatCounter=0] - How many repeats are left to run? + * @property {number} [start=0] - Ease value data. + * @property {number} [current=0] - Ease value data. + * @property {number} [end=0] - Ease value data. + * @property {number} [t1=0] - Time duration 1. + * @property {number} [t2=0] - Time duration 2. + * @property {Phaser.Tweens.Types.TweenDataGenConfig} [gen] - LoadValue generation functions. + * @property {integer} [state=0] - TWEEN_CONST.CREATED + */ diff --git a/src/tweens/typedefs/TweenDataGenConfig.js b/src/tweens/typedefs/TweenDataGenConfig.js new file mode 100644 index 000000000..12b85be94 --- /dev/null +++ b/src/tweens/typedefs/TweenDataGenConfig.js @@ -0,0 +1,10 @@ +/** + * @typedef {object} Phaser.Tweens.Types.TweenDataGenConfig + * @since 3.0.0 + * + * @property {function} delay - Time in ms/frames before tween will start. + * @property {function} duration - Duration of the tween in ms/frames, excludes time for yoyo or repeats. + * @property {function} hold - Time in ms/frames the tween will pause before running the yoyo or starting a repeat. + * @property {function} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @property {function} repeatDelay - Time in ms/frames before the repeat will start. + */ diff --git a/src/tweens/typedefs/index.js b/src/tweens/typedefs/index.js new file mode 100644 index 000000000..eddb0e57a --- /dev/null +++ b/src/tweens/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2019 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tweens.Types + */ diff --git a/src/utils/Class.js b/src/utils/Class.js index 9b731941b..4cc10a5ed 100644 --- a/src/utils/Class.js +++ b/src/utils/Class.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -66,6 +66,15 @@ function hasNonConfigurable (obj, k) return false; } +/** + * Extends the given `myClass` object's prototype with the properties of `definition`. + * + * @function Phaser.Class.extend + * @param {Object} ctor The constructor object to mix into. + * @param {Object} definition A dictionary of functions for the class. + * @param {boolean} isClassDescriptor Is the definition a class descriptor? + * @param {Object} [extend] The parent constructor object. + */ function extend (ctor, definition, isClassDescriptor, extend) { for (var k in definition) @@ -108,6 +117,13 @@ function extend (ctor, definition, isClassDescriptor, extend) } } +/** + * Applies the given `mixins` to the prototype of `myClass`. + * + * @function Phaser.Class.mixin + * @param {Object} myClass The constructor object to mix into. + * @param {Object|Array} mixins The mixins to apply to the constructor. + */ function mixin (myClass, mixins) { if (!mixins) @@ -136,7 +152,7 @@ function mixin (myClass, mixins) * You can also use `Extends` and `Mixins` to provide subclassing * and inheritance. * - * @class Class + * @class Phaser.Class * @constructor * @param {Object} definition a dictionary of functions for the class * @example diff --git a/src/utils/NOOP.js b/src/utils/NOOP.js index 9975cb2bc..d8e211525 100644 --- a/src/utils/NOOP.js +++ b/src/utils/NOOP.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/Add.js b/src/utils/array/Add.js index 0d2b44bed..0a9ef9b69 100644 --- a/src/utils/array/Add.js +++ b/src/utils/array/Add.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/AddAt.js b/src/utils/array/AddAt.js index 99ebc4517..526fc1050 100644 --- a/src/utils/array/AddAt.js +++ b/src/utils/array/AddAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/BringToTop.js b/src/utils/array/BringToTop.js index a11f14108..447296b57 100644 --- a/src/utils/array/BringToTop.js +++ b/src/utils/array/BringToTop.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/CountAllMatching.js b/src/utils/array/CountAllMatching.js index 9263123b5..c041c17d5 100644 --- a/src/utils/array/CountAllMatching.js +++ b/src/utils/array/CountAllMatching.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/Each.js b/src/utils/array/Each.js index cc980135b..481b0ed7c 100644 --- a/src/utils/array/Each.js +++ b/src/utils/array/Each.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/EachInRange.js b/src/utils/array/EachInRange.js index a6e122f10..0b64101e1 100644 --- a/src/utils/array/EachInRange.js +++ b/src/utils/array/EachInRange.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/FindClosestInSorted.js b/src/utils/array/FindClosestInSorted.js index b3cb13680..16db35833 100644 --- a/src/utils/array/FindClosestInSorted.js +++ b/src/utils/array/FindClosestInSorted.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/GetAll.js b/src/utils/array/GetAll.js index 9d1eac2f7..a54469fc9 100644 --- a/src/utils/array/GetAll.js +++ b/src/utils/array/GetAll.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/GetFirst.js b/src/utils/array/GetFirst.js index e456222bc..f0f0e52b2 100644 --- a/src/utils/array/GetFirst.js +++ b/src/utils/array/GetFirst.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/GetRandom.js b/src/utils/array/GetRandom.js index 3020d8341..a29bdb1d4 100644 --- a/src/utils/array/GetRandom.js +++ b/src/utils/array/GetRandom.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/MoveDown.js b/src/utils/array/MoveDown.js index bc6d823dc..551a2fc88 100644 --- a/src/utils/array/MoveDown.js +++ b/src/utils/array/MoveDown.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/MoveTo.js b/src/utils/array/MoveTo.js index b15f36f6e..9dfbdd12c 100644 --- a/src/utils/array/MoveTo.js +++ b/src/utils/array/MoveTo.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/MoveUp.js b/src/utils/array/MoveUp.js index a66668014..68234b307 100644 --- a/src/utils/array/MoveUp.js +++ b/src/utils/array/MoveUp.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/NumberArray.js b/src/utils/array/NumberArray.js index b745dfbfa..d546c3709 100644 --- a/src/utils/array/NumberArray.js +++ b/src/utils/array/NumberArray.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/NumberArrayStep.js b/src/utils/array/NumberArrayStep.js index 5c99c8bc1..dc3c5e68e 100644 --- a/src/utils/array/NumberArrayStep.js +++ b/src/utils/array/NumberArrayStep.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/QuickSelect.js b/src/utils/array/QuickSelect.js index 7943ab6b0..b8a997185 100644 --- a/src/utils/array/QuickSelect.js +++ b/src/utils/array/QuickSelect.js @@ -1,9 +1,12 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @ignore + */ function swap (arr, i, j) { var tmp = arr[i]; @@ -11,6 +14,9 @@ function swap (arr, i, j) arr[j] = tmp; } +/** + * @ignore + */ function defaultCompare (a, b) { return a < b ? -1 : a > b ? 1 : 0; diff --git a/src/utils/array/Range.js b/src/utils/array/Range.js index c79649c27..d65c0c991 100644 --- a/src/utils/array/Range.js +++ b/src/utils/array/Range.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/Remove.js b/src/utils/array/Remove.js index 7415b2303..f0b5bcfdb 100644 --- a/src/utils/array/Remove.js +++ b/src/utils/array/Remove.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/RemoveAt.js b/src/utils/array/RemoveAt.js index 3203195b7..fec02195b 100644 --- a/src/utils/array/RemoveAt.js +++ b/src/utils/array/RemoveAt.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/RemoveBetween.js b/src/utils/array/RemoveBetween.js index d898538c1..769c78895 100644 --- a/src/utils/array/RemoveBetween.js +++ b/src/utils/array/RemoveBetween.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/RemoveRandomElement.js b/src/utils/array/RemoveRandomElement.js index 0925d0546..eea852deb 100644 --- a/src/utils/array/RemoveRandomElement.js +++ b/src/utils/array/RemoveRandomElement.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/Replace.js b/src/utils/array/Replace.js index d7261f245..1c6ac0016 100644 --- a/src/utils/array/Replace.js +++ b/src/utils/array/Replace.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/RotateLeft.js b/src/utils/array/RotateLeft.js index a5813cb8c..07b5529d5 100644 --- a/src/utils/array/RotateLeft.js +++ b/src/utils/array/RotateLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/RotateRight.js b/src/utils/array/RotateRight.js index 22c43c148..82a98e045 100644 --- a/src/utils/array/RotateRight.js +++ b/src/utils/array/RotateRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/SafeRange.js b/src/utils/array/SafeRange.js index abc0848eb..03e7db2f5 100644 --- a/src/utils/array/SafeRange.js +++ b/src/utils/array/SafeRange.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/SendToBack.js b/src/utils/array/SendToBack.js index 86eed1975..a27549e3e 100644 --- a/src/utils/array/SendToBack.js +++ b/src/utils/array/SendToBack.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/SetAll.js b/src/utils/array/SetAll.js index caf61607c..074fe8eaa 100644 --- a/src/utils/array/SetAll.js +++ b/src/utils/array/SetAll.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/Shuffle.js b/src/utils/array/Shuffle.js index f8b9454e9..937b33a46 100644 --- a/src/utils/array/Shuffle.js +++ b/src/utils/array/Shuffle.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/SpliceOne.js b/src/utils/array/SpliceOne.js index 25a7319bb..0ce2b4c4c 100644 --- a/src/utils/array/SpliceOne.js +++ b/src/utils/array/SpliceOne.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/StableSort.js b/src/utils/array/StableSort.js index 13d9be1cc..34c3769a5 100644 --- a/src/utils/array/StableSort.js +++ b/src/utils/array/StableSort.js @@ -1,12 +1,16 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ //! stable.js 0.1.6, https://github.com/Two-Screen/stable //! © 2017 Angry Bytes and contributors. MIT licensed. +/** + * @namespace Phaser.Utils.Array.StableSortFunctions + */ + (function() { /** @@ -28,7 +32,8 @@ var stable = function(arr, comp) { /** * Sort the input array and simply copy it back if the result isn't in the original array, which happens on an odd number of passes. * - * @function Phaser.Utils.Array.StableSort.inplace + * @function Phaser.Utils.Array.StableSortFunctions.inplace + * @memberof Phaser.Utils.Array.StableSortFunctions * @since 3.0.0 * * @param {array} arr - The input array. diff --git a/src/utils/array/Swap.js b/src/utils/array/Swap.js index 68a64d06f..c7968a71f 100644 --- a/src/utils/array/Swap.js +++ b/src/utils/array/Swap.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/index.js b/src/utils/array/index.js index f411de35c..b90e4027a 100644 --- a/src/utils/array/index.js +++ b/src/utils/array/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/CheckMatrix.js b/src/utils/array/matrix/CheckMatrix.js index c146672b2..80e3cce86 100644 --- a/src/utils/array/matrix/CheckMatrix.js +++ b/src/utils/array/matrix/CheckMatrix.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/MatrixToString.js b/src/utils/array/matrix/MatrixToString.js index 65dded167..e23a77ba5 100644 --- a/src/utils/array/matrix/MatrixToString.js +++ b/src/utils/array/matrix/MatrixToString.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/ReverseColumns.js b/src/utils/array/matrix/ReverseColumns.js index 216458caa..bc05374ef 100644 --- a/src/utils/array/matrix/ReverseColumns.js +++ b/src/utils/array/matrix/ReverseColumns.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/ReverseRows.js b/src/utils/array/matrix/ReverseRows.js index 7986d1f09..667611164 100644 --- a/src/utils/array/matrix/ReverseRows.js +++ b/src/utils/array/matrix/ReverseRows.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/Rotate180.js b/src/utils/array/matrix/Rotate180.js index cb202288c..97d478096 100644 --- a/src/utils/array/matrix/Rotate180.js +++ b/src/utils/array/matrix/Rotate180.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/RotateLeft.js b/src/utils/array/matrix/RotateLeft.js index 53b1b101e..923bf361e 100644 --- a/src/utils/array/matrix/RotateLeft.js +++ b/src/utils/array/matrix/RotateLeft.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/RotateMatrix.js b/src/utils/array/matrix/RotateMatrix.js index 940cc0794..818eb2c5e 100644 --- a/src/utils/array/matrix/RotateMatrix.js +++ b/src/utils/array/matrix/RotateMatrix.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/RotateRight.js b/src/utils/array/matrix/RotateRight.js index 73dec8d32..c8e12e473 100644 --- a/src/utils/array/matrix/RotateRight.js +++ b/src/utils/array/matrix/RotateRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/TransposeMatrix.js b/src/utils/array/matrix/TransposeMatrix.js index cf8fab963..ddcb2b733 100644 --- a/src/utils/array/matrix/TransposeMatrix.js +++ b/src/utils/array/matrix/TransposeMatrix.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/array/matrix/index.js b/src/utils/array/matrix/index.js index 0190f6f55..6dc2797a8 100644 --- a/src/utils/array/matrix/index.js +++ b/src/utils/array/matrix/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/index.js b/src/utils/index.js index 72f2a4ef7..c98337987 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/Clone.js b/src/utils/object/Clone.js index 821944fa2..7d32783f9 100644 --- a/src/utils/object/Clone.js +++ b/src/utils/object/Clone.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/Extend.js b/src/utils/object/Extend.js index 2406816e6..2b0290e5d 100644 --- a/src/utils/object/Extend.js +++ b/src/utils/object/Extend.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/GetAdvancedValue.js b/src/utils/object/GetAdvancedValue.js index e373751a6..36f4d40bf 100644 --- a/src/utils/object/GetAdvancedValue.js +++ b/src/utils/object/GetAdvancedValue.js @@ -1,10 +1,10 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH = require('../../math/const'); +var MATH = require('../../math'); var GetValue = require('./GetValue'); /** diff --git a/src/utils/object/GetFastValue.js b/src/utils/object/GetFastValue.js index cf95d37bc..d27c2bde3 100644 --- a/src/utils/object/GetFastValue.js +++ b/src/utils/object/GetFastValue.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/GetMinMaxValue.js b/src/utils/object/GetMinMaxValue.js index 562770b44..38d5e2a7c 100644 --- a/src/utils/object/GetMinMaxValue.js +++ b/src/utils/object/GetMinMaxValue.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/GetValue.js b/src/utils/object/GetValue.js index 1d495dfbb..ef766650a 100644 --- a/src/utils/object/GetValue.js +++ b/src/utils/object/GetValue.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -30,7 +30,7 @@ var GetValue = function (source, key, defaultValue) { return source[key]; } - else if (key.indexOf('.')) + else if (key.indexOf('.') !== -1) { var keys = key.split('.'); var parent = source; diff --git a/src/utils/object/HasAll.js b/src/utils/object/HasAll.js index 769fc67bf..505d32066 100644 --- a/src/utils/object/HasAll.js +++ b/src/utils/object/HasAll.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/HasAny.js b/src/utils/object/HasAny.js index 3d43d87e8..0109a26cf 100644 --- a/src/utils/object/HasAny.js +++ b/src/utils/object/HasAny.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/HasValue.js b/src/utils/object/HasValue.js index 3a4dd6d76..4b16349f0 100644 --- a/src/utils/object/HasValue.js +++ b/src/utils/object/HasValue.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/IsPlainObject.js b/src/utils/object/IsPlainObject.js index 5df7280f7..ccb0ecb2a 100644 --- a/src/utils/object/IsPlainObject.js +++ b/src/utils/object/IsPlainObject.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/Merge.js b/src/utils/object/Merge.js index 597371782..14c9b741c 100644 --- a/src/utils/object/Merge.js +++ b/src/utils/object/Merge.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/MergeRight.js b/src/utils/object/MergeRight.js index 1f347692c..bb57b12c8 100644 --- a/src/utils/object/MergeRight.js +++ b/src/utils/object/MergeRight.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/object/index.js b/src/utils/object/index.js index ad90d3b3e..51356ce8e 100644 --- a/src/utils/object/index.js +++ b/src/utils/object/index.js @@ -1,11 +1,11 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @namespace Phaser.Utils.Object + * @namespace Phaser.Utils.Objects */ module.exports = { diff --git a/src/utils/string/Format.js b/src/utils/string/Format.js index 8aebe0c31..83abc5955 100644 --- a/src/utils/string/Format.js +++ b/src/utils/string/Format.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/string/Pad.js b/src/utils/string/Pad.js index 59b707fef..c5b203d72 100644 --- a/src/utils/string/Pad.js +++ b/src/utils/string/Pad.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/string/Reverse.js b/src/utils/string/Reverse.js index 7e7d5d47a..e146a0b96 100644 --- a/src/utils/string/Reverse.js +++ b/src/utils/string/Reverse.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ @@ -8,16 +8,16 @@ * Takes the given string and reverses it, returning the reversed string. * For example if given the string `Atari 520ST` it would return `TS025 iratA`. * - * @function Phaser.Utils.String.ReverseString + * @function Phaser.Utils.String.Reverse * @since 3.0.0 * * @param {string} string - The string to be reversed. * * @return {string} The reversed string. */ -var ReverseString = function (string) +var Reverse = function (string) { return string.split('').reverse().join(''); }; -module.exports = ReverseString; +module.exports = Reverse; diff --git a/src/utils/string/UUID.js b/src/utils/string/UUID.js index 285e3f8b2..c5fc3ad33 100644 --- a/src/utils/string/UUID.js +++ b/src/utils/string/UUID.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/string/UppercaseFirst.js b/src/utils/string/UppercaseFirst.js index 307439261..5917120c4 100644 --- a/src/utils/string/UppercaseFirst.js +++ b/src/utils/string/UppercaseFirst.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ diff --git a/src/utils/string/index.js b/src/utils/string/index.js index 61f43a75a..54ab78df3 100644 --- a/src/utils/string/index.js +++ b/src/utils/string/index.js @@ -1,6 +1,6 @@ /** * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. + * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */